lwc 2.32.0 → 2.32.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 +222 -249
- package/dist/engine-dom/iife/es2017/engine-dom.js +222 -249
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +94 -145
- package/dist/engine-dom/iife/es5/engine-dom.js +211 -226
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +120 -183
- package/dist/engine-dom/umd/es2017/engine-dom.js +222 -249
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +94 -145
- package/dist/engine-dom/umd/es5/engine-dom.js +211 -226
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +120 -183
- package/dist/engine-server/commonjs/es2017/engine-server.js +218 -224
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +218 -224
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +85 -345
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +85 -345
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +85 -345
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +85 -345
- 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 @@ var LWC = (function (exports) {
|
|
|
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.32.
|
|
347
|
+
const LWC_VERSION = "2.32.1";
|
|
348
348
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
349
|
-
/** version: 2.32.
|
|
349
|
+
/** version: 2.32.1 */
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
352
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -428,7 +428,7 @@ var LWC = (function (exports) {
|
|
|
428
428
|
patch$1(propName);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
/** version: 2.32.
|
|
431
|
+
/** version: 2.32.1 */
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
434
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -442,19 +442,14 @@ var LWC = (function (exports) {
|
|
|
442
442
|
*/
|
|
443
443
|
const features = {
|
|
444
444
|
DUMMY_TEST_FLAG: null,
|
|
445
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
446
445
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
447
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
448
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
449
446
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
450
447
|
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
451
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
452
|
-
ENABLE_NODE_PATCH: null,
|
|
453
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
454
448
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
455
449
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
456
450
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
457
451
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
452
|
+
ENABLE_FROZEN_TEMPLATE: null,
|
|
458
453
|
};
|
|
459
454
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
460
455
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -508,7 +503,7 @@ var LWC = (function (exports) {
|
|
|
508
503
|
setFeatureFlag(name, value);
|
|
509
504
|
}
|
|
510
505
|
}
|
|
511
|
-
/** version: 2.32.
|
|
506
|
+
/** version: 2.32.1 */
|
|
512
507
|
|
|
513
508
|
/*
|
|
514
509
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1079,7 +1074,7 @@ var LWC = (function (exports) {
|
|
|
1079
1074
|
}),
|
|
1080
1075
|
};
|
|
1081
1076
|
// Apply extra restriction related to DOM manipulation if the element is not a portal.
|
|
1082
|
-
if (!options.isLight && !options.isPortal) {
|
|
1077
|
+
if (!options.isLight && options.isSynthetic && !options.isPortal) {
|
|
1083
1078
|
const { appendChild, insertBefore, removeChild, replaceChild } = elm;
|
|
1084
1079
|
const originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');
|
|
1085
1080
|
const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
@@ -2332,45 +2327,6 @@ var LWC = (function (exports) {
|
|
|
2332
2327
|
configurable: true,
|
|
2333
2328
|
};
|
|
2334
2329
|
}
|
|
2335
|
-
class AccessorReactiveObserver extends ReactiveObserver {
|
|
2336
|
-
constructor(vm, set) {
|
|
2337
|
-
super(() => {
|
|
2338
|
-
if (isFalse(this.debouncing)) {
|
|
2339
|
-
this.debouncing = true;
|
|
2340
|
-
addCallbackToNextTick(() => {
|
|
2341
|
-
if (isTrue(this.debouncing)) {
|
|
2342
|
-
const { value } = this;
|
|
2343
|
-
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
2344
|
-
set.call(component, value);
|
|
2345
|
-
// de-bouncing after the call to the original setter to prevent
|
|
2346
|
-
// infinity loop if the setter itself is mutating things that
|
|
2347
|
-
// were accessed during the previous invocation.
|
|
2348
|
-
this.debouncing = false;
|
|
2349
|
-
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
2350
|
-
// immediate rehydration due to a setter driven mutation, otherwise
|
|
2351
|
-
// the component will get rendered on the second tick, which it is not
|
|
2352
|
-
// desirable.
|
|
2353
|
-
rerenderVM(vm);
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
});
|
|
2357
|
-
}
|
|
2358
|
-
});
|
|
2359
|
-
this.debouncing = false;
|
|
2360
|
-
}
|
|
2361
|
-
reset(value) {
|
|
2362
|
-
super.reset();
|
|
2363
|
-
this.debouncing = false;
|
|
2364
|
-
if (arguments.length > 0) {
|
|
2365
|
-
this.value = value;
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
}
|
|
2369
|
-
function createAccessorReactiveObserver(vm, set) {
|
|
2370
|
-
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
2371
|
-
return new AccessorReactiveObserver(vm, set)
|
|
2372
|
-
;
|
|
2373
|
-
}
|
|
2374
2330
|
|
|
2375
2331
|
/*
|
|
2376
2332
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2379,90 +2335,71 @@ var LWC = (function (exports) {
|
|
|
2379
2335
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2380
2336
|
*/
|
|
2381
2337
|
function api$1() {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2338
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2339
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2340
|
+
}
|
|
2341
|
+
throw new Error();
|
|
2386
2342
|
}
|
|
2387
2343
|
function createPublicPropertyDescriptor(key) {
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2344
|
+
return {
|
|
2345
|
+
get() {
|
|
2346
|
+
const vm = getAssociatedVM(this);
|
|
2347
|
+
if (isBeingConstructed(vm)) {
|
|
2348
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2349
|
+
logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
|
|
2350
|
+
}
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
componentValueObserved(vm, key);
|
|
2354
|
+
return vm.cmpProps[key];
|
|
2355
|
+
},
|
|
2356
|
+
set(newValue) {
|
|
2357
|
+
const vm = getAssociatedVM(this);
|
|
2358
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2359
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2360
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2361
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2362
|
+
}
|
|
2363
|
+
vm.cmpProps[key] = newValue;
|
|
2364
|
+
componentValueMutated(vm, key);
|
|
2365
|
+
},
|
|
2366
|
+
enumerable: true,
|
|
2367
|
+
configurable: true,
|
|
2368
|
+
};
|
|
2413
2369
|
}
|
|
2414
2370
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2415
|
-
|
|
2416
|
-
get
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
configurable
|
|
2420
|
-
} = descriptor;
|
|
2421
|
-
if (!isFunction$1(get)) {
|
|
2422
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2423
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2424
|
-
}
|
|
2425
|
-
throw new Error();
|
|
2426
|
-
}
|
|
2427
|
-
return {
|
|
2428
|
-
get() {
|
|
2429
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2430
|
-
// Assert that the this value is an actual Component with an associated VM.
|
|
2431
|
-
getAssociatedVM(this);
|
|
2432
|
-
}
|
|
2433
|
-
return get.call(this);
|
|
2434
|
-
},
|
|
2435
|
-
set(newValue) {
|
|
2436
|
-
const vm = getAssociatedVM(this);
|
|
2437
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2438
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2439
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2440
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2441
|
-
}
|
|
2442
|
-
if (set) {
|
|
2443
|
-
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2444
|
-
let ro = vm.oar[key];
|
|
2445
|
-
if (isUndefined$1(ro)) {
|
|
2446
|
-
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
2447
|
-
}
|
|
2448
|
-
// every time we invoke this setter from outside (through this wrapper setter)
|
|
2449
|
-
// we should reset the value and then debounce just in case there is a pending
|
|
2450
|
-
// invocation the next tick that is not longer relevant since the value is changing
|
|
2451
|
-
// from outside.
|
|
2452
|
-
ro.reset(newValue);
|
|
2453
|
-
ro.observe(() => {
|
|
2454
|
-
set.call(this, newValue);
|
|
2455
|
-
});
|
|
2456
|
-
} else {
|
|
2457
|
-
set.call(this, newValue);
|
|
2371
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2372
|
+
if (!isFunction$1(get)) {
|
|
2373
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2374
|
+
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2458
2375
|
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2376
|
+
throw new Error();
|
|
2377
|
+
}
|
|
2378
|
+
return {
|
|
2379
|
+
get() {
|
|
2380
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2381
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2382
|
+
getAssociatedVM(this);
|
|
2383
|
+
}
|
|
2384
|
+
return get.call(this);
|
|
2385
|
+
},
|
|
2386
|
+
set(newValue) {
|
|
2387
|
+
const vm = getAssociatedVM(this);
|
|
2388
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2389
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2390
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2391
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2392
|
+
}
|
|
2393
|
+
if (set) {
|
|
2394
|
+
set.call(this, newValue);
|
|
2395
|
+
}
|
|
2396
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
2397
|
+
assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
|
|
2398
|
+
}
|
|
2399
|
+
},
|
|
2400
|
+
enumerable,
|
|
2401
|
+
configurable,
|
|
2402
|
+
};
|
|
2466
2403
|
}
|
|
2467
2404
|
|
|
2468
2405
|
/*
|
|
@@ -2788,12 +2725,6 @@ var LWC = (function (exports) {
|
|
|
2788
2725
|
}
|
|
2789
2726
|
}
|
|
2790
2727
|
|
|
2791
|
-
/*
|
|
2792
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
2793
|
-
* All rights reserved.
|
|
2794
|
-
* SPDX-License-Identifier: MIT
|
|
2795
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2796
|
-
*/
|
|
2797
2728
|
const signedTemplateSet = new Set();
|
|
2798
2729
|
function defaultEmptyTemplate() {
|
|
2799
2730
|
return [];
|
|
@@ -2811,32 +2742,6 @@ var LWC = (function (exports) {
|
|
|
2811
2742
|
checkVersionMismatch(tpl, 'template');
|
|
2812
2743
|
}
|
|
2813
2744
|
signedTemplateSet.add(tpl);
|
|
2814
|
-
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2815
|
-
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2816
|
-
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2817
|
-
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2818
|
-
defineProperty(tpl, 'stylesheetTokens', {
|
|
2819
|
-
enumerable: true,
|
|
2820
|
-
configurable: true,
|
|
2821
|
-
get() {
|
|
2822
|
-
const { stylesheetToken } = this;
|
|
2823
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
2824
|
-
return stylesheetToken;
|
|
2825
|
-
}
|
|
2826
|
-
// Shim for the old `stylesheetTokens` property
|
|
2827
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2828
|
-
return {
|
|
2829
|
-
hostAttribute: `${stylesheetToken}-host`,
|
|
2830
|
-
shadowAttribute: stylesheetToken,
|
|
2831
|
-
};
|
|
2832
|
-
},
|
|
2833
|
-
set(value) {
|
|
2834
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2835
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2836
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2837
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2838
|
-
},
|
|
2839
|
-
});
|
|
2840
2745
|
// chaining this method as a way to wrap existing
|
|
2841
2746
|
// assignment of templates easily, without too much transformation
|
|
2842
2747
|
return tpl;
|
|
@@ -4373,11 +4278,13 @@ var LWC = (function (exports) {
|
|
|
4373
4278
|
function applyElementRestrictions(elm, vnode) {
|
|
4374
4279
|
var _a, _b;
|
|
4375
4280
|
if (process.env.NODE_ENV !== 'production') {
|
|
4281
|
+
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4376
4282
|
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 */;
|
|
4377
4283
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4378
4284
|
patchElementWithRestrictions(elm, {
|
|
4379
4285
|
isPortal,
|
|
4380
|
-
isLight
|
|
4286
|
+
isLight,
|
|
4287
|
+
isSynthetic
|
|
4381
4288
|
});
|
|
4382
4289
|
}
|
|
4383
4290
|
}
|
|
@@ -4793,7 +4700,7 @@ var LWC = (function (exports) {
|
|
|
4793
4700
|
// undefined is for root components, but root components cannot accept slotted content
|
|
4794
4701
|
setVMBeingRendered(slotset.owner);
|
|
4795
4702
|
try {
|
|
4796
|
-
ArrayPush$1.
|
|
4703
|
+
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
|
4797
4704
|
}
|
|
4798
4705
|
finally {
|
|
4799
4706
|
setVMBeingRendered(vmBeingRenderedInception);
|
|
@@ -5673,15 +5580,10 @@ var LWC = (function (exports) {
|
|
|
5673
5580
|
} = vm;
|
|
5674
5581
|
if (state !== 2 /* VMState.disconnected */) {
|
|
5675
5582
|
const {
|
|
5676
|
-
oar,
|
|
5677
5583
|
tro
|
|
5678
5584
|
} = vm;
|
|
5679
5585
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
|
5680
5586
|
tro.reset();
|
|
5681
|
-
// Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
5682
|
-
for (const key in oar) {
|
|
5683
|
-
oar[key].reset();
|
|
5684
|
-
}
|
|
5685
5587
|
runDisconnectedCallback(vm);
|
|
5686
5588
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
5687
5589
|
runChildNodesDisconnectedCallback(vm);
|
|
@@ -5734,7 +5636,6 @@ var LWC = (function (exports) {
|
|
|
5734
5636
|
cmpSlots: {
|
|
5735
5637
|
slotAssignments: create(null)
|
|
5736
5638
|
},
|
|
5737
|
-
oar: create(null),
|
|
5738
5639
|
cmpTemplate: null,
|
|
5739
5640
|
hydrated: Boolean(hydrated),
|
|
5740
5641
|
renderMode: def.renderMode,
|
|
@@ -6915,94 +6816,166 @@ var LWC = (function (exports) {
|
|
|
6915
6816
|
// See @lwc/engine-core/src/framework/template.ts
|
|
6916
6817
|
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6917
6818
|
// Via https://www.npmjs.com/package/object-observer
|
|
6918
|
-
const ARRAY_MUTATION_METHODS = [
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
'reverse',
|
|
6924
|
-
'sort',
|
|
6925
|
-
'fill',
|
|
6926
|
-
'splice',
|
|
6927
|
-
'copyWithin',
|
|
6928
|
-
];
|
|
6819
|
+
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
6820
|
+
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
6821
|
+
const STYLESHEET_FUNCTION_EXPANDOS = [
|
|
6822
|
+
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
6823
|
+
'$scoped$'];
|
|
6929
6824
|
function getOriginalArrayMethod(prop) {
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6825
|
+
switch (prop) {
|
|
6826
|
+
case 'pop':
|
|
6827
|
+
return ArrayPop;
|
|
6828
|
+
case 'push':
|
|
6829
|
+
return ArrayPush$1;
|
|
6830
|
+
case 'shift':
|
|
6831
|
+
return ArrayShift;
|
|
6832
|
+
case 'unshift':
|
|
6833
|
+
return ArrayUnshift;
|
|
6834
|
+
case 'reverse':
|
|
6835
|
+
return ArrayReverse;
|
|
6836
|
+
case 'sort':
|
|
6837
|
+
return ArraySort;
|
|
6838
|
+
case 'fill':
|
|
6839
|
+
return ArrayFill;
|
|
6840
|
+
case 'splice':
|
|
6841
|
+
return ArraySplice;
|
|
6842
|
+
case 'copyWithin':
|
|
6843
|
+
return ArrayCopyWithin;
|
|
6844
|
+
}
|
|
6950
6845
|
}
|
|
6951
6846
|
let mutationWarningsSilenced = false;
|
|
6952
|
-
// Warn if the user tries to mutate
|
|
6847
|
+
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
6953
6848
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6954
6849
|
function warnOnArrayMutation(stylesheets) {
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6850
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6851
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6852
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6853
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6854
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6855
|
+
logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6856
|
+
// @ts-ignore
|
|
6857
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6858
|
+
};
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
6862
|
+
// `stylesheet.$scoped$ = true`
|
|
6863
|
+
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
6864
|
+
// We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
|
|
6865
|
+
for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
|
|
6866
|
+
let value = stylesheet[prop];
|
|
6867
|
+
defineProperty(stylesheet, prop, {
|
|
6868
|
+
enumerable: true,
|
|
6869
|
+
configurable: true,
|
|
6870
|
+
get() {
|
|
6871
|
+
return value;
|
|
6872
|
+
},
|
|
6873
|
+
set(newValue) {
|
|
6874
|
+
logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6875
|
+
value = newValue;
|
|
6876
|
+
}
|
|
6877
|
+
});
|
|
6878
|
+
}
|
|
6879
|
+
}
|
|
6880
|
+
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
6881
|
+
function warnOnStylesheetsMutation(stylesheets) {
|
|
6882
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6883
|
+
if (isArray$1(subStylesheets)) {
|
|
6884
|
+
warnOnArrayMutation(subStylesheets);
|
|
6885
|
+
} else {
|
|
6886
|
+
warnOnStylesheetFunctionMutation(subStylesheets);
|
|
6965
6887
|
}
|
|
6888
|
+
});
|
|
6889
|
+
}
|
|
6890
|
+
// Deeply freeze the entire array (of arrays) of stylesheet factory functions
|
|
6891
|
+
function deepFreeze(stylesheets) {
|
|
6892
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6893
|
+
freeze(subStylesheets);
|
|
6894
|
+
});
|
|
6895
|
+
}
|
|
6896
|
+
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
6897
|
+
function traverseStylesheets(stylesheets, callback) {
|
|
6898
|
+
callback(stylesheets);
|
|
6899
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
6900
|
+
const stylesheet = stylesheets[i];
|
|
6901
|
+
if (isArray$1(stylesheet)) {
|
|
6902
|
+
traverseStylesheets(stylesheet, callback);
|
|
6903
|
+
} else {
|
|
6904
|
+
callback(stylesheet);
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6966
6907
|
}
|
|
6967
|
-
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6968
|
-
// just warns on mutation.
|
|
6969
6908
|
function freezeTemplate(tmpl) {
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
});
|
|
6909
|
+
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
6910
|
+
// Deep freeze the template
|
|
6911
|
+
freeze(tmpl);
|
|
6912
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6913
|
+
deepFreeze(tmpl.stylesheets);
|
|
6914
|
+
}
|
|
6915
|
+
} else {
|
|
6916
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
6917
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6918
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
6919
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6920
|
+
enumerable: true,
|
|
6921
|
+
configurable: true,
|
|
6922
|
+
get() {
|
|
6923
|
+
const {
|
|
6924
|
+
stylesheetToken
|
|
6925
|
+
} = this;
|
|
6926
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
6927
|
+
return stylesheetToken;
|
|
6990
6928
|
}
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
6929
|
+
// Shim for the old `stylesheetTokens` property
|
|
6930
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
6931
|
+
return {
|
|
6932
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
6933
|
+
shadowAttribute: stylesheetToken
|
|
6934
|
+
};
|
|
6935
|
+
},
|
|
6936
|
+
set(value) {
|
|
6937
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
6938
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
6939
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
6940
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
6941
|
+
}
|
|
6942
|
+
});
|
|
6943
|
+
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
6944
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6945
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6946
|
+
warnOnStylesheetsMutation(tmpl.stylesheets);
|
|
6947
|
+
}
|
|
6948
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6949
|
+
let value = tmpl[prop];
|
|
6950
|
+
defineProperty(tmpl, prop, {
|
|
6951
|
+
enumerable: true,
|
|
6952
|
+
configurable: true,
|
|
6953
|
+
get() {
|
|
6954
|
+
return value;
|
|
6955
|
+
},
|
|
6956
|
+
set(newValue) {
|
|
6957
|
+
if (!mutationWarningsSilenced) {
|
|
6958
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6959
|
+
}
|
|
6960
|
+
value = newValue;
|
|
6961
|
+
}
|
|
7004
6962
|
});
|
|
6963
|
+
}
|
|
6964
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6965
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6966
|
+
enumerable: true,
|
|
6967
|
+
configurable: true,
|
|
6968
|
+
get: originalDescriptor.get,
|
|
6969
|
+
set(value) {
|
|
6970
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6971
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6972
|
+
mutationWarningsSilenced = true;
|
|
6973
|
+
originalDescriptor.set.call(this, value);
|
|
6974
|
+
mutationWarningsSilenced = false;
|
|
6975
|
+
}
|
|
6976
|
+
});
|
|
7005
6977
|
}
|
|
6978
|
+
}
|
|
7006
6979
|
}
|
|
7007
6980
|
|
|
7008
6981
|
/*
|
|
@@ -7027,7 +7000,7 @@ var LWC = (function (exports) {
|
|
|
7027
7000
|
}
|
|
7028
7001
|
return ctor;
|
|
7029
7002
|
}
|
|
7030
|
-
/* version: 2.32.
|
|
7003
|
+
/* version: 2.32.1 */
|
|
7031
7004
|
|
|
7032
7005
|
/*
|
|
7033
7006
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8000,7 +7973,7 @@ var LWC = (function (exports) {
|
|
|
8000
7973
|
function isNull(obj) {
|
|
8001
7974
|
return obj === null;
|
|
8002
7975
|
}
|
|
8003
|
-
/** version: 2.32.
|
|
7976
|
+
/** version: 2.32.1 */
|
|
8004
7977
|
|
|
8005
7978
|
/*
|
|
8006
7979
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8561,7 +8534,7 @@ var LWC = (function (exports) {
|
|
|
8561
8534
|
});
|
|
8562
8535
|
freeze(LightningElement);
|
|
8563
8536
|
seal(LightningElement.prototype);
|
|
8564
|
-
/* version: 2.32.
|
|
8537
|
+
/* version: 2.32.1 */
|
|
8565
8538
|
|
|
8566
8539
|
exports.LightningElement = LightningElement;
|
|
8567
8540
|
exports.__unstable__ProfilerControl = profilerControl;
|