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
@@ -305,9 +305,9 @@
305
305
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
306
306
  */
307
307
  // Increment whenever the LWC template compiler changes
308
- const LWC_VERSION = "2.25.0";
308
+ const LWC_VERSION = "2.25.1";
309
309
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
310
- /** version: 2.25.0 */
310
+ /** version: 2.25.1 */
311
311
 
312
312
  /**
313
313
  * Copyright (C) 2018 salesforce.com, inc.
@@ -389,7 +389,7 @@
389
389
  patch$1(propName);
390
390
  }
391
391
  }
392
- /** version: 2.25.0 */
392
+ /** version: 2.25.1 */
393
393
 
394
394
  /**
395
395
  * Copyright (C) 2018 salesforce.com, inc.
@@ -415,6 +415,7 @@
415
415
  ENABLE_REACTIVE_SETTER: null,
416
416
  ENABLE_WIRE_SYNC_EMIT: null,
417
417
  ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
418
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
418
419
  };
419
420
  if (!_globalThis.lwcRuntimeFlags) {
420
421
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
@@ -468,7 +469,7 @@
468
469
  setFeatureFlag(name, value);
469
470
  }
470
471
  }
471
- /** version: 2.25.0 */
472
+ /** version: 2.25.1 */
472
473
 
473
474
  /*
474
475
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3465,175 +3466,270 @@
3465
3466
  * SPDX-License-Identifier: MIT
3466
3467
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3467
3468
  */
3469
+
3468
3470
  function makeHostToken(token) {
3469
- return `${token}-host`;
3471
+ return `${token}-host`;
3470
3472
  }
3473
+
3471
3474
  function createInlineStyleVNode(content) {
3472
- return api.h('style', {
3473
- key: 'style',
3474
- attrs: {
3475
- type: 'text/css',
3476
- },
3477
- }, [api.t(content)]);
3475
+ return api.h('style', {
3476
+ key: 'style',
3477
+ attrs: {
3478
+ type: 'text/css'
3479
+ }
3480
+ }, [api.t(content)]);
3478
3481
  }
3482
+
3479
3483
  function updateStylesheetToken(vm, template) {
3480
- const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
3481
- const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
3482
- const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3483
- const { hasScopedStyles } = context;
3484
- let newToken;
3485
- let newHasTokenInClass;
3486
- let newHasTokenInAttribute;
3487
- // Reset the styling token applied to the host element.
3488
- const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
3489
- if (!isUndefined$1(oldToken)) {
3490
- if (oldHasTokenInClass) {
3491
- getClassList(elm).remove(makeHostToken(oldToken));
3492
- }
3493
- if (oldHasTokenInAttribute) {
3494
- removeAttribute(elm, makeHostToken(oldToken));
3495
- }
3496
- }
3497
- // Apply the new template styling token to the host element, if the new template has any
3498
- // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3499
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3500
- newToken = newStylesheetToken;
3501
- }
3502
- // Set the new styling token on the host element
3503
- if (!isUndefined$1(newToken)) {
3504
- if (hasScopedStyles) {
3505
- getClassList(elm).add(makeHostToken(newToken));
3506
- newHasTokenInClass = true;
3507
- }
3508
- if (isSyntheticShadow) {
3509
- setAttribute(elm, makeHostToken(newToken), '');
3510
- newHasTokenInAttribute = true;
3511
- }
3512
- }
3513
- // Update the styling tokens present on the context object.
3514
- context.stylesheetToken = newToken;
3515
- context.hasTokenInClass = newHasTokenInClass;
3516
- context.hasTokenInAttribute = newHasTokenInAttribute;
3484
+ const {
3485
+ elm,
3486
+ context,
3487
+ renderMode,
3488
+ shadowMode,
3489
+ renderer: {
3490
+ getClassList,
3491
+ removeAttribute,
3492
+ setAttribute
3493
+ }
3494
+ } = vm;
3495
+ const {
3496
+ stylesheets: newStylesheets,
3497
+ stylesheetToken: newStylesheetToken
3498
+ } = template;
3499
+ const isSyntheticShadow = renderMode === 1
3500
+ /* RenderMode.Shadow */
3501
+ && shadowMode === 1
3502
+ /* ShadowMode.Synthetic */
3503
+ ;
3504
+ const {
3505
+ hasScopedStyles
3506
+ } = context;
3507
+ let newToken;
3508
+ let newHasTokenInClass;
3509
+ let newHasTokenInAttribute; // Reset the styling token applied to the host element.
3510
+
3511
+ const {
3512
+ stylesheetToken: oldToken,
3513
+ hasTokenInClass: oldHasTokenInClass,
3514
+ hasTokenInAttribute: oldHasTokenInAttribute
3515
+ } = context;
3516
+
3517
+ if (!isUndefined$1(oldToken)) {
3518
+ if (oldHasTokenInClass) {
3519
+ getClassList(elm).remove(makeHostToken(oldToken));
3520
+ }
3521
+
3522
+ if (oldHasTokenInAttribute) {
3523
+ removeAttribute(elm, makeHostToken(oldToken));
3524
+ }
3525
+ } // Apply the new template styling token to the host element, if the new template has any
3526
+ // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3527
+
3528
+
3529
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3530
+ newToken = newStylesheetToken;
3531
+ } // Set the new styling token on the host element
3532
+
3533
+
3534
+ if (!isUndefined$1(newToken)) {
3535
+ if (hasScopedStyles) {
3536
+ getClassList(elm).add(makeHostToken(newToken));
3537
+ newHasTokenInClass = true;
3538
+ }
3539
+
3540
+ if (isSyntheticShadow) {
3541
+ setAttribute(elm, makeHostToken(newToken), '');
3542
+ newHasTokenInAttribute = true;
3543
+ }
3544
+ } // Update the styling tokens present on the context object.
3545
+
3546
+
3547
+ context.stylesheetToken = newToken;
3548
+ context.hasTokenInClass = newHasTokenInClass;
3549
+ context.hasTokenInAttribute = newHasTokenInAttribute;
3517
3550
  }
