lwc 2.6.2 → 2.7.3
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 +1114 -1054
- package/dist/engine-dom/iife/es2017/engine-dom.js +1114 -1054
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -9
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1084 -1018
- package/dist/engine-dom/iife/es5/engine-dom.js +1166 -999
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -9
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +1181 -1014
- package/dist/engine-dom/umd/es2017/engine-dom.js +1114 -1054
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -9
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1084 -1018
- package/dist/engine-dom/umd/es5/engine-dom.js +1166 -999
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -9
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +1181 -1014
- package/dist/engine-server/commonjs/es2017/engine-server.js +1286 -1227
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -9
- package/dist/engine-server/esm/es2017/engine-server.js +1286 -1227
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +74 -9
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +74 -9
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +74 -9
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +78 -9
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +78 -9
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +74 -9
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +74 -9
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +78 -9
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +78 -9
- 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 +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- 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 +3 -3
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +3 -3
- package/package.json +8 -8
|
@@ -335,7 +335,7 @@ function htmlPropertyToAttribute(propName) {
|
|
|
335
335
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
336
336
|
return attributeName;
|
|
337
337
|
}
|
|
338
|
-
/** version: 2.
|
|
338
|
+
/** version: 2.7.3 */
|
|
339
339
|
|
|
340
340
|
/*
|
|
341
341
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -393,7 +393,6 @@ const features = {
|
|
|
393
393
|
ENABLE_NODE_LIST_PATCH: null,
|
|
394
394
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
395
395
|
ENABLE_NODE_PATCH: null,
|
|
396
|
-
ENABLE_MIXED_SHADOW_MODE: null,
|
|
397
396
|
ENABLE_WIRE_SYNC_EMIT: null
|
|
398
397
|
};
|
|
399
398
|
|
|
@@ -458,7 +457,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
458
457
|
setFeatureFlag(name, value);
|
|
459
458
|
}
|
|
460
459
|
}
|
|
461
|
-
/** version: 2.
|
|
460
|
+
/** version: 2.7.3 */
|
|
462
461
|
|
|
463
462
|
/* proxy-compat-disable */
|
|
464
463
|
|
|
@@ -532,6 +531,249 @@ function parseStyleText(cssText) {
|
|
|
532
531
|
}
|
|
533
532
|
|
|
534
533
|
return styleMap;
|
|
534
|
+
} //
|
|
535
|
+
// Primitives
|
|
536
|
+
//
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
let ssr$1;
|
|
540
|
+
|
|
541
|
+
function setSsr(ssrImpl) {
|
|
542
|
+
ssr$1 = ssrImpl;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
let isNativeShadowDefined$1;
|
|
546
|
+
|
|
547
|
+
function setIsNativeShadowDefined(isNativeShadowDefinedImpl) {
|
|
548
|
+
isNativeShadowDefined$1 = isNativeShadowDefinedImpl;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
let isSyntheticShadowDefined$1;
|
|
552
|
+
|
|
553
|
+
function setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {
|
|
554
|
+
isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
let HTMLElementExported$1;
|
|
558
|
+
|
|
559
|
+
function setHTMLElement(HTMLElementImpl) {
|
|
560
|
+
HTMLElementExported$1 = HTMLElementImpl;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
let isHydrating$1;
|
|
564
|
+
|
|
565
|
+
function setIsHydrating(isHydratingImpl) {
|
|
566
|
+
isHydrating$1 = isHydratingImpl;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
let insert$1;
|
|
570
|
+
|
|
571
|
+
function setInsert(insertImpl) {
|
|
572
|
+
insert$1 = insertImpl;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
let remove$1;
|
|
576
|
+
|
|
577
|
+
function setRemove(removeImpl) {
|
|
578
|
+
remove$1 = removeImpl;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
let createElement$1;
|
|
582
|
+
|
|
583
|
+
function setCreateElement(createElementImpl) {
|
|
584
|
+
createElement$1 = createElementImpl;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
let createText$1;
|
|
588
|
+
|
|
589
|
+
function setCreateText(createTextImpl) {
|
|
590
|
+
createText$1 = createTextImpl;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
let createComment$1;
|
|
594
|
+
|
|
595
|
+
function setCreateComment(createCommentImpl) {
|
|
596
|
+
createComment$1 = createCommentImpl;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
let nextSibling$1;
|
|
600
|
+
|
|
601
|
+
function setNextSibling(nextSiblingImpl) {
|
|
602
|
+
nextSibling$1 = nextSiblingImpl;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
let attachShadow$1;
|
|
606
|
+
|
|
607
|
+
function setAttachShadow(attachShadowImpl) {
|
|
608
|
+
attachShadow$1 = attachShadowImpl;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
let getProperty$1;
|
|
612
|
+
|
|
613
|
+
function setGetProperty(getPropertyImpl) {
|
|
614
|
+
getProperty$1 = getPropertyImpl;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
let setProperty$1;
|
|
618
|
+
|
|
619
|
+
function setSetProperty(setPropertyImpl) {
|
|
620
|
+
setProperty$1 = setPropertyImpl;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
let setText$1;
|
|
624
|
+
|
|
625
|
+
function setSetText(setTextImpl) {
|
|
626
|
+
setText$1 = setTextImpl;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
let getAttribute$1;
|
|
630
|
+
|
|
631
|
+
function setGetAttribute(getAttributeImpl) {
|
|
632
|
+
getAttribute$1 = getAttributeImpl;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
let setAttribute$1;
|
|
636
|
+
|
|
637
|
+
function setSetAttribute(setAttributeImpl) {
|
|
638
|
+
setAttribute$1 = setAttributeImpl;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
let removeAttribute$1;
|
|
642
|
+
|
|
643
|
+
function setRemoveAttribute(removeAttributeImpl) {
|
|
644
|
+
removeAttribute$1 = removeAttributeImpl;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
let addEventListener$1;
|
|
648
|
+
|
|
649
|
+
function setAddEventListener(addEventListenerImpl) {
|
|
650
|
+
addEventListener$1 = addEventListenerImpl;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
let removeEventListener$1;
|
|
654
|
+
|
|
655
|
+
function setRemoveEventListener(removeEventListenerImpl) {
|
|
656
|
+
removeEventListener$1 = removeEventListenerImpl;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
let dispatchEvent$1;
|
|
660
|
+
|
|
661
|
+
function setDispatchEvent(dispatchEventImpl) {
|
|
662
|
+
dispatchEvent$1 = dispatchEventImpl;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
let getClassList$1;
|
|
666
|
+
|
|
667
|
+
function setGetClassList(getClassListImpl) {
|
|
668
|
+
getClassList$1 = getClassListImpl;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
let setCSSStyleProperty$1;
|
|
672
|
+
|
|
673
|
+
function setSetCSSStyleProperty(setCSSStylePropertyImpl) {
|
|
674
|
+
setCSSStyleProperty$1 = setCSSStylePropertyImpl;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
let getBoundingClientRect$1;
|
|
678
|
+
|
|
679
|
+
function setGetBoundingClientRect(getBoundingClientRectImpl) {
|
|
680
|
+
getBoundingClientRect$1 = getBoundingClientRectImpl;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
let querySelector$1;
|
|
684
|
+
|
|
685
|
+
function setQuerySelector(querySelectorImpl) {
|
|
686
|
+
querySelector$1 = querySelectorImpl;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
let querySelectorAll$1;
|
|
690
|
+
|
|
691
|
+
function setQuerySelectorAll(querySelectorAllImpl) {
|
|
692
|
+
querySelectorAll$1 = querySelectorAllImpl;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
let getElementsByTagName$1;
|
|
696
|
+
|
|
697
|
+
function setGetElementsByTagName(getElementsByTagNameImpl) {
|
|
698
|
+
getElementsByTagName$1 = getElementsByTagNameImpl;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
let getElementsByClassName$1;
|
|
702
|
+
|
|
703
|
+
function setGetElementsByClassName(getElementsByClassNameImpl) {
|
|
704
|
+
getElementsByClassName$1 = getElementsByClassNameImpl;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
let getChildren$1;
|
|
708
|
+
|
|
709
|
+
function setGetChildren(getChildrenImpl) {
|
|
710
|
+
getChildren$1 = getChildrenImpl;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
let getChildNodes$1;
|
|
714
|
+
|
|
715
|
+
function setGetChildNodes(getChildNodesImpl) {
|
|
716
|
+
getChildNodes$1 = getChildNodesImpl;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
let getFirstChild$1;
|
|
720
|
+
|
|
721
|
+
function setGetFirstChild(getFirstChildImpl) {
|
|
722
|
+
getFirstChild$1 = getFirstChildImpl;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
let getFirstElementChild$1;
|
|
726
|
+
|
|
727
|
+
function setGetFirstElementChild(getFirstElementChildImpl) {
|
|
728
|
+
getFirstElementChild$1 = getFirstElementChildImpl;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
let getLastChild$1;
|
|
732
|
+
|
|
733
|
+
function setGetLastChild(getLastChildImpl) {
|
|
734
|
+
getLastChild$1 = getLastChildImpl;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
let getLastElementChild$1;
|
|
738
|
+
|
|
739
|
+
function setGetLastElementChild(getLastElementChildImpl) {
|
|
740
|
+
getLastElementChild$1 = getLastElementChildImpl;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
let isConnected$1;
|
|
744
|
+
|
|
745
|
+
function setIsConnected(isConnectedImpl) {
|
|
746
|
+
isConnected$1 = isConnectedImpl;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
let insertGlobalStylesheet$1;
|
|
750
|
+
|
|
751
|
+
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
752
|
+
insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
let insertStylesheet$1;
|
|
756
|
+
|
|
757
|
+
function setInsertStylesheet(insertStylesheetImpl) {
|
|
758
|
+
insertStylesheet$1 = insertStylesheetImpl;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
let assertInstanceOfHTMLElement$1;
|
|
762
|
+
|
|
763
|
+
function setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {
|
|
764
|
+
assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
let defineCustomElement$1;
|
|
768
|
+
|
|
769
|
+
function setDefineCustomElement(defineCustomElementImpl) {
|
|
770
|
+
defineCustomElement$1 = defineCustomElementImpl;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
let getCustomElement$1;
|
|
774
|
+
|
|
775
|
+
function setGetCustomElement(getCustomElementImpl) {
|
|
776
|
+
getCustomElement$1 = getCustomElementImpl;
|
|
535
777
|
}
|
|
536
778
|
/*
|
|
537
779
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -661,612 +903,86 @@ class ReactiveObserver {
|
|
|
661
903
|
*/
|
|
662
904
|
|
|
663
905
|
|
|
664
|
-
function componentValueMutated(vm, key) {
|
|
665
|
-
valueMutated(vm.component, key);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
function componentValueObserved(vm, key) {
|
|
669
|
-
valueObserved(vm.component, key);
|
|
670
|
-
}
|
|
671
|
-
/*
|
|
672
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
673
|
-
* All rights reserved.
|
|
674
|
-
* SPDX-License-Identifier: MIT
|
|
675
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
676
|
-
*/
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
function getComponentTag(vm) {
|
|
680
|
-
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
681
|
-
} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
function getComponentStack(vm) {
|
|
685
|
-
const stack = [];
|
|
686
|
-
let prefix = '';
|
|
687
|
-
|
|
688
|
-
while (!isNull(vm.owner)) {
|
|
689
|
-
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
690
|
-
vm = vm.owner;
|
|
691
|
-
prefix += '\t';
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
return ArrayJoin.call(stack, '\n');
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
function getErrorComponentStack(vm) {
|
|
698
|
-
const wcStack = [];
|
|
699
|
-
let currentVm = vm;
|
|
700
|
-
|
|
701
|
-
while (!isNull(currentVm)) {
|
|
702
|
-
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
703
|
-
currentVm = currentVm.owner;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
return wcStack.reverse().join('\n\t');
|
|
707
|
-
}
|
|
708
|
-
/*
|
|
709
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
710
|
-
* All rights reserved.
|
|
711
|
-
* SPDX-License-Identifier: MIT
|
|
712
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
713
|
-
*/
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
function log(method, message, vm) {
|
|
717
|
-
let msg = `[LWC ${method}]: ${message}`;
|
|
718
|
-
|
|
719
|
-
if (!isUndefined$1(vm)) {
|
|
720
|
-
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
if (process.env.NODE_ENV === 'test') {
|
|
724
|
-
/* eslint-disable-next-line no-console */
|
|
725
|
-
console[method](msg);
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
try {
|
|
730
|
-
throw new Error(msg);
|
|
731
|
-
} catch (e) {
|
|
732
|
-
/* eslint-disable-next-line no-console */
|
|
733
|
-
console[method](e);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
function logError(message, vm) {
|
|
738
|
-
log('error', message, vm);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
function logWarn(message, vm) {
|
|
742
|
-
log('warn', message, vm);
|
|
743
|
-
}
|
|
744
|
-
/*
|
|
745
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
746
|
-
* All rights reserved.
|
|
747
|
-
* SPDX-License-Identifier: MIT
|
|
748
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
749
|
-
*/
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
function handleEvent(event, vnode) {
|
|
753
|
-
const {
|
|
754
|
-
type
|
|
755
|
-
} = event;
|
|
756
|
-
const {
|
|
757
|
-
data: {
|
|
758
|
-
on
|
|
759
|
-
}
|
|
760
|
-
} = vnode;
|
|
761
|
-
const handler = on && on[type]; // call event handler if exists
|
|
762
|
-
|
|
763
|
-
if (handler) {
|
|
764
|
-
handler.call(undefined, event);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
function createListener() {
|
|
769
|
-
return function handler(event) {
|
|
770
|
-
handleEvent(event, handler.vnode);
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
function updateAllEventListeners(oldVnode, vnode) {
|
|
775
|
-
if (isUndefined$1(oldVnode.listener)) {
|
|
776
|
-
createAllEventListeners(vnode);
|
|
777
|
-
} else {
|
|
778
|
-
vnode.listener = oldVnode.listener;
|
|
779
|
-
vnode.listener.vnode = vnode;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
function createAllEventListeners(vnode) {
|
|
784
|
-
const {
|
|
785
|
-
elm,
|
|
786
|
-
data: {
|
|
787
|
-
on
|
|
788
|
-
},
|
|
789
|
-
owner: {
|
|
790
|
-
renderer
|
|
791
|
-
}
|
|
792
|
-
} = vnode;
|
|
793
|
-
|
|
794
|
-
if (isUndefined$1(on)) {
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
const listener = vnode.listener = createListener();
|
|
799
|
-
listener.vnode = vnode;
|
|
800
|
-
let name;
|
|
801
|
-
|
|
802
|
-
for (name in on) {
|
|
803
|
-
renderer.addEventListener(elm, name, listener);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
var modEvents = {
|
|
808
|
-
update: updateAllEventListeners,
|
|
809
|
-
create: createAllEventListeners
|
|
810
|
-
};
|
|
811
|
-
/*
|
|
812
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
813
|
-
* All rights reserved.
|
|
814
|
-
* SPDX-License-Identifier: MIT
|
|
815
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
816
|
-
*/
|
|
817
|
-
|
|
818
|
-
const defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
819
|
-
|
|
820
|
-
function offsetPropertyErrorMessage(name) {
|
|
821
|
-
return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
|
|
822
|
-
} // Global HTML Attributes & Properties
|
|
823
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
824
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
const globalHTMLProperties = assign(create(null), {
|
|
828
|
-
accessKey: {
|
|
829
|
-
attribute: 'accesskey'
|
|
830
|
-
},
|
|
831
|
-
accessKeyLabel: {
|
|
832
|
-
readOnly: true
|
|
833
|
-
},
|
|
834
|
-
className: {
|
|
835
|
-
attribute: 'class',
|
|
836
|
-
error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.'
|
|
837
|
-
},
|
|
838
|
-
contentEditable: {
|
|
839
|
-
attribute: 'contenteditable'
|
|
840
|
-
},
|
|
841
|
-
dataset: {
|
|
842
|
-
readOnly: true,
|
|
843
|
-
error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead."
|
|
844
|
-
},
|
|
845
|
-
dir: {
|
|
846
|
-
attribute: 'dir'
|
|
847
|
-
},
|
|
848
|
-
draggable: {
|
|
849
|
-
attribute: 'draggable'
|
|
850
|
-
},
|
|
851
|
-
dropzone: {
|
|
852
|
-
attribute: 'dropzone',
|
|
853
|
-
readOnly: true
|
|
854
|
-
},
|
|
855
|
-
hidden: {
|
|
856
|
-
attribute: 'hidden'
|
|
857
|
-
},
|
|
858
|
-
id: {
|
|
859
|
-
attribute: 'id'
|
|
860
|
-
},
|
|
861
|
-
inputMode: {
|
|
862
|
-
attribute: 'inputmode'
|
|
863
|
-
},
|
|
864
|
-
lang: {
|
|
865
|
-
attribute: 'lang'
|
|
866
|
-
},
|
|
867
|
-
slot: {
|
|
868
|
-
attribute: 'slot',
|
|
869
|
-
error: 'Using the `slot` property is an anti-pattern.'
|
|
870
|
-
},
|
|
871
|
-
spellcheck: {
|
|
872
|
-
attribute: 'spellcheck'
|
|
873
|
-
},
|
|
874
|
-
style: {
|
|
875
|
-
attribute: 'style'
|
|
876
|
-
},
|
|
877
|
-
tabIndex: {
|
|
878
|
-
attribute: 'tabindex'
|
|
879
|
-
},
|
|
880
|
-
title: {
|
|
881
|
-
attribute: 'title'
|
|
882
|
-
},
|
|
883
|
-
translate: {
|
|
884
|
-
attribute: 'translate'
|
|
885
|
-
},
|
|
886
|
-
// additional "global attributes" that are not present in the link above.
|
|
887
|
-
isContentEditable: {
|
|
888
|
-
readOnly: true
|
|
889
|
-
},
|
|
890
|
-
offsetHeight: {
|
|
891
|
-
readOnly: true,
|
|
892
|
-
error: offsetPropertyErrorMessage('offsetHeight')
|
|
893
|
-
},
|
|
894
|
-
offsetLeft: {
|
|
895
|
-
readOnly: true,
|
|
896
|
-
error: offsetPropertyErrorMessage('offsetLeft')
|
|
897
|
-
},
|
|
898
|
-
offsetParent: {
|
|
899
|
-
readOnly: true
|
|
900
|
-
},
|
|
901
|
-
offsetTop: {
|
|
902
|
-
readOnly: true,
|
|
903
|
-
error: offsetPropertyErrorMessage('offsetTop')
|
|
904
|
-
},
|
|
905
|
-
offsetWidth: {
|
|
906
|
-
readOnly: true,
|
|
907
|
-
error: offsetPropertyErrorMessage('offsetWidth')
|
|
908
|
-
},
|
|
909
|
-
role: {
|
|
910
|
-
attribute: 'role'
|
|
911
|
-
}
|
|
912
|
-
});
|
|
913
|
-
let controlledElement = null;
|
|
914
|
-
let controlledAttributeName;
|
|
915
|
-
|
|
916
|
-
function isAttributeLocked(elm, attrName) {
|
|
917
|
-
return elm !== controlledElement || attrName !== controlledAttributeName;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
function lockAttribute(_elm, _key) {
|
|
921
|
-
controlledElement = null;
|
|
922
|
-
controlledAttributeName = undefined;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
function unlockAttribute(elm, key) {
|
|
926
|
-
controlledElement = elm;
|
|
927
|
-
controlledAttributeName = key;
|
|
928
|
-
}
|
|
929
|
-
/*
|
|
930
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
931
|
-
* All rights reserved.
|
|
932
|
-
* SPDX-License-Identifier: MIT
|
|
933
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
934
|
-
*/
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
const xlinkNS = 'http://www.w3.org/1999/xlink';
|
|
938
|
-
const xmlNS = 'http://www.w3.org/XML/1998/namespace';
|
|
939
|
-
const ColonCharCode = 58;
|
|
940
|
-
|
|
941
|
-
function updateAttrs(oldVnode, vnode) {
|
|
942
|
-
const {
|
|
943
|
-
data: {
|
|
944
|
-
attrs
|
|
945
|
-
},
|
|
946
|
-
owner: {
|
|
947
|
-
renderer
|
|
948
|
-
}
|
|
949
|
-
} = vnode;
|
|
950
|
-
|
|
951
|
-
if (isUndefined$1(attrs)) {
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
let {
|
|
956
|
-
data: {
|
|
957
|
-
attrs: oldAttrs
|
|
958
|
-
}
|
|
959
|
-
} = oldVnode;
|
|
960
|
-
|
|
961
|
-
if (oldAttrs === attrs) {
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
966
|
-
assert.invariant(isUndefined$1(oldAttrs) || keys(oldAttrs).join(',') === keys(attrs).join(','), `vnode.data.attrs cannot change shape.`);
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
const elm = vnode.elm;
|
|
970
|
-
const {
|
|
971
|
-
setAttribute,
|
|
972
|
-
removeAttribute
|
|
973
|
-
} = renderer;
|
|
974
|
-
let key;
|
|
975
|
-
oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
|
|
976
|
-
// this routine is only useful for data-* attributes in all kind of elements
|
|
977
|
-
// and aria-* in standard elements (custom elements will use props for these)
|
|
978
|
-
|
|
979
|
-
for (key in attrs) {
|
|
980
|
-
const cur = attrs[key];
|
|
981
|
-
const old = oldAttrs[key];
|
|
982
|
-
|
|
983
|
-
if (old !== cur) {
|
|
984
|
-
unlockAttribute(elm, key);
|
|
985
|
-
|
|
986
|
-
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
987
|
-
// Assume xml namespace
|
|
988
|
-
setAttribute(elm, key, cur, xmlNS);
|
|
989
|
-
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
990
|
-
// Assume xlink namespace
|
|
991
|
-
setAttribute(elm, key, cur, xlinkNS);
|
|
992
|
-
} else if (isNull(cur)) {
|
|
993
|
-
removeAttribute(elm, key);
|
|
994
|
-
} else {
|
|
995
|
-
setAttribute(elm, key, cur);
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
lockAttribute();
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
const emptyVNode$3 = {
|
|
1004
|
-
data: {}
|
|
1005
|
-
};
|
|
1006
|
-
var modAttrs = {
|
|
1007
|
-
create: vnode => updateAttrs(emptyVNode$3, vnode),
|
|
1008
|
-
update: updateAttrs
|
|
1009
|
-
};
|
|
1010
|
-
/*
|
|
1011
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1012
|
-
* All rights reserved.
|
|
1013
|
-
* SPDX-License-Identifier: MIT
|
|
1014
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1015
|
-
*/
|
|
1016
|
-
|
|
1017
|
-
function isLiveBindingProp(sel, key) {
|
|
1018
|
-
// For properties with live bindings, we read values from the DOM element
|
|
1019
|
-
// instead of relying on internally tracked values.
|
|
1020
|
-
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
function update(oldVnode, vnode) {
|
|
1024
|
-
const props = vnode.data.props;
|
|
1025
|
-
|
|
1026
|
-
if (isUndefined$1(props)) {
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
const oldProps = oldVnode.data.props;
|
|
1031
|
-
|
|
1032
|
-
if (oldProps === props) {
|
|
1033
|
-
return;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1037
|
-
assert.invariant(isUndefined$1(oldProps) || keys(oldProps).join(',') === keys(props).join(','), 'vnode.data.props cannot change shape.');
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
const isFirstPatch = isUndefined$1(oldProps);
|
|
1041
|
-
const {
|
|
1042
|
-
elm,
|
|
1043
|
-
sel,
|
|
1044
|
-
owner: {
|
|
1045
|
-
renderer
|
|
1046
|
-
}
|
|
1047
|
-
} = vnode;
|
|
1048
|
-
|
|
1049
|
-
for (const key in props) {
|
|
1050
|
-
const cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
|
|
1051
|
-
|
|
1052
|
-
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? renderer.getProperty(elm, key) : oldProps[key])) {
|
|
1053
|
-
renderer.setProperty(elm, key, cur);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
const emptyVNode$2 = {
|
|
1059
|
-
data: {}
|
|
1060
|
-
};
|
|
1061
|
-
var modProps = {
|
|
1062
|
-
create: vnode => update(emptyVNode$2, vnode),
|
|
1063
|
-
update
|
|
1064
|
-
};
|
|
1065
|
-
/*
|
|
1066
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1067
|
-
* All rights reserved.
|
|
1068
|
-
* SPDX-License-Identifier: MIT
|
|
1069
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1070
|
-
*/
|
|
1071
|
-
|
|
1072
|
-
const classNameToClassMap = create(null);
|
|
1073
|
-
|
|
1074
|
-
function getMapFromClassName(className) {
|
|
1075
|
-
// Intentionally using == to match undefined and null values from computed style attribute
|
|
1076
|
-
if (className == null) {
|
|
1077
|
-
return EmptyObject;
|
|
1078
|
-
} // computed class names must be string
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
className = isString(className) ? className : className + '';
|
|
1082
|
-
let map = classNameToClassMap[className];
|
|
1083
|
-
|
|
1084
|
-
if (map) {
|
|
1085
|
-
return map;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
map = create(null);
|
|
1089
|
-
let start = 0;
|
|
1090
|
-
let o;
|
|
1091
|
-
const len = className.length;
|
|
1092
|
-
|
|
1093
|
-
for (o = 0; o < len; o++) {
|
|
1094
|
-
if (StringCharCodeAt.call(className, o) === SPACE_CHAR) {
|
|
1095
|
-
if (o > start) {
|
|
1096
|
-
map[StringSlice.call(className, start, o)] = true;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
start = o + 1;
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
if (o > start) {
|
|
1104
|
-
map[StringSlice.call(className, start, o)] = true;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
classNameToClassMap[className] = map;
|
|
1108
|
-
|
|
1109
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1110
|
-
// just to make sure that this object never changes as part of the diffing algo
|
|
1111
|
-
freeze(map);
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
return map;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
function updateClassAttribute(oldVnode, vnode) {
|
|
1118
|
-
const {
|
|
1119
|
-
elm,
|
|
1120
|
-
data: {
|
|
1121
|
-
className: newClass
|
|
1122
|
-
},
|
|
1123
|
-
owner: {
|
|
1124
|
-
renderer
|
|
1125
|
-
}
|
|
1126
|
-
} = vnode;
|
|
1127
|
-
const {
|
|
1128
|
-
data: {
|
|
1129
|
-
className: oldClass
|
|
1130
|
-
}
|
|
1131
|
-
} = oldVnode;
|
|
1132
|
-
|
|
1133
|
-
if (oldClass === newClass) {
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
const classList = renderer.getClassList(elm);
|
|
1138
|
-
const newClassMap = getMapFromClassName(newClass);
|
|
1139
|
-
const oldClassMap = getMapFromClassName(oldClass);
|
|
1140
|
-
let name;
|
|
1141
|
-
|
|
1142
|
-
for (name in oldClassMap) {
|
|
1143
|
-
// remove only if it is not in the new class collection and it is not set from within the instance
|
|
1144
|
-
if (isUndefined$1(newClassMap[name])) {
|
|
1145
|
-
classList.remove(name);
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
for (name in newClassMap) {
|
|
1150
|
-
if (isUndefined$1(oldClassMap[name])) {
|
|
1151
|
-
classList.add(name);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
const emptyVNode$1 = {
|
|
1157
|
-
data: {}
|
|
1158
|
-
};
|
|
1159
|
-
var modComputedClassName = {
|
|
1160
|
-
create: vnode => updateClassAttribute(emptyVNode$1, vnode),
|
|
1161
|
-
update: updateClassAttribute
|
|
1162
|
-
};
|
|
1163
|
-
/*
|
|
1164
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1165
|
-
* All rights reserved.
|
|
1166
|
-
* SPDX-License-Identifier: MIT
|
|
1167
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1168
|
-
*/
|
|
1169
|
-
|
|
1170
|
-
function updateStyleAttribute(oldVnode, vnode) {
|
|
1171
|
-
const {
|
|
1172
|
-
elm,
|
|
1173
|
-
data: {
|
|
1174
|
-
style: newStyle
|
|
1175
|
-
},
|
|
1176
|
-
owner: {
|
|
1177
|
-
renderer
|
|
1178
|
-
}
|
|
1179
|
-
} = vnode;
|
|
1180
|
-
const {
|
|
1181
|
-
setAttribute,
|
|
1182
|
-
removeAttribute
|
|
1183
|
-
} = renderer;
|
|
1184
|
-
|
|
1185
|
-
if (oldVnode.data.style === newStyle) {
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
if (!isString(newStyle) || newStyle === '') {
|
|
1190
|
-
removeAttribute(elm, 'style');
|
|
1191
|
-
} else {
|
|
1192
|
-
setAttribute(elm, 'style', newStyle);
|
|
1193
|
-
}
|
|
906
|
+
function componentValueMutated(vm, key) {
|
|
907
|
+
valueMutated(vm.component, key);
|
|
1194
908
|
}
|
|
1195
909
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
}
|
|
1199
|
-
var modComputedStyle = {
|
|
1200
|
-
create: vnode => updateStyleAttribute(emptyVNode, vnode),
|
|
1201
|
-
update: updateStyleAttribute
|
|
1202
|
-
};
|
|
910
|
+
function componentValueObserved(vm, key) {
|
|
911
|
+
valueObserved(vm.component, key);
|
|
912
|
+
}
|
|
1203
913
|
/*
|
|
1204
914
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1205
915
|
* All rights reserved.
|
|
1206
916
|
* SPDX-License-Identifier: MIT
|
|
1207
917
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1208
918
|
*/
|
|
1209
|
-
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
1210
|
-
// different classnames properties individually instead of via a string.
|
|
1211
919
|
|
|
1212
|
-
function createClassAttribute(vnode) {
|
|
1213
|
-
const {
|
|
1214
|
-
elm,
|
|
1215
|
-
data: {
|
|
1216
|
-
classMap
|
|
1217
|
-
},
|
|
1218
|
-
owner: {
|
|
1219
|
-
renderer
|
|
1220
|
-
}
|
|
1221
|
-
} = vnode;
|
|
1222
920
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
921
|
+
function getComponentTag(vm) {
|
|
922
|
+
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
923
|
+
} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
1226
924
|
|
|
1227
|
-
const classList = renderer.getClassList(elm);
|
|
1228
925
|
|
|
1229
|
-
|
|
1230
|
-
|
|
926
|
+
function getComponentStack(vm) {
|
|
927
|
+
const stack = [];
|
|
928
|
+
let prefix = '';
|
|
929
|
+
|
|
930
|
+
while (!isNull(vm.owner)) {
|
|
931
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
932
|
+
vm = vm.owner;
|
|
933
|
+
prefix += '\t';
|
|
1231
934
|
}
|
|
935
|
+
|
|
936
|
+
return ArrayJoin.call(stack, '\n');
|
|
1232
937
|
}
|
|
1233
938
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
939
|
+
function getErrorComponentStack(vm) {
|
|
940
|
+
const wcStack = [];
|
|
941
|
+
let currentVm = vm;
|
|
942
|
+
|
|
943
|
+
while (!isNull(currentVm)) {
|
|
944
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
945
|
+
currentVm = currentVm.owner;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
return wcStack.reverse().join('\n\t');
|
|
949
|
+
}
|
|
1237
950
|
/*
|
|
1238
951
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1239
952
|
* All rights reserved.
|
|
1240
953
|
* SPDX-License-Identifier: MIT
|
|
1241
954
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1242
955
|
*/
|
|
1243
|
-
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
1244
|
-
// different style properties individually instead of via a string.
|
|
1245
956
|
|
|
1246
|
-
function createStyleAttribute(vnode) {
|
|
1247
|
-
const {
|
|
1248
|
-
elm,
|
|
1249
|
-
data: {
|
|
1250
|
-
styleDecls
|
|
1251
|
-
},
|
|
1252
|
-
owner: {
|
|
1253
|
-
renderer
|
|
1254
|
-
}
|
|
1255
|
-
} = vnode;
|
|
1256
957
|
|
|
1257
|
-
|
|
958
|
+
function log(method, message, vm) {
|
|
959
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
960
|
+
|
|
961
|
+
if (!isUndefined$1(vm)) {
|
|
962
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
if (process.env.NODE_ENV === 'test') {
|
|
966
|
+
/* eslint-disable-next-line no-console */
|
|
967
|
+
console[method](msg);
|
|
1258
968
|
return;
|
|
1259
969
|
}
|
|
1260
970
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
971
|
+
try {
|
|
972
|
+
throw new Error(msg);
|
|
973
|
+
} catch (e) {
|
|
974
|
+
/* eslint-disable-next-line no-console */
|
|
975
|
+
console[method](e);
|
|
1264
976
|
}
|
|
1265
977
|
}
|
|
1266
978
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
}
|
|
979
|
+
function logError(message, vm) {
|
|
980
|
+
log('error', message, vm);
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
function logWarn(message, vm) {
|
|
984
|
+
log('warn', message, vm);
|
|
985
|
+
}
|
|
1270
986
|
/*
|
|
1271
987
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1272
988
|
* All rights reserved.
|
|
@@ -1274,14 +990,6 @@ var modStaticStyle = {
|
|
|
1274
990
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1275
991
|
*/
|
|
1276
992
|
|
|
1277
|
-
/**
|
|
1278
|
-
@license
|
|
1279
|
-
Copyright (c) 2015 Simon Friis Vindum.
|
|
1280
|
-
This code may only be used under the MIT License found at
|
|
1281
|
-
https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
1282
|
-
Code distributed by Snabbdom as part of the Snabbdom project at
|
|
1283
|
-
https://github.com/snabbdom/snabbdom/
|
|
1284
|
-
*/
|
|
1285
993
|
|
|
1286
994
|
function isUndef(s) {
|
|
1287
995
|
return s === undefined;
|
|
@@ -1370,7 +1078,7 @@ function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
|
1370
1078
|
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
1371
1079
|
// Vnode moved right
|
|
1372
1080
|
patchVnode(oldStartVnode, newEndVnode);
|
|
1373
|
-
newEndVnode.hook.move(oldStartVnode, parentElm,
|
|
1081
|
+
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
1374
1082
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
1375
1083
|
newEndVnode = newCh[--newEndIdx];
|
|
1376
1084
|
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
@@ -1490,6 +1198,125 @@ function patchVnode(oldVnode, vnode) {
|
|
|
1490
1198
|
*/
|
|
1491
1199
|
|
|
1492
1200
|
|
|
1201
|
+
const defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1202
|
+
|
|
1203
|
+
function offsetPropertyErrorMessage(name) {
|
|
1204
|
+
return `Using the \`${name}\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \`getBoundingClientRect\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;
|
|
1205
|
+
} // Global HTML Attributes & Properties
|
|
1206
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
1207
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
const globalHTMLProperties = assign(create(null), {
|
|
1211
|
+
accessKey: {
|
|
1212
|
+
attribute: 'accesskey'
|
|
1213
|
+
},
|
|
1214
|
+
accessKeyLabel: {
|
|
1215
|
+
readOnly: true
|
|
1216
|
+
},
|
|
1217
|
+
className: {
|
|
1218
|
+
attribute: 'class',
|
|
1219
|
+
error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.'
|
|
1220
|
+
},
|
|
1221
|
+
contentEditable: {
|
|
1222
|
+
attribute: 'contenteditable'
|
|
1223
|
+
},
|
|
1224
|
+
dataset: {
|
|
1225
|
+
readOnly: true,
|
|
1226
|
+
error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead."
|
|
1227
|
+
},
|
|
1228
|
+
dir: {
|
|
1229
|
+
attribute: 'dir'
|
|
1230
|
+
},
|
|
1231
|
+
draggable: {
|
|
1232
|
+
attribute: 'draggable'
|
|
1233
|
+
},
|
|
1234
|
+
dropzone: {
|
|
1235
|
+
attribute: 'dropzone',
|
|
1236
|
+
readOnly: true
|
|
1237
|
+
},
|
|
1238
|
+
hidden: {
|
|
1239
|
+
attribute: 'hidden'
|
|
1240
|
+
},
|
|
1241
|
+
id: {
|
|
1242
|
+
attribute: 'id'
|
|
1243
|
+
},
|
|
1244
|
+
inputMode: {
|
|
1245
|
+
attribute: 'inputmode'
|
|
1246
|
+
},
|
|
1247
|
+
lang: {
|
|
1248
|
+
attribute: 'lang'
|
|
1249
|
+
},
|
|
1250
|
+
slot: {
|
|
1251
|
+
attribute: 'slot',
|
|
1252
|
+
error: 'Using the `slot` property is an anti-pattern.'
|
|
1253
|
+
},
|
|
1254
|
+
spellcheck: {
|
|
1255
|
+
attribute: 'spellcheck'
|
|
1256
|
+
},
|
|
1257
|
+
style: {
|
|
1258
|
+
attribute: 'style'
|
|
1259
|
+
},
|
|
1260
|
+
tabIndex: {
|
|
1261
|
+
attribute: 'tabindex'
|
|
1262
|
+
},
|
|
1263
|
+
title: {
|
|
1264
|
+
attribute: 'title'
|
|
1265
|
+
},
|
|
1266
|
+
translate: {
|
|
1267
|
+
attribute: 'translate'
|
|
1268
|
+
},
|
|
1269
|
+
// additional "global attributes" that are not present in the link above.
|
|
1270
|
+
isContentEditable: {
|
|
1271
|
+
readOnly: true
|
|
1272
|
+
},
|
|
1273
|
+
offsetHeight: {
|
|
1274
|
+
readOnly: true,
|
|
1275
|
+
error: offsetPropertyErrorMessage('offsetHeight')
|
|
1276
|
+
},
|
|
1277
|
+
offsetLeft: {
|
|
1278
|
+
readOnly: true,
|
|
1279
|
+
error: offsetPropertyErrorMessage('offsetLeft')
|
|
1280
|
+
},
|
|
1281
|
+
offsetParent: {
|
|
1282
|
+
readOnly: true
|
|
1283
|
+
},
|
|
1284
|
+
offsetTop: {
|
|
1285
|
+
readOnly: true,
|
|
1286
|
+
error: offsetPropertyErrorMessage('offsetTop')
|
|
1287
|
+
},
|
|
1288
|
+
offsetWidth: {
|
|
1289
|
+
readOnly: true,
|
|
1290
|
+
error: offsetPropertyErrorMessage('offsetWidth')
|
|
1291
|
+
},
|
|
1292
|
+
role: {
|
|
1293
|
+
attribute: 'role'
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
let controlledElement = null;
|
|
1297
|
+
let controlledAttributeName;
|
|
1298
|
+
|
|
1299
|
+
function isAttributeLocked(elm, attrName) {
|
|
1300
|
+
return elm !== controlledElement || attrName !== controlledAttributeName;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
function lockAttribute(_elm, _key) {
|
|
1304
|
+
controlledElement = null;
|
|
1305
|
+
controlledAttributeName = undefined;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
function unlockAttribute(elm, key) {
|
|
1309
|
+
controlledElement = elm;
|
|
1310
|
+
controlledAttributeName = key;
|
|
1311
|
+
}
|
|
1312
|
+
/*
|
|
1313
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1314
|
+
* All rights reserved.
|
|
1315
|
+
* SPDX-License-Identifier: MIT
|
|
1316
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1317
|
+
*/
|
|
1318
|
+
|
|
1319
|
+
|
|
1493
1320
|
function generateDataDescriptor(options) {
|
|
1494
1321
|
return assign({
|
|
1495
1322
|
configurable: true,
|
|
@@ -1852,7 +1679,7 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
|
1852
1679
|
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1853
1680
|
}
|
|
1854
1681
|
/*
|
|
1855
|
-
* Copyright (c)
|
|
1682
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1856
1683
|
* All rights reserved.
|
|
1857
1684
|
* SPDX-License-Identifier: MIT
|
|
1858
1685
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
@@ -2772,9 +2599,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
2772
2599
|
|
|
2773
2600
|
|
|
2774
2601
|
const LightningElement = function () {
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2602
|
+
// This should be as performant as possible, while any initialization should be done lazily
|
|
2778
2603
|
if (isNull(vmBeingConstructed)) {
|
|
2779
2604
|
throw new ReferenceError('Illegal constructor');
|
|
2780
2605
|
}
|
|
@@ -2782,15 +2607,14 @@ const LightningElement = function () {
|
|
|
2782
2607
|
const vm = vmBeingConstructed;
|
|
2783
2608
|
const {
|
|
2784
2609
|
def,
|
|
2785
|
-
elm
|
|
2786
|
-
renderer
|
|
2610
|
+
elm
|
|
2787
2611
|
} = vm;
|
|
2788
2612
|
const {
|
|
2789
2613
|
bridge
|
|
2790
2614
|
} = def;
|
|
2791
2615
|
|
|
2792
2616
|
if (process.env.NODE_ENV !== 'production') {
|
|
2793
|
-
|
|
2617
|
+
assertInstanceOfHTMLElement$1(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2794
2618
|
}
|
|
2795
2619
|
|
|
2796
2620
|
const component = this;
|
|
@@ -2820,7 +2644,7 @@ const LightningElement = function () {
|
|
|
2820
2644
|
if (vm.renderMode === 1
|
|
2821
2645
|
/* Shadow */
|
|
2822
2646
|
) {
|
|
2823
|
-
|
|
2647
|
+
doAttachShadow(vm);
|
|
2824
2648
|
} // Adding extra guard rails in DEV mode.
|
|
2825
2649
|
|
|
2826
2650
|
|
|
@@ -2832,17 +2656,16 @@ const LightningElement = function () {
|
|
|
2832
2656
|
return this;
|
|
2833
2657
|
};
|
|
2834
2658
|
|
|
2835
|
-
function
|
|
2659
|
+
function doAttachShadow(vm) {
|
|
2836
2660
|
const {
|
|
2837
2661
|
elm,
|
|
2838
2662
|
mode,
|
|
2839
|
-
renderer,
|
|
2840
2663
|
shadowMode,
|
|
2841
2664
|
def: {
|
|
2842
2665
|
ctor
|
|
2843
2666
|
}
|
|
2844
2667
|
} = vm;
|
|
2845
|
-
const cmpRoot =
|
|
2668
|
+
const cmpRoot = attachShadow$1(elm, {
|
|
2846
2669
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1
|
|
2847
2670
|
/* Synthetic */
|
|
2848
2671
|
,
|
|
@@ -2869,21 +2692,15 @@ LightningElement.prototype = {
|
|
|
2869
2692
|
|
|
2870
2693
|
dispatchEvent(event) {
|
|
2871
2694
|
const {
|
|
2872
|
-
elm
|
|
2873
|
-
renderer: {
|
|
2874
|
-
dispatchEvent
|
|
2875
|
-
}
|
|
2695
|
+
elm
|
|
2876
2696
|
} = getAssociatedVM(this);
|
|
2877
|
-
return dispatchEvent(elm, event);
|
|
2697
|
+
return dispatchEvent$1(elm, event);
|
|
2878
2698
|
},
|
|
2879
2699
|
|
|
2880
2700
|
addEventListener(type, listener, options) {
|
|
2881
2701
|
const vm = getAssociatedVM(this);
|
|
2882
2702
|
const {
|
|
2883
|
-
elm
|
|
2884
|
-
renderer: {
|
|
2885
|
-
addEventListener
|
|
2886
|
-
}
|
|
2703
|
+
elm
|
|
2887
2704
|
} = vm;
|
|
2888
2705
|
|
|
2889
2706
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2894,92 +2711,68 @@ LightningElement.prototype = {
|
|
|
2894
2711
|
}
|
|
2895
2712
|
|
|
2896
2713
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2897
|
-
addEventListener(elm, type, wrappedListener, options);
|
|
2714
|
+
addEventListener$1(elm, type, wrappedListener, options);
|
|
2898
2715
|
},
|
|
2899
2716
|
|
|
2900
2717
|
removeEventListener(type, listener, options) {
|
|
2901
2718
|
const vm = getAssociatedVM(this);
|
|
2902
2719
|
const {
|
|
2903
|
-
elm
|
|
2904
|
-
renderer: {
|
|
2905
|
-
removeEventListener
|
|
2906
|
-
}
|
|
2720
|
+
elm
|
|
2907
2721
|
} = vm;
|
|
2908
2722
|
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2909
|
-
removeEventListener(elm, type, wrappedListener, options);
|
|
2723
|
+
removeEventListener$1(elm, type, wrappedListener, options);
|
|
2910
2724
|
},
|
|
2911
2725
|
|
|
2912
2726
|
hasAttribute(name) {
|
|
2913
2727
|
const {
|
|
2914
|
-
elm
|
|
2915
|
-
renderer: {
|
|
2916
|
-
getAttribute
|
|
2917
|
-
}
|
|
2728
|
+
elm
|
|
2918
2729
|
} = getAssociatedVM(this);
|
|
2919
|
-
return !isNull(getAttribute(elm, name));
|
|
2730
|
+
return !isNull(getAttribute$1(elm, name));
|
|
2920
2731
|
},
|
|
2921
2732
|
|
|
2922
2733
|
hasAttributeNS(namespace, name) {
|
|
2923
2734
|
const {
|
|
2924
|
-
elm
|
|
2925
|
-
renderer: {
|
|
2926
|
-
getAttribute
|
|
2927
|
-
}
|
|
2735
|
+
elm
|
|
2928
2736
|
} = getAssociatedVM(this);
|
|
2929
|
-
return !isNull(getAttribute(elm, name, namespace));
|
|
2737
|
+
return !isNull(getAttribute$1(elm, name, namespace));
|
|
2930
2738
|
},
|
|
2931
2739
|
|
|
2932
2740
|
removeAttribute(name) {
|
|
2933
2741
|
const {
|
|
2934
|
-
elm
|
|
2935
|
-
renderer: {
|
|
2936
|
-
removeAttribute
|
|
2937
|
-
}
|
|
2742
|
+
elm
|
|
2938
2743
|
} = getAssociatedVM(this);
|
|
2939
2744
|
unlockAttribute(elm, name);
|
|
2940
|
-
removeAttribute(elm, name);
|
|
2745
|
+
removeAttribute$1(elm, name);
|
|
2941
2746
|
lockAttribute();
|
|
2942
2747
|
},
|
|
2943
2748
|
|
|
2944
2749
|
removeAttributeNS(namespace, name) {
|
|
2945
2750
|
const {
|
|
2946
|
-
elm
|
|
2947
|
-
renderer: {
|
|
2948
|
-
removeAttribute
|
|
2949
|
-
}
|
|
2751
|
+
elm
|
|
2950
2752
|
} = getAssociatedVM(this);
|
|
2951
2753
|
unlockAttribute(elm, name);
|
|
2952
|
-
removeAttribute(elm, name, namespace);
|
|
2754
|
+
removeAttribute$1(elm, name, namespace);
|
|
2953
2755
|
lockAttribute();
|
|
2954
2756
|
},
|
|
2955
2757
|
|
|
2956
2758
|
getAttribute(name) {
|
|
2957
2759
|
const {
|
|
2958
|
-
elm
|
|
2959
|
-
renderer: {
|
|
2960
|
-
getAttribute
|
|
2961
|
-
}
|
|
2760
|
+
elm
|
|
2962
2761
|
} = getAssociatedVM(this);
|
|
2963
|
-
return getAttribute(elm, name);
|
|
2762
|
+
return getAttribute$1(elm, name);
|
|
2964
2763
|
},
|
|
2965
2764
|
|
|
2966
2765
|
getAttributeNS(namespace, name) {
|
|
2967
2766
|
const {
|
|
2968
|
-
elm
|
|
2969
|
-
renderer: {
|
|
2970
|
-
getAttribute
|
|
2971
|
-
}
|
|
2767
|
+
elm
|
|
2972
2768
|
} = getAssociatedVM(this);
|
|
2973
|
-
return getAttribute(elm, name, namespace);
|
|
2769
|
+
return getAttribute$1(elm, name, namespace);
|
|
2974
2770
|
},
|
|
2975
2771
|
|
|
2976
2772
|
setAttribute(name, value) {
|
|
2977
2773
|
const vm = getAssociatedVM(this);
|
|
2978
2774
|
const {
|
|
2979
|
-
elm
|
|
2980
|
-
renderer: {
|
|
2981
|
-
setAttribute
|
|
2982
|
-
}
|
|
2775
|
+
elm
|
|
2983
2776
|
} = vm;
|
|
2984
2777
|
|
|
2985
2778
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2987,17 +2780,14 @@ LightningElement.prototype = {
|
|
|
2987
2780
|
}
|
|
2988
2781
|
|
|
2989
2782
|
unlockAttribute(elm, name);
|
|
2990
|
-
setAttribute(elm, name, value);
|
|
2783
|
+
setAttribute$1(elm, name, value);
|
|
2991
2784
|
lockAttribute();
|
|
2992
2785
|
},
|
|
2993
2786
|
|
|
2994
2787
|
setAttributeNS(namespace, name, value) {
|
|
2995
2788
|
const vm = getAssociatedVM(this);
|
|
2996
2789
|
const {
|
|
2997
|
-
elm
|
|
2998
|
-
renderer: {
|
|
2999
|
-
setAttribute
|
|
3000
|
-
}
|
|
2790
|
+
elm
|
|
3001
2791
|
} = vm;
|
|
3002
2792
|
|
|
3003
2793
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -3005,43 +2795,34 @@ LightningElement.prototype = {
|
|
|
3005
2795
|
}
|
|
3006
2796
|
|
|
3007
2797
|
unlockAttribute(elm, name);
|
|
3008
|
-
setAttribute(elm, name, value, namespace);
|
|
2798
|
+
setAttribute$1(elm, name, value, namespace);
|
|
3009
2799
|
lockAttribute();
|
|
3010
2800
|
},
|
|
3011
2801
|
|
|
3012
2802
|
getBoundingClientRect() {
|
|
3013
2803
|
const vm = getAssociatedVM(this);
|
|
3014
2804
|
const {
|
|
3015
|
-
elm
|
|
3016
|
-
renderer: {
|
|
3017
|
-
getBoundingClientRect
|
|
3018
|
-
}
|
|
2805
|
+
elm
|
|
3019
2806
|
} = vm;
|
|
3020
2807
|
|
|
3021
2808
|
if (process.env.NODE_ENV !== 'production') {
|
|
3022
2809
|
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
3023
2810
|
}
|
|
3024
2811
|
|
|
3025
|
-
return getBoundingClientRect(elm);
|
|
2812
|
+
return getBoundingClientRect$1(elm);
|
|
3026
2813
|
},
|
|
3027
2814
|
|
|
3028
2815
|
get isConnected() {
|
|
3029
2816
|
const {
|
|
3030
|
-
elm
|
|
3031
|
-
renderer: {
|
|
3032
|
-
isConnected
|
|
3033
|
-
}
|
|
2817
|
+
elm
|
|
3034
2818
|
} = getAssociatedVM(this);
|
|
3035
|
-
return isConnected(elm);
|
|
2819
|
+
return isConnected$1(elm);
|
|
3036
2820
|
},
|
|
3037
2821
|
|
|
3038
2822
|
get classList() {
|
|
3039
2823
|
const vm = getAssociatedVM(this);
|
|
3040
2824
|
const {
|
|
3041
|
-
elm
|
|
3042
|
-
renderer: {
|
|
3043
|
-
getClassList
|
|
3044
|
-
}
|
|
2825
|
+
elm
|
|
3045
2826
|
} = vm;
|
|
3046
2827
|
|
|
3047
2828
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -3050,7 +2831,7 @@ LightningElement.prototype = {
|
|
|
3050
2831
|
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.`);
|
|
3051
2832
|
}
|
|
3052
2833
|
|
|
3053
|
-
return getClassList(elm);
|
|
2834
|
+
return getClassList$1(elm);
|
|
3054
2835
|
},
|
|
3055
2836
|
|
|
3056
2837
|
get template() {
|
|
@@ -3084,23 +2865,48 @@ LightningElement.prototype = {
|
|
|
3084
2865
|
}
|
|
3085
2866
|
|
|
3086
2867
|
};
|
|
3087
|
-
const queryAndChildGetterDescriptors = create(null);
|
|
3088
|
-
|
|
2868
|
+
const queryAndChildGetterDescriptors = create(null); // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size
|
|
2869
|
+
// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen
|
|
2870
|
+
// object representing the renderer, with a lot of methods we don't actually need.
|
|
2871
|
+
|
|
2872
|
+
const childGetters = ['children', 'childNodes', 'firstChild', 'firstElementChild', 'lastChild', 'lastElementChild'];
|
|
2873
|
+
|
|
2874
|
+
function getChildGetter(methodName) {
|
|
2875
|
+
switch (methodName) {
|
|
2876
|
+
case 'children':
|
|
2877
|
+
return getChildren$1;
|
|
2878
|
+
|
|
2879
|
+
case 'childNodes':
|
|
2880
|
+
return getChildNodes$1;
|
|
2881
|
+
|
|
2882
|
+
case 'firstChild':
|
|
2883
|
+
return getFirstChild$1;
|
|
2884
|
+
|
|
2885
|
+
case 'firstElementChild':
|
|
2886
|
+
return getFirstElementChild$1;
|
|
2887
|
+
|
|
2888
|
+
case 'lastChild':
|
|
2889
|
+
return getLastChild$1;
|
|
2890
|
+
|
|
2891
|
+
case 'lastElementChild':
|
|
2892
|
+
return getLastElementChild$1;
|
|
2893
|
+
}
|
|
2894
|
+
} // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2895
|
+
|
|
3089
2896
|
|
|
3090
|
-
for (const
|
|
3091
|
-
queryAndChildGetterDescriptors[
|
|
2897
|
+
for (const childGetter of childGetters) {
|
|
2898
|
+
queryAndChildGetterDescriptors[childGetter] = {
|
|
3092
2899
|
get() {
|
|
3093
2900
|
const vm = getAssociatedVM(this);
|
|
3094
2901
|
const {
|
|
3095
|
-
elm
|
|
3096
|
-
renderer
|
|
2902
|
+
elm
|
|
3097
2903
|
} = vm;
|
|
3098
2904
|
|
|
3099
2905
|
if (process.env.NODE_ENV !== 'production') {
|
|
3100
|
-
warnIfInvokedDuringConstruction(vm,
|
|
2906
|
+
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
3101
2907
|
}
|
|
3102
2908
|
|
|
3103
|
-
return
|
|
2909
|
+
return getChildGetter(childGetter)(elm);
|
|
3104
2910
|
},
|
|
3105
2911
|
|
|
3106
2912
|
configurable: true,
|
|
@@ -3108,22 +2914,38 @@ for (const [elementProp, rendererMethod] of childGetters) {
|
|
|
3108
2914
|
};
|
|
3109
2915
|
}
|
|
3110
2916
|
|
|
3111
|
-
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2917
|
+
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2918
|
+
|
|
2919
|
+
function getQueryMethod(methodName) {
|
|
2920
|
+
switch (methodName) {
|
|
2921
|
+
case 'getElementsByClassName':
|
|
2922
|
+
return getElementsByClassName$1;
|
|
2923
|
+
|
|
2924
|
+
case 'getElementsByTagName':
|
|
2925
|
+
return getElementsByTagName$1;
|
|
2926
|
+
|
|
2927
|
+
case 'querySelector':
|
|
2928
|
+
return querySelector$1;
|
|
2929
|
+
|
|
2930
|
+
case 'querySelectorAll':
|
|
2931
|
+
return querySelectorAll$1;
|
|
2932
|
+
}
|
|
2933
|
+
} // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2934
|
+
|
|
3112
2935
|
|
|
3113
2936
|
for (const queryMethod of queryMethods) {
|
|
3114
2937
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
3115
2938
|
value(arg) {
|
|
3116
2939
|
const vm = getAssociatedVM(this);
|
|
3117
2940
|
const {
|
|
3118
|
-
elm
|
|
3119
|
-
renderer
|
|
2941
|
+
elm
|
|
3120
2942
|
} = vm;
|
|
3121
2943
|
|
|
3122
2944
|
if (process.env.NODE_ENV !== 'production') {
|
|
3123
2945
|
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
3124
2946
|
}
|
|
3125
2947
|
|
|
3126
|
-
return
|
|
2948
|
+
return getQueryMethod(queryMethod)(elm, arg);
|
|
3127
2949
|
},
|
|
3128
2950
|
|
|
3129
2951
|
configurable: true,
|
|
@@ -4159,10 +3981,6 @@ function createComponentDef(Ctor) {
|
|
|
4159
3981
|
|
|
4160
3982
|
assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
4161
3983
|
|
|
4162
|
-
if (!runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
4163
|
-
assert.isFalse('shadowSupportMode' in Ctor, `${ctorName || 'Anonymous class'} is an invalid LWC component. The shadowSupportMode static property is not available in this environment.`);
|
|
4164
|
-
}
|
|
4165
|
-
|
|
4166
3984
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4167
3985
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4168
3986
|
/* Any */
|
|
@@ -4268,118 +4086,407 @@ function isComponentConstructor(ctor) {
|
|
|
4268
4086
|
// to resolve.
|
|
4269
4087
|
|
|
4270
4088
|
|
|
4271
|
-
let current = ctor;
|
|
4089
|
+
let current = ctor;
|
|
4090
|
+
|
|
4091
|
+
do {
|
|
4092
|
+
if (isCircularModuleDependency(current)) {
|
|
4093
|
+
const circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end
|
|
4094
|
+
// of the proto chain, which must always be a valid base constructor.
|
|
4095
|
+
|
|
4096
|
+
if (circularResolved === current) {
|
|
4097
|
+
return true;
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
current = circularResolved;
|
|
4101
|
+
}
|
|
4102
|
+
|
|
4103
|
+
if (current === LightningElement) {
|
|
4104
|
+
return true;
|
|
4105
|
+
}
|
|
4106
|
+
} while (!isNull(current) && (current = getPrototypeOf$1(current))); // Finally return false if the LightningElement is not part of the prototype chain.
|
|
4107
|
+
|
|
4108
|
+
|
|
4109
|
+
return false;
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
function getComponentInternalDef(Ctor) {
|
|
4113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4114
|
+
Ctor = getComponentOrSwappedComponent(Ctor);
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
let def = CtorToDefMap.get(Ctor);
|
|
4118
|
+
|
|
4119
|
+
if (isUndefined$1(def)) {
|
|
4120
|
+
if (isCircularModuleDependency(Ctor)) {
|
|
4121
|
+
const resolvedCtor = resolveCircularModuleDependency(Ctor);
|
|
4122
|
+
def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
|
|
4123
|
+
// look up the definition in cache instead of re-resolving and recreating the def.
|
|
4124
|
+
|
|
4125
|
+
CtorToDefMap.set(Ctor, def);
|
|
4126
|
+
return def;
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
if (!isComponentConstructor(Ctor)) {
|
|
4130
|
+
throw new TypeError(`${Ctor} is not a valid component, or does not extends LightningElement from "lwc". You probably forgot to add the extend clause on the class declaration.`);
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
def = createComponentDef(Ctor);
|
|
4134
|
+
CtorToDefMap.set(Ctor, def);
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
return def;
|
|
4138
|
+
}
|
|
4139
|
+
|
|
4140
|
+
const lightingElementDef = {
|
|
4141
|
+
ctor: LightningElement,
|
|
4142
|
+
name: LightningElement.name,
|
|
4143
|
+
props: lightningBasedDescriptors,
|
|
4144
|
+
propsConfig: EmptyObject,
|
|
4145
|
+
methods: EmptyObject,
|
|
4146
|
+
renderMode: 1
|
|
4147
|
+
/* Shadow */
|
|
4148
|
+
,
|
|
4149
|
+
shadowSupportMode: "reset"
|
|
4150
|
+
/* Default */
|
|
4151
|
+
,
|
|
4152
|
+
wire: EmptyObject,
|
|
4153
|
+
bridge: BaseBridgeElement,
|
|
4154
|
+
template: defaultEmptyTemplate,
|
|
4155
|
+
render: LightningElement.prototype.render
|
|
4156
|
+
};
|
|
4157
|
+
/**
|
|
4158
|
+
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
|
4159
|
+
* subject to change or being removed.
|
|
4160
|
+
*/
|
|
4161
|
+
|
|
4162
|
+
function getComponentDef(Ctor) {
|
|
4163
|
+
const def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
|
|
4164
|
+
// for some external services, e.g.: Locker Service, usually, all they care
|
|
4165
|
+
// is about the shape of the constructor, the internals of it are not relevant
|
|
4166
|
+
// because they don't have a way to mess with that.
|
|
4167
|
+
|
|
4168
|
+
const {
|
|
4169
|
+
ctor,
|
|
4170
|
+
name,
|
|
4171
|
+
props,
|
|
4172
|
+
propsConfig,
|
|
4173
|
+
methods
|
|
4174
|
+
} = def;
|
|
4175
|
+
const publicProps = {};
|
|
4176
|
+
|
|
4177
|
+
for (const key in props) {
|
|
4178
|
+
// avoid leaking the reference to the public props descriptors
|
|
4179
|
+
publicProps[key] = {
|
|
4180
|
+
config: propsConfig[key] || 0,
|
|
4181
|
+
type: "any"
|
|
4182
|
+
/* any */
|
|
4183
|
+
,
|
|
4184
|
+
attr: htmlPropertyToAttribute(key)
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
|
|
4188
|
+
const publicMethods = {};
|
|
4189
|
+
|
|
4190
|
+
for (const key in methods) {
|
|
4191
|
+
// avoid leaking the reference to the public method descriptors
|
|
4192
|
+
publicMethods[key] = methods[key].value;
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
return {
|
|
4196
|
+
ctor,
|
|
4197
|
+
name,
|
|
4198
|
+
props: publicProps,
|
|
4199
|
+
methods: publicMethods
|
|
4200
|
+
};
|
|
4201
|
+
}
|
|
4202
|
+
/*
|
|
4203
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4204
|
+
* All rights reserved.
|
|
4205
|
+
* SPDX-License-Identifier: MIT
|
|
4206
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4207
|
+
*/
|
|
4208
|
+
|
|
4209
|
+
|
|
4210
|
+
const xlinkNS = 'http://www.w3.org/1999/xlink';
|
|
4211
|
+
const xmlNS = 'http://www.w3.org/XML/1998/namespace';
|
|
4212
|
+
const ColonCharCode = 58;
|
|
4213
|
+
|
|
4214
|
+
function patchAttributes(oldVnode, vnode) {
|
|
4215
|
+
const {
|
|
4216
|
+
attrs
|
|
4217
|
+
} = vnode.data;
|
|
4218
|
+
|
|
4219
|
+
if (isUndefined$1(attrs)) {
|
|
4220
|
+
return;
|
|
4221
|
+
}
|
|
4222
|
+
|
|
4223
|
+
const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
|
|
4224
|
+
|
|
4225
|
+
if (oldAttrs === attrs) {
|
|
4226
|
+
return;
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
const {
|
|
4230
|
+
elm
|
|
4231
|
+
} = vnode;
|
|
4232
|
+
|
|
4233
|
+
for (const key in attrs) {
|
|
4234
|
+
const cur = attrs[key];
|
|
4235
|
+
const old = oldAttrs[key];
|
|
4236
|
+
|
|
4237
|
+
if (old !== cur) {
|
|
4238
|
+
unlockAttribute(elm, key);
|
|
4239
|
+
|
|
4240
|
+
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
4241
|
+
// Assume xml namespace
|
|
4242
|
+
setAttribute$1(elm, key, cur, xmlNS);
|
|
4243
|
+
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
4244
|
+
// Assume xlink namespace
|
|
4245
|
+
setAttribute$1(elm, key, cur, xlinkNS);
|
|
4246
|
+
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
4247
|
+
removeAttribute$1(elm, key);
|
|
4248
|
+
} else {
|
|
4249
|
+
setAttribute$1(elm, key, cur);
|
|
4250
|
+
}
|
|
4251
|
+
|
|
4252
|
+
lockAttribute();
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
/*
|
|
4257
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4258
|
+
* All rights reserved.
|
|
4259
|
+
* SPDX-License-Identifier: MIT
|
|
4260
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4261
|
+
*/
|
|
4262
|
+
|
|
4263
|
+
|
|
4264
|
+
function isLiveBindingProp(sel, key) {
|
|
4265
|
+
// For properties with live bindings, we read values from the DOM element
|
|
4266
|
+
// instead of relying on internally tracked values.
|
|
4267
|
+
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
function patchProps(oldVnode, vnode) {
|
|
4271
|
+
const {
|
|
4272
|
+
props
|
|
4273
|
+
} = vnode.data;
|
|
4274
|
+
|
|
4275
|
+
if (isUndefined$1(props)) {
|
|
4276
|
+
return;
|
|
4277
|
+
}
|
|
4278
|
+
|
|
4279
|
+
const oldProps = isNull(oldVnode) ? EmptyObject : oldVnode.data.props;
|
|
4280
|
+
|
|
4281
|
+
if (oldProps === props) {
|
|
4282
|
+
return;
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
const isFirstPatch = isNull(oldVnode);
|
|
4286
|
+
const {
|
|
4287
|
+
elm,
|
|
4288
|
+
sel
|
|
4289
|
+
} = vnode;
|
|
4290
|
+
|
|
4291
|
+
for (const key in props) {
|
|
4292
|
+
const cur = props[key]; // Set the property if it's the first time is is patched or if the previous property is
|
|
4293
|
+
// different than the one previously set.
|
|
4294
|
+
|
|
4295
|
+
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {
|
|
4296
|
+
setProperty$1(elm, key, cur);
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
/*
|
|
4301
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4302
|
+
* All rights reserved.
|
|
4303
|
+
* SPDX-License-Identifier: MIT
|
|
4304
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4305
|
+
*/
|
|
4306
|
+
|
|
4307
|
+
|
|
4308
|
+
const classNameToClassMap = create(null);
|
|
4309
|
+
|
|
4310
|
+
function getMapFromClassName(className) {
|
|
4311
|
+
// Intentionally using == to match undefined and null values from computed style attribute
|
|
4312
|
+
if (className == null) {
|
|
4313
|
+
return EmptyObject;
|
|
4314
|
+
} // computed class names must be string
|
|
4315
|
+
|
|
4316
|
+
|
|
4317
|
+
className = isString(className) ? className : className + '';
|
|
4318
|
+
let map = classNameToClassMap[className];
|
|
4319
|
+
|
|
4320
|
+
if (map) {
|
|
4321
|
+
return map;
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
map = create(null);
|
|
4325
|
+
let start = 0;
|
|
4326
|
+
let o;
|
|
4327
|
+
const len = className.length;
|
|
4328
|
+
|
|
4329
|
+
for (o = 0; o < len; o++) {
|
|
4330
|
+
if (StringCharCodeAt.call(className, o) === SPACE_CHAR) {
|
|
4331
|
+
if (o > start) {
|
|
4332
|
+
map[StringSlice.call(className, start, o)] = true;
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
start = o + 1;
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4338
|
+
|
|
4339
|
+
if (o > start) {
|
|
4340
|
+
map[StringSlice.call(className, start, o)] = true;
|
|
4341
|
+
}
|
|
4342
|
+
|
|
4343
|
+
classNameToClassMap[className] = map;
|
|
4344
|
+
|
|
4345
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4346
|
+
// just to make sure that this object never changes as part of the diffing algo
|
|
4347
|
+
freeze(map);
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4350
|
+
return map;
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4353
|
+
function patchClassAttribute(oldVnode, vnode) {
|
|
4354
|
+
const {
|
|
4355
|
+
elm,
|
|
4356
|
+
data: {
|
|
4357
|
+
className: newClass
|
|
4358
|
+
}
|
|
4359
|
+
} = vnode;
|
|
4360
|
+
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
4272
4361
|
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
// of the proto chain, which must always be a valid base constructor.
|
|
4362
|
+
if (oldClass === newClass) {
|
|
4363
|
+
return;
|
|
4364
|
+
}
|
|
4277
4365
|
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4366
|
+
const classList = getClassList$1(elm);
|
|
4367
|
+
const newClassMap = getMapFromClassName(newClass);
|
|
4368
|
+
const oldClassMap = getMapFromClassName(oldClass);
|
|
4369
|
+
let name;
|
|
4281
4370
|
|
|
4282
|
-
|
|
4371
|
+
for (name in oldClassMap) {
|
|
4372
|
+
// remove only if it is not in the new class collection and it is not set from within the instance
|
|
4373
|
+
if (isUndefined$1(newClassMap[name])) {
|
|
4374
|
+
classList.remove(name);
|
|
4283
4375
|
}
|
|
4376
|
+
}
|
|
4284
4377
|
|
|
4285
|
-
|
|
4286
|
-
|
|
4378
|
+
for (name in newClassMap) {
|
|
4379
|
+
if (isUndefined$1(oldClassMap[name])) {
|
|
4380
|
+
classList.add(name);
|
|
4287
4381
|
}
|
|
4288
|
-
}
|
|
4382
|
+
}
|
|
4383
|
+
}
|
|
4384
|
+
/*
|
|
4385
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4386
|
+
* All rights reserved.
|
|
4387
|
+
* SPDX-License-Identifier: MIT
|
|
4388
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4389
|
+
*/
|
|
4289
4390
|
|
|
4290
4391
|
|
|
4291
|
-
|
|
4292
|
-
|
|
4392
|
+
function patchStyleAttribute(oldVnode, vnode) {
|
|
4393
|
+
const {
|
|
4394
|
+
elm,
|
|
4395
|
+
data: {
|
|
4396
|
+
style: newStyle
|
|
4397
|
+
}
|
|
4398
|
+
} = vnode;
|
|
4399
|
+
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
4293
4400
|
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
Ctor = getComponentOrSwappedComponent(Ctor);
|
|
4401
|
+
if (oldStyle === newStyle) {
|
|
4402
|
+
return;
|
|
4297
4403
|
}
|
|
4298
4404
|
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4405
|
+
if (!isString(newStyle) || newStyle === '') {
|
|
4406
|
+
removeAttribute$1(elm, 'style');
|
|
4407
|
+
} else {
|
|
4408
|
+
setAttribute$1(elm, 'style', newStyle);
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
/*
|
|
4412
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4413
|
+
* All rights reserved.
|
|
4414
|
+
* SPDX-License-Identifier: MIT
|
|
4415
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4416
|
+
*/
|
|
4306
4417
|
|
|
4307
|
-
CtorToDefMap.set(Ctor, def);
|
|
4308
|
-
return def;
|
|
4309
|
-
}
|
|
4310
4418
|
|
|
4311
|
-
|
|
4312
|
-
|
|
4419
|
+
function applyEventListeners(vnode) {
|
|
4420
|
+
const {
|
|
4421
|
+
elm,
|
|
4422
|
+
data: {
|
|
4423
|
+
on
|
|
4313
4424
|
}
|
|
4425
|
+
} = vnode;
|
|
4314
4426
|
|
|
4315
|
-
|
|
4316
|
-
|
|
4427
|
+
if (isUndefined$1(on)) {
|
|
4428
|
+
return;
|
|
4317
4429
|
}
|
|
4318
4430
|
|
|
4319
|
-
|
|
4431
|
+
for (const name in on) {
|
|
4432
|
+
const handler = on[name];
|
|
4433
|
+
addEventListener$1(elm, name, handler);
|
|
4434
|
+
}
|
|
4320
4435
|
}
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
propsConfig: EmptyObject,
|
|
4327
|
-
methods: EmptyObject,
|
|
4328
|
-
renderMode: 1
|
|
4329
|
-
/* Shadow */
|
|
4330
|
-
,
|
|
4331
|
-
shadowSupportMode: "reset"
|
|
4332
|
-
/* Default */
|
|
4333
|
-
,
|
|
4334
|
-
wire: EmptyObject,
|
|
4335
|
-
bridge: BaseBridgeElement,
|
|
4336
|
-
template: defaultEmptyTemplate,
|
|
4337
|
-
render: LightningElement.prototype.render
|
|
4338
|
-
};
|
|
4339
|
-
/**
|
|
4340
|
-
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
|
4341
|
-
* subject to change or being removed.
|
|
4436
|
+
/*
|
|
4437
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4438
|
+
* All rights reserved.
|
|
4439
|
+
* SPDX-License-Identifier: MIT
|
|
4440
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4342
4441
|
*/
|
|
4442
|
+
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
4443
|
+
// different classnames properties individually instead of via a string.
|
|
4343
4444
|
|
|
4344
|
-
function getComponentDef(Ctor) {
|
|
4345
|
-
const def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
|
|
4346
|
-
// for some external services, e.g.: Locker Service, usually, all they care
|
|
4347
|
-
// is about the shape of the constructor, the internals of it are not relevant
|
|
4348
|
-
// because they don't have a way to mess with that.
|
|
4349
4445
|
|
|
4446
|
+
function applyStaticClassAttribute(vnode) {
|
|
4350
4447
|
const {
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
} = def;
|
|
4357
|
-
const publicProps = {};
|
|
4448
|
+
elm,
|
|
4449
|
+
data: {
|
|
4450
|
+
classMap
|
|
4451
|
+
}
|
|
4452
|
+
} = vnode;
|
|
4358
4453
|
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
publicProps[key] = {
|
|
4362
|
-
config: propsConfig[key] || 0,
|
|
4363
|
-
type: "any"
|
|
4364
|
-
/* any */
|
|
4365
|
-
,
|
|
4366
|
-
attr: htmlPropertyToAttribute(key)
|
|
4367
|
-
};
|
|
4454
|
+
if (isUndefined$1(classMap)) {
|
|
4455
|
+
return;
|
|
4368
4456
|
}
|
|
4369
4457
|
|
|
4370
|
-
const
|
|
4458
|
+
const classList = getClassList$1(elm);
|
|
4371
4459
|
|
|
4372
|
-
for (const
|
|
4373
|
-
|
|
4374
|
-
|
|
4460
|
+
for (const name in classMap) {
|
|
4461
|
+
classList.add(name);
|
|
4462
|
+
}
|
|
4463
|
+
}
|
|
4464
|
+
/*
|
|
4465
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4466
|
+
* All rights reserved.
|
|
4467
|
+
* SPDX-License-Identifier: MIT
|
|
4468
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4469
|
+
*/
|
|
4470
|
+
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
4471
|
+
// different style properties individually instead of via a string.
|
|
4472
|
+
|
|
4473
|
+
|
|
4474
|
+
function applyStaticStyleAttribute(vnode) {
|
|
4475
|
+
const {
|
|
4476
|
+
elm,
|
|
4477
|
+
data: {
|
|
4478
|
+
styleDecls
|
|
4479
|
+
}
|
|
4480
|
+
} = vnode;
|
|
4481
|
+
|
|
4482
|
+
if (isUndefined$1(styleDecls)) {
|
|
4483
|
+
return;
|
|
4375
4484
|
}
|
|
4376
4485
|
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
methods: publicMethods
|
|
4382
|
-
};
|
|
4486
|
+
for (let i = 0; i < styleDecls.length; i++) {
|
|
4487
|
+
const [prop, value, important] = styleDecls[i];
|
|
4488
|
+
setCSSStyleProperty$1(elm, prop, value, important);
|
|
4489
|
+
}
|
|
4383
4490
|
}
|
|
4384
4491
|
/*
|
|
4385
4492
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4406,17 +4513,14 @@ function setScopeTokenClassIfNecessary(elm, owner) {
|
|
|
4406
4513
|
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4407
4514
|
|
|
4408
4515
|
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4409
|
-
|
|
4516
|
+
getClassList$1(elm).add(token);
|
|
4410
4517
|
}
|
|
4411
4518
|
}
|
|
4412
4519
|
|
|
4413
4520
|
function updateNodeHook(oldVnode, vnode) {
|
|
4414
4521
|
const {
|
|
4415
4522
|
elm,
|
|
4416
|
-
text
|
|
4417
|
-
owner: {
|
|
4418
|
-
renderer
|
|
4419
|
-
}
|
|
4523
|
+
text
|
|
4420
4524
|
} = vnode;
|
|
4421
4525
|
|
|
4422
4526
|
if (oldVnode.text !== text) {
|
|
@@ -4424,7 +4528,7 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4424
4528
|
unlockDomMutation();
|
|
4425
4529
|
}
|
|
4426
4530
|
|
|
4427
|
-
|
|
4531
|
+
setText$1(elm, text);
|
|
4428
4532
|
|
|
4429
4533
|
if (process.env.NODE_ENV !== 'production') {
|
|
4430
4534
|
lockDomMutation();
|
|
@@ -4433,15 +4537,11 @@ function updateNodeHook(oldVnode, vnode) {
|
|
|
4433
4537
|
}
|
|
4434
4538
|
|
|
4435
4539
|
function insertNodeHook(vnode, parentNode, referenceNode) {
|
|
4436
|
-
const {
|
|
4437
|
-
renderer
|
|
4438
|
-
} = vnode.owner;
|
|
4439
|
-
|
|
4440
4540
|
if (process.env.NODE_ENV !== 'production') {
|
|
4441
4541
|
unlockDomMutation();
|
|
4442
4542
|
}
|
|
4443
4543
|
|
|
4444
|
-
|
|
4544
|
+
insert$1(vnode.elm, parentNode, referenceNode);
|
|
4445
4545
|
|
|
4446
4546
|
if (process.env.NODE_ENV !== 'production') {
|
|
4447
4547
|
lockDomMutation();
|
|
@@ -4449,43 +4549,35 @@ function insertNodeHook(vnode, parentNode, referenceNode) {
|
|
|
4449
4549
|
}
|
|
4450
4550
|
|
|
4451
4551
|
function removeNodeHook(vnode, parentNode) {
|
|
4452
|
-
const {
|
|
4453
|
-
renderer
|
|
4454
|
-
} = vnode.owner;
|
|
4455
|
-
|
|
4456
4552
|
if (process.env.NODE_ENV !== 'production') {
|
|
4457
4553
|
unlockDomMutation();
|
|
4458
4554
|
}
|
|
4459
4555
|
|
|
4460
|
-
|
|
4556
|
+
remove$1(vnode.elm, parentNode);
|
|
4461
4557
|
|
|
4462
4558
|
if (process.env.NODE_ENV !== 'production') {
|
|
4463
4559
|
lockDomMutation();
|
|
4464
4560
|
}
|
|
4465
4561
|
}
|
|
4466
4562
|
|
|
4467
|
-
function
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4563
|
+
function patchElementPropsAndAttrs(oldVnode, vnode) {
|
|
4564
|
+
if (isNull(oldVnode)) {
|
|
4565
|
+
applyEventListeners(vnode);
|
|
4566
|
+
applyStaticClassAttribute(vnode);
|
|
4567
|
+
applyStaticStyleAttribute(vnode);
|
|
4568
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4569
|
+
// value is set before type=radio.
|
|
4570
|
+
|
|
4471
4571
|
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
modComputedClassName.create(vnode);
|
|
4477
|
-
modComputedStyle.create(vnode);
|
|
4572
|
+
patchClassAttribute(oldVnode, vnode);
|
|
4573
|
+
patchStyleAttribute(oldVnode, vnode);
|
|
4574
|
+
patchAttributes(oldVnode, vnode);
|
|
4575
|
+
patchProps(oldVnode, vnode);
|
|
4478
4576
|
}
|
|
4479
4577
|
|
|
4480
4578
|
function hydrateElmHook(vnode) {
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
modProps.create(vnode); // Already set.
|
|
4485
|
-
// modStaticClassName.create(vnode);
|
|
4486
|
-
// modStaticStyle.create(vnode);
|
|
4487
|
-
// modComputedClassName.create(vnode);
|
|
4488
|
-
// modComputedStyle.create(vnode);
|
|
4579
|
+
applyEventListeners(vnode);
|
|
4580
|
+
patchProps(null, vnode);
|
|
4489
4581
|
}
|
|
4490
4582
|
|
|
4491
4583
|
function fallbackElmHook(elm, vnode) {
|
|
@@ -4537,26 +4629,11 @@ function fallbackElmHook(elm, vnode) {
|
|
|
4537
4629
|
}
|
|
4538
4630
|
}
|
|
4539
4631
|
|
|
4540
|
-
function
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
// is set before type=radio.
|
|
4544
|
-
modAttrs.update(oldVnode, vnode);
|
|
4545
|
-
modProps.update(oldVnode, vnode);
|
|
4546
|
-
modComputedClassName.update(oldVnode, vnode);
|
|
4547
|
-
modComputedStyle.update(oldVnode, vnode);
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
function updateChildrenHook(oldVnode, vnode) {
|
|
4551
|
-
const {
|
|
4552
|
-
elm,
|
|
4553
|
-
children
|
|
4554
|
-
} = vnode;
|
|
4555
|
-
|
|
4556
|
-
if (hasDynamicChildren(children)) {
|
|
4557
|
-
updateDynamicChildren(elm, oldVnode.children, children);
|
|
4632
|
+
function patchChildren(parent, oldCh, newCh) {
|
|
4633
|
+
if (hasDynamicChildren(newCh)) {
|
|
4634
|
+
updateDynamicChildren(parent, oldCh, newCh);
|
|
4558
4635
|
} else {
|
|
4559
|
-
updateStaticChildren(
|
|
4636
|
+
updateStaticChildren(parent, oldCh, newCh);
|
|
4560
4637
|
}
|
|
4561
4638
|
}
|
|
4562
4639
|
|
|
@@ -4623,8 +4700,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
4623
4700
|
createVM(elm, def, {
|
|
4624
4701
|
mode,
|
|
4625
4702
|
owner,
|
|
4626
|
-
tagName: sel
|
|
4627
|
-
renderer: owner.renderer
|
|
4703
|
+
tagName: sel
|
|
4628
4704
|
});
|
|
4629
4705
|
|
|
4630
4706
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4632,19 +4708,6 @@ function createViewModelHook(elm, vnode) {
|
|
|
4632
4708
|
}
|
|
4633
4709
|
}
|
|
4634
4710
|
|
|
4635
|
-
function createCustomElmHook(vnode) {
|
|
4636
|
-
modEvents.create(vnode); // Attrs need to be applied to element before props
|
|
4637
|
-
// IE11 will wipe out value on radio inputs if value
|
|
4638
|
-
// is set before type=radio.
|
|
4639
|
-
|
|
4640
|
-
modAttrs.create(vnode);
|
|
4641
|
-
modProps.create(vnode);
|
|
4642
|
-
modStaticClassName.create(vnode);
|
|
4643
|
-
modStaticStyle.create(vnode);
|
|
4644
|
-
modComputedClassName.create(vnode);
|
|
4645
|
-
modComputedStyle.create(vnode);
|
|
4646
|
-
}
|
|
4647
|
-
|
|
4648
4711
|
function createChildrenHook(vnode) {
|
|
4649
4712
|
const {
|
|
4650
4713
|
elm,
|
|
@@ -4670,16 +4733,13 @@ function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
|
4670
4733
|
const {
|
|
4671
4734
|
data: {
|
|
4672
4735
|
attrs = {}
|
|
4673
|
-
},
|
|
4674
|
-
owner: {
|
|
4675
|
-
renderer
|
|
4676
4736
|
}
|
|
4677
4737
|
} = vnode;
|
|
4678
4738
|
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4679
4739
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4680
4740
|
|
|
4681
4741
|
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4682
|
-
const elmAttrValue =
|
|
4742
|
+
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
4683
4743
|
|
|
4684
4744
|
if (String(attrValue) !== elmAttrValue) {
|
|
4685
4745
|
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
@@ -4695,9 +4755,6 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4695
4755
|
data: {
|
|
4696
4756
|
className,
|
|
4697
4757
|
classMap
|
|
4698
|
-
},
|
|
4699
|
-
owner: {
|
|
4700
|
-
renderer
|
|
4701
4758
|
}
|
|
4702
4759
|
} = vnode;
|
|
4703
4760
|
let nodesAreCompatible = true;
|
|
@@ -4709,7 +4766,7 @@ function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
|
4709
4766
|
vnodeClassName = className;
|
|
4710
4767
|
} else if (!isUndefined$1(classMap)) {
|
|
4711
4768
|
// classMap is used when class is set to static value.
|
|
4712
|
-
const classList =
|
|
4769
|
+
const classList = getClassList$1(elm);
|
|
4713
4770
|
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4714
4771
|
|
|
4715
4772
|
for (const name in classMap) {
|
|
@@ -4739,12 +4796,9 @@ function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
|
4739
4796
|
data: {
|
|
4740
4797
|
style,
|
|
4741
4798
|
styleDecls
|
|
4742
|
-
},
|
|
4743
|
-
owner: {
|
|
4744
|
-
renderer
|
|
4745
4799
|
}
|
|
4746
4800
|
} = vnode;
|
|
4747
|
-
const elmStyle =
|
|
4801
|
+
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
4748
4802
|
let vnodeStyle;
|
|
4749
4803
|
let nodesAreCompatible = true;
|
|
4750
4804
|
|
|
@@ -4817,47 +4871,97 @@ function hydrateChildrenHook(elmChildren, children, vm) {
|
|
|
4817
4871
|
} // Note: props are not yet set
|
|
4818
4872
|
|
|
4819
4873
|
|
|
4820
|
-
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4821
|
-
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4822
|
-
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4823
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4874
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4875
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4876
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4877
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4878
|
+
|
|
4879
|
+
if (!isVNodeAndElementCompatible) {
|
|
4880
|
+
throwHydrationError();
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
}
|
|
4884
|
+
|
|
4885
|
+
ch.hook.hydrate(ch, childNode);
|
|
4886
|
+
elmCurrentChildIdx++;
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
function removeElmHook(vnode) {
|
|
4892
|
+
// this method only needs to search on child vnodes from template
|
|
4893
|
+
// to trigger the remove hook just in case some of those children
|
|
4894
|
+
// are custom elements.
|
|
4895
|
+
const {
|
|
4896
|
+
children,
|
|
4897
|
+
elm
|
|
4898
|
+
} = vnode;
|
|
4899
|
+
|
|
4900
|
+
for (let j = 0, len = children.length; j < len; ++j) {
|
|
4901
|
+
const ch = children[j];
|
|
4902
|
+
|
|
4903
|
+
if (!isNull(ch)) {
|
|
4904
|
+
ch.hook.remove(ch, elm);
|
|
4905
|
+
}
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
function allocateInSlot(vm, children) {
|
|
4910
|
+
const {
|
|
4911
|
+
cmpSlots: oldSlots
|
|
4912
|
+
} = vm;
|
|
4913
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
4914
|
+
|
|
4915
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4916
|
+
const vnode = children[i];
|
|
4917
|
+
|
|
4918
|
+
if (isNull(vnode)) {
|
|
4919
|
+
continue;
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
const {
|
|
4923
|
+
data
|
|
4924
|
+
} = vnode;
|
|
4925
|
+
const slotName = data.attrs && data.attrs.slot || '';
|
|
4926
|
+
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
4927
|
+
// which might have similar keys. Each vnode will always have a key that
|
|
4928
|
+
// starts with a numeric character from compiler. In this case, we add a unique
|
|
4929
|
+
// notation for slotted vnodes keys, e.g.: `@foo:1:1`
|
|
4930
|
+
|
|
4931
|
+
if (!isUndefined$1(vnode.key)) {
|
|
4932
|
+
vnode.key = `@${slotName}:${vnode.key}`;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
4936
|
+
}
|
|
4824
4937
|
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
}
|
|
4938
|
+
if (isFalse(vm.isDirty)) {
|
|
4939
|
+
// We need to determine if the old allocation is really different from the new one
|
|
4940
|
+
// and mark the vm as dirty
|
|
4941
|
+
const oldKeys = keys(oldSlots);
|
|
4830
4942
|
|
|
4831
|
-
|
|
4832
|
-
|
|
4943
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
4944
|
+
markComponentAsDirty(vm);
|
|
4945
|
+
return;
|
|
4833
4946
|
}
|
|
4834
|
-
}
|
|
4835
|
-
}
|
|
4836
4947
|
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
// IE11 will wipe out value on radio inputs if value
|
|
4840
|
-
// is set before type=radio.
|
|
4841
|
-
modAttrs.update(oldVnode, vnode);
|
|
4842
|
-
modProps.update(oldVnode, vnode);
|
|
4843
|
-
modComputedClassName.update(oldVnode, vnode);
|
|
4844
|
-
modComputedStyle.update(oldVnode, vnode);
|
|
4845
|
-
}
|
|
4948
|
+
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4949
|
+
const key = oldKeys[i];
|
|
4846
4950
|
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
const {
|
|
4852
|
-
children,
|
|
4853
|
-
elm
|
|
4854
|
-
} = vnode;
|
|
4951
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
4952
|
+
markComponentAsDirty(vm);
|
|
4953
|
+
return;
|
|
4954
|
+
}
|
|
4855
4955
|
|
|
4856
|
-
|
|
4857
|
-
|
|
4956
|
+
const oldVNodes = oldSlots[key];
|
|
4957
|
+
const vnodes = cmpSlots[key];
|
|
4858
4958
|
|
|
4859
|
-
|
|
4860
|
-
|
|
4959
|
+
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
4960
|
+
if (oldVNodes[j] !== vnodes[j]) {
|
|
4961
|
+
markComponentAsDirty(vm);
|
|
4962
|
+
return;
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4861
4965
|
}
|
|
4862
4966
|
}
|
|
4863
4967
|
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
@@ -4881,12 +4985,12 @@ function hasDynamicChildren(children) {
|
|
|
4881
4985
|
*/
|
|
4882
4986
|
|
|
4883
4987
|
|
|
4884
|
-
function getUpgradableConstructor(tagName
|
|
4988
|
+
function getUpgradableConstructor(tagName) {
|
|
4885
4989
|
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4886
4990
|
// produce only tags with lowercase letters
|
|
4887
4991
|
// But, for backwards compatibility, we will lower case the tagName
|
|
4888
4992
|
tagName = tagName.toLowerCase();
|
|
4889
|
-
let CE =
|
|
4993
|
+
let CE = getCustomElement$1(tagName);
|
|
4890
4994
|
|
|
4891
4995
|
if (!isUndefined$1(CE)) {
|
|
4892
4996
|
return CE;
|
|
@@ -4897,7 +5001,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4897
5001
|
*/
|
|
4898
5002
|
|
|
4899
5003
|
|
|
4900
|
-
CE = class LWCUpgradableElement extends
|
|
5004
|
+
CE = class LWCUpgradableElement extends HTMLElementExported$1 {
|
|
4901
5005
|
constructor(upgradeCallback) {
|
|
4902
5006
|
super();
|
|
4903
5007
|
|
|
@@ -4907,7 +5011,7 @@ function getUpgradableConstructor(tagName, renderer) {
|
|
|
4907
5011
|
}
|
|
4908
5012
|
|
|
4909
5013
|
};
|
|
4910
|
-
|
|
5014
|
+
defineCustomElement$1(tagName, CE);
|
|
4911
5015
|
return CE;
|
|
4912
5016
|
}
|
|
4913
5017
|
/*
|
|
@@ -4925,10 +5029,7 @@ const TextHook = {
|
|
|
4925
5029
|
const {
|
|
4926
5030
|
owner
|
|
4927
5031
|
} = vnode;
|
|
4928
|
-
const
|
|
4929
|
-
renderer
|
|
4930
|
-
} = owner;
|
|
4931
|
-
const elm = renderer.createText(vnode.text);
|
|
5032
|
+
const elm = createText$1(vnode.text);
|
|
4932
5033
|
linkNodeToShadow(elm, owner);
|
|
4933
5034
|
vnode.elm = elm;
|
|
4934
5035
|
},
|
|
@@ -4962,10 +5063,7 @@ const CommentHook = {
|
|
|
4962
5063
|
owner,
|
|
4963
5064
|
text
|
|
4964
5065
|
} = vnode;
|
|
4965
|
-
const
|
|
4966
|
-
renderer
|
|
4967
|
-
} = owner;
|
|
4968
|
-
const elm = renderer.createComment(text);
|
|
5066
|
+
const elm = createComment$1(text);
|
|
4969
5067
|
linkNodeToShadow(elm, owner);
|
|
4970
5068
|
vnode.elm = elm;
|
|
4971
5069
|
},
|
|
@@ -5007,19 +5105,16 @@ const ElementHook = {
|
|
|
5007
5105
|
svg
|
|
5008
5106
|
}
|
|
5009
5107
|
} = vnode;
|
|
5010
|
-
const {
|
|
5011
|
-
renderer
|
|
5012
|
-
} = owner;
|
|
5013
5108
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
5014
|
-
const elm =
|
|
5109
|
+
const elm = createElement$1(sel, namespace);
|
|
5015
5110
|
linkNodeToShadow(elm, owner);
|
|
5016
5111
|
fallbackElmHook(elm, vnode);
|
|
5017
5112
|
vnode.elm = elm;
|
|
5018
|
-
|
|
5113
|
+
patchElementPropsAndAttrs(null, vnode);
|
|
5019
5114
|
},
|
|
5020
5115
|
update: (oldVnode, vnode) => {
|
|
5021
|
-
|
|
5022
|
-
|
|
5116
|
+
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5117
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5023
5118
|
},
|
|
5024
5119
|
insert: (vnode, parentNode, referenceNode) => {
|
|
5025
5120
|
insertNodeHook(vnode, parentNode, referenceNode);
|
|
@@ -5071,10 +5166,7 @@ const CustomElementHook = {
|
|
|
5071
5166
|
sel,
|
|
5072
5167
|
owner
|
|
5073
5168
|
} = vnode;
|
|
5074
|
-
const
|
|
5075
|
-
renderer
|
|
5076
|
-
} = owner;
|
|
5077
|
-
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
5169
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
5078
5170
|
/**
|
|
5079
5171
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
5080
5172
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -5096,10 +5188,10 @@ const CustomElementHook = {
|
|
|
5096
5188
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
5097
5189
|
}
|
|
5098
5190
|
|
|
5099
|
-
|
|
5191
|
+
patchElementPropsAndAttrs(null, vnode);
|
|
5100
5192
|
},
|
|
5101
5193
|
update: (oldVnode, vnode) => {
|
|
5102
|
-
|
|
5194
|
+
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5103
5195
|
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
5104
5196
|
|
|
5105
5197
|
if (vm) {
|
|
@@ -5110,7 +5202,7 @@ const CustomElementHook = {
|
|
|
5110
5202
|
// will happen, but in native, it does allocate the light dom
|
|
5111
5203
|
|
|
5112
5204
|
|
|
5113
|
-
|
|
5205
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5114
5206
|
|
|
5115
5207
|
if (vm) {
|
|
5116
5208
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5167,8 +5259,7 @@ const CustomElementHook = {
|
|
|
5167
5259
|
createVM(elm, def, {
|
|
5168
5260
|
mode,
|
|
5169
5261
|
owner,
|
|
5170
|
-
tagName: sel
|
|
5171
|
-
renderer: owner.renderer
|
|
5262
|
+
tagName: sel
|
|
5172
5263
|
});
|
|
5173
5264
|
vnode.elm = elm;
|
|
5174
5265
|
const vm = getAssociatedVM(elm);
|
|
@@ -5197,12 +5288,11 @@ const CustomElementHook = {
|
|
|
5197
5288
|
|
|
5198
5289
|
function linkNodeToShadow(elm, owner) {
|
|
5199
5290
|
const {
|
|
5200
|
-
renderer,
|
|
5201
5291
|
renderMode,
|
|
5202
5292
|
shadowMode
|
|
5203
5293
|
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
5204
5294
|
|
|
5205
|
-
if (
|
|
5295
|
+
if (isSyntheticShadowDefined$1) {
|
|
5206
5296
|
if (shadowMode === 1
|
|
5207
5297
|
/* Synthetic */
|
|
5208
5298
|
|| renderMode === 0
|
|
@@ -5734,7 +5824,6 @@ function updateStylesheetToken(vm, template) {
|
|
|
5734
5824
|
const {
|
|
5735
5825
|
elm,
|
|
5736
5826
|
context,
|
|
5737
|
-
renderer,
|
|
5738
5827
|
renderMode,
|
|
5739
5828
|
shadowMode
|
|
5740
5829
|
} = vm;
|
|
@@ -5761,11 +5850,11 @@ function updateStylesheetToken(vm, template) {
|
|
|
5761
5850
|
} = context;
|
|
5762
5851
|
|
|
5763
5852
|
if (oldHasTokenInClass) {
|
|
5764
|
-
|
|
5853
|
+
getClassList$1(elm).remove(makeHostToken(oldToken));
|
|
5765
5854
|
}
|
|
5766
5855
|
|
|
5767
5856
|
if (oldHasTokenInAttribute) {
|
|
5768
|
-
|
|
5857
|
+
removeAttribute$1(elm, makeHostToken(oldToken));
|
|
5769
5858
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5770
5859
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5771
5860
|
|
|
@@ -5777,12 +5866,12 @@ function updateStylesheetToken(vm, template) {
|
|
|
5777
5866
|
|
|
5778
5867
|
if (!isUndefined$1(newToken)) {
|
|
5779
5868
|
if (hasScopedStyles) {
|
|
5780
|
-
|
|
5869
|
+
getClassList$1(elm).add(makeHostToken(newToken));
|
|
5781
5870
|
newHasTokenInClass = true;
|
|
5782
5871
|
}
|
|
5783
5872
|
|
|
5784
5873
|
if (isSyntheticShadow) {
|
|
5785
|
-
|
|
5874
|
+
setAttribute$1(elm, makeHostToken(newToken), '');
|
|
5786
5875
|
newHasTokenInAttribute = true;
|
|
5787
5876
|
}
|
|
5788
5877
|
} // Update the styling tokens present on the context object.
|
|
@@ -5903,7 +5992,6 @@ function getNearestNativeShadowComponent(vm) {
|
|
|
5903
5992
|
|
|
5904
5993
|
function createStylesheet(vm, stylesheets) {
|
|
5905
5994
|
const {
|
|
5906
|
-
renderer,
|
|
5907
5995
|
renderMode,
|
|
5908
5996
|
shadowMode
|
|
5909
5997
|
} = vm;
|
|
@@ -5914,9 +6002,9 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5914
6002
|
/* Synthetic */
|
|
5915
6003
|
) {
|
|
5916
6004
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5917
|
-
|
|
6005
|
+
insertGlobalStylesheet$1(stylesheets[i]);
|
|
5918
6006
|
}
|
|
5919
|
-
} else if (
|
|
6007
|
+
} else if (ssr$1 || isHydrating$1()) {
|
|
5920
6008
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
5921
6009
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
5922
6010
|
// the first time the VM renders.
|
|
@@ -5930,10 +6018,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
5930
6018
|
|
|
5931
6019
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5932
6020
|
if (isGlobal) {
|
|
5933
|
-
|
|
6021
|
+
insertGlobalStylesheet$1(stylesheets[i]);
|
|
5934
6022
|
} else {
|
|
5935
6023
|
// local level
|
|
5936
|
-
|
|
6024
|
+
insertStylesheet$1(stylesheets[i], root.cmpRoot);
|
|
5937
6025
|
}
|
|
5938
6026
|
}
|
|
5939
6027
|
}
|
|
@@ -6567,7 +6655,6 @@ function createVM(elm, def, options) {
|
|
|
6567
6655
|
const {
|
|
6568
6656
|
mode,
|
|
6569
6657
|
owner,
|
|
6570
|
-
renderer,
|
|
6571
6658
|
tagName
|
|
6572
6659
|
} = options;
|
|
6573
6660
|
const vm = {
|
|
@@ -6582,7 +6669,6 @@ function createVM(elm, def, options) {
|
|
|
6582
6669
|
tagName,
|
|
6583
6670
|
mode,
|
|
6584
6671
|
owner,
|
|
6585
|
-
renderer,
|
|
6586
6672
|
children: EmptyArray,
|
|
6587
6673
|
aChildren: EmptyArray,
|
|
6588
6674
|
velements: EmptyArray,
|
|
@@ -6637,16 +6723,11 @@ function createVM(elm, def, options) {
|
|
|
6637
6723
|
|
|
6638
6724
|
function computeShadowMode(vm) {
|
|
6639
6725
|
const {
|
|
6640
|
-
def
|
|
6641
|
-
renderer
|
|
6726
|
+
def
|
|
6642
6727
|
} = vm;
|
|
6643
|
-
const {
|
|
6644
|
-
isNativeShadowDefined,
|
|
6645
|
-
isSyntheticShadowDefined
|
|
6646
|
-
} = renderer;
|
|
6647
6728
|
let shadowMode;
|
|
6648
6729
|
|
|
6649
|
-
if (isSyntheticShadowDefined) {
|
|
6730
|
+
if (isSyntheticShadowDefined$1) {
|
|
6650
6731
|
if (def.renderMode === 0
|
|
6651
6732
|
/* Light */
|
|
6652
6733
|
) {
|
|
@@ -6655,7 +6736,7 @@ function computeShadowMode(vm) {
|
|
|
6655
6736
|
shadowMode = 0
|
|
6656
6737
|
/* Native */
|
|
6657
6738
|
;
|
|
6658
|
-
} else if (isNativeShadowDefined) {
|
|
6739
|
+
} else if (isNativeShadowDefined$1) {
|
|
6659
6740
|
if (def.shadowSupportMode === "any"
|
|
6660
6741
|
/* Any */
|
|
6661
6742
|
) {
|
|
@@ -6763,7 +6844,6 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6763
6844
|
// patch function mutates vnodes by adding the element reference,
|
|
6764
6845
|
// however, if patching fails it contains partial changes.
|
|
6765
6846
|
if (oldCh !== newCh) {
|
|
6766
|
-
const fn = hasDynamicChildren(newCh) ? updateDynamicChildren : updateStaticChildren;
|
|
6767
6847
|
runWithBoundaryProtection(vm, vm, () => {
|
|
6768
6848
|
// pre
|
|
6769
6849
|
logOperationStart(2
|
|
@@ -6771,8 +6851,8 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6771
6851
|
, vm);
|
|
6772
6852
|
}, () => {
|
|
6773
6853
|
// job
|
|
6774
|
-
const
|
|
6775
|
-
|
|
6854
|
+
const renderRoot = getRenderRoot(vm);
|
|
6855
|
+
patchChildren(renderRoot, oldCh, newCh);
|
|
6776
6856
|
}, () => {
|
|
6777
6857
|
// post
|
|
6778
6858
|
logOperationEnd(2
|
|
@@ -6795,13 +6875,12 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6795
6875
|
|
|
6796
6876
|
function runRenderedCallback(vm) {
|
|
6797
6877
|
const {
|
|
6798
|
-
renderer,
|
|
6799
6878
|
def: {
|
|
6800
6879
|
renderedCallback
|
|
6801
6880
|
}
|
|
6802
6881
|
} = vm;
|
|
6803
6882
|
|
|
6804
|
-
if (isTrue(
|
|
6883
|
+
if (isTrue(ssr$1)) {
|
|
6805
6884
|
return;
|
|
6806
6885
|
}
|
|
6807
6886
|
|
|
@@ -7027,8 +7106,7 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
7027
7106
|
|
|
7028
7107
|
function resetComponentRoot(vm) {
|
|
7029
7108
|
const {
|
|
7030
|
-
children
|
|
7031
|
-
renderer
|
|
7109
|
+
children
|
|
7032
7110
|
} = vm;
|
|
7033
7111
|
const rootNode = getRenderRoot(vm);
|
|
7034
7112
|
|
|
@@ -7036,7 +7114,7 @@ function resetComponentRoot(vm) {
|
|
|
7036
7114
|
const child = children[i];
|
|
7037
7115
|
|
|
7038
7116
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
7039
|
-
|
|
7117
|
+
remove$1(child.elm, rootNode);
|
|
7040
7118
|
}
|
|
7041
7119
|
}
|
|
7042
7120
|
|
|
@@ -7046,7 +7124,7 @@ function resetComponentRoot(vm) {
|
|
|
7046
7124
|
}
|
|
7047
7125
|
|
|
7048
7126
|
function scheduleRehydration(vm) {
|
|
7049
|
-
if (isTrue(
|
|
7127
|
+
if (isTrue(ssr$1) || isTrue(vm.isScheduled)) {
|
|
7050
7128
|
return;
|
|
7051
7129
|
}
|
|
7052
7130
|
|
|
@@ -7069,69 +7147,6 @@ function getErrorBoundaryVM(vm) {
|
|
|
7069
7147
|
|
|
7070
7148
|
currentVm = currentVm.owner;
|
|
7071
7149
|
}
|
|
7072
|
-
} // slow path routine
|
|
7073
|
-
// NOTE: we should probably more this routine to the synthetic shadow folder
|
|
7074
|
-
// and get the allocation to be cached by in the elm instead of in the VM
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
function allocateInSlot(vm, children) {
|
|
7078
|
-
const {
|
|
7079
|
-
cmpSlots: oldSlots
|
|
7080
|
-
} = vm;
|
|
7081
|
-
const cmpSlots = vm.cmpSlots = create(null);
|
|
7082
|
-
|
|
7083
|
-
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
7084
|
-
const vnode = children[i];
|
|
7085
|
-
|
|
7086
|
-
if (isNull(vnode)) {
|
|
7087
|
-
continue;
|
|
7088
|
-
}
|
|
7089
|
-
|
|
7090
|
-
const {
|
|
7091
|
-
data
|
|
7092
|
-
} = vnode;
|
|
7093
|
-
const slotName = data.attrs && data.attrs.slot || '';
|
|
7094
|
-
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
7095
|
-
// which might have similar keys. Each vnode will always have a key that
|
|
7096
|
-
// starts with a numeric character from compiler. In this case, we add a unique
|
|
7097
|
-
// notation for slotted vnodes keys, e.g.: `@foo:1:1`
|
|
7098
|
-
|
|
7099
|
-
if (!isUndefined$1(vnode.key)) {
|
|
7100
|
-
vnode.key = `@${slotName}:${vnode.key}`;
|
|
7101
|
-
}
|
|
7102
|
-
|
|
7103
|
-
ArrayPush$1.call(vnodes, vnode);
|
|
7104
|
-
}
|
|
7105
|
-
|
|
7106
|
-
if (isFalse(vm.isDirty)) {
|
|
7107
|
-
// We need to determine if the old allocation is really different from the new one
|
|
7108
|
-
// and mark the vm as dirty
|
|
7109
|
-
const oldKeys = keys(oldSlots);
|
|
7110
|
-
|
|
7111
|
-
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
7112
|
-
markComponentAsDirty(vm);
|
|
7113
|
-
return;
|
|
7114
|
-
}
|
|
7115
|
-
|
|
7116
|
-
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
7117
|
-
const key = oldKeys[i];
|
|
7118
|
-
|
|
7119
|
-
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
7120
|
-
markComponentAsDirty(vm);
|
|
7121
|
-
return;
|
|
7122
|
-
}
|
|
7123
|
-
|
|
7124
|
-
const oldVNodes = oldSlots[key];
|
|
7125
|
-
const vnodes = cmpSlots[key];
|
|
7126
|
-
|
|
7127
|
-
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
7128
|
-
if (oldVNodes[j] !== vnodes[j]) {
|
|
7129
|
-
markComponentAsDirty(vm);
|
|
7130
|
-
return;
|
|
7131
|
-
}
|
|
7132
|
-
}
|
|
7133
|
-
}
|
|
7134
|
-
}
|
|
7135
7150
|
}
|
|
7136
7151
|
|
|
7137
7152
|
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
@@ -7273,7 +7288,6 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
7273
7288
|
|
|
7274
7289
|
const {
|
|
7275
7290
|
elm,
|
|
7276
|
-
renderer,
|
|
7277
7291
|
context: {
|
|
7278
7292
|
wiredConnecting,
|
|
7279
7293
|
wiredDisconnecting
|
|
@@ -7300,7 +7314,7 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
7300
7314
|
}
|
|
7301
7315
|
|
|
7302
7316
|
});
|
|
7303
|
-
|
|
7317
|
+
dispatchEvent$1(elm, contextRegistrationEvent);
|
|
7304
7318
|
});
|
|
7305
7319
|
}
|
|
7306
7320
|
|
|
@@ -7565,7 +7579,7 @@ function setHooks(hooks) {
|
|
|
7565
7579
|
hooksAreSet = true;
|
|
7566
7580
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7567
7581
|
}
|
|
7568
|
-
/* version: 2.
|
|
7582
|
+
/* version: 2.7.3 */
|
|
7569
7583
|
|
|
7570
7584
|
/*
|
|
7571
7585
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -7639,7 +7653,7 @@ function registerCustomElement(name, ctor) {
|
|
|
7639
7653
|
reverseRegistry.set(ctor, name);
|
|
7640
7654
|
}
|
|
7641
7655
|
|
|
7642
|
-
class
|
|
7656
|
+
class HTMLElementImpl {
|
|
7643
7657
|
constructor() {
|
|
7644
7658
|
const {
|
|
7645
7659
|
constructor
|
|
@@ -7655,275 +7669,321 @@ class HTMLElement$1 {
|
|
|
7655
7669
|
|
|
7656
7670
|
}
|
|
7657
7671
|
|
|
7658
|
-
const
|
|
7659
|
-
ssr: true,
|
|
7660
|
-
|
|
7661
|
-
isHydrating() {
|
|
7662
|
-
return false;
|
|
7663
|
-
},
|
|
7672
|
+
const ssr = true;
|
|
7664
7673
|
|
|
7665
|
-
|
|
7666
|
-
|
|
7674
|
+
function isHydrating() {
|
|
7675
|
+
return false;
|
|
7676
|
+
}
|
|
7667
7677
|
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
const nodeIndex = node.parent.children.indexOf(node);
|
|
7671
|
-
node.parent.children.splice(nodeIndex, 1);
|
|
7672
|
-
}
|
|
7678
|
+
const isNativeShadowDefined = false;
|
|
7679
|
+
const isSyntheticShadowDefined = false;
|
|
7673
7680
|
|
|
7674
|
-
|
|
7675
|
-
|
|
7681
|
+
function insert(node, parent, anchor) {
|
|
7682
|
+
if (node.parent !== null && node.parent !== parent) {
|
|
7683
|
+
const nodeIndex = node.parent.children.indexOf(node);
|
|
7684
|
+
node.parent.children.splice(nodeIndex, 1);
|
|
7685
|
+
}
|
|
7676
7686
|
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
} else {
|
|
7680
|
-
parent.children.splice(anchorIndex, 0, node);
|
|
7681
|
-
}
|
|
7682
|
-
},
|
|
7687
|
+
node.parent = parent;
|
|
7688
|
+
const anchorIndex = isNull(anchor) ? -1 : parent.children.indexOf(anchor);
|
|
7683
7689
|
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7690
|
+
if (anchorIndex === -1) {
|
|
7691
|
+
parent.children.push(node);
|
|
7692
|
+
} else {
|
|
7693
|
+
parent.children.splice(anchorIndex, 0, node);
|
|
7694
|
+
}
|
|
7695
|
+
}
|
|
7688
7696
|
|
|
7689
|
-
|
|
7697
|
+
function remove(node, parent) {
|
|
7698
|
+
const nodeIndex = parent.children.indexOf(node);
|
|
7699
|
+
parent.children.splice(nodeIndex, 1);
|
|
7700
|
+
}
|
|
7690
7701
|
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7702
|
+
function createText(content) {
|
|
7703
|
+
return {
|
|
7704
|
+
type: HostNodeType.Text,
|
|
7705
|
+
value: String(content),
|
|
7706
|
+
parent: null
|
|
7707
|
+
};
|
|
7708
|
+
}
|
|
7698
7709
|
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7710
|
+
function createComment(content) {
|
|
7711
|
+
return {
|
|
7712
|
+
type: HostNodeType.Comment,
|
|
7713
|
+
value: content,
|
|
7714
|
+
parent: null
|
|
7715
|
+
};
|
|
7716
|
+
}
|
|
7706
7717
|
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7718
|
+
function nextSibling(node) {
|
|
7719
|
+
const {
|
|
7720
|
+
parent
|
|
7721
|
+
} = node;
|
|
7711
7722
|
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7723
|
+
if (isNull(parent)) {
|
|
7724
|
+
return null;
|
|
7725
|
+
}
|
|
7715
7726
|
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7727
|
+
const nodeIndex = parent.children.indexOf(node);
|
|
7728
|
+
return parent.children[nodeIndex + 1] || null;
|
|
7729
|
+
}
|
|
7719
7730
|
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7731
|
+
function attachShadow(element, config) {
|
|
7732
|
+
element.shadowRoot = {
|
|
7733
|
+
type: HostNodeType.ShadowRoot,
|
|
7734
|
+
children: [],
|
|
7735
|
+
mode: config.mode,
|
|
7736
|
+
delegatesFocus: !!config.delegatesFocus
|
|
7737
|
+
};
|
|
7738
|
+
return element.shadowRoot;
|
|
7739
|
+
}
|
|
7729
7740
|
|
|
7730
|
-
|
|
7731
|
-
|
|
7741
|
+
function getProperty(node, key) {
|
|
7742
|
+
var _a, _b;
|
|
7732
7743
|
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7744
|
+
if (key in node) {
|
|
7745
|
+
return node[key];
|
|
7746
|
+
}
|
|
7736
7747
|
|
|
7737
|
-
|
|
7738
|
-
|
|
7748
|
+
if (node.type === HostNodeType.Element) {
|
|
7749
|
+
const attrName = htmlPropertyToAttribute(key); // Handle all the boolean properties.
|
|
7739
7750
|
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7751
|
+
if (isBooleanAttribute(attrName, node.name)) {
|
|
7752
|
+
return (_a = getAttribute(node, attrName)) !== null && _a !== void 0 ? _a : false;
|
|
7753
|
+
} // Handle global html attributes and AOM.
|
|
7743
7754
|
|
|
7744
7755
|
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7756
|
+
if (isGlobalHtmlAttribute(attrName) || isAriaAttribute(attrName)) {
|
|
7757
|
+
return getAttribute(node, attrName);
|
|
7758
|
+
} // Handle special elements live bindings. The checked property is already handled above
|
|
7759
|
+
// in the boolean case.
|
|
7749
7760
|
|
|
7750
7761
|
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
}
|
|
7762
|
+
if (node.name === 'input' && key === 'value') {
|
|
7763
|
+
return (_b = getAttribute(node, 'value')) !== null && _b !== void 0 ? _b : '';
|
|
7754
7764
|
}
|
|
7765
|
+
}
|
|
7755
7766
|
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7767
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7768
|
+
// eslint-disable-next-line no-console
|
|
7769
|
+
console.error(`Unexpected "${key}" property access from the renderer`);
|
|
7770
|
+
}
|
|
7771
|
+
}
|
|
7761
7772
|
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7773
|
+
function setProperty(node, key, value) {
|
|
7774
|
+
if (key in node) {
|
|
7775
|
+
return node[key] = value;
|
|
7776
|
+
}
|
|
7766
7777
|
|
|
7767
|
-
|
|
7768
|
-
|
|
7778
|
+
if (node.type === HostNodeType.Element) {
|
|
7779
|
+
const attrName = htmlPropertyToAttribute(key);
|
|
7769
7780
|
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7781
|
+
if (key === 'innerHTML') {
|
|
7782
|
+
node.children = [{
|
|
7783
|
+
type: HostNodeType.Raw,
|
|
7784
|
+
parent: node,
|
|
7785
|
+
value
|
|
7786
|
+
}];
|
|
7787
|
+
return;
|
|
7788
|
+
} // Handle all the boolean properties.
|
|
7778
7789
|
|
|
7779
7790
|
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7791
|
+
if (isBooleanAttribute(attrName, node.name)) {
|
|
7792
|
+
return value === true ? setAttribute(node, attrName, '') : removeAttribute(node, attrName);
|
|
7793
|
+
} // Handle global html attributes and AOM.
|
|
7783
7794
|
|
|
7784
7795
|
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7796
|
+
if (isGlobalHtmlAttribute(attrName) || isAriaAttribute(attrName)) {
|
|
7797
|
+
return setAttribute(node, attrName, value);
|
|
7798
|
+
} // Handle special elements live bindings. The checked property is already handled above
|
|
7799
|
+
// in the boolean case.
|
|
7789
7800
|
|
|
7790
7801
|
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
}
|
|
7802
|
+
if (node.name === 'input' && attrName === 'value') {
|
|
7803
|
+
return isNull(value) || isUndefined$1(value) ? removeAttribute(node, 'value') : setAttribute(node, 'value', value);
|
|
7794
7804
|
}
|
|
7805
|
+
}
|
|
7795
7806
|
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7807
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7808
|
+
// eslint-disable-next-line no-console
|
|
7809
|
+
console.error(`Unexpected attempt to set "${key}=${value}" property from the renderer`);
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7801
7812
|
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
+
function setText(node, content) {
|
|
7814
|
+
if (node.type === HostNodeType.Text) {
|
|
7815
|
+
node.value = content;
|
|
7816
|
+
} else if (node.type === HostNodeType.Element) {
|
|
7817
|
+
node.children = [{
|
|
7818
|
+
type: HostNodeType.Text,
|
|
7819
|
+
parent: node,
|
|
7820
|
+
value: content
|
|
7821
|
+
}];
|
|
7822
|
+
}
|
|
7823
|
+
}
|
|
7813
7824
|
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7825
|
+
function getAttribute(element, name, namespace = null) {
|
|
7826
|
+
const attribute = element.attributes.find(attr => attr.name === name && attr.namespace === namespace);
|
|
7827
|
+
return attribute ? attribute.value : null;
|
|
7828
|
+
}
|
|
7818
7829
|
|
|
7819
|
-
|
|
7820
|
-
|
|
7830
|
+
function setAttribute(element, name, value, namespace = null) {
|
|
7831
|
+
const attribute = element.attributes.find(attr => attr.name === name && attr.namespace === namespace);
|
|
7821
7832
|
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7833
|
+
if (isUndefined$1(namespace)) {
|
|
7834
|
+
namespace = null;
|
|
7835
|
+
}
|
|
7836
|
+
|
|
7837
|
+
if (isUndefined$1(attribute)) {
|
|
7838
|
+
element.attributes.push({
|
|
7839
|
+
name,
|
|
7840
|
+
namespace,
|
|
7841
|
+
value: String(value)
|
|
7842
|
+
});
|
|
7843
|
+
} else {
|
|
7844
|
+
attribute.value = value;
|
|
7845
|
+
}
|
|
7846
|
+
}
|
|
7847
|
+
|
|
7848
|
+
function removeAttribute(element, name, namespace) {
|
|
7849
|
+
element.attributes = element.attributes.filter(attr => attr.name !== name && attr.namespace !== namespace);
|
|
7850
|
+
}
|
|
7851
|
+
|
|
7852
|
+
function getClassList(element) {
|
|
7853
|
+
function getClassAttribute() {
|
|
7854
|
+
let classAttribute = element.attributes.find(attr => attr.name === 'class' && isNull(attr.namespace));
|
|
7855
|
+
|
|
7856
|
+
if (isUndefined$1(classAttribute)) {
|
|
7857
|
+
classAttribute = {
|
|
7858
|
+
name: 'class',
|
|
7859
|
+
namespace: null,
|
|
7860
|
+
value: ''
|
|
7861
|
+
};
|
|
7862
|
+
element.attributes.push(classAttribute);
|
|
7830
7863
|
}
|
|
7831
|
-
},
|
|
7832
7864
|
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
},
|
|
7865
|
+
return classAttribute;
|
|
7866
|
+
}
|
|
7836
7867
|
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
namespace: null,
|
|
7845
|
-
value: ''
|
|
7846
|
-
};
|
|
7847
|
-
element.attributes.push(classAttribute);
|
|
7848
|
-
}
|
|
7868
|
+
return {
|
|
7869
|
+
add(...names) {
|
|
7870
|
+
const classAttribute = getClassAttribute();
|
|
7871
|
+
const tokenList = classNameToTokenList(classAttribute.value);
|
|
7872
|
+
names.forEach(name => tokenList.add(name));
|
|
7873
|
+
classAttribute.value = tokenListToClassName(tokenList);
|
|
7874
|
+
},
|
|
7849
7875
|
|
|
7850
|
-
|
|
7876
|
+
remove(...names) {
|
|
7877
|
+
const classAttribute = getClassAttribute();
|
|
7878
|
+
const tokenList = classNameToTokenList(classAttribute.value);
|
|
7879
|
+
names.forEach(name => tokenList.delete(name));
|
|
7880
|
+
classAttribute.value = tokenListToClassName(tokenList);
|
|
7851
7881
|
}
|
|
7852
7882
|
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
const classAttribute = getClassAttribute();
|
|
7856
|
-
const tokenList = classNameToTokenList(classAttribute.value);
|
|
7857
|
-
names.forEach(name => tokenList.add(name));
|
|
7858
|
-
classAttribute.value = tokenListToClassName(tokenList);
|
|
7859
|
-
},
|
|
7883
|
+
};
|
|
7884
|
+
}
|
|
7860
7885
|
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
names.forEach(name => tokenList.delete(name));
|
|
7865
|
-
classAttribute.value = tokenListToClassName(tokenList);
|
|
7866
|
-
}
|
|
7886
|
+
function setCSSStyleProperty(element, name, value, important) {
|
|
7887
|
+
const styleAttribute = element.attributes.find(attr => attr.name === 'style' && isNull(attr.namespace));
|
|
7888
|
+
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
7867
7889
|
|
|
7868
|
-
|
|
7869
|
-
|
|
7890
|
+
if (isUndefined$1(styleAttribute)) {
|
|
7891
|
+
element.attributes.push({
|
|
7892
|
+
name: 'style',
|
|
7893
|
+
namespace: null,
|
|
7894
|
+
value: serializedProperty
|
|
7895
|
+
});
|
|
7896
|
+
} else {
|
|
7897
|
+
styleAttribute.value += `; ${serializedProperty}`;
|
|
7898
|
+
}
|
|
7899
|
+
}
|
|
7870
7900
|
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7901
|
+
function isConnected(node) {
|
|
7902
|
+
return !isNull(node.parent);
|
|
7903
|
+
} // Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
|
|
7904
|
+
// synthetic shadow.
|
|
7874
7905
|
|
|
7875
|
-
if (isUndefined$1(styleAttribute)) {
|
|
7876
|
-
element.attributes.push({
|
|
7877
|
-
name: 'style',
|
|
7878
|
-
namespace: null,
|
|
7879
|
-
value: serializedProperty
|
|
7880
|
-
});
|
|
7881
|
-
} else {
|
|
7882
|
-
styleAttribute.value += `; ${serializedProperty}`;
|
|
7883
|
-
}
|
|
7884
|
-
},
|
|
7885
7906
|
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
},
|
|
7907
|
+
const insertGlobalStylesheet = noop; // Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
|
|
7908
|
+
// synthetic shadow.
|
|
7889
7909
|
|
|
7890
|
-
|
|
7891
|
-
// synthetic shadow.
|
|
7892
|
-
},
|
|
7910
|
+
const insertStylesheet = noop; // Noop on SSR.
|
|
7893
7911
|
|
|
7894
|
-
|
|
7895
|
-
// synthetic shadow.
|
|
7896
|
-
},
|
|
7912
|
+
const addEventListener = noop; // Noop on SSR.
|
|
7897
7913
|
|
|
7898
|
-
|
|
7899
|
-
|
|
7914
|
+
const removeEventListener = noop;
|
|
7915
|
+
const dispatchEvent = unsupportedMethod('dispatchEvent');
|
|
7916
|
+
const getBoundingClientRect = unsupportedMethod('getBoundingClientRect');
|
|
7917
|
+
const querySelector = unsupportedMethod('querySelector');
|
|
7918
|
+
const querySelectorAll = unsupportedMethod('querySelectorAll');
|
|
7919
|
+
const getElementsByTagName = unsupportedMethod('getElementsByTagName');
|
|
7920
|
+
const getElementsByClassName = unsupportedMethod('getElementsByClassName');
|
|
7921
|
+
const getChildren = unsupportedMethod('getChildren');
|
|
7922
|
+
const getChildNodes = unsupportedMethod('getChildNodes');
|
|
7923
|
+
const getFirstChild = unsupportedMethod('getFirstChild');
|
|
7924
|
+
const getFirstElementChild = unsupportedMethod('getFirstElementChild');
|
|
7925
|
+
const getLastChild = unsupportedMethod('getLastChild');
|
|
7926
|
+
const getLastElementChild = unsupportedMethod('getLastElementChild');
|
|
7900
7927
|
|
|
7901
|
-
|
|
7902
|
-
|
|
7928
|
+
function defineCustomElement(name, constructor, _options) {
|
|
7929
|
+
registerCustomElement(name, constructor);
|
|
7930
|
+
}
|
|
7903
7931
|
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
querySelectorAll: unsupportedMethod('querySelectorAll'),
|
|
7908
|
-
getElementsByTagName: unsupportedMethod('getElementsByTagName'),
|
|
7909
|
-
getElementsByClassName: unsupportedMethod('getElementsByClassName'),
|
|
7910
|
-
getChildren: unsupportedMethod('getChildren'),
|
|
7911
|
-
getChildNodes: unsupportedMethod('getChildNodes'),
|
|
7912
|
-
getFirstChild: unsupportedMethod('getFirstChild'),
|
|
7913
|
-
getFirstElementChild: unsupportedMethod('getFirstElementChild'),
|
|
7914
|
-
getLastChild: unsupportedMethod('getLastChild'),
|
|
7915
|
-
getLastElementChild: unsupportedMethod('getLastElementChild'),
|
|
7916
|
-
|
|
7917
|
-
defineCustomElement(name, constructor, _options) {
|
|
7918
|
-
registerCustomElement(name, constructor);
|
|
7919
|
-
},
|
|
7932
|
+
function getCustomElement(name) {
|
|
7933
|
+
return registry[name];
|
|
7934
|
+
}
|
|
7920
7935
|
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
},
|
|
7936
|
+
const HTMLElementExported = HTMLElementImpl;
|
|
7937
|
+
/* noop */
|
|
7924
7938
|
|
|
7925
|
-
|
|
7926
|
-
|
|
7939
|
+
const assertInstanceOfHTMLElement = noop;
|
|
7940
|
+
/*
|
|
7941
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
7942
|
+
* All rights reserved.
|
|
7943
|
+
* SPDX-License-Identifier: MIT
|
|
7944
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7945
|
+
*/
|
|
7946
|
+
|
|
7947
|
+
setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElement);
|
|
7948
|
+
setAttachShadow(attachShadow);
|
|
7949
|
+
setCreateComment(createComment);
|
|
7950
|
+
setCreateElement(createElement);
|
|
7951
|
+
setCreateText(createText);
|
|
7952
|
+
setDefineCustomElement(defineCustomElement);
|
|
7953
|
+
setDispatchEvent(dispatchEvent);
|
|
7954
|
+
setGetAttribute(getAttribute);
|
|
7955
|
+
setGetBoundingClientRect(getBoundingClientRect);
|
|
7956
|
+
setGetChildNodes(getChildNodes);
|
|
7957
|
+
setGetChildren(getChildren);
|
|
7958
|
+
setGetClassList(getClassList);
|
|
7959
|
+
setGetCustomElement(getCustomElement);
|
|
7960
|
+
setGetElementsByClassName(getElementsByClassName);
|
|
7961
|
+
setGetElementsByTagName(getElementsByTagName);
|
|
7962
|
+
setGetFirstChild(getFirstChild);
|
|
7963
|
+
setGetFirstElementChild(getFirstElementChild);
|
|
7964
|
+
setGetLastChild(getLastChild);
|
|
7965
|
+
setGetLastElementChild(getLastElementChild);
|
|
7966
|
+
setGetProperty(getProperty);
|
|
7967
|
+
setHTMLElement(HTMLElementExported);
|
|
7968
|
+
setInsert(insert);
|
|
7969
|
+
setInsertGlobalStylesheet(insertGlobalStylesheet);
|
|
7970
|
+
setInsertStylesheet(insertStylesheet);
|
|
7971
|
+
setIsConnected(isConnected);
|
|
7972
|
+
setIsHydrating(isHydrating);
|
|
7973
|
+
setIsNativeShadowDefined(isNativeShadowDefined);
|
|
7974
|
+
setIsSyntheticShadowDefined(isSyntheticShadowDefined);
|
|
7975
|
+
setNextSibling(nextSibling);
|
|
7976
|
+
setQuerySelector(querySelector);
|
|
7977
|
+
setQuerySelectorAll(querySelectorAll);
|
|
7978
|
+
setRemove(remove);
|
|
7979
|
+
setRemoveAttribute(removeAttribute);
|
|
7980
|
+
setRemoveEventListener(removeEventListener);
|
|
7981
|
+
setSetAttribute(setAttribute);
|
|
7982
|
+
setSetCSSStyleProperty(setCSSStyleProperty);
|
|
7983
|
+
setSetProperty(setProperty);
|
|
7984
|
+
setSetText(setText);
|
|
7985
|
+
setSsr(ssr);
|
|
7986
|
+
setAddEventListener(addEventListener);
|
|
7927
7987
|
/*
|
|
7928
7988
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
7929
7989
|
* All rights reserved.
|
|
@@ -8034,12 +8094,11 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
8034
8094
|
throw new TypeError(`"renderComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
8035
8095
|
}
|
|
8036
8096
|
|
|
8037
|
-
const element =
|
|
8097
|
+
const element = createElement(tagName);
|
|
8038
8098
|
const def = getComponentInternalDef(Ctor);
|
|
8039
8099
|
createVM(element, def, {
|
|
8040
8100
|
mode: 'open',
|
|
8041
8101
|
owner: null,
|
|
8042
|
-
renderer,
|
|
8043
8102
|
tagName
|
|
8044
8103
|
});
|
|
8045
8104
|
|
|
@@ -8061,6 +8120,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
8061
8120
|
|
|
8062
8121
|
freeze(LightningElement);
|
|
8063
8122
|
seal(LightningElement.prototype);
|
|
8064
|
-
/* version: 2.
|
|
8123
|
+
/* version: 2.7.3 */
|
|
8065
8124
|
|
|
8066
8125
|
export { LightningElement, api$1 as api, createContextProvider, getComponentDef, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|