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
|
@@ -229,6 +229,7 @@ const _globalThis = /*@__PURE__*/ (function () {
|
|
|
229
229
|
return _globalThis;
|
|
230
230
|
})();
|
|
231
231
|
const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
232
|
+
const KEY__SHADOW_STATIC = '$shadowStaticNode$';
|
|
232
233
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
233
234
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
234
235
|
|
|
@@ -410,6 +411,24 @@ function htmlPropertyToAttribute(propName) {
|
|
|
410
411
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
411
412
|
return attributeName;
|
|
412
413
|
}
|
|
414
|
+
|
|
415
|
+
/*
|
|
416
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
417
|
+
* All rights reserved.
|
|
418
|
+
* SPDX-License-Identifier: MIT
|
|
419
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
420
|
+
*/
|
|
421
|
+
const ESCAPED_CHARS = {
|
|
422
|
+
'"': '"',
|
|
423
|
+
"'": ''',
|
|
424
|
+
'<': '<',
|
|
425
|
+
'>': '>',
|
|
426
|
+
'&': '&',
|
|
427
|
+
};
|
|
428
|
+
function htmlEscape(str, attrMode = false) {
|
|
429
|
+
const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
|
|
430
|
+
return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
|
|
431
|
+
}
|
|
413
432
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
414
433
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
415
434
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -421,9 +440,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
421
440
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
422
441
|
*/
|
|
423
442
|
// Increment whenever the LWC template compiler changes
|
|
424
|
-
const LWC_VERSION = "2.
|
|
443
|
+
const LWC_VERSION = "2.16.0";
|
|
425
444
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
426
|
-
/** version: 2.
|
|
445
|
+
/** version: 2.16.0 */
|
|
427
446
|
|
|
428
447
|
/*
|
|
429
448
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -532,7 +551,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
532
551
|
setFeatureFlag(name, value);
|
|
533
552
|
}
|
|
534
553
|
}
|
|
535
|
-
/** version: 2.
|
|
554
|
+
/** version: 2.16.0 */
|
|
536
555
|
|
|
537
556
|
/* proxy-compat-disable */
|
|
538
557
|
|
|
@@ -615,162 +634,6 @@ function flattenStylesheets(stylesheets) {
|
|
|
615
634
|
return list;
|
|
616
635
|
}
|
|
617
636
|
|
|
618
|
-
//
|
|
619
|
-
// Primitives
|
|
620
|
-
//
|
|
621
|
-
let ssr$1;
|
|
622
|
-
function setSsr(ssrImpl) {
|
|
623
|
-
ssr$1 = ssrImpl;
|
|
624
|
-
}
|
|
625
|
-
let isNativeShadowDefined$1;
|
|
626
|
-
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
627
|
-
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
628
|
-
}
|
|
629
|
-
let isSyntheticShadowDefined$1;
|
|
630
|
-
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
631
|
-
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
632
|
-
}
|
|
633
|
-
let HTMLElementExported$1;
|
|
634
|
-
function setHTMLElement(HTMLElementImpl) {
|
|
635
|
-
HTMLElementExported$1 = HTMLElementImpl;
|
|
636
|
-
}
|
|
637
|
-
let insert$1;
|
|
638
|
-
function setInsert(insertImpl) {
|
|
639
|
-
insert$1 = insertImpl;
|
|
640
|
-
}
|
|
641
|
-
let remove$1;
|
|
642
|
-
function setRemove(removeImpl) {
|
|
643
|
-
remove$1 = removeImpl;
|
|
644
|
-
}
|
|
645
|
-
let createElement$1;
|
|
646
|
-
function setCreateElement(createElementImpl) {
|
|
647
|
-
createElement$1 = createElementImpl;
|
|
648
|
-
}
|
|
649
|
-
let createText$1;
|
|
650
|
-
function setCreateText(createTextImpl) {
|
|
651
|
-
createText$1 = createTextImpl;
|
|
652
|
-
}
|
|
653
|
-
let createComment$1;
|
|
654
|
-
function setCreateComment(createCommentImpl) {
|
|
655
|
-
createComment$1 = createCommentImpl;
|
|
656
|
-
}
|
|
657
|
-
let nextSibling$1;
|
|
658
|
-
function setNextSibling(nextSiblingImpl) {
|
|
659
|
-
nextSibling$1 = nextSiblingImpl;
|
|
660
|
-
}
|
|
661
|
-
let attachShadow$1;
|
|
662
|
-
function setAttachShadow(attachShadowImpl) {
|
|
663
|
-
attachShadow$1 = attachShadowImpl;
|
|
664
|
-
}
|
|
665
|
-
let getProperty$1;
|
|
666
|
-
function setGetProperty(getPropertyImpl) {
|
|
667
|
-
getProperty$1 = getPropertyImpl;
|
|
668
|
-
}
|
|
669
|
-
let setProperty$1;
|
|
670
|
-
function setSetProperty(setPropertyImpl) {
|
|
671
|
-
setProperty$1 = setPropertyImpl;
|
|
672
|
-
}
|
|
673
|
-
let setText$1;
|
|
674
|
-
function setSetText(setTextImpl) {
|
|
675
|
-
setText$1 = setTextImpl;
|
|
676
|
-
}
|
|
677
|
-
let getAttribute$1;
|
|
678
|
-
function setGetAttribute(getAttributeImpl) {
|
|
679
|
-
getAttribute$1 = getAttributeImpl;
|
|
680
|
-
}
|
|
681
|
-
let setAttribute$1;
|
|
682
|
-
function setSetAttribute(setAttributeImpl) {
|
|
683
|
-
setAttribute$1 = setAttributeImpl;
|
|
684
|
-
}
|
|
685
|
-
let removeAttribute$1;
|
|
686
|
-
function setRemoveAttribute(removeAttributeImpl) {
|
|
687
|
-
removeAttribute$1 = removeAttributeImpl;
|
|
688
|
-
}
|
|
689
|
-
let addEventListener$1;
|
|
690
|
-
function setAddEventListener(addEventListenerImpl) {
|
|
691
|
-
addEventListener$1 = addEventListenerImpl;
|
|
692
|
-
}
|
|
693
|
-
let removeEventListener$1;
|
|
694
|
-
function setRemoveEventListener(removeEventListenerImpl) {
|
|
695
|
-
removeEventListener$1 = removeEventListenerImpl;
|
|
696
|
-
}
|
|
697
|
-
let dispatchEvent$1;
|
|
698
|
-
function setDispatchEvent(dispatchEventImpl) {
|
|
699
|
-
dispatchEvent$1 = dispatchEventImpl;
|
|
700
|
-
}
|
|
701
|
-
let getClassList$1;
|
|
702
|
-
function setGetClassList(getClassListImpl) {
|
|
703
|
-
getClassList$1 = getClassListImpl;
|
|
704
|
-
}
|
|
705
|
-
let setCSSStyleProperty$1;
|
|
706
|
-
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
707
|
-
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
708
|
-
}
|
|
709
|
-
let getBoundingClientRect$1;
|
|
710
|
-
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
711
|
-
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
712
|
-
}
|
|
713
|
-
let querySelector$1;
|
|
714
|
-
function setQuerySelector(querySelectorImpl) {
|
|
715
|
-
querySelector$1 = querySelectorImpl;
|
|
716
|
-
}
|
|
717
|
-
let querySelectorAll$1;
|
|
718
|
-
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
719
|
-
querySelectorAll$1 = querySelectorAllImpl;
|
|
720
|
-
}
|
|
721
|
-
let getElementsByTagName$1;
|
|
722
|
-
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
723
|
-
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
724
|
-
}
|
|
725
|
-
let getElementsByClassName$1;
|
|
726
|
-
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
727
|
-
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
728
|
-
}
|
|
729
|
-
let getChildren$1;
|
|
730
|
-
function setGetChildren(getChildrenImpl) {
|
|
731
|
-
getChildren$1 = getChildrenImpl;
|
|
732
|
-
}
|
|
733
|
-
let getChildNodes$1;
|
|
734
|
-
function setGetChildNodes(getChildNodesImpl) {
|
|
735
|
-
getChildNodes$1 = getChildNodesImpl;
|
|
736
|
-
}
|
|
737
|
-
let getFirstChild$1;
|
|
738
|
-
function setGetFirstChild(getFirstChildImpl) {
|
|
739
|
-
getFirstChild$1 = getFirstChildImpl;
|
|
740
|
-
}
|
|
741
|
-
let getFirstElementChild$1;
|
|
742
|
-
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
743
|
-
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
744
|
-
}
|
|
745
|
-
let getLastChild$1;
|
|
746
|
-
function setGetLastChild(getLastChildImpl) {
|
|
747
|
-
getLastChild$1 = getLastChildImpl;
|
|
748
|
-
}
|
|
749
|
-
let getLastElementChild$1;
|
|
750
|
-
function setGetLastElementChild(getLastElementChildImpl) {
|
|
751
|
-
getLastElementChild$1 = getLastElementChildImpl;
|
|
752
|
-
}
|
|
753
|
-
let isConnected$1;
|
|
754
|
-
function setIsConnected(isConnectedImpl) {
|
|
755
|
-
isConnected$1 = isConnectedImpl;
|
|
756
|
-
}
|
|
757
|
-
let insertStylesheet$1;
|
|
758
|
-
function setInsertStylesheet(insertStylesheetImpl) {
|
|
759
|
-
insertStylesheet$1 = insertStylesheetImpl;
|
|
760
|
-
}
|
|
761
|
-
let assertInstanceOfHTMLElement$1;
|
|
762
|
-
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
763
|
-
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
764
|
-
}
|
|
765
|
-
let defineCustomElement$1;
|
|
766
|
-
function setDefineCustomElement(defineCustomElementImpl) {
|
|
767
|
-
defineCustomElement$1 = defineCustomElementImpl;
|
|
768
|
-
}
|
|
769
|
-
let getCustomElement$1;
|
|
770
|
-
function setGetCustomElement(getCustomElementImpl) {
|
|
771
|
-
getCustomElement$1 = getCustomElementImpl;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
637
|
/*
|
|
775
638
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
776
639
|
* All rights reserved.
|
|
@@ -2072,7 +1935,8 @@ const LightningElement = function () {
|
|
|
2072
1935
|
const { def, elm } = vm;
|
|
2073
1936
|
const { bridge } = def;
|
|
2074
1937
|
if (process.env.NODE_ENV !== 'production') {
|
|
2075
|
-
|
|
1938
|
+
const { assertInstanceOfHTMLElement } = vm.renderer;
|
|
1939
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2076
1940
|
}
|
|
2077
1941
|
const component = this;
|
|
2078
1942
|
setPrototypeOf(elm, bridge.prototype);
|
|
@@ -2106,8 +1970,8 @@ const LightningElement = function () {
|
|
|
2106
1970
|
return this;
|
|
2107
1971
|
};
|
|
2108
1972
|
function doAttachShadow(vm) {
|
|
2109
|
-
const { elm, mode, shadowMode, def: { ctor }, } = vm;
|
|
2110
|
-
const shadowRoot = attachShadow
|
|
1973
|
+
const { elm, mode, shadowMode, def: { ctor }, renderer: { attachShadow }, } = vm;
|
|
1974
|
+
const shadowRoot = attachShadow(elm, {
|
|
2111
1975
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* Synthetic */,
|
|
2112
1976
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2113
1977
|
mode,
|
|
@@ -2128,12 +1992,13 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
|
2128
1992
|
LightningElement.prototype = {
|
|
2129
1993
|
constructor: LightningElement,
|
|
2130
1994
|
dispatchEvent(event) {
|
|
2131
|
-
const
|
|
2132
|
-
|
|
1995
|
+
const vm = getAssociatedVM(this);
|
|
1996
|
+
const { elm, renderer: { dispatchEvent }, } = vm;
|
|
1997
|
+
return dispatchEvent(elm, event);
|
|
2133
1998
|
},
|
|
2134
1999
|
addEventListener(type, listener, options) {
|
|
2135
2000
|
const vm = getAssociatedVM(this);
|
|
2136
|
-
const { elm } = vm;
|
|
2001
|
+
const { elm, renderer: { addEventListener }, } = vm;
|
|
2137
2002
|
if (process.env.NODE_ENV !== 'production') {
|
|
2138
2003
|
const vmBeingRendered = getVMBeingRendered();
|
|
2139
2004
|
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
@@ -2141,83 +2006,91 @@ LightningElement.prototype = {
|
|
|
2141
2006
|
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2142
2007
|
}
|
|
2143
2008
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2144
|
-
addEventListener
|
|
2009
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2145
2010
|
},
|
|
2146
2011
|
removeEventListener(type, listener, options) {
|
|
2147
2012
|
const vm = getAssociatedVM(this);
|
|
2148
|
-
const { elm } = vm;
|
|
2013
|
+
const { elm, renderer: { removeEventListener }, } = vm;
|
|
2149
2014
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2150
|
-
removeEventListener
|
|
2015
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2151
2016
|
},
|
|
2152
2017
|
hasAttribute(name) {
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2018
|
+
const vm = getAssociatedVM(this);
|
|
2019
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2020
|
+
return !isNull(getAttribute(elm, name));
|
|
2155
2021
|
},
|
|
2156
2022
|
hasAttributeNS(namespace, name) {
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2023
|
+
const vm = getAssociatedVM(this);
|
|
2024
|
+
const { elm, renderer: { getAttribute }, } = vm;
|
|
2025
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2159
2026
|
},
|
|
2160
2027
|
removeAttribute(name) {
|
|
2161
|
-
const
|
|
2028
|
+
const vm = getAssociatedVM(this);
|
|
2029
|
+
const { elm, renderer: { removeAttribute }, } = vm;
|
|
2162
2030
|
unlockAttribute(elm, name);
|
|
2163
|
-
removeAttribute
|
|
2031
|
+
removeAttribute(elm, name);
|
|
2164
2032
|
lockAttribute();
|
|
2165
2033
|
},
|
|
2166
2034
|
removeAttributeNS(namespace, name) {
|
|
2167
|
-
const { elm } = getAssociatedVM(this);
|
|
2035
|
+
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2168
2036
|
unlockAttribute(elm, name);
|
|
2169
|
-
removeAttribute
|
|
2037
|
+
removeAttribute(elm, name, namespace);
|
|
2170
2038
|
lockAttribute();
|
|
2171
2039
|
},
|
|
2172
2040
|
getAttribute(name) {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2041
|
+
const vm = getAssociatedVM(this);
|
|
2042
|
+
const { elm } = vm;
|
|
2043
|
+
const { getAttribute } = vm.renderer;
|
|
2044
|
+
return getAttribute(elm, name);
|
|
2175
2045
|
},
|
|
2176
2046
|
getAttributeNS(namespace, name) {
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2047
|
+
const vm = getAssociatedVM(this);
|
|
2048
|
+
const { elm } = vm;
|
|
2049
|
+
const { getAttribute } = vm.renderer;
|
|
2050
|
+
return getAttribute(elm, name, namespace);
|
|
2179
2051
|
},
|
|
2180
2052
|
setAttribute(name, value) {
|
|
2181
2053
|
const vm = getAssociatedVM(this);
|
|
2182
|
-
const { elm } = vm;
|
|
2054
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2183
2055
|
if (process.env.NODE_ENV !== 'production') {
|
|
2184
2056
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2185
2057
|
}
|
|
2186
2058
|
unlockAttribute(elm, name);
|
|
2187
|
-
setAttribute
|
|
2059
|
+
setAttribute(elm, name, value);
|
|
2188
2060
|
lockAttribute();
|
|
2189
2061
|
},
|
|
2190
2062
|
setAttributeNS(namespace, name, value) {
|
|
2191
2063
|
const vm = getAssociatedVM(this);
|
|
2192
|
-
const { elm } = vm;
|
|
2064
|
+
const { elm, renderer: { setAttribute }, } = vm;
|
|
2193
2065
|
if (process.env.NODE_ENV !== 'production') {
|
|
2194
2066
|
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2195
2067
|
}
|
|
2196
2068
|
unlockAttribute(elm, name);
|
|
2197
|
-
setAttribute
|
|
2069
|
+
setAttribute(elm, name, value, namespace);
|
|
2198
2070
|
lockAttribute();
|
|
2199
2071
|
},
|
|
2200
2072
|
getBoundingClientRect() {
|
|
2201
2073
|
const vm = getAssociatedVM(this);
|
|
2202
|
-
const { elm } = vm;
|
|
2074
|
+
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2203
2075
|
if (process.env.NODE_ENV !== 'production') {
|
|
2204
2076
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2205
2077
|
}
|
|
2206
|
-
return getBoundingClientRect
|
|
2078
|
+
return getBoundingClientRect(elm);
|
|
2207
2079
|
},
|
|
2208
2080
|
get isConnected() {
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2081
|
+
const vm = getAssociatedVM(this);
|
|
2082
|
+
const { elm, renderer: { isConnected }, } = vm;
|
|
2083
|
+
return isConnected(elm);
|
|
2211
2084
|
},
|
|
2212
2085
|
get classList() {
|
|
2213
2086
|
const vm = getAssociatedVM(this);
|
|
2214
|
-
const { elm } = vm;
|
|
2087
|
+
const { elm, renderer: { getClassList }, } = vm;
|
|
2215
2088
|
if (process.env.NODE_ENV !== 'production') {
|
|
2216
2089
|
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2217
2090
|
// just throw in all modes
|
|
2218
2091
|
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.`);
|
|
2219
2092
|
}
|
|
2220
|
-
return getClassList
|
|
2093
|
+
return getClassList(elm);
|
|
2221
2094
|
},
|
|
2222
2095
|
get template() {
|
|
2223
2096
|
const vm = getAssociatedVM(this);
|
|
@@ -2233,6 +2106,54 @@ LightningElement.prototype = {
|
|
|
2233
2106
|
// Authors should rely on this.template instead.
|
|
2234
2107
|
return null;
|
|
2235
2108
|
},
|
|
2109
|
+
get children() {
|
|
2110
|
+
const vm = getAssociatedVM(this);
|
|
2111
|
+
const renderer = vm.renderer;
|
|
2112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2113
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2114
|
+
}
|
|
2115
|
+
return renderer.getChildren(vm.elm);
|
|
2116
|
+
},
|
|
2117
|
+
get childNodes() {
|
|
2118
|
+
const vm = getAssociatedVM(this);
|
|
2119
|
+
const renderer = vm.renderer;
|
|
2120
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2121
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2122
|
+
}
|
|
2123
|
+
return renderer.getChildNodes(vm.elm);
|
|
2124
|
+
},
|
|
2125
|
+
get firstChild() {
|
|
2126
|
+
const vm = getAssociatedVM(this);
|
|
2127
|
+
const renderer = vm.renderer;
|
|
2128
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2129
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2130
|
+
}
|
|
2131
|
+
return renderer.getFirstChild(vm.elm);
|
|
2132
|
+
},
|
|
2133
|
+
get firstElementChild() {
|
|
2134
|
+
const vm = getAssociatedVM(this);
|
|
2135
|
+
const renderer = vm.renderer;
|
|
2136
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2137
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2138
|
+
}
|
|
2139
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2140
|
+
},
|
|
2141
|
+
get lastChild() {
|
|
2142
|
+
const vm = getAssociatedVM(this);
|
|
2143
|
+
const renderer = vm.renderer;
|
|
2144
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2145
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2146
|
+
}
|
|
2147
|
+
return renderer.getLastChild(vm.elm);
|
|
2148
|
+
},
|
|
2149
|
+
get lastElementChild() {
|
|
2150
|
+
const vm = getAssociatedVM(this);
|
|
2151
|
+
const renderer = vm.renderer;
|
|
2152
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2153
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2154
|
+
}
|
|
2155
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2156
|
+
},
|
|
2236
2157
|
render() {
|
|
2237
2158
|
const vm = getAssociatedVM(this);
|
|
2238
2159
|
return vm.def.template;
|
|
@@ -2243,76 +2164,22 @@ LightningElement.prototype = {
|
|
|
2243
2164
|
},
|
|
2244
2165
|
};
|
|
2245
2166
|
const queryAndChildGetterDescriptors = create(null);
|
|
2246
|
-
// The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2247
|
-
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2248
|
-
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2249
|
-
const childGetters = [
|
|
2250
|
-
'children',
|
|
2251
|
-
'childNodes',
|
|
2252
|
-
'firstChild',
|
|
2253
|
-
'firstElementChild',
|
|
2254
|
-
'lastChild',
|
|
2255
|
-
'lastElementChild',
|
|
2256
|
-
];
|
|
2257
|
-
function getChildGetter(methodName) {
|
|
2258
|
-
switch (methodName) {
|
|
2259
|
-
case 'children':
|
|
2260
|
-
return getChildren$1;
|
|
2261
|
-
case 'childNodes':
|
|
2262
|
-
return getChildNodes$1;
|
|
2263
|
-
case 'firstChild':
|
|
2264
|
-
return getFirstChild$1;
|
|
2265
|
-
case 'firstElementChild':
|
|
2266
|
-
return getFirstElementChild$1;
|
|
2267
|
-
case 'lastChild':
|
|
2268
|
-
return getLastChild$1;
|
|
2269
|
-
case 'lastElementChild':
|
|
2270
|
-
return getLastElementChild$1;
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
// Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2274
|
-
for (const childGetter of childGetters) {
|
|
2275
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
2276
|
-
get() {
|
|
2277
|
-
const vm = getAssociatedVM(this);
|
|
2278
|
-
const { elm } = vm;
|
|
2279
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2280
|
-
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2281
|
-
}
|
|
2282
|
-
return getChildGetter(childGetter)(elm);
|
|
2283
|
-
},
|
|
2284
|
-
configurable: true,
|
|
2285
|
-
enumerable: true,
|
|
2286
|
-
};
|
|
2287
|
-
}
|
|
2288
2167
|
const queryMethods = [
|
|
2289
2168
|
'getElementsByClassName',
|
|
2290
2169
|
'getElementsByTagName',
|
|
2291
2170
|
'querySelector',
|
|
2292
2171
|
'querySelectorAll',
|
|
2293
2172
|
];
|
|
2294
|
-
function getQueryMethod(methodName) {
|
|
2295
|
-
switch (methodName) {
|
|
2296
|
-
case 'getElementsByClassName':
|
|
2297
|
-
return getElementsByClassName$1;
|
|
2298
|
-
case 'getElementsByTagName':
|
|
2299
|
-
return getElementsByTagName$1;
|
|
2300
|
-
case 'querySelector':
|
|
2301
|
-
return querySelector$1;
|
|
2302
|
-
case 'querySelectorAll':
|
|
2303
|
-
return querySelectorAll$1;
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
2173
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2307
2174
|
for (const queryMethod of queryMethods) {
|
|
2308
2175
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2309
2176
|
value(arg) {
|
|
2310
2177
|
const vm = getAssociatedVM(this);
|
|
2311
|
-
const { elm } = vm;
|
|
2178
|
+
const { elm, renderer } = vm;
|
|
2312
2179
|
if (process.env.NODE_ENV !== 'production') {
|
|
2313
2180
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2314
2181
|
}
|
|
2315
|
-
return
|
|
2182
|
+
return renderer[queryMethod](elm, arg);
|
|
2316
2183
|
},
|
|
2317
2184
|
configurable: true,
|
|
2318
2185
|
enumerable: true,
|
|
@@ -3415,12 +3282,13 @@ function getComponentDef(Ctor) {
|
|
|
3415
3282
|
* SPDX-License-Identifier: MIT
|
|
3416
3283
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3417
3284
|
*/
|
|
3418
|
-
function getUpgradableConstructor(tagName) {
|
|
3285
|
+
function getUpgradableConstructor(tagName, renderer) {
|
|
3286
|
+
const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
|
|
3419
3287
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
3420
3288
|
// produce only tags with lowercase letters
|
|
3421
3289
|
// But, for backwards compatibility, we will lower case the tagName
|
|
3422
3290
|
tagName = tagName.toLowerCase();
|
|
3423
|
-
let CE = getCustomElement
|
|
3291
|
+
let CE = getCustomElement(tagName);
|
|
3424
3292
|
if (!isUndefined$1(CE)) {
|
|
3425
3293
|
return CE;
|
|
3426
3294
|
}
|
|
@@ -3428,7 +3296,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3428
3296
|
* LWC Upgradable Element reference to an element that was created
|
|
3429
3297
|
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3430
3298
|
*/
|
|
3431
|
-
CE = class LWCUpgradableElement extends
|
|
3299
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3432
3300
|
constructor(upgradeCallback) {
|
|
3433
3301
|
super();
|
|
3434
3302
|
if (isFunction$1(upgradeCallback)) {
|
|
@@ -3436,7 +3304,7 @@ function getUpgradableConstructor(tagName) {
|
|
|
3436
3304
|
}
|
|
3437
3305
|
}
|
|
3438
3306
|
};
|
|
3439
|
-
defineCustomElement
|
|
3307
|
+
defineCustomElement(tagName, CE);
|
|
3440
3308
|
return CE;
|
|
3441
3309
|
}
|
|
3442
3310
|
|
|
@@ -3461,7 +3329,7 @@ function isSameVnode(vnode1, vnode2) {
|
|
|
3461
3329
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3462
3330
|
*/
|
|
3463
3331
|
const ColonCharCode = 58;
|
|
3464
|
-
function patchAttributes(oldVnode, vnode) {
|
|
3332
|
+
function patchAttributes(oldVnode, vnode, renderer) {
|
|
3465
3333
|
const { attrs } = vnode.data;
|
|
3466
3334
|
if (isUndefined$1(attrs)) {
|
|
3467
3335
|
return;
|
|
@@ -3471,6 +3339,7 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3471
3339
|
return;
|
|
3472
3340
|
}
|
|
3473
3341
|
const { elm } = vnode;
|
|
3342
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3474
3343
|
for (const key in attrs) {
|
|
3475
3344
|
const cur = attrs[key];
|
|
3476
3345
|
const old = oldAttrs[key];
|
|
@@ -3478,17 +3347,17 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
3478
3347
|
unlockAttribute(elm, key);
|
|
3479
3348
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3480
3349
|
// Assume xml namespace
|
|
3481
|
-
setAttribute
|
|
3350
|
+
setAttribute(elm, key, cur, XML_NAMESPACE);
|
|
3482
3351
|
}
|
|
3483
3352
|
else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3484
3353
|
// Assume xlink namespace
|
|
3485
|
-
setAttribute
|
|
3354
|
+
setAttribute(elm, key, cur, XLINK_NAMESPACE);
|
|
3486
3355
|
}
|
|
3487
3356
|
else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3488
|
-
removeAttribute
|
|
3357
|
+
removeAttribute(elm, key);
|
|
3489
3358
|
}
|
|
3490
3359
|
else {
|
|
3491
|
-
setAttribute
|
|
3360
|
+
setAttribute(elm, key, cur);
|
|
3492
3361
|
}
|
|
3493
3362
|
lockAttribute();
|
|
3494
3363
|
}
|
|
@@ -3506,7 +3375,7 @@ function isLiveBindingProp(sel, key) {
|
|
|
3506
3375
|
// instead of relying on internally tracked values.
|
|
3507
3376
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3508
3377
|
}
|
|
3509
|
-
function patchProps(oldVnode, vnode) {
|
|
3378
|
+
function patchProps(oldVnode, vnode, renderer) {
|
|
3510
3379
|
const { props } = vnode.data;
|
|
3511
3380
|
if (isUndefined$1(props)) {
|
|
3512
3381
|
return;
|
|
@@ -3517,13 +3386,14 @@ function patchProps(oldVnode, vnode) {
|
|
|
3517
3386
|
}
|
|
3518
3387
|
const isFirstPatch = isNull(oldVnode);
|
|
3519
3388
|
const { elm, sel } = vnode;
|
|
3389
|
+
const { getProperty, setProperty } = renderer;
|
|
3520
3390
|
for (const key in props) {
|
|
3521
3391
|
const cur = props[key];
|
|
3522
3392
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3523
3393
|
// different than the one previously set.
|
|
3524
3394
|
if (isFirstPatch ||
|
|
3525
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty
|
|
3526
|
-
setProperty
|
|
3395
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3396
|
+
setProperty(elm, key, cur);
|
|
3527
3397
|
}
|
|
3528
3398
|
}
|
|
3529
3399
|
}
|
|
@@ -3568,13 +3438,14 @@ function getMapFromClassName(className) {
|
|
|
3568
3438
|
}
|
|
3569
3439
|
return map;
|
|
3570
3440
|
}
|
|
3571
|
-
function patchClassAttribute(oldVnode, vnode) {
|
|
3441
|
+
function patchClassAttribute(oldVnode, vnode, renderer) {
|
|
3572
3442
|
const { elm, data: { className: newClass }, } = vnode;
|
|
3573
3443
|
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3574
3444
|
if (oldClass === newClass) {
|
|
3575
3445
|
return;
|
|
3576
3446
|
}
|
|
3577
|
-
const
|
|
3447
|
+
const { getClassList } = renderer;
|
|
3448
|
+
const classList = getClassList(elm);
|
|
3578
3449
|
const newClassMap = getMapFromClassName(newClass);
|
|
3579
3450
|
const oldClassMap = getMapFromClassName(oldClass);
|
|
3580
3451
|
let name;
|
|
@@ -3598,17 +3469,18 @@ function patchClassAttribute(oldVnode, vnode) {
|
|
|
3598
3469
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3599
3470
|
*/
|
|
3600
3471
|
// The style property is a string when defined via an expression in the template.
|
|
3601
|
-
function patchStyleAttribute(oldVnode, vnode) {
|
|
3472
|
+
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
|
3602
3473
|
const { elm, data: { style: newStyle }, } = vnode;
|
|
3603
3474
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3604
3475
|
if (oldStyle === newStyle) {
|
|
3605
3476
|
return;
|
|
3606
3477
|
}
|
|
3478
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3607
3479
|
if (!isString(newStyle) || newStyle === '') {
|
|
3608
|
-
removeAttribute
|
|
3480
|
+
removeAttribute(elm, 'style');
|
|
3609
3481
|
}
|
|
3610
3482
|
else {
|
|
3611
|
-
setAttribute
|
|
3483
|
+
setAttribute(elm, 'style', newStyle);
|
|
3612
3484
|
}
|
|
3613
3485
|
}
|
|
3614
3486
|
|
|
@@ -3618,14 +3490,15 @@ function patchStyleAttribute(oldVnode, vnode) {
|
|
|
3618
3490
|
* SPDX-License-Identifier: MIT
|
|
3619
3491
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3620
3492
|
*/
|
|
3621
|
-
function applyEventListeners(vnode) {
|
|
3493
|
+
function applyEventListeners(vnode, renderer) {
|
|
3622
3494
|
const { elm, data: { on }, } = vnode;
|
|
3623
3495
|
if (isUndefined$1(on)) {
|
|
3624
3496
|
return;
|
|
3625
3497
|
}
|
|
3498
|
+
const { addEventListener } = renderer;
|
|
3626
3499
|
for (const name in on) {
|
|
3627
3500
|
const handler = on[name];
|
|
3628
|
-
addEventListener
|
|
3501
|
+
addEventListener(elm, name, handler);
|
|
3629
3502
|
}
|
|
3630
3503
|
}
|
|
3631
3504
|
|
|
@@ -3638,12 +3511,13 @@ function applyEventListeners(vnode) {
|
|
|
3638
3511
|
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3639
3512
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3640
3513
|
// different classnames properties individually instead of via a string.
|
|
3641
|
-
function applyStaticClassAttribute(vnode) {
|
|
3514
|
+
function applyStaticClassAttribute(vnode, renderer) {
|
|
3642
3515
|
const { elm, data: { classMap }, } = vnode;
|
|
3643
3516
|
if (isUndefined$1(classMap)) {
|
|
3644
3517
|
return;
|
|
3645
3518
|
}
|
|
3646
|
-
const
|
|
3519
|
+
const { getClassList } = renderer;
|
|
3520
|
+
const classList = getClassList(elm);
|
|
3647
3521
|
for (const name in classMap) {
|
|
3648
3522
|
classList.add(name);
|
|
3649
3523
|
}
|
|
@@ -3658,14 +3532,15 @@ function applyStaticClassAttribute(vnode) {
|
|
|
3658
3532
|
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3659
3533
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3660
3534
|
// different style properties individually instead of via a string.
|
|
3661
|
-
function applyStaticStyleAttribute(vnode) {
|
|
3535
|
+
function applyStaticStyleAttribute(vnode, renderer) {
|
|
3662
3536
|
const { elm, data: { styleDecls }, } = vnode;
|
|
3663
3537
|
if (isUndefined$1(styleDecls)) {
|
|
3664
3538
|
return;
|
|
3665
3539
|
}
|
|
3540
|
+
const { setCSSStyleProperty } = renderer;
|
|
3666
3541
|
for (let i = 0; i < styleDecls.length; i++) {
|
|
3667
3542
|
const [prop, value, important] = styleDecls[i];
|
|
3668
|
-
setCSSStyleProperty
|
|
3543
|
+
setCSSStyleProperty(elm, prop, value, important);
|
|
3669
3544
|
}
|
|
3670
3545
|
}
|
|
3671
3546
|
|
|
@@ -3675,15 +3550,16 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
3675
3550
|
* SPDX-License-Identifier: MIT
|
|
3676
3551
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3677
3552
|
*/
|
|
3678
|
-
function patchChildren(c1, c2, parent) {
|
|
3553
|
+
function patchChildren(c1, c2, parent, renderer) {
|
|
3679
3554
|
if (hasDynamicChildren(c2)) {
|
|
3680
|
-
updateDynamicChildren(c1, c2, parent);
|
|
3555
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
3681
3556
|
}
|
|
3682
3557
|
else {
|
|
3683
|
-
updateStaticChildren(c1, c2, parent);
|
|
3558
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
3684
3559
|
}
|
|
3685
3560
|
}
|
|
3686
|
-
function patch(n1, n2) {
|
|
3561
|
+
function patch(n1, n2, renderer) {
|
|
3562
|
+
var _a, _b;
|
|
3687
3563
|
if (n1 === n2) {
|
|
3688
3564
|
return;
|
|
3689
3565
|
}
|
|
@@ -3697,80 +3573,115 @@ function patch(n1, n2) {
|
|
|
3697
3573
|
}
|
|
3698
3574
|
switch (n2.type) {
|
|
3699
3575
|
case 0 /* Text */:
|
|
3700
|
-
|
|
3576
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3577
|
+
patchText(n1, n2, renderer);
|
|
3701
3578
|
break;
|
|
3702
3579
|
case 1 /* Comment */:
|
|
3703
|
-
|
|
3580
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3581
|
+
patchComment(n1, n2, renderer);
|
|
3582
|
+
break;
|
|
3583
|
+
case 4 /* Static */:
|
|
3584
|
+
n2.elm = n1.elm;
|
|
3704
3585
|
break;
|
|
3705
3586
|
case 2 /* Element */:
|
|
3706
|
-
patchElement(n1, n2);
|
|
3587
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3707
3588
|
break;
|
|
3708
3589
|
case 3 /* CustomElement */:
|
|
3709
|
-
patchCustomElement(n1, n2);
|
|
3590
|
+
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3710
3591
|
break;
|
|
3711
3592
|
}
|
|
3712
3593
|
}
|
|
3713
|
-
function mount(node, parent, anchor) {
|
|
3594
|
+
function mount(node, parent, renderer, anchor) {
|
|
3595
|
+
var _a, _b;
|
|
3714
3596
|
switch (node.type) {
|
|
3715
3597
|
case 0 /* Text */:
|
|
3716
|
-
|
|
3598
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
3599
|
+
mountText(node, parent, anchor, renderer);
|
|
3717
3600
|
break;
|
|
3718
3601
|
case 1 /* Comment */:
|
|
3719
|
-
|
|
3602
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
3603
|
+
mountComment(node, parent, anchor, renderer);
|
|
3604
|
+
break;
|
|
3605
|
+
case 4 /* Static */:
|
|
3606
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3607
|
+
mountStatic(node, parent, anchor, renderer);
|
|
3720
3608
|
break;
|
|
3721
3609
|
case 2 /* Element */:
|
|
3722
|
-
|
|
3610
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3611
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3723
3612
|
break;
|
|
3724
3613
|
case 3 /* CustomElement */:
|
|
3725
|
-
|
|
3614
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3615
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3726
3616
|
break;
|
|
3727
3617
|
}
|
|
3728
3618
|
}
|
|
3729
|
-
function patchText(n1, n2) {
|
|
3619
|
+
function patchText(n1, n2, renderer) {
|
|
3730
3620
|
n2.elm = n1.elm;
|
|
3731
3621
|
if (n2.text !== n1.text) {
|
|
3732
|
-
updateTextContent(n2);
|
|
3622
|
+
updateTextContent(n2, renderer);
|
|
3733
3623
|
}
|
|
3734
3624
|
}
|
|
3735
|
-
function mountText(
|
|
3736
|
-
const { owner } =
|
|
3737
|
-
const
|
|
3738
|
-
|
|
3739
|
-
|
|
3625
|
+
function mountText(vnode, parent, anchor, renderer) {
|
|
3626
|
+
const { owner } = vnode;
|
|
3627
|
+
const { createText } = renderer;
|
|
3628
|
+
const textNode = (vnode.elm = createText(vnode.text));
|
|
3629
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
3630
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
3740
3631
|
}
|
|
3741
|
-
function patchComment(n1, n2) {
|
|
3632
|
+
function patchComment(n1, n2, renderer) {
|
|
3742
3633
|
n2.elm = n1.elm;
|
|
3743
3634
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3744
3635
|
// it is the case today.
|
|
3745
3636
|
if (n2.text !== n1.text) {
|
|
3746
|
-
updateTextContent(n2);
|
|
3637
|
+
updateTextContent(n2, renderer);
|
|
3747
3638
|
}
|
|
3748
3639
|
}
|
|
3749
|
-
function mountComment(
|
|
3750
|
-
const { owner } =
|
|
3751
|
-
const
|
|
3752
|
-
|
|
3753
|
-
|
|
3640
|
+
function mountComment(vnode, parent, anchor, renderer) {
|
|
3641
|
+
const { owner } = vnode;
|
|
3642
|
+
const { createComment } = renderer;
|
|
3643
|
+
const commentNode = (vnode.elm = createComment(vnode.text));
|
|
3644
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
3645
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
3754
3646
|
}
|
|
3755
|
-
function mountElement(vnode, parent, anchor) {
|
|
3647
|
+
function mountElement(vnode, parent, anchor, renderer) {
|
|
3756
3648
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3649
|
+
const { createElement } = renderer;
|
|
3757
3650
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3758
|
-
const elm = createElement
|
|
3759
|
-
linkNodeToShadow(elm, owner);
|
|
3760
|
-
fallbackElmHook(elm, vnode);
|
|
3651
|
+
const elm = createElement(sel, namespace);
|
|
3652
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3653
|
+
fallbackElmHook(elm, vnode, renderer);
|
|
3761
3654
|
vnode.elm = elm;
|
|
3762
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3763
|
-
insertNode(elm, parent, anchor);
|
|
3764
|
-
mountVNodes(vnode.children, elm, null);
|
|
3655
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3656
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3657
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3765
3658
|
}
|
|
3766
|
-
function patchElement(n1, n2) {
|
|
3659
|
+
function patchElement(n1, n2, renderer) {
|
|
3767
3660
|
const elm = (n2.elm = n1.elm);
|
|
3768
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3769
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3661
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3662
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3663
|
+
}
|
|
3664
|
+
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3665
|
+
const { owner } = vnode;
|
|
3666
|
+
const { cloneNode, isSyntheticShadowDefined } = renderer;
|
|
3667
|
+
const elm = (vnode.elm = cloneNode(vnode.fragment, true));
|
|
3668
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3669
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3670
|
+
const { renderMode, shadowMode } = owner;
|
|
3671
|
+
if (isSyntheticShadowDefined) {
|
|
3672
|
+
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3673
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3677
|
+
const isLight = renderMode === 0 /* Light */;
|
|
3678
|
+
patchElementWithRestrictions(elm, { isPortal: false, isLight });
|
|
3679
|
+
}
|
|
3680
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3770
3681
|
}
|
|
3771
|
-
function mountCustomElement(vnode, parent, anchor) {
|
|
3682
|
+
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3772
3683
|
const { sel, owner } = vnode;
|
|
3773
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3684
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
3774
3685
|
/**
|
|
3775
3686
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3776
3687
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3780,9 +3691,9 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3780
3691
|
let vm;
|
|
3781
3692
|
const elm = new UpgradableConstructor((elm) => {
|
|
3782
3693
|
// the custom element from the registry is expecting an upgrade callback
|
|
3783
|
-
vm = createViewModelHook(elm, vnode);
|
|
3694
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
3784
3695
|
});
|
|
3785
|
-
linkNodeToShadow(elm, owner);
|
|
3696
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3786
3697
|
vnode.elm = elm;
|
|
3787
3698
|
vnode.vm = vm;
|
|
3788
3699
|
if (vm) {
|
|
@@ -3791,23 +3702,23 @@ function mountCustomElement(vnode, parent, anchor) {
|
|
|
3791
3702
|
else if (vnode.ctor !== UpgradableConstructor) {
|
|
3792
3703
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
3793
3704
|
}
|
|
3794
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3795
|
-
insertNode(elm, parent, anchor);
|
|
3705
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3706
|
+
insertNode(elm, parent, anchor, renderer);
|
|
3796
3707
|
if (vm) {
|
|
3797
3708
|
if (process.env.NODE_ENV !== 'production') {
|
|
3798
3709
|
assert.isTrue(vm.state === 0 /* created */, `${vm} cannot be recycled.`);
|
|
3799
3710
|
}
|
|
3800
3711
|
runConnectedCallback(vm);
|
|
3801
3712
|
}
|
|
3802
|
-
mountVNodes(vnode.children, elm, null);
|
|
3713
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3803
3714
|
if (vm) {
|
|
3804
3715
|
appendVM(vm);
|
|
3805
3716
|
}
|
|
3806
3717
|
}
|
|
3807
|
-
function patchCustomElement(n1, n2) {
|
|
3718
|
+
function patchCustomElement(n1, n2, renderer) {
|
|
3808
3719
|
const elm = (n2.elm = n1.elm);
|
|
3809
3720
|
const vm = (n2.vm = n1.vm);
|
|
3810
|
-
patchElementPropsAndAttrs$1(n1, n2);
|
|
3721
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3811
3722
|
if (!isUndefined$1(vm)) {
|
|
3812
3723
|
// in fallback mode, the allocation will always set children to
|
|
3813
3724
|
// empty and delegate the real allocation to the slot elements
|
|
@@ -3815,34 +3726,36 @@ function patchCustomElement(n1, n2) {
|
|
|
3815
3726
|
}
|
|
3816
3727
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3817
3728
|
// will happen, but in native, it does allocate the light dom
|
|
3818
|
-
patchChildren(n1.children, n2.children, elm);
|
|
3729
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3819
3730
|
if (!isUndefined$1(vm)) {
|
|
3820
3731
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3821
3732
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3822
3733
|
rerenderVM(vm);
|
|
3823
3734
|
}
|
|
3824
3735
|
}
|
|
3825
|
-
function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
3736
|
+
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3826
3737
|
for (; start < end; ++start) {
|
|
3827
3738
|
const vnode = vnodes[start];
|
|
3828
3739
|
if (isVNode(vnode)) {
|
|
3829
|
-
mount(vnode, parent, anchor);
|
|
3740
|
+
mount(vnode, parent, renderer, anchor);
|
|
3830
3741
|
}
|
|
3831
3742
|
}
|
|
3832
3743
|
}
|
|
3833
|
-
function unmount(vnode, parent, doRemove = false) {
|
|
3744
|
+
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3834
3745
|
const { type, elm, sel } = vnode;
|
|
3835
3746
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3836
3747
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3837
3748
|
if (doRemove) {
|
|
3838
|
-
|
|
3749
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3750
|
+
// but the removal used here is from the owner instead.
|
|
3751
|
+
removeNode(elm, parent, renderer);
|
|
3839
3752
|
}
|
|
3840
3753
|
switch (type) {
|
|
3841
3754
|
case 2 /* Element */: {
|
|
3842
3755
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3843
3756
|
// Only required for synthetic shadow.
|
|
3844
|
-
const
|
|
3845
|
-
unmountVNodes(vnode.children, elm,
|
|
3757
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3758
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3846
3759
|
break;
|
|
3847
3760
|
}
|
|
3848
3761
|
case 3 /* CustomElement */: {
|
|
@@ -3855,11 +3768,11 @@ function unmount(vnode, parent, doRemove = false) {
|
|
|
3855
3768
|
}
|
|
3856
3769
|
}
|
|
3857
3770
|
}
|
|
3858
|
-
function unmountVNodes(vnodes, parent, doRemove = false, start = 0, end = vnodes.length) {
|
|
3771
|
+
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3859
3772
|
for (; start < end; ++start) {
|
|
3860
3773
|
const ch = vnodes[start];
|
|
3861
3774
|
if (isVNode(ch)) {
|
|
3862
|
-
unmount(ch, parent, doRemove);
|
|
3775
|
+
unmount(ch, parent, renderer, doRemove);
|
|
3863
3776
|
}
|
|
3864
3777
|
}
|
|
3865
3778
|
}
|
|
@@ -3873,66 +3786,71 @@ function setElementShadowToken(elm, token) {
|
|
|
3873
3786
|
elm.$shadowToken$ = token;
|
|
3874
3787
|
}
|
|
3875
3788
|
// Set the scope token class for *.scoped.css styles
|
|
3876
|
-
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
3789
|
+
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3877
3790
|
const { cmpTemplate, context } = owner;
|
|
3791
|
+
const { getClassList } = renderer;
|
|
3878
3792
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3879
3793
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3880
|
-
|
|
3794
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3795
|
+
// probably we should have a renderer api for just the add operation
|
|
3796
|
+
getClassList(elm).add(token);
|
|
3881
3797
|
}
|
|
3882
3798
|
}
|
|
3883
|
-
function linkNodeToShadow(elm, owner) {
|
|
3799
|
+
function linkNodeToShadow(elm, owner, renderer) {
|
|
3884
3800
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3801
|
+
const { isSyntheticShadowDefined } = renderer;
|
|
3885
3802
|
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3886
|
-
if (isSyntheticShadowDefined
|
|
3803
|
+
if (isSyntheticShadowDefined) {
|
|
3887
3804
|
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
3888
3805
|
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
3889
3806
|
}
|
|
3890
3807
|
}
|
|
3891
3808
|
}
|
|
3892
|
-
function updateTextContent(vnode) {
|
|
3809
|
+
function updateTextContent(vnode, renderer) {
|
|
3893
3810
|
const { elm, text } = vnode;
|
|
3811
|
+
const { setText } = renderer;
|
|
3894
3812
|
if (process.env.NODE_ENV !== 'production') {
|
|
3895
3813
|
unlockDomMutation();
|
|
3896
3814
|
}
|
|
3897
|
-
setText
|
|
3815
|
+
setText(elm, text);
|
|
3898
3816
|
if (process.env.NODE_ENV !== 'production') {
|
|
3899
3817
|
lockDomMutation();
|
|
3900
3818
|
}
|
|
3901
3819
|
}
|
|
3902
|
-
function insertNode(node, parent, anchor) {
|
|
3820
|
+
function insertNode(node, parent, anchor, renderer) {
|
|
3903
3821
|
if (process.env.NODE_ENV !== 'production') {
|
|
3904
3822
|
unlockDomMutation();
|
|
3905
3823
|
}
|
|
3906
|
-
insert
|
|
3824
|
+
renderer.insert(node, parent, anchor);
|
|
3907
3825
|
if (process.env.NODE_ENV !== 'production') {
|
|
3908
3826
|
lockDomMutation();
|
|
3909
3827
|
}
|
|
3910
3828
|
}
|
|
3911
|
-
function removeNode(node, parent) {
|
|
3829
|
+
function removeNode(node, parent, renderer) {
|
|
3912
3830
|
if (process.env.NODE_ENV !== 'production') {
|
|
3913
3831
|
unlockDomMutation();
|
|
3914
3832
|
}
|
|
3915
|
-
remove
|
|
3833
|
+
renderer.remove(node, parent);
|
|
3916
3834
|
if (process.env.NODE_ENV !== 'production') {
|
|
3917
3835
|
lockDomMutation();
|
|
3918
3836
|
}
|
|
3919
3837
|
}
|
|
3920
|
-
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
3838
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3921
3839
|
if (isNull(oldVnode)) {
|
|
3922
|
-
applyEventListeners(vnode);
|
|
3923
|
-
applyStaticClassAttribute(vnode);
|
|
3924
|
-
applyStaticStyleAttribute(vnode);
|
|
3840
|
+
applyEventListeners(vnode, renderer);
|
|
3841
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3842
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3925
3843
|
}
|
|
3926
3844
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3927
3845
|
// value is set before type=radio.
|
|
3928
|
-
patchClassAttribute(oldVnode, vnode);
|
|
3929
|
-
patchStyleAttribute(oldVnode, vnode);
|
|
3930
|
-
patchAttributes(oldVnode, vnode);
|
|
3931
|
-
patchProps(oldVnode, vnode);
|
|
3846
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3847
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3848
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3849
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3932
3850
|
}
|
|
3933
|
-
function fallbackElmHook(elm, vnode) {
|
|
3851
|
+
function fallbackElmHook(elm, vnode, renderer) {
|
|
3934
3852
|
const { owner } = vnode;
|
|
3935
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3853
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3936
3854
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3937
3855
|
const { data: { context }, } = vnode;
|
|
3938
3856
|
const { stylesheetToken } = owner.context;
|
|
@@ -3980,7 +3898,7 @@ function allocateChildren(vnode, vm) {
|
|
|
3980
3898
|
vnode.children = EmptyArray;
|
|
3981
3899
|
}
|
|
3982
3900
|
}
|
|
3983
|
-
function createViewModelHook(elm, vnode) {
|
|
3901
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
3984
3902
|
let vm = getAssociatedVMIfPresent(elm);
|
|
3985
3903
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3986
3904
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
@@ -3989,7 +3907,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3989
3907
|
return vm;
|
|
3990
3908
|
}
|
|
3991
3909
|
const { sel, mode, ctor, owner } = vnode;
|
|
3992
|
-
setScopeTokenClassIfNecessary(elm, owner);
|
|
3910
|
+
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3993
3911
|
if (owner.shadowMode === 1 /* Synthetic */) {
|
|
3994
3912
|
const { stylesheetToken } = owner.context;
|
|
3995
3913
|
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
@@ -3998,7 +3916,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
3998
3916
|
setElementShadowToken(elm, stylesheetToken);
|
|
3999
3917
|
}
|
|
4000
3918
|
}
|
|
4001
|
-
vm = createVM(elm, ctor, {
|
|
3919
|
+
vm = createVM(elm, ctor, renderer, {
|
|
4002
3920
|
mode,
|
|
4003
3921
|
owner,
|
|
4004
3922
|
tagName: sel,
|
|
@@ -4073,7 +3991,7 @@ function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
|
4073
3991
|
}
|
|
4074
3992
|
return map;
|
|
4075
3993
|
}
|
|
4076
|
-
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3994
|
+
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4077
3995
|
let oldStartIdx = 0;
|
|
4078
3996
|
let newStartIdx = 0;
|
|
4079
3997
|
let oldEndIdx = oldCh.length - 1;
|
|
@@ -4102,26 +4020,26 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4102
4020
|
newEndVnode = newCh[--newEndIdx];
|
|
4103
4021
|
}
|
|
4104
4022
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4105
|
-
patch(oldStartVnode, newStartVnode);
|
|
4023
|
+
patch(oldStartVnode, newStartVnode, renderer);
|
|
4106
4024
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4107
4025
|
newStartVnode = newCh[++newStartIdx];
|
|
4108
4026
|
}
|
|
4109
4027
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4110
|
-
patch(oldEndVnode, newEndVnode);
|
|
4028
|
+
patch(oldEndVnode, newEndVnode, renderer);
|
|
4111
4029
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4112
4030
|
newEndVnode = newCh[--newEndIdx];
|
|
4113
4031
|
}
|
|
4114
4032
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4115
4033
|
// Vnode moved right
|
|
4116
|
-
patch(oldStartVnode, newEndVnode);
|
|
4117
|
-
insertNode(oldStartVnode.elm, parent, nextSibling
|
|
4034
|
+
patch(oldStartVnode, newEndVnode, renderer);
|
|
4035
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4118
4036
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4119
4037
|
newEndVnode = newCh[--newEndIdx];
|
|
4120
4038
|
}
|
|
4121
4039
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4122
4040
|
// Vnode moved left
|
|
4123
|
-
patch(oldEndVnode, newStartVnode);
|
|
4124
|
-
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
4041
|
+
patch(oldEndVnode, newStartVnode, renderer);
|
|
4042
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4125
4043
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4126
4044
|
newStartVnode = newCh[++newStartIdx];
|
|
4127
4045
|
}
|
|
@@ -4132,7 +4050,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4132
4050
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4133
4051
|
if (isUndefined$1(idxInOld)) {
|
|
4134
4052
|
// New element
|
|
4135
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4053
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4136
4054
|
newStartVnode = newCh[++newStartIdx];
|
|
4137
4055
|
}
|
|
4138
4056
|
else {
|
|
@@ -4140,10 +4058,10 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4140
4058
|
if (isVNode(elmToMove)) {
|
|
4141
4059
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4142
4060
|
// New element
|
|
4143
|
-
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
4061
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4144
4062
|
}
|
|
4145
4063
|
else {
|
|
4146
|
-
patch(elmToMove, newStartVnode);
|
|
4064
|
+
patch(elmToMove, newStartVnode, renderer);
|
|
4147
4065
|
// Delete the old child, but copy the array since it is read-only.
|
|
4148
4066
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4149
4067
|
// so we only care about the `oldCh` object inside this function.
|
|
@@ -4155,7 +4073,7 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4155
4073
|
}
|
|
4156
4074
|
// We've already cloned at least once, so it's no longer read-only
|
|
4157
4075
|
oldCh[idxInOld] = undefined;
|
|
4158
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
4076
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4159
4077
|
}
|
|
4160
4078
|
}
|
|
4161
4079
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4172,25 +4090,25 @@ function updateDynamicChildren(oldCh, newCh, parent) {
|
|
|
4172
4090
|
n = newCh[++i];
|
|
4173
4091
|
} while (!isVNode(n) && i < newChEnd);
|
|
4174
4092
|
before = isVNode(n) ? n.elm : null;
|
|
4175
|
-
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
4093
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4176
4094
|
}
|
|
4177
4095
|
else {
|
|
4178
|
-
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
4096
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
4179
4097
|
}
|
|
4180
4098
|
}
|
|
4181
4099
|
}
|
|
4182
|
-
function updateStaticChildren(c1, c2, parent) {
|
|
4100
|
+
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4183
4101
|
const c1Length = c1.length;
|
|
4184
4102
|
const c2Length = c2.length;
|
|
4185
4103
|
if (c1Length === 0) {
|
|
4186
4104
|
// the old list is empty, we can directly insert anything new
|
|
4187
|
-
mountVNodes(c2, parent, null);
|
|
4105
|
+
mountVNodes(c2, parent, renderer, null);
|
|
4188
4106
|
return;
|
|
4189
4107
|
}
|
|
4190
4108
|
if (c2Length === 0) {
|
|
4191
4109
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4192
4110
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4193
|
-
unmountVNodes(c1, parent, true);
|
|
4111
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
4194
4112
|
return;
|
|
4195
4113
|
}
|
|
4196
4114
|
// if the old list is not empty, the new list MUST have the same
|
|
@@ -4203,16 +4121,16 @@ function updateStaticChildren(c1, c2, parent) {
|
|
|
4203
4121
|
if (isVNode(n1)) {
|
|
4204
4122
|
if (isVNode(n2)) {
|
|
4205
4123
|
// both vnodes are equivalent, and we just need to patch them
|
|
4206
|
-
patch(n1, n2);
|
|
4124
|
+
patch(n1, n2, renderer);
|
|
4207
4125
|
anchor = n2.elm;
|
|
4208
4126
|
}
|
|
4209
4127
|
else {
|
|
4210
4128
|
// removing the old vnode since the new one is null
|
|
4211
|
-
unmount(n1, parent, true);
|
|
4129
|
+
unmount(n1, parent, renderer, true);
|
|
4212
4130
|
}
|
|
4213
4131
|
}
|
|
4214
4132
|
else if (isVNode(n2)) {
|
|
4215
|
-
mount(n2, parent, anchor);
|
|
4133
|
+
mount(n2, parent, renderer, anchor);
|
|
4216
4134
|
anchor = n2.elm;
|
|
4217
4135
|
}
|
|
4218
4136
|
}
|
|
@@ -4229,6 +4147,17 @@ const SymbolIterator = Symbol.iterator;
|
|
|
4229
4147
|
function addVNodeToChildLWC(vnode) {
|
|
4230
4148
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
4231
4149
|
}
|
|
4150
|
+
// [st]atic node
|
|
4151
|
+
function st(fragment, key) {
|
|
4152
|
+
return {
|
|
4153
|
+
type: 4 /* Static */,
|
|
4154
|
+
sel: undefined,
|
|
4155
|
+
key,
|
|
4156
|
+
elm: undefined,
|
|
4157
|
+
fragment,
|
|
4158
|
+
owner: getVMBeingRendered(),
|
|
4159
|
+
};
|
|
4160
|
+
}
|
|
4232
4161
|
// [h]tml node
|
|
4233
4162
|
function h(sel, data, children = EmptyArray) {
|
|
4234
4163
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -4618,6 +4547,7 @@ const api = freeze({
|
|
|
4618
4547
|
co,
|
|
4619
4548
|
dc,
|
|
4620
4549
|
ti,
|
|
4550
|
+
st,
|
|
4621
4551
|
gid,
|
|
4622
4552
|
fid,
|
|
4623
4553
|
shc,
|
|
@@ -4641,7 +4571,7 @@ function createInlineStyleVNode(content) {
|
|
|
4641
4571
|
}, [api.t(content)]);
|
|
4642
4572
|
}
|
|
4643
4573
|
function updateStylesheetToken(vm, template) {
|
|
4644
|
-
const { elm, context, renderMode, shadowMode } = vm;
|
|
4574
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4645
4575
|
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4646
4576
|
const isSyntheticShadow = renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */;
|
|
4647
4577
|
const { hasScopedStyles } = context;
|
|
@@ -4652,10 +4582,10 @@ function updateStylesheetToken(vm, template) {
|
|
|
4652
4582
|
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4653
4583
|
if (!isUndefined$1(oldToken)) {
|
|
4654
4584
|
if (oldHasTokenInClass) {
|
|
4655
|
-
getClassList
|
|
4585
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4656
4586
|
}
|
|
4657
4587
|
if (oldHasTokenInAttribute) {
|
|
4658
|
-
removeAttribute
|
|
4588
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
4659
4589
|
}
|
|
4660
4590
|
}
|
|
4661
4591
|
// Apply the new template styling token to the host element, if the new template has any
|
|
@@ -4666,11 +4596,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
4666
4596
|
// Set the new styling token on the host element
|
|
4667
4597
|
if (!isUndefined$1(newToken)) {
|
|
4668
4598
|
if (hasScopedStyles) {
|
|
4669
|
-
getClassList
|
|
4599
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
4670
4600
|
newHasTokenInClass = true;
|
|
4671
4601
|
}
|
|
4672
4602
|
if (isSyntheticShadow) {
|
|
4673
|
-
setAttribute
|
|
4603
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
4674
4604
|
newHasTokenInAttribute = true;
|
|
4675
4605
|
}
|
|
4676
4606
|
}
|
|
@@ -4758,19 +4688,18 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
4758
4688
|
return owner;
|
|
4759
4689
|
}
|
|
4760
4690
|
function createStylesheet(vm, stylesheets) {
|
|
4761
|
-
const { renderMode, shadowMode } = vm;
|
|
4691
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4762
4692
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4763
4693
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4764
|
-
insertStylesheet
|
|
4694
|
+
insertStylesheet(stylesheets[i]);
|
|
4765
4695
|
}
|
|
4766
4696
|
}
|
|
4767
|
-
else if (ssr
|
|
4697
|
+
else if (ssr || vm.hydrated) {
|
|
4768
4698
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4769
4699
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4770
4700
|
// the first time the VM renders.
|
|
4771
4701
|
// native shadow or light DOM, SSR
|
|
4772
|
-
|
|
4773
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
4702
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4774
4703
|
}
|
|
4775
4704
|
else {
|
|
4776
4705
|
// native shadow or light DOM, DOM renderer
|
|
@@ -4778,7 +4707,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4778
4707
|
// null root means a global style
|
|
4779
4708
|
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4780
4709
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4781
|
-
insertStylesheet
|
|
4710
|
+
insertStylesheet(stylesheets[i], target);
|
|
4782
4711
|
}
|
|
4783
4712
|
}
|
|
4784
4713
|
return null;
|
|
@@ -4904,6 +4833,54 @@ function validateLightDomTemplate(template, vm) {
|
|
|
4904
4833
|
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"`);
|
|
4905
4834
|
}
|
|
4906
4835
|
}
|
|
4836
|
+
function buildParseFragmentFn(createFragmentFn) {
|
|
4837
|
+
return (strings, ...keys) => {
|
|
4838
|
+
const cache = create(null);
|
|
4839
|
+
return function () {
|
|
4840
|
+
const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
|
|
4841
|
+
const hasStyleToken = !isUndefined$1(stylesheetToken);
|
|
4842
|
+
const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
|
|
4843
|
+
let cacheKey = 0;
|
|
4844
|
+
if (hasStyleToken && hasScopedStyles) {
|
|
4845
|
+
cacheKey |= 1 /* HAS_SCOPED_STYLE */;
|
|
4846
|
+
}
|
|
4847
|
+
if (hasStyleToken && isSyntheticShadow) {
|
|
4848
|
+
cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
|
|
4849
|
+
}
|
|
4850
|
+
if (!isUndefined$1(cache[cacheKey])) {
|
|
4851
|
+
return cache[cacheKey];
|
|
4852
|
+
}
|
|
4853
|
+
const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
|
|
4854
|
+
const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
|
|
4855
|
+
const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
4856
|
+
let htmlFragment = '';
|
|
4857
|
+
for (let i = 0, n = keys.length; i < n; i++) {
|
|
4858
|
+
switch (keys[i]) {
|
|
4859
|
+
case 0: // styleToken in existing class attr
|
|
4860
|
+
htmlFragment += strings[i] + classToken;
|
|
4861
|
+
break;
|
|
4862
|
+
case 1: // styleToken for added class attr
|
|
4863
|
+
htmlFragment += strings[i] + classAttrToken;
|
|
4864
|
+
break;
|
|
4865
|
+
case 2: // styleToken as attr
|
|
4866
|
+
htmlFragment += strings[i] + attrToken;
|
|
4867
|
+
break;
|
|
4868
|
+
case 3: // ${1}${2}
|
|
4869
|
+
htmlFragment += strings[i] + classAttrToken + attrToken;
|
|
4870
|
+
break;
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
htmlFragment += strings[strings.length - 1];
|
|
4874
|
+
cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
|
|
4875
|
+
return cache[cacheKey];
|
|
4876
|
+
};
|
|
4877
|
+
};
|
|
4878
|
+
}
|
|
4879
|
+
// Note: at the moment this code executes, we don't have a renderer yet.
|
|
4880
|
+
const parseFragment = buildParseFragmentFn((html, renderer) => {
|
|
4881
|
+
const { createFragment } = renderer;
|
|
4882
|
+
return createFragment(html);
|
|
4883
|
+
});
|
|
4907
4884
|
function evaluateTemplate(vm, html) {
|
|
4908
4885
|
if (process.env.NODE_ENV !== 'production') {
|
|
4909
4886
|
assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
|
|
@@ -4950,7 +4927,7 @@ function evaluateTemplate(vm, html) {
|
|
|
4950
4927
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
4951
4928
|
// re-rendering.
|
|
4952
4929
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
4953
|
-
context.
|
|
4930
|
+
context.styleVNodes =
|
|
4954
4931
|
stylesheetsContent.length === 0
|
|
4955
4932
|
? null
|
|
4956
4933
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -4967,9 +4944,9 @@ function evaluateTemplate(vm, html) {
|
|
|
4967
4944
|
// Set the global flag that template is being updated
|
|
4968
4945
|
isUpdatingTemplate = true;
|
|
4969
4946
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
4970
|
-
const {
|
|
4971
|
-
if (!isNull(
|
|
4972
|
-
ArrayUnshift.
|
|
4947
|
+
const { styleVNodes } = context;
|
|
4948
|
+
if (!isNull(styleVNodes)) {
|
|
4949
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
4973
4950
|
}
|
|
4974
4951
|
});
|
|
4975
4952
|
}, () => {
|
|
@@ -5299,7 +5276,7 @@ function getNearestShadowAncestor(vm) {
|
|
|
5299
5276
|
return ancestor;
|
|
5300
5277
|
}
|
|
5301
5278
|
|
|
5302
|
-
function createVM(elm, ctor, options) {
|
|
5279
|
+
function createVM(elm, ctor, renderer, options) {
|
|
5303
5280
|
const {
|
|
5304
5281
|
mode,
|
|
5305
5282
|
owner,
|
|
@@ -5334,7 +5311,7 @@ function createVM(elm, ctor, options) {
|
|
|
5334
5311
|
hasTokenInClass: undefined,
|
|
5335
5312
|
hasTokenInAttribute: undefined,
|
|
5336
5313
|
hasScopedStyles: undefined,
|
|
5337
|
-
|
|
5314
|
+
styleVNodes: null,
|
|
5338
5315
|
tplCache: EmptyObject,
|
|
5339
5316
|
wiredConnecting: EmptyArray,
|
|
5340
5317
|
wiredDisconnecting: EmptyArray
|
|
@@ -5348,9 +5325,10 @@ function createVM(elm, ctor, options) {
|
|
|
5348
5325
|
renderRoot: null,
|
|
5349
5326
|
callHook,
|
|
5350
5327
|
setHook,
|
|
5351
|
-
getHook
|
|
5328
|
+
getHook,
|
|
5329
|
+
renderer
|
|
5352
5330
|
};
|
|
5353
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5331
|
+
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5354
5332
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5355
5333
|
|
|
5356
5334
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5375,13 +5353,17 @@ function createVM(elm, ctor, options) {
|
|
|
5375
5353
|
return vm;
|
|
5376
5354
|
}
|
|
5377
5355
|
|
|
5378
|
-
function computeShadowMode(vm) {
|
|
5356
|
+
function computeShadowMode(vm, renderer) {
|
|
5379
5357
|
const {
|
|
5380
5358
|
def
|
|
5381
5359
|
} = vm;
|
|
5360
|
+
const {
|
|
5361
|
+
isSyntheticShadowDefined,
|
|
5362
|
+
isNativeShadowDefined
|
|
5363
|
+
} = renderer;
|
|
5382
5364
|
let shadowMode;
|
|
5383
5365
|
|
|
5384
|
-
if (isSyntheticShadowDefined
|
|
5366
|
+
if (isSyntheticShadowDefined) {
|
|
5385
5367
|
if (def.renderMode === 0
|
|
5386
5368
|
/* Light */
|
|
5387
5369
|
) {
|
|
@@ -5390,7 +5372,7 @@ function computeShadowMode(vm) {
|
|
|
5390
5372
|
shadowMode = 0
|
|
5391
5373
|
/* Native */
|
|
5392
5374
|
;
|
|
5393
|
-
} else if (isNativeShadowDefined
|
|
5375
|
+
} else if (isNativeShadowDefined) {
|
|
5394
5376
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5395
5377
|
// the if-condition.
|
|
5396
5378
|
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
@@ -5480,7 +5462,8 @@ function rehydrate(vm) {
|
|
|
5480
5462
|
function patchShadowRoot(vm, newCh) {
|
|
5481
5463
|
const {
|
|
5482
5464
|
renderRoot,
|
|
5483
|
-
children: oldCh
|
|
5465
|
+
children: oldCh,
|
|
5466
|
+
renderer
|
|
5484
5467
|
} = vm; // caching the new children collection
|
|
5485
5468
|
|
|
5486
5469
|
vm.children = newCh;
|
|
@@ -5496,7 +5479,7 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5496
5479
|
, vm);
|
|
5497
5480
|
}, () => {
|
|
5498
5481
|
// job
|
|
5499
|
-
patchChildren(oldCh, newCh, renderRoot);
|
|
5482
|
+
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5500
5483
|
}, () => {
|
|
5501
5484
|
// post
|
|
5502
5485
|
logOperationEnd(2
|
|
@@ -5521,10 +5504,13 @@ function runRenderedCallback(vm) {
|
|
|
5521
5504
|
const {
|
|
5522
5505
|
def: {
|
|
5523
5506
|
renderedCallback
|
|
5507
|
+
},
|
|
5508
|
+
renderer: {
|
|
5509
|
+
ssr
|
|
5524
5510
|
}
|
|
5525
5511
|
} = vm;
|
|
5526
5512
|
|
|
5527
|
-
if (isTrue(ssr
|
|
5513
|
+
if (isTrue(ssr)) {
|
|
5528
5514
|
return;
|
|
5529
5515
|
}
|
|
5530
5516
|
|
|
@@ -5758,14 +5744,17 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5758
5744
|
function resetComponentRoot(vm) {
|
|
5759
5745
|
const {
|
|
5760
5746
|
children,
|
|
5761
|
-
renderRoot
|
|
5747
|
+
renderRoot,
|
|
5748
|
+
renderer: {
|
|
5749
|
+
remove
|
|
5750
|
+
}
|
|
5762
5751
|
} = vm;
|
|
5763
5752
|
|
|
5764
5753
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5765
5754
|
const child = children[i];
|
|
5766
5755
|
|
|
5767
5756
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5768
|
-
remove
|
|
5757
|
+
remove(child.elm, renderRoot);
|
|
5769
5758
|
}
|
|
5770
5759
|
}
|
|
5771
5760
|
|
|
@@ -5774,7 +5763,13 @@ function resetComponentRoot(vm) {
|
|
|
5774
5763
|
vm.velements = EmptyArray;
|
|
5775
5764
|
}
|
|
5776
5765
|
function scheduleRehydration(vm) {
|
|
5777
|
-
|
|
5766
|
+
const {
|
|
5767
|
+
renderer: {
|
|
5768
|
+
ssr
|
|
5769
|
+
}
|
|
5770
|
+
} = vm;
|
|
5771
|
+
|
|
5772
|
+
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5778
5773
|
return;
|
|
5779
5774
|
}
|
|
5780
5775
|
|
|
@@ -5933,6 +5928,9 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5933
5928
|
context: {
|
|
5934
5929
|
wiredConnecting,
|
|
5935
5930
|
wiredDisconnecting
|
|
5931
|
+
},
|
|
5932
|
+
renderer: {
|
|
5933
|
+
dispatchEvent
|
|
5936
5934
|
}
|
|
5937
5935
|
} = vm; // waiting for the component to be connected to formally request the context via the token
|
|
5938
5936
|
|
|
@@ -5956,7 +5954,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
5956
5954
|
}
|
|
5957
5955
|
|
|
5958
5956
|
});
|
|
5959
|
-
dispatchEvent
|
|
5957
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
5960
5958
|
});
|
|
5961
5959
|
}
|
|
5962
5960
|
|
|
@@ -6296,7 +6294,7 @@ function freezeTemplate(tmpl) {
|
|
|
6296
6294
|
});
|
|
6297
6295
|
}
|
|
6298
6296
|
}
|
|
6299
|
-
/* version: 2.
|
|
6297
|
+
/* version: 2.16.0 */
|
|
6300
6298
|
|
|
6301
6299
|
/*
|
|
6302
6300
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6369,6 +6367,9 @@ class HTMLElementImpl {
|
|
|
6369
6367
|
}
|
|
6370
6368
|
}
|
|
6371
6369
|
const ssr = true;
|
|
6370
|
+
function isHydrating() {
|
|
6371
|
+
return false;
|
|
6372
|
+
}
|
|
6372
6373
|
const isNativeShadowDefined = false;
|
|
6373
6374
|
const isSyntheticShadowDefined = false;
|
|
6374
6375
|
function insert(node, parent, anchor) {
|
|
@@ -6389,6 +6390,16 @@ function remove(node, parent) {
|
|
|
6389
6390
|
const nodeIndex = parent.children.indexOf(node);
|
|
6390
6391
|
parent.children.splice(nodeIndex, 1);
|
|
6391
6392
|
}
|
|
6393
|
+
function cloneNode(node) {
|
|
6394
|
+
return node;
|
|
6395
|
+
}
|
|
6396
|
+
function createFragment(html) {
|
|
6397
|
+
return {
|
|
6398
|
+
type: HostNodeType.Raw,
|
|
6399
|
+
parent: null,
|
|
6400
|
+
value: html,
|
|
6401
|
+
};
|
|
6402
|
+
}
|
|
6392
6403
|
function createText(content) {
|
|
6393
6404
|
return {
|
|
6394
6405
|
type: HostNodeType.Text,
|
|
@@ -6595,68 +6606,49 @@ function getCustomElement(name) {
|
|
|
6595
6606
|
const HTMLElementExported = HTMLElementImpl;
|
|
6596
6607
|
/* noop */
|
|
6597
6608
|
const assertInstanceOfHTMLElement = noop;
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
setSsr(ssr);
|
|
6641
|
-
setAddEventListener(addEventListener);
|
|
6642
|
-
setInsertStylesheet(insertStylesheet);
|
|
6643
|
-
|
|
6644
|
-
/*
|
|
6645
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
6646
|
-
* All rights reserved.
|
|
6647
|
-
* SPDX-License-Identifier: MIT
|
|
6648
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6649
|
-
*/
|
|
6650
|
-
const ESCAPED_CHARS = {
|
|
6651
|
-
'"': '"',
|
|
6652
|
-
"'": ''',
|
|
6653
|
-
'<': '<',
|
|
6654
|
-
'>': '>',
|
|
6655
|
-
'&': '&',
|
|
6609
|
+
const renderer = {
|
|
6610
|
+
ssr,
|
|
6611
|
+
isNativeShadowDefined,
|
|
6612
|
+
isSyntheticShadowDefined,
|
|
6613
|
+
HTMLElementExported,
|
|
6614
|
+
isHydrating,
|
|
6615
|
+
insert,
|
|
6616
|
+
remove,
|
|
6617
|
+
cloneNode,
|
|
6618
|
+
createFragment,
|
|
6619
|
+
createElement,
|
|
6620
|
+
createText,
|
|
6621
|
+
createComment,
|
|
6622
|
+
nextSibling,
|
|
6623
|
+
attachShadow,
|
|
6624
|
+
getProperty,
|
|
6625
|
+
setProperty,
|
|
6626
|
+
setText,
|
|
6627
|
+
getAttribute,
|
|
6628
|
+
setAttribute,
|
|
6629
|
+
removeAttribute,
|
|
6630
|
+
addEventListener,
|
|
6631
|
+
removeEventListener,
|
|
6632
|
+
dispatchEvent,
|
|
6633
|
+
getClassList,
|
|
6634
|
+
setCSSStyleProperty,
|
|
6635
|
+
getBoundingClientRect,
|
|
6636
|
+
querySelector,
|
|
6637
|
+
querySelectorAll,
|
|
6638
|
+
getElementsByTagName,
|
|
6639
|
+
getElementsByClassName,
|
|
6640
|
+
getChildren,
|
|
6641
|
+
getChildNodes,
|
|
6642
|
+
getFirstChild,
|
|
6643
|
+
getFirstElementChild,
|
|
6644
|
+
getLastChild,
|
|
6645
|
+
getLastElementChild,
|
|
6646
|
+
isConnected,
|
|
6647
|
+
insertStylesheet,
|
|
6648
|
+
assertInstanceOfHTMLElement,
|
|
6649
|
+
defineCustomElement,
|
|
6650
|
+
getCustomElement,
|
|
6656
6651
|
};
|
|
6657
|
-
function htmlEscape(str) {
|
|
6658
|
-
return str.replace(/["'<>&]/g, (char) => ESCAPED_CHARS[char]);
|
|
6659
|
-
}
|
|
6660
6652
|
|
|
6661
6653
|
/*
|
|
6662
6654
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6733,8 +6725,8 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6733
6725
|
if (!isObject(props) || isNull(props)) {
|
|
6734
6726
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6735
6727
|
}
|
|
6736
|
-
const element = createElement(tagName);
|
|
6737
|
-
createVM(element, Ctor, {
|
|
6728
|
+
const element = renderer.createElement(tagName);
|
|
6729
|
+
createVM(element, Ctor, renderer, {
|
|
6738
6730
|
mode: 'open',
|
|
6739
6731
|
owner: null,
|
|
6740
6732
|
tagName,
|
|
@@ -6755,7 +6747,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6755
6747
|
*/
|
|
6756
6748
|
freeze(LightningElement);
|
|
6757
6749
|
seal(LightningElement.prototype);
|
|
6758
|
-
/* version: 2.
|
|
6750
|
+
/* version: 2.16.0 */
|
|
6759
6751
|
|
|
6760
6752
|
exports.LightningElement = LightningElement;
|
|
6761
6753
|
exports.api = api$1;
|
|
@@ -6763,12 +6755,15 @@ exports.createContextProvider = createContextProvider;
|
|
|
6763
6755
|
exports.freezeTemplate = freezeTemplate;
|
|
6764
6756
|
exports.getComponentDef = getComponentDef;
|
|
6765
6757
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6758
|
+
exports.parseFragment = parseFragment;
|
|
6759
|
+
exports.parseSVGFragment = parseFragment;
|
|
6766
6760
|
exports.readonly = readonly;
|
|
6767
6761
|
exports.register = register;
|
|
6768
6762
|
exports.registerComponent = registerComponent;
|
|
6769
6763
|
exports.registerDecorators = registerDecorators;
|
|
6770
6764
|
exports.registerTemplate = registerTemplate;
|
|
6771
6765
|
exports.renderComponent = renderComponent;
|
|
6766
|
+
exports.renderer = renderer;
|
|
6772
6767
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
6773
6768
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6774
6769
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|