lwc 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-dom/esm/es2017/engine-dom.js +1103 -533
- package/dist/engine-dom/iife/es2017/engine-dom.js +1103 -533
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +942 -320
- package/dist/engine-dom/iife/es5/engine-dom.js +966 -312
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +895 -225
- package/dist/engine-dom/umd/es2017/engine-dom.js +1103 -533
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +942 -320
- package/dist/engine-dom/umd/es5/engine-dom.js +966 -312
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +895 -225
- package/dist/engine-server/commonjs/es2017/engine-server.js +331 -339
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +331 -339
- 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
|
@@ -436,9 +436,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
436
436
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
437
437
|
*/
|
|
438
438
|
// Increment whenever the LWC template compiler changes
|
|
439
|
-
const LWC_VERSION = "2.
|
|
439
|
+
const LWC_VERSION = "2.26.0";
|
|
440
440
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
441
|
-
/** version: 2.
|
|
441
|
+
/** version: 2.26.0 */
|
|
442
442
|
|
|
443
443
|
/*
|
|
444
444
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -486,7 +486,6 @@ const features = {
|
|
|
486
486
|
DUMMY_TEST_FLAG: null,
|
|
487
487
|
ENABLE_ELEMENT_PATCH: null,
|
|
488
488
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
489
|
-
ENABLE_HMR: null,
|
|
490
489
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
491
490
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
492
491
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
@@ -496,6 +495,8 @@ const features = {
|
|
|
496
495
|
ENABLE_REACTIVE_SETTER: null,
|
|
497
496
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
498
497
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
498
|
+
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
499
|
+
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
499
500
|
};
|
|
500
501
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
501
502
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -549,7 +550,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
549
550
|
setFeatureFlag(name, value);
|
|
550
551
|
}
|
|
551
552
|
}
|
|
552
|
-
/** version: 2.
|
|
553
|
+
/** version: 2.26.0 */
|
|
553
554
|
|
|
554
555
|
/* proxy-compat-disable */
|
|
555
556
|
|
|
@@ -1858,7 +1859,9 @@ const refsCache = new WeakMap();
|
|
|
1858
1859
|
const LightningElement = function () {
|
|
1859
1860
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1860
1861
|
if (isNull(vmBeingConstructed)) {
|
|
1861
|
-
|
|
1862
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1863
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1864
|
+
throw new TypeError('Illegal constructor');
|
|
1862
1865
|
}
|
|
1863
1866
|
const vm = vmBeingConstructed;
|
|
1864
1867
|
const { def, elm } = vm;
|
|
@@ -2879,157 +2882,120 @@ const swappedStyleMap = new WeakMap();
|
|
|
2879
2882
|
const activeTemplates = new WeakMap();
|
|
2880
2883
|
const activeComponents = new WeakMap();
|
|
2881
2884
|
const activeStyles = new WeakMap();
|
|
2882
|
-
|
|
2883
2885
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2886
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2887
|
+
// this method should never leak to prod
|
|
2888
|
+
throw new ReferenceError();
|
|
2889
|
+
}
|
|
2890
2890
|
const visited = new Set();
|
|
2891
|
-
|
|
2892
2891
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
2893
|
-
|
|
2894
|
-
|
|
2892
|
+
visited.add(tpl);
|
|
2893
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
2895
2894
|
}
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
return tpl;
|
|
2895
|
+
return tpl;
|
|
2899
2896
|
}
|
|
2900
2897
|
function getComponentOrSwappedComponent(Ctor) {
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2898
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2899
|
+
// this method should never leak to prod
|
|
2900
|
+
throw new ReferenceError();
|
|
2901
|
+
}
|
|
2907
2902
|
const visited = new Set();
|
|
2908
|
-
|
|
2909
2903
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
2910
|
-
|
|
2911
|
-
|
|
2904
|
+
visited.add(Ctor);
|
|
2905
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
2912
2906
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
return Ctor;
|
|
2907
|
+
return Ctor;
|
|
2916
2908
|
}
|
|
2917
2909
|
function getStyleOrSwappedStyle(style) {
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2910
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2911
|
+
// this method should never leak to prod
|
|
2912
|
+
throw new ReferenceError();
|
|
2913
|
+
}
|
|
2924
2914
|
const visited = new Set();
|
|
2925
|
-
|
|
2926
2915
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
2927
|
-
|
|
2928
|
-
|
|
2916
|
+
visited.add(style);
|
|
2917
|
+
style = swappedStyleMap.get(style);
|
|
2929
2918
|
}
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
return style;
|
|
2919
|
+
return style;
|
|
2933
2920
|
}
|
|
2934
2921
|
function setActiveVM(vm) {
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2922
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2923
|
+
// this method should never leak to prod
|
|
2924
|
+
throw new ReferenceError();
|
|
2925
|
+
}
|
|
2941
2926
|
// tracking active component
|
|
2942
2927
|
const Ctor = vm.def.ctor;
|
|
2943
2928
|
let componentVMs = activeComponents.get(Ctor);
|
|
2944
|
-
|
|
2945
2929
|
if (isUndefined$1(componentVMs)) {
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
}
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2930
|
+
componentVMs = new Set();
|
|
2931
|
+
activeComponents.set(Ctor, componentVMs);
|
|
2932
|
+
}
|
|
2933
|
+
// this will allow us to keep track of the hot components
|
|
2934
|
+
componentVMs.add(vm);
|
|
2935
|
+
// tracking active template
|
|
2953
2936
|
const tpl = vm.cmpTemplate;
|
|
2954
|
-
|
|
2955
2937
|
if (tpl) {
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
stylesheetVMs.add(vm);
|
|
2986
|
-
});
|
|
2987
|
-
}
|
|
2938
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
2939
|
+
if (isUndefined$1(templateVMs)) {
|
|
2940
|
+
templateVMs = new Set();
|
|
2941
|
+
activeTemplates.set(tpl, templateVMs);
|
|
2942
|
+
}
|
|
2943
|
+
// this will allow us to keep track of the templates that are
|
|
2944
|
+
// being used by a hot component
|
|
2945
|
+
templateVMs.add(vm);
|
|
2946
|
+
// tracking active styles associated to template
|
|
2947
|
+
const stylesheets = tpl.stylesheets;
|
|
2948
|
+
if (!isUndefined$1(stylesheets)) {
|
|
2949
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
2950
|
+
// this is necessary because we don't hold the list of styles
|
|
2951
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
2952
|
+
// but the styles attached to the template might not be the actual
|
|
2953
|
+
// active ones, but the swapped versions of those.
|
|
2954
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
2955
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
2956
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
2957
|
+
stylesheetVMs = new Set();
|
|
2958
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
2959
|
+
}
|
|
2960
|
+
// this will allow us to keep track of the stylesheet that are
|
|
2961
|
+
// being used by a hot component
|
|
2962
|
+
stylesheetVMs.add(vm);
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2988
2965
|
}
|
|
2989
|
-
}
|
|
2990
2966
|
}
|
|
2991
2967
|
function removeActiveVM(vm) {
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
if (lwcRuntimeFlags.ENABLE_HMR) {
|
|
2968
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2969
|
+
// this method should never leak to prod
|
|
2970
|
+
throw new ReferenceError();
|
|
2971
|
+
}
|
|
2998
2972
|
// tracking inactive component
|
|
2999
2973
|
const Ctor = vm.def.ctor;
|
|
3000
2974
|
let list = activeComponents.get(Ctor);
|
|
3001
|
-
|
|
3002
2975
|
if (!isUndefined$1(list)) {
|
|
3003
|
-
// deleting the vm from the set to avoid leaking memory
|
|
3004
|
-
list.delete(vm);
|
|
3005
|
-
} // removing inactive template
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
const tpl = vm.cmpTemplate;
|
|
3009
|
-
|
|
3010
|
-
if (tpl) {
|
|
3011
|
-
list = activeTemplates.get(tpl);
|
|
3012
|
-
|
|
3013
|
-
if (!isUndefined$1(list)) {
|
|
3014
2976
|
// deleting the vm from the set to avoid leaking memory
|
|
3015
2977
|
list.delete(vm);
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
flattenStylesheets(styles).forEach(style => {
|
|
3023
|
-
list = activeStyles.get(style);
|
|
3024
|
-
|
|
3025
|
-
if (!isUndefined$1(list)) {
|
|
2978
|
+
}
|
|
2979
|
+
// removing inactive template
|
|
2980
|
+
const tpl = vm.cmpTemplate;
|
|
2981
|
+
if (tpl) {
|
|
2982
|
+
list = activeTemplates.get(tpl);
|
|
2983
|
+
if (!isUndefined$1(list)) {
|
|
3026
2984
|
// deleting the vm from the set to avoid leaking memory
|
|
3027
2985
|
list.delete(vm);
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
2986
|
+
}
|
|
2987
|
+
// removing active styles associated to template
|
|
2988
|
+
const styles = tpl.stylesheets;
|
|
2989
|
+
if (!isUndefined$1(styles)) {
|
|
2990
|
+
flattenStylesheets(styles).forEach((style) => {
|
|
2991
|
+
list = activeStyles.get(style);
|
|
2992
|
+
if (!isUndefined$1(list)) {
|
|
2993
|
+
// deleting the vm from the set to avoid leaking memory
|
|
2994
|
+
list.delete(vm);
|
|
2995
|
+
}
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
3031
2998
|
}
|
|
3032
|
-
}
|
|
3033
2999
|
}
|
|
3034
3000
|
|
|
3035
3001
|
/*
|
|
@@ -3232,218 +3198,234 @@ function getComponentDef(Ctor) {
|
|
|
3232
3198
|
* SPDX-License-Identifier: MIT
|
|
3233
3199
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3234
3200
|
*/
|
|
3201
|
+
|
|
3235
3202
|
function makeHostToken(token) {
|
|
3236
|
-
|
|
3203
|
+
return `${token}-host`;
|
|
3237
3204
|
}
|
|
3205
|
+
|
|
3238
3206
|
function createInlineStyleVNode(content) {
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3207
|
+
return api.h('style', {
|
|
3208
|
+
key: 'style',
|
|
3209
|
+
attrs: {
|
|
3210
|
+
type: 'text/css'
|
|
3211
|
+
}
|
|
3212
|
+
}, [api.t(content)]);
|
|
3245
3213
|
}
|
|
3214
|
+
|
|
3246
3215
|
function updateStylesheetToken(vm, template) {
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3216
|
+
const {
|
|
3217
|
+
elm,
|
|
3218
|
+
context,
|
|
3219
|
+
renderMode,
|
|
3220
|
+
shadowMode,
|
|
3221
|
+
renderer: {
|
|
3222
|
+
getClassList,
|
|
3223
|
+
removeAttribute,
|
|
3224
|
+
setAttribute
|
|
3225
|
+
}
|
|
3226
|
+
} = vm;
|
|
3227
|
+
const {
|
|
3228
|
+
stylesheets: newStylesheets,
|
|
3229
|
+
stylesheetToken: newStylesheetToken
|
|
3230
|
+
} = template;
|
|
3231
|
+
const isSyntheticShadow = renderMode === 1
|
|
3232
|
+
/* RenderMode.Shadow */
|
|
3233
|
+
&& shadowMode === 1
|
|
3234
|
+
/* ShadowMode.Synthetic */
|
|
3235
|
+
;
|
|
3236
|
+
const {
|
|
3237
|
+
hasScopedStyles
|
|
3238
|
+
} = context;
|
|
3239
|
+
let newToken;
|
|
3240
|
+
let newHasTokenInClass;
|
|
3241
|
+
let newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
3242
|
+
|
|
3243
|
+
const {
|
|
3244
|
+
stylesheetToken: oldToken,
|
|
3245
|
+
hasTokenInClass: oldHasTokenInClass,
|
|
3246
|
+
hasTokenInAttribute: oldHasTokenInAttribute
|
|
3247
|
+
} = context;
|
|
3248
|
+
|
|
3249
|
+
if (!isUndefined$1(oldToken)) {
|
|
3250
|
+
if (oldHasTokenInClass) {
|
|
3251
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
if (oldHasTokenInAttribute) {
|
|
3255
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
3256
|
+
}
|
|
3257
|
+
} // Apply the new template styling token to the host element, if the new template has any
|
|
3258
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3259
|
+
|
|
3260
|
+
|
|
3261
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
3262
|
+
newToken = newStylesheetToken;
|
|
3263
|
+
} // Set the new styling token on the host element
|
|
3264
|
+
|
|
3265
|
+
|
|
3266
|
+
if (!isUndefined$1(newToken)) {
|
|
3267
|
+
if (hasScopedStyles) {
|
|
3268
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
3269
|
+
newHasTokenInClass = true;
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
if (isSyntheticShadow) {
|
|
3273
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
3274
|
+
newHasTokenInAttribute = true;
|
|
3275
|
+
}
|
|
3276
|
+
} // Update the styling tokens present on the context object.
|
|
3277
|
+
|
|
3278
|
+
|
|
3279
|
+
context.stylesheetToken = newToken;
|
|
3280
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
3281
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
3284
3282
|
}
|
|
3283
|
+
|
|
3285
3284
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3285
|
+
const content = [];
|
|
3286
|
+
let root;
|
|
3287
|
+
|
|
3288
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3289
|
+
let stylesheet = stylesheets[i];
|
|
3290
|
+
|
|
3291
|
+
if (isArray$1(stylesheet)) {
|
|
3292
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3293
|
+
} else {
|
|
3294
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3295
|
+
// Check for compiler version mismatch in dev mode only
|
|
3296
|
+
checkVersionMismatch(stylesheet, 'stylesheet'); // in dev-mode, we support hot swapping of stylesheet, which means that
|
|
3297
|
+
// the component instance might be attempting to use an old version of
|
|
3298
|
+
// the stylesheet, while internally, we have a replacement for it.
|
|
3299
|
+
|
|
3300
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3304
|
+
|
|
3305
|
+
if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
|
|
3306
|
+
if (!isScopedCss && vm.renderMode === 0
|
|
3307
|
+
/* RenderMode.Light */
|
|
3308
|
+
) {
|
|
3309
|
+
logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
|
|
3310
|
+
continue;
|
|
3292
3311
|
}
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
root = getNearestShadowComponent(vm);
|
|
3325
|
-
}
|
|
3326
|
-
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3327
|
-
}
|
|
3328
|
-
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3312
|
+
} // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3313
|
+
|
|
3314
|
+
|
|
3315
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
3316
|
+
/* ShadowMode.Synthetic */
|
|
3317
|
+
&& vm.renderMode === 1
|
|
3318
|
+
/* RenderMode.Shadow */
|
|
3319
|
+
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3320
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3321
|
+
|
|
3322
|
+
const useActualHostSelector = vm.renderMode === 0
|
|
3323
|
+
/* RenderMode.Light */
|
|
3324
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
3325
|
+
/* ShadowMode.Native */
|
|
3326
|
+
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3327
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
3328
|
+
|
|
3329
|
+
let useNativeDirPseudoclass;
|
|
3330
|
+
|
|
3331
|
+
if (vm.renderMode === 1
|
|
3332
|
+
/* RenderMode.Shadow */
|
|
3333
|
+
) {
|
|
3334
|
+
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
3335
|
+
/* ShadowMode.Native */
|
|
3336
|
+
;
|
|
3337
|
+
} else {
|
|
3338
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
3339
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
3340
|
+
if (isUndefined$1(root)) {
|
|
3341
|
+
// Only calculate the root once as necessary
|
|
3342
|
+
root = getNearestShadowComponent(vm);
|
|
3329
3343
|
}
|
|
3344
|
+
|
|
3345
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
|
|
3346
|
+
/* ShadowMode.Native */
|
|
3347
|
+
;
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3330
3351
|
}
|
|
3331
|
-
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
return content;
|
|
3332
3355
|
}
|
|
3356
|
+
|
|
3333
3357
|
function getStylesheetsContent(vm, template) {
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3358
|
+
const {
|
|
3359
|
+
stylesheets,
|
|
3360
|
+
stylesheetToken
|
|
3361
|
+
} = template;
|
|
3362
|
+
let content = [];
|
|
3363
|
+
|
|
3364
|
+
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
3365
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3368
|
+
return content;
|
|
3369
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3342
3370
|
// perf testing has not shown it to be a huge improvement yet:
|
|
3343
3371
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
3372
|
+
|
|
3344
3373
|
function getNearestShadowComponent(vm) {
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3374
|
+
let owner = vm;
|
|
3375
|
+
|
|
3376
|
+
while (!isNull(owner)) {
|
|
3377
|
+
if (owner.renderMode === 1
|
|
3378
|
+
/* RenderMode.Shadow */
|
|
3379
|
+
) {
|
|
3380
|
+
return owner;
|
|
3351
3381
|
}
|
|
3352
|
-
|
|
3382
|
+
|
|
3383
|
+
owner = owner.owner;
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
return owner;
|
|
3353
3387
|
}
|
|
3354
3388
|
/**
|
|
3355
3389
|
* If the component that is currently being rendered uses scoped styles,
|
|
3356
3390
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
3357
3391
|
* it returns null.
|
|
3358
3392
|
*/
|
|
3359
|
-
function getScopeTokenClass(owner) {
|
|
3360
|
-
const { cmpTemplate, context } = owner;
|
|
3361
|
-
return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
|
|
3362
|
-
}
|
|
3363
|
-
function createStylesheet(vm, stylesheets) {
|
|
3364
|
-
const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
|
|
3365
|
-
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3366
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
3367
|
-
insertStylesheet(stylesheets[i]);
|
|
3368
|
-
}
|
|
3369
|
-
}
|
|
3370
|
-
else {
|
|
3371
|
-
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3372
|
-
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3373
|
-
// the first time the VM renders.
|
|
3374
|
-
// native shadow or light DOM, SSR
|
|
3375
|
-
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3376
|
-
}
|
|
3377
|
-
return null;
|
|
3378
|
-
}
|
|
3379
3393
|
|
|
3380
|
-
/*
|
|
3381
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
3382
|
-
* All rights reserved.
|
|
3383
|
-
* SPDX-License-Identifier: MIT
|
|
3384
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3385
|
-
*/
|
|
3386
3394
|
|
|
3387
|
-
function
|
|
3388
|
-
const
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
logError(`VM for tag name "${elm.tagName.toLowerCase()}" is undefined. ` + `This indicates that an element was created with this tag name, ` + `which is already reserved by an LWC component. Use lwc.createElement ` + `instead to create elements.`);
|
|
3394
|
-
}
|
|
3395
|
-
|
|
3396
|
-
return hasVM;
|
|
3395
|
+
function getScopeTokenClass(owner) {
|
|
3396
|
+
const {
|
|
3397
|
+
cmpTemplate,
|
|
3398
|
+
context
|
|
3399
|
+
} = owner;
|
|
3400
|
+
return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
|
|
3397
3401
|
}
|
|
3398
3402
|
|
|
3399
|
-
function
|
|
3403
|
+
function createStylesheet(vm, stylesheets) {
|
|
3400
3404
|
const {
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
// produce only tags with lowercase letters
|
|
3406
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
3407
|
-
|
|
3408
|
-
tagName = tagName.toLowerCase();
|
|
3409
|
-
let CE = getCustomElement(tagName);
|
|
3410
|
-
|
|
3411
|
-
if (!isUndefined$1(CE)) {
|
|
3412
|
-
return CE;
|
|
3413
|
-
}
|
|
3414
|
-
/**
|
|
3415
|
-
* LWC Upgradable Element reference to an element that was created
|
|
3416
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
3417
|
-
*/
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
3421
|
-
constructor(upgradeCallback) {
|
|
3422
|
-
super();
|
|
3423
|
-
|
|
3424
|
-
if (isFunction$1(upgradeCallback)) {
|
|
3425
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
3426
|
-
}
|
|
3405
|
+
renderMode,
|
|
3406
|
+
shadowMode,
|
|
3407
|
+
renderer: {
|
|
3408
|
+
insertStylesheet
|
|
3427
3409
|
}
|
|
3410
|
+
} = vm;
|
|
3428
3411
|
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
}
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3412
|
+
if (renderMode === 1
|
|
3413
|
+
/* RenderMode.Shadow */
|
|
3414
|
+
&& shadowMode === 1
|
|
3415
|
+
/* ShadowMode.Synthetic */
|
|
3416
|
+
) {
|
|
3417
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3418
|
+
insertStylesheet(stylesheets[i]);
|
|
3419
|
+
}
|
|
3420
|
+
} else {
|
|
3421
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3422
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3423
|
+
// the first time the VM renders.
|
|
3424
|
+
// native shadow or light DOM, SSR
|
|
3425
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3443
3426
|
}
|
|
3444
3427
|
|
|
3445
|
-
|
|
3446
|
-
return CE;
|
|
3428
|
+
return null;
|
|
3447
3429
|
}
|
|
3448
3430
|
|
|
3449
3431
|
/*
|
|
@@ -3948,7 +3930,9 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3948
3930
|
sel,
|
|
3949
3931
|
owner
|
|
3950
3932
|
} = vnode;
|
|
3951
|
-
const
|
|
3933
|
+
const {
|
|
3934
|
+
createCustomElement
|
|
3935
|
+
} = renderer;
|
|
3952
3936
|
/**
|
|
3953
3937
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3954
3938
|
* with a callback as the first argument, we could implement a more advanced
|
|
@@ -3957,10 +3941,25 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3957
3941
|
*/
|
|
3958
3942
|
|
|
3959
3943
|
let vm;
|
|
3960
|
-
|
|
3944
|
+
|
|
3945
|
+
const upgradeCallback = elm => {
|
|
3961
3946
|
// the custom element from the registry is expecting an upgrade callback
|
|
3962
3947
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
3963
|
-
}
|
|
3948
|
+
};
|
|
3949
|
+
|
|
3950
|
+
const connectedCallback = elm => {
|
|
3951
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3952
|
+
connectRootElement(elm);
|
|
3953
|
+
}
|
|
3954
|
+
};
|
|
3955
|
+
|
|
3956
|
+
const disconnectedCallback = elm => {
|
|
3957
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3958
|
+
disconnectRootElement(elm);
|
|
3959
|
+
}
|
|
3960
|
+
};
|
|
3961
|
+
|
|
3962
|
+
const elm = createCustomElement(sel, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
3964
3963
|
vnode.elm = elm;
|
|
3965
3964
|
vnode.vm = vm;
|
|
3966
3965
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -3968,8 +3967,6 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3968
3967
|
|
|
3969
3968
|
if (vm) {
|
|
3970
3969
|
allocateChildren(vnode, vm);
|
|
3971
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
3972
|
-
throw new TypeError(`Incorrect Component Constructor`);
|
|
3973
3970
|
}
|
|
3974
3971
|
|
|
3975
3972
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
@@ -6411,7 +6408,7 @@ function freezeTemplate(tmpl) {
|
|
|
6411
6408
|
});
|
|
6412
6409
|
}
|
|
6413
6410
|
}
|
|
6414
|
-
/* version: 2.
|
|
6411
|
+
/* version: 2.26.0 */
|
|
6415
6412
|
|
|
6416
6413
|
/*
|
|
6417
6414
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6475,25 +6472,6 @@ function createElement(tagName, namespace) {
|
|
|
6475
6472
|
[HostEventListenersKey]: {},
|
|
6476
6473
|
};
|
|
6477
6474
|
}
|
|
6478
|
-
const registry = create(null);
|
|
6479
|
-
const reverseRegistry = new WeakMap();
|
|
6480
|
-
function registerCustomElement(name, ctor) {
|
|
6481
|
-
if (name !== StringToLowerCase.call(name) || registry[name]) {
|
|
6482
|
-
throw new TypeError(`Invalid Registration`);
|
|
6483
|
-
}
|
|
6484
|
-
registry[name] = ctor;
|
|
6485
|
-
reverseRegistry.set(ctor, name);
|
|
6486
|
-
}
|
|
6487
|
-
class HTMLElementImpl {
|
|
6488
|
-
constructor() {
|
|
6489
|
-
const { constructor } = this;
|
|
6490
|
-
const tagName = reverseRegistry.get(constructor);
|
|
6491
|
-
if (!tagName) {
|
|
6492
|
-
throw new TypeError(`Invalid Construction`);
|
|
6493
|
-
}
|
|
6494
|
-
return createElement(tagName);
|
|
6495
|
-
}
|
|
6496
|
-
}
|
|
6497
6475
|
const isNativeShadowDefined = false;
|
|
6498
6476
|
const isSyntheticShadowDefined = false;
|
|
6499
6477
|
function insert(node, parent, anchor) {
|
|
@@ -6722,19 +6700,34 @@ const getFirstChild = unsupportedMethod('getFirstChild');
|
|
|
6722
6700
|
const getFirstElementChild = unsupportedMethod('getFirstElementChild');
|
|
6723
6701
|
const getLastChild = unsupportedMethod('getLastChild');
|
|
6724
6702
|
const getLastElementChild = unsupportedMethod('getLastElementChild');
|
|
6725
|
-
function defineCustomElement(name, constructor, _options) {
|
|
6726
|
-
registerCustomElement(name, constructor);
|
|
6727
|
-
}
|
|
6728
|
-
function getCustomElement(name) {
|
|
6729
|
-
return registry[name];
|
|
6730
|
-
}
|
|
6731
|
-
const HTMLElementExported = HTMLElementImpl;
|
|
6732
6703
|
/* noop */
|
|
6733
6704
|
const assertInstanceOfHTMLElement = noop;
|
|
6705
|
+
const localRegistryRecord = new Map();
|
|
6706
|
+
function createUpgradableElementConstructor(tagName) {
|
|
6707
|
+
return function Ctor(upgradeCallback) {
|
|
6708
|
+
const elm = createElement(tagName);
|
|
6709
|
+
if (isFunction$1(upgradeCallback)) {
|
|
6710
|
+
upgradeCallback(elm); // nothing to do with the result for now
|
|
6711
|
+
}
|
|
6712
|
+
return elm;
|
|
6713
|
+
};
|
|
6714
|
+
}
|
|
6715
|
+
function getUpgradableElement(tagName) {
|
|
6716
|
+
let ctor = localRegistryRecord.get(tagName);
|
|
6717
|
+
if (!isUndefined$1(ctor)) {
|
|
6718
|
+
return ctor;
|
|
6719
|
+
}
|
|
6720
|
+
ctor = createUpgradableElementConstructor(tagName);
|
|
6721
|
+
localRegistryRecord.set(tagName, ctor);
|
|
6722
|
+
return ctor;
|
|
6723
|
+
}
|
|
6724
|
+
function createCustomElement(tagName, upgradeCallback) {
|
|
6725
|
+
const UpgradableConstructor = getUpgradableElement(tagName);
|
|
6726
|
+
return new UpgradableConstructor(upgradeCallback);
|
|
6727
|
+
}
|
|
6734
6728
|
const renderer = {
|
|
6735
6729
|
isNativeShadowDefined,
|
|
6736
6730
|
isSyntheticShadowDefined,
|
|
6737
|
-
HTMLElementExported,
|
|
6738
6731
|
insert,
|
|
6739
6732
|
remove,
|
|
6740
6733
|
cloneNode,
|
|
@@ -6742,6 +6735,7 @@ const renderer = {
|
|
|
6742
6735
|
createElement,
|
|
6743
6736
|
createText,
|
|
6744
6737
|
createComment,
|
|
6738
|
+
createCustomElement,
|
|
6745
6739
|
nextSibling,
|
|
6746
6740
|
attachShadow,
|
|
6747
6741
|
getProperty,
|
|
@@ -6769,8 +6763,6 @@ const renderer = {
|
|
|
6769
6763
|
isConnected,
|
|
6770
6764
|
insertStylesheet,
|
|
6771
6765
|
assertInstanceOfHTMLElement,
|
|
6772
|
-
defineCustomElement,
|
|
6773
|
-
getCustomElement,
|
|
6774
6766
|
};
|
|
6775
6767
|
|
|
6776
6768
|
/*
|
|
@@ -6881,7 +6873,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6881
6873
|
*/
|
|
6882
6874
|
freeze(LightningElement);
|
|
6883
6875
|
seal(LightningElement.prototype);
|
|
6884
|
-
/* version: 2.
|
|
6876
|
+
/* version: 2.26.0 */
|
|
6885
6877
|
|
|
6886
6878
|
exports.LightningElement = LightningElement;
|
|
6887
6879
|
exports.api = api$1;
|