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