lwc 2.14.1 → 2.16.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 +598 -541
- package/dist/engine-dom/iife/es2017/engine-dom.js +600 -540
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +537 -485
- package/dist/engine-dom/iife/es5/engine-dom.js +768 -679
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +692 -621
- package/dist/engine-dom/umd/es2017/engine-dom.js +600 -540
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +537 -485
- package/dist/engine-dom/umd/es5/engine-dom.js +768 -679
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +692 -621
- package/dist/engine-server/commonjs/es2017/engine-server.js +455 -460
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +453 -461
- 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.16.0";
|
|
308
309
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.
|
|
310
|
+
/** version: 2.16.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.16.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,
|
|
@@ -3494,12 +3368,13 @@
|
|
|
3494
3368
|
* SPDX-License-Identifier: MIT
|
|
3495
3369
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3496
3370
|
*/
|
|
3497
|
-
function getUpgradableConstructor(tagName) {
|
|
3371
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3372
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3498
3373
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3499
3374
|
// produce only tags with lowercase letters
|
|
3500
3375
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3501
3376
|
tagName = tagName.toLowerCase();
|
|
3502
|
-
let CE = getCustomElement
|
|
3377
|
+
let CE = getCustomElement(tagName);
|
|
3503
3378
|
if (!isUndefined$1(CE)) {
|
|
3504
3379
|
return CE;
|
|
3505
3380
|
}
|
|
@@ -3507,7 +3382,7 @@
|
|
|
3507
3382
|
* LWC Upgradable Element reference to an element that was created
|
|
3508
3383
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3509
3384
|
*/
|
|
3510
|
-
CE = class LWCUpgradableElement extends
|
|
3385
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3511
3386
|
constructor(upgradeCallback) {
|
|
3512
3387
|
super();
|
|
3513
3388
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3515,7 +3390,7 @@
|
|
|
3515
3390
|
}
|
|
3516
3391
|
}
|
|
3517
3392
|
};
|
|
3518
|
-
defineCustomElement
|
|
3393
|
+
defineCustomElement(tagName, CE);
|
|
3519
3394
|
return CE;
|
|
3520
3395
|
}
|
|
3521
3396
|
|
|
@@ -3540,7 +3415,7 @@
|
|
|
3540
3415
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3541
3416
|
*/
|
|
3542
3417
|
const ColonCharCode = 58;
|
|
3543
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3418
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3544
3419
|
const { attrs } = vnode.data;
|
|
3545
3420
|
if (isUndefined$1(attrs)) {
|
|
3546
3421
|
return;
|
|
@@ -3550,6 +3425,7 @@
|
|
|
3550
3425
|
return;
|
|
3551
3426
|
}
|
|
3552
3427
|
const { elm } = vnode;
|
|
3428
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3553
3429
|
for (const key in attrs) {
|
|
3554
3430
|
const cur = attrs[key];
|
|
3555
3431
|
const old = oldAttrs[key];
|
|
@@ -3557,17 +3433,17 @@
|
|
|
3557
3433
|
unlockAttribute(elm, key);
|
|
3558
3434
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3559
3435
|
// Assume xml namespace
|
|
3560
|
-
setAttribute
|
|
3436
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3561
3437
|
}
|
|
3562
3438
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3563
3439
|
// Assume xlink namespace
|
|
3564
|
-
setAttribute
|
|
3440
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3565
3441
|
}
|
|
3566
3442
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3567
|
-
removeAttribute
|
|
3443
|
+
removeAttribute(elm, key);
|
|
3568
3444
|
}
|
|
3569
3445
|
else {
|
|
3570
|
-
setAttribute
|
|
3446
|
+
setAttribute(elm, key, cur);
|
|
3571
3447
|
}
|
|
3572
3448
|
lockAttribute();
|
|
3573
3449
|
}
|
|
@@ -3585,7 +3461,7 @@
|
|
|
3585
3461
|
// instead of relying on internally tracked values.
|
|
3586
3462
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3587
3463
|
}
|
|
3588
|
-
function patchProps(oldVnode, vnode) {
|
|
3464
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3589
3465
|
const { props } = vnode.data;
|
|
3590
3466
|
if (isUndefined$1(props)) {
|
|
3591
3467
|
return;
|
|
@@ -3596,13 +3472,14 @@
|
|
|
3596
3472
|
}
|
|
3597
3473
|
const isFirstPatch = isNull(oldVnode);
|
|
3598
3474
|
const { elm, sel } = vnode;
|
|
3475
|
+
const { getProperty, setProperty } = renderer;
|
|
3599
3476
|
for (const key in props) {
|
|
3600
3477
|
const cur = props[key];
|
|
3601
3478
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3602
3479
|
// different than the one previously set.
|
|
3603
3480
|
if (isFirstPatch ||
|
|
3604
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3605
|
-
setProperty
|
|
3481
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3482
|
+
setProperty(elm, key, cur);
|
|
3606
3483
|
}
|
|
3607
3484
|
}
|
|
3608
3485
|
}
|
|
@@ -3647,13 +3524,14 @@
|
|
|
3647
3524
|
}
|
|
3648
3525
|
return map;
|
|
3649
3526
|
}
|
|
3650
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3527
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3651
3528
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3652
3529
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3653
3530
|
if (oldClass === newClass) {
|
|
3654
3531
|
return;
|
|
3655
3532
|
}
|
|
3656
|
-
const
|
|
3533
|
+
const { getClassList } = renderer;
|
|
3534
|
+
const classList = getClassList(elm);
|
|
3657
3535
|
const newClassMap = getMapFromClassName(newClass);
|
|
3658
3536
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3659
3537
|
let name;
|
|
@@ -3677,17 +3555,18 @@
|
|
|
3677
3555
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3678
3556
|
*/
|
|
3679
3557
|
// The style property is a string when defined via an expression in the template.
|
|
3680
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3558
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3681
3559
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3682
3560
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3683
3561
|
if (oldStyle === newStyle) {
|
|
3684
3562
|
return;
|
|
3685
3563
|
}
|
|
3564
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3686
3565
|
if (!isString(newStyle) || newStyle === '') {
|
|
3687
|
-
removeAttribute
|
|
3566
|
+
removeAttribute(elm, 'style');
|
|
3688
3567
|
}
|
|
3689
3568
|
else {
|
|
3690
|
-
setAttribute
|
|
3569
|
+
setAttribute(elm, 'style', newStyle);
|
|
3691
3570
|
}
|
|
3692
3571
|
}
|
|
3693
3572
|
|
|
@@ -3697,14 +3576,15 @@
|
|
|
3697
3576
|
* SPDX-License-Identifier: MIT
|
|
3698
3577
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3699
3578
|
*/
|
|
3700
|
-
function applyEventListeners(vnode) {
|
|
3579
|
+
function applyEventListeners(vnode, renderer) {
|
|
3701
3580
|
const { elm, data: { on }, } = vnode;
|
|
3702
3581
|
if (isUndefined$1(on)) {
|
|
3703
3582
|
return;
|
|
3704
3583
|
}
|
|
3584
|
+
const { addEventListener } = renderer;
|
|
3705
3585
|
for (const name in on) {
|
|
3706
3586
|
const handler = on[name];
|
|
3707
|
-
addEventListener
|
|
3587
|
+
addEventListener(elm, name, handler);
|
|
3708
3588
|
}
|
|
3709
3589
|
}
|
|
3710
3590
|
|
|
@@ -3717,12 +3597,13 @@
|
|
|
3717
3597
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3718
3598
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3719
3599
|
// different classnames properties individually instead of via a string.
|
|
3720
|
-
function applyStaticClassAttribute(vnode) {
|
|
3600
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3721
3601
|
const { elm, data: { classMap }, } = vnode;
|
|
3722
3602
|
if (isUndefined$1(classMap)) {
|
|
3723
3603
|
return;
|
|
3724
3604
|
}
|
|
3725
|
-
const
|
|
3605
|
+
const { getClassList } = renderer;
|
|
3606
|
+
const classList = getClassList(elm);
|
|
3726
3607
|
for (const name in classMap) {
|
|
3727
3608
|
classList.add(name);
|
|
3728
3609
|
}
|
|
@@ -3737,14 +3618,15 @@
|
|
|
3737
3618
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3738
3619
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3739
3620
|
// different style properties individually instead of via a string.
|
|
3740
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3621
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3741
3622
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3742
3623
|
if (isUndefined$1(styleDecls)) {
|
|
3743
3624
|
return;
|
|
3744
3625
|
}
|
|
3626
|
+
const { setCSSStyleProperty } = renderer;
|
|
3745
3627
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3746
3628
|
const [prop, value, important] = styleDecls[i];
|
|
3747
|
-
setCSSStyleProperty
|
|
3629
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3748
3630
|
}
|
|
3749
3631
|
}
|
|
3750
3632
|
|
|
@@ -3754,15 +3636,16 @@
|
|
|
3754
3636
|
* SPDX-License-Identifier: MIT
|
|
3755
3637
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3756
3638
|
*/
|
|
3757
|
-
function patchChildren(c1, c2, parent) {
|
|
3639
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3758
3640
|
if (hasDynamicChildren(c2)) {
|
|
3759
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3641
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3760
3642
|
}
|
|
3761
3643
|
else {
|
|
3762
|
-
updateStaticChildren(c1, c2, parent);
|
|
3644
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3763
3645
|
}
|
|
3764
3646
|
}
|
|
3765
|
-
function patch(n1, n2) {
|
|
3647
|
+
function patch(n1, n2, renderer) {
|
|
3648
|
+
var _a, _b;
|
|
3766
3649
|
if (n1 === n2) {
|
|
3767
3650
|
return;
|
|
3768
3651
|
}
|
|
@@ -3776,80 +3659,115 @@
|
|
|
3776
3659
|
}
|
|
3777
3660
|
switch (n2.type) {
|
|
3778
3661
|
case 0 /* Text */:
|
|
3779
|
-
|
|
3662
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3663
|
+
patchText(n1, n2, renderer);
|
|
3780
3664
|
break;
|
|
3781
3665
|
case 1 /* Comment */:
|
|
3782
|
-
|
|
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;
|
|
3783
3671
|
break;
|
|
3784
3672
|
case 2 /* Element */:
|
|
3785
|
-
patchElement(n1, n2);
|
|
3673
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3786
3674
|
break;
|
|
3787
3675
|
case 3 /* CustomElement */:
|
|
3788
|
-
patchCustomElement(n1, n2);
|
|
3676
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3789
3677
|
break;
|
|
3790
3678
|
}
|
|
3791
3679
|
}
|
|
3792
|
-
function mount(node, parent, anchor) {
|
|
3680
|
+
function mount(node, parent, renderer, anchor) {
|
|
3681
|
+
var _a, _b;
|
|
3793
3682
|
switch (node.type) {
|
|
3794
3683
|
case 0 /* Text */:
|
|
3795
|
-
|
|
3684
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3685
|
+
mountText(node, parent, anchor, renderer);
|
|
3796
3686
|
break;
|
|
3797
3687
|
case 1 /* Comment */:
|
|
3798
|
-
|
|
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);
|
|
3799
3694
|
break;
|
|
3800
3695
|
case 2 /* Element */:
|
|
3801
|
-
|
|
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);
|
|
3802
3698
|
break;
|
|
3803
3699
|
case 3 /* CustomElement */:
|
|
3804
|
-
|
|
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);
|
|
3805
3702
|
break;
|
|
3806
3703
|
}
|
|
3807
3704
|
}
|
|
3808
|
-
function patchText(n1, n2) {
|
|
3705
|
+
function patchText(n1, n2, renderer) {
|
|
3809
3706
|
n2.elm = n1.elm;
|
|
3810
3707
|
if (n2.text !== n1.text) {
|
|
3811
|
-
updateTextContent(n2);
|
|
3708
|
+
updateTextContent(n2, renderer);
|
|
3812
3709
|
}
|
|
3813
3710
|
}
|
|
3814
|
-
function mountText(
|
|
3815
|
-
const { owner } =
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3818
|
-
|
|
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);
|
|
3819
3717
|
}
|
|
3820
|
-
function patchComment(n1, n2) {
|
|
3718
|
+
function patchComment(n1, n2, renderer) {
|
|
3821
3719
|
n2.elm = n1.elm;
|
|
3822
3720
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3823
3721
|
// it is the case today.
|
|
3824
3722
|
if (n2.text !== n1.text) {
|
|
3825
|
-
updateTextContent(n2);
|
|
3723
|
+
updateTextContent(n2, renderer);
|
|
3826
3724
|
}
|
|
3827
3725
|
}
|
|
3828
|
-
function mountComment(
|
|
3829
|
-
const { owner } =
|
|
3830
|
-
const
|
|
3831
|
-
|
|
3832
|
-
|
|
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);
|
|
3833
3732
|
}
|
|
3834
|
-
function mountElement(vnode, parent, anchor) {
|
|
3733
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3835
3734
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3735
|
+
const { createElement } = renderer;
|
|
3836
3736
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3837
|
-
const elm = createElement
|
|
3838
|
-
linkNodeToShadow(elm, owner);
|
|
3839
|
-
fallbackElmHook(elm, vnode);
|
|
3737
|
+
const elm = createElement(sel, namespace);
|
|
3738
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3739
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3840
3740
|
vnode.elm = elm;
|
|
3841
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3842
|
-
insertNode(elm, parent, anchor);
|
|
3843
|
-
mountVNodes(vnode.children, elm, null);
|
|
3741
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3742
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3743
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3844
3744
|
}
|
|
3845
|
-
function patchElement(n1, n2) {
|
|
3745
|
+
function patchElement(n1, n2, renderer) {
|
|
3846
3746
|
const elm = (n2.elm = n1.elm);
|
|
3847
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3848
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3747
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3748
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3849
3749
|
}
|
|
3850
|
-
function
|
|
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);
|
|
3767
|
+
}
|
|
3768
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3851
3769
|
const { sel, owner } = vnode;
|
|
3852
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3770
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3853
3771
|
/**
|
|
3854
3772
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3855
3773
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3859,9 +3777,9 @@
|
|
|
3859
3777
|
let vm;
|
|
3860
3778
|
const elm = new UpgradableConstructor((elm) => {
|
|
3861
3779
|
// the custom element from the registry is expecting an upgrade callback
|
|
3862
|
-
vm = createViewModelHook(elm, vnode);
|
|
3780
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3863
3781
|
});
|
|
3864
|
-
linkNodeToShadow(elm, owner);
|
|
3782
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3865
3783
|
vnode.elm = elm;
|
|
3866
3784
|
vnode.vm = vm;
|
|
3867
3785
|
if (vm) {
|
|
@@ -3870,23 +3788,23 @@
|
|
|
3870
3788
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3871
3789
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3872
3790
|
}
|
|
3873
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3874
|
-
insertNode(elm, parent, anchor);
|
|
3791
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3792
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3875
3793
|
if (vm) {
|
|
3876
3794
|
if (process.env.NODE_ENV !== 'production') {
|
|
3877
3795
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3878
3796
|
}
|
|
3879
3797
|
runConnectedCallback(vm);
|
|
3880
3798
|
}
|
|
3881
|
-
mountVNodes(vnode.children, elm, null);
|
|
3799
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3882
3800
|
if (vm) {
|
|
3883
3801
|
appendVM(vm);
|
|
3884
3802
|
}
|
|
3885
3803
|
}
|
|
3886
|
-
function patchCustomElement(n1, n2) {
|
|
3804
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3887
3805
|
const elm = (n2.elm = n1.elm);
|
|
3888
3806
|
const vm = (n2.vm = n1.vm);
|
|
3889
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3807
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3890
3808
|
if (!isUndefined$1(vm)) {
|
|
3891
3809
|
// in fallback mode, the allocation will always set children to
|
|
3892
3810
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3894,34 +3812,36 @@
|
|
|
3894
3812
|
}
|
|
3895
3813
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3896
3814
|
// will happen, but in native, it does allocate the light dom
|
|
3897
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3815
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3898
3816
|
if (!isUndefined$1(vm)) {
|
|
3899
3817
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3900
3818
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3901
3819
|
rerenderVM(vm);
|
|
3902
3820
|
}
|
|
3903
3821
|
}
|
|
3904
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3822
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3905
3823
|
for (; start < end; ++start) {
|
|
3906
3824
|
const vnode = vnodes[start];
|
|
3907
3825
|
if (isVNode(vnode)) {
|
|
3908
|
-
mount(vnode, parent, anchor);
|
|
3826
|
+
mount(vnode, parent, renderer, anchor);
|
|
3909
3827
|
}
|
|
3910
3828
|
}
|
|
3911
3829
|
}
|
|
3912
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3830
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3913
3831
|
const { type, elm, sel } = vnode;
|
|
3914
3832
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3915
3833
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3916
3834
|
if (doRemove) {
|
|
3917
|
-
|
|
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);
|
|
3918
3838
|
}
|
|
3919
3839
|
switch (type) {
|
|
3920
3840
|
case 2 /* Element */: {
|
|
3921
3841
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3922
3842
|
// Only required for synthetic shadow.
|
|
3923
|
-
const
|
|
3924
|
-
unmountVNodes(vnode.children, elm,
|
|
3843
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3844
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3925
3845
|
break;
|
|
3926
3846
|
}
|
|
3927
3847
|
case 3 /* CustomElement */: {
|
|
@@ -3934,11 +3854,11 @@
|
|
|
3934
3854
|
}
|
|
3935
3855
|
}
|
|
3936
3856
|
}
|
|
3937
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3857
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3938
3858
|
for (; start < end; ++start) {
|
|
3939
3859
|
const ch = vnodes[start];
|
|
3940
3860
|
if (isVNode(ch)) {
|
|
3941
|
-
unmount(ch, parent, doRemove);
|
|
3861
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3942
3862
|
}
|
|
3943
3863
|
}
|
|
3944
3864
|
}
|
|
@@ -3952,66 +3872,71 @@
|
|
|
3952
3872
|
elm.$shadowToken$ = token;
|
|
3953
3873
|
}
|
|
3954
3874
|
// Set the scope token class for *.scoped.css styles
|
|
3955
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3875
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3956
3876
|
const { cmpTemplate, context } = owner;
|
|
3877
|
+
const { getClassList } = renderer;
|
|
3957
3878
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3958
3879
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3959
|
-
|
|
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);
|
|
3960
3883
|
}
|
|
3961
3884
|
}
|
|
3962
|
-
function linkNodeToShadow(elm, owner) {
|
|
3885
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3963
3886
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3887
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3964
3888
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3965
|
-
if (isSyntheticShadowDefined
|
|
3889
|
+
if (isSyntheticShadowDefined) {
|
|
3966
3890
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3967
3891
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3968
3892
|
}
|
|
3969
3893
|
}
|
|
3970
3894
|
}
|
|
3971
|
-
function updateTextContent(vnode) {
|
|
3895
|
+
function updateTextContent(vnode, renderer) {
|
|
3972
3896
|
const { elm, text } = vnode;
|
|
3897
|
+
const { setText } = renderer;
|
|
3973
3898
|
if (process.env.NODE_ENV !== 'production') {
|
|
3974
3899
|
unlockDomMutation();
|
|
3975
3900
|
}
|
|
3976
|
-
setText
|
|
3901
|
+
setText(elm, text);
|
|
3977
3902
|
if (process.env.NODE_ENV !== 'production') {
|
|
3978
3903
|
lockDomMutation();
|
|
3979
3904
|
}
|
|
3980
3905
|
}
|
|
3981
|
-
function insertNode(node, parent, anchor) {
|
|
3906
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3982
3907
|
if (process.env.NODE_ENV !== 'production') {
|
|
3983
3908
|
unlockDomMutation();
|
|
3984
3909
|
}
|
|
3985
|
-
insert
|
|
3910
|
+
renderer.insert(node, parent, anchor);
|
|
3986
3911
|
if (process.env.NODE_ENV !== 'production') {
|
|
3987
3912
|
lockDomMutation();
|
|
3988
3913
|
}
|
|
3989
3914
|
}
|
|
3990
|
-
function removeNode(node, parent) {
|
|
3915
|
+
function removeNode(node, parent, renderer) {
|
|
3991
3916
|
if (process.env.NODE_ENV !== 'production') {
|
|
3992
3917
|
unlockDomMutation();
|
|
3993
3918
|
}
|
|
3994
|
-
remove
|
|
3919
|
+
renderer.remove(node, parent);
|
|
3995
3920
|
if (process.env.NODE_ENV !== 'production') {
|
|
3996
3921
|
lockDomMutation();
|
|
3997
3922
|
}
|
|
3998
3923
|
}
|
|
3999
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3924
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
4000
3925
|
if (isNull(oldVnode)) {
|
|
4001
|
-
applyEventListeners(vnode);
|
|
4002
|
-
applyStaticClassAttribute(vnode);
|
|
4003
|
-
applyStaticStyleAttribute(vnode);
|
|
3926
|
+
applyEventListeners(vnode, renderer);
|
|
3927
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3928
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
4004
3929
|
}
|
|
4005
3930
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4006
3931
|
// value is set before type=radio.
|
|
4007
|
-
patchClassAttribute(oldVnode, vnode);
|
|
4008
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
4009
|
-
patchAttributes(oldVnode, vnode);
|
|
4010
|
-
patchProps(oldVnode, vnode);
|
|
3932
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3933
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3934
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3935
|
+
patchProps(oldVnode, vnode, renderer);
|
|
4011
3936
|
}
|
|
4012
|
-
function fallbackElmHook(elm, vnode) {
|
|
3937
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
4013
3938
|
const { owner } = vnode;
|
|
4014
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3939
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4015
3940
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4016
3941
|
const { data: { context }, } = vnode;
|
|
4017
3942
|
const { stylesheetToken } = owner.context;
|
|
@@ -4059,7 +3984,7 @@
|
|
|
4059
3984
|
vnode.children = EmptyArray;
|
|
4060
3985
|
}
|
|
4061
3986
|
}
|
|
4062
|
-
function createViewModelHook(elm, vnode) {
|
|
3987
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
4063
3988
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4064
3989
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4065
3990
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -4068,7 +3993,7 @@
|
|
|
4068
3993
|
return vm;
|
|
4069
3994
|
}
|
|
4070
3995
|
const { sel, mode, ctor, owner } = vnode;
|
|
4071
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3996
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4072
3997
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
4073
3998
|
const { stylesheetToken } = owner.context;
|
|
4074
3999
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -4077,7 +4002,7 @@
|
|
|
4077
4002
|
setElementShadowToken(elm, stylesheetToken);
|
|
4078
4003
|
}
|
|
4079
4004
|
}
|
|
4080
|
-
vm = createVM(elm, ctor, {
|
|
4005
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4081
4006
|
mode,
|
|
4082
4007
|
owner,
|
|
4083
4008
|
tagName: sel,
|
|
@@ -4152,7 +4077,7 @@
|
|
|
4152
4077
|
}
|
|
4153
4078
|
return map;
|
|
4154
4079
|
}
|
|
4155
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
4080
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4156
4081
|
let oldStartIdx = 0;
|
|
4157
4082
|
let newStartIdx = 0;
|
|
4158
4083
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4181,26 +4106,26 @@
|
|
|
4181
4106
|
newEndVnode = newCh[--newEndIdx];
|
|
4182
4107
|
}
|
|
4183
4108
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4184
|
-
patch(oldStartVnode, newStartVnode);
|
|
4109
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4185
4110
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4186
4111
|
newStartVnode = newCh[++newStartIdx];
|
|
4187
4112
|
}
|
|
4188
4113
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4189
|
-
patch(oldEndVnode, newEndVnode);
|
|
4114
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4190
4115
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4191
4116
|
newEndVnode = newCh[--newEndIdx];
|
|
4192
4117
|
}
|
|
4193
4118
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4194
4119
|
// Vnode moved right
|
|
4195
|
-
patch(oldStartVnode, newEndVnode);
|
|
4196
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4120
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4121
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4197
4122
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4198
4123
|
newEndVnode = newCh[--newEndIdx];
|
|
4199
4124
|
}
|
|
4200
4125
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4201
4126
|
// Vnode moved left
|
|
4202
|
-
patch(oldEndVnode, newStartVnode);
|
|
4203
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4127
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4128
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4204
4129
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4205
4130
|
newStartVnode = newCh[++newStartIdx];
|
|
4206
4131
|
}
|
|
@@ -4211,7 +4136,7 @@
|
|
|
4211
4136
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4212
4137
|
if (isUndefined$1(idxInOld)) {
|
|
4213
4138
|
// New element
|
|
4214
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4139
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4215
4140
|
newStartVnode = newCh[++newStartIdx];
|
|
4216
4141
|
}
|
|
4217
4142
|
else {
|
|
@@ -4219,10 +4144,10 @@
|
|
|
4219
4144
|
if (isVNode(elmToMove)) {
|
|
4220
4145
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4221
4146
|
// New element
|
|
4222
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4147
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4223
4148
|
}
|
|
4224
4149
|
else {
|
|
4225
|
-
patch(elmToMove, newStartVnode);
|
|
4150
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4226
4151
|
// Delete the old child, but copy the array since it is read-only.
|
|
4227
4152
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4228
4153
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4234,7 +4159,7 @@
|
|
|
4234
4159
|
}
|
|
4235
4160
|
// We've already cloned at least once, so it's no longer read-only
|
|
4236
4161
|
oldCh[idxInOld] = undefined;
|
|
4237
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4162
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4238
4163
|
}
|
|
4239
4164
|
}
|
|
4240
4165
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4251,25 +4176,25 @@
|
|
|
4251
4176
|
n = newCh[++i];
|
|
4252
4177
|
} while (!isVNode(n) && i < newChEnd);
|
|
4253
4178
|
before = isVNode(n) ? n.elm : null;
|
|
4254
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4179
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4255
4180
|
}
|
|
4256
4181
|
else {
|
|
4257
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4182
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4258
4183
|
}
|
|
4259
4184
|
}
|
|
4260
4185
|
}
|
|
4261
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4186
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4262
4187
|
const c1Length = c1.length;
|
|
4263
4188
|
const c2Length = c2.length;
|
|
4264
4189
|
if (c1Length === 0) {
|
|
4265
4190
|
// the old list is empty, we can directly insert anything new
|
|
4266
|
-
mountVNodes(c2, parent, null);
|
|
4191
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4267
4192
|
return;
|
|
4268
4193
|
}
|
|
4269
4194
|
if (c2Length === 0) {
|
|
4270
4195
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4271
4196
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4272
|
-
unmountVNodes(c1, parent, true);
|
|
4197
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4273
4198
|
return;
|
|
4274
4199
|
}
|
|
4275
4200
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4282,16 +4207,16 @@
|
|
|
4282
4207
|
if (isVNode(n1)) {
|
|
4283
4208
|
if (isVNode(n2)) {
|
|
4284
4209
|
// both vnodes are equivalent, and we just need to patch them
|
|
4285
|
-
patch(n1, n2);
|
|
4210
|
+
patch(n1, n2, renderer);
|
|
4286
4211
|
anchor = n2.elm;
|
|
4287
4212
|
}
|
|
4288
4213
|
else {
|
|
4289
4214
|
// removing the old vnode since the new one is null
|
|
4290
|
-
unmount(n1, parent, true);
|
|
4215
|
+
unmount(n1, parent, renderer, true);
|
|
4291
4216
|
}
|
|
4292
4217
|
}
|
|
4293
4218
|
else if (isVNode(n2)) {
|
|
4294
|
-
mount(n2, parent, anchor);
|
|
4219
|
+
mount(n2, parent, renderer, anchor);
|
|
4295
4220
|
anchor = n2.elm;
|
|
4296
4221
|
}
|
|
4297
4222
|
}
|
|
@@ -4308,6 +4233,17 @@
|
|
|
4308
4233
|
function addVNodeToChildLWC(vnode) {
|
|
4309
4234
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4310
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
|
+
}
|
|
4311
4247
|
// [h]tml node
|
|
4312
4248
|
function h(sel, data, children = EmptyArray) {
|
|
4313
4249
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -4697,6 +4633,7 @@
|
|
|
4697
4633
|
co,
|
|
4698
4634
|
dc,
|
|
4699
4635
|
ti,
|
|
4636
|
+
st,
|
|
4700
4637
|
gid,
|
|
4701
4638
|
fid,
|
|
4702
4639
|
shc,
|
|
@@ -4720,7 +4657,7 @@
|
|
|
4720
4657
|
}, [api.t(content)]);
|
|
4721
4658
|
}
|
|
4722
4659
|
function updateStylesheetToken(vm, template) {
|
|
4723
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4660
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4724
4661
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4725
4662
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4726
4663
|
const { hasScopedStyles } = context;
|
|
@@ -4731,10 +4668,10 @@
|
|
|
4731
4668
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4732
4669
|
if (!isUndefined$1(oldToken)) {
|
|
4733
4670
|
if (oldHasTokenInClass) {
|
|
4734
|
-
getClassList
|
|
4671
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4735
4672
|
}
|
|
4736
4673
|
if (oldHasTokenInAttribute) {
|
|
4737
|
-
removeAttribute
|
|
4674
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4738
4675
|
}
|
|
4739
4676
|
}
|
|
4740
4677
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4745,11 +4682,11 @@
|
|
|
4745
4682
|
// Set the new styling token on the host element
|
|
4746
4683
|
if (!isUndefined$1(newToken)) {
|
|
4747
4684
|
if (hasScopedStyles) {
|
|
4748
|
-
getClassList
|
|
4685
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4749
4686
|
newHasTokenInClass = true;
|
|
4750
4687
|
}
|
|
4751
4688
|
if (isSyntheticShadow) {
|
|
4752
|
-
setAttribute
|
|
4689
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4753
4690
|
newHasTokenInAttribute = true;
|
|
4754
4691
|
}
|
|
4755
4692
|
}
|
|
@@ -4837,19 +4774,18 @@
|
|
|
4837
4774
|
return owner;
|
|
4838
4775
|
}
|
|
4839
4776
|
function createStylesheet(vm, stylesheets) {
|
|
4840
|
-
const { renderMode, shadowMode } = vm;
|
|
4777
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4841
4778
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4842
4779
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4843
|
-
insertStylesheet
|
|
4780
|
+
insertStylesheet(stylesheets[i]);
|
|
4844
4781
|
}
|
|
4845
4782
|
}
|
|
4846
|
-
else if (ssr
|
|
4783
|
+
else if (ssr || vm.hydrated) {
|
|
4847
4784
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4848
4785
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4849
4786
|
// the first time the VM renders.
|
|
4850
4787
|
// native shadow or light DOM, SSR
|
|
4851
|
-
|
|
4852
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
4788
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4853
4789
|
}
|
|
4854
4790
|
else {
|
|
4855
4791
|
// native shadow or light DOM, DOM renderer
|
|
@@ -4857,7 +4793,7 @@
|
|
|
4857
4793
|
// null root means a global style
|
|
4858
4794
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4859
4795
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4860
|
-
insertStylesheet
|
|
4796
|
+
insertStylesheet(stylesheets[i], target);
|
|
4861
4797
|
}
|
|
4862
4798
|
}
|
|
4863
4799
|
return null;
|
|
@@ -5017,6 +4953,59 @@
|
|
|
5017
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"`);
|
|
5018
4954
|
}
|
|
5019
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
|
+
});
|
|
5020
5009
|
function evaluateTemplate(vm, html) {
|
|
5021
5010
|
if (process.env.NODE_ENV !== 'production') {
|
|
5022
5011
|
assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
|
|
@@ -5063,7 +5052,7 @@
|
|
|
5063
5052
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
5064
5053
|
// re-rendering.
|
|
5065
5054
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5066
|
-
context.
|
|
5055
|
+
context.styleVNodes =
|
|
5067
5056
|
stylesheetsContent.length === 0
|
|
5068
5057
|
? null
|
|
5069
5058
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -5080,9 +5069,9 @@
|
|
|
5080
5069
|
// Set the global flag that template is being updated
|
|
5081
5070
|
isUpdatingTemplate = true;
|
|
5082
5071
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
5083
|
-
const {
|
|
5084
|
-
if (!isNull(
|
|
5085
|
-
ArrayUnshift.
|
|
5072
|
+
const { styleVNodes } = context;
|
|
5073
|
+
if (!isNull(styleVNodes)) {
|
|
5074
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
5086
5075
|
}
|
|
5087
5076
|
});
|
|
5088
5077
|
}, () => {
|
|
@@ -5412,7 +5401,7 @@
|
|
|
5412
5401
|
return ancestor;
|
|
5413
5402
|
}
|
|
5414
5403
|
|
|
5415
|
-
function createVM(elm, ctor, options) {
|
|
5404
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5416
5405
|
const {
|
|
5417
5406
|
mode,
|
|
5418
5407
|
owner,
|
|
@@ -5447,7 +5436,7 @@
|
|
|
5447
5436
|
hasTokenInClass: undefined,
|
|
5448
5437
|
hasTokenInAttribute: undefined,
|
|
5449
5438
|
hasScopedStyles: undefined,
|
|
5450
|
-
|
|
5439
|
+
styleVNodes: null,
|
|
5451
5440
|
tplCache: EmptyObject,
|
|
5452
5441
|
wiredConnecting: EmptyArray,
|
|
5453
5442
|
wiredDisconnecting: EmptyArray
|
|
@@ -5461,9 +5450,10 @@
|
|
|
5461
5450
|
renderRoot: null,
|
|
5462
5451
|
callHook,
|
|
5463
5452
|
setHook,
|
|
5464
|
-
getHook
|
|
5453
|
+
getHook,
|
|
5454
|
+
renderer
|
|
5465
5455
|
};
|
|
5466
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5456
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5467
5457
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5468
5458
|
|
|
5469
5459
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5488,13 +5478,17 @@
|
|
|
5488
5478
|
return vm;
|
|
5489
5479
|
}
|
|
5490
5480
|
|
|
5491
|
-
function computeShadowMode(vm) {
|
|
5481
|
+
function computeShadowMode(vm, renderer) {
|
|
5492
5482
|
const {
|
|
5493
5483
|
def
|
|
5494
5484
|
} = vm;
|
|
5485
|
+
const {
|
|
5486
|
+
isSyntheticShadowDefined,
|
|
5487
|
+
isNativeShadowDefined
|
|
5488
|
+
} = renderer;
|
|
5495
5489
|
let shadowMode;
|
|
5496
5490
|
|
|
5497
|
-
if (isSyntheticShadowDefined
|
|
5491
|
+
if (isSyntheticShadowDefined) {
|
|
5498
5492
|
if (def.renderMode === 0
|
|
5499
5493
|
/* Light */
|
|
5500
5494
|
) {
|
|
@@ -5503,7 +5497,7 @@
|
|
|
5503
5497
|
shadowMode = 0
|
|
5504
5498
|
/* Native */
|
|
5505
5499
|
;
|
|
5506
|
-
} else if (isNativeShadowDefined
|
|
5500
|
+
} else if (isNativeShadowDefined) {
|
|
5507
5501
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5508
5502
|
// the if-condition.
|
|
5509
5503
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5593,7 +5587,8 @@
|
|
|
5593
5587
|
function patchShadowRoot(vm, newCh) {
|
|
5594
5588
|
const {
|
|
5595
5589
|
renderRoot,
|
|
5596
|
-
children: oldCh
|
|
5590
|
+
children: oldCh,
|
|
5591
|
+
renderer
|
|
5597
5592
|
} = vm; // caching the new children collection
|
|
5598
5593
|
|
|
5599
5594
|
vm.children = newCh;
|
|
@@ -5609,7 +5604,7 @@
|
|
|
5609
5604
|
, vm);
|
|
5610
5605
|
}, () => {
|
|
5611
5606
|
// job
|
|
5612
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5607
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5613
5608
|
}, () => {
|
|
5614
5609
|
// post
|
|
5615
5610
|
logOperationEnd(2
|
|
@@ -5634,10 +5629,13 @@
|
|
|
5634
5629
|
const {
|
|
5635
5630
|
def: {
|
|
5636
5631
|
renderedCallback
|
|
5632
|
+
},
|
|
5633
|
+
renderer: {
|
|
5634
|
+
ssr
|
|
5637
5635
|
}
|
|
5638
5636
|
} = vm;
|
|
5639
5637
|
|
|
5640
|
-
if (isTrue(ssr
|
|
5638
|
+
if (isTrue(ssr)) {
|
|
5641
5639
|
return;
|
|
5642
5640
|
}
|
|
5643
5641
|
|
|
@@ -5871,14 +5869,17 @@
|
|
|
5871
5869
|
function resetComponentRoot(vm) {
|
|
5872
5870
|
const {
|
|
5873
5871
|
children,
|
|
5874
|
-
renderRoot
|
|
5872
|
+
renderRoot,
|
|
5873
|
+
renderer: {
|
|
5874
|
+
remove
|
|
5875
|
+
}
|
|
5875
5876
|
} = vm;
|
|
5876
5877
|
|
|
5877
5878
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5878
5879
|
const child = children[i];
|
|
5879
5880
|
|
|
5880
5881
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5881
|
-
remove
|
|
5882
|
+
remove(child.elm, renderRoot);
|
|
5882
5883
|
}
|
|
5883
5884
|
}
|
|
5884
5885
|
|
|
@@ -5887,7 +5888,13 @@
|
|
|
5887
5888
|
vm.velements = EmptyArray;
|
|
5888
5889
|
}
|
|
5889
5890
|
function scheduleRehydration(vm) {
|
|
5890
|
-
|
|
5891
|
+
const {
|
|
5892
|
+
renderer: {
|
|
5893
|
+
ssr
|
|
5894
|
+
}
|
|
5895
|
+
} = vm;
|
|
5896
|
+
|
|
5897
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5891
5898
|
return;
|
|
5892
5899
|
}
|
|
5893
5900
|
|
|
@@ -6063,6 +6070,9 @@
|
|
|
6063
6070
|
context: {
|
|
6064
6071
|
wiredConnecting,
|
|
6065
6072
|
wiredDisconnecting
|
|
6073
|
+
},
|
|
6074
|
+
renderer: {
|
|
6075
|
+
dispatchEvent
|
|
6066
6076
|
}
|
|
6067
6077
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
6068
6078
|
|
|
@@ -6086,7 +6096,7 @@
|
|
|
6086
6096
|
}
|
|
6087
6097
|
|
|
6088
6098
|
});
|
|
6089
|
-
dispatchEvent
|
|
6099
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
6090
6100
|
});
|
|
6091
6101
|
}
|
|
6092
6102
|
|
|
@@ -6334,95 +6344,116 @@
|
|
|
6334
6344
|
function hydrateVM(vm) {
|
|
6335
6345
|
const children = renderComponent(vm);
|
|
6336
6346
|
vm.children = children;
|
|
6337
|
-
const parentNode = vm
|
|
6338
|
-
hydrateChildren(getFirstChild
|
|
6347
|
+
const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
|
|
6348
|
+
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
|
|
6339
6349
|
runRenderedCallback(vm);
|
|
6340
6350
|
}
|
|
6341
|
-
function hydrateNode(node, vnode) {
|
|
6351
|
+
function hydrateNode(node, vnode, renderer) {
|
|
6352
|
+
var _a, _b;
|
|
6342
6353
|
let hydratedNode;
|
|
6343
6354
|
switch (vnode.type) {
|
|
6344
6355
|
case 0 /* Text */:
|
|
6345
|
-
|
|
6356
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
6357
|
+
hydratedNode = hydrateText(node, vnode, renderer);
|
|
6346
6358
|
break;
|
|
6347
6359
|
case 1 /* Comment */:
|
|
6348
|
-
|
|
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);
|
|
6349
6366
|
break;
|
|
6350
6367
|
case 2 /* Element */:
|
|
6351
|
-
hydratedNode = hydrateElement(node, vnode);
|
|
6368
|
+
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
6352
6369
|
break;
|
|
6353
6370
|
case 3 /* CustomElement */:
|
|
6354
|
-
hydratedNode = hydrateCustomElement(node, vnode);
|
|
6371
|
+
hydratedNode = hydrateCustomElement(node, vnode, (_b = vnode.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
6355
6372
|
break;
|
|
6356
6373
|
}
|
|
6357
|
-
return nextSibling
|
|
6374
|
+
return renderer.nextSibling(hydratedNode);
|
|
6358
6375
|
}
|
|
6359
|
-
function hydrateText(node, vnode) {
|
|
6376
|
+
function hydrateText(node, vnode, renderer) {
|
|
6360
6377
|
var _a;
|
|
6361
|
-
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT
|
|
6362
|
-
return handleMismatch(node, vnode);
|
|
6378
|
+
if (!hasCorrectNodeType(vnode, node, 3 /* TEXT */, renderer)) {
|
|
6379
|
+
return handleMismatch(node, vnode, renderer);
|
|
6363
6380
|
}
|
|
6364
6381
|
if (process.env.NODE_ENV !== 'production') {
|
|
6365
|
-
const
|
|
6382
|
+
const { getProperty } = renderer;
|
|
6383
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6366
6384
|
if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
|
|
6367
6385
|
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6368
6386
|
}
|
|
6369
6387
|
}
|
|
6370
|
-
setText
|
|
6388
|
+
const { setText } = renderer;
|
|
6389
|
+
setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6371
6390
|
vnode.elm = node;
|
|
6372
6391
|
return node;
|
|
6373
6392
|
}
|
|
6374
|
-
function hydrateComment(node, vnode) {
|
|
6393
|
+
function hydrateComment(node, vnode, renderer) {
|
|
6375
6394
|
var _a;
|
|
6376
|
-
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT
|
|
6377
|
-
return handleMismatch(node, vnode);
|
|
6395
|
+
if (!hasCorrectNodeType(vnode, node, 8 /* COMMENT */, renderer)) {
|
|
6396
|
+
return handleMismatch(node, vnode, renderer);
|
|
6378
6397
|
}
|
|
6379
6398
|
if (process.env.NODE_ENV !== 'production') {
|
|
6380
|
-
const
|
|
6399
|
+
const { getProperty } = renderer;
|
|
6400
|
+
const nodeValue = getProperty(node, 'nodeValue');
|
|
6381
6401
|
if (nodeValue !== vnode.text) {
|
|
6382
6402
|
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6383
6403
|
}
|
|
6384
6404
|
}
|
|
6385
|
-
setProperty
|
|
6405
|
+
const { setProperty } = renderer;
|
|
6406
|
+
setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6386
6407
|
vnode.elm = node;
|
|
6387
6408
|
return node;
|
|
6388
6409
|
}
|
|
6389
|
-
function
|
|
6390
|
-
if (!
|
|
6391
|
-
|
|
6392
|
-
return handleMismatch(elm, vnode);
|
|
6410
|
+
function hydrateStaticElement(elm, vnode, renderer) {
|
|
6411
|
+
if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
6412
|
+
return handleMismatch(elm, vnode, renderer);
|
|
6393
6413
|
}
|
|
6394
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;
|
|
6395
6424
|
const { context } = vnode.data;
|
|
6396
6425
|
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual" /* Manual */);
|
|
6397
6426
|
if (isDomManual) {
|
|
6398
6427
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6399
6428
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6400
|
-
const { props } = vnode
|
|
6429
|
+
const { data: { props }, } = vnode;
|
|
6430
|
+
const { getProperty } = renderer;
|
|
6401
6431
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6402
|
-
if (getProperty
|
|
6432
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6403
6433
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6404
6434
|
vnode.data = Object.assign(Object.assign({}, vnode.data), { props: cloneAndOmitKey(props, 'innerHTML') });
|
|
6405
6435
|
}
|
|
6406
6436
|
else {
|
|
6407
6437
|
if (process.env.NODE_ENV !== 'production') {
|
|
6408
|
-
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);
|
|
6409
6439
|
}
|
|
6410
6440
|
}
|
|
6411
6441
|
}
|
|
6412
6442
|
}
|
|
6413
|
-
patchElementPropsAndAttrs(vnode);
|
|
6443
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6414
6444
|
if (!isDomManual) {
|
|
6415
|
-
|
|
6445
|
+
const { getFirstChild } = renderer;
|
|
6446
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6416
6447
|
}
|
|
6417
6448
|
return elm;
|
|
6418
6449
|
}
|
|
6419
|
-
function hydrateCustomElement(elm, vnode) {
|
|
6420
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT
|
|
6421
|
-
!isMatchingElement(vnode, elm)) {
|
|
6422
|
-
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);
|
|
6423
6454
|
}
|
|
6424
6455
|
const { sel, mode, ctor, owner } = vnode;
|
|
6425
|
-
const vm = createVM(elm, ctor, {
|
|
6456
|
+
const vm = createVM(elm, ctor, renderer, {
|
|
6426
6457
|
mode,
|
|
6427
6458
|
owner,
|
|
6428
6459
|
tagName: sel,
|
|
@@ -6431,16 +6462,17 @@
|
|
|
6431
6462
|
vnode.elm = elm;
|
|
6432
6463
|
vnode.vm = vm;
|
|
6433
6464
|
allocateChildren(vnode, vm);
|
|
6434
|
-
patchElementPropsAndAttrs(vnode);
|
|
6465
|
+
patchElementPropsAndAttrs(vnode, renderer);
|
|
6435
6466
|
// Insert hook section:
|
|
6436
6467
|
if (process.env.NODE_ENV !== 'production') {
|
|
6437
6468
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
6438
6469
|
}
|
|
6439
6470
|
runConnectedCallback(vm);
|
|
6440
6471
|
if (vm.renderMode !== 0 /* Light */) {
|
|
6472
|
+
const { getFirstChild } = renderer;
|
|
6441
6473
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6442
6474
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6443
|
-
hydrateChildren(getFirstChild
|
|
6475
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6444
6476
|
}
|
|
6445
6477
|
hydrateVM(vm);
|
|
6446
6478
|
return elm;
|
|
@@ -6449,11 +6481,12 @@
|
|
|
6449
6481
|
let hasWarned = false;
|
|
6450
6482
|
let nextNode = node;
|
|
6451
6483
|
let anchor = null;
|
|
6484
|
+
const { renderer } = owner;
|
|
6452
6485
|
for (let i = 0; i < children.length; i++) {
|
|
6453
6486
|
const childVnode = children[i];
|
|
6454
6487
|
if (!isNull(childVnode)) {
|
|
6455
6488
|
if (nextNode) {
|
|
6456
|
-
nextNode = hydrateNode(nextNode, childVnode);
|
|
6489
|
+
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
6457
6490
|
anchor = childVnode.elm;
|
|
6458
6491
|
}
|
|
6459
6492
|
else {
|
|
@@ -6464,7 +6497,7 @@
|
|
|
6464
6497
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Client produced more nodes than the server.`, owner);
|
|
6465
6498
|
}
|
|
6466
6499
|
}
|
|
6467
|
-
mount(childVnode, parentNode, anchor);
|
|
6500
|
+
mount(childVnode, parentNode, renderer, anchor);
|
|
6468
6501
|
anchor = childVnode.elm;
|
|
6469
6502
|
}
|
|
6470
6503
|
}
|
|
@@ -6476,31 +6509,33 @@
|
|
|
6476
6509
|
logError(`Hydration mismatch: incorrect number of rendered nodes. Server rendered more nodes than the client.`, owner);
|
|
6477
6510
|
}
|
|
6478
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;
|
|
6479
6517
|
do {
|
|
6480
6518
|
const current = nextNode;
|
|
6481
|
-
nextNode = nextSibling
|
|
6482
|
-
removeNode(current, parentNode);
|
|
6519
|
+
nextNode = nextSibling(nextNode);
|
|
6520
|
+
removeNode(current, parentNode, renderer);
|
|
6483
6521
|
} while (nextNode);
|
|
6484
6522
|
}
|
|
6485
6523
|
}
|
|
6486
|
-
function handleMismatch(node, vnode,
|
|
6524
|
+
function handleMismatch(node, vnode, renderer) {
|
|
6487
6525
|
hasMismatch = true;
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
}
|
|
6493
|
-
const parentNode = getProperty$1(node, 'parentNode');
|
|
6494
|
-
mount(vnode, parentNode, node);
|
|
6495
|
-
removeNode(node, parentNode);
|
|
6526
|
+
const { getProperty } = renderer;
|
|
6527
|
+
const parentNode = getProperty(node, 'parentNode');
|
|
6528
|
+
mount(vnode, parentNode, renderer, node);
|
|
6529
|
+
removeNode(node, parentNode, renderer);
|
|
6496
6530
|
return vnode.elm;
|
|
6497
6531
|
}
|
|
6498
|
-
function patchElementPropsAndAttrs(vnode) {
|
|
6499
|
-
applyEventListeners(vnode);
|
|
6500
|
-
patchProps(null, vnode);
|
|
6532
|
+
function patchElementPropsAndAttrs(vnode, renderer) {
|
|
6533
|
+
applyEventListeners(vnode, renderer);
|
|
6534
|
+
patchProps(null, vnode, renderer);
|
|
6501
6535
|
}
|
|
6502
|
-
function hasCorrectNodeType(vnode, node, nodeType) {
|
|
6503
|
-
|
|
6536
|
+
function hasCorrectNodeType(vnode, node, nodeType, renderer) {
|
|
6537
|
+
const { getProperty } = renderer;
|
|
6538
|
+
if (getProperty(node, 'nodeType') !== nodeType) {
|
|
6504
6539
|
if (process.env.NODE_ENV !== 'production') {
|
|
6505
6540
|
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6506
6541
|
}
|
|
@@ -6508,46 +6543,51 @@
|
|
|
6508
6543
|
}
|
|
6509
6544
|
return true;
|
|
6510
6545
|
}
|
|
6511
|
-
function isMatchingElement(vnode, elm) {
|
|
6512
|
-
|
|
6546
|
+
function isMatchingElement(vnode, elm, renderer) {
|
|
6547
|
+
const { getProperty } = renderer;
|
|
6548
|
+
if (vnode.sel.toLowerCase() !== getProperty(elm, 'tagName').toLowerCase()) {
|
|
6513
6549
|
if (process.env.NODE_ENV !== 'production') {
|
|
6514
|
-
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);
|
|
6515
6551
|
}
|
|
6516
6552
|
return false;
|
|
6517
6553
|
}
|
|
6518
|
-
const hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6519
|
-
const hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6520
|
-
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);
|
|
6521
6557
|
return hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6522
6558
|
}
|
|
6523
|
-
function validateAttrs(vnode, elm) {
|
|
6559
|
+
function validateAttrs(vnode, elm, renderer) {
|
|
6524
6560
|
const { data: { attrs = {} }, } = vnode;
|
|
6525
6561
|
let nodesAreCompatible = true;
|
|
6526
6562
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6527
6563
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6528
6564
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
6529
|
-
const
|
|
6565
|
+
const { owner } = vnode;
|
|
6566
|
+
const { getAttribute } = renderer;
|
|
6567
|
+
const elmAttrValue = getAttribute(elm, attrName);
|
|
6530
6568
|
if (String(attrValue) !== elmAttrValue) {
|
|
6531
6569
|
if (process.env.NODE_ENV !== 'production') {
|
|
6532
|
-
|
|
6570
|
+
const { getProperty } = renderer;
|
|
6571
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
|
|
6533
6572
|
}
|
|
6534
6573
|
nodesAreCompatible = false;
|
|
6535
6574
|
}
|
|
6536
6575
|
}
|
|
6537
6576
|
return nodesAreCompatible;
|
|
6538
6577
|
}
|
|
6539
|
-
function validateClassAttr(vnode, elm) {
|
|
6578
|
+
function validateClassAttr(vnode, elm, renderer) {
|
|
6540
6579
|
const { data: { className, classMap }, } = vnode;
|
|
6580
|
+
const { getProperty, getClassList } = renderer;
|
|
6541
6581
|
let nodesAreCompatible = true;
|
|
6542
6582
|
let vnodeClassName;
|
|
6543
|
-
if (!isUndefined$1(className) && String(className) !== getProperty
|
|
6583
|
+
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
6544
6584
|
// className is used when class is bound to an expr.
|
|
6545
6585
|
nodesAreCompatible = false;
|
|
6546
6586
|
vnodeClassName = className;
|
|
6547
6587
|
}
|
|
6548
6588
|
else if (!isUndefined$1(classMap)) {
|
|
6549
6589
|
// classMap is used when class is set to static value.
|
|
6550
|
-
const classList = getClassList
|
|
6590
|
+
const classList = getClassList(elm);
|
|
6551
6591
|
let computedClassName = '';
|
|
6552
6592
|
// all classes from the vnode should be in the element.classList
|
|
6553
6593
|
for (const name in classMap) {
|
|
@@ -6563,14 +6603,15 @@
|
|
|
6563
6603
|
}
|
|
6564
6604
|
if (!nodesAreCompatible) {
|
|
6565
6605
|
if (process.env.NODE_ENV !== 'production') {
|
|
6566
|
-
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);
|
|
6567
6607
|
}
|
|
6568
6608
|
}
|
|
6569
6609
|
return nodesAreCompatible;
|
|
6570
6610
|
}
|
|
6571
|
-
function validateStyleAttr(vnode, elm) {
|
|
6611
|
+
function validateStyleAttr(vnode, elm, renderer) {
|
|
6572
6612
|
const { data: { style, styleDecls }, } = vnode;
|
|
6573
|
-
const
|
|
6613
|
+
const { getAttribute } = renderer;
|
|
6614
|
+
const elmStyle = getAttribute(elm, 'style') || '';
|
|
6574
6615
|
let vnodeStyle;
|
|
6575
6616
|
let nodesAreCompatible = true;
|
|
6576
6617
|
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
@@ -6602,11 +6643,45 @@
|
|
|
6602
6643
|
}
|
|
6603
6644
|
if (!nodesAreCompatible) {
|
|
6604
6645
|
if (process.env.NODE_ENV !== 'production') {
|
|
6605
|
-
|
|
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);
|
|
6606
6648
|
}
|
|
6607
6649
|
}
|
|
6608
6650
|
return nodesAreCompatible;
|
|
6609
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
|
+
}
|
|
6610
6685
|
|
|
6611
6686
|
/*
|
|
6612
6687
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6742,7 +6817,7 @@
|
|
|
6742
6817
|
}
|
|
6743
6818
|
return ctor;
|
|
6744
6819
|
}
|
|
6745
|
-
/* version: 2.
|
|
6820
|
+
/* version: 2.16.0 */
|
|
6746
6821
|
|
|
6747
6822
|
/*
|
|
6748
6823
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6901,7 +6976,7 @@
|
|
|
6901
6976
|
try {
|
|
6902
6977
|
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
6903
6978
|
// _wrapNativeSuper()
|
|
6904
|
-
// This is a problem because LWCUpgradableElement extends renderer.
|
|
6979
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6905
6980
|
// get wrapped by babel.
|
|
6906
6981
|
const HTMLElementAlias = HTMLElement;
|
|
6907
6982
|
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
@@ -6955,8 +7030,17 @@
|
|
|
6955
7030
|
hydrating = value;
|
|
6956
7031
|
}
|
|
6957
7032
|
const ssr = false;
|
|
7033
|
+
function isHydrating() {
|
|
7034
|
+
return hydrating;
|
|
7035
|
+
}
|
|
6958
7036
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6959
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
|
+
}
|
|
6960
7044
|
function createElement$1(tagName, namespace) {
|
|
6961
7045
|
return isUndefined$1(namespace)
|
|
6962
7046
|
? document.createElement(tagName)
|
|
@@ -7073,76 +7157,49 @@
|
|
|
7073
7157
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7074
7158
|
}
|
|
7075
7159
|
const HTMLElementExported = HTMLElementConstructor;
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
setAddEventListener(addEventListener);
|
|
7120
|
-
setInsertStylesheet(insertStylesheet);
|
|
7121
|
-
|
|
7122
|
-
/*
|
|
7123
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7124
|
-
* All rights reserved.
|
|
7125
|
-
* SPDX-License-Identifier: MIT
|
|
7126
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7127
|
-
*/
|
|
7128
|
-
// @ts-ignore
|
|
7129
|
-
|
|
7130
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7131
|
-
window.addEventListener('test-dummy-flag', () => {
|
|
7132
|
-
let hasFlag = false;
|
|
7133
|
-
|
|
7134
|
-
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7135
|
-
hasFlag = true;
|
|
7136
|
-
}
|
|
7137
|
-
|
|
7138
|
-
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7139
|
-
detail: {
|
|
7140
|
-
package: '@lwc/engine-dom',
|
|
7141
|
-
hasFlag
|
|
7142
|
-
}
|
|
7143
|
-
}));
|
|
7144
|
-
});
|
|
7145
|
-
}
|
|
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
|
+
};
|
|
7146
7203
|
|
|
7147
7204
|
/*
|
|
7148
7205
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7164,7 +7221,7 @@
|
|
|
7164
7221
|
}
|
|
7165
7222
|
}
|
|
7166
7223
|
function createVMWithProps(element, Ctor, props) {
|
|
7167
|
-
const vm = createVM(element, Ctor, {
|
|
7224
|
+
const vm = createVM(element, Ctor, renderer, {
|
|
7168
7225
|
mode: 'open',
|
|
7169
7226
|
owner: null,
|
|
7170
7227
|
tagName: element.tagName.toLowerCase(),
|
|
@@ -7260,7 +7317,7 @@
|
|
|
7260
7317
|
hydratedCustomElements.add(this);
|
|
7261
7318
|
}
|
|
7262
7319
|
else {
|
|
7263
|
-
createVM(this, Ctor, {
|
|
7320
|
+
createVM(this, Ctor, renderer, {
|
|
7264
7321
|
mode: 'open',
|
|
7265
7322
|
owner: null,
|
|
7266
7323
|
tagName: this.tagName,
|
|
@@ -7345,7 +7402,7 @@
|
|
|
7345
7402
|
if (!isFunction$1(Ctor)) {
|
|
7346
7403
|
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
7347
7404
|
}
|
|
7348
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
7405
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
7349
7406
|
let wasComponentUpgraded = false;
|
|
7350
7407
|
// the custom element from the registry is expecting an upgrade callback
|
|
7351
7408
|
/**
|
|
@@ -7355,7 +7412,7 @@
|
|
|
7355
7412
|
* an upgradable custom element.
|
|
7356
7413
|
*/
|
|
7357
7414
|
const element = new UpgradableConstructor((elm) => {
|
|
7358
|
-
createVM(elm, Ctor, {
|
|
7415
|
+
createVM(elm, Ctor, renderer, {
|
|
7359
7416
|
tagName: sel,
|
|
7360
7417
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7361
7418
|
owner: null,
|
|
@@ -7439,7 +7496,7 @@
|
|
|
7439
7496
|
});
|
|
7440
7497
|
freeze(LightningElement);
|
|
7441
7498
|
seal(LightningElement.prototype);
|
|
7442
|
-
/* version: 2.
|
|
7499
|
+
/* version: 2.16.0 */
|
|
7443
7500
|
|
|
7444
7501
|
exports.LightningElement = LightningElement;
|
|
7445
7502
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7453,11 +7510,14 @@
|
|
|
7453
7510
|
exports.hydrateComponent = hydrateComponent;
|
|
7454
7511
|
exports.isComponentConstructor = isComponentConstructor;
|
|
7455
7512
|
exports.isNodeFromTemplate = isNodeShadowed;
|
|
7513
|
+
exports.parseFragment = parseFragment;
|
|
7514
|
+
exports.parseSVGFragment = parseSVGFragment;
|
|
7456
7515
|
exports.readonly = readonly;
|
|
7457
7516
|
exports.register = register;
|
|
7458
7517
|
exports.registerComponent = registerComponent;
|
|
7459
7518
|
exports.registerDecorators = registerDecorators;
|
|
7460
7519
|
exports.registerTemplate = registerTemplate;
|
|
7520
|
+
exports.renderer = renderer;
|
|
7461
7521
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7462
7522
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7463
7523
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|