lwc 2.20.2 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +203 -171
- package/dist/engine-dom/iife/es2017/engine-dom.js +203 -171
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +193 -161
- package/dist/engine-dom/iife/es5/engine-dom.js +288 -254
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +278 -243
- package/dist/engine-dom/umd/es2017/engine-dom.js +203 -171
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +193 -161
- package/dist/engine-dom/umd/es5/engine-dom.js +288 -254
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +278 -243
- package/dist/engine-server/commonjs/es2017/engine-server.js +280 -258
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +280 -258
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
350
350
|
return attributeName;
|
|
351
351
|
}
|
|
352
|
-
/** version: 2.
|
|
352
|
+
/** version: 2.21.0 */
|
|
353
353
|
|
|
354
354
|
/*
|
|
355
355
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2913,6 +2913,233 @@
|
|
|
2913
2913
|
methods: publicMethods
|
|
2914
2914
|
};
|
|
2915
2915
|
}
|
|
2916
|
+
/*
|
|
2917
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2918
|
+
* All rights reserved.
|
|
2919
|
+
* SPDX-License-Identifier: MIT
|
|
2920
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2921
|
+
*/
|
|
2922
|
+
|
|
2923
|
+
|
|
2924
|
+
function makeHostToken(token) {
|
|
2925
|
+
return "".concat(token, "-host");
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
function createInlineStyleVNode(content) {
|
|
2929
|
+
return api.h('style', {
|
|
2930
|
+
key: 'style',
|
|
2931
|
+
attrs: {
|
|
2932
|
+
type: 'text/css'
|
|
2933
|
+
}
|
|
2934
|
+
}, [api.t(content)]);
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
function updateStylesheetToken(vm, template) {
|
|
2938
|
+
var elm = vm.elm,
|
|
2939
|
+
context = vm.context,
|
|
2940
|
+
renderMode = vm.renderMode,
|
|
2941
|
+
shadowMode = vm.shadowMode,
|
|
2942
|
+
_vm$renderer = vm.renderer,
|
|
2943
|
+
getClassList = _vm$renderer.getClassList,
|
|
2944
|
+
removeAttribute = _vm$renderer.removeAttribute,
|
|
2945
|
+
setAttribute = _vm$renderer.setAttribute;
|
|
2946
|
+
var newStylesheets = template.stylesheets,
|
|
2947
|
+
newStylesheetToken = template.stylesheetToken;
|
|
2948
|
+
var isSyntheticShadow = renderMode === 1
|
|
2949
|
+
/* RenderMode.Shadow */
|
|
2950
|
+
&& shadowMode === 1
|
|
2951
|
+
/* ShadowMode.Synthetic */
|
|
2952
|
+
;
|
|
2953
|
+
var hasScopedStyles = context.hasScopedStyles;
|
|
2954
|
+
var newToken;
|
|
2955
|
+
var newHasTokenInClass;
|
|
2956
|
+
var newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
2957
|
+
|
|
2958
|
+
var oldToken = context.stylesheetToken,
|
|
2959
|
+
oldHasTokenInClass = context.hasTokenInClass,
|
|
2960
|
+
oldHasTokenInAttribute = context.hasTokenInAttribute;
|
|
2961
|
+
|
|
2962
|
+
if (!isUndefined$1(oldToken)) {
|
|
2963
|
+
if (oldHasTokenInClass) {
|
|
2964
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
if (oldHasTokenInAttribute) {
|
|
2968
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
2969
|
+
}
|
|
2970
|
+
} // Apply the new template styling token to the host element, if the new template has any
|
|
2971
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
2975
|
+
newToken = newStylesheetToken;
|
|
2976
|
+
} // Set the new styling token on the host element
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
if (!isUndefined$1(newToken)) {
|
|
2980
|
+
if (hasScopedStyles) {
|
|
2981
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
2982
|
+
newHasTokenInClass = true;
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
if (isSyntheticShadow) {
|
|
2986
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
2987
|
+
newHasTokenInAttribute = true;
|
|
2988
|
+
}
|
|
2989
|
+
} // Update the styling tokens present on the context object.
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
context.stylesheetToken = newToken;
|
|
2993
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
2994
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
2998
|
+
var content = [];
|
|
2999
|
+
var root;
|
|
3000
|
+
|
|
3001
|
+
for (var _i11 = 0; _i11 < stylesheets.length; _i11++) {
|
|
3002
|
+
var stylesheet = stylesheets[_i11];
|
|
3003
|
+
|
|
3004
|
+
if (isArray$1(stylesheet)) {
|
|
3005
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3006
|
+
} else {
|
|
3007
|
+
|
|
3008
|
+
var isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3009
|
+
|
|
3010
|
+
var scopeToken = isScopedCss || vm.shadowMode === 1
|
|
3011
|
+
/* ShadowMode.Synthetic */
|
|
3012
|
+
&& vm.renderMode === 1
|
|
3013
|
+
/* RenderMode.Shadow */
|
|
3014
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3015
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3016
|
+
|
|
3017
|
+
var useActualHostSelector = vm.renderMode === 0
|
|
3018
|
+
/* RenderMode.Light */
|
|
3019
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
3020
|
+
/* ShadowMode.Native */
|
|
3021
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3022
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
3023
|
+
|
|
3024
|
+
var useNativeDirPseudoclass = void 0;
|
|
3025
|
+
|
|
3026
|
+
if (vm.renderMode === 1
|
|
3027
|
+
/* RenderMode.Shadow */
|
|
3028
|
+
) {
|
|
3029
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
3030
|
+
/* ShadowMode.Native */
|
|
3031
|
+
;
|
|
3032
|
+
} else {
|
|
3033
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
3034
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
3035
|
+
if (isUndefined$1(root)) {
|
|
3036
|
+
// Only calculate the root once as necessary
|
|
3037
|
+
root = getNearestShadowComponent(vm);
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
3041
|
+
/* ShadowMode.Native */
|
|
3042
|
+
;
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
|
|
3049
|
+
return content;
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
function getStylesheetsContent(vm, template) {
|
|
3053
|
+
var stylesheets = template.stylesheets,
|
|
3054
|
+
stylesheetToken = template.stylesheetToken;
|
|
3055
|
+
var content = [];
|
|
3056
|
+
|
|
3057
|
+
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
3058
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
return content;
|
|
3062
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3063
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
3064
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
3065
|
+
|
|
3066
|
+
|
|
3067
|
+
function getNearestShadowComponent(vm) {
|
|
3068
|
+
var owner = vm;
|
|
3069
|
+
|
|
3070
|
+
while (!isNull(owner)) {
|
|
3071
|
+
if (owner.renderMode === 1
|
|
3072
|
+
/* RenderMode.Shadow */
|
|
3073
|
+
) {
|
|
3074
|
+
return owner;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
owner = owner.owner;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
return owner;
|
|
3081
|
+
}
|
|
3082
|
+
/**
|
|
3083
|
+
* If the component that is currently being rendered uses scoped styles,
|
|
3084
|
+
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
3085
|
+
* it returns null.
|
|
3086
|
+
*/
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
function getScopeTokenClass(owner) {
|
|
3090
|
+
var cmpTemplate = owner.cmpTemplate,
|
|
3091
|
+
context = owner.context;
|
|
3092
|
+
return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
function getNearestNativeShadowComponent(vm) {
|
|
3096
|
+
var owner = getNearestShadowComponent(vm);
|
|
3097
|
+
|
|
3098
|
+
if (!isNull(owner) && owner.shadowMode === 1
|
|
3099
|
+
/* ShadowMode.Synthetic */
|
|
3100
|
+
) {
|
|
3101
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
3102
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
3103
|
+
return null;
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
return owner;
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
function createStylesheet(vm, stylesheets) {
|
|
3110
|
+
var renderMode = vm.renderMode,
|
|
3111
|
+
shadowMode = vm.shadowMode,
|
|
3112
|
+
_vm$renderer2 = vm.renderer,
|
|
3113
|
+
ssr = _vm$renderer2.ssr,
|
|
3114
|
+
insertStylesheet = _vm$renderer2.insertStylesheet;
|
|
3115
|
+
|
|
3116
|
+
if (renderMode === 1
|
|
3117
|
+
/* RenderMode.Shadow */
|
|
3118
|
+
&& shadowMode === 1
|
|
3119
|
+
/* ShadowMode.Synthetic */
|
|
3120
|
+
) {
|
|
3121
|
+
for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
|
|
3122
|
+
insertStylesheet(stylesheets[_i12]);
|
|
3123
|
+
}
|
|
3124
|
+
} else if (ssr || vm.hydrated) {
|
|
3125
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3126
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3127
|
+
// the first time the VM renders.
|
|
3128
|
+
// native shadow or light DOM, SSR
|
|
3129
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3130
|
+
} else {
|
|
3131
|
+
// native shadow or light DOM, DOM renderer
|
|
3132
|
+
var root = getNearestNativeShadowComponent(vm); // null root means a global style
|
|
3133
|
+
|
|
3134
|
+
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
3135
|
+
|
|
3136
|
+
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
3137
|
+
insertStylesheet(stylesheets[_i13], target);
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
return null;
|
|
3142
|
+
}
|
|
2916
3143
|
/*
|
|
2917
3144
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
2918
3145
|
* All rights reserved.
|
|
@@ -3250,8 +3477,8 @@
|
|
|
3250
3477
|
|
|
3251
3478
|
var setCSSStyleProperty = renderer.setCSSStyleProperty;
|
|
3252
3479
|
|
|
3253
|
-
for (var
|
|
3254
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
3480
|
+
for (var _i14 = 0; _i14 < styleDecls.length; _i14++) {
|
|
3481
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i14], 3),
|
|
3255
3482
|
prop = _styleDecls$_i[0],
|
|
3256
3483
|
value = _styleDecls$_i[1],
|
|
3257
3484
|
important = _styleDecls$_i[2];
|
|
@@ -3580,15 +3807,13 @@
|
|
|
3580
3807
|
|
|
3581
3808
|
|
|
3582
3809
|
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3583
|
-
var
|
|
3584
|
-
context = owner.context;
|
|
3585
|
-
var getClassList = renderer.getClassList;
|
|
3586
|
-
var token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
3810
|
+
var token = getScopeTokenClass(owner);
|
|
3587
3811
|
|
|
3588
|
-
if (!
|
|
3589
|
-
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3812
|
+
if (!isNull(token)) {
|
|
3813
|
+
var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
|
|
3590
3814
|
// probably we should have a renderer api for just the add operation
|
|
3591
|
-
|
|
3815
|
+
|
|
3816
|
+
_getClassList(elm).add(token);
|
|
3592
3817
|
}
|
|
3593
3818
|
}
|
|
3594
3819
|
|
|
@@ -3738,8 +3963,8 @@
|
|
|
3738
3963
|
var oldSlots = vm.cmpSlots;
|
|
3739
3964
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
3740
3965
|
|
|
3741
|
-
for (var
|
|
3742
|
-
var vnode = children[
|
|
3966
|
+
for (var _i15 = 0, len = children.length; _i15 < len; _i15 += 1) {
|
|
3967
|
+
var vnode = children[_i15];
|
|
3743
3968
|
|
|
3744
3969
|
if (isNull(vnode)) {
|
|
3745
3970
|
continue;
|
|
@@ -3765,8 +3990,8 @@
|
|
|
3765
3990
|
return;
|
|
3766
3991
|
}
|
|
3767
3992
|
|
|
3768
|
-
for (var
|
|
3769
|
-
var key = oldKeys[
|
|
3993
|
+
for (var _i16 = 0, _len4 = oldKeys.length; _i16 < _len4; _i16 += 1) {
|
|
3994
|
+
var key = oldKeys[_i16];
|
|
3770
3995
|
|
|
3771
3996
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
3772
3997
|
markComponentAsDirty(vm);
|
|
@@ -3906,12 +4131,12 @@
|
|
|
3906
4131
|
if (oldStartIdx > oldEndIdx) {
|
|
3907
4132
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
3908
4133
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
3909
|
-
var
|
|
4134
|
+
var _i17 = newEndIdx;
|
|
3910
4135
|
var n;
|
|
3911
4136
|
|
|
3912
4137
|
do {
|
|
3913
|
-
n = newCh[++
|
|
3914
|
-
} while (!isVNode(n) &&
|
|
4138
|
+
n = newCh[++_i17];
|
|
4139
|
+
} while (!isVNode(n) && _i17 < newChEnd);
|
|
3915
4140
|
|
|
3916
4141
|
before = isVNode(n) ? n.elm : null;
|
|
3917
4142
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
@@ -3942,9 +4167,9 @@
|
|
|
3942
4167
|
|
|
3943
4168
|
var anchor = null;
|
|
3944
4169
|
|
|
3945
|
-
for (var
|
|
3946
|
-
var n1 = c1[
|
|
3947
|
-
var n2 = c2[
|
|
4170
|
+
for (var _i18 = c2Length - 1; _i18 >= 0; _i18 -= 1) {
|
|
4171
|
+
var n1 = c1[_i18];
|
|
4172
|
+
var n2 = c2[_i18];
|
|
3948
4173
|
|
|
3949
4174
|
if (n2 !== n1) {
|
|
3950
4175
|
if (isVNode(n1)) {
|
|
@@ -4360,220 +4585,6 @@
|
|
|
4360
4585
|
fid: fid,
|
|
4361
4586
|
shc: shc
|
|
4362
4587
|
});
|
|
4363
|
-
/*
|
|
4364
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4365
|
-
* All rights reserved.
|
|
4366
|
-
* SPDX-License-Identifier: MIT
|
|
4367
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4368
|
-
*/
|
|
4369
|
-
|
|
4370
|
-
function makeHostToken(token) {
|
|
4371
|
-
return "".concat(token, "-host");
|
|
4372
|
-
}
|
|
4373
|
-
|
|
4374
|
-
function createInlineStyleVNode(content) {
|
|
4375
|
-
return api.h('style', {
|
|
4376
|
-
key: 'style',
|
|
4377
|
-
attrs: {
|
|
4378
|
-
type: 'text/css'
|
|
4379
|
-
}
|
|
4380
|
-
}, [api.t(content)]);
|
|
4381
|
-
}
|
|
4382
|
-
|
|
4383
|
-
function updateStylesheetToken(vm, template) {
|
|
4384
|
-
var elm = vm.elm,
|
|
4385
|
-
context = vm.context,
|
|
4386
|
-
renderMode = vm.renderMode,
|
|
4387
|
-
shadowMode = vm.shadowMode,
|
|
4388
|
-
_vm$renderer = vm.renderer,
|
|
4389
|
-
getClassList = _vm$renderer.getClassList,
|
|
4390
|
-
removeAttribute = _vm$renderer.removeAttribute,
|
|
4391
|
-
setAttribute = _vm$renderer.setAttribute;
|
|
4392
|
-
var newStylesheets = template.stylesheets,
|
|
4393
|
-
newStylesheetToken = template.stylesheetToken;
|
|
4394
|
-
var isSyntheticShadow = renderMode === 1
|
|
4395
|
-
/* RenderMode.Shadow */
|
|
4396
|
-
&& shadowMode === 1
|
|
4397
|
-
/* ShadowMode.Synthetic */
|
|
4398
|
-
;
|
|
4399
|
-
var hasScopedStyles = context.hasScopedStyles;
|
|
4400
|
-
var newToken;
|
|
4401
|
-
var newHasTokenInClass;
|
|
4402
|
-
var newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
4403
|
-
|
|
4404
|
-
var oldToken = context.stylesheetToken,
|
|
4405
|
-
oldHasTokenInClass = context.hasTokenInClass,
|
|
4406
|
-
oldHasTokenInAttribute = context.hasTokenInAttribute;
|
|
4407
|
-
|
|
4408
|
-
if (!isUndefined$1(oldToken)) {
|
|
4409
|
-
if (oldHasTokenInClass) {
|
|
4410
|
-
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4411
|
-
}
|
|
4412
|
-
|
|
4413
|
-
if (oldHasTokenInAttribute) {
|
|
4414
|
-
removeAttribute(elm, makeHostToken(oldToken));
|
|
4415
|
-
}
|
|
4416
|
-
} // Apply the new template styling token to the host element, if the new template has any
|
|
4417
|
-
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
4421
|
-
newToken = newStylesheetToken;
|
|
4422
|
-
} // Set the new styling token on the host element
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
if (!isUndefined$1(newToken)) {
|
|
4426
|
-
if (hasScopedStyles) {
|
|
4427
|
-
getClassList(elm).add(makeHostToken(newToken));
|
|
4428
|
-
newHasTokenInClass = true;
|
|
4429
|
-
}
|
|
4430
|
-
|
|
4431
|
-
if (isSyntheticShadow) {
|
|
4432
|
-
setAttribute(elm, makeHostToken(newToken), '');
|
|
4433
|
-
newHasTokenInAttribute = true;
|
|
4434
|
-
}
|
|
4435
|
-
} // Update the styling tokens present on the context object.
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
context.stylesheetToken = newToken;
|
|
4439
|
-
context.hasTokenInClass = newHasTokenInClass;
|
|
4440
|
-
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
4441
|
-
}
|
|
4442
|
-
|
|
4443
|
-
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
4444
|
-
var content = [];
|
|
4445
|
-
var root;
|
|
4446
|
-
|
|
4447
|
-
for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
|
|
4448
|
-
var stylesheet = stylesheets[_i16];
|
|
4449
|
-
|
|
4450
|
-
if (isArray$1(stylesheet)) {
|
|
4451
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
4452
|
-
} else {
|
|
4453
|
-
|
|
4454
|
-
var isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
4455
|
-
|
|
4456
|
-
var scopeToken = isScopedCss || vm.shadowMode === 1
|
|
4457
|
-
/* ShadowMode.Synthetic */
|
|
4458
|
-
&& vm.renderMode === 1
|
|
4459
|
-
/* RenderMode.Shadow */
|
|
4460
|
-
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
4461
|
-
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4462
|
-
|
|
4463
|
-
var useActualHostSelector = vm.renderMode === 0
|
|
4464
|
-
/* RenderMode.Light */
|
|
4465
|
-
? !isScopedCss : vm.shadowMode === 0
|
|
4466
|
-
/* ShadowMode.Native */
|
|
4467
|
-
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
4468
|
-
// we use an attribute selector on the host to simulate :dir().
|
|
4469
|
-
|
|
4470
|
-
var useNativeDirPseudoclass = void 0;
|
|
4471
|
-
|
|
4472
|
-
if (vm.renderMode === 1
|
|
4473
|
-
/* RenderMode.Shadow */
|
|
4474
|
-
) {
|
|
4475
|
-
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
4476
|
-
/* ShadowMode.Native */
|
|
4477
|
-
;
|
|
4478
|
-
} else {
|
|
4479
|
-
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
4480
|
-
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
4481
|
-
if (isUndefined$1(root)) {
|
|
4482
|
-
// Only calculate the root once as necessary
|
|
4483
|
-
root = getNearestShadowComponent(vm);
|
|
4484
|
-
}
|
|
4485
|
-
|
|
4486
|
-
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
4487
|
-
/* ShadowMode.Native */
|
|
4488
|
-
;
|
|
4489
|
-
}
|
|
4490
|
-
|
|
4491
|
-
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
4492
|
-
}
|
|
4493
|
-
}
|
|
4494
|
-
|
|
4495
|
-
return content;
|
|
4496
|
-
}
|
|
4497
|
-
|
|
4498
|
-
function getStylesheetsContent(vm, template) {
|
|
4499
|
-
var stylesheets = template.stylesheets,
|
|
4500
|
-
stylesheetToken = template.stylesheetToken;
|
|
4501
|
-
var content = [];
|
|
4502
|
-
|
|
4503
|
-
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
4504
|
-
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
4505
|
-
}
|
|
4506
|
-
|
|
4507
|
-
return content;
|
|
4508
|
-
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
4509
|
-
// perf testing has not shown it to be a huge improvement yet:
|
|
4510
|
-
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
function getNearestShadowComponent(vm) {
|
|
4514
|
-
var owner = vm;
|
|
4515
|
-
|
|
4516
|
-
while (!isNull(owner)) {
|
|
4517
|
-
if (owner.renderMode === 1
|
|
4518
|
-
/* RenderMode.Shadow */
|
|
4519
|
-
) {
|
|
4520
|
-
return owner;
|
|
4521
|
-
}
|
|
4522
|
-
|
|
4523
|
-
owner = owner.owner;
|
|
4524
|
-
}
|
|
4525
|
-
|
|
4526
|
-
return owner;
|
|
4527
|
-
}
|
|
4528
|
-
|
|
4529
|
-
function getNearestNativeShadowComponent(vm) {
|
|
4530
|
-
var owner = getNearestShadowComponent(vm);
|
|
4531
|
-
|
|
4532
|
-
if (!isNull(owner) && owner.shadowMode === 1
|
|
4533
|
-
/* ShadowMode.Synthetic */
|
|
4534
|
-
) {
|
|
4535
|
-
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
4536
|
-
// synthetic, we know we won't find a native component if we go any further.
|
|
4537
|
-
return null;
|
|
4538
|
-
}
|
|
4539
|
-
|
|
4540
|
-
return owner;
|
|
4541
|
-
}
|
|
4542
|
-
|
|
4543
|
-
function createStylesheet(vm, stylesheets) {
|
|
4544
|
-
var renderMode = vm.renderMode,
|
|
4545
|
-
shadowMode = vm.shadowMode,
|
|
4546
|
-
_vm$renderer2 = vm.renderer,
|
|
4547
|
-
ssr = _vm$renderer2.ssr,
|
|
4548
|
-
insertStylesheet = _vm$renderer2.insertStylesheet;
|
|
4549
|
-
|
|
4550
|
-
if (renderMode === 1
|
|
4551
|
-
/* RenderMode.Shadow */
|
|
4552
|
-
&& shadowMode === 1
|
|
4553
|
-
/* ShadowMode.Synthetic */
|
|
4554
|
-
) {
|
|
4555
|
-
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
4556
|
-
insertStylesheet(stylesheets[_i17]);
|
|
4557
|
-
}
|
|
4558
|
-
} else if (ssr || vm.hydrated) {
|
|
4559
|
-
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4560
|
-
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4561
|
-
// the first time the VM renders.
|
|
4562
|
-
// native shadow or light DOM, SSR
|
|
4563
|
-
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4564
|
-
} else {
|
|
4565
|
-
// native shadow or light DOM, DOM renderer
|
|
4566
|
-
var root = getNearestNativeShadowComponent(vm); // null root means a global style
|
|
4567
|
-
|
|
4568
|
-
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
4569
|
-
|
|
4570
|
-
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
4571
|
-
insertStylesheet(stylesheets[_i18], target);
|
|
4572
|
-
}
|
|
4573
|
-
}
|
|
4574
|
-
|
|
4575
|
-
return null;
|
|
4576
|
-
}
|
|
4577
4588
|
/** Indicates if operations should be logged by the profiler. */
|
|
4578
4589
|
|
|
4579
4590
|
var isProfilerEnabled = false;
|
|
@@ -6286,11 +6297,27 @@
|
|
|
6286
6297
|
}
|
|
6287
6298
|
|
|
6288
6299
|
function validateClassAttr(vnode, elm, renderer) {
|
|
6289
|
-
var
|
|
6290
|
-
|
|
6291
|
-
|
|
6300
|
+
var data = vnode.data,
|
|
6301
|
+
owner = vnode.owner;
|
|
6302
|
+
var className = data.className,
|
|
6303
|
+
classMap = data.classMap;
|
|
6292
6304
|
var getProperty = renderer.getProperty,
|
|
6293
6305
|
getClassList = renderer.getClassList;
|
|
6306
|
+
var scopedToken = getScopeTokenClass(owner); // Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
6307
|
+
// or to the VDOM on the server in the case of SSR. As such, these classnames
|
|
6308
|
+
// are never present in VDOM nodes in the browser.
|
|
6309
|
+
//
|
|
6310
|
+
// Consequently, hydration mismatches will occur if scoped CSS token classnames
|
|
6311
|
+
// are rendered during SSR. This needs to be accounted for when validating.
|
|
6312
|
+
|
|
6313
|
+
if (scopedToken) {
|
|
6314
|
+
if (!isUndefined$1(className)) {
|
|
6315
|
+
className = "".concat(scopedToken, " ").concat(className);
|
|
6316
|
+
} else if (!isUndefined$1(classMap)) {
|
|
6317
|
+
classMap = Object.assign(Object.assign({}, classMap), _defineProperty({}, scopedToken, true));
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6320
|
+
|
|
6294
6321
|
var nodesAreCompatible = true;
|
|
6295
6322
|
|
|
6296
6323
|
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
@@ -6320,9 +6347,9 @@
|
|
|
6320
6347
|
}
|
|
6321
6348
|
|
|
6322
6349
|
function validateStyleAttr(vnode, elm, renderer) {
|
|
6323
|
-
var _vnode$
|
|
6324
|
-
style = _vnode$
|
|
6325
|
-
styleDecls = _vnode$
|
|
6350
|
+
var _vnode$data = vnode.data,
|
|
6351
|
+
style = _vnode$data.style,
|
|
6352
|
+
styleDecls = _vnode$data.styleDecls;
|
|
6326
6353
|
var getAttribute = renderer.getAttribute;
|
|
6327
6354
|
var elmStyle = getAttribute(elm, 'style') || '';
|
|
6328
6355
|
var nodesAreCompatible = true;
|
|
@@ -6458,7 +6485,7 @@
|
|
|
6458
6485
|
|
|
6459
6486
|
return ctor;
|
|
6460
6487
|
}
|
|
6461
|
-
/* version: 2.
|
|
6488
|
+
/* version: 2.21.0 */
|
|
6462
6489
|
|
|
6463
6490
|
/*
|
|
6464
6491
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6746,7 +6773,15 @@
|
|
|
6746
6773
|
}
|
|
6747
6774
|
|
|
6748
6775
|
function attachShadow(element, options) {
|
|
6749
|
-
|
|
6776
|
+
// `hydrating` will be true in two cases:
|
|
6777
|
+
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
6778
|
+
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
6779
|
+
// root component with customeElement.define('c-app', Ctor)
|
|
6780
|
+
//
|
|
6781
|
+
// The second case can be treated as a failed hydration with nominal impact
|
|
6782
|
+
// to performance. However, because <c-app> won't have a <template shadowroot>
|
|
6783
|
+
// declarative child, `element.shadowRoot` is `null`.
|
|
6784
|
+
if (hydrating && element.shadowRoot) {
|
|
6750
6785
|
return element.shadowRoot;
|
|
6751
6786
|
}
|
|
6752
6787
|
|
|
@@ -7257,7 +7292,7 @@
|
|
|
7257
7292
|
});
|
|
7258
7293
|
freeze(LightningElement);
|
|
7259
7294
|
seal(LightningElement.prototype);
|
|
7260
|
-
/* version: 2.
|
|
7295
|
+
/* version: 2.21.0 */
|
|
7261
7296
|
|
|
7262
7297
|
exports.LightningElement = LightningElement;
|
|
7263
7298
|
exports.__unstable__ProfilerControl = profilerControl;
|