3551
+
3518
3552
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3519
- const content = [];
3520
- let root;
3521
- for (let i = 0; i < stylesheets.length; i++) {
3522
- let stylesheet = stylesheets[i];
3523
- if (isArray$1(stylesheet)) {
3524
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3553
+ const content = [];
3554
+ let root;
3555
+
3556
+ for (let i = 0; i < stylesheets.length; i++) {
3557
+ let stylesheet = stylesheets[i];
3558
+
3559
+ if (isArray$1(stylesheet)) {
3560
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3561
+ } else {
3562
+ if (process.env.NODE_ENV !== 'production') {
3563
+ // Check for compiler version mismatch in dev mode only
3564
+ checkVersionMismatch(stylesheet, 'stylesheet'); // in dev-mode, we support hot swapping of stylesheet, which means that
3565
+ // the component instance might be attempting to use an old version of
3566
+ // the stylesheet, while internally, we have a replacement for it.
3567
+
3568
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
3569
+ }
3570
+
3571
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3572
+
3573
+ if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
3574
+ if (!isScopedCss && vm.renderMode === 0
3575
+ /* RenderMode.Light */
3576
+ ) {
3577
+ logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
3578
+ continue;
3525
3579
  }
3526
- else {
3527
- if (process.env.NODE_ENV !== 'production') {
3528
- // Check for compiler version mismatch in dev mode only
3529
- checkVersionMismatch(stylesheet, 'stylesheet');
3530
- // in dev-mode, we support hot swapping of stylesheet, which means that
3531
- // the component instance might be attempting to use an old version of
3532
- // the stylesheet, while internally, we have a replacement for it.
3533
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3534
- }
3535
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3536
- // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3537
- const scopeToken = isScopedCss ||
3538
- (vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
3539
- ? stylesheetToken
3540
- : undefined;
3541
- // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3542
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3543
- const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
3544
- ? !isScopedCss
3545
- : vm.shadowMode === 0 /* ShadowMode.Native */;
3546
- // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3547
- // we use an attribute selector on the host to simulate :dir().
3548
- let useNativeDirPseudoclass;
3549
- if (vm.renderMode === 1 /* RenderMode.Shadow */) {
3550
- useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
3551
- }
3552
- else {
3553
- // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3554
- // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
3555
- if (isUndefined$1(root)) {
3556
- // Only calculate the root once as necessary
3557
- root = getNearestShadowComponent(vm);
3558
- }
3559
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
3560
- }
3561
- ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3580
+ } // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3581
+
3582
+
3583
+ const scopeToken = isScopedCss || vm.shadowMode === 1
3584
+ /* ShadowMode.Synthetic */
3585
+ && vm.renderMode === 1
3586
+ /* RenderMode.Shadow */
3587
+ ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3588
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3589
+
3590
+ const useActualHostSelector = vm.renderMode === 0
3591
+ /* RenderMode.Light */
3592
+ ? !isScopedCss : vm.shadowMode === 0
3593
+ /* ShadowMode.Native */
3594
+ ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3595
+ // we use an attribute selector on the host to simulate :dir().
3596
+
3597
+ let useNativeDirPseudoclass;
3598
+
3599
+ if (vm.renderMode === 1
3600
+ /* RenderMode.Shadow */
3601
+ ) {
3602
+ useNativeDirPseudoclass = vm.shadowMode === 0
3603
+ /* ShadowMode.Native */
3604
+ ;
3605
+ } else {
3606
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3607
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
3608
+ if (isUndefined$1(root)) {
3609
+ // Only calculate the root once as necessary
3610
+ root = getNearestShadowComponent(vm);
3562
3611
  }
3612
+
3613
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
3614
+ /* ShadowMode.Native */
3615
+ ;
3616
+ }
3617
+
3618
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3563
3619
  }
3564
- return content;
3620
+ }
3621
+
3622
+ return content;
3565
3623
  }
3624
+
3566
3625
  function getStylesheetsContent(vm, template) {
3567
- const { stylesheets, stylesheetToken } = template;
3568
- let content = [];
3569
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3570
- content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3571
- }
3572
- return content;
3573
- }
3574
- // It might be worth caching this to avoid doing the lookup repeatedly, but
3626
+ const {
3627
+ stylesheets,
3628
+ stylesheetToken
3629
+ } = template;
3630
+ let content = [];
3631
+
3632
+ if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3633
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3634
+ }
3635
+
3636
+ return content;
3637
+ } // It might be worth caching this to avoid doing the lookup repeatedly, but
3575
3638
  // perf testing has not shown it to be a huge improvement yet:
