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