@lwc/engine-core 2.25.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-core.cjs.js +419 -431
- package/dist/engine-core.js +421 -432
- package/package.json +3 -3
- package/types/framework/main.d.ts +1 -2
- package/types/framework/renderer.d.ts +2 -3
- package/types/framework/stylesheet.d.ts +2 -0
- package/types/framework/template.d.ts +1 -0
- package/types/framework/upgradable-element.d.ts +0 -7
package/dist/engine-core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* proxy-compat-disable */
|
|
2
2
|
import { lwcRuntimeFlags } from '@lwc/features';
|
|
3
3
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
4
|
-
import { seal, create, isUndefined as isUndefined$1, isFunction as isFunction$1, ArrayPush as ArrayPush$1, ArrayIndexOf, ArraySplice, StringToLowerCase, isNull, ArrayJoin, isFrozen, defineProperty, hasOwnProperty as hasOwnProperty$1, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, freeze, assert, KEY__SYNTHETIC_MODE, isFalse, isTrue, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, htmlPropertyToAttribute, ArraySlice, ArrayMap, isArray as isArray$1, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, isNumber, StringReplace, noop, ArrayUnshift, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift, ArrayPop } from '@lwc/shared';
|
|
4
|
+
import { seal, create, isUndefined as isUndefined$1, isFunction as isFunction$1, ArrayPush as ArrayPush$1, ArrayIndexOf, ArraySplice, StringToLowerCase, isNull, ArrayJoin, isFrozen, defineProperty, hasOwnProperty as hasOwnProperty$1, assign, forEach, keys, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getOwnPropertyNames as getOwnPropertyNames$1, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, isObject, freeze, assert, KEY__SYNTHETIC_MODE, isFalse, isTrue, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, htmlPropertyToAttribute, ArraySlice, ArrayMap, isArray as isArray$1, KEY__SCOPED_CSS, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, isString, StringSlice, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, isNumber, StringReplace, noop, ArrayUnshift, ArrayFilter, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse, ArrayShift, ArrayPop } from '@lwc/shared';
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1462,7 +1462,9 @@ const refsCache = new WeakMap();
|
|
|
1462
1462
|
const LightningElement = function () {
|
|
1463
1463
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1464
1464
|
if (isNull(vmBeingConstructed)) {
|
|
1465
|
-
|
|
1465
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1466
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1467
|
+
throw new TypeError('Illegal constructor');
|
|
1466
1468
|
}
|
|
1467
1469
|
const vm = vmBeingConstructed;
|
|
1468
1470
|
const { def, elm } = vm;
|
|
@@ -2526,274 +2528,213 @@ const swappedStyleMap = new WeakMap();
|
|
|
2526
2528
|
const activeTemplates = new WeakMap();
|
|
2527
2529
|
const activeComponents = new WeakMap();
|
|
2528
2530
|
const activeStyles = new WeakMap();
|
|
2529
|
-
|
|
2530
2531
|
function rehydrateHotTemplate(tpl) {
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
return true;
|
|
2532
|
+
const list = activeTemplates.get(tpl);
|
|
2533
|
+
if (!isUndefined$1(list)) {
|
|
2534
|
+
list.forEach((vm) => {
|
|
2535
|
+
if (isFalse(vm.isDirty)) {
|
|
2536
|
+
// forcing the vm to rehydrate in the micro-task:
|
|
2537
|
+
markComponentAsDirty(vm);
|
|
2538
|
+
scheduleRehydration(vm);
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
// resetting the Set to release the memory of those vm references
|
|
2542
|
+
// since they are not longer related to this template, instead
|
|
2543
|
+
// they will get re-associated once these instances are rehydrated.
|
|
2544
|
+
list.clear();
|
|
2545
|
+
}
|
|
2546
|
+
return true;
|
|
2548
2547
|
}
|
|
2549
|
-
|
|
2550
2548
|
function rehydrateHotStyle(style) {
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
return true;
|
|
2549
|
+
const list = activeStyles.get(style);
|
|
2550
|
+
if (!isUndefined$1(list)) {
|
|
2551
|
+
list.forEach((vm) => {
|
|
2552
|
+
// if a style definition is swapped, we must reset
|
|
2553
|
+
// vm's template content in the next micro-task:
|
|
2554
|
+
forceRehydration(vm);
|
|
2555
|
+
});
|
|
2556
|
+
// resetting the Set to release the memory of those vm references
|
|
2557
|
+
// since they are not longer related to this style, instead
|
|
2558
|
+
// they will get re-associated once these instances are rehydrated.
|
|
2559
|
+
list.clear();
|
|
2560
|
+
}
|
|
2561
|
+
return true;
|
|
2566
2562
|
}
|
|
2567
|
-
|
|
2568
2563
|
function rehydrateHotComponent(Ctor) {
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
list.clear();
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
|
-
return canRefreshAllInstances;
|
|
2564
|
+
const list = activeComponents.get(Ctor);
|
|
2565
|
+
let canRefreshAllInstances = true;
|
|
2566
|
+
if (!isUndefined$1(list)) {
|
|
2567
|
+
list.forEach((vm) => {
|
|
2568
|
+
const { owner } = vm;
|
|
2569
|
+
if (!isNull(owner)) {
|
|
2570
|
+
// if a component class definition is swapped, we must reset
|
|
2571
|
+
// owner's template content in the next micro-task:
|
|
2572
|
+
forceRehydration(owner);
|
|
2573
|
+
}
|
|
2574
|
+
else {
|
|
2575
|
+
// the hot swapping for components only work for instances of components
|
|
2576
|
+
// created from a template, root elements can't be swapped because we
|
|
2577
|
+
// don't have a way to force the creation of the element with the same state
|
|
2578
|
+
// of the current element.
|
|
2579
|
+
// Instead, we can report the problem to the caller so it can take action,
|
|
2580
|
+
// for example: reload the entire page.
|
|
2581
|
+
canRefreshAllInstances = false;
|
|
2582
|
+
}
|
|
2583
|
+
});
|
|
2584
|
+
// resetting the Set to release the memory of those vm references
|
|
2585
|
+
// since they are not longer related to this constructor, instead
|
|
2586
|
+
// they will get re-associated once these instances are rehydrated.
|
|
2587
|
+
list.clear();
|
|
2588
|
+
}
|
|
2589
|
+
return canRefreshAllInstances;
|
|
2599
2590
|
}
|
|
2600
|
-
|
|
2601
2591
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2592
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2593
|
+
// this method should never leak to prod
|
|
2594
|
+
throw new ReferenceError();
|
|
2595
|
+
}
|
|
2608
2596
|
const visited = new Set();
|
|
2609
|
-
|
|
2610
2597
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
2611
|
-
|
|
2612
|
-
|
|
2598
|
+
visited.add(tpl);
|
|
2599
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
2613
2600
|
}
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
return tpl;
|
|
2601
|
+
return tpl;
|
|
2617
2602
|
}
|
|
2618
2603
|
function getComponentOrSwappedComponent(Ctor) {
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2604
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2605
|
+
// this method should never leak to prod
|
|
2606
|
+
throw new ReferenceError();
|
|
2607
|
+
}
|
|
2625
2608
|
const visited = new Set();
|
|
2626
|
-
|
|
2627
2609
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
2628
|
-
|
|
2629
|
-
|
|
2610
|
+
visited.add(Ctor);
|
|
2611
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
2630
2612
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
return Ctor;
|
|
2613
|
+
return Ctor;
|
|
2634
2614
|
}
|
|
2635
2615
|
function getStyleOrSwappedStyle(style) {
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2616
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2617
|
+
// this method should never leak to prod
|
|
2618
|
+
throw new ReferenceError();
|
|
2619
|
+
}
|
|
2642
2620
|
const visited = new Set();
|
|
2643
|
-
|
|
2644
2621
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
2645
|
-
|
|
2646
|
-
|
|
2622
|
+
visited.add(style);
|
|
2623
|
+
style = swappedStyleMap.get(style);
|
|
2647
2624
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
return style;
|
|
2625
|
+
return style;
|
|
2651
2626
|
}
|
|
2652
2627
|
function setActiveVM(vm) {
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2628
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2629
|
+
// this method should never leak to prod
|
|
2630
|
+
throw new ReferenceError();
|
|
2631
|
+
}
|
|
2659
2632
|
// tracking active component
|
|
2660
2633
|
const Ctor = vm.def.ctor;
|
|
2661
2634
|
let componentVMs = activeComponents.get(Ctor);
|
|
2662
|
-
|
|
2663
2635
|
if (isUndefined$1(componentVMs)) {
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2636
|
+
componentVMs = new Set();
|
|
2637
|
+
activeComponents.set(Ctor, componentVMs);
|
|
2638
|
+
}
|
|
2639
|
+
// this will allow us to keep track of the hot components
|
|
2640
|
+
componentVMs.add(vm);
|
|
2641
|
+
// tracking active template
|
|
2671
2642
|
const tpl = vm.cmpTemplate;
|
|
2672
|
-
|
|
2673
2643
|
if (tpl) {
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
stylesheetVMs.add(vm);
|
|
2704
|
-
});
|
|
2705
|
-
}
|
|
2644
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
2645
|
+
if (isUndefined$1(templateVMs)) {
|
|
2646
|
+
templateVMs = new Set();
|
|
2647
|
+
activeTemplates.set(tpl, templateVMs);
|
|
2648
|
+
}
|
|
2649
|
+
// this will allow us to keep track of the templates that are
|
|
2650
|
+
// being used by a hot component
|
|
2651
|
+
templateVMs.add(vm);
|
|
2652
|
+
// tracking active styles associated to template
|
|
2653
|
+
const stylesheets = tpl.stylesheets;
|
|
2654
|
+
if (!isUndefined$1(stylesheets)) {
|
|
2655
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
2656
|
+
// this is necessary because we don't hold the list of styles
|
|
2657
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
2658
|
+
// but the styles attached to the template might not be the actual
|
|
2659
|
+
// active ones, but the swapped versions of those.
|
|
2660
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
2661
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
2662
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
2663
|
+
stylesheetVMs = new Set();
|
|
2664
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
2665
|
+
}
|
|
2666
|
+
// this will allow us to keep track of the stylesheet that are
|
|
2667
|
+
// being used by a hot component
|
|
2668
|
+
stylesheetVMs.add(vm);
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2706
2671
|
}
|
|
2707
|
-
}
|
|
2708
2672
|
}
|
|
2709
2673
|
function removeActiveVM(vm) {
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2674
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2675
|
+
// this method should never leak to prod
|
|
2676
|
+
throw new ReferenceError();
|
|
2677
|
+
}
|
|
2716
2678
|
// tracking inactive component
|
|
2717
2679
|
const Ctor = vm.def.ctor;
|
|
2718
2680
|
let list = activeComponents.get(Ctor);
|
|
2719
|
-
|
|
2720
2681
|
if (!isUndefined$1(list)) {
|
|
2721
|
-
// deleting the vm from the set to avoid leaking memory
|
|
2722
|
-
list.delete(vm);
|
|
2723
|
-
} // removing inactive template
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
const tpl = vm.cmpTemplate;
|
|
2727
|
-
|
|
2728
|
-
if (tpl) {
|
|
2729
|
-
list = activeTemplates.get(tpl);
|
|
2730
|
-
|
|
2731
|
-
if (!isUndefined$1(list)) {
|
|
2732
2682
|
// deleting the vm from the set to avoid leaking memory
|
|
2733
2683
|
list.delete(vm);
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
flattenStylesheets(styles).forEach(style => {
|
|
2741
|
-
list = activeStyles.get(style);
|
|
2742
|
-
|
|
2743
|
-
if (!isUndefined$1(list)) {
|
|
2684
|
+
}
|
|
2685
|
+
// removing inactive template
|
|
2686
|
+
const tpl = vm.cmpTemplate;
|
|
2687
|
+
if (tpl) {
|
|
2688
|
+
list = activeTemplates.get(tpl);
|
|
2689
|
+
if (!isUndefined$1(list)) {
|
|
2744
2690
|
// deleting the vm from the set to avoid leaking memory
|
|
2745
2691
|
list.delete(vm);
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2692
|
+
}
|
|
2693
|
+
// removing active styles associated to template
|
|
2694
|
+
const styles = tpl.stylesheets;
|
|
2695
|
+
if (!isUndefined$1(styles)) {
|
|
2696
|
+
flattenStylesheets(styles).forEach((style) => {
|
|
2697
|
+
list = activeStyles.get(style);
|
|
2698
|
+
if (!isUndefined$1(list)) {
|
|
2699
|
+
// deleting the vm from the set to avoid leaking memory
|
|
2700
|
+
list.delete(vm);
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2749
2704
|
}
|
|
2750
|
-
}
|
|
2751
2705
|
}
|
|
2752
2706
|
function swapTemplate(oldTpl, newTpl) {
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2707
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2708
|
+
if (isTemplateRegistered(oldTpl) && isTemplateRegistered(newTpl)) {
|
|
2709
|
+
swappedTemplateMap.set(oldTpl, newTpl);
|
|
2710
|
+
return rehydrateHotTemplate(oldTpl);
|
|
2711
|
+
}
|
|
2712
|
+
else {
|
|
2713
|
+
throw new TypeError(`Invalid Template`);
|
|
2714
|
+
}
|
|
2759
2715
|
}
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2763
|
-
throw new Error('HMR is not enabled');
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
|
-
return false;
|
|
2716
|
+
return false;
|
|
2767
2717
|
}
|
|
2768
2718
|
function swapComponent(oldComponent, newComponent) {
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2719
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2720
|
+
if (isComponentConstructor(oldComponent) && isComponentConstructor(newComponent)) {
|
|
2721
|
+
swappedComponentMap.set(oldComponent, newComponent);
|
|
2722
|
+
return rehydrateHotComponent(oldComponent);
|
|
2723
|
+
}
|
|
2724
|
+
else {
|
|
2725
|
+
throw new TypeError(`Invalid Component`);
|
|
2726
|
+
}
|
|
2775
2727
|
}
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2779
|
-
throw new Error('HMR is not enabled');
|
|
2780
|
-
}
|
|
2781
|
-
|
|
2782
|
-
return false;
|
|
2728
|
+
return false;
|
|
2783
2729
|
}
|
|
2784
2730
|
function swapStyle(oldStyle, newStyle) {
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2793
|
-
throw new Error('HMR is not enabled');
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
return false;
|
|
2731
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2732
|
+
// TODO [#1887]: once the support for registering styles is implemented
|
|
2733
|
+
// we can add the validation of both styles around this block.
|
|
2734
|
+
swappedStyleMap.set(oldStyle, newStyle);
|
|
2735
|
+
return rehydrateHotStyle(oldStyle);
|
|
2736
|
+
}
|
|
2737
|
+
return false;
|
|
2797
2738
|
}
|
|
2798
2739
|
|
|
2799
2740
|
/*
|
|
@@ -3000,244 +2941,273 @@ function getComponentDef(Ctor) {
|
|
|
3000
2941
|
* SPDX-License-Identifier: MIT
|
|
3001
2942
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3002
2943
|
*/
|
|
2944
|
+
|
|
3003
2945
|
function makeHostToken(token) {
|
|
3004
|
-
|
|
2946
|
+
return `${token}-host`;
|
|
3005
2947
|
}
|
|
2948
|
+
|
|
3006
2949
|
function createInlineStyleVNode(content) {
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2950
|
+
return api.h('style', {
|
|
2951
|
+
key: 'style',
|
|
2952
|
+
attrs: {
|
|
2953
|
+
type: 'text/css'
|
|
2954
|
+
}
|
|
2955
|
+
}, [api.t(content)]);
|
|
3013
2956
|
}
|
|
2957
|
+
|
|
3014
2958
|
function updateStylesheetToken(vm, template) {
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
2959
|
+
const {
|
|
2960
|
+
elm,
|
|
2961
|
+
context,
|
|
2962
|
+
renderMode,
|
|
2963
|
+
shadowMode,
|
|
2964
|
+
renderer: {
|
|
2965
|
+
getClassList,
|
|
2966
|
+
removeAttribute,
|
|
2967
|
+
setAttribute
|
|
2968
|
+
}
|
|
2969
|
+
} = vm;
|
|
2970
|
+
const {
|
|
2971
|
+
stylesheets: newStylesheets,
|
|
2972
|
+
stylesheetToken: newStylesheetToken
|
|
2973
|
+
} = template;
|
|
2974
|
+
const isSyntheticShadow = renderMode === 1
|
|
2975
|
+
/* RenderMode.Shadow */
|
|
2976
|
+
&& shadowMode === 1
|
|
2977
|
+
/* ShadowMode.Synthetic */
|
|
2978
|
+
;
|
|
2979
|
+
const {
|
|
2980
|
+
hasScopedStyles
|
|
2981
|
+
} = context;
|
|
2982
|
+
let newToken;
|
|
2983
|
+
let newHasTokenInClass;
|
|
2984
|
+
let newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
2985
|
+
|
|
2986
|
+
const {
|
|
2987
|
+
stylesheetToken: oldToken,
|
|
2988
|
+
hasTokenInClass: oldHasTokenInClass,
|
|
2989
|
+
hasTokenInAttribute: oldHasTokenInAttribute
|
|
2990
|
+
} = context;
|
|
2991
|
+
|
|
2992
|
+
if (!isUndefined$1(oldToken)) {
|
|
2993
|
+
if (oldHasTokenInClass) {
|
|
2994
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
if (oldHasTokenInAttribute) {
|
|
2998
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
2999
|
+
}
|
|
3000
|
+
} // Apply the new template styling token to the host element, if the new template has any
|
|
3001
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3002
|
+
|
|
3003
|
+
|
|
3004
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
3005
|
+
newToken = newStylesheetToken;
|
|
3006
|
+
} // Set the new styling token on the host element
|
|
3007
|
+
|
|
3008
|
+
|
|
3009
|
+
if (!isUndefined$1(newToken)) {
|
|
3010
|
+
if (hasScopedStyles) {
|
|
3011
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
3012
|
+
newHasTokenInClass = true;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
if (isSyntheticShadow) {
|
|
3016
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
3017
|
+
newHasTokenInAttribute = true;
|
|
3018
|
+
}
|
|
3019
|
+
} // Update the styling tokens present on the context object.
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
context.stylesheetToken = newToken;
|
|
3023
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
3024
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
3052
3025
|
}
|
|
3026
|
+
|
|
3053
3027
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3028
|
+
const content = [];
|
|
3029
|
+
let root;
|
|
3030
|
+
|
|
3031
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3032
|
+
let stylesheet = stylesheets[i];
|
|
3033
|
+
|
|
3034
|
+
if (isArray$1(stylesheet)) {
|
|
3035
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3036
|
+
} else {
|
|
3037
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3038
|
+
// Check for compiler version mismatch in dev mode only
|
|
3039
|
+
checkVersionMismatch(stylesheet, 'stylesheet'); // in dev-mode, we support hot swapping of stylesheet, which means that
|
|
3040
|
+
// the component instance might be attempting to use an old version of
|
|
3041
|
+
// the stylesheet, while internally, we have a replacement for it.
|
|
3042
|
+
|
|
3043
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3047
|
+
|
|
3048
|
+
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
|
|
3049
|
+
if (!isScopedCss && vm.renderMode === 0
|
|
3050
|
+
/* RenderMode.Light */
|
|
3051
|
+
) {
|
|
3052
|
+
logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
|
|
3053
|
+
continue;
|
|
3060
3054
|
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
root = getNearestShadowComponent(vm);
|
|
3093
|
-
}
|
|
3094
|
-
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3095
|
-
}
|
|
3096
|
-
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3055
|
+
} // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
3059
|
+
/* ShadowMode.Synthetic */
|
|
3060
|
+
&& vm.renderMode === 1
|
|
3061
|
+
/* RenderMode.Shadow */
|
|
3062
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3063
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3064
|
+
|
|
3065
|
+
const useActualHostSelector = vm.renderMode === 0
|
|
3066
|
+
/* RenderMode.Light */
|
|
3067
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
3068
|
+
/* ShadowMode.Native */
|
|
3069
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3070
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
3071
|
+
|
|
3072
|
+
let useNativeDirPseudoclass;
|
|
3073
|
+
|
|
3074
|
+
if (vm.renderMode === 1
|
|
3075
|
+
/* RenderMode.Shadow */
|
|
3076
|
+
) {
|
|
3077
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
3078
|
+
/* ShadowMode.Native */
|
|
3079
|
+
;
|
|
3080
|
+
} else {
|
|
3081
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
3082
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
3083
|
+
if (isUndefined$1(root)) {
|
|
3084
|
+
// Only calculate the root once as necessary
|
|
3085
|
+
root = getNearestShadowComponent(vm);
|
|
3097
3086
|
}
|
|
3087
|
+
|
|
3088
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
3089
|
+
/* ShadowMode.Native */
|
|
3090
|
+
;
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3098
3094
|
}
|
|
3099
|
-
|
|
3095
|
+
}
|
|
3096
|
+
|
|
3097
|
+
return content;
|
|
3100
3098
|
}
|
|
3099
|
+
|
|
3101
3100
|
function getStylesheetsContent(vm, template) {
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3101
|
+
const {
|
|
3102
|
+
stylesheets,
|
|
3103
|
+
stylesheetToken
|
|
3104
|
+
} = template;
|
|
3105
|
+
let content = [];
|
|
3106
|
+
|
|
3107
|
+
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
3108
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
return content;
|
|
3112
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3110
3113
|
// perf testing has not shown it to be a huge improvement yet:
|
|
3111
3114
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
3115
|
+
|
|
3112
3116
|
function getNearestShadowComponent(vm) {
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3117
|
+
let owner = vm;
|
|
3118
|
+
|
|
3119
|
+
while (!isNull(owner)) {
|
|
3120
|
+
if (owner.renderMode === 1
|
|
3121
|
+
/* RenderMode.Shadow */
|
|
3122
|
+
) {
|
|
3123
|
+
return owner;
|
|
3119
3124
|
}
|
|
3120
|
-
|
|
3125
|
+
|
|
3126
|
+
owner = owner.owner;
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
return owner;
|
|
3121
3130
|
}
|
|
3122
3131
|
/**
|
|
3123
3132
|
* If the component that is currently being rendered uses scoped styles,
|
|
3124
3133
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
3125
3134
|
* it returns null.
|
|
3126
3135
|
*/
|
|
3136
|
+
|
|
3137
|
+
|
|
3127
3138
|
function getScopeTokenClass(owner) {
|
|
3128
|
-
|
|
3129
|
-
|
|
3139
|
+
const {
|
|
3140
|
+
cmpTemplate,
|
|
3141
|
+
context
|
|
3142
|
+
} = owner;
|
|
3143
|
+
return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
|
|
3130
3144
|
}
|
|
3131
3145
|
/**
|
|
3132
3146
|
* This function returns the host style token for a custom element if it
|
|
3133
3147
|
* exists. Otherwise it returns null.
|
|
3148
|
+
*
|
|
3149
|
+
* A host style token is applied to the component if scoped styles are used.
|
|
3134
3150
|
*/
|
|
3151
|
+
|
|
3135
3152
|
function getStylesheetTokenHost(vnode) {
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
}
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
// synthetic, we know we won't find a native component if we go any further.
|
|
3144
|
-
return null;
|
|
3145
|
-
}
|
|
3146
|
-
return owner;
|
|
3147
|
-
}
|
|
3148
|
-
function createStylesheet(vm, stylesheets) {
|
|
3149
|
-
const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
|
|
3150
|
-
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3151
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
3152
|
-
insertStylesheet(stylesheets[i]);
|
|
3153
|
-
}
|
|
3154
|
-
}
|
|
3155
|
-
else if (!process.env.IS_BROWSER || vm.hydrated) {
|
|
3156
|
-
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3157
|
-
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3158
|
-
// the first time the VM renders.
|
|
3159
|
-
// native shadow or light DOM, SSR
|
|
3160
|
-
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3161
|
-
}
|
|
3162
|
-
else {
|
|
3163
|
-
// native shadow or light DOM, DOM renderer
|
|
3164
|
-
const root = getNearestNativeShadowComponent(vm);
|
|
3165
|
-
// null root means a global style
|
|
3166
|
-
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
3167
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
3168
|
-
insertStylesheet(stylesheets[i], target);
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
return null;
|
|
3153
|
+
const {
|
|
3154
|
+
template
|
|
3155
|
+
} = getComponentInternalDef(vnode.ctor);
|
|
3156
|
+
const {
|
|
3157
|
+
stylesheetToken
|
|
3158
|
+
} = template;
|
|
3159
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
3172
3160
|
}
|
|
3173
3161
|
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
* All rights reserved.
|
|
3177
|
-
* SPDX-License-Identifier: MIT
|
|
3178
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3179
|
-
*/
|
|
3180
|
-
|
|
3181
|
-
function checkHasVM(elm) {
|
|
3182
|
-
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3162
|
+
function getNearestNativeShadowComponent(vm) {
|
|
3163
|
+
const owner = getNearestShadowComponent(vm);
|
|
3183
3164
|
|
|
3184
|
-
if (
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3165
|
+
if (!isNull(owner) && owner.shadowMode === 1
|
|
3166
|
+
/* ShadowMode.Synthetic */
|
|
3167
|
+
) {
|
|
3168
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
3169
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
3170
|
+
return null;
|
|
3188
3171
|
}
|
|
3189
3172
|
|
|
3190
|
-
return
|
|
3173
|
+
return owner;
|
|
3191
3174
|
}
|
|
3192
3175
|
|
|
3193
|
-
function
|
|
3176
|
+
function createStylesheet(vm, stylesheets) {
|
|
3194
3177
|
const {
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
// produce only tags with lowercase letters
|
|
3200
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
3201
|
-
|
|
3202
|
-
tagName = tagName.toLowerCase();
|
|
3203
|
-
let CE = getCustomElement(tagName);
|
|
3204
|
-
|
|
3205
|
-
if (!isUndefined$1(CE)) {
|
|
3206
|
-
return CE;
|
|
3207
|
-
}
|
|
3208
|
-
/**
|
|
3209
|
-
* LWC Upgradable Element reference to an element that was created
|
|
3210
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3211
|
-
*/
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3215
|
-
constructor(upgradeCallback) {
|
|
3216
|
-
super();
|
|
3217
|
-
|
|
3218
|
-
if (isFunction$1(upgradeCallback)) {
|
|
3219
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3220
|
-
}
|
|
3178
|
+
renderMode,
|
|
3179
|
+
shadowMode,
|
|
3180
|
+
renderer: {
|
|
3181
|
+
insertStylesheet
|
|
3221
3182
|
}
|
|
3183
|
+
} = vm;
|
|
3222
3184
|
|
|
3223
|
-
|
|
3185
|
+
if (renderMode === 1
|
|
3186
|
+
/* RenderMode.Shadow */
|
|
3187
|
+
&& shadowMode === 1
|
|
3188
|
+
/* ShadowMode.Synthetic */
|
|
3189
|
+
) {
|
|
3190
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3191
|
+
insertStylesheet(stylesheets[i]);
|
|
3192
|
+
}
|
|
3193
|
+
} else if (!process.env.IS_BROWSER || vm.hydrated) {
|
|
3194
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3195
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3196
|
+
// the first time the VM renders.
|
|
3197
|
+
// native shadow or light DOM, SSR
|
|
3198
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3199
|
+
} else {
|
|
3200
|
+
// native shadow or light DOM, DOM renderer
|
|
3201
|
+
const root = getNearestNativeShadowComponent(vm); // null root means a global style
|
|
3224
3202
|
|
|
3225
|
-
|
|
3226
|
-
CE.prototype.connectedCallback = function () {
|
|
3227
|
-
if (checkHasVM(this)) {
|
|
3228
|
-
connectRootElement(this);
|
|
3229
|
-
}
|
|
3230
|
-
};
|
|
3203
|
+
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
3231
3204
|
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
}
|
|
3236
|
-
};
|
|
3205
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3206
|
+
insertStylesheet(stylesheets[i], target);
|
|
3207
|
+
}
|
|
3237
3208
|
}
|
|
3238
3209
|
|
|
3239
|
-
|
|
3240
|
-
return CE;
|
|
3210
|
+
return null;
|
|
3241
3211
|
}
|
|
3242
3212
|
|
|
3243
3213
|
/*
|
|
@@ -3753,7 +3723,9 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3753
3723
|
sel,
|
|
3754
3724
|
owner
|
|
3755
3725
|
} = vnode;
|
|
3756
|
-
const
|
|
3726
|
+
const {
|
|
3727
|
+
createCustomElement
|
|
3728
|
+
} = renderer;
|
|
3757
3729
|
/**
|
|
3758
3730
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3759
3731
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3762,10 +3734,25 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3762
3734
|
*/
|
|
3763
3735
|
|
|
3764
3736
|
let vm;
|
|
3765
|
-
|
|
3737
|
+
|
|
3738
|
+
const upgradeCallback = elm => {
|
|
3766
3739
|
// the custom element from the registry is expecting an upgrade callback
|
|
3767
3740
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
3768
|
-
}
|
|
3741
|
+
};
|
|
3742
|
+
|
|
3743
|
+
const connectedCallback = elm => {
|
|
3744
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3745
|
+
connectRootElement(elm);
|
|
3746
|
+
}
|
|
3747
|
+
};
|
|
3748
|
+
|
|
3749
|
+
const disconnectedCallback = elm => {
|
|
3750
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3751
|
+
disconnectRootElement(elm);
|
|
3752
|
+
}
|
|
3753
|
+
};
|
|
3754
|
+
|
|
3755
|
+
const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
3769
3756
|
vnode.elm = elm;
|
|
3770
3757
|
vnode.vm = vm;
|
|
3771
3758
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -3773,8 +3760,6 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3773
3760
|
|
|
3774
3761
|
if (vm) {
|
|
3775
3762
|
allocateChildren(vnode, vm);
|
|
3776
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
3777
|
-
throw new TypeError(`Incorrect Component Constructor`);
|
|
3778
3763
|
}
|
|
3779
3764
|
|
|
3780
3765
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
@@ -6556,19 +6541,23 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6556
6541
|
//
|
|
6557
6542
|
// Consequently, hydration mismatches will occur if scoped CSS token classnames
|
|
6558
6543
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
6559
|
-
if (scopedToken) {
|
|
6544
|
+
if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
|
|
6560
6545
|
if (!isUndefined$1(className)) {
|
|
6561
|
-
className
|
|
6562
|
-
|
|
6563
|
-
|
|
6546
|
+
// The order of the className should be scopedToken className stylesheetTokenHost
|
|
6547
|
+
const classTokens = [scopedToken, className, stylesheetTokenHost];
|
|
6548
|
+
const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
|
|
6549
|
+
className = ArrayJoin.call(classNames, ' ');
|
|
6564
6550
|
}
|
|
6565
6551
|
else if (!isUndefined$1(classMap)) {
|
|
6566
|
-
classMap = Object.assign(Object.assign(Object.assign({}, classMap), { [scopedToken]: true }), (isNull(stylesheetTokenHost) ? {
|
|
6552
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), (!isNull(scopedToken) ? { [scopedToken]: true } : {})), (!isNull(stylesheetTokenHost) ? { [stylesheetTokenHost]: true } : {}));
|
|
6567
6553
|
}
|
|
6568
6554
|
else {
|
|
6569
|
-
className
|
|
6570
|
-
|
|
6571
|
-
|
|
6555
|
+
// The order of the className should be scopedToken stylesheetTokenHost
|
|
6556
|
+
const classTokens = [scopedToken, stylesheetTokenHost];
|
|
6557
|
+
const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
|
|
6558
|
+
if (classNames.length) {
|
|
6559
|
+
className = ArrayJoin.call(classNames, ' ');
|
|
6560
|
+
}
|
|
6572
6561
|
}
|
|
6573
6562
|
}
|
|
6574
6563
|
let nodesAreCompatible = true;
|
|
@@ -6811,5 +6800,5 @@ function getComponentConstructor(elm) {
|
|
|
6811
6800
|
return ctor;
|
|
6812
6801
|
}
|
|
6813
6802
|
|
|
6814
|
-
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype,
|
|
6815
|
-
/* version: 2.
|
|
6803
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
6804
|
+
/* version: 2.26.0 */
|