lwc 2.25.0 → 2.25.1

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.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +237 -141
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +237 -141
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +224 -128
  5. package/dist/engine-dom/iife/es5/engine-dom.js +20 -9
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +18 -7
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +237 -141
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +224 -128
  11. package/dist/engine-dom/umd/es5/engine-dom.js +20 -9
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +18 -7
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +207 -121
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +207 -121
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. 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.25.0";
439
+ const LWC_VERSION = "2.25.1";
440
440
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
441
- /** version: 2.25.0 */
441
+ /** version: 2.25.1 */
442
442
 
443
443
  /*
444
444
  * Copyright (c) 2020, salesforce.com, inc.
@@ -496,6 +496,7 @@ const features = {
496
496
  ENABLE_REACTIVE_SETTER: null,
497
497
  ENABLE_WIRE_SYNC_EMIT: null,
498
498
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
499
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: 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.25.0 */
553
+ /** version: 2.25.1 */
553
554
 
554
555
  /* proxy-compat-disable */
555
556
 
@@ -3232,149 +3233,234 @@ function getComponentDef(Ctor) {
3232
3233
  * SPDX-License-Identifier: MIT
3233
3234
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3234
3235
  */
3236
+
3235
3237
  function makeHostToken(token) {
3236
- return `${token}-host`;
3238
+ return `${token}-host`;
3237
3239
  }
3240
+
3238
3241
  function createInlineStyleVNode(content) {
3239
- return api.h('style', {
3240
- key: 'style',
3241
- attrs: {
3242
- type: 'text/css',
3243
- },
3244
- }, [api.t(content)]);
3242
+ return api.h('style', {
3243
+ key: 'style',
3244
+ attrs: {
3245
+ type: 'text/css'
3246
+ }
3247
+ }, [api.t(content)]);
3245
3248
  }
3249
+
3246
3250
  function updateStylesheetToken(vm, template) {
3247
- const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
3248
- const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
3249
- const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3250
- const { hasScopedStyles } = context;
3251
- let newToken;
3252
- let newHasTokenInClass;
3253
- let newHasTokenInAttribute;
3254
- // Reset the styling token applied to the host element.
3255
- const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
3256
- if (!isUndefined$1(oldToken)) {
3257
- if (oldHasTokenInClass) {
3258
- getClassList(elm).remove(makeHostToken(oldToken));
3259
- }
3260
- if (oldHasTokenInAttribute) {
3261
- removeAttribute(elm, makeHostToken(oldToken));
3262
- }
3263
- }
3264
- // Apply the new template styling token to the host element, if the new template has any
3265
- // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3266
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3267
- newToken = newStylesheetToken;
3268
- }
3269
- // Set the new styling token on the host element
3270
- if (!isUndefined$1(newToken)) {
3271
- if (hasScopedStyles) {
3272
- getClassList(elm).add(makeHostToken(newToken));
3273
- newHasTokenInClass = true;
3274
- }
3275
- if (isSyntheticShadow) {
3276
- setAttribute(elm, makeHostToken(newToken), '');
3277
- newHasTokenInAttribute = true;
3278
- }
3279
- }
3280
- // Update the styling tokens present on the context object.
3281
- context.stylesheetToken = newToken;
3282
- context.hasTokenInClass = newHasTokenInClass;
3283
- context.hasTokenInAttribute = newHasTokenInAttribute;
3251
+ const {
3252
+ elm,
3253
+ context,
3254
+ renderMode,
3255
+ shadowMode,
3256
+ renderer: {
3257
+ getClassList,
3258
+ removeAttribute,
3259
+ setAttribute
3260
+ }
3261
+ } = vm;
3262
+ const {
3263
+ stylesheets: newStylesheets,
3264
+ stylesheetToken: newStylesheetToken
3265
+ } = template;
3266
+ const isSyntheticShadow = renderMode === 1
3267
+ /* RenderMode.Shadow */
3268
+ && shadowMode === 1
3269
+ /* ShadowMode.Synthetic */
3270
+ ;
3271
+ const {
3272
+ hasScopedStyles
3273
+ } = context;
3274
+ let newToken;
3275
+ let newHasTokenInClass;
3276
+ let newHasTokenInAttribute; // Reset the styling token applied to the host element.
3277
+
3278
+ const {
3279
+ stylesheetToken: oldToken,
3280
+ hasTokenInClass: oldHasTokenInClass,
3281
+ hasTokenInAttribute: oldHasTokenInAttribute
3282
+ } = context;
3283
+
3284
+ if (!isUndefined$1(oldToken)) {
3285
+ if (oldHasTokenInClass) {
3286
+ getClassList(elm).remove(makeHostToken(oldToken));
3287
+ }
3288
+
3289
+ if (oldHasTokenInAttribute) {
3290
+ removeAttribute(elm, makeHostToken(oldToken));
3291
+ }
3292
+ } // Apply the new template styling token to the host element, if the new template has any
3293
+ // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3294
+
3295
+
3296
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3297
+ newToken = newStylesheetToken;
3298
+ } // Set the new styling token on the host element
3299
+
3300
+
3301
+ if (!isUndefined$1(newToken)) {
3302
+ if (hasScopedStyles) {
3303
+ getClassList(elm).add(makeHostToken(newToken));
3304
+ newHasTokenInClass = true;
3305
+ }
3306
+
3307
+ if (isSyntheticShadow) {
3308
+ setAttribute(elm, makeHostToken(newToken), '');
3309
+ newHasTokenInAttribute = true;
3310
+ }
3311
+ } // Update the styling tokens present on the context object.
3312
+
3313
+
3314
+ context.stylesheetToken = newToken;
3315
+ context.hasTokenInClass = newHasTokenInClass;
3316
+ context.hasTokenInAttribute = newHasTokenInAttribute;
3284
3317
  }