3576
3639
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
3640
+
3577
3641
  function getNearestShadowComponent(vm) {
3578
- let owner = vm;
3579
- while (!isNull(owner)) {
3580
- if (owner.renderMode === 1 /* RenderMode.Shadow */) {
3581
- return owner;
3582
- }
3583
- owner = owner.owner;
3642
+ let owner = vm;
3643
+
3644
+ while (!isNull(owner)) {
3645
+ if (owner.renderMode === 1
3646
+ /* RenderMode.Shadow */
3647
+ ) {
3648
+ return owner;
3584
3649
  }
3585
- return owner;
3650
+
3651
+ owner = owner.owner;
3652
+ }
3653
+
3654
+ return owner;
3586
3655
  }
3587
3656
  /**
3588
3657
  * If the component that is currently being rendered uses scoped styles,
3589
3658
  * this returns the unique token for that scoped stylesheet. Otherwise
3590
3659
  * it returns null.
3591
3660
  */
3661
+
3662
+
3592
3663
  function getScopeTokenClass(owner) {
3593
- const { cmpTemplate, context } = owner;
3594
- return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
3664
+ const {
3665
+ cmpTemplate,
3666
+ context
3667
+ } = owner;
3668
+ return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
3595
3669
  }
3596
3670
  /**
3597
3671
  * This function returns the host style token for a custom element if it
3598
3672
  * exists. Otherwise it returns null.
3599
3673
  */
3674
+
3600
3675
  function getStylesheetTokenHost(vnode) {
3601
- const { template: { stylesheetToken }, } = getComponentInternalDef(vnode.ctor);
3602
- return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
3676
+ const {
3677
+ template: {
3678
+ stylesheetToken
3679
+ }
3680
+ } = getComponentInternalDef(vnode.ctor);
3681
+ return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
3603
3682
  }
3683
+
3604
3684
  function getNearestNativeShadowComponent(vm) {
3605
- const owner = getNearestShadowComponent(vm);
3606
- if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
3607
- // Synthetic-within-native is impossible. So if the nearest shadow component is
3608
- // synthetic, we know we won't find a native component if we go any further.
3609
- return null;
3610
- }
3611
- return owner;
3685
+ const owner = getNearestShadowComponent(vm);
3686
+
3687
+ if (!isNull(owner) && owner.shadowMode === 1
3688
+ /* ShadowMode.Synthetic */
3689
+ ) {
3690
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
3691
+ // synthetic, we know we won't find a native component if we go any further.
3692
+ return null;
3693
+ }
3694
+
3695
+ return owner;
3612
3696
  }
