lwc 2.33.0 → 2.34.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 +166 -42
- package/dist/engine-dom/iife/es2017/engine-dom.js +166 -42
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +170 -39
- package/dist/engine-dom/iife/es5/engine-dom.js +204 -91
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +217 -88
- package/dist/engine-dom/umd/es2017/engine-dom.js +166 -42
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +170 -39
- package/dist/engine-dom/umd/es5/engine-dom.js +204 -91
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +217 -88
- package/dist/engine-server/commonjs/es2017/engine-server.js +158 -39
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +158 -39
- 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
|
@@ -344,9 +344,9 @@ function htmlAttributeToProperty(attrName) {
|
|
|
344
344
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
345
345
|
*/
|
|
346
346
|
// Increment whenever the LWC template compiler changes
|
|
347
|
-
const LWC_VERSION = "2.
|
|
347
|
+
const LWC_VERSION = "2.34.0";
|
|
348
348
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
349
|
-
/** version: 2.
|
|
349
|
+
/** version: 2.34.0 */
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
352
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -369,6 +369,7 @@ const features = {
|
|
|
369
369
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
370
370
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
371
371
|
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
372
|
+
ENABLE_PROGRAMMATIC_STYLESHEETS: null,
|
|
372
373
|
};
|
|
373
374
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
374
375
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -422,7 +423,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
422
423
|
setFeatureFlag(name, value);
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
|
-
/** version: 2.
|
|
426
|
+
/** version: 2.34.0 */
|
|
426
427
|
|
|
427
428
|
/**
|
|
428
429
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -486,7 +487,7 @@ function applyAriaReflection(prototype = Element.prototype) {
|
|
|
486
487
|
}
|
|
487
488
|
}
|
|
488
489
|
}
|
|
489
|
-
/** version: 2.
|
|
490
|
+
/** version: 2.34.0 */
|
|
490
491
|
|
|
491
492
|
/*
|
|
492
493
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -815,6 +816,7 @@ function log(method, message, vm) {
|
|
|
815
816
|
if (!isUndefined$1(vm)) {
|
|
816
817
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
817
818
|
}
|
|
819
|
+
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
818
820
|
if (process.env.NODE_ENV === 'test') {
|
|
819
821
|
/* eslint-disable-next-line no-console */
|
|
820
822
|
console[method](msg);
|
|
@@ -884,6 +886,9 @@ function offsetPropertyErrorMessage(name) {
|
|
|
884
886
|
// Global HTML Attributes & Properties
|
|
885
887
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
886
888
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
889
|
+
//
|
|
890
|
+
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
891
|
+
// for e.g. "dropzone" should suffice.
|
|
887
892
|
const globalHTMLProperties = assign(create(null), {
|
|
888
893
|
accessKey: {
|
|
889
894
|
attribute: 'accesskey',
|
|
@@ -3476,6 +3481,9 @@ function updateStylesheetToken(vm, template) {
|
|
|
3476
3481
|
stylesheets: newStylesheets,
|
|
3477
3482
|
stylesheetToken: newStylesheetToken
|
|
3478
3483
|
} = template;
|
|
3484
|
+
const {
|
|
3485
|
+
stylesheets: newVmStylesheets
|
|
3486
|
+
} = vm;
|
|
3479
3487
|
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3480
3488
|
const {
|
|
3481
3489
|
hasScopedStyles
|
|
@@ -3499,7 +3507,9 @@ function updateStylesheetToken(vm, template) {
|
|
|
3499
3507
|
}
|
|
3500
3508
|
// Apply the new template styling token to the host element, if the new template has any
|
|
3501
3509
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3502
|
-
|
|
3510
|
+
const hasNewStylesheets = hasStyles(newStylesheets);
|
|
3511
|
+
const hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
3512
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
3503
3513
|
newToken = newStylesheetToken;
|
|
3504
3514
|
}
|
|
3505
3515
|
// Set the new styling token on the host element
|
|
@@ -3571,10 +3581,17 @@ function getStylesheetsContent(vm, template) {
|
|
|
3571
3581
|
stylesheets,
|
|
3572
3582
|
stylesheetToken
|
|
3573
3583
|
} = template;
|
|
3584
|
+
const {
|
|
3585
|
+
stylesheets: vmStylesheets
|
|
3586
|
+
} = vm;
|
|
3574
3587
|
let content = [];
|
|
3575
|
-
if (
|
|
3588
|
+
if (hasStyles(stylesheets)) {
|
|
3576
3589
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3577
3590
|
}
|
|
3591
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
3592
|
+
if (hasStyles(vmStylesheets)) {
|
|
3593
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
3594
|
+
}
|
|
3578
3595
|
return content;
|
|
3579
3596
|
}
|
|
3580
3597
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -3612,10 +3629,13 @@ function getStylesheetTokenHost(vnode) {
|
|
|
3612
3629
|
const {
|
|
3613
3630
|
template
|
|
3614
3631
|
} = getComponentInternalDef(vnode.ctor);
|
|
3632
|
+
const {
|
|
3633
|
+
vm
|
|
3634
|
+
} = vnode;
|
|
3615
3635
|
const {
|
|
3616
3636
|
stylesheetToken
|
|
3617
3637
|
} = template;
|
|
3618
|
-
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
3638
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
|
|
3619
3639
|
}
|
|
3620
3640
|
function getNearestNativeShadowComponent(vm) {
|
|
3621
3641
|
const owner = getNearestShadowComponent(vm);
|
|
@@ -4228,6 +4248,28 @@ function patchCustomElement(n1, n2, parent, renderer) {
|
|
|
4228
4248
|
// in fallback mode, the allocation will always set children to
|
|
4229
4249
|
// empty and delegate the real allocation to the slot elements
|
|
4230
4250
|
allocateChildren(n2, vm);
|
|
4251
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
4252
|
+
//
|
|
4253
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
4254
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
4255
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
4256
|
+
//
|
|
4257
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
4258
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
4259
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
4260
|
+
// mark the new children dynamic.
|
|
4261
|
+
//
|
|
4262
|
+
// Example:
|
|
4263
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
4264
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
4265
|
+
const {
|
|
4266
|
+
shadowMode,
|
|
4267
|
+
renderMode
|
|
4268
|
+
} = vm;
|
|
4269
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
4270
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
4271
|
+
markAsDynamicChildren(n2.children);
|
|
4272
|
+
}
|
|
4231
4273
|
}
|
|
4232
4274
|
// in fallback mode, the children will be always empty, so, nothing
|
|
4233
4275
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -4420,7 +4462,6 @@ function allocateChildren(vnode, vm) {
|
|
|
4420
4462
|
//
|
|
4421
4463
|
// In case #2, we will always get a fresh VCustomElement.
|
|
4422
4464
|
const children = vnode.aChildren || vnode.children;
|
|
4423
|
-
vm.aChildren = children;
|
|
4424
4465
|
const {
|
|
4425
4466
|
renderMode,
|
|
4426
4467
|
shadowMode
|
|
@@ -4433,15 +4474,61 @@ function allocateChildren(vnode, vm) {
|
|
|
4433
4474
|
logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
|
|
4434
4475
|
}
|
|
4435
4476
|
}
|
|
4477
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
4478
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
4479
|
+
const allocatedChildren = flattenFragmentsInChildren(children);
|
|
4480
|
+
vnode.children = allocatedChildren;
|
|
4481
|
+
vm.aChildren = allocatedChildren;
|
|
4436
4482
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
4437
4483
|
// slow path
|
|
4438
|
-
allocateInSlot(vm,
|
|
4484
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
4439
4485
|
// save the allocated children in case this vnode is reused.
|
|
4440
|
-
vnode.aChildren =
|
|
4486
|
+
vnode.aChildren = allocatedChildren;
|
|
4441
4487
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4442
4488
|
vnode.children = EmptyArray;
|
|
4443
4489
|
}
|
|
4444
4490
|
}
|
|
4491
|
+
/**
|
|
4492
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
4493
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
4494
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
4495
|
+
*
|
|
4496
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
4497
|
+
*
|
|
4498
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
4499
|
+
*/
|
|
4500
|
+
function flattenFragmentsInChildren(children) {
|
|
4501
|
+
const flattenedChildren = [];
|
|
4502
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
4503
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4504
|
+
const nodeStack = [];
|
|
4505
|
+
let fragmentFound = false;
|
|
4506
|
+
for (let i = children.length - 1; i > -1; i -= 1) {
|
|
4507
|
+
const child = children[i];
|
|
4508
|
+
ArrayPush$1.call(nodeStack, child);
|
|
4509
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4510
|
+
}
|
|
4511
|
+
if (!fragmentFound) {
|
|
4512
|
+
return children;
|
|
4513
|
+
}
|
|
4514
|
+
let currentNode;
|
|
4515
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
4516
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4517
|
+
const fChildren = currentNode.children;
|
|
4518
|
+
// Ignore the start and end text node delimiters
|
|
4519
|
+
for (let i = fChildren.length - 2; i > 0; i -= 1) {
|
|
4520
|
+
ArrayPush$1.call(nodeStack, fChildren[i]);
|
|
4521
|
+
}
|
|
4522
|
+
} else {
|
|
4523
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4526
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
4527
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
4528
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
4529
|
+
markAsDynamicChildren(flattenedChildren);
|
|
4530
|
+
return flattenedChildren;
|
|
4531
|
+
}
|
|
4445
4532
|
function createViewModelHook(elm, vnode, renderer) {
|
|
4446
4533
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4447
4534
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
@@ -4466,22 +4553,20 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4466
4553
|
}
|
|
4467
4554
|
return vm;
|
|
4468
4555
|
}
|
|
4469
|
-
|
|
4470
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
4471
|
-
*/
|
|
4472
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
4556
|
+
function allocateInSlot(vm, children, owner) {
|
|
4473
4557
|
var _a, _b;
|
|
4558
|
+
const {
|
|
4559
|
+
cmpSlots: {
|
|
4560
|
+
slotAssignments: oldSlotsMapping
|
|
4561
|
+
}
|
|
4562
|
+
} = vm;
|
|
4563
|
+
const cmpSlotsMapping = create(null);
|
|
4564
|
+
// Collect all slots into cmpSlotsMapping
|
|
4474
4565
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4475
4566
|
const vnode = children[i];
|
|
4476
4567
|
if (isNull(vnode)) {
|
|
4477
4568
|
continue;
|
|
4478
4569
|
}
|
|
4479
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
4480
|
-
if (isVFragment(vnode)) {
|
|
4481
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
4482
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
4483
|
-
continue;
|
|
4484
|
-
}
|
|
4485
4570
|
let slotName = '';
|
|
4486
4571
|
if (isVBaseElement(vnode)) {
|
|
4487
4572
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
@@ -4491,15 +4576,6 @@ function collectSlots(vm, children, cmpSlotsMapping) {
|
|
|
4491
4576
|
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4492
4577
|
ArrayPush$1.call(vnodes, vnode);
|
|
4493
4578
|
}
|
|
4494
|
-
}
|
|
4495
|
-
function allocateInSlot(vm, children, owner) {
|
|
4496
|
-
const {
|
|
4497
|
-
cmpSlots: {
|
|
4498
|
-
slotAssignments: oldSlotsMapping
|
|
4499
|
-
}
|
|
4500
|
-
} = vm;
|
|
4501
|
-
const cmpSlotsMapping = create(null);
|
|
4502
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
4503
4579
|
vm.cmpSlots = {
|
|
4504
4580
|
owner,
|
|
4505
4581
|
slotAssignments: cmpSlotsMapping
|
|
@@ -4530,14 +4606,14 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4530
4606
|
}
|
|
4531
4607
|
}
|
|
4532
4608
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4533
|
-
const
|
|
4534
|
-
// dynamic children means it was generated by an iteration
|
|
4535
|
-
//
|
|
4609
|
+
const DynamicChildren = new WeakMap();
|
|
4610
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
4611
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
4536
4612
|
function markAsDynamicChildren(children) {
|
|
4537
|
-
|
|
4613
|
+
DynamicChildren.set(children, 1);
|
|
4538
4614
|
}
|
|
4539
4615
|
function hasDynamicChildren(children) {
|
|
4540
|
-
return
|
|
4616
|
+
return DynamicChildren.has(children);
|
|
4541
4617
|
}
|
|
4542
4618
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4543
4619
|
const map = {};
|
|
@@ -5403,7 +5479,7 @@ function evaluateTemplate(vm, html) {
|
|
|
5403
5479
|
// Create a brand new template cache for the swapped templated.
|
|
5404
5480
|
context.tplCache = create(null);
|
|
5405
5481
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5406
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
5482
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
5407
5483
|
// Update the scoping token on the host element.
|
|
5408
5484
|
updateStylesheetToken(vm, html);
|
|
5409
5485
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -5446,9 +5522,8 @@ function evaluateTemplate(vm, html) {
|
|
|
5446
5522
|
}
|
|
5447
5523
|
return vnodes;
|
|
5448
5524
|
}
|
|
5449
|
-
function
|
|
5450
|
-
|
|
5451
|
-
if (!isUndefined$1(stylesheets)) {
|
|
5525
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
5526
|
+
if (hasStyles(stylesheets)) {
|
|
5452
5527
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5453
5528
|
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
5454
5529
|
return true;
|
|
@@ -5457,6 +5532,15 @@ function computeHasScopedStyles(template) {
|
|
|
5457
5532
|
}
|
|
5458
5533
|
return false;
|
|
5459
5534
|
}
|
|
5535
|
+
function computeHasScopedStyles(template, vm) {
|
|
5536
|
+
const { stylesheets } = template;
|
|
5537
|
+
const vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
5538
|
+
return (computeHasScopedStylesInStylesheets(stylesheets) ||
|
|
5539
|
+
computeHasScopedStylesInStylesheets(vmStylesheets));
|
|
5540
|
+
}
|
|
5541
|
+
function hasStyles(stylesheets) {
|
|
5542
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
5543
|
+
}
|
|
5460
5544
|
|
|
5461
5545
|
/*
|
|
5462
5546
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5772,6 +5856,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5772
5856
|
// Properties set right after VM creation.
|
|
5773
5857
|
tro: null,
|
|
5774
5858
|
shadowMode: null,
|
|
5859
|
+
stylesheets: null,
|
|
5775
5860
|
// Properties set by the LightningElement constructor.
|
|
5776
5861
|
component: null,
|
|
5777
5862
|
shadowRoot: null,
|
|
@@ -5784,6 +5869,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5784
5869
|
if (process.env.NODE_ENV !== 'production') {
|
|
5785
5870
|
vm.debugInfo = create(null);
|
|
5786
5871
|
}
|
|
5872
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
5787
5873
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5788
5874
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5789
5875
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5802,6 +5888,42 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5802
5888
|
}
|
|
5803
5889
|
return vm;
|
|
5804
5890
|
}
|
|
5891
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
5892
|
+
let valid = true;
|
|
5893
|
+
const validate = arrayOrStylesheet => {
|
|
5894
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
5895
|
+
for (let i = 0; i < arrayOrStylesheet.length; i++) {
|
|
5896
|
+
validate(arrayOrStylesheet[i]);
|
|
5897
|
+
}
|
|
5898
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
5899
|
+
// function assumed to be a stylesheet factory
|
|
5900
|
+
valid = false;
|
|
5901
|
+
}
|
|
5902
|
+
};
|
|
5903
|
+
if (!isArray$1(stylesheets)) {
|
|
5904
|
+
valid = false;
|
|
5905
|
+
} else {
|
|
5906
|
+
validate(stylesheets);
|
|
5907
|
+
}
|
|
5908
|
+
return valid;
|
|
5909
|
+
}
|
|
5910
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
5911
|
+
function computeStylesheets(vm, ctor) {
|
|
5912
|
+
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
5913
|
+
const {
|
|
5914
|
+
stylesheets
|
|
5915
|
+
} = ctor;
|
|
5916
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5917
|
+
const valid = validateComponentStylesheets(vm, stylesheets);
|
|
5918
|
+
if (valid) {
|
|
5919
|
+
return flattenStylesheets(stylesheets);
|
|
5920
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
5921
|
+
logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
return null;
|
|
5926
|
+
}
|
|
5805
5927
|
function computeShadowMode(vm, renderer) {
|
|
5806
5928
|
const {
|
|
5807
5929
|
def
|
|
@@ -7120,7 +7242,7 @@ function getComponentConstructor(elm) {
|
|
|
7120
7242
|
}
|
|
7121
7243
|
return ctor;
|
|
7122
7244
|
}
|
|
7123
|
-
/* version: 2.
|
|
7245
|
+
/* version: 2.34.0 */
|
|
7124
7246
|
|
|
7125
7247
|
/*
|
|
7126
7248
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7227,7 +7349,9 @@ const stylesheetCache = new Map();
|
|
|
7227
7349
|
//
|
|
7228
7350
|
// Test utilities
|
|
7229
7351
|
//
|
|
7230
|
-
|
|
7352
|
+
// Only used in LWC's Karma tests
|
|
7353
|
+
// @ts-ignore
|
|
7354
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7231
7355
|
// @ts-ignore
|
|
7232
7356
|
window.__lwcResetGlobalStylesheets = () => {
|
|
7233
7357
|
stylesheetCache.clear();
|
|
@@ -8093,7 +8217,7 @@ function rendererFactory(baseRenderer) {
|
|
|
8093
8217
|
function isNull(obj) {
|
|
8094
8218
|
return obj === null;
|
|
8095
8219
|
}
|
|
8096
|
-
/** version: 2.
|
|
8220
|
+
/** version: 2.34.0 */
|
|
8097
8221
|
|
|
8098
8222
|
/*
|
|
8099
8223
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8654,6 +8778,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
8654
8778
|
});
|
|
8655
8779
|
freeze(LightningElement);
|
|
8656
8780
|
seal(LightningElement.prototype);
|
|
8657
|
-
/* version: 2.
|
|
8781
|
+
/* version: 2.34.0 */
|
|
8658
8782
|
|
|
8659
8783
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|