lwc 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +637 -554
- package/dist/engine-dom/iife/es2017/engine-dom.js +639 -553
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +574 -497
- package/dist/engine-dom/iife/es5/engine-dom.js +807 -694
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +729 -634
- package/dist/engine-dom/umd/es2017/engine-dom.js +639 -553
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +574 -497
- package/dist/engine-dom/umd/es5/engine-dom.js +807 -694
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +729 -634
- package/dist/engine-server/commonjs/es2017/engine-server.js +494 -473
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +492 -474
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +29 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +29 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -225,6 +225,7 @@ const _globalThis = /*@__PURE__*/ (function () {
|
|
|
225
225
|
return _globalThis;
|
|
226
226
|
})();
|
|
227
227
|
const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
228
|
+
const KEY__SHADOW_STATIC = '$shadowStaticNode$';
|
|
228
229
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
229
230
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
230
231
|
|
|
@@ -406,6 +407,24 @@ function htmlPropertyToAttribute(propName) {
|
|
|
406
407
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
407
408
|
return attributeName;
|
|
408
409
|
}
|
|
410
|
+
|
|
411
|
+
/*
|
|
412
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
413
|
+
* All rights reserved.
|
|
414
|
+
* SPDX-License-Identifier: MIT
|
|
415
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
416
|
+
*/
|
|
417
|
+
const ESCAPED_CHARS = {
|
|
418
|
+
'"': '"',
|
|
419
|
+
"'": ''',
|
|
420
|
+
'<': '<',
|
|
421
|
+
'>': '>',
|
|
422
|
+
'&': '&',
|
|
423
|
+
};
|
|
424
|
+
function htmlEscape(str, attrMode = false) {
|
|
425
|
+
const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
|
|
426
|
+
return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
|
|
427
|
+
}
|
|
409
428
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
410
429
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
411
430
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -417,9 +436,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
417
436
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
418
437
|
*/
|
|
419
438
|
// Increment whenever the LWC template compiler changes
|
|
420
|
-
const LWC_VERSION = "2.
|
|
439
|
+
const LWC_VERSION = "2.15.0";
|
|
421
440
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
422
|
-
/** version: 2.
|
|
441
|
+
/** version: 2.15.0 */
|
|
423
442
|
|
|
424
443
|
/*
|
|
425
444
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -528,7 +547,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
528
547
|
setFeatureFlag(name, value);
|
|
529
548
|
}
|
|
530
549
|
}
|
|
531
|
-
/** version: 2.
|
|
550
|
+
/** version: 2.15.0 */
|
|
532
551
|
|
|
533
552
|
/* proxy-compat-disable */
|
|
534
553
|
|
|
@@ -611,162 +630,6 @@ function flattenStylesheets(stylesheets) {
|
|
|
611
630
|
return list;
|
|
612
631
|
}
|
|
613
632
|
|
|
614
|
-
//
|
|
615
|
-
// Primitives
|
|
616
|
-
//
|
|
617
|
-
let ssr$1;
|
|
618
|
-
function setSsr(ssrImpl) {
|
|
619
|
-
ssr$1 = ssrImpl;
|
|
620
|
-
}
|
|
621
|
-
let isNativeShadowDefined$1;
|
|
622
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
623
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
624
|
-
}
|
|
625
|
-
let isSyntheticShadowDefined$1;
|
|
626
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
627
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
628
|
-
}
|
|
629
|
-
let HTMLElementExported$1;
|
|
630
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
631
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
632
|
-
}
|
|
633
|
-
let insert$1;
|
|
634
|
-
function setInsert(insertImpl) {
|
|
635
|
-
insert$1 = insertImpl;
|
|
636
|
-
}
|
|
637
|
-
let remove$1;
|
|
638
|
-
function setRemove(removeImpl) {
|
|
639
|
-
remove$1 = removeImpl;
|
|
640
|
-
}
|
|
641
|
-
let createElement$1;
|
|
642
|
-
function setCreateElement(createElementImpl) {
|
|
643
|
-
createElement$1 = createElementImpl;
|
|
644
|
-
}
|
|
645
|
-
let createText$1;
|
|
646
|
-
function setCreateText(createTextImpl) {
|
|
647
|
-
createText$1 = createTextImpl;
|
|
648
|
-
}
|
|
649
|
-
let createComment$1;
|
|
650
|
-
function setCreateComment(createCommentImpl) {
|
|
651
|
-
createComment$1 = createCommentImpl;
|
|
652
|
-
}
|
|
653
|
-
let nextSibling$1;
|
|
654
|
-
function setNextSibling(nextSiblingImpl) {
|
|
655
|
-
nextSibling$1 = nextSiblingImpl;
|
|
656
|
-
}
|
|
657
|
-
let attachShadow$1;
|
|
658
|
-
function setAttachShadow(attachShadowImpl) {
|
|
659
|
-
attachShadow$1 = attachShadowImpl;
|
|
660
|
-
}
|
|
661
|
-
let getProperty$1;
|
|
662
|
-
function setGetProperty(getPropertyImpl) {
|
|
663
|
-
getProperty$1 = getPropertyImpl;
|
|
664
|
-
}
|
|
665
|
-
let setProperty$1;
|
|
666
|
-
function setSetProperty(setPropertyImpl) {
|
|
667
|
-
setProperty$1 = setPropertyImpl;
|
|
668
|
-
}
|
|
669
|
-
let setText$1;
|
|
670
|
-
function setSetText(setTextImpl) {
|
|
671
|
-
setText$1 = setTextImpl;
|
|
672
|
-
}
|
|
673
|
-
let getAttribute$1;
|
|
674
|
-
function setGetAttribute(getAttributeImpl) {
|
|
675
|
-
getAttribute$1 = getAttributeImpl;
|
|
676
|
-
}
|
|
677
|
-
let setAttribute$1;
|
|
678
|
-
function setSetAttribute(setAttributeImpl) {
|
|
679
|
-
setAttribute$1 = setAttributeImpl;
|
|
680
|
-
}
|
|
681
|
-
let removeAttribute$1;
|
|
682
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
683
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
684
|
-
}
|
|
685
|
-
let addEventListener$1;
|
|
686
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
687
|
-
addEventListener$1 = addEventListenerImpl;
|
|
688
|
-
}
|
|
689
|
-
let removeEventListener$1;
|
|
690
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
691
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
692
|
-
}
|
|
693
|
-
let dispatchEvent$1;
|
|
694
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
695
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
696
|
-
}
|
|
697
|
-
let getClassList$1;
|
|
698
|
-
function setGetClassList(getClassListImpl) {
|
|
699
|
-
getClassList$1 = getClassListImpl;
|
|
700
|
-
}
|
|
701
|
-
let setCSSStyleProperty$1;
|
|
702
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
703
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
704
|
-
}
|
|
705
|
-
let getBoundingClientRect$1;
|
|
706
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
707
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
708
|
-
}
|
|
709
|
-
let querySelector$1;
|
|
710
|
-
function setQuerySelector(querySelectorImpl) {
|
|
711
|
-
querySelector$1 = querySelectorImpl;
|
|
712
|
-
}
|
|
713
|
-
let querySelectorAll$1;
|
|
714
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
715
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
716
|
-
}
|
|
717
|
-
let getElementsByTagName$1;
|
|
718
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
719
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
720
|
-
}
|
|
721
|
-
let getElementsByClassName$1;
|
|
722
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
723
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
724
|
-
}
|
|
725
|
-
let getChildren$1;
|
|
726
|
-
function setGetChildren(getChildrenImpl) {
|
|
727
|
-
getChildren$1 = getChildrenImpl;
|
|
728
|
-
}
|
|
729
|
-
let getChildNodes$1;
|
|
730
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
731
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
732
|
-
}
|
|
733
|
-
let getFirstChild$1;
|
|
734
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
735
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
736
|
-
}
|
|
737
|
-
let getFirstElementChild$1;
|
|
738
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
739
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
740
|
-
}
|
|
741
|
-
let getLastChild$1;
|
|
742
|
-
function setGetLastChild(getLastChildImpl) {
|
|
743
|
-
getLastChild$1 = getLastChildImpl;
|
|
744
|
-
}
|
|
745
|
-
let getLastElementChild$1;
|
|
746
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
747
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
748
|
-
}
|
|
749
|
-
let isConnected$1;
|
|
750
|
-
function setIsConnected(isConnectedImpl) {
|
|
751
|
-
isConnected$1 = isConnectedImpl;
|
|
752
|
-
}
|
|
753
|
-
let insertStylesheet$1;
|
|
754
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
755
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
756
|
-
}
|
|
757
|
-
let assertInstanceOfHTMLElement$1;
|
|
758
|
-
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
759
|
-
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
760
|
-
}
|
|
761
|
-
let defineCustomElement$1;
|
|
762
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
763
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
764
|
-
}
|
|
765
|
-
let getCustomElement$1;
|
|
766
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
767
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
633
|
/*
|
|
771
634
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
772
635
|
* All rights reserved.
|
|
@@ -2068,7 +1931,8 @@ const LightningElement = function () {
|
|
|
2068
1931
|
const { def, elm } = vm;
|
|
2069
1932
|
const { bridge } = def;
|
|
2070
1933
|
if (process.env.NODE_ENV !== 'production') {
|
|
2071
|
-
|
|
1934
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1935
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2072
1936
|
}
|
|
2073
1937
|
const component = this;
|
|
2074
1938
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2102,8 +1966,8 @@ const LightningElement = function () {
|
|
|
2102
1966
|
return this;
|
|
2103
1967
|
};
|
|
2104
1968
|
function doAttachShadow(vm) {
|
|
2105
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2106
|
-
const shadowRoot = attachShadow
|
|
1969
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1970
|
+
const shadowRoot = attachShadow(elm, {
|
|
2107
1971
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2108
1972
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2109
1973
|
mode,
|
|
@@ -2124,12 +1988,13 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
|
2124
1988
|
LightningElement.prototype = {
|
|
2125
1989
|
constructor: LightningElement,
|
|
2126
1990
|
dispatchEvent(event) {
|
|
2127
|
-
const
|
|
2128
|
-
|
|
1991
|
+
const vm = getAssociatedVM(this);
|
|
1992
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1993
|
+
return dispatchEvent(elm, event);
|
|
2129
1994
|
},
|
|
2130
1995
|
addEventListener(type, listener, options) {
|
|
2131
1996
|
const vm = getAssociatedVM(this);
|
|
2132
|
-
const { elm } = vm;
|
|
1997
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2133
1998
|
if (process.env.NODE_ENV !== 'production') {
|
|
2134
1999
|
const vmBeingRendered = getVMBeingRendered();
|
|
2135
2000
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2137,83 +2002,91 @@ LightningElement.prototype = {
|
|
|
2137
2002
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2138
2003
|
}
|
|
2139
2004
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2140
|
-
addEventListener
|
|
2005
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2141
2006
|
},
|
|
2142
2007
|
removeEventListener(type, listener, options) {
|
|
2143
2008
|
const vm = getAssociatedVM(this);
|
|
2144
|
-
const { elm } = vm;
|
|
2009
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2145
2010
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2146
|
-
removeEventListener
|
|
2011
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2147
2012
|
},
|
|
2148
2013
|
hasAttribute(name) {
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2014
|
+
const vm = getAssociatedVM(this);
|
|
2015
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2016
|
+
return !isNull(getAttribute(elm, name));
|
|
2151
2017
|
},
|
|
2152
2018
|
hasAttributeNS(namespace, name) {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2019
|
+
const vm = getAssociatedVM(this);
|
|
2020
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2021
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2155
2022
|
},
|
|
2156
2023
|
removeAttribute(name) {
|
|
2157
|
-
const
|
|
2024
|
+
const vm = getAssociatedVM(this);
|
|
2025
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2158
2026
|
unlockAttribute(elm, name);
|
|
2159
|
-
removeAttribute
|
|
2027
|
+
removeAttribute(elm, name);
|
|
2160
2028
|
lockAttribute();
|
|
2161
2029
|
},
|
|
2162
2030
|
removeAttributeNS(namespace, name) {
|
|
2163
|
-
const { elm } = getAssociatedVM(this);
|
|
2031
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2164
2032
|
unlockAttribute(elm, name);
|
|
2165
|
-
removeAttribute
|
|
2033
|
+
removeAttribute(elm, name, namespace);
|
|
2166
2034
|
lockAttribute();
|
|
2167
2035
|
},
|
|
2168
2036
|
getAttribute(name) {
|
|
2169
|
-
const
|
|
2170
|
-
|
|
2037
|
+
const vm = getAssociatedVM(this);
|
|
2038
|
+
const { elm } = vm;
|
|
2039
|
+
const { getAttribute } = vm.renderer;
|
|
2040
|
+
return getAttribute(elm, name);
|
|
2171
2041
|
},
|
|
2172
2042
|
getAttributeNS(namespace, name) {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2043
|
+
const vm = getAssociatedVM(this);
|
|
2044
|
+
const { elm } = vm;
|
|
2045
|
+
const { getAttribute } = vm.renderer;
|
|
2046
|
+
return getAttribute(elm, name, namespace);
|
|
2175
2047
|
},
|
|
2176
2048
|
setAttribute(name, value) {
|
|
2177
2049
|
const vm = getAssociatedVM(this);
|
|
2178
|
-
const { elm } = vm;
|
|
2050
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2179
2051
|
if (process.env.NODE_ENV !== 'production') {
|
|
2180
2052
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2181
2053
|
}
|
|
2182
2054
|
unlockAttribute(elm, name);
|
|
2183
|
-
setAttribute
|
|
2055
|
+
setAttribute(elm, name, value);
|
|
2184
2056
|
lockAttribute();
|
|
2185
2057
|
},
|
|
2186
2058
|
setAttributeNS(namespace, name, value) {
|
|
2187
2059
|
const vm = getAssociatedVM(this);
|
|
2188
|
-
const { elm } = vm;
|
|
2060
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2189
2061
|
if (process.env.NODE_ENV !== 'production') {
|
|
2190
2062
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2191
2063
|
}
|
|
2192
2064
|
unlockAttribute(elm, name);
|
|
2193
|
-
setAttribute
|
|
2065
|
+
setAttribute(elm, name, value, namespace);
|
|
2194
2066
|
lockAttribute();
|
|
2195
2067
|
},
|
|
2196
2068
|
getBoundingClientRect() {
|
|
2197
2069
|
const vm = getAssociatedVM(this);
|
|
2198
|
-
const { elm } = vm;
|
|
2070
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2199
2071
|
if (process.env.NODE_ENV !== 'production') {
|
|
2200
2072
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2201
2073
|
}
|
|
2202
|
-
return getBoundingClientRect
|
|
2074
|
+
return getBoundingClientRect(elm);
|
|
2203
2075
|
},
|
|
2204
2076
|
get isConnected() {
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2077
|
+
const vm = getAssociatedVM(this);
|
|
2078
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2079
|
+
return isConnected(elm);
|
|
2207
2080
|
},
|
|
2208
2081
|
get classList() {
|
|
2209
2082
|
const vm = getAssociatedVM(this);
|
|
2210
|
-
const { elm } = vm;
|
|
2083
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2211
2084
|
if (process.env.NODE_ENV !== 'production') {
|
|
2212
2085
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2213
2086
|
// just throw in all modes
|
|
2214
2087
|
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.`);
|
|
2215
2088
|
}
|
|
2216
|
-
return getClassList
|
|
2089
|
+
return getClassList(elm);
|
|
2217
2090
|
},
|
|
2218
2091
|
get template() {
|
|
2219
2092
|
const vm = getAssociatedVM(this);
|
|
@@ -2229,6 +2102,54 @@ LightningElement.prototype = {
|
|
|
2229
2102
|
// Authors should rely on this.template instead.
|
|
2230
2103
|
return null;
|
|
2231
2104
|
},
|
|
2105
|
+
get children() {
|
|
2106
|
+
const vm = getAssociatedVM(this);
|
|
2107
|
+
const renderer = vm.renderer;
|
|
2108
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2109
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2110
|
+
}
|
|
2111
|
+
return renderer.getChildren(vm.elm);
|
|
2112
|
+
},
|
|
2113
|
+
get childNodes() {
|
|
2114
|
+
const vm = getAssociatedVM(this);
|
|
2115
|
+
const renderer = vm.renderer;
|
|
2116
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2117
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2118
|
+
}
|
|
2119
|
+
return renderer.getChildNodes(vm.elm);
|
|
2120
|
+
},
|
|
2121
|
+
get firstChild() {
|
|
2122
|
+
const vm = getAssociatedVM(this);
|
|
2123
|
+
const renderer = vm.renderer;
|
|
2124
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2125
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2126
|
+
}
|
|
2127
|
+
return renderer.getFirstChild(vm.elm);
|
|
2128
|
+
},
|
|
2129
|
+
get firstElementChild() {
|
|
2130
|
+
const vm = getAssociatedVM(this);
|
|
2131
|
+
const renderer = vm.renderer;
|
|
2132
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2133
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2134
|
+
}
|
|
2135
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2136
|
+
},
|
|
2137
|
+
get lastChild() {
|
|
2138
|
+
const vm = getAssociatedVM(this);
|
|
2139
|
+
const renderer = vm.renderer;
|
|
2140
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2141
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2142
|
+
}
|
|
2143
|
+
return renderer.getLastChild(vm.elm);
|
|
2144
|
+
},
|
|
2145
|
+
get lastElementChild() {
|
|
2146
|
+
const vm = getAssociatedVM(this);
|
|
2147
|
+
const renderer = vm.renderer;
|
|
2148
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2149
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2150
|
+
}
|
|
2151
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2152
|
+
},
|
|
2232
2153
|
render() {
|
|
2233
2154
|
const vm = getAssociatedVM(this);
|
|
2234
2155
|
return vm.def.template;
|
|
@@ -2239,76 +2160,22 @@ LightningElement.prototype = {
|
|
|
2239
2160
|
},
|
|
2240
2161
|
};
|
|
2241
2162
|
const queryAndChildGetterDescriptors = create(null);
|
|
2242
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2243
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2244
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2245
|
-
const childGetters = [
|
|
2246
|
-
'children',
|
|
2247
|
-
'childNodes',
|
|
2248
|
-
'firstChild',
|
|
2249
|
-
'firstElementChild',
|
|
2250
|
-
'lastChild',
|
|
2251
|
-
'lastElementChild',
|
|
2252
|
-
];
|
|
2253
|
-
function getChildGetter(methodName) {
|
|
2254
|
-
switch (methodName) {
|
|
2255
|
-
case 'children':
|
|
2256
|
-
return getChildren$1;
|
|
2257
|
-
case 'childNodes':
|
|
2258
|
-
return getChildNodes$1;
|
|
2259
|
-
case 'firstChild':
|
|
2260
|
-
return getFirstChild$1;
|
|
2261
|
-
case 'firstElementChild':
|
|
2262
|
-
return getFirstElementChild$1;
|
|
2263
|
-
case 'lastChild':
|
|
2264
|
-
return getLastChild$1;
|
|
2265
|
-
case 'lastElementChild':
|
|
2266
|
-
return getLastElementChild$1;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2270
|
-
for (const childGetter of childGetters) {
|
|
2271
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
2272
|
-
get() {
|
|
2273
|
-
const vm = getAssociatedVM(this);
|
|
2274
|
-
const { elm } = vm;
|
|
2275
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2276
|
-
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2277
|
-
}
|
|
2278
|
-
return getChildGetter(childGetter)(elm);
|
|
2279
|
-
},
|
|
2280
|
-
configurable: true,
|
|
2281
|
-
enumerable: true,
|
|
2282
|
-
};
|
|
2283
|
-
}
|
|
2284
2163
|
const queryMethods = [
|
|
2285
2164
|
'getElementsByClassName',
|
|
2286
2165
|
'getElementsByTagName',
|
|
2287
2166
|
'querySelector',
|
|
2288
2167
|
'querySelectorAll',
|
|
2289
2168
|
];
|
|
2290
|
-
function getQueryMethod(methodName) {
|
|
2291
|
-
switch (methodName) {
|
|
2292
|
-
case 'getElementsByClassName':
|
|
2293
|
-
return getElementsByClassName$1;
|
|
2294
|
-
case 'getElementsByTagName':
|
|
2295
|
-
return getElementsByTagName$1;
|
|
2296
|
-
case 'querySelector':
|
|
2297
|
-
return querySelector$1;
|
|
2298
|
-
case 'querySelectorAll':
|
|
2299
|
-
return querySelectorAll$1;
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
2169
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2303
2170
|
for (const queryMethod of queryMethods) {
|
|
2304
2171
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2305
2172
|
value(arg) {
|
|
2306
2173
|
const vm = getAssociatedVM(this);
|
|
2307
|
-
const { elm } = vm;
|
|
2174
|
+
const { elm, renderer } = vm;
|
|
2308
2175
|
if (process.env.NODE_ENV !== 'production') {
|
|
2309
2176
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2310
2177
|
}
|
|
2311
|
-
return
|
|
2178
|
+
return renderer[queryMethod](elm, arg);
|
|
2312
2179
|
},
|
|
2313
2180
|
configurable: true,
|
|
2314
2181
|
enumerable: true,
|
|
@@ -2813,7 +2680,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2813
2680
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2814
2681
|
*/
|
|
2815
2682
|
let warned = false;
|
|
2816
|
-
|
|
2683
|
+
// @ts-ignore
|
|
2684
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2817
2685
|
// @ts-ignore
|
|
2818
2686
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2819
2687
|
warned = false;
|
|
@@ -3410,12 +3278,13 @@ function getComponentDef(Ctor) {
|
|
|
3410
3278
|
* SPDX-License-Identifier: MIT
|
|
3411
3279
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3412
3280
|
*/
|
|
3413
|
-
function getUpgradableConstructor(tagName) {
|
|
3281
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3282
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3414
3283
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3415
3284
|
// produce only tags with lowercase letters
|
|
3416
3285
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3417
3286
|
tagName = tagName.toLowerCase();
|
|
3418
|
-
let CE = getCustomElement
|
|
3287
|
+
let CE = getCustomElement(tagName);
|
|
3419
3288
|
if (!isUndefined$1(CE)) {
|
|
3420
3289
|
return CE;
|
|
3421
3290
|
}
|
|
@@ -3423,7 +3292,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3423
3292
|
* LWC Upgradable Element reference to an element that was created
|
|
3424
3293
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3425
3294
|
*/
|
|
3426
|
-
CE = class LWCUpgradableElement extends
|
|
3295
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3427
3296
|
constructor(upgradeCallback) {
|
|
3428
3297
|
super();
|
|
3429
3298
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3431,7 +3300,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3431
3300
|
}
|
|
3432
3301
|
}
|
|
3433
3302
|
};
|
|
3434
|
-
defineCustomElement
|
|
3303
|
+
defineCustomElement(tagName, CE);
|
|
3435
3304
|
return CE;
|
|
3436
3305
|
}
|
|
3437
3306
|
|
|
@@ -3456,7 +3325,7 @@ function isSameVnode(vnode1, vnode2) {
|
|
|
3456
3325
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3457
3326
|
*/
|
|
3458
3327
|
const ColonCharCode = 58;
|
|
3459
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3328
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3460
3329
|
const { attrs } = vnode.data;
|
|
3461
3330
|
if (isUndefined$1(attrs)) {
|
|
3462
3331
|
return;
|
|
@@ -3466,6 +3335,7 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3466
3335
|
return;
|
|
3467
3336
|
}
|
|
3468
3337
|
const { elm } = vnode;
|
|
3338
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3469
3339
|
for (const key in attrs) {
|
|
3470
3340
|
const cur = attrs[key];
|
|
3471
3341
|
const old = oldAttrs[key];
|
|
@@ -3473,17 +3343,17 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3473
3343
|
unlockAttribute(elm, key);
|
|
3474
3344
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3475
3345
|
// Assume xml namespace
|
|
3476
|
-
setAttribute
|
|
3346
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3477
3347
|
}
|
|
3478
3348
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3479
3349
|
// Assume xlink namespace
|
|
3480
|
-
setAttribute
|
|
3350
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3481
3351
|
}
|
|
3482
3352
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3483
|
-
removeAttribute
|
|
3353
|
+
removeAttribute(elm, key);
|
|
3484
3354
|
}
|
|
3485
3355
|
else {
|
|
3486
|
-
setAttribute
|
|
3356
|
+
setAttribute(elm, key, cur);
|
|
3487
3357
|
}
|
|
3488
3358
|
lockAttribute();
|
|
3489
3359
|
}
|
|
@@ -3501,7 +3371,7 @@ function isLiveBindingProp(sel, key) {
|
|
|
3501
3371
|
// instead of relying on internally tracked values.
|
|
3502
3372
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3503
3373
|
}
|
|
3504
|
-
function patchProps(oldVnode, vnode) {
|
|
3374
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3505
3375
|
const { props } = vnode.data;
|
|
3506
3376
|
if (isUndefined$1(props)) {
|
|
3507
3377
|
return;
|
|
@@ -3512,13 +3382,14 @@ function patchProps(oldVnode, vnode) {
|
|
|
3512
3382
|
}
|
|
3513
3383
|
const isFirstPatch = isNull(oldVnode);
|
|
3514
3384
|
const { elm, sel } = vnode;
|
|
3385
|
+
const { getProperty, setProperty } = renderer;
|
|
3515
3386
|
for (const key in props) {
|
|
3516
3387
|
const cur = props[key];
|
|
3517
3388
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3518
3389
|
// different than the one previously set.
|
|
3519
3390
|
if (isFirstPatch ||
|
|
3520
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3521
|
-
setProperty
|
|
3391
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3392
|
+
setProperty(elm, key, cur);
|
|
3522
3393
|
}
|
|
3523
3394
|
}
|
|
3524
3395
|
}
|
|
@@ -3563,13 +3434,14 @@ function getMapFromClassName(className) {
|
|
|
3563
3434
|
}
|
|
3564
3435
|
return map;
|
|
3565
3436
|
}
|
|
3566
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3437
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3567
3438
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3568
3439
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3569
3440
|
if (oldClass === newClass) {
|
|
3570
3441
|
return;
|
|
3571
3442
|
}
|
|
3572
|
-
const
|
|
3443
|
+
const { getClassList } = renderer;
|
|
3444
|
+
const classList = getClassList(elm);
|
|
3573
3445
|
const newClassMap = getMapFromClassName(newClass);
|
|
3574
3446
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3575
3447
|
let name;
|
|
@@ -3593,17 +3465,18 @@ function patchClassAttribute(oldVnode, vnode) {
|
|
|
3593
3465
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3594
3466
|
*/
|
|
3595
3467
|
// The style property is a string when defined via an expression in the template.
|
|
3596
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3468
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3597
3469
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3598
3470
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3599
3471
|
if (oldStyle === newStyle) {
|
|
3600
3472
|
return;
|
|
3601
3473
|
}
|
|
3474
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3602
3475
|
if (!isString(newStyle) || newStyle === '') {
|
|
3603
|
-
removeAttribute
|
|
3476
|
+
removeAttribute(elm, 'style');
|
|
3604
3477
|
}
|
|
3605
3478
|
else {
|
|
3606
|
-
setAttribute
|
|
3479
|
+
setAttribute(elm, 'style', newStyle);
|
|
3607
3480
|
}
|
|
3608
3481
|
}
|
|
3609
3482
|
|
|
@@ -3613,14 +3486,15 @@ function patchStyleAttribute(oldVnode, vnode) {
|
|
|
3613
3486
|
* SPDX-License-Identifier: MIT
|
|
3614
3487
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3615
3488
|
*/
|
|
3616
|
-
function applyEventListeners(vnode) {
|
|
3489
|
+
function applyEventListeners(vnode, renderer) {
|
|
3617
3490
|
const { elm, data: { on }, } = vnode;
|
|
3618
3491
|
if (isUndefined$1(on)) {
|
|
3619
3492
|
return;
|
|
3620
3493
|
}
|
|
3494
|
+
const { addEventListener } = renderer;
|
|
3621
3495
|
for (const name in on) {
|
|
3622
3496
|
const handler = on[name];
|
|
3623
|
-
addEventListener
|
|
3497
|
+
addEventListener(elm, name, handler);
|
|
3624
3498
|
}
|
|
3625
3499
|
}
|
|
3626
3500
|
|
|
@@ -3633,12 +3507,13 @@ function applyEventListeners(vnode) {
|
|
|
3633
3507
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3634
3508
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3635
3509
|
// different classnames properties individually instead of via a string.
|
|
3636
|
-
function applyStaticClassAttribute(vnode) {
|
|
3510
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3637
3511
|
const { elm, data: { classMap }, } = vnode;
|
|
3638
3512
|
if (isUndefined$1(classMap)) {
|
|
3639
3513
|
return;
|
|
3640
3514
|
}
|
|
3641
|
-
const
|
|
3515
|
+
const { getClassList } = renderer;
|
|
3516
|
+
const classList = getClassList(elm);
|
|
3642
3517
|
for (const name in classMap) {
|
|
3643
3518
|
classList.add(name);
|
|
3644
3519
|
}
|
|
@@ -3653,14 +3528,15 @@ function applyStaticClassAttribute(vnode) {
|
|
|
3653
3528
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3654
3529
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3655
3530
|
// different style properties individually instead of via a string.
|
|
3656
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3531
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3657
3532
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3658
3533
|
if (isUndefined$1(styleDecls)) {
|
|
3659
3534
|
return;
|
|
3660
3535
|
}
|
|
3536
|
+
const { setCSSStyleProperty } = renderer;
|
|
3661
3537
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3662
3538
|
const [prop, value, important] = styleDecls[i];
|
|
3663
|
-
setCSSStyleProperty
|
|
3539
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3664
3540
|
}
|
|
3665
3541
|
}
|
|
3666
3542
|
|
|
@@ -3670,15 +3546,16 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
3670
3546
|
* SPDX-License-Identifier: MIT
|
|
3671
3547
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3672
3548
|
*/
|
|
3673
|
-
function patchChildren(c1, c2, parent) {
|
|
3549
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3674
3550
|
if (hasDynamicChildren(c2)) {
|
|
3675
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3551
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3676
3552
|
}
|
|
3677
3553
|
else {
|
|
3678
|
-
updateStaticChildren(c1, c2, parent);
|
|
3554
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3679
3555
|
}
|
|
3680
3556
|
}
|
|
3681
|
-
function patch(n1, n2) {
|
|
3557
|
+
function patch(n1, n2, renderer) {
|
|
3558
|
+
var _a, _b;
|
|
3682
3559
|
if (n1 === n2) {
|
|
3683
3560
|
return;
|
|
3684
3561
|
}
|
|
@@ -3692,80 +3569,115 @@ function patch(n1, n2) {
|
|
|
3692
3569
|
}
|
|
3693
3570
|
switch (n2.type) {
|
|
3694
3571
|
case 0 /* Text */:
|
|
3695
|
-
|
|
3572
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3573
|
+
patchText(n1, n2, renderer);
|
|
3696
3574
|
break;
|
|
3697
3575
|
case 1 /* Comment */:
|
|
3698
|
-
|
|
3576
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3577
|
+
patchComment(n1, n2, renderer);
|
|
3578
|
+
break;
|
|
3579
|
+
case 4 /* Static */:
|
|
3580
|
+
n2.elm = n1.elm;
|
|
3699
3581
|
break;
|
|
3700
3582
|
case 2 /* Element */:
|
|
3701
|
-
patchElement(n1, n2);
|
|
3583
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3702
3584
|
break;
|
|
3703
3585
|
case 3 /* CustomElement */:
|
|
3704
|
-
patchCustomElement(n1, n2);
|
|
3586
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3705
3587
|
break;
|
|
3706
3588
|
}
|
|
3707
3589
|
}
|
|
3708
|
-
function mount(node, parent, anchor) {
|
|
3590
|
+
function mount(node, parent, renderer, anchor) {
|
|
3591
|
+
var _a, _b;
|
|
3709
3592
|
switch (node.type) {
|
|
3710
3593
|
case 0 /* Text */:
|
|
3711
|
-
|
|
3594
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3595
|
+
mountText(node, parent, anchor, renderer);
|
|
3712
3596
|
break;
|
|
3713
3597
|
case 1 /* Comment */:
|
|
3714
|
-
|
|
3598
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3599
|
+
mountComment(node, parent, anchor, renderer);
|
|
3600
|
+
break;
|
|
3601
|
+
case 4 /* Static */:
|
|
3602
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3603
|
+
mountStatic(node, parent, anchor, renderer);
|
|
3715
3604
|
break;
|
|
3716
3605
|
case 2 /* Element */:
|
|
3717
|
-
|
|
3606
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3607
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3718
3608
|
break;
|
|
3719
3609
|
case 3 /* CustomElement */:
|
|
3720
|
-
|
|
3610
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3611
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3721
3612
|
break;
|
|
3722
3613
|
}
|
|
3723
3614
|
}
|
|
3724
|
-
function patchText(n1, n2) {
|
|
3615
|
+
function patchText(n1, n2, renderer) {
|
|
3725
3616
|
n2.elm = n1.elm;
|
|
3726
3617
|
if (n2.text !== n1.text) {
|
|
3727
|
-
updateTextContent(n2);
|
|
3618
|
+
updateTextContent(n2, renderer);
|
|
3728
3619
|
}
|
|
3729
3620
|
}
|
|
3730
|
-
function mountText(
|
|
3731
|
-
const { owner } =
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3734
|
-
|
|
3621
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3622
|
+
const { owner } = vnode;
|
|
3623
|
+
const { createText } = renderer;
|
|
3624
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3625
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3626
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3735
3627
|
}
|
|
3736
|
-
function patchComment(n1, n2) {
|
|
3628
|
+
function patchComment(n1, n2, renderer) {
|
|
3737
3629
|
n2.elm = n1.elm;
|
|
3738
3630
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3739
3631
|
// it is the case today.
|
|
3740
3632
|
if (n2.text !== n1.text) {
|
|
3741
|
-
updateTextContent(n2);
|
|
3633
|
+
updateTextContent(n2, renderer);
|
|
3742
3634
|
}
|
|
3743
3635
|
}
|
|
3744
|
-
function mountComment(
|
|
3745
|
-
const { owner } =
|
|
3746
|
-
const
|
|
3747
|
-
|
|
3748
|
-
|
|
3636
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3637
|
+
const { owner } = vnode;
|
|
3638
|
+
const { createComment } = renderer;
|
|
3639
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3640
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3641
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3749
3642
|
}
|
|
3750
|
-
function mountElement(vnode, parent, anchor) {
|
|
3643
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3751
3644
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3645
|
+
const { createElement } = renderer;
|
|
3752
3646
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3753
|
-
const elm = createElement
|
|
3754
|
-
linkNodeToShadow(elm, owner);
|
|
3755
|
-
fallbackElmHook(elm, vnode);
|
|
3647
|
+
const elm = createElement(sel, namespace);
|
|
3648
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3649
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3756
3650
|
vnode.elm = elm;
|
|
3757
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3758
|
-
insertNode(elm, parent, anchor);
|
|
3759
|
-
mountVNodes(vnode.children, elm, null);
|
|
3651
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3652
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3653
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3760
3654
|
}
|
|
3761
|
-
function patchElement(n1, n2) {
|
|
3655
|
+
function patchElement(n1, n2, renderer) {
|
|
3762
3656
|
const elm = (n2.elm = n1.elm);
|
|
3763
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3764
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3657
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3658
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3765
3659
|
}
|
|
3766
|
-
function
|
|
3660
|
+
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3661
|
+
const { owner } = vnode;
|
|
3662
|
+
const { cloneNode, isSyntheticShadowDefined } = renderer;
|
|
3663
|
+
const elm = (vnode.elm = cloneNode(vnode.fragment, true));
|
|
3664
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3665
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3666
|
+
const { renderMode, shadowMode } = owner;
|
|
3667
|
+
if (isSyntheticShadowDefined) {
|
|
3668
|
+
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3669
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3673
|
+
const isLight = renderMode === 0 /* Light */;
|
|
3674
|
+
patchElementWithRestrictions(elm, { isPortal: false, isLight });
|
|
3675
|
+
}
|
|
3676
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3677
|
+
}
|
|
3678
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3767
3679
|
const { sel, owner } = vnode;
|
|
3768
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3680
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3769
3681
|
/**
|
|
3770
3682
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3771
3683
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3775,9 +3687,9 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3775
3687
|
let vm;
|
|
3776
3688
|
const elm = new UpgradableConstructor((elm) => {
|
|
3777
3689
|
// the custom element from the registry is expecting an upgrade callback
|
|
3778
|
-
vm = createViewModelHook(elm, vnode);
|
|
3690
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3779
3691
|
});
|
|
3780
|
-
linkNodeToShadow(elm, owner);
|
|
3692
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3781
3693
|
vnode.elm = elm;
|
|
3782
3694
|
vnode.vm = vm;
|
|
3783
3695
|
if (vm) {
|
|
@@ -3786,23 +3698,23 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3786
3698
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3787
3699
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3788
3700
|
}
|
|
3789
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3790
|
-
insertNode(elm, parent, anchor);
|
|
3701
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3702
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3791
3703
|
if (vm) {
|
|
3792
3704
|
if (process.env.NODE_ENV !== 'production') {
|
|
3793
3705
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3794
3706
|
}
|
|
3795
3707
|
runConnectedCallback(vm);
|
|
3796
3708
|
}
|
|
3797
|
-
mountVNodes(vnode.children, elm, null);
|
|
3709
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3798
3710
|
if (vm) {
|
|
3799
3711
|
appendVM(vm);
|
|
3800
3712
|
}
|
|
3801
3713
|
}
|
|
3802
|
-
function patchCustomElement(n1, n2) {
|
|
3714
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3803
3715
|
const elm = (n2.elm = n1.elm);
|
|
3804
3716
|
const vm = (n2.vm = n1.vm);
|
|
3805
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3717
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3806
3718
|
if (!isUndefined$1(vm)) {
|
|
3807
3719
|
// in fallback mode, the allocation will always set children to
|
|
3808
3720
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3810,33 +3722,38 @@ function patchCustomElement(n1, n2) {
|
|
|
3810
3722
|
}
|
|
3811
3723
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3812
3724
|
// will happen, but in native, it does allocate the light dom
|
|
3813
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3725
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3814
3726
|
if (!isUndefined$1(vm)) {
|
|
3815
3727
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3816
3728
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3817
3729
|
rerenderVM(vm);
|
|
3818
3730
|
}
|
|
3819
3731
|
}
|
|
3820
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3732
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3821
3733
|
for (; start < end; ++start) {
|
|
3822
3734
|
const vnode = vnodes[start];
|
|
3823
3735
|
if (isVNode(vnode)) {
|
|
3824
|
-
mount(vnode, parent, anchor);
|
|
3736
|
+
mount(vnode, parent, renderer, anchor);
|
|
3825
3737
|
}
|
|
3826
3738
|
}
|
|
3827
3739
|
}
|
|
3828
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3740
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3829
3741
|
const { type, elm, sel } = vnode;
|
|
3830
3742
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3831
3743
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3832
3744
|
if (doRemove) {
|
|
3833
|
-
|
|
3745
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3746
|
+
// but the removal used here is from the owner instead.
|
|
3747
|
+
removeNode(elm, parent, renderer);
|
|
3834
3748
|
}
|
|
3835
|
-
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
3836
3749
|
switch (type) {
|
|
3837
|
-
case 2 /* Element */:
|
|
3838
|
-
|
|
3750
|
+
case 2 /* Element */: {
|
|
3751
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3752
|
+
// Only required for synthetic shadow.
|
|
3753
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3754
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3839
3755
|
break;
|
|
3756
|
+
}
|
|
3840
3757
|
case 3 /* CustomElement */: {
|
|
3841
3758
|
const { vm } = vnode;
|
|
3842
3759
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -3847,11 +3764,11 @@ function unmount(vnode, parent, doRemove = false) {
|
|
|
3847
3764
|
}
|
|
3848
3765
|
}
|
|
3849
3766
|
}
|
|
3850
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3767
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3851
3768
|
for (; start < end; ++start) {
|
|
3852
3769
|
const ch = vnodes[start];
|
|
3853
3770
|
if (isVNode(ch)) {
|
|
3854
|
-
unmount(ch, parent, doRemove);
|
|
3771
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3855
3772
|
}
|
|
3856
3773
|
}
|
|
3857
3774
|
}
|
|
@@ -3865,66 +3782,71 @@ function setElementShadowToken(elm, token) {
|
|
|
3865
3782
|
elm.$shadowToken$ = token;
|
|
3866
3783
|
}
|
|
3867
3784
|
// Set the scope token class for *.scoped.css styles
|
|
3868
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3785
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3869
3786
|
const { cmpTemplate, context } = owner;
|
|
3787
|
+
const { getClassList } = renderer;
|
|
3870
3788
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3871
3789
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3872
|
-
|
|
3790
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3791
|
+
// probably we should have a renderer api for just the add operation
|
|
3792
|
+
getClassList(elm).add(token);
|
|
3873
3793
|
}
|
|
3874
3794
|
}
|
|
3875
|
-
function linkNodeToShadow(elm, owner) {
|
|
3795
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3876
3796
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3797
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3877
3798
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3878
|
-
if (isSyntheticShadowDefined
|
|
3799
|
+
if (isSyntheticShadowDefined) {
|
|
3879
3800
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3880
3801
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3881
3802
|
}
|
|
3882
3803
|
}
|
|
3883
3804
|
}
|
|
3884
|
-
function updateTextContent(vnode) {
|
|
3805
|
+
function updateTextContent(vnode, renderer) {
|
|
3885
3806
|
const { elm, text } = vnode;
|
|
3807
|
+
const { setText } = renderer;
|
|
3886
3808
|
if (process.env.NODE_ENV !== 'production') {
|
|
3887
3809
|
unlockDomMutation();
|
|
3888
3810
|
}
|
|
3889
|
-
setText
|
|
3811
|
+
setText(elm, text);
|
|
3890
3812
|
if (process.env.NODE_ENV !== 'production') {
|
|
3891
3813
|
lockDomMutation();
|
|
3892
3814
|
}
|
|
3893
3815
|
}
|
|
3894
|
-
function insertNode(node, parent, anchor) {
|
|
3816
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3895
3817
|
if (process.env.NODE_ENV !== 'production') {
|
|
3896
3818
|
unlockDomMutation();
|
|
3897
3819
|
}
|
|
3898
|
-
insert
|
|
3820
|
+
renderer.insert(node, parent, anchor);
|
|
3899
3821
|
if (process.env.NODE_ENV !== 'production') {
|
|
3900
3822
|
lockDomMutation();
|
|
3901
3823
|
}
|
|
3902
3824
|
}
|
|
3903
|
-
function removeNode(node, parent) {
|
|
3825
|
+
function removeNode(node, parent, renderer) {
|
|
3904
3826
|
if (process.env.NODE_ENV !== 'production') {
|
|
3905
3827
|
unlockDomMutation();
|
|
3906
3828
|
}
|
|
3907
|
-
remove
|
|
3829
|
+
renderer.remove(node, parent);
|
|
3908
3830
|
if (process.env.NODE_ENV !== 'production') {
|
|
3909
3831
|
lockDomMutation();
|
|
3910
3832
|
}
|
|
3911
3833
|
}
|
|
3912
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3834
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3913
3835
|
if (isNull(oldVnode)) {
|
|
3914
|
-
applyEventListeners(vnode);
|
|
3915
|
-
applyStaticClassAttribute(vnode);
|
|
3916
|
-
applyStaticStyleAttribute(vnode);
|
|
3836
|
+
applyEventListeners(vnode, renderer);
|
|
3837
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3838
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3917
3839
|
}
|
|
3918
3840
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3919
3841
|
// value is set before type=radio.
|
|
3920
|
-
patchClassAttribute(oldVnode, vnode);
|
|
3921
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
3922
|
-
patchAttributes(oldVnode, vnode);
|
|
3923
|
-
patchProps(oldVnode, vnode);
|
|
3842
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3843
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3844
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3845
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3924
3846
|
}
|
|
3925
|
-
function fallbackElmHook(elm, vnode) {
|
|
3847
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
3926
3848
|
const { owner } = vnode;
|
|
3927
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3849
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3928
3850
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3929
3851
|
const { data: { context }, } = vnode;
|
|
3930
3852
|
const { stylesheetToken } = owner.context;
|
|
@@ -3972,7 +3894,7 @@ function allocateChildren(vnode, vm) {
|
|
|
3972
3894
|
vnode.children = EmptyArray;
|
|
3973
3895
|
}
|
|
3974
3896
|
}
|
|
3975
|
-
function createViewModelHook(elm, vnode) {
|
|
3897
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
3976
3898
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3977
3899
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3978
3900
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -3981,7 +3903,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3981
3903
|
return vm;
|
|
3982
3904
|
}
|
|
3983
3905
|
const { sel, mode, ctor, owner } = vnode;
|
|
3984
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3906
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3985
3907
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3986
3908
|
const { stylesheetToken } = owner.context;
|
|
3987
3909
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3990,7 +3912,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3990
3912
|
setElementShadowToken(elm, stylesheetToken);
|
|
3991
3913
|
}
|
|
3992
3914
|
}
|
|
3993
|
-
vm = createVM(elm, ctor, {
|
|
3915
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3994
3916
|
mode,
|
|
3995
3917
|
owner,
|
|
3996
3918
|
tagName: sel,
|
|
@@ -4065,7 +3987,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4065
3987
|
}
|
|
4066
3988
|
return map;
|
|
4067
3989
|
}
|
|
4068
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3990
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4069
3991
|
let oldStartIdx = 0;
|
|
4070
3992
|
let newStartIdx = 0;
|
|
4071
3993
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4094,26 +4016,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4094
4016
|
newEndVnode = newCh[--newEndIdx];
|
|
4095
4017
|
}
|
|
4096
4018
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4097
|
-
patch(oldStartVnode, newStartVnode);
|
|
4019
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4098
4020
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4099
4021
|
newStartVnode = newCh[++newStartIdx];
|
|
4100
4022
|
}
|
|
4101
4023
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4102
|
-
patch(oldEndVnode, newEndVnode);
|
|
4024
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4103
4025
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4104
4026
|
newEndVnode = newCh[--newEndIdx];
|
|
4105
4027
|
}
|
|
4106
4028
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4107
4029
|
// Vnode moved right
|
|
4108
|
-
patch(oldStartVnode, newEndVnode);
|
|
4109
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4030
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4031
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4110
4032
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4111
4033
|
newEndVnode = newCh[--newEndIdx];
|
|
4112
4034
|
}
|
|
4113
4035
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4114
4036
|
// Vnode moved left
|
|
4115
|
-
patch(oldEndVnode, newStartVnode);
|
|
4116
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4037
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4038
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4117
4039
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4118
4040
|
newStartVnode = newCh[++newStartIdx];
|
|
4119
4041
|
}
|
|
@@ -4124,7 +4046,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4124
4046
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4125
4047
|
if (isUndefined$1(idxInOld)) {
|
|
4126
4048
|
// New element
|
|
4127
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4049
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4128
4050
|
newStartVnode = newCh[++newStartIdx];
|
|
4129
4051
|
}
|
|
4130
4052
|
else {
|
|
@@ -4132,10 +4054,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4132
4054
|
if (isVNode(elmToMove)) {
|
|
4133
4055
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4134
4056
|
// New element
|
|
4135
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4057
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4136
4058
|
}
|
|
4137
4059
|
else {
|
|
4138
|
-
patch(elmToMove, newStartVnode);
|
|
4060
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4139
4061
|
// Delete the old child, but copy the array since it is read-only.
|
|
4140
4062
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4141
4063
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4147,7 +4069,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4147
4069
|
}
|
|
4148
4070
|
// We've already cloned at least once, so it's no longer read-only
|
|
4149
4071
|
oldCh[idxInOld] = undefined;
|
|
4150
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4072
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4151
4073
|
}
|
|
4152
4074
|
}
|
|
4153
4075
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4164,25 +4086,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4164
4086
|
n = newCh[++i];
|
|
4165
4087
|
} while (!isVNode(n) && i < newChEnd);
|
|
4166
4088
|
before = isVNode(n) ? n.elm : null;
|
|
4167
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4089
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4168
4090
|
}
|
|
4169
4091
|
else {
|
|
4170
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4092
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4171
4093
|
}
|
|
4172
4094
|
}
|
|
4173
4095
|
}
|
|
4174
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4096
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4175
4097
|
const c1Length = c1.length;
|
|
4176
4098
|
const c2Length = c2.length;
|
|
4177
4099
|
if (c1Length === 0) {
|
|
4178
4100
|
// the old list is empty, we can directly insert anything new
|
|
4179
|
-
mountVNodes(c2, parent, null);
|
|
4101
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4180
4102
|
return;
|
|
4181
4103
|
}
|
|
4182
4104
|
if (c2Length === 0) {
|
|
4183
4105
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4184
4106
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4185
|
-
unmountVNodes(c1, parent, true);
|
|
4107
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4186
4108
|
return;
|
|
4187
4109
|
}
|
|
4188
4110
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4195,16 +4117,16 @@ function updateStaticChildren(c1, c2, parent) {
|
|
|
4195
4117
|
if (isVNode(n1)) {
|
|
4196
4118
|
if (isVNode(n2)) {
|
|
4197
4119
|
// both vnodes are equivalent, and we just need to patch them
|
|
4198
|
-
patch(n1, n2);
|
|
4120
|
+
patch(n1, n2, renderer);
|
|
4199
4121
|
anchor = n2.elm;
|
|
4200
4122
|
}
|
|
4201
4123
|
else {
|
|
4202
4124
|
// removing the old vnode since the new one is null
|
|
4203
|
-
unmount(n1, parent, true);
|
|
4125
|
+
unmount(n1, parent, renderer, true);
|
|
4204
4126
|
}
|
|
4205
4127
|
}
|
|
4206
4128
|
else if (isVNode(n2)) {
|
|
4207
|
-
mount(n2, parent, anchor);
|
|
4129
|
+
mount(n2, parent, renderer, anchor);
|
|
4208
4130
|
anchor = n2.elm;
|
|
4209
4131
|
}
|
|
4210
4132
|
}
|
|
@@ -4221,6 +4143,17 @@ const SymbolIterator = Symbol.iterator;
|
|
|
4221
4143
|
function addVNodeToChildLWC(vnode) {
|
|
4222
4144
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4223
4145
|
}
|
|
4146
|
+
// [st]atic node
|
|
4147
|
+
function st(fragment, key) {
|
|
4148
|
+
return {
|
|
4149
|
+
type: 4 /* Static */,
|
|
4150
|
+
sel: undefined,
|
|
4151
|
+
key,
|
|
4152
|
+
elm: undefined,
|
|
4153
|
+
fragment,
|
|
4154
|
+
owner: getVMBeingRendered(),
|
|
4155
|
+
};
|
|
4156
|
+
}
|
|
4224
4157
|
// [h]tml node
|
|
4225
4158
|
function h(sel, data, children = EmptyArray) {
|
|
4226
4159
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -4610,6 +4543,7 @@ const api = freeze({
|
|
|
4610
4543
|
co,
|
|
4611
4544
|
dc,
|
|
4612
4545
|
ti,
|
|
4546
|
+
st,
|
|
4613
4547
|
gid,
|
|
4614
4548
|
fid,
|
|
4615
4549
|
shc,
|
|
@@ -4633,7 +4567,7 @@ function createInlineStyleVNode(content) {
|
|
|
4633
4567
|
}, [api.t(content)]);
|
|
4634
4568
|
}
|
|
4635
4569
|
function updateStylesheetToken(vm, template) {
|
|
4636
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4570
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4637
4571
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4638
4572
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4639
4573
|
const { hasScopedStyles } = context;
|
|
@@ -4644,10 +4578,10 @@ function updateStylesheetToken(vm, template) {
|
|
|
4644
4578
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4645
4579
|
if (!isUndefined$1(oldToken)) {
|
|
4646
4580
|
if (oldHasTokenInClass) {
|
|
4647
|
-
getClassList
|
|
4581
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4648
4582
|
}
|
|
4649
4583
|
if (oldHasTokenInAttribute) {
|
|
4650
|
-
removeAttribute
|
|
4584
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4651
4585
|
}
|
|
4652
4586
|
}
|
|
4653
4587
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4658,11 +4592,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
4658
4592
|
// Set the new styling token on the host element
|
|
4659
4593
|
if (!isUndefined$1(newToken)) {
|
|
4660
4594
|
if (hasScopedStyles) {
|
|
4661
|
-
getClassList
|
|
4595
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4662
4596
|
newHasTokenInClass = true;
|
|
4663
4597
|
}
|
|
4664
4598
|
if (isSyntheticShadow) {
|
|
4665
|
-
setAttribute
|
|
4599
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4666
4600
|
newHasTokenInAttribute = true;
|
|
4667
4601
|
}
|
|
4668
4602
|
}
|
|
@@ -4750,19 +4684,18 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
4750
4684
|
return owner;
|
|
4751
4685
|
}
|
|
4752
4686
|
function createStylesheet(vm, stylesheets) {
|
|
4753
|
-
const { renderMode, shadowMode } = vm;
|
|
4687
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4754
4688
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4755
4689
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4756
|
-
insertStylesheet
|
|
4690
|
+
insertStylesheet(stylesheets[i]);
|
|
4757
4691
|
}
|
|
4758
4692
|
}
|
|
4759
|
-
else if (ssr
|
|
4693
|
+
else if (ssr || vm.hydrated) {
|
|
4760
4694
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4761
4695
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4762
4696
|
// the first time the VM renders.
|
|
4763
4697
|
// native shadow or light DOM, SSR
|
|
4764
|
-
|
|
4765
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
4698
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4766
4699
|
}
|
|
4767
4700
|
else {
|
|
4768
4701
|
// native shadow or light DOM, DOM renderer
|
|
@@ -4770,7 +4703,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4770
4703
|
// null root means a global style
|
|
4771
4704
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4772
4705
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4773
|
-
insertStylesheet
|
|
4706
|
+
insertStylesheet(stylesheets[i], target);
|
|
4774
4707
|
}
|
|
4775
4708
|
}
|
|
4776
4709
|
return null;
|
|
@@ -4896,6 +4829,54 @@ function validateLightDomTemplate(template, vm) {
|
|
|
4896
4829
|
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"`);
|
|
4897
4830
|
}
|
|
4898
4831
|
}
|
|
4832
|
+
function buildParseFragmentFn(createFragmentFn) {
|
|
4833
|
+
return (strings, ...keys) => {
|
|
4834
|
+
const cache = create(null);
|
|
4835
|
+
return function () {
|
|
4836
|
+
const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
|
|
4837
|
+
const hasStyleToken = !isUndefined$1(stylesheetToken);
|
|
4838
|
+
const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
|
|
4839
|
+
let cacheKey = 0;
|
|
4840
|
+
if (hasStyleToken && hasScopedStyles) {
|
|
4841
|
+
cacheKey |= 1 /* HAS_SCOPED_STYLE */;
|
|
4842
|
+
}
|
|
4843
|
+
if (hasStyleToken && isSyntheticShadow) {
|
|
4844
|
+
cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
|
|
4845
|
+
}
|
|
4846
|
+
if (!isUndefined$1(cache[cacheKey])) {
|
|
4847
|
+
return cache[cacheKey];
|
|
4848
|
+
}
|
|
4849
|
+
const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
|
|
4850
|
+
const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
|
|
4851
|
+
const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
4852
|
+
let htmlFragment = '';
|
|
4853
|
+
for (let i = 0, n = keys.length; i < n; i++) {
|
|
4854
|
+
switch (keys[i]) {
|
|
4855
|
+
case 0: // styleToken in existing class attr
|
|
4856
|
+
htmlFragment += strings[i] + classToken;
|
|
4857
|
+
break;
|
|
4858
|
+
case 1: // styleToken for added class attr
|
|
4859
|
+
htmlFragment += strings[i] + classAttrToken;
|
|
4860
|
+
break;
|
|
4861
|
+
case 2: // styleToken as attr
|
|
4862
|
+
htmlFragment += strings[i] + attrToken;
|
|
4863
|
+
break;
|
|
4864
|
+
case 3: // ${1}${2}
|
|
4865
|
+
htmlFragment += strings[i] + classAttrToken + attrToken;
|
|
4866
|
+
break;
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
htmlFragment += strings[strings.length - 1];
|
|
4870
|
+
cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
|
|
4871
|
+
return cache[cacheKey];
|
|
4872
|
+
};
|
|
4873
|
+
};
|
|
4874
|
+
}
|
|
4875
|
+
// Note: at the moment this code executes, we don't have a renderer yet.
|
|
4876
|
+
const parseFragment = buildParseFragmentFn((html, renderer) => {
|
|
4877
|
+
const { createFragment } = renderer;
|
|
4878
|
+
return createFragment(html);
|
|
4879
|
+
});
|
|
4899
4880
|
function evaluateTemplate(vm, html) {
|
|
4900
4881
|
if (process.env.NODE_ENV !== 'production') {
|
|
4901
4882
|
assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
|
|
@@ -4942,7 +4923,7 @@ function evaluateTemplate(vm, html) {
|
|
|
4942
4923
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
4943
4924
|
// re-rendering.
|
|
4944
4925
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
4945
|
-
context.
|
|
4926
|
+
context.styleVNodes =
|
|
4946
4927
|
stylesheetsContent.length === 0
|
|
4947
4928
|
? null
|
|
4948
4929
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -4959,9 +4940,9 @@ function evaluateTemplate(vm, html) {
|
|
|
4959
4940
|
// Set the global flag that template is being updated
|
|
4960
4941
|
isUpdatingTemplate = true;
|
|
4961
4942
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
4962
|
-
const {
|
|
4963
|
-
if (!isNull(
|
|
4964
|
-
ArrayUnshift.
|
|
4943
|
+
const { styleVNodes } = context;
|
|
4944
|
+
if (!isNull(styleVNodes)) {
|
|
4945
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
4965
4946
|
}
|
|
4966
4947
|
});
|
|
4967
4948
|
}, () => {
|
|
@@ -5278,9 +5259,20 @@ function removeVM(vm) {
|
|
|
5278
5259
|
|
|
5279
5260
|
resetComponentStateWhenRemoved(vm);
|
|
5280
5261
|
}
|
|
5281
|
-
function createVM(elm, ctor, options) {
|
|
5282
|
-
var _a;
|
|
5283
5262
|
|
|
5263
|
+
function getNearestShadowAncestor(vm) {
|
|
5264
|
+
let ancestor = vm.owner;
|
|
5265
|
+
|
|
5266
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5267
|
+
/* Light */
|
|
5268
|
+
) {
|
|
5269
|
+
ancestor = ancestor.owner;
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5272
|
+
return ancestor;
|
|
5273
|
+
}
|
|
5274
|
+
|
|
5275
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5284
5276
|
const {
|
|
5285
5277
|
mode,
|
|
5286
5278
|
owner,
|
|
@@ -5310,28 +5302,29 @@ function createVM(elm, ctor, options) {
|
|
|
5310
5302
|
cmpTemplate: null,
|
|
5311
5303
|
hydrated: Boolean(hydrated),
|
|
5312
5304
|
renderMode: def.renderMode,
|
|
5313
|
-
shadowMode: computeShadowMode(def, owner),
|
|
5314
|
-
nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
|
|
5315
5305
|
context: {
|
|
5316
5306
|
stylesheetToken: undefined,
|
|
5317
5307
|
hasTokenInClass: undefined,
|
|
5318
5308
|
hasTokenInAttribute: undefined,
|
|
5319
5309
|
hasScopedStyles: undefined,
|
|
5320
|
-
|
|
5310
|
+
styleVNodes: null,
|
|
5321
5311
|
tplCache: EmptyObject,
|
|
5322
5312
|
wiredConnecting: EmptyArray,
|
|
5323
5313
|
wiredDisconnecting: EmptyArray
|
|
5324
5314
|
},
|
|
5325
5315
|
// Properties set right after VM creation.
|
|
5326
5316
|
tro: null,
|
|
5317
|
+
shadowMode: null,
|
|
5327
5318
|
// Properties set by the LightningElement constructor.
|
|
5328
5319
|
component: null,
|
|
5329
5320
|
shadowRoot: null,
|
|
5330
5321
|
renderRoot: null,
|
|
5331
5322
|
callHook,
|
|
5332
5323
|
setHook,
|
|
5333
|
-
getHook
|
|
5324
|
+
getHook,
|
|
5325
|
+
renderer
|
|
5334
5326
|
};
|
|
5327
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5335
5328
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5336
5329
|
|
|
5337
5330
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5356,12 +5349,17 @@ function createVM(elm, ctor, options) {
|
|
|
5356
5349
|
return vm;
|
|
5357
5350
|
}
|
|
5358
5351
|
|
|
5359
|
-
function computeShadowMode(
|
|
5360
|
-
|
|
5361
|
-
|
|
5352
|
+
function computeShadowMode(vm, renderer) {
|
|
5353
|
+
const {
|
|
5354
|
+
def
|
|
5355
|
+
} = vm;
|
|
5356
|
+
const {
|
|
5357
|
+
isSyntheticShadowDefined,
|
|
5358
|
+
isNativeShadowDefined
|
|
5359
|
+
} = renderer;
|
|
5362
5360
|
let shadowMode;
|
|
5363
5361
|
|
|
5364
|
-
if (isSyntheticShadowDefined
|
|
5362
|
+
if (isSyntheticShadowDefined) {
|
|
5365
5363
|
if (def.renderMode === 0
|
|
5366
5364
|
/* Light */
|
|
5367
5365
|
) {
|
|
@@ -5370,7 +5368,7 @@ function computeShadowMode(def, owner) {
|
|
|
5370
5368
|
shadowMode = 0
|
|
5371
5369
|
/* Native */
|
|
5372
5370
|
;
|
|
5373
|
-
} else if (isNativeShadowDefined
|
|
5371
|
+
} else if (isNativeShadowDefined) {
|
|
5374
5372
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5375
5373
|
// the if-condition.
|
|
5376
5374
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5381,13 +5379,23 @@ function computeShadowMode(def, owner) {
|
|
|
5381
5379
|
/* Native */
|
|
5382
5380
|
;
|
|
5383
5381
|
} else {
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5382
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5383
|
+
|
|
5384
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5385
|
+
/* Native */
|
|
5386
|
+
) {
|
|
5387
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5388
|
+
// transitively opts all of its descendants into native.
|
|
5389
|
+
shadowMode = 0
|
|
5390
|
+
/* Native */
|
|
5391
|
+
;
|
|
5392
|
+
} else {
|
|
5393
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5394
|
+
// to be native.
|
|
5395
|
+
shadowMode = 1
|
|
5396
|
+
/* Synthetic */
|
|
5397
|
+
;
|
|
5398
|
+
}
|
|
5391
5399
|
}
|
|
5392
5400
|
} else {
|
|
5393
5401
|
shadowMode = 1
|
|
@@ -5450,7 +5458,8 @@ function rehydrate(vm) {
|
|
|
5450
5458
|
function patchShadowRoot(vm, newCh) {
|
|
5451
5459
|
const {
|
|
5452
5460
|
renderRoot,
|
|
5453
|
-
children: oldCh
|
|
5461
|
+
children: oldCh,
|
|
5462
|
+
renderer
|
|
5454
5463
|
} = vm; // caching the new children collection
|
|
5455
5464
|
|
|
5456
5465
|
vm.children = newCh;
|
|
@@ -5466,7 +5475,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5466
5475
|
, vm);
|
|
5467
5476
|
}, () => {
|
|
5468
5477
|
// job
|
|
5469
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5478
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5470
5479
|
}, () => {
|
|
5471
5480
|
// post
|
|
5472
5481
|
logOperationEnd(2
|
|
@@ -5491,10 +5500,13 @@ function runRenderedCallback(vm) {
|
|
|
5491
5500
|
const {
|
|
5492
5501
|
def: {
|
|
5493
5502
|
renderedCallback
|
|
5503
|
+
},
|
|
5504
|
+
renderer: {
|
|
5505
|
+
ssr
|
|
5494
5506
|
}
|
|
5495
5507
|
} = vm;
|
|
5496
5508
|
|
|
5497
|
-
if (isTrue(ssr
|
|
5509
|
+
if (isTrue(ssr)) {
|
|
5498
5510
|
return;
|
|
5499
5511
|
}
|
|
5500
5512
|
|
|
@@ -5728,14 +5740,17 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5728
5740
|
function resetComponentRoot(vm) {
|
|
5729
5741
|
const {
|
|
5730
5742
|
children,
|
|
5731
|
-
renderRoot
|
|
5743
|
+
renderRoot,
|
|
5744
|
+
renderer: {
|
|
5745
|
+
remove
|
|
5746
|
+
}
|
|
5732
5747
|
} = vm;
|
|
5733
5748
|
|
|
5734
5749
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5735
5750
|
const child = children[i];
|
|
5736
5751
|
|
|
5737
5752
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5738
|
-
remove
|
|
5753
|
+
remove(child.elm, renderRoot);
|
|
5739
5754
|
}
|
|
5740
5755
|
}
|
|
5741
5756
|
|
|
@@ -5744,7 +5759,13 @@ function resetComponentRoot(vm) {
|
|
|
5744
5759
|
vm.velements = EmptyArray;
|
|
5745
5760
|
}
|
|
5746
5761
|
function scheduleRehydration(vm) {
|
|
5747
|
-
|
|
5762
|
+
const {
|
|
5763
|
+
renderer: {
|
|
5764
|
+
ssr
|
|
5765
|
+
}
|
|
5766
|
+
} = vm;
|
|
5767
|
+
|
|
5768
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5748
5769
|
return;
|
|
5749
5770
|
}
|
|
5750
5771
|
|
|
@@ -5903,6 +5924,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5903
5924
|
context: {
|
|
5904
5925
|
wiredConnecting,
|
|
5905
5926
|
wiredDisconnecting
|
|
5927
|
+
},
|
|
5928
|
+
renderer: {
|
|
5929
|
+
dispatchEvent
|
|
5906
5930
|
}
|
|
5907
5931
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
5908
5932
|
|
|
@@ -5926,7 +5950,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5926
5950
|
}
|
|
5927
5951
|
|
|
5928
5952
|
});
|
|
5929
|
-
dispatchEvent
|
|
5953
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
5930
5954
|
});
|
|
5931
5955
|
}
|
|
5932
5956
|
|
|
@@ -6266,7 +6290,7 @@ function freezeTemplate(tmpl) {
|
|
|
6266
6290
|
});
|
|
6267
6291
|
}
|
|
6268
6292
|
}
|
|
6269
|
-
/* version: 2.
|
|
6293
|
+
/* version: 2.15.0 */
|
|
6270
6294
|
|
|
6271
6295
|
/*
|
|
6272
6296
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6339,6 +6363,9 @@ class HTMLElementImpl {
|
|
|
6339
6363
|
}
|
|
6340
6364
|
}
|
|
6341
6365
|
const ssr = true;
|
|
6366
|
+
function isHydrating() {
|
|
6367
|
+
return false;
|
|
6368
|
+
}
|
|
6342
6369
|
const isNativeShadowDefined = false;
|
|
6343
6370
|
const isSyntheticShadowDefined = false;
|
|
6344
6371
|
function insert(node, parent, anchor) {
|
|
@@ -6359,6 +6386,16 @@ function remove(node, parent) {
|
|
|
6359
6386
|
const nodeIndex = parent.children.indexOf(node);
|
|
6360
6387
|
parent.children.splice(nodeIndex, 1);
|
|
6361
6388
|
}
|
|
6389
|
+
function cloneNode(node) {
|
|
6390
|
+
return node;
|
|
6391
|
+
}
|
|
6392
|
+
function createFragment(html) {
|
|
6393
|
+
return {
|
|
6394
|
+
type: HostNodeType.Raw,
|
|
6395
|
+
parent: null,
|
|
6396
|
+
value: html,
|
|
6397
|
+
};
|
|
6398
|
+
}
|
|
6362
6399
|
function createText(content) {
|
|
6363
6400
|
return {
|
|
6364
6401
|
type: HostNodeType.Text,
|
|
@@ -6565,68 +6602,49 @@ function getCustomElement(name) {
|
|
|
6565
6602
|
const HTMLElementExported = HTMLElementImpl;
|
|
6566
6603
|
/* noop */
|
|
6567
6604
|
const assertInstanceOfHTMLElement = noop;
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
setSsr(ssr);
|
|
6611
|
-
setAddEventListener(addEventListener);
|
|
6612
|
-
setInsertStylesheet(insertStylesheet);
|
|
6613
|
-
|
|
6614
|
-
/*
|
|
6615
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
6616
|
-
* All rights reserved.
|
|
6617
|
-
* SPDX-License-Identifier: MIT
|
|
6618
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6619
|
-
*/
|
|
6620
|
-
const ESCAPED_CHARS = {
|
|
6621
|
-
'"': '"',
|
|
6622
|
-
"'": ''',
|
|
6623
|
-
'<': '<',
|
|
6624
|
-
'>': '>',
|
|
6625
|
-
'&': '&',
|
|
6605
|
+
const renderer = {
|
|
6606
|
+
ssr,
|
|
6607
|
+
isNativeShadowDefined,
|
|
6608
|
+
isSyntheticShadowDefined,
|
|
6609
|
+
HTMLElementExported,
|
|
6610
|
+
isHydrating,
|
|
6611
|
+
insert,
|
|
6612
|
+
remove,
|
|
6613
|
+
cloneNode,
|
|
6614
|
+
createFragment,
|
|
6615
|
+
createElement,
|
|
6616
|
+
createText,
|
|
6617
|
+
createComment,
|
|
6618
|
+
nextSibling,
|
|
6619
|
+
attachShadow,
|
|
6620
|
+
getProperty,
|
|
6621
|
+
setProperty,
|
|
6622
|
+
setText,
|
|
6623
|
+
getAttribute,
|
|
6624
|
+
setAttribute,
|
|
6625
|
+
removeAttribute,
|
|
6626
|
+
addEventListener,
|
|
6627
|
+
removeEventListener,
|
|
6628
|
+
dispatchEvent,
|
|
6629
|
+
getClassList,
|
|
6630
|
+
setCSSStyleProperty,
|
|
6631
|
+
getBoundingClientRect,
|
|
6632
|
+
querySelector,
|
|
6633
|
+
querySelectorAll,
|
|
6634
|
+
getElementsByTagName,
|
|
6635
|
+
getElementsByClassName,
|
|
6636
|
+
getChildren,
|
|
6637
|
+
getChildNodes,
|
|
6638
|
+
getFirstChild,
|
|
6639
|
+
getFirstElementChild,
|
|
6640
|
+
getLastChild,
|
|
6641
|
+
getLastElementChild,
|
|
6642
|
+
isConnected,
|
|
6643
|
+
insertStylesheet,
|
|
6644
|
+
assertInstanceOfHTMLElement,
|
|
6645
|
+
defineCustomElement,
|
|
6646
|
+
getCustomElement,
|
|
6626
6647
|
};
|
|
6627
|
-
function htmlEscape(str) {
|
|
6628
|
-
return str.replace(/["'<>&]/g, (char) => ESCAPED_CHARS[char]);
|
|
6629
|
-
}
|
|
6630
6648
|
|
|
6631
6649
|
/*
|
|
6632
6650
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6703,8 +6721,8 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6703
6721
|
if (!isObject(props) || isNull(props)) {
|
|
6704
6722
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6705
6723
|
}
|
|
6706
|
-
const element = createElement(tagName);
|
|
6707
|
-
createVM(element, Ctor, {
|
|
6724
|
+
const element = renderer.createElement(tagName);
|
|
6725
|
+
createVM(element, Ctor, renderer, {
|
|
6708
6726
|
mode: 'open',
|
|
6709
6727
|
owner: null,
|
|
6710
6728
|
tagName,
|
|
@@ -6725,6 +6743,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6725
6743
|
*/
|
|
6726
6744
|
freeze(LightningElement);
|
|
6727
6745
|
seal(LightningElement.prototype);
|
|
6728
|
-
/* version: 2.
|
|
6746
|
+
/* version: 2.15.0 */
|
|
6729
6747
|
|
|
6730
|
-
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|
|
6748
|
+
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|