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