lwc 2.14.2 → 2.17.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 +155 -13
- package/dist/engine-dom/iife/es2017/engine-dom.js +156 -12
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +147 -10
- package/dist/engine-dom/iife/es5/engine-dom.js +268 -40
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +253 -38
- package/dist/engine-dom/umd/es2017/engine-dom.js +156 -12
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +147 -10
- package/dist/engine-dom/umd/es5/engine-dom.js +268 -40
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +253 -38
- package/dist/engine-server/commonjs/es2017/engine-server.js +129 -29
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +128 -30
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +29 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +24 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +24 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +29 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +29 -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
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
*/
|
|
234
234
|
const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
|
|
235
235
|
const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
236
|
+
const KEY__SHADOW_STATIC = '$shadowStaticNode$';
|
|
236
237
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
237
238
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
238
239
|
const KEY__SCOPED_CSS = '$scoped$';
|
|
@@ -293,7 +294,7 @@
|
|
|
293
294
|
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
294
295
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
295
296
|
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
296
|
-
/** version: 2.
|
|
297
|
+
/** version: 2.17.0 */
|
|
297
298
|
|
|
298
299
|
/*
|
|
299
300
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2584,6 +2585,9 @@
|
|
|
2584
2585
|
// VComment has no special capability, fallback to the owner's renderer
|
|
2585
2586
|
patchComment(n1, n2, renderer);
|
|
2586
2587
|
break;
|
|
2588
|
+
case 4 /* Static */:
|
|
2589
|
+
n2.elm = n1.elm;
|
|
2590
|
+
break;
|
|
2587
2591
|
case 2 /* Element */:
|
|
2588
2592
|
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2589
2593
|
break;
|
|
@@ -2603,6 +2607,10 @@
|
|
|
2603
2607
|
// VComment has no special capability, fallback to the owner's renderer
|
|
2604
2608
|
mountComment(node, parent, anchor, renderer);
|
|
2605
2609
|
break;
|
|
2610
|
+
case 4 /* Static */:
|
|
2611
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
2612
|
+
mountStatic(node, parent, anchor, renderer);
|
|
2613
|
+
break;
|
|
2606
2614
|
case 2 /* Element */:
|
|
2607
2615
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
2608
2616
|
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
@@ -2658,6 +2666,20 @@
|
|
|
2658
2666
|
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
2659
2667
|
patchChildren(n1.children, n2.children, elm, renderer);
|
|
2660
2668
|
}
|
|
2669
|
+
function mountStatic(vnode, parent, anchor, renderer) {
|
|
2670
|
+
const { owner } = vnode;
|
|
2671
|
+
const { cloneNode, isSyntheticShadowDefined } = renderer;
|
|
2672
|
+
const elm = (vnode.elm = cloneNode(vnode.fragment, true));
|
|
2673
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2674
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
2675
|
+
const { renderMode, shadowMode } = owner;
|
|
2676
|
+
if (isSyntheticShadowDefined) {
|
|
2677
|
+
if (shadowMode === 1 /* Synthetic */ || renderMode === 0 /* Light */) {
|
|
2678
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2682
|
+
}
|
|
2661
2683
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
2662
2684
|
const { sel, owner } = vnode;
|
|
2663
2685
|
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
@@ -3094,6 +3116,17 @@
|
|
|
3094
3116
|
function addVNodeToChildLWC(vnode) {
|
|
3095
3117
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
3096
3118
|
}
|
|
3119
|
+
// [st]atic node
|
|
3120
|
+
function st(fragment, key) {
|
|
3121
|
+
return {
|
|
3122
|
+
type: 4 /* Static */,
|
|
3123
|
+
sel: undefined,
|
|
3124
|
+
key,
|
|
3125
|
+
elm: undefined,
|
|
3126
|
+
fragment,
|
|
3127
|
+
owner: getVMBeingRendered(),
|
|
3128
|
+
};
|
|
3129
|
+
}
|
|
3097
3130
|
// [h]tml node
|
|
3098
3131
|
function h(sel, data, children = EmptyArray) {
|
|
3099
3132
|
const vmBeingRendered = getVMBeingRendered();
|
|
@@ -3370,6 +3403,7 @@
|
|
|
3370
3403
|
co,
|
|
3371
3404
|
dc,
|
|
3372
3405
|
ti,
|
|
3406
|
+
st,
|
|
3373
3407
|
gid,
|
|
3374
3408
|
fid,
|
|
3375
3409
|
shc,
|
|
@@ -3513,8 +3547,7 @@
|
|
|
3513
3547
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3514
3548
|
// the first time the VM renders.
|
|
3515
3549
|
// native shadow or light DOM, SSR
|
|
3516
|
-
|
|
3517
|
-
return createInlineStyleVNode(combinedStylesheetContent);
|
|
3550
|
+
return ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3518
3551
|
}
|
|
3519
3552
|
else {
|
|
3520
3553
|
// native shadow or light DOM, DOM renderer
|
|
@@ -3600,6 +3633,59 @@
|
|
|
3600
3633
|
assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode="shadow"`);
|
|
3601
3634
|
}
|
|
3602
3635
|
}
|
|
3636
|
+
function buildParseFragmentFn(createFragmentFn) {
|
|
3637
|
+
return (strings, ...keys) => {
|
|
3638
|
+
const cache = create(null);
|
|
3639
|
+
return function () {
|
|
3640
|
+
const { context: { hasScopedStyles, stylesheetToken }, shadowMode, renderer, } = getVMBeingRendered();
|
|
3641
|
+
const hasStyleToken = !isUndefined$1(stylesheetToken);
|
|
3642
|
+
const isSyntheticShadow = shadowMode === 1 /* Synthetic */;
|
|
3643
|
+
let cacheKey = 0;
|
|
3644
|
+
if (hasStyleToken && hasScopedStyles) {
|
|
3645
|
+
cacheKey |= 1 /* HAS_SCOPED_STYLE */;
|
|
3646
|
+
}
|
|
3647
|
+
if (hasStyleToken && isSyntheticShadow) {
|
|
3648
|
+
cacheKey |= 2 /* SHADOW_MODE_SYNTHETIC */;
|
|
3649
|
+
}
|
|
3650
|
+
if (!isUndefined$1(cache[cacheKey])) {
|
|
3651
|
+
return cache[cacheKey];
|
|
3652
|
+
}
|
|
3653
|
+
const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetToken : '';
|
|
3654
|
+
const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetToken}"` : '';
|
|
3655
|
+
const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
3656
|
+
let htmlFragment = '';
|
|
3657
|
+
for (let i = 0, n = keys.length; i < n; i++) {
|
|
3658
|
+
switch (keys[i]) {
|
|
3659
|
+
case 0: // styleToken in existing class attr
|
|
3660
|
+
htmlFragment += strings[i] + classToken;
|
|
3661
|
+
break;
|
|
3662
|
+
case 1: // styleToken for added class attr
|
|
3663
|
+
htmlFragment += strings[i] + classAttrToken;
|
|
3664
|
+
break;
|
|
3665
|
+
case 2: // styleToken as attr
|
|
3666
|
+
htmlFragment += strings[i] + attrToken;
|
|
3667
|
+
break;
|
|
3668
|
+
case 3: // ${1}${2}
|
|
3669
|
+
htmlFragment += strings[i] + classAttrToken + attrToken;
|
|
3670
|
+
break;
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
htmlFragment += strings[strings.length - 1];
|
|
3674
|
+
cache[cacheKey] = createFragmentFn(htmlFragment, renderer);
|
|
3675
|
+
return cache[cacheKey];
|
|
3676
|
+
};
|
|
3677
|
+
};
|
|
3678
|
+
}
|
|
3679
|
+
// Note: at the moment this code executes, we don't have a renderer yet.
|
|
3680
|
+
const parseFragment = buildParseFragmentFn((html, renderer) => {
|
|
3681
|
+
const { createFragment } = renderer;
|
|
3682
|
+
return createFragment(html);
|
|
3683
|
+
});
|
|
3684
|
+
const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
|
|
3685
|
+
const { createFragment, getFirstChild } = renderer;
|
|
3686
|
+
const fragment = createFragment('<svg>' + html + '</svg>');
|
|
3687
|
+
return getFirstChild(fragment);
|
|
3688
|
+
});
|
|
3603
3689
|
function evaluateTemplate(vm, html) {
|
|
3604
3690
|
const isUpdatingTemplateInception = isUpdatingTemplate;
|
|
3605
3691
|
const vmOfTemplateBeingUpdatedInception = vmBeingRendered;
|
|
@@ -3637,7 +3723,7 @@
|
|
|
3637
3723
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
3638
3724
|
// re-rendering.
|
|
3639
3725
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
3640
|
-
context.
|
|
3726
|
+
context.styleVNodes =
|
|
3641
3727
|
stylesheetsContent.length === 0
|
|
3642
3728
|
? null
|
|
3643
3729
|
: createStylesheet(vm, stylesheetsContent);
|
|
@@ -3649,9 +3735,9 @@
|
|
|
3649
3735
|
// Set the global flag that template is being updated
|
|
3650
3736
|
isUpdatingTemplate = true;
|
|
3651
3737
|
vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);
|
|
3652
|
-
const {
|
|
3653
|
-
if (!isNull(
|
|
3654
|
-
ArrayUnshift.
|
|
3738
|
+
const { styleVNodes } = context;
|
|
3739
|
+
if (!isNull(styleVNodes)) {
|
|
3740
|
+
ArrayUnshift.apply(vnodes, styleVNodes);
|
|
3655
3741
|
}
|
|
3656
3742
|
});
|
|
3657
3743
|
}, () => {
|
|
@@ -3969,7 +4055,7 @@
|
|
|
3969
4055
|
hasTokenInClass: undefined,
|
|
3970
4056
|
hasTokenInAttribute: undefined,
|
|
3971
4057
|
hasScopedStyles: undefined,
|
|
3972
|
-
|
|
4058
|
+
styleVNodes: null,
|
|
3973
4059
|
tplCache: EmptyObject,
|
|
3974
4060
|
wiredConnecting: EmptyArray,
|
|
3975
4061
|
wiredDisconnecting: EmptyArray
|
|
@@ -4829,6 +4915,10 @@
|
|
|
4829
4915
|
// VComment has no special capability, fallback to the owner's renderer
|
|
4830
4916
|
hydratedNode = hydrateComment(node, vnode, renderer);
|
|
4831
4917
|
break;
|
|
4918
|
+
case 4 /* Static */:
|
|
4919
|
+
// VStatic are cacheable and cannot have custom renderer associated to them
|
|
4920
|
+
hydratedNode = hydrateStaticElement(node, vnode, renderer);
|
|
4921
|
+
break;
|
|
4832
4922
|
case 2 /* Element */:
|
|
4833
4923
|
hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
4834
4924
|
break;
|
|
@@ -4858,6 +4948,13 @@
|
|
|
4858
4948
|
vnode.elm = node;
|
|
4859
4949
|
return node;
|
|
4860
4950
|
}
|
|
4951
|
+
function hydrateStaticElement(elm, vnode, renderer) {
|
|
4952
|
+
if (!areCompatibleNodes(vnode.fragment, elm, vnode, renderer)) {
|
|
4953
|
+
return handleMismatch(elm, vnode, renderer);
|
|
4954
|
+
}
|
|
4955
|
+
vnode.elm = elm;
|
|
4956
|
+
return elm;
|
|
4957
|
+
}
|
|
4861
4958
|
function hydrateElement(elm, vnode, renderer) {
|
|
4862
4959
|
if (!hasCorrectNodeType(vnode, elm, 1 /* ELEMENT */, renderer) ||
|
|
4863
4960
|
!isMatchingElement(vnode, elm, renderer)) {
|
|
@@ -5046,6 +5143,36 @@
|
|
|
5046
5143
|
}
|
|
5047
5144
|
return nodesAreCompatible;
|
|
5048
5145
|
}
|
|
5146
|
+
function areCompatibleNodes(client, ssr, vnode, renderer) {
|
|
5147
|
+
const { getProperty, getAttribute } = renderer;
|
|
5148
|
+
if (getProperty(client, 'nodeType') === 3 /* TEXT */) {
|
|
5149
|
+
if (!hasCorrectNodeType(vnode, ssr, 3 /* TEXT */, renderer)) {
|
|
5150
|
+
return false;
|
|
5151
|
+
}
|
|
5152
|
+
return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
|
|
5153
|
+
}
|
|
5154
|
+
if (getProperty(client, 'nodeType') === 8 /* COMMENT */) {
|
|
5155
|
+
if (!hasCorrectNodeType(vnode, ssr, 8 /* COMMENT */, renderer)) {
|
|
5156
|
+
return false;
|
|
5157
|
+
}
|
|
5158
|
+
return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
|
|
5159
|
+
}
|
|
5160
|
+
if (!hasCorrectNodeType(vnode, ssr, 1 /* ELEMENT */, renderer)) {
|
|
5161
|
+
return false;
|
|
5162
|
+
}
|
|
5163
|
+
let isCompatibleElements = true;
|
|
5164
|
+
if (getProperty(client, 'tagName') !== getProperty(ssr, 'tagName')) {
|
|
5165
|
+
return false;
|
|
5166
|
+
}
|
|
5167
|
+
const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
|
|
5168
|
+
clientAttrsNames.forEach((attrName) => {
|
|
5169
|
+
if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
|
|
5170
|
+
logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
|
|
5171
|
+
isCompatibleElements = false;
|
|
5172
|
+
}
|
|
5173
|
+
});
|
|
5174
|
+
return isCompatibleElements;
|
|
5175
|
+
}
|
|
5049
5176
|
|
|
5050
5177
|
/*
|
|
5051
5178
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5086,7 +5213,7 @@
|
|
|
5086
5213
|
}
|
|
5087
5214
|
return ctor;
|
|
5088
5215
|
}
|
|
5089
|
-
/* version: 2.
|
|
5216
|
+
/* version: 2.17.0 */
|
|
5090
5217
|
|
|
5091
5218
|
/*
|
|
5092
5219
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5295,6 +5422,12 @@
|
|
|
5295
5422
|
}
|
|
5296
5423
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5297
5424
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5425
|
+
function cloneNode(node, deep) {
|
|
5426
|
+
return node.cloneNode(deep);
|
|
5427
|
+
}
|
|
5428
|
+
function createFragment(html) {
|
|
5429
|
+
return document.createRange().createContextualFragment(html).firstChild;
|
|
5430
|
+
}
|
|
5298
5431
|
function createElement$1(tagName, namespace) {
|
|
5299
5432
|
return isUndefined$1(namespace)
|
|
5300
5433
|
? document.createElement(tagName)
|
|
@@ -5413,6 +5546,8 @@
|
|
|
5413
5546
|
isHydrating,
|
|
5414
5547
|
insert,
|
|
5415
5548
|
remove,
|
|
5549
|
+
cloneNode,
|
|
5550
|
+
createFragment,
|
|
5416
5551
|
createElement: createElement$1,
|
|
5417
5552
|
createText,
|
|
5418
5553
|
createComment,
|
|
@@ -5734,7 +5869,7 @@
|
|
|
5734
5869
|
});
|
|
5735
5870
|
freeze(LightningElement);
|
|
5736
5871
|
seal(LightningElement.prototype);
|
|
5737
|
-
/* version: 2.
|
|
5872
|
+
/* version: 2.17.0 */
|
|
5738
5873
|
|
|
5739
5874
|
exports.LightningElement = LightningElement;
|
|
5740
5875
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -5748,6 +5883,8 @@
|
|
|
5748
5883
|
exports.hydrateComponent = hydrateComponent;
|
|
5749
5884
|
exports.isComponentConstructor = isComponentConstructor;
|
|
5750
5885
|
exports.isNodeFromTemplate = isNodeShadowed;
|
|
5886
|
+
exports.parseFragment = parseFragment;
|
|
5887
|
+
exports.parseSVGFragment = parseSVGFragment;
|
|
5751
5888
|
exports.readonly = readonly;
|
|
5752
5889
|
exports.register = register;
|
|
5753
5890
|
exports.registerComponent = registerComponent;
|