3697
+
3613
3698
  function createStylesheet(vm, stylesheets) {
3614
- const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
3615
- if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3616
- for (let i = 0; i < stylesheets.length; i++) {
3617
- insertStylesheet(stylesheets[i]);
3618
- }
3619
- }
3620
- else if (vm.hydrated) {
3621
- // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3622
- // This works in the client, because the stylesheets are created, and cached in the VM
3623
- // the first time the VM renders.
3624
- // native shadow or light DOM, SSR
3625
- return ArrayMap.call(stylesheets, createInlineStyleVNode);
3699
+ const {
3700
+ renderMode,
3701
+ shadowMode,
3702
+ renderer: {
3703
+ insertStylesheet
3626
3704
  }
3627
- else {
3628
- // native shadow or light DOM, DOM renderer
3629
- const root = getNearestNativeShadowComponent(vm);
3630
- // null root means a global style
3631
- const target = isNull(root) ? undefined : root.shadowRoot;
3632
- for (let i = 0; i < stylesheets.length; i++) {
3633
- insertStylesheet(stylesheets[i], target);
3634
- }
3705
+ } = vm;
3706
+
3707
+ if (renderMode === 1
3708
+ /* RenderMode.Shadow */
3709
+ && shadowMode === 1
3710
+ /* ShadowMode.Synthetic */
3711
+ ) {
3712
+ for (let i = 0; i < stylesheets.length; i++) {
3713
+ insertStylesheet(stylesheets[i]);
3714
+ }
3715
+ } else if (vm.hydrated) {
3716
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3717
+ // This works in the client, because the stylesheets are created, and cached in the VM
3718
+ // the first time the VM renders.
3719
+ // native shadow or light DOM, SSR
3720
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
3721
+ } else {
3722
+ // native shadow or light DOM, DOM renderer
3723
+ const root = getNearestNativeShadowComponent(vm); // null root means a global style
3724
+
3725
+ const target = isNull(root) ? undefined : root.shadowRoot;
3726
+
3727
+ for (let i = 0; i < stylesheets.length; i++) {
3728
+ insertStylesheet(stylesheets[i], target);
3635
3729
  }
3636
- return null;
3730
+ }
3731
+
3732
+ return null;
3637
3733
  }
3638
3734
 
3639
3735
  /*
@@ -7267,7 +7363,7 @@
7267
7363
  }
7268
7364
  return ctor;
7269
7365
  }
7270
- /* version: 2.25.0 */
7366
+ /* version: 2.25.1 */
7271
7367
 
7272
7368
  /*
7273
7369
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7471,7 +7567,7 @@
7471
7567
  function isNull(obj) {
7472
7568
  return obj === null;
7473
7569
  }
7474
- /** version: 2.25.0 */
7570
+ /** version: 2.25.1 */
7475
7571
 
7476
7572
  /*
7477
7573
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8090,7 +8186,7 @@
8090
8186
  });
8091
8187
  freeze(LightningElement);
8092
8188
  seal(LightningElement.prototype);
8093
- /* version: 2.25.0 */
8189
+ /* version: 2.25.1 */
8094
8190
 
8095
8191
  exports.LightningElement = LightningElement;
8096
8192
  exports.__unstable__ProfilerControl = profilerControl;