3318
+
3285
3319
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3286
- const content = [];
3287
- let root;
3288
- for (let i = 0; i < stylesheets.length; i++) {
3289
- let stylesheet = stylesheets[i];
3290
- if (isArray$1(stylesheet)) {
3291
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3320
+ const content = [];
3321
+ let root;
3322
+
3323
+ for (let i = 0; i < stylesheets.length; i++) {
3324
+ let stylesheet = stylesheets[i];
3325
+
3326
+ if (isArray$1(stylesheet)) {
3327
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3328
+ } else {
3329
+ if (process.env.NODE_ENV !== 'production') {
3330
+ // Check for compiler version mismatch in dev mode only
3331
+ checkVersionMismatch(stylesheet, 'stylesheet'); // in dev-mode, we support hot swapping of stylesheet, which means that
3332
+ // the component instance might be attempting to use an old version of
3333
+ // the stylesheet, while internally, we have a replacement for it.
3334
+
3335
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
3336
+ }
3337
+
3338
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3339
+
3340
+ if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
3341
+ if (!isScopedCss && vm.renderMode === 0
3342
+ /* RenderMode.Light */
3343
+ ) {
3344
+ logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
3345
+ continue;
3292
3346
  }
3293
- else {
3294
- if (process.env.NODE_ENV !== 'production') {
3295
- // Check for compiler version mismatch in dev mode only
3296
- checkVersionMismatch(stylesheet, 'stylesheet');
3297
- // in dev-mode, we support hot swapping of stylesheet, which means that
3298
- // the component instance might be attempting to use an old version of
3299
- // the stylesheet, while internally, we have a replacement for it.
3300
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3301
- }
3302
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3303
- // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3304
- const scopeToken = isScopedCss ||
3305
- (vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
3306
- ? stylesheetToken
3307
- : undefined;
3308
- // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3309
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3310
- const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
3311
- ? !isScopedCss
3312
- : vm.shadowMode === 0 /* ShadowMode.Native */;
3313
- // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3314
- // we use an attribute selector on the host to simulate :dir().
3315
- let useNativeDirPseudoclass;
3316
- if (vm.renderMode === 1 /* RenderMode.Shadow */) {
3317
- useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
3318
- }
3319
- else {
3320
- // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3321
- // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
3322
- if (isUndefined$1(root)) {
3323
- // Only calculate the root once as necessary
3324
- root = getNearestShadowComponent(vm);
3325
- }
3326
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
3327
- }
3328
- ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3347
+ } // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3348
+
3349
+
3350
+ const scopeToken = isScopedCss || vm.shadowMode === 1
3351
+ /* ShadowMode.Synthetic */
3352
+ && vm.renderMode === 1
3353
+ /* RenderMode.Shadow */
3354
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3355
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3356
+
3357
+ const useActualHostSelector = vm.renderMode === 0
3358
+ /* RenderMode.Light */
3359
+ ? !isScopedCss : vm.shadowMode === 0
3360
+ /* ShadowMode.Native */
3361
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3362
+ // we use an attribute selector on the host to simulate :dir().
3363
+
3364
+ let useNativeDirPseudoclass;
3365
+
3366
+ if (vm.renderMode === 1
3367
+ /* RenderMode.Shadow */
3368
+ ) {
3369
+ useNativeDirPseudoclass = vm.shadowMode === 0
3370
+ /* ShadowMode.Native */
3371
+ ;
3372
+ } else {
3373
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3374
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
3375
+ if (isUndefined$1(root)) {
3376
+ // Only calculate the root once as necessary
3377
+ root = getNearestShadowComponent(vm);
3329
3378
  }
3379
+
3380
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
3381
+ /* ShadowMode.Native */
3382
+ ;
3383
+ }
3384
+
3385
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3330
3386
  }
3331
- return content;
3387
+ }
3388
+
3389
+ return content;
3332
3390
  }
3391
+
3333
3392
  function getStylesheetsContent(vm, template) {
3334
- const { stylesheets, stylesheetToken } = template;
3335
- let content = [];
3336
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3337
- content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3338
- }
3339
- return content;
3340
- }
3341
- // It might be worth caching this to avoid doing the lookup repeatedly, but
3393
+ const {
3394
+ stylesheets,
3395
+ stylesheetToken
3396
+ } = template;
3397
+ let content = [];
3398
+
3399
+ if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3400
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3401
+ }
3402
+
3403
+ return content;
3404
+ } // It might be worth caching this to avoid doing the lookup repeatedly, but
3342
3405
  // perf testing has not shown it to be a huge improvement yet:
