lwc 2.35.0 → 2.35.2
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 +61 -134
- package/dist/engine-dom/iife/es2017/engine-dom.js +61 -134
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +100 -74
- package/dist/engine-dom/iife/es5/engine-dom.js +249 -327
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +266 -244
- package/dist/engine-dom/umd/es2017/engine-dom.js +61 -134
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +100 -74
- package/dist/engine-dom/umd/es5/engine-dom.js +249 -327
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +266 -244
- package/dist/engine-server/commonjs/es2017/engine-server.js +47 -136
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +47 -136
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +11 -42
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +11 -42
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +8 -38
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +15 -44
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +12 -40
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +11 -42
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +8 -38
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +15 -44
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +12 -40
- 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
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
|
|
36
36
|
var assert = /*#__PURE__*/Object.freeze({
|
|
37
37
|
__proto__: null,
|
|
38
|
+
fail: fail,
|
|
38
39
|
invariant: invariant,
|
|
39
|
-
isTrue: isTrue$1,
|
|
40
40
|
isFalse: isFalse$1,
|
|
41
|
-
|
|
41
|
+
isTrue: isTrue$1
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
/*
|
|
@@ -205,41 +205,11 @@
|
|
|
205
205
|
* SPDX-License-Identifier: MIT
|
|
206
206
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
207
207
|
*/
|
|
208
|
-
//
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
let _globalThis;
|
|
215
|
-
try {
|
|
216
|
-
// eslint-disable-next-line no-extend-native
|
|
217
|
-
Object.defineProperty(Object.prototype, '__magic__', {
|
|
218
|
-
get: function () {
|
|
219
|
-
return this;
|
|
220
|
-
},
|
|
221
|
-
configurable: true,
|
|
222
|
-
});
|
|
223
|
-
// __magic__ is undefined in Safari 10 and IE10 and older.
|
|
224
|
-
// @ts-ignore
|
|
225
|
-
// eslint-disable-next-line no-undef
|
|
226
|
-
_globalThis = __magic__;
|
|
227
|
-
// @ts-ignore
|
|
228
|
-
delete Object.prototype.__magic__;
|
|
229
|
-
}
|
|
230
|
-
catch (ex) {
|
|
231
|
-
// In IE8, Object.defineProperty only works on DOM objects.
|
|
232
|
-
}
|
|
233
|
-
finally {
|
|
234
|
-
// If the magic above fails for some reason we assume that we are in a legacy browser.
|
|
235
|
-
// Assume `window` exists in this case.
|
|
236
|
-
if (typeof _globalThis === 'undefined') {
|
|
237
|
-
// @ts-ignore
|
|
238
|
-
_globalThis = window;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return _globalThis;
|
|
242
|
-
})();
|
|
208
|
+
// See browser support for globalThis:
|
|
209
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
|
|
210
|
+
/* istanbul ignore next */
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
const _globalThis = typeof globalThis === 'object' ? globalThis : window;
|
|
243
213
|
|
|
244
214
|
/*
|
|
245
215
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -354,7 +324,7 @@
|
|
|
354
324
|
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
355
325
|
return propertyName;
|
|
356
326
|
}
|
|
357
|
-
/** version: 2.35.
|
|
327
|
+
/** version: 2.35.2 */
|
|
358
328
|
|
|
359
329
|
/**
|
|
360
330
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -404,6 +374,7 @@
|
|
|
404
374
|
console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
|
|
405
375
|
return;
|
|
406
376
|
}
|
|
377
|
+
// This may seem redundant, but `"production" === 'test-karma-lwc'` is replaced by Karma tests
|
|
407
378
|
{
|
|
408
379
|
// Disallow the same flag to be set more than once in production
|
|
409
380
|
const runtimeValue = lwcRuntimeFlags[name];
|
|
@@ -421,7 +392,7 @@
|
|
|
421
392
|
*/
|
|
422
393
|
function setFeatureFlagForTest(name, value) {
|
|
423
394
|
}
|
|
424
|
-
/** version: 2.35.
|
|
395
|
+
/** version: 2.35.2 */
|
|
425
396
|
|
|
426
397
|
/**
|
|
427
398
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -485,7 +456,7 @@
|
|
|
485
456
|
}
|
|
486
457
|
}
|
|
487
458
|
}
|
|
488
|
-
/** version: 2.35.
|
|
459
|
+
/** version: 2.35.2 */
|
|
489
460
|
|
|
490
461
|
/*
|
|
491
462
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -843,6 +814,14 @@
|
|
|
843
814
|
refVNodes[ref] = vnode;
|
|
844
815
|
}
|
|
845
816
|
}
|
|
817
|
+
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
818
|
+
function assertNotProd() {
|
|
819
|
+
/* istanbul ignore if */
|
|
820
|
+
{
|
|
821
|
+
// this method should never leak to prod
|
|
822
|
+
throw new ReferenceError();
|
|
823
|
+
}
|
|
824
|
+
}
|
|
846
825
|
|
|
847
826
|
/*
|
|
848
827
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -1433,7 +1412,6 @@
|
|
|
1433
1412
|
}
|
|
1434
1413
|
};
|
|
1435
1414
|
}
|
|
1436
|
-
const EMPTY_REFS = freeze(create(null));
|
|
1437
1415
|
const refsCache = new WeakMap();
|
|
1438
1416
|
/**
|
|
1439
1417
|
* This class is the base class for any LWC element.
|
|
@@ -1671,22 +1649,15 @@
|
|
|
1671
1649
|
}
|
|
1672
1650
|
const {
|
|
1673
1651
|
refVNodes,
|
|
1674
|
-
hasRefVNodes,
|
|
1675
1652
|
cmpTemplate
|
|
1676
1653
|
} = vm;
|
|
1677
1654
|
// For backwards compatibility with component written before template refs
|
|
1678
1655
|
// were introduced, we return undefined if the template has no refs defined
|
|
1679
1656
|
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
1680
1657
|
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
1681
|
-
// Note
|
|
1682
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
1683
|
-
if (!hasRefVNodes) {
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
1687
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
1658
|
+
// Note we use a null refVNodes to indicate that the template has no refs defined.
|
|
1688
1659
|
if (isNull(refVNodes)) {
|
|
1689
|
-
return
|
|
1660
|
+
return;
|
|
1690
1661
|
}
|
|
1691
1662
|
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
1692
1663
|
// are recreated from scratch every time the template is rendered.
|
|
@@ -2503,10 +2474,60 @@
|
|
|
2503
2474
|
}
|
|
2504
2475
|
freeze(BaseBridgeElement);
|
|
2505
2476
|
seal(BaseBridgeElement.prototype);
|
|
2477
|
+
const swappedStyleMap = new WeakMap();
|
|
2478
|
+
const activeTemplates = new WeakMap();
|
|
2479
|
+
const activeComponents = new WeakMap();
|
|
2480
|
+
const activeStyles = new WeakMap();
|
|
2481
|
+
function getStyleOrSwappedStyle(style) {
|
|
2482
|
+
assertNotProd(); // this method should never leak to prod
|
|
2483
|
+
const visited = new Set();
|
|
2484
|
+
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
2485
|
+
visited.add(style);
|
|
2486
|
+
style = swappedStyleMap.get(style);
|
|
2487
|
+
}
|
|
2488
|
+
return style;
|
|
2489
|
+
}
|
|
2506
2490
|
function setActiveVM(vm) {
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2491
|
+
assertNotProd(); // this method should never leak to prod
|
|
2492
|
+
// tracking active component
|
|
2493
|
+
const Ctor = vm.def.ctor;
|
|
2494
|
+
let componentVMs = activeComponents.get(Ctor);
|
|
2495
|
+
if (isUndefined$1(componentVMs)) {
|
|
2496
|
+
componentVMs = new Set();
|
|
2497
|
+
activeComponents.set(Ctor, componentVMs);
|
|
2498
|
+
}
|
|
2499
|
+
// this will allow us to keep track of the hot components
|
|
2500
|
+
componentVMs.add(vm);
|
|
2501
|
+
// tracking active template
|
|
2502
|
+
const tpl = vm.cmpTemplate;
|
|
2503
|
+
if (tpl) {
|
|
2504
|
+
let templateVMs = activeTemplates.get(tpl);
|
|
2505
|
+
if (isUndefined$1(templateVMs)) {
|
|
2506
|
+
templateVMs = new Set();
|
|
2507
|
+
activeTemplates.set(tpl, templateVMs);
|
|
2508
|
+
}
|
|
2509
|
+
// this will allow us to keep track of the templates that are
|
|
2510
|
+
// being used by a hot component
|
|
2511
|
+
templateVMs.add(vm);
|
|
2512
|
+
// tracking active styles associated to template
|
|
2513
|
+
const stylesheets = tpl.stylesheets;
|
|
2514
|
+
if (!isUndefined$1(stylesheets)) {
|
|
2515
|
+
flattenStylesheets(stylesheets).forEach((stylesheet) => {
|
|
2516
|
+
// this is necessary because we don't hold the list of styles
|
|
2517
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
2518
|
+
// but the styles attached to the template might not be the actual
|
|
2519
|
+
// active ones, but the swapped versions of those.
|
|
2520
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
2521
|
+
let stylesheetVMs = activeStyles.get(stylesheet);
|
|
2522
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
2523
|
+
stylesheetVMs = new Set();
|
|
2524
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
2525
|
+
}
|
|
2526
|
+
// this will allow us to keep track of the stylesheet that are
|
|
2527
|
+
// being used by a hot component
|
|
2528
|
+
stylesheetVMs.add(vm);
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2510
2531
|
}
|
|
2511
2532
|
}
|
|
2512
2533
|
function swapTemplate(oldTpl, newTpl) {
|
|
@@ -4338,9 +4359,17 @@
|
|
|
4338
4359
|
vmBeingRendered = vm;
|
|
4339
4360
|
}
|
|
4340
4361
|
function validateSlots(vm, html) {
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4362
|
+
assertNotProd(); // this method should never leak to prod
|
|
4363
|
+
const { cmpSlots } = vm;
|
|
4364
|
+
const { slots = EmptyArray } = html;
|
|
4365
|
+
for (const slotName in cmpSlots.slotAssignments) {
|
|
4366
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
4367
|
+
assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
|
|
4368
|
+
if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {
|
|
4369
|
+
// TODO [#1297]: this should never really happen because the compiler should always validate
|
|
4370
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-production-assert
|
|
4371
|
+
logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
|
|
4372
|
+
}
|
|
4344
4373
|
}
|
|
4345
4374
|
}
|
|
4346
4375
|
function validateLightDomTemplate(template, vm) {
|
|
@@ -4450,9 +4479,7 @@
|
|
|
4450
4479
|
}
|
|
4451
4480
|
if ("production" !== 'production') ;
|
|
4452
4481
|
// reset the refs; they will be set during the tmpl() instantiation
|
|
4453
|
-
|
|
4454
|
-
vm.hasRefVNodes = hasRefVNodes;
|
|
4455
|
-
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
4482
|
+
vm.refVNodes = html.hasRefs ? create(null) : null;
|
|
4456
4483
|
// right before producing the vnodes, we clear up all internal references
|
|
4457
4484
|
// to custom elements from the template.
|
|
4458
4485
|
vm.velements = [];
|
|
@@ -4609,7 +4636,7 @@
|
|
|
4609
4636
|
const cmpEventListenerMap = new WeakMap();
|
|
4610
4637
|
function getWrappedComponentsListener(vm, listener) {
|
|
4611
4638
|
if (!isFunction$1(listener)) {
|
|
4612
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
4639
|
+
throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
|
|
4613
4640
|
}
|
|
4614
4641
|
let wrappedListener = cmpEventListenerMap.get(listener);
|
|
4615
4642
|
if (isUndefined$1(wrappedListener)) {
|
|
@@ -4742,7 +4769,6 @@
|
|
|
4742
4769
|
mode,
|
|
4743
4770
|
owner,
|
|
4744
4771
|
refVNodes: null,
|
|
4745
|
-
hasRefVNodes: false,
|
|
4746
4772
|
children: EmptyArray,
|
|
4747
4773
|
aChildren: EmptyArray,
|
|
4748
4774
|
velements: EmptyArray,
|
|
@@ -5953,7 +5979,7 @@
|
|
|
5953
5979
|
const cachedConstructors = new Map();
|
|
5954
5980
|
const elementsUpgradedOutsideLWC = new WeakSet();
|
|
5955
5981
|
let elementBeingUpgradedByLWC = false;
|
|
5956
|
-
// Creates a constructor that is intended to be used as a
|
|
5982
|
+
// Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
|
|
5957
5983
|
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
|
5958
5984
|
// Another benefit is that only LWC can create components that actually do anything – if you do
|
|
5959
5985
|
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
|
@@ -5998,7 +6024,7 @@
|
|
|
5998
6024
|
}
|
|
5999
6025
|
return UpgradableConstructor;
|
|
6000
6026
|
};
|
|
6001
|
-
const
|
|
6027
|
+
const createCustomElementUsingUpgradableConstructor = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
|
|
6002
6028
|
// use global custom elements registry
|
|
6003
6029
|
let UpgradableConstructor = cachedConstructors.get(tagName);
|
|
6004
6030
|
if (isUndefined$1(UpgradableConstructor)) {
|
|
@@ -6026,7 +6052,7 @@
|
|
|
6026
6052
|
*/
|
|
6027
6053
|
/**
|
|
6028
6054
|
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
6029
|
-
* do not conflict with
|
|
6055
|
+
* do not conflict with third-party custom elements having the same tag name.
|
|
6030
6056
|
*/
|
|
6031
6057
|
function createScopedRegistry() {
|
|
6032
6058
|
if (!hasCustomElements) {
|
|
@@ -6567,10 +6593,10 @@
|
|
|
6567
6593
|
* We have three modes for creating custom elements:
|
|
6568
6594
|
*
|
|
6569
6595
|
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
6570
|
-
* 2. "
|
|
6571
|
-
*
|
|
6572
|
-
*
|
|
6573
|
-
* constructor, which allows us to have completely customized functionality for different components.
|
|
6596
|
+
* 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
|
|
6597
|
+
* via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
|
|
6598
|
+
* a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
|
|
6599
|
+
* constructor"), which allows us to have completely customized functionality for different components.
|
|
6574
6600
|
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
6575
6601
|
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
6576
6602
|
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
@@ -6581,8 +6607,8 @@
|
|
|
6581
6607
|
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
6582
6608
|
createCustomElement = createCustomElementScoped;
|
|
6583
6609
|
} else {
|
|
6584
|
-
// use global
|
|
6585
|
-
createCustomElement =
|
|
6610
|
+
// use the global registry, with an upgradable constructor for the defined custom element
|
|
6611
|
+
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
6586
6612
|
}
|
|
6587
6613
|
} else {
|
|
6588
6614
|
// no registry available here
|
|
@@ -6638,10 +6664,10 @@
|
|
|
6638
6664
|
|
|
6639
6665
|
var assert = /*#__PURE__*/Object.freeze({
|
|
6640
6666
|
__proto__: null,
|
|
6667
|
+
fail: fail,
|
|
6641
6668
|
invariant: invariant,
|
|
6642
|
-
isTrue: isTrue$1,
|
|
6643
6669
|
isFalse: isFalse$1,
|
|
6644
|
-
|
|
6670
|
+
isTrue: isTrue$1
|
|
6645
6671
|
});
|
|
6646
6672
|
function isUndefined(obj) {
|
|
6647
6673
|
return obj === undefined;
|
|
@@ -6649,7 +6675,7 @@
|
|
|
6649
6675
|
function isNull(obj) {
|
|
6650
6676
|
return obj === null;
|
|
6651
6677
|
}
|
|
6652
|
-
/** version: 2.35.
|
|
6678
|
+
/** version: 2.35.2 */
|
|
6653
6679
|
|
|
6654
6680
|
/*
|
|
6655
6681
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7202,7 +7228,7 @@
|
|
|
7202
7228
|
});
|
|
7203
7229
|
freeze(LightningElement);
|
|
7204
7230
|
seal(LightningElement.prototype);
|
|
7205
|
-
/* version: 2.35.
|
|
7231
|
+
/* version: 2.35.2 */
|
|
7206
7232
|
|
|
7207
7233
|
exports.LightningElement = LightningElement;
|
|
7208
7234
|
exports.__unstable__ProfilerControl = profilerControl;
|