lwc 2.20.3 → 2.21.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.
- package/dist/engine-dom/esm/es2017/engine-dom.js +41 -61
- package/dist/engine-dom/iife/es2017/engine-dom.js +41 -61
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +28 -49
- package/dist/engine-dom/iife/es5/engine-dom.js +49 -73
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +37 -58
- package/dist/engine-dom/umd/es2017/engine-dom.js +41 -61
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +28 -49
- package/dist/engine-dom/umd/es5/engine-dom.js +49 -73
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +37 -58
- package/dist/engine-server/commonjs/es2017/engine-server.js +144 -150
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +144 -150
- 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
|
@@ -419,9 +419,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
419
419
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
420
420
|
*/
|
|
421
421
|
// Increment whenever the LWC template compiler changes
|
|
422
|
-
const LWC_VERSION = "2.
|
|
422
|
+
const LWC_VERSION = "2.21.1";
|
|
423
423
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
424
|
-
/** version: 2.
|
|
424
|
+
/** version: 2.21.1 */
|
|
425
425
|
|
|
426
426
|
/*
|
|
427
427
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -530,7 +530,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
530
530
|
setFeatureFlag(name, value);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
-
/** version: 2.
|
|
533
|
+
/** version: 2.21.1 */
|
|
534
534
|
|
|
535
535
|
/* proxy-compat-disable */
|
|
536
536
|
|
|
@@ -3796,10 +3796,11 @@ function mountElement(vnode, parent, anchor, renderer) {
|
|
|
3796
3796
|
const { sel, owner, data: { svg }, } = vnode;
|
|
3797
3797
|
const { createElement } = renderer;
|
|
3798
3798
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3799
|
-
const elm = createElement(sel, namespace);
|
|
3799
|
+
const elm = (vnode.elm = createElement(sel, namespace));
|
|
3800
3800
|
linkNodeToShadow(elm, owner, renderer);
|
|
3801
|
-
|
|
3802
|
-
|
|
3801
|
+
applyStyleScoping(elm, owner, renderer);
|
|
3802
|
+
applyDomManual(elm, vnode);
|
|
3803
|
+
applyElementRestrictions(elm, vnode);
|
|
3803
3804
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3804
3805
|
insertNode(elm, parent, anchor, renderer);
|
|
3805
3806
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
@@ -3814,6 +3815,7 @@ function mountStatic(vnode, parent, anchor, renderer) {
|
|
|
3814
3815
|
const { cloneNode, isSyntheticShadowDefined } = renderer;
|
|
3815
3816
|
const elm = (vnode.elm = cloneNode(vnode.fragment, true));
|
|
3816
3817
|
linkNodeToShadow(elm, owner, renderer);
|
|
3818
|
+
applyElementRestrictions(elm, vnode);
|
|
3817
3819
|
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3818
3820
|
const { renderMode, shadowMode } = owner;
|
|
3819
3821
|
if (isSyntheticShadowDefined) {
|
|
@@ -3821,10 +3823,6 @@ function mountStatic(vnode, parent, anchor, renderer) {
|
|
|
3821
3823
|
elm[KEY__SHADOW_STATIC] = true;
|
|
3822
3824
|
}
|
|
3823
3825
|
}
|
|
3824
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3825
|
-
const isLight = renderMode === 0 /* RenderMode.Light */;
|
|
3826
|
-
patchElementWithRestrictions(elm, { isPortal: false, isLight });
|
|
3827
|
-
}
|
|
3828
3826
|
insertNode(elm, parent, anchor, renderer);
|
|
3829
3827
|
}
|
|
3830
3828
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
@@ -3841,9 +3839,10 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3841
3839
|
// the custom element from the registry is expecting an upgrade callback
|
|
3842
3840
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
3843
3841
|
});
|
|
3844
|
-
linkNodeToShadow(elm, owner, renderer);
|
|
3845
3842
|
vnode.elm = elm;
|
|
3846
3843
|
vnode.vm = vm;
|
|
3844
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
3845
|
+
applyStyleScoping(elm, owner, renderer);
|
|
3847
3846
|
if (vm) {
|
|
3848
3847
|
allocateChildren(vnode, vm);
|
|
3849
3848
|
}
|
|
@@ -3927,22 +3926,6 @@ function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, en
|
|
|
3927
3926
|
function isVNode(vnode) {
|
|
3928
3927
|
return vnode != null;
|
|
3929
3928
|
}
|
|
3930
|
-
function observeElementChildNodes(elm) {
|
|
3931
|
-
elm.$domManual$ = true;
|
|
3932
|
-
}
|
|
3933
|
-
function setElementShadowToken(elm, token) {
|
|
3934
|
-
elm.$shadowToken$ = token;
|
|
3935
|
-
}
|
|
3936
|
-
// Set the scope token class for *.scoped.css styles
|
|
3937
|
-
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
3938
|
-
const token = getScopeTokenClass(owner);
|
|
3939
|
-
if (!isNull(token)) {
|
|
3940
|
-
const { getClassList } = renderer;
|
|
3941
|
-
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3942
|
-
// probably we should have a renderer api for just the add operation
|
|
3943
|
-
getClassList(elm).add(token);
|
|
3944
|
-
}
|
|
3945
|
-
}
|
|
3946
3929
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
3947
3930
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
3948
3931
|
const { isSyntheticShadowDefined } = renderer;
|
|
@@ -3995,31 +3978,37 @@ function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
|
3995
3978
|
patchAttributes(oldVnode, vnode, renderer);
|
|
3996
3979
|
patchProps(oldVnode, vnode, renderer);
|
|
3997
3980
|
}
|
|
3998
|
-
function
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
if (
|
|
4002
|
-
const {
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
context.lwc.dom === "manual" /* LwcDomMode.Manual */) {
|
|
4007
|
-
// this element will now accept any manual content inserted into it
|
|
4008
|
-
observeElementChildNodes(elm);
|
|
4009
|
-
}
|
|
4010
|
-
if (!isUndefined$1(stylesheetToken)) {
|
|
4011
|
-
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4012
|
-
// into each element from the template, so they can be styled accordingly.
|
|
4013
|
-
setElementShadowToken(elm, stylesheetToken);
|
|
4014
|
-
}
|
|
3981
|
+
function applyStyleScoping(elm, owner, renderer) {
|
|
3982
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
3983
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
3984
|
+
if (!isNull(scopeToken)) {
|
|
3985
|
+
const { getClassList } = renderer;
|
|
3986
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
3987
|
+
// probably we should have a renderer api for just the add operation
|
|
3988
|
+
getClassList(elm).add(scopeToken);
|
|
4015
3989
|
}
|
|
3990
|
+
// Set property element for synthetic shadow DOM style scoping.
|
|
3991
|
+
const { stylesheetToken: syntheticToken } = owner.context;
|
|
3992
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
|
|
3993
|
+
elm.$shadowToken$ = syntheticToken;
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
function applyDomManual(elm, vnode) {
|
|
3997
|
+
var _a;
|
|
3998
|
+
const { owner, data: { context }, } = vnode;
|
|
3999
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
|
|
4000
|
+
elm.$domManual$ = true;
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
function applyElementRestrictions(elm, vnode) {
|
|
4004
|
+
var _a, _b;
|
|
4016
4005
|
if (process.env.NODE_ENV !== 'production') {
|
|
4017
|
-
const
|
|
4018
|
-
const
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4006
|
+
const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
|
|
4007
|
+
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4008
|
+
patchElementWithRestrictions(elm, {
|
|
4009
|
+
isPortal,
|
|
4010
|
+
isLight,
|
|
4011
|
+
});
|
|
4023
4012
|
}
|
|
4024
4013
|
}
|
|
4025
4014
|
function allocateChildren(vnode, vm) {
|
|
@@ -4054,15 +4043,6 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4054
4043
|
return vm;
|
|
4055
4044
|
}
|
|
4056
4045
|
const { sel, mode, ctor, owner } = vnode;
|
|
4057
|
-
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
4058
|
-
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
4059
|
-
const { stylesheetToken } = owner.context;
|
|
4060
|
-
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4061
|
-
// into each element from the template, so they can be styled accordingly.
|
|
4062
|
-
if (!isUndefined$1(stylesheetToken)) {
|
|
4063
|
-
setElementShadowToken(elm, stylesheetToken);
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
4066
4046
|
vm = createVM(elm, ctor, renderer, {
|
|
4067
4047
|
mode,
|
|
4068
4048
|
owner,
|
|
@@ -6281,7 +6261,7 @@ function freezeTemplate(tmpl) {
|
|
|
6281
6261
|
});
|
|
6282
6262
|
}
|
|
6283
6263
|
}
|
|
6284
|
-
/* version: 2.
|
|
6264
|
+
/* version: 2.21.1 */
|
|
6285
6265
|
|
|
6286
6266
|
/*
|
|
6287
6267
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6289,6 +6269,16 @@ function freezeTemplate(tmpl) {
|
|
|
6289
6269
|
* SPDX-License-Identifier: MIT
|
|
6290
6270
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6291
6271
|
*/
|
|
6272
|
+
// We use Symbols as the keys for HostElement properties to avoid conflicting
|
|
6273
|
+
// with public component properties defined by a component author.
|
|
6274
|
+
const HostNamespaceKey = Symbol('namespace');
|
|
6275
|
+
const HostTypeKey = Symbol('type');
|
|
6276
|
+
const HostParentKey = Symbol('parent');
|
|
6277
|
+
const HostShadowRootKey = Symbol('shadow-root');
|
|
6278
|
+
const HostChildrenKey = Symbol('children');
|
|
6279
|
+
const HostAttributesKey = Symbol('attributes');
|
|
6280
|
+
const HostEventListenersKey = Symbol('event-listeners');
|
|
6281
|
+
const HostValueKey = Symbol('value');
|
|
6292
6282
|
var HostNodeType;
|
|
6293
6283
|
(function (HostNodeType) {
|
|
6294
6284
|
HostNodeType["Text"] = "text";
|
|
@@ -6323,16 +6313,16 @@ function unsupportedMethod(name) {
|
|
|
6323
6313
|
throw new TypeError(`"${name}" is not supported in this environment`);
|
|
6324
6314
|
};
|
|
6325
6315
|
}
|
|
6326
|
-
function createElement(
|
|
6316
|
+
function createElement(tagName, namespace) {
|
|
6327
6317
|
return {
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6318
|
+
[HostTypeKey]: HostNodeType.Element,
|
|
6319
|
+
tagName,
|
|
6320
|
+
[HostNamespaceKey]: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
|
|
6321
|
+
[HostParentKey]: null,
|
|
6322
|
+
[HostShadowRootKey]: null,
|
|
6323
|
+
[HostChildrenKey]: [],
|
|
6324
|
+
[HostAttributesKey]: [],
|
|
6325
|
+
[HostEventListenersKey]: {},
|
|
6336
6326
|
};
|
|
6337
6327
|
}
|
|
6338
6328
|
const registry = create(null);
|
|
@@ -6347,11 +6337,11 @@ function registerCustomElement(name, ctor) {
|
|
|
6347
6337
|
class HTMLElementImpl {
|
|
6348
6338
|
constructor() {
|
|
6349
6339
|
const { constructor } = this;
|
|
6350
|
-
const
|
|
6351
|
-
if (!
|
|
6340
|
+
const tagName = reverseRegistry.get(constructor);
|
|
6341
|
+
if (!tagName) {
|
|
6352
6342
|
throw new TypeError(`Invalid Construction`);
|
|
6353
6343
|
}
|
|
6354
|
-
return createElement(
|
|
6344
|
+
return createElement(tagName);
|
|
6355
6345
|
}
|
|
6356
6346
|
}
|
|
6357
6347
|
const ssr = true;
|
|
@@ -6361,73 +6351,74 @@ function isHydrating() {
|
|
|
6361
6351
|
const isNativeShadowDefined = false;
|
|
6362
6352
|
const isSyntheticShadowDefined = false;
|
|
6363
6353
|
function insert(node, parent, anchor) {
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6354
|
+
const nodeParent = node[HostParentKey];
|
|
6355
|
+
if (nodeParent !== null && nodeParent !== parent) {
|
|
6356
|
+
const nodeIndex = nodeParent[HostChildrenKey].indexOf(node);
|
|
6357
|
+
nodeParent[HostChildrenKey].splice(nodeIndex, 1);
|
|
6367
6358
|
}
|
|
6368
|
-
node
|
|
6369
|
-
const anchorIndex = isNull(anchor) ? -1 : parent.
|
|
6359
|
+
node[HostParentKey] = parent;
|
|
6360
|
+
const anchorIndex = isNull(anchor) ? -1 : parent[HostChildrenKey].indexOf(anchor);
|
|
6370
6361
|
if (anchorIndex === -1) {
|
|
6371
|
-
parent.
|
|
6362
|
+
parent[HostChildrenKey].push(node);
|
|
6372
6363
|
}
|
|
6373
6364
|
else {
|
|
6374
|
-
parent.
|
|
6365
|
+
parent[HostChildrenKey].splice(anchorIndex, 0, node);
|
|
6375
6366
|
}
|
|
6376
6367
|
}
|
|
6377
6368
|
function remove(node, parent) {
|
|
6378
|
-
const nodeIndex = parent.
|
|
6379
|
-
parent.
|
|
6369
|
+
const nodeIndex = parent[HostChildrenKey].indexOf(node);
|
|
6370
|
+
parent[HostChildrenKey].splice(nodeIndex, 1);
|
|
6380
6371
|
}
|
|
6381
6372
|
function cloneNode(node) {
|
|
6382
6373
|
return node;
|
|
6383
6374
|
}
|
|
6384
6375
|
function createFragment(html) {
|
|
6385
6376
|
return {
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
6377
|
+
[HostTypeKey]: HostNodeType.Raw,
|
|
6378
|
+
[HostParentKey]: null,
|
|
6379
|
+
[HostValueKey]: html,
|
|
6389
6380
|
};
|
|
6390
6381
|
}
|
|
6391
6382
|
function createText(content) {
|
|
6392
6383
|
return {
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6384
|
+
[HostTypeKey]: HostNodeType.Text,
|
|
6385
|
+
[HostValueKey]: String(content),
|
|
6386
|
+
[HostParentKey]: null,
|
|
6396
6387
|
};
|
|
6397
6388
|
}
|
|
6398
6389
|
function createComment(content) {
|
|
6399
6390
|
return {
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6391
|
+
[HostTypeKey]: HostNodeType.Comment,
|
|
6392
|
+
[HostValueKey]: content,
|
|
6393
|
+
[HostParentKey]: null,
|
|
6403
6394
|
};
|
|
6404
6395
|
}
|
|
6405
6396
|
function nextSibling(node) {
|
|
6406
|
-
const
|
|
6397
|
+
const parent = node[HostParentKey];
|
|
6407
6398
|
if (isNull(parent)) {
|
|
6408
6399
|
return null;
|
|
6409
6400
|
}
|
|
6410
|
-
const nodeIndex = parent.
|
|
6411
|
-
return parent
|
|
6401
|
+
const nodeIndex = parent[HostChildrenKey].indexOf(node);
|
|
6402
|
+
return parent[HostChildrenKey][nodeIndex + 1] || null;
|
|
6412
6403
|
}
|
|
6413
6404
|
function attachShadow(element, config) {
|
|
6414
|
-
element
|
|
6415
|
-
|
|
6416
|
-
|
|
6405
|
+
element[HostShadowRootKey] = {
|
|
6406
|
+
[HostTypeKey]: HostNodeType.ShadowRoot,
|
|
6407
|
+
[HostChildrenKey]: [],
|
|
6417
6408
|
mode: config.mode,
|
|
6418
6409
|
delegatesFocus: !!config.delegatesFocus,
|
|
6419
6410
|
};
|
|
6420
|
-
return element
|
|
6411
|
+
return element[HostShadowRootKey];
|
|
6421
6412
|
}
|
|
6422
6413
|
function getProperty(node, key) {
|
|
6423
6414
|
var _a, _b;
|
|
6424
6415
|
if (key in node) {
|
|
6425
6416
|
return node[key];
|
|
6426
6417
|
}
|
|
6427
|
-
if (node
|
|
6418
|
+
if (node[HostTypeKey] === HostNodeType.Element) {
|
|
6428
6419
|
const attrName = htmlPropertyToAttribute(key);
|
|
6429
6420
|
// Handle all the boolean properties.
|
|
6430
|
-
if (isBooleanAttribute(attrName, node.
|
|
6421
|
+
if (isBooleanAttribute(attrName, node.tagName)) {
|
|
6431
6422
|
return (_a = getAttribute(node, attrName)) !== null && _a !== void 0 ? _a : false;
|
|
6432
6423
|
}
|
|
6433
6424
|
// Handle global html attributes and AOM.
|
|
@@ -6436,7 +6427,7 @@ function getProperty(node, key) {
|
|
|
6436
6427
|
}
|
|
6437
6428
|
// Handle special elements live bindings. The checked property is already handled above
|
|
6438
6429
|
// in the boolean case.
|
|
6439
|
-
if (node.
|
|
6430
|
+
if (node.tagName === 'input' && key === 'value') {
|
|
6440
6431
|
return (_b = getAttribute(node, 'value')) !== null && _b !== void 0 ? _b : '';
|
|
6441
6432
|
}
|
|
6442
6433
|
}
|
|
@@ -6449,20 +6440,20 @@ function setProperty(node, key, value) {
|
|
|
6449
6440
|
if (key in node) {
|
|
6450
6441
|
return (node[key] = value);
|
|
6451
6442
|
}
|
|
6452
|
-
if (node
|
|
6443
|
+
if (node[HostTypeKey] === HostNodeType.Element) {
|
|
6453
6444
|
const attrName = htmlPropertyToAttribute(key);
|
|
6454
6445
|
if (key === 'innerHTML') {
|
|
6455
|
-
node
|
|
6446
|
+
node[HostChildrenKey] = [
|
|
6456
6447
|
{
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
value,
|
|
6448
|
+
[HostTypeKey]: HostNodeType.Raw,
|
|
6449
|
+
[HostParentKey]: node,
|
|
6450
|
+
[HostValueKey]: value,
|
|
6460
6451
|
},
|
|
6461
6452
|
];
|
|
6462
6453
|
return;
|
|
6463
6454
|
}
|
|
6464
6455
|
// Handle all the boolean properties.
|
|
6465
|
-
if (isBooleanAttribute(attrName, node.
|
|
6456
|
+
if (isBooleanAttribute(attrName, node.tagName)) {
|
|
6466
6457
|
return value === true
|
|
6467
6458
|
? setAttribute(node, attrName, '')
|
|
6468
6459
|
: removeAttribute(node, attrName);
|
|
@@ -6473,7 +6464,7 @@ function setProperty(node, key, value) {
|
|
|
6473
6464
|
}
|
|
6474
6465
|
// Handle special elements live bindings. The checked property is already handled above
|
|
6475
6466
|
// in the boolean case.
|
|
6476
|
-
if (node.
|
|
6467
|
+
if (node.tagName === 'input' && attrName === 'value') {
|
|
6477
6468
|
return isNull(value) || isUndefined$1(value)
|
|
6478
6469
|
? removeAttribute(node, 'value')
|
|
6479
6470
|
: setAttribute(node, 'value', value);
|
|
@@ -6485,32 +6476,32 @@ function setProperty(node, key, value) {
|
|
|
6485
6476
|
}
|
|
6486
6477
|
}
|
|
6487
6478
|
function setText(node, content) {
|
|
6488
|
-
if (node
|
|
6489
|
-
node
|
|
6479
|
+
if (node[HostTypeKey] === HostNodeType.Text) {
|
|
6480
|
+
node[HostValueKey] = content;
|
|
6490
6481
|
}
|
|
6491
|
-
else if (node
|
|
6492
|
-
node
|
|
6482
|
+
else if (node[HostTypeKey] === HostNodeType.Element) {
|
|
6483
|
+
node[HostChildrenKey] = [
|
|
6493
6484
|
{
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6485
|
+
[HostTypeKey]: HostNodeType.Text,
|
|
6486
|
+
[HostParentKey]: node,
|
|
6487
|
+
[HostValueKey]: content,
|
|
6497
6488
|
},
|
|
6498
6489
|
];
|
|
6499
6490
|
}
|
|
6500
6491
|
}
|
|
6501
6492
|
function getAttribute(element, name, namespace = null) {
|
|
6502
|
-
const attribute = element.
|
|
6493
|
+
const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
|
|
6503
6494
|
return attribute ? attribute.value : null;
|
|
6504
6495
|
}
|
|
6505
6496
|
function setAttribute(element, name, value, namespace = null) {
|
|
6506
|
-
const attribute = element.
|
|
6497
|
+
const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
|
|
6507
6498
|
if (isUndefined$1(namespace)) {
|
|
6508
6499
|
namespace = null;
|
|
6509
6500
|
}
|
|
6510
6501
|
if (isUndefined$1(attribute)) {
|
|
6511
|
-
element.
|
|
6502
|
+
element[HostAttributesKey].push({
|
|
6512
6503
|
name,
|
|
6513
|
-
namespace,
|
|
6504
|
+
[HostNamespaceKey]: namespace,
|
|
6514
6505
|
value: String(value),
|
|
6515
6506
|
});
|
|
6516
6507
|
}
|
|
@@ -6519,18 +6510,18 @@ function setAttribute(element, name, value, namespace = null) {
|
|
|
6519
6510
|
}
|
|
6520
6511
|
}
|
|
6521
6512
|
function removeAttribute(element, name, namespace) {
|
|
6522
|
-
element
|
|
6513
|
+
element[HostAttributesKey] = element[HostAttributesKey].filter((attr) => attr.name !== name && attr[HostNamespaceKey] !== namespace);
|
|
6523
6514
|
}
|
|
6524
6515
|
function getClassList(element) {
|
|
6525
6516
|
function getClassAttribute() {
|
|
6526
|
-
let classAttribute = element.
|
|
6517
|
+
let classAttribute = element[HostAttributesKey].find((attr) => attr.name === 'class' && isNull(attr[HostNamespaceKey]));
|
|
6527
6518
|
if (isUndefined$1(classAttribute)) {
|
|
6528
6519
|
classAttribute = {
|
|
6529
6520
|
name: 'class',
|
|
6530
|
-
|
|
6521
|
+
[HostNamespaceKey]: null,
|
|
6531
6522
|
value: '',
|
|
6532
6523
|
};
|
|
6533
|
-
element.
|
|
6524
|
+
element[HostAttributesKey].push(classAttribute);
|
|
6534
6525
|
}
|
|
6535
6526
|
return classAttribute;
|
|
6536
6527
|
}
|
|
@@ -6550,12 +6541,12 @@ function getClassList(element) {
|
|
|
6550
6541
|
};
|
|
6551
6542
|
}
|
|
6552
6543
|
function setCSSStyleProperty(element, name, value, important) {
|
|
6553
|
-
const styleAttribute = element.
|
|
6544
|
+
const styleAttribute = element[HostAttributesKey].find((attr) => attr.name === 'style' && isNull(attr[HostNamespaceKey]));
|
|
6554
6545
|
const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
|
|
6555
6546
|
if (isUndefined$1(styleAttribute)) {
|
|
6556
|
-
element.
|
|
6547
|
+
element[HostAttributesKey].push({
|
|
6557
6548
|
name: 'style',
|
|
6558
|
-
|
|
6549
|
+
[HostNamespaceKey]: null,
|
|
6559
6550
|
value: serializedProperty,
|
|
6560
6551
|
});
|
|
6561
6552
|
}
|
|
@@ -6564,7 +6555,7 @@ function setCSSStyleProperty(element, name, value, important) {
|
|
|
6564
6555
|
}
|
|
6565
6556
|
}
|
|
6566
6557
|
function isConnected(node) {
|
|
6567
|
-
return !isNull(node
|
|
6558
|
+
return !isNull(node[HostParentKey]);
|
|
6568
6559
|
}
|
|
6569
6560
|
// Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
|
|
6570
6561
|
// synthetic shadow.
|
|
@@ -6652,13 +6643,13 @@ function serializeAttributes(attributes) {
|
|
|
6652
6643
|
function serializeChildNodes(children) {
|
|
6653
6644
|
return children
|
|
6654
6645
|
.map((child) => {
|
|
6655
|
-
switch (child
|
|
6646
|
+
switch (child[HostTypeKey]) {
|
|
6656
6647
|
case HostNodeType.Text:
|
|
6657
|
-
return child
|
|
6648
|
+
return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
|
|
6658
6649
|
case HostNodeType.Comment:
|
|
6659
|
-
return `<!--${htmlEscape(child
|
|
6650
|
+
return `<!--${htmlEscape(child[HostValueKey])}-->`;
|
|
6660
6651
|
case HostNodeType.Raw:
|
|
6661
|
-
return child
|
|
6652
|
+
return child[HostValueKey];
|
|
6662
6653
|
case HostNodeType.Element:
|
|
6663
6654
|
return serializeElement(child);
|
|
6664
6655
|
}
|
|
@@ -6670,27 +6661,30 @@ function serializeShadowRoot(shadowRoot) {
|
|
|
6670
6661
|
if (shadowRoot.delegatesFocus) {
|
|
6671
6662
|
attrs.push('shadowrootdelegatesfocus');
|
|
6672
6663
|
}
|
|
6673
|
-
return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot
|
|
6664
|
+
return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot[HostChildrenKey])}</template>`;
|
|
6674
6665
|
}
|
|
6675
6666
|
function serializeElement(element) {
|
|
6676
6667
|
let output = '';
|
|
6677
|
-
const
|
|
6668
|
+
const tagName = element.tagName;
|
|
6669
|
+
const namespace = element[HostNamespaceKey];
|
|
6678
6670
|
const isForeignElement = namespace !== HTML_NAMESPACE;
|
|
6679
|
-
const hasChildren = element.
|
|
6680
|
-
const attrs = element.
|
|
6681
|
-
|
|
6671
|
+
const hasChildren = element[HostChildrenKey].length > 0;
|
|
6672
|
+
const attrs = element[HostAttributesKey].length
|
|
6673
|
+
? ` ${serializeAttributes(element[HostAttributesKey])}`
|
|
6674
|
+
: '';
|
|
6675
|
+
output += `<${tagName}${attrs}`;
|
|
6682
6676
|
// Note that foreign elements can have children but not shadow roots
|
|
6683
6677
|
if (isForeignElement && !hasChildren) {
|
|
6684
6678
|
output += '/>';
|
|
6685
6679
|
return output;
|
|
6686
6680
|
}
|
|
6687
6681
|
output += '>';
|
|
6688
|
-
if (element
|
|
6689
|
-
output += serializeShadowRoot(element
|
|
6682
|
+
if (element[HostShadowRootKey]) {
|
|
6683
|
+
output += serializeShadowRoot(element[HostShadowRootKey]);
|
|
6690
6684
|
}
|
|
6691
|
-
output += serializeChildNodes(element
|
|
6692
|
-
if (!isVoidElement(
|
|
6693
|
-
output += `</${
|
|
6685
|
+
output += serializeChildNodes(element[HostChildrenKey]);
|
|
6686
|
+
if (!isVoidElement(tagName, namespace) || hasChildren) {
|
|
6687
|
+
output += `</${tagName}>`;
|
|
6694
6688
|
}
|
|
6695
6689
|
return output;
|
|
6696
6690
|
}
|
|
@@ -6702,14 +6696,14 @@ function serializeElement(element) {
|
|
|
6702
6696
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6703
6697
|
*/
|
|
6704
6698
|
const FakeRootElement = {
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6699
|
+
[HostTypeKey]: HostNodeType.Element,
|
|
6700
|
+
tagName: 'fake-root-element',
|
|
6701
|
+
[HostNamespaceKey]: HTML_NAMESPACE,
|
|
6702
|
+
[HostParentKey]: null,
|
|
6703
|
+
[HostShadowRootKey]: null,
|
|
6704
|
+
[HostChildrenKey]: [],
|
|
6705
|
+
[HostAttributesKey]: [],
|
|
6706
|
+
[HostEventListenersKey]: {},
|
|
6713
6707
|
};
|
|
6714
6708
|
function renderComponent(tagName, Ctor, props = {}) {
|
|
6715
6709
|
if (!isString(tagName)) {
|
|
@@ -6730,7 +6724,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6730
6724
|
for (const [key, value] of Object.entries(props)) {
|
|
6731
6725
|
element[key] = value;
|
|
6732
6726
|
}
|
|
6733
|
-
element
|
|
6727
|
+
element[HostParentKey] = FakeRootElement;
|
|
6734
6728
|
connectRootElement(element);
|
|
6735
6729
|
return serializeElement(element);
|
|
6736
6730
|
}
|
|
@@ -6743,7 +6737,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6743
6737
|
*/
|
|
6744
6738
|
freeze(LightningElement);
|
|
6745
6739
|
seal(LightningElement.prototype);
|
|
6746
|
-
/* version: 2.
|
|
6740
|
+
/* version: 2.21.1 */
|
|
6747
6741
|
|
|
6748
6742
|
exports.LightningElement = LightningElement;
|
|
6749
6743
|
exports.api = api$1;
|