3343
3406
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
3407
+
3344
3408
  function getNearestShadowComponent(vm) {
3345
- let owner = vm;
3346
- while (!isNull(owner)) {
3347
- if (owner.renderMode === 1 /* RenderMode.Shadow */) {
3348
- return owner;
3349
- }
3350
- owner = owner.owner;
3409
+ let owner = vm;
3410
+
3411
+ while (!isNull(owner)) {
3412
+ if (owner.renderMode === 1
3413
+ /* RenderMode.Shadow */
3414
+ ) {
3415
+ return owner;
3351
3416
  }
3352
- return owner;
3417
+
3418
+ owner = owner.owner;
3419
+ }
3420
+
3421
+ return owner;
3353
3422
  }
3354
3423
  /**
3355
3424
  * If the component that is currently being rendered uses scoped styles,
3356
3425
  * this returns the unique token for that scoped stylesheet. Otherwise
3357
3426
  * it returns null.
3358
3427
  */
3428
+
3429
+
3359
3430
  function getScopeTokenClass(owner) {
3360
- const { cmpTemplate, context } = owner;
3361
- return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
3431
+ const {
3432
+ cmpTemplate,
3433
+ context
3434
+ } = owner;
3435
+ return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
3362
3436
  }
3437
+
3363
3438
  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
- }
3439
+ const {
3440
+ renderMode,
3441
+ shadowMode,
3442
+ renderer: {
3443
+ insertStylesheet
3369
3444
  }
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);
3445
+ } = vm;
3446
+
3447
+ if (renderMode === 1
3448
+ /* RenderMode.Shadow */
3449
+ && shadowMode === 1
3450
+ /* ShadowMode.Synthetic */
3451
+ ) {
3452
+ for (let i = 0; i < stylesheets.length; i++) {
3453
+ insertStylesheet(stylesheets[i]);
3376
3454
  }
3377
- return null;
3455
+ } else {
3456
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3457
+ // This works in the client, because the stylesheets are created, and cached in the VM
3458
+ // the first time the VM renders.
3459
+ // native shadow or light DOM, SSR
3460
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
3461
+ }
3462
+
3463
+ return null;
3378
3464
  }
3379
3465
 
3380
3466
  /*
@@ -6411,7 +6497,7 @@ function freezeTemplate(tmpl) {
6411
6497
  });
6412
6498
  }
6413
6499
  }
6414
- /* version: 2.25.0 */
6500
+ /* version: 2.25.1 */
6415
6501
 
6416
6502
  /*
6417
6503
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6881,7 +6967,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6881
6967
  */
6882
6968
  freeze(LightningElement);
6883
6969
  seal(LightningElement.prototype);
6884
- /* version: 2.25.0 */
6970
+ /* version: 2.25.1 */
6885
6971
 
6886
6972
  exports.LightningElement = LightningElement;
6887
6973
  exports.api = api$1;