lwc 2.20.2 → 2.20.5
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 +287 -260
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +287 -260
- 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
|
@@ -254,7 +254,7 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
254
254
|
// e.g. `</tagName>` or `<tagName />`. For instance, `<meta>` closes on its own; no need for a slash.
|
|
255
255
|
// These only come from HTML; there are no void elements in the SVG or MathML namespaces.
|
|
256
256
|
// See: https://html.spec.whatwg.org/multipage/syntax.html#syntax-tags
|
|
257
|
-
const
|
|
257
|
+
const VOID_ELEMENTS = [
|
|
258
258
|
'area',
|
|
259
259
|
'base',
|
|
260
260
|
'br',
|
|
@@ -268,7 +268,12 @@ const VOID_ELEMENTS_SET = new Set([
|
|
|
268
268
|
'source',
|
|
269
269
|
'track',
|
|
270
270
|
'wbr',
|
|
271
|
-
]
|
|
271
|
+
];
|
|
272
|
+
// These elements have been deprecated but preserving their usage for backwards compatibility
|
|
273
|
+
// until we can officially deprecate them from LWC.
|
|
274
|
+
// See: https://html.spec.whatwg.org/multipage/obsolete.html#obsolete-but-conforming-features
|
|
275
|
+
const DEPRECATED_VOID_ELEMENTS = ['param', 'keygen', 'menuitem'];
|
|
276
|
+
const VOID_ELEMENTS_SET = new Set([...VOID_ELEMENTS, ...DEPRECATED_VOID_ELEMENTS]);
|
|
272
277
|
function isVoidElement(name, namespace) {
|
|
273
278
|
return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase());
|
|
274
279
|
}
|
|
@@ -419,9 +424,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
419
424
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
420
425
|
*/
|
|
421
426
|
// Increment whenever the LWC template compiler changes
|
|
422
|
-
const LWC_VERSION = "2.20.
|
|
427
|
+
const LWC_VERSION = "2.20.5";
|
|
423
428
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
424
|
-
/** version: 2.20.
|
|
429
|
+
/** version: 2.20.5 */
|
|
425
430
|
|
|
426
431
|
/*
|
|
427
432
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -530,7 +535,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
530
535
|
setFeatureFlag(name, value);
|
|
531
536
|
}
|
|
532
537
|
}
|
|
533
|
-
/** version: 2.20.
|
|
538
|
+
/** version: 2.20.5 */
|
|
534
539
|
|
|
535
540
|
/* proxy-compat-disable */
|
|
536
541
|
|
|
@@ -3255,6 +3260,175 @@ function getComponentDef(Ctor) {
|
|
|
3255
3260
|
};
|
|
3256
3261
|
}
|
|
3257
3262
|
|
|
3263
|
+
/*
|
|
3264
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3265
|
+
* All rights reserved.
|
|
3266
|
+
* SPDX-License-Identifier: MIT
|
|
3267
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3268
|
+
*/
|
|
3269
|
+
function makeHostToken(token) {
|
|
3270
|
+
return `${token}-host`;
|
|
3271
|
+
}
|
|
3272
|
+
function createInlineStyleVNode(content) {
|
|
3273
|
+
return api.h('style', {
|
|
3274
|
+
key: 'style',
|
|
3275
|
+
attrs: {
|
|
3276
|
+
type: 'text/css',
|
|
3277
|
+
},
|
|
3278
|
+
}, [api.t(content)]);
|
|
3279
|
+
}
|
|
3280
|
+
function updateStylesheetToken(vm, template) {
|
|
3281
|
+
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
3282
|
+
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
3283
|
+
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3284
|
+
const { hasScopedStyles } = context;
|
|
3285
|
+
let newToken;
|
|
3286
|
+
let newHasTokenInClass;
|
|
3287
|
+
let newHasTokenInAttribute;
|
|
3288
|
+
// Reset the styling token applied to the host element.
|
|
3289
|
+
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
3290
|
+
if (!isUndefined$1(oldToken)) {
|
|
3291
|
+
if (oldHasTokenInClass) {
|
|
3292
|
+
getClassList(elm).remove(makeHostToken(oldToken));
|
|
3293
|
+
}
|
|
3294
|
+
if (oldHasTokenInAttribute) {
|
|
3295
|
+
removeAttribute(elm, makeHostToken(oldToken));
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
// Apply the new template styling token to the host element, if the new template has any
|
|
3299
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3300
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
3301
|
+
newToken = newStylesheetToken;
|
|
3302
|
+
}
|
|
3303
|
+
// Set the new styling token on the host element
|
|
3304
|
+
if (!isUndefined$1(newToken)) {
|
|
3305
|
+
if (hasScopedStyles) {
|
|
3306
|
+
getClassList(elm).add(makeHostToken(newToken));
|
|
3307
|
+
newHasTokenInClass = true;
|
|
3308
|
+
}
|
|
3309
|
+
if (isSyntheticShadow) {
|
|
3310
|
+
setAttribute(elm, makeHostToken(newToken), '');
|
|
3311
|
+
newHasTokenInAttribute = true;
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
// Update the styling tokens present on the context object.
|
|
3315
|
+
context.stylesheetToken = newToken;
|
|
3316
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
3317
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
3318
|
+
}
|
|
3319
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3320
|
+
const content = [];
|
|
3321
|
+
let root;
|
|
3322
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3323
|
+
let stylesheet = stylesheets[i];
|
|
3324
|
+
if (isArray$1(stylesheet)) {
|
|
3325
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3326
|
+
}
|
|
3327
|
+
else {
|
|
3328
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3329
|
+
// Check for compiler version mismatch in dev mode only
|
|
3330
|
+
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3331
|
+
// 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
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3335
|
+
}
|
|
3336
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
3337
|
+
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3338
|
+
const scopeToken = isScopedCss ||
|
|
3339
|
+
(vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
|
|
3340
|
+
? stylesheetToken
|
|
3341
|
+
: undefined;
|
|
3342
|
+
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3343
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3344
|
+
const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
|
|
3345
|
+
? !isScopedCss
|
|
3346
|
+
: vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3347
|
+
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3348
|
+
// we use an attribute selector on the host to simulate :dir().
|
|
3349
|
+
let useNativeDirPseudoclass;
|
|
3350
|
+
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
3351
|
+
useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3352
|
+
}
|
|
3353
|
+
else {
|
|
3354
|
+
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
3355
|
+
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
3356
|
+
if (isUndefined$1(root)) {
|
|
3357
|
+
// Only calculate the root once as necessary
|
|
3358
|
+
root = getNearestShadowComponent(vm);
|
|
3359
|
+
}
|
|
3360
|
+
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3361
|
+
}
|
|
3362
|
+
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
return content;
|
|
3366
|
+
}
|
|
3367
|
+
function getStylesheetsContent(vm, template) {
|
|
3368
|
+
const { stylesheets, stylesheetToken } = template;
|
|
3369
|
+
let content = [];
|
|
3370
|
+
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
3371
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3372
|
+
}
|
|
3373
|
+
return content;
|
|
3374
|
+
}
|
|
3375
|
+
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3376
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
3377
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
3378
|
+
function getNearestShadowComponent(vm) {
|
|
3379
|
+
let owner = vm;
|
|
3380
|
+
while (!isNull(owner)) {
|
|
3381
|
+
if (owner.renderMode === 1 /* RenderMode.Shadow */) {
|
|
3382
|
+
return owner;
|
|
3383
|
+
}
|
|
3384
|
+
owner = owner.owner;
|
|
3385
|
+
}
|
|
3386
|
+
return owner;
|
|
3387
|
+
}
|
|
3388
|
+
/**
|
|
3389
|
+
* If the component that is currently being rendered uses scoped styles,
|
|
3390
|
+
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
3391
|
+
* it returns null.
|
|
3392
|
+
*/
|
|
3393
|
+
function getScopeTokenClass(owner) {
|
|
3394
|
+
const { cmpTemplate, context } = owner;
|
|
3395
|
+
return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
|
|
3396
|
+
}
|
|
3397
|
+
function getNearestNativeShadowComponent(vm) {
|
|
3398
|
+
const owner = getNearestShadowComponent(vm);
|
|
3399
|
+
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3400
|
+
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
3401
|
+
// synthetic, we know we won't find a native component if we go any further.
|
|
3402
|
+
return null;
|
|
3403
|
+
}
|
|
3404
|
+
return owner;
|
|
3405
|
+
}
|
|
3406
|
+
function createStylesheet(vm, stylesheets) {
|
|
3407
|
+
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
3408
|
+
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3409
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3410
|
+
insertStylesheet(stylesheets[i]);
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
else if (ssr || vm.hydrated) {
|
|
3414
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3415
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3416
|
+
// the first time the VM renders.
|
|
3417
|
+
// native shadow or light DOM, SSR
|
|
3418
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3419
|
+
}
|
|
3420
|
+
else {
|
|
3421
|
+
// native shadow or light DOM, DOM renderer
|
|
3422
|
+
const root = getNearestNativeShadowComponent(vm);
|
|
3423
|
+
// null root means a global style
|
|
3424
|
+
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
3425
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
3426
|
+
insertStylesheet(stylesheets[i], target);
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
return null;
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3258
3432
|
/*
|
|
3259
3433
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
3260
3434
|
* All rights reserved.
|
|
@@ -3766,10 +3940,9 @@ function setElementShadowToken(elm, token) {
|
|
|
3766
3940
|
}
|
|
3767
3941
|
// Set the scope token class for *.scoped.css styles
|
|
3768
3942
|
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3769
|
-
const
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
3943
|
+
const token = getScopeTokenClass(owner);
|
|
3944
|
+
if (!isNull(token)) {
|
|
3945
|
+
const { getClassList } = renderer;
|
|
3773
3946
|
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3774
3947
|
// probably we should have a renderer api for just the add operation
|
|
3775
3948
|
getClassList(elm).add(token);
|
|
@@ -4532,166 +4705,6 @@ const api = freeze({
|
|
|
4532
4705
|
shc,
|
|
4533
4706
|
});
|
|
4534
4707
|
|
|
4535
|
-
/*
|
|
4536
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
4537
|
-
* All rights reserved.
|
|
4538
|
-
* SPDX-License-Identifier: MIT
|
|
4539
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4540
|
-
*/
|
|
4541
|
-
function makeHostToken(token) {
|
|
4542
|
-
return `${token}-host`;
|
|
4543
|
-
}
|
|
4544
|
-
function createInlineStyleVNode(content) {
|
|
4545
|
-
return api.h('style', {
|
|
4546
|
-
key: 'style',
|
|
4547
|
-
attrs: {
|
|
4548
|
-
type: 'text/css',
|
|
4549
|
-
},
|
|
4550
|
-
}, [api.t(content)]);
|
|
4551
|
-
}
|
|
4552
|
-
function updateStylesheetToken(vm, template) {
|
|
4553
|
-
const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
|
|
4554
|
-
const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
|
|
4555
|
-
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4556
|
-
const { hasScopedStyles } = context;
|
|
4557
|
-
let newToken;
|
|
4558
|
-
let newHasTokenInClass;
|
|
4559
|
-
let newHasTokenInAttribute;
|
|
4560
|
-
// Reset the styling token applied to the host element.
|
|
4561
|
-
const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
|
|
4562
|
-
if (!isUndefined$1(oldToken)) {
|
|
4563
|
-
if (oldHasTokenInClass) {
|
|
4564
|
-
getClassList(elm).remove(makeHostToken(oldToken));
|
|
4565
|
-
}
|
|
4566
|
-
if (oldHasTokenInAttribute) {
|
|
4567
|
-
removeAttribute(elm, makeHostToken(oldToken));
|
|
4568
|
-
}
|
|
4569
|
-
}
|
|
4570
|
-
// Apply the new template styling token to the host element, if the new template has any
|
|
4571
|
-
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
4572
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
4573
|
-
newToken = newStylesheetToken;
|
|
4574
|
-
}
|
|
4575
|
-
// Set the new styling token on the host element
|
|
4576
|
-
if (!isUndefined$1(newToken)) {
|
|
4577
|
-
if (hasScopedStyles) {
|
|
4578
|
-
getClassList(elm).add(makeHostToken(newToken));
|
|
4579
|
-
newHasTokenInClass = true;
|
|
4580
|
-
}
|
|
4581
|
-
if (isSyntheticShadow) {
|
|
4582
|
-
setAttribute(elm, makeHostToken(newToken), '');
|
|
4583
|
-
newHasTokenInAttribute = true;
|
|
4584
|
-
}
|
|
4585
|
-
}
|
|
4586
|
-
// Update the styling tokens present on the context object.
|
|
4587
|
-
context.stylesheetToken = newToken;
|
|
4588
|
-
context.hasTokenInClass = newHasTokenInClass;
|
|
4589
|
-
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
4590
|
-
}
|
|
4591
|
-
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
4592
|
-
const content = [];
|
|
4593
|
-
let root;
|
|
4594
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
4595
|
-
let stylesheet = stylesheets[i];
|
|
4596
|
-
if (isArray$1(stylesheet)) {
|
|
4597
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
4598
|
-
}
|
|
4599
|
-
else {
|
|
4600
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4601
|
-
// Check for compiler version mismatch in dev mode only
|
|
4602
|
-
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
4603
|
-
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
4604
|
-
// the component instance might be attempting to use an old version of
|
|
4605
|
-
// the stylesheet, while internally, we have a replacement for it.
|
|
4606
|
-
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
4607
|
-
}
|
|
4608
|
-
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
4609
|
-
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
4610
|
-
const scopeToken = isScopedCss ||
|
|
4611
|
-
(vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
|
|
4612
|
-
? stylesheetToken
|
|
4613
|
-
: undefined;
|
|
4614
|
-
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
4615
|
-
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
4616
|
-
const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
|
|
4617
|
-
? !isScopedCss
|
|
4618
|
-
: vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
4619
|
-
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
4620
|
-
// we use an attribute selector on the host to simulate :dir().
|
|
4621
|
-
let useNativeDirPseudoclass;
|
|
4622
|
-
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
4623
|
-
useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
4624
|
-
}
|
|
4625
|
-
else {
|
|
4626
|
-
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
4627
|
-
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
4628
|
-
if (isUndefined$1(root)) {
|
|
4629
|
-
// Only calculate the root once as necessary
|
|
4630
|
-
root = getNearestShadowComponent(vm);
|
|
4631
|
-
}
|
|
4632
|
-
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
4633
|
-
}
|
|
4634
|
-
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
4635
|
-
}
|
|
4636
|
-
}
|
|
4637
|
-
return content;
|
|
4638
|
-
}
|
|
4639
|
-
function getStylesheetsContent(vm, template) {
|
|
4640
|
-
const { stylesheets, stylesheetToken } = template;
|
|
4641
|
-
let content = [];
|
|
4642
|
-
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
4643
|
-
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
4644
|
-
}
|
|
4645
|
-
return content;
|
|
4646
|
-
}
|
|
4647
|
-
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
4648
|
-
// perf testing has not shown it to be a huge improvement yet:
|
|
4649
|
-
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
4650
|
-
function getNearestShadowComponent(vm) {
|
|
4651
|
-
let owner = vm;
|
|
4652
|
-
while (!isNull(owner)) {
|
|
4653
|
-
if (owner.renderMode === 1 /* RenderMode.Shadow */) {
|
|
4654
|
-
return owner;
|
|
4655
|
-
}
|
|
4656
|
-
owner = owner.owner;
|
|
4657
|
-
}
|
|
4658
|
-
return owner;
|
|
4659
|
-
}
|
|
4660
|
-
function getNearestNativeShadowComponent(vm) {
|
|
4661
|
-
const owner = getNearestShadowComponent(vm);
|
|
4662
|
-
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
4663
|
-
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
4664
|
-
// synthetic, we know we won't find a native component if we go any further.
|
|
4665
|
-
return null;
|
|
4666
|
-
}
|
|
4667
|
-
return owner;
|
|
4668
|
-
}
|
|
4669
|
-
function createStylesheet(vm, stylesheets) {
|
|
4670
|
-
const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
|
|
4671
|
-
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
4672
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
4673
|
-
insertStylesheet(stylesheets[i]);
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4676
|
-
else if (ssr || vm.hydrated) {
|
|
4677
|
-
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4678
|
-
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4679
|
-
// the first time the VM renders.
|
|
4680
|
-
// native shadow or light DOM, SSR
|
|
4681
|
-
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
4682
|
-
}
|
|
4683
|
-
else {
|
|
4684
|
-
// native shadow or light DOM, DOM renderer
|
|
4685
|
-
const root = getNearestNativeShadowComponent(vm);
|
|
4686
|
-
// null root means a global style
|
|
4687
|
-
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4688
|
-
for (let i = 0; i < stylesheets.length; i++) {
|
|
4689
|
-
insertStylesheet(stylesheets[i], target);
|
|
4690
|
-
}
|
|
4691
|
-
}
|
|
4692
|
-
return null;
|
|
4693
|
-
}
|
|
4694
|
-
|
|
4695
4708
|
/*
|
|
4696
4709
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4697
4710
|
* All rights reserved.
|
|
@@ -6273,7 +6286,7 @@ function freezeTemplate(tmpl) {
|
|
|
6273
6286
|
});
|
|
6274
6287
|
}
|
|
6275
6288
|
}
|
|
6276
|
-
/* version: 2.20.
|
|
6289
|
+
/* version: 2.20.5 */
|
|
6277
6290
|
|
|
6278
6291
|
/*
|
|
6279
6292
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6281,6 +6294,16 @@ function freezeTemplate(tmpl) {
|
|
|
6281
6294
|
* SPDX-License-Identifier: MIT
|
|
6282
6295
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6283
6296
|
*/
|
|
6297
|
+
// We use Symbols as the keys for HostElement properties to avoid conflicting
|
|
6298
|
+
// with public component properties defined by a component author.
|
|
6299
|
+
const HostNamespaceKey = Symbol('namespace');
|
|
6300
|
+
const HostTypeKey = Symbol('type');
|
|
6301
|
+
const HostParentKey = Symbol('parent');
|
|
6302
|
+
const HostShadowRootKey = Symbol('shadow-root');
|
|
6303
|
+
const HostChildrenKey = Symbol('children');
|
|
6304
|
+
const HostAttributesKey = Symbol('attributes');
|
|
6305
|
+
const HostEventListenersKey = Symbol('event-listeners');
|
|
6306
|
+
const HostValueKey = Symbol('value');
|
|
6284
6307
|
var HostNodeType;
|
|
6285
6308
|
(function (HostNodeType) {
|
|
6286
6309
|
HostNodeType["Text"] = "text";
|
|
@@ -6315,16 +6338,16 @@ function unsupportedMethod(name) {
|
|
|
6315
6338
|
throw new TypeError(`"${name}" is not supported in this environment`);
|
|
6316
6339
|
};
|
|
6317
6340
|
}
|
|
6318
|
-
function createElement(
|
|
6341
|
+
function createElement(tagName, namespace) {
|
|
6319
6342
|
return {
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6343
|
+
[HostTypeKey]: HostNodeType.Element,
|
|
6344
|
+
tagName,
|
|
6345
|
+
[HostNamespaceKey]: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
|
|
6346
|
+
[HostParentKey]: null,
|
|
6347
|
+
[HostShadowRootKey]: null,
|
|
6348
|
+
[HostChildrenKey]: [],
|
|
6349
|
+
[HostAttributesKey]: [],
|
|
6350
|
+
[HostEventListenersKey]: {},
|
|
6328
6351
|
};
|
|
6329
6352
|
}
|
|
6330
6353
|
const registry = create(null);
|
|
@@ -6339,11 +6362,11 @@ function registerCustomElement(name, ctor) {
|
|
|
6339
6362
|
class HTMLElementImpl {
|
|
6340
6363
|
constructor() {
|
|
6341
6364
|
const { constructor } = this;
|
|
6342
|
-
const
|
|
6343
|
-
if (!
|
|
6365
|
+
const tagName = reverseRegistry.get(constructor);
|
|
6366
|
+
if (!tagName) {
|
|
6344
6367
|
throw new TypeError(`Invalid Construction`);
|
|
6345
6368
|
}
|
|
6346
|
-
return createElement(
|
|
6369
|
+
return createElement(tagName);
|
|
6347
6370
|
}
|
|
6348
6371
|
}
|
|
6349
6372
|
const ssr = true;
|
|
@@ -6353,73 +6376,74 @@ function isHydrating() {
|
|
|
6353
6376
|
const isNativeShadowDefined = false;
|
|
6354
6377
|
const isSyntheticShadowDefined = false;
|
|
6355
6378
|
function insert(node, parent, anchor) {
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6379
|
+
const nodeParent = node[HostParentKey];
|
|
6380
|
+
if (nodeParent !== null && nodeParent !== parent) {
|
|
6381
|
+
const nodeIndex = nodeParent[HostChildrenKey].indexOf(node);
|
|
6382
|
+
nodeParent[HostChildrenKey].splice(nodeIndex, 1);
|
|
6359
6383
|
}
|
|
6360
|
-
node
|
|
6361
|
-
const anchorIndex = isNull(anchor) ? -1 : parent.
|
|
6384
|
+
node[HostParentKey] = parent;
|
|
6385
|
+
const anchorIndex = isNull(anchor) ? -1 : parent[HostChildrenKey].indexOf(anchor);
|
|
6362
6386
|
if (anchorIndex === -1) {
|
|
6363
|
-
parent.
|
|
6387
|
+
parent[HostChildrenKey].push(node);
|
|
6364
6388
|
}
|
|
6365
6389
|
else {
|
|
6366
|
-
parent.
|
|
6390
|
+
parent[HostChildrenKey].splice(anchorIndex, 0, node);
|
|
6367
6391
|
}
|
|
6368
6392
|
}
|
|
6369
6393
|
function remove(node, parent) {
|
|
6370
|
-
const nodeIndex = parent.
|
|
6371
|
-
parent.
|
|
6394
|
+
const nodeIndex = parent[HostChildrenKey].indexOf(node);
|
|
6395
|
+
parent[HostChildrenKey].splice(nodeIndex, 1);
|
|
6372
6396
|
}
|
|
6373
6397
|
function cloneNode(node) {
|
|
6374
6398
|
return node;
|
|
6375
6399
|
}
|
|
6376
6400
|
function createFragment(html) {
|
|
6377
6401
|
return {
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6402
|
+
[HostTypeKey]: HostNodeType.Raw,
|
|
6403
|
+
[HostParentKey]: null,
|
|
6404
|
+
[HostValueKey]: html,
|
|
6381
6405
|
};
|
|
6382
6406
|
}
|
|
6383
6407
|
function createText(content) {
|
|
6384
6408
|
return {
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6409
|
+
[HostTypeKey]: HostNodeType.Text,
|
|
6410
|
+
[HostValueKey]: String(content),
|
|
6411
|
+
[HostParentKey]: null,
|
|
6388
6412
|
};
|
|
6389
6413
|
}
|
|
6390
6414
|
function createComment(content) {
|
|
6391
6415
|
return {
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6416
|
+
[HostTypeKey]: HostNodeType.Comment,
|
|
6417
|
+
[HostValueKey]: content,
|
|
6418
|
+
[HostParentKey]: null,
|
|
6395
6419
|
};
|
|
6396
6420
|
}
|
|
6397
6421
|
function nextSibling(node) {
|
|
6398
|
-
const
|
|
6422
|
+
const parent = node[HostParentKey];
|
|
6399
6423
|
if (isNull(parent)) {
|
|
6400
6424
|
return null;
|
|
6401
6425
|
}
|
|
6402
|
-
const nodeIndex = parent.
|
|
6403
|
-
return parent
|
|
6426
|
+
const nodeIndex = parent[HostChildrenKey].indexOf(node);
|
|
6427
|
+
return parent[HostChildrenKey][nodeIndex + 1] || null;
|
|
6404
6428
|
}
|
|
6405
6429
|
function attachShadow(element, config) {
|
|
6406
|
-
element
|
|
6407
|
-
|
|
6408
|
-
|
|
6430
|
+
element[HostShadowRootKey] = {
|
|
6431
|
+
[HostTypeKey]: HostNodeType.ShadowRoot,
|
|
6432
|
+
[HostChildrenKey]: [],
|
|
6409
6433
|
mode: config.mode,
|
|
6410
6434
|
delegatesFocus: !!config.delegatesFocus,
|
|
6411
6435
|
};
|
|
6412
|
-
return element
|
|
6436
|
+
return element[HostShadowRootKey];
|
|
6413
6437
|
}
|
|
6414
6438
|
function getProperty(node, key) {
|
|
6415
6439
|
var _a, _b;
|
|
6416
6440
|
if (key in node) {
|
|
6417
6441
|
return node[key];
|
|
6418
6442
|
}
|
|
6419
|
-
if (node
|
|
6443
|
+
if (node[HostTypeKey] === HostNodeType.Element) {
|
|
6420
6444
|
const attrName = htmlPropertyToAttribute(key);
|
|
6421
6445
|
// Handle all the boolean properties.
|
|
6422
|
-
if (isBooleanAttribute(attrName, node.
|
|
6446
|
+
if (isBooleanAttribute(attrName, node.tagName)) {
|
|
6423
6447
|
return (_a = getAttribute(node, attrName)) !== null && _a !== void 0 ? _a : false;
|
|
6424
6448
|
}
|
|
6425
6449
|
// Handle global html attributes and AOM.
|
|
@@ -6428,7 +6452,7 @@ function getProperty(node, key) {
|
|
|
6428
6452
|
}
|
|
6429
6453
|
// Handle special elements live bindings. The checked property is already handled above
|
|
6430
6454
|
// in the boolean case.
|
|
6431
|
-
if (node.
|
|
6455
|
+
if (node.tagName === 'input' && key === 'value') {
|
|
6432
6456
|
return (_b = getAttribute(node, 'value')) !== null && _b !== void 0 ? _b : '';
|
|
6433
6457
|
}
|
|
6434
6458
|
}
|
|
@@ -6441,20 +6465,20 @@ function setProperty(node, key, value) {
|
|
|
6441
6465
|
if (key in node) {
|
|
6442
6466
|
return (node[key] = value);
|
|
6443
6467
|
}
|
|
6444
|
-
if (node
|
|
6468
|
+
if (node[HostTypeKey] === HostNodeType.Element) {
|
|
6445
6469
|
const attrName = htmlPropertyToAttribute(key);
|
|
6446
6470
|
if (key === 'innerHTML') {
|
|
6447
|
-
node
|
|
6471
|
+
node[HostChildrenKey] = [
|
|
6448
6472
|
{
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
value,
|
|
6473
|
+
[HostTypeKey]: HostNodeType.Raw,
|
|
6474
|
+
[HostParentKey]: node,
|
|
6475
|
+
[HostValueKey]: value,
|
|
6452
6476
|
},
|
|
6453
6477
|
];
|
|
6454
6478
|
return;
|
|
6455
6479
|
}
|
|
6456
6480
|
// Handle all the boolean properties.
|
|
6457
|
-
if (isBooleanAttribute(attrName, node.
|
|
6481
|
+
if (isBooleanAttribute(attrName, node.tagName)) {
|
|
6458
6482
|
return value === true
|
|
6459
6483
|
? setAttribute(node, attrName, '')
|
|
6460
6484
|
: removeAttribute(node, attrName);
|
|
@@ -6465,7 +6489,7 @@ function setProperty(node, key, value) {
|
|
|
6465
6489
|
}
|
|
6466
6490
|
// Handle special elements live bindings. The checked property is already handled above
|
|
6467
6491
|
// in the boolean case.
|
|
6468
|
-
if (node.
|
|
6492
|
+
if (node.tagName === 'input' && attrName === 'value') {
|
|
6469
6493
|
return isNull(value) || isUndefined$1(value)
|
|
6470
6494
|
? removeAttribute(node, 'value')
|
|
6471
6495
|
: setAttribute(node, 'value', value);
|
|
@@ -6477,32 +6501,32 @@ function setProperty(node, key, value) {
|
|
|
6477
6501
|
}
|
|
6478
6502
|
}
|
|
6479
6503
|
function setText(node, content) {
|
|
6480
|
-
if (node
|
|
6481
|
-
node
|
|
6504
|
+
if (node[HostTypeKey] === HostNodeType.Text) {
|
|
6505
|
+
node[HostValueKey] = content;
|
|
6482
6506
|
}
|
|
6483
|
-
else if (node
|
|
6484
|
-
node
|
|
6507
|
+
else if (node[HostTypeKey] === HostNodeType.Element) {
|
|
6508
|
+
node[HostChildrenKey] = [
|
|
6485
6509
|
{
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6510
|
+
[HostTypeKey]: HostNodeType.Text,
|
|
6511
|
+
[HostParentKey]: node,
|
|
6512
|
+
[HostValueKey]: content,
|
|
6489
6513
|
},
|
|
6490
6514
|
];
|
|
6491
6515
|
}
|
|
6492
6516
|
}
|
|
6493
6517
|
function getAttribute(element, name, namespace = null) {
|
|
6494
|
-
const attribute = element.
|
|
6518
|
+
const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
|
|
6495
6519
|
return attribute ? attribute.value : null;
|
|
6496
6520
|
}
|
|
6497
6521
|
function setAttribute(element, name, value, namespace = null) {
|
|
6498
|
-
const attribute = element.
|
|
6522
|
+
const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
|
|
6499
6523
|
if (isUndefined$1(namespace)) {
|
|
6500
6524
|
namespace = null;
|
|
6501
6525
|
}
|
|
6502
6526
|
if (isUndefined$1(attribute)) {
|
|
6503
|
-
element.
|
|
6527
|
+
element[HostAttributesKey].push({
|
|
6504
6528
|
name,
|
|
6505
|
-
namespace,
|
|
6529
|
+
[HostNamespaceKey]: namespace,
|
|
6506
6530
|
value: String(value),
|
|
6507
6531
|
});
|
|
6508
6532
|
}
|
|
@@ -6511,18 +6535,18 @@ function setAttribute(element, name, value, namespace = null) {
|
|
|
6511
6535
|
}
|
|
6512
6536
|
}
|
|
6513
6537
|
function removeAttribute(element, name, namespace) {
|
|
6514
|
-
element
|
|
6538
|
+
element[HostAttributesKey] = element[HostAttributesKey].filter((attr) => attr.name !== name && attr[HostNamespaceKey] !== namespace);
|
|
6515
6539
|
}
|
|
6516
6540
|
function getClassList(element) {
|
|
6517
6541
|
function getClassAttribute() {
|
|
6518
|
-
let classAttribute = element.
|
|
6542
|
+
let classAttribute = element[HostAttributesKey].find((attr) => attr.name === 'class' && isNull(attr[HostNamespaceKey]));
|
|
6519
6543
|
if (isUndefined$1(classAttribute)) {
|
|
6520
6544
|
classAttribute = {
|
|
6521
6545
|
name: 'class',
|
|
6522
|
-
|
|
6546
|
+
[HostNamespaceKey]: null,
|
|
6523
6547
|
value: '',
|
|
6524
6548
|
};
|
|
6525
|
-
element.
|
|
6549
|
+
element[HostAttributesKey].push(classAttribute);
|
|
6526
6550
|
}
|
|
6527
6551
|
return classAttribute;
|
|
6528
6552
|
}
|
|
@@ -6542,12 +6566,12 @@ function getClassList(element) {
|
|
|
6542
6566
|
};
|
|
6543
6567
|
}
|
|
6544
6568
|
function setCSSStyleProperty(element, name, value, important) {
|
|
6545
|
-
const styleAttribute = element.
|
|
6569
|
+
const styleAttribute = element[HostAttributesKey].find((attr) => attr.name === 'style' && isNull(attr[HostNamespaceKey]));
|
|
6546
6570
|
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
6547
6571
|
if (isUndefined$1(styleAttribute)) {
|
|
6548
|
-
element.
|
|
6572
|
+
element[HostAttributesKey].push({
|
|
6549
6573
|
name: 'style',
|
|
6550
|
-
|
|
6574
|
+
[HostNamespaceKey]: null,
|
|
6551
6575
|
value: serializedProperty,
|
|
6552
6576
|
});
|
|
6553
6577
|
}
|
|
@@ -6556,7 +6580,7 @@ function setCSSStyleProperty(element, name, value, important) {
|
|
|
6556
6580
|
}
|
|
6557
6581
|
}
|
|
6558
6582
|
function isConnected(node) {
|
|
6559
|
-
return !isNull(node
|
|
6583
|
+
return !isNull(node[HostParentKey]);
|
|
6560
6584
|
}
|
|
6561
6585
|
// Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
|
|
6562
6586
|
// synthetic shadow.
|
|
@@ -6644,13 +6668,13 @@ function serializeAttributes(attributes) {
|
|
|
6644
6668
|
function serializeChildNodes(children) {
|
|
6645
6669
|
return children
|
|
6646
6670
|
.map((child) => {
|
|
6647
|
-
switch (child
|
|
6671
|
+
switch (child[HostTypeKey]) {
|
|
6648
6672
|
case HostNodeType.Text:
|
|
6649
|
-
return child
|
|
6673
|
+
return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
|
|
6650
6674
|
case HostNodeType.Comment:
|
|
6651
|
-
return `<!--${htmlEscape(child
|
|
6675
|
+
return `<!--${htmlEscape(child[HostValueKey])}-->`;
|
|
6652
6676
|
case HostNodeType.Raw:
|
|
6653
|
-
return child
|
|
6677
|
+
return child[HostValueKey];
|
|
6654
6678
|
case HostNodeType.Element:
|
|
6655
6679
|
return serializeElement(child);
|
|
6656
6680
|
}
|
|
@@ -6662,27 +6686,30 @@ function serializeShadowRoot(shadowRoot) {
|
|
|
6662
6686
|
if (shadowRoot.delegatesFocus) {
|
|
6663
6687
|
attrs.push('shadowrootdelegatesfocus');
|
|
6664
6688
|
}
|
|
6665
|
-
return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot
|
|
6689
|
+
return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot[HostChildrenKey])}</template>`;
|
|
6666
6690
|
}
|
|
6667
6691
|
function serializeElement(element) {
|
|
6668
6692
|
let output = '';
|
|
6669
|
-
const
|
|
6693
|
+
const tagName = element.tagName;
|
|
6694
|
+
const namespace = element[HostNamespaceKey];
|
|
6670
6695
|
const isForeignElement = namespace !== HTML_NAMESPACE;
|
|
6671
|
-
const hasChildren = element.
|
|
6672
|
-
const attrs = element.
|
|
6673
|
-
|
|
6696
|
+
const hasChildren = element[HostChildrenKey].length > 0;
|
|
6697
|
+
const attrs = element[HostAttributesKey].length
|
|
6698
|
+
? ` ${serializeAttributes(element[HostAttributesKey])}`
|
|
6699
|
+
: '';
|
|
6700
|
+
output += `<${tagName}${attrs}`;
|
|
6674
6701
|
// Note that foreign elements can have children but not shadow roots
|
|
6675
6702
|
if (isForeignElement && !hasChildren) {
|
|
6676
6703
|
output += '/>';
|
|
6677
6704
|
return output;
|
|
6678
6705
|
}
|
|
6679
6706
|
output += '>';
|
|
6680
|
-
if (element
|
|
6681
|
-
output += serializeShadowRoot(element
|
|
6707
|
+
if (element[HostShadowRootKey]) {
|
|
6708
|
+
output += serializeShadowRoot(element[HostShadowRootKey]);
|
|
6682
6709
|
}
|
|
6683
|
-
output += serializeChildNodes(element
|
|
6684
|
-
if (!isVoidElement(
|
|
6685
|
-
output += `</${
|
|
6710
|
+
output += serializeChildNodes(element[HostChildrenKey]);
|
|
6711
|
+
if (!isVoidElement(tagName, namespace) || hasChildren) {
|
|
6712
|
+
output += `</${tagName}>`;
|
|
6686
6713
|
}
|
|
6687
6714
|
return output;
|
|
6688
6715
|
}
|
|
@@ -6694,14 +6721,14 @@ function serializeElement(element) {
|
|
|
6694
6721
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6695
6722
|
*/
|
|
6696
6723
|
const FakeRootElement = {
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6724
|
+
[HostTypeKey]: HostNodeType.Element,
|
|
6725
|
+
tagName: 'fake-root-element',
|
|
6726
|
+
[HostNamespaceKey]: HTML_NAMESPACE,
|
|
6727
|
+
[HostParentKey]: null,
|
|
6728
|
+
[HostShadowRootKey]: null,
|
|
6729
|
+
[HostChildrenKey]: [],
|
|
6730
|
+
[HostAttributesKey]: [],
|
|
6731
|
+
[HostEventListenersKey]: {},
|
|
6705
6732
|
};
|
|
6706
6733
|
function renderComponent(tagName, Ctor, props = {}) {
|
|
6707
6734
|
if (!isString(tagName)) {
|
|
@@ -6722,7 +6749,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6722
6749
|
for (const [key, value] of Object.entries(props)) {
|
|
6723
6750
|
element[key] = value;
|
|
6724
6751
|
}
|
|
6725
|
-
element
|
|
6752
|
+
element[HostParentKey] = FakeRootElement;
|
|
6726
6753
|
connectRootElement(element);
|
|
6727
6754
|
return serializeElement(element);
|
|
6728
6755
|
}
|
|
@@ -6735,7 +6762,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6735
6762
|
*/
|
|
6736
6763
|
freeze(LightningElement);
|
|
6737
6764
|
seal(LightningElement.prototype);
|
|
6738
|
-
/* version: 2.20.
|
|
6765
|
+
/* version: 2.20.5 */
|
|
6739
6766
|
|
|
6740
6767
|
exports.LightningElement = LightningElement;
|
|
6741
6768
|
exports.api = api$1;
|