lwc 2.20.2 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +203 -171
- package/dist/engine-dom/iife/es2017/engine-dom.js +203 -171
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +193 -161
- package/dist/engine-dom/iife/es5/engine-dom.js +288 -254
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +278 -243
- package/dist/engine-dom/umd/es2017/engine-dom.js +203 -171
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +193 -161
- package/dist/engine-dom/umd/es5/engine-dom.js +288 -254
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +278 -243
- package/dist/engine-server/commonjs/es2017/engine-server.js +280 -258
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +280 -258
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
|
|
|
302
302
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
303
303
|
*/
|
|
304
304
|
// Increment whenever the LWC template compiler changes
|
|
305
|
-
const LWC_VERSION = "2.
|
|
305
|
+
const LWC_VERSION = "2.21.0";
|
|
306
306
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
307
|
-
/** version: 2.
|
|
307
|
+
/** version: 2.21.0 */
|
|
308
308
|
|
|
309
309
|
/*
|
|
310
310
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -458,7 +458,7 @@ var LWC = (function (exports) {
|
|
|
458
458
|
setFeatureFlag(name, value);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
/** version: 2.
|
|
461
|
+
/** version: 2.21.0 */
|
|
462
462
|
|
|
463
463
|
/*
|
|
464
464
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3359,6 +3359,175 @@ var LWC = (function (exports) {
|
|
|
3359
3359
|
};
|
|
3360
3360
|
}
|
|
3361
3361
|
|
|
3362
|
+
/*
|
|
3363
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3364
|
+
* All rights reserved.
|
|
3365
|
+
* SPDX-License-Identifier: MIT
|
|
3366
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3367
|
+
*/
|
|
3368
|
+
function makeHostToken(token) {
|
|
3369
|
+
return `${token}-host`;
|
|
3370
|
+
}
|
|
3371
|
+
function createInlineStyleVNode(content) {
|
|
3372
|
+
return api.h('style', {
|
|
3373
|
+
key: 'style',
|
|
3374
|
+
attrs: {
|
|
3375
|
+
type: 'text/css',
|
|
3376
|
+
},
|
|
3377
|
+
}, [api.t(content)]);
|
|
3378
|
+
}
|
|
3379
|
+
function updateStylesheetToken(vm, template) {
|
|
3380
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
3381
|
+
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
3382
|
+
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3383
|
+
const { hasScopedStyles } = context;
|
|
3384
|
+
let newToken;
|
|
3385
|
+
let newHasTokenInClass;
|
|
3386
|
+
let newHasTokenInAttribute;
|
|
3387
|
+
// Reset the styling token applied to the host element.
|
|
3388
|
+
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
3389
|
+
if (!isUndefined$1(oldToken)) {
|
|
3390
|
+
if (oldHasTokenInClass) {
|
|
3391
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
3392
|
+
}
|
|
3393
|
+
if (oldHasTokenInAttribute) {
|
|
3394
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
// Apply the new template styling token to the host element, if the new template has any
|
|
3398
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3399
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
3400
|
+
newToken = newStylesheetToken;
|
|
3401
|
+
}
|
|
3402
|
+
// Set the new styling token on the host element
|
|
3403
|
+
if (!isUndefined$1(newToken)) {
|
|
3404
|
+
if (hasScopedStyles) {
|
|
3405
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
3406
|
+
newHasTokenInClass = true;
|
|
3407
|
+
}
|
|
3408
|
+
if (isSyntheticShadow) {
|
|
3409
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
3410
|
+
newHasTokenInAttribute = true;
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
// Update the styling tokens present on the context object.
|
|
3414
|
+
context.stylesheetToken = newToken;
|
|
3415
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
3416
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
3417
|
+
}
|
|
3418
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3419
|
+
const content = [];
|
|
3420
|
+
let root;
|
|
3421
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3422
|
+
let stylesheet = stylesheets[i];
|
|
3423
|
+
if (isArray$1(stylesheet)) {
|
|
3424
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3425
|
+
}
|
|
3426
|
+
else {
|
|
3427
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3428
|
+
// Check for compiler version mismatch in dev mode only
|
|
3429
|
+
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3430
|
+
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
3431
|
+
// the component instance might be attempting to use an old version of
|
|
3432
|
+
// the stylesheet, while internally, we have a replacement for it.
|
|
3433
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3434
|
+
}
|
|
3435
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3436
|
+
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3437
|
+
const scopeToken = isScopedCss ||
|
|
3438
|
+
(vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
|
|
3439
|
+
? stylesheetToken
|
|
3440
|
+
: undefined;
|
|
3441
|
+
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3442
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3443
|
+
const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
|
|
3444
|
+
? !isScopedCss
|
|
3445
|
+
: vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3446
|
+
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3447
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
3448
|
+
let useNativeDirPseudoclass;
|
|
3449
|
+
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
3450
|
+
useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3451
|
+
}
|
|
3452
|
+
else {
|
|
3453
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
3454
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
3455
|
+
if (isUndefined$1(root)) {
|
|
3456
|
+
// Only calculate the root once as necessary
|
|
3457
|
+
root = getNearestShadowComponent(vm);
|
|
3458
|
+
}
|
|
3459
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3460
|
+
}
|
|
3461
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
return content;
|
|
3465
|
+
}
|
|
3466
|
+
function getStylesheetsContent(vm, template) {
|
|
3467
|
+
const { stylesheets, stylesheetToken } = template;
|
|
3468
|
+
let content = [];
|
|
3469
|
+
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
3470
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3471
|
+
}
|
|
3472
|
+
return content;
|
|
3473
|
+
}
|
|
3474
|
+
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3475
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
3476
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
3477
|
+
function getNearestShadowComponent(vm) {
|
|
3478
|
+
let owner = vm;
|
|
3479
|
+
while (!isNull(owner)) {
|
|
3480
|
+
if (owner.renderMode === 1 /* RenderMode.Shadow */) {
|
|
3481
|
+
return owner;
|
|
3482
|
+
}
|
|
3483
|
+
owner = owner.owner;
|
|
3484
|
+
}
|
|
3485
|
+
return owner;
|
|
3486
|
+
}
|
|
3487
|
+
/**
|
|
3488
|
+
* If the component that is currently being rendered uses scoped styles,
|
|
3489
|
+
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
3490
|
+
* it returns null.
|
|
3491
|
+
*/
|
|
3492
|
+
function getScopeTokenClass(owner) {
|
|
3493
|
+
const { cmpTemplate, context } = owner;
|
|
3494
|
+
return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
|
|
3495
|
+
}
|
|
3496
|
+
function getNearestNativeShadowComponent(vm) {
|
|
3497
|
+
const owner = getNearestShadowComponent(vm);
|
|
3498
|
+
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3499
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
3500
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
3501
|
+
return null;
|
|
3502
|
+
}
|
|
3503
|
+
return owner;
|
|
3504
|
+
}
|
|
3505
|
+
function createStylesheet(vm, stylesheets) {
|
|
3506
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
3507
|
+
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3508
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3509
|
+
insertStylesheet(stylesheets[i]);
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
else if (ssr || vm.hydrated) {
|
|
3513
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3514
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3515
|
+
// the first time the VM renders.
|
|
3516
|
+
// native shadow or light DOM, SSR
|
|
3517
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3518
|
+
}
|
|
3519
|
+
else {
|
|
3520
|
+
// native shadow or light DOM, DOM renderer
|
|
3521
|
+
const root = getNearestNativeShadowComponent(vm);
|
|
3522
|
+
// null root means a global style
|
|
3523
|
+
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
3524
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3525
|
+
insertStylesheet(stylesheets[i], target);
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return null;
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3362
3531
|
/*
|
|
3363
3532
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
3364
3533
|
* All rights reserved.
|
|
@@ -3870,10 +4039,9 @@ var LWC = (function (exports) {
|
|
|
3870
4039
|
}
|
|
3871
4040
|
// Set the scope token class for *.scoped.css styles
|
|
3872
4041
|
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3873
|
-
const
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4042
|
+
const token = getScopeTokenClass(owner);
|
|
4043
|
+
if (!isNull(token)) {
|
|
4044
|
+
const { getClassList } = renderer;
|
|
3877
4045
|
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3878
4046
|
// probably we should have a renderer api for just the add operation
|
|
3879
4047
|
getClassList(elm).add(token);
|
|
@@ -4636,166 +4804,6 @@ var LWC = (function (exports) {
|
|
|
4636
4804
|
shc,
|
|
4637
4805
|
});
|
|
4638
4806
|
|
|
4639
|
-
/*
|
|
4640
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4641
|
-
* All rights reserved.
|
|
4642
|
-
* SPDX-License-Identifier: MIT
|
|
4643
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4644
|
-
*/
|
|
4645
|
-
function makeHostToken(token) {
|
|
4646
|
-
return `${token}-host`;
|
|
4647
|
-
}
|
|
4648
|
-
function createInlineStyleVNode(content) {
|
|
4649
|
-
return api.h('style', {
|
|
4650
|
-
key: 'style',
|
|
4651
|
-
attrs: {
|
|
4652
|
-
type: 'text/css',
|
|
4653
|
-
},
|
|
4654
|
-
}, [api.t(content)]);
|
|
4655
|
-
}
|
|
4656
|
-
function updateStylesheetToken(vm, template) {
|
|
4657
|
-
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4658
|
-
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4659
|
-
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4660
|
-
const { hasScopedStyles } = context;
|
|
4661
|
-
let newToken;
|
|
4662
|
-
let newHasTokenInClass;
|
|
4663
|
-
let newHasTokenInAttribute;
|
|
4664
|
-
// Reset the styling token applied to the host element.
|
|
4665
|
-
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4666
|
-
if (!isUndefined$1(oldToken)) {
|
|
4667
|
-
if (oldHasTokenInClass) {
|
|
4668
|
-
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4669
|
-
}
|
|
4670
|
-
if (oldHasTokenInAttribute) {
|
|
4671
|
-
removeAttribute(elm, makeHostToken(oldToken));
|
|
4672
|
-
}
|
|
4673
|
-
}
|
|
4674
|
-
// Apply the new template styling token to the host element, if the new template has any
|
|
4675
|
-
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
4676
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
4677
|
-
newToken = newStylesheetToken;
|
|
4678
|
-
}
|
|
4679
|
-
// Set the new styling token on the host element
|
|
4680
|
-
if (!isUndefined$1(newToken)) {
|
|
4681
|
-
if (hasScopedStyles) {
|
|
4682
|
-
getClassList(elm).add(makeHostToken(newToken));
|
|
4683
|
-
newHasTokenInClass = true;
|
|
4684
|
-
}
|
|
4685
|
-
if (isSyntheticShadow) {
|
|
4686
|
-
setAttribute(elm, makeHostToken(newToken), '');
|
|
4687
|
-
newHasTokenInAttribute = true;
|
|
4688
|
-
}
|
|
4689
|
-
}
|
|
4690
|
-
// Update the styling tokens present on the context object.
|
|
4691
|
-
context.stylesheetToken = newToken;
|
|
4692
|
-
context.hasTokenInClass = newHasTokenInClass;
|
|
4693
|
-
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
4694
|
-
}
|
|
4695
|
-
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
4696
|
-
const content = [];
|
|
4697
|
-
let root;
|
|
4698
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
4699
|
-
let stylesheet = stylesheets[i];
|
|
4700
|
-
if (isArray$1(stylesheet)) {
|
|
4701
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
4702
|
-
}
|
|
4703
|
-
else {
|
|
4704
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4705
|
-
// Check for compiler version mismatch in dev mode only
|
|
4706
|
-
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
4707
|
-
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
4708
|
-
// the component instance might be attempting to use an old version of
|
|
4709
|
-
// the stylesheet, while internally, we have a replacement for it.
|
|
4710
|
-
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
4711
|
-
}
|
|
4712
|
-
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
4713
|
-
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
4714
|
-
const scopeToken = isScopedCss ||
|
|
4715
|
-
(vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
|
|
4716
|
-
? stylesheetToken
|
|
4717
|
-
: undefined;
|
|
4718
|
-
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
4719
|
-
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4720
|
-
const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
|
|
4721
|
-
? !isScopedCss
|
|
4722
|
-
: vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
4723
|
-
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
4724
|
-
// we use an attribute selector on the host to simulate :dir().
|
|
4725
|
-
let useNativeDirPseudoclass;
|
|
4726
|
-
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
4727
|
-
useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
4728
|
-
}
|
|
4729
|
-
else {
|
|
4730
|
-
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
4731
|
-
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
4732
|
-
if (isUndefined$1(root)) {
|
|
4733
|
-
// Only calculate the root once as necessary
|
|
4734
|
-
root = getNearestShadowComponent(vm);
|
|
4735
|
-
}
|
|
4736
|
-
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
4737
|
-
}
|
|
4738
|
-
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
4739
|
-
}
|
|
4740
|
-
}
|
|
4741
|
-
return content;
|
|
4742
|
-
}
|
|
4743
|
-
function getStylesheetsContent(vm, template) {
|
|
4744
|
-
const { stylesheets, stylesheetToken } = template;
|
|
4745
|
-
let content = [];
|
|
4746
|
-
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
4747
|
-
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
4748
|
-
}
|
|
4749
|
-
return content;
|
|
4750
|
-
}
|
|
4751
|
-
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
4752
|
-
// perf testing has not shown it to be a huge improvement yet:
|
|
4753
|
-
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
4754
|
-
function getNearestShadowComponent(vm) {
|
|
4755
|
-
let owner = vm;
|
|
4756
|
-
while (!isNull(owner)) {
|
|
4757
|
-
if (owner.renderMode === 1 /* RenderMode.Shadow */) {
|
|
4758
|
-
return owner;
|
|
4759
|
-
}
|
|
4760
|
-
owner = owner.owner;
|
|
4761
|
-
}
|
|
4762
|
-
return owner;
|
|
4763
|
-
}
|
|
4764
|
-
function getNearestNativeShadowComponent(vm) {
|
|
4765
|
-
const owner = getNearestShadowComponent(vm);
|
|
4766
|
-
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
4767
|
-
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
4768
|
-
// synthetic, we know we won't find a native component if we go any further.
|
|
4769
|
-
return null;
|
|
4770
|
-
}
|
|
4771
|
-
return owner;
|
|
4772
|
-
}
|
|
4773
|
-
function createStylesheet(vm, stylesheets) {
|
|
4774
|
-
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4775
|
-
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
4776
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
4777
|
-
insertStylesheet(stylesheets[i]);
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
|
-
else if (ssr || vm.hydrated) {
|
|
4781
|
-
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4782
|
-
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4783
|
-
// the first time the VM renders.
|
|
4784
|
-
// native shadow or light DOM, SSR
|
|
4785
|
-
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4786
|
-
}
|
|
4787
|
-
else {
|
|
4788
|
-
// native shadow or light DOM, DOM renderer
|
|
4789
|
-
const root = getNearestNativeShadowComponent(vm);
|
|
4790
|
-
// null root means a global style
|
|
4791
|
-
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4792
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
4793
|
-
insertStylesheet(stylesheets[i], target);
|
|
4794
|
-
}
|
|
4795
|
-
}
|
|
4796
|
-
return null;
|
|
4797
|
-
}
|
|
4798
|
-
|
|
4799
4807
|
/*
|
|
4800
4808
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4801
4809
|
* All rights reserved.
|
|
@@ -6573,8 +6581,24 @@ var LWC = (function (exports) {
|
|
|
6573
6581
|
return nodesAreCompatible;
|
|
6574
6582
|
}
|
|
6575
6583
|
function validateClassAttr(vnode, elm, renderer) {
|
|
6576
|
-
const { data
|
|
6584
|
+
const { data, owner } = vnode;
|
|
6585
|
+
let { className, classMap } = data;
|
|
6577
6586
|
const { getProperty, getClassList } = renderer;
|
|
6587
|
+
const scopedToken = getScopeTokenClass(owner);
|
|
6588
|
+
// Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
6589
|
+
// or to the VDOM on the server in the case of SSR. As such, these classnames
|
|
6590
|
+
// are never present in VDOM nodes in the browser.
|
|
6591
|
+
//
|
|
6592
|
+
// Consequently, hydration mismatches will occur if scoped CSS token classnames
|
|
6593
|
+
// are rendered during SSR. This needs to be accounted for when validating.
|
|
6594
|
+
if (scopedToken) {
|
|
6595
|
+
if (!isUndefined$1(className)) {
|
|
6596
|
+
className = `${scopedToken} ${className}`;
|
|
6597
|
+
}
|
|
6598
|
+
else if (!isUndefined$1(classMap)) {
|
|
6599
|
+
classMap = Object.assign(Object.assign({}, classMap), { [scopedToken]: true });
|
|
6600
|
+
}
|
|
6601
|
+
}
|
|
6578
6602
|
let nodesAreCompatible = true;
|
|
6579
6603
|
let vnodeClassName;
|
|
6580
6604
|
if (!isUndefined$1(className) && String(className) !== getProperty(elm, 'className')) {
|
|
@@ -6814,7 +6838,7 @@ var LWC = (function (exports) {
|
|
|
6814
6838
|
}
|
|
6815
6839
|
return ctor;
|
|
6816
6840
|
}
|
|
6817
|
-
/* version: 2.
|
|
6841
|
+
/* version: 2.21.0 */
|
|
6818
6842
|
|
|
6819
6843
|
/*
|
|
6820
6844
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7060,7 +7084,15 @@ var LWC = (function (exports) {
|
|
|
7060
7084
|
return node.nextSibling;
|
|
7061
7085
|
}
|
|
7062
7086
|
function attachShadow(element, options) {
|
|
7063
|
-
|
|
7087
|
+
// `hydrating` will be true in two cases:
|
|
7088
|
+
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
7089
|
+
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
7090
|
+
// root component with customeElement.define('c-app', Ctor)
|
|
7091
|
+
//
|
|
7092
|
+
// The second case can be treated as a failed hydration with nominal impact
|
|
7093
|
+
// to performance. However, because <c-app> won't have a <template shadowroot>
|
|
7094
|
+
// declarative child, `element.shadowRoot` is `null`.
|
|
7095
|
+
if (hydrating && element.shadowRoot) {
|
|
7064
7096
|
return element.shadowRoot;
|
|
7065
7097
|
}
|
|
7066
7098
|
return element.attachShadow(options);
|
|
@@ -7494,7 +7526,7 @@ var LWC = (function (exports) {
|
|
|
7494
7526
|
});
|
|
7495
7527
|
freeze(LightningElement);
|
|
7496
7528
|
seal(LightningElement.prototype);
|
|
7497
|
-
/* version: 2.
|
|
7529
|
+
/* version: 2.21.0 */
|
|
7498
7530
|
|
|
7499
7531
|
exports.LightningElement = LightningElement;
|
|
7500
7532
|
exports.__unstable__ProfilerControl = profilerControl;
|