lwc 2.13.1 → 2.13.4
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 +376 -170
- package/dist/engine-dom/iife/es2017/engine-dom.js +376 -169
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +222 -164
- package/dist/engine-dom/iife/es5/engine-dom.js +7562 -5758
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +5947 -4586
- package/dist/engine-dom/umd/es2017/engine-dom.js +376 -169
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +222 -164
- package/dist/engine-dom/umd/es5/engine-dom.js +7562 -5758
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +5947 -4586
- package/dist/engine-server/commonjs/es2017/engine-server.js +190 -72
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +190 -73
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +29 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +10 -13
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +4601 -3603
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +10 -1
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +4424 -3481
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +29 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +10 -13
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +4601 -3603
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +10 -1
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +4424 -3481
- 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.min.js +1 -1
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +243 -258
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +243 -258
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +243 -258
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +243 -258
- package/package.json +7 -7
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*/
|
|
50
50
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
51
51
|
const { isArray: isArray$1 } = Array;
|
|
52
|
-
const { filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, slice: ArraySlice, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
52
|
+
const { copyWithin: ArrayCopyWithin, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, } = Array.prototype;
|
|
53
53
|
const { fromCharCode: StringFromCharCode } = String;
|
|
54
54
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
55
55
|
function isUndefined$1(obj) {
|
|
@@ -304,9 +304,9 @@
|
|
|
304
304
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
305
305
|
*/
|
|
306
306
|
// Increment whenever the LWC template compiler changes
|
|
307
|
-
const LWC_VERSION = "2.13.
|
|
307
|
+
const LWC_VERSION = "2.13.4";
|
|
308
308
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.13.
|
|
309
|
+
/** version: 2.13.4 */
|
|
310
310
|
|
|
311
311
|
/*
|
|
312
312
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -396,6 +396,7 @@
|
|
|
396
396
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
397
397
|
*/
|
|
398
398
|
const features = {
|
|
399
|
+
DUMMY_TEST_FLAG: null,
|
|
399
400
|
ENABLE_ELEMENT_PATCH: null,
|
|
400
401
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
401
402
|
ENABLE_HMR: null,
|
|
@@ -459,10 +460,35 @@
|
|
|
459
460
|
setFeatureFlag(name, value);
|
|
460
461
|
}
|
|
461
462
|
}
|
|
462
|
-
/** version: 2.13.
|
|
463
|
+
/** version: 2.13.4 */
|
|
463
464
|
|
|
464
465
|
/* proxy-compat-disable */
|
|
465
466
|
|
|
467
|
+
/*
|
|
468
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
469
|
+
* All rights reserved.
|
|
470
|
+
* SPDX-License-Identifier: MIT
|
|
471
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
472
|
+
*/
|
|
473
|
+
// @ts-ignore
|
|
474
|
+
|
|
475
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
476
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
477
|
+
let hasFlag = false;
|
|
478
|
+
|
|
479
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
480
|
+
hasFlag = true;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
484
|
+
detail: {
|
|
485
|
+
package: '@lwc/engine-core',
|
|
486
|
+
hasFlag
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
|
|
466
492
|
/*
|
|
467
493
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
468
494
|
* All rights reserved.
|
|
@@ -563,10 +589,6 @@
|
|
|
563
589
|
function setHTMLElement(HTMLElementImpl) {
|
|
564
590
|
HTMLElementExported$1 = HTMLElementImpl;
|
|
565
591
|
}
|
|
566
|
-
let isHydrating$1;
|
|
567
|
-
function setIsHydrating$1(isHydratingImpl) {
|
|
568
|
-
isHydrating$1 = isHydratingImpl;
|
|
569
|
-
}
|
|
570
592
|
let insert$1;
|
|
571
593
|
function setInsert(insertImpl) {
|
|
572
594
|
insert$1 = insertImpl;
|
|
@@ -687,10 +709,6 @@
|
|
|
687
709
|
function setIsConnected(isConnectedImpl) {
|
|
688
710
|
isConnected$1 = isConnectedImpl;
|
|
689
711
|
}
|
|
690
|
-
let insertGlobalStylesheet$1;
|
|
691
|
-
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
692
|
-
insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
|
|
693
|
-
}
|
|
694
712
|
let insertStylesheet$1;
|
|
695
713
|
function setInsertStylesheet(insertStylesheetImpl) {
|
|
696
714
|
insertStylesheet$1 = insertStylesheetImpl;
|
|
@@ -2778,6 +2796,12 @@
|
|
|
2778
2796
|
}
|
|
2779
2797
|
}
|
|
2780
2798
|
|
|
2799
|
+
/*
|
|
2800
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2801
|
+
* All rights reserved.
|
|
2802
|
+
* SPDX-License-Identifier: MIT
|
|
2803
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2804
|
+
*/
|
|
2781
2805
|
const signedTemplateSet = new Set();
|
|
2782
2806
|
function defaultEmptyTemplate() {
|
|
2783
2807
|
return [];
|
|
@@ -2795,6 +2819,32 @@
|
|
|
2795
2819
|
checkVersionMismatch(tpl, 'template');
|
|
2796
2820
|
}
|
|
2797
2821
|
signedTemplateSet.add(tpl);
|
|
2822
|
+
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2823
|
+
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2824
|
+
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2825
|
+
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2826
|
+
defineProperty(tpl, 'stylesheetTokens', {
|
|
2827
|
+
enumerable: true,
|
|
2828
|
+
configurable: true,
|
|
2829
|
+
get() {
|
|
2830
|
+
const { stylesheetToken } = this;
|
|
2831
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
2832
|
+
return stylesheetToken;
|
|
2833
|
+
}
|
|
2834
|
+
// Shim for the old `stylesheetTokens` property
|
|
2835
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2836
|
+
return {
|
|
2837
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
2838
|
+
shadowAttribute: stylesheetToken,
|
|
2839
|
+
};
|
|
2840
|
+
},
|
|
2841
|
+
set(value) {
|
|
2842
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2843
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2844
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2845
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2846
|
+
},
|
|
2847
|
+
});
|
|
2798
2848
|
// chaining this method as a way to wrap existing
|
|
2799
2849
|
// assignment of templates easily, without too much transformation
|
|
2800
2850
|
return tpl;
|
|
@@ -3859,15 +3909,16 @@
|
|
|
3859
3909
|
}
|
|
3860
3910
|
}
|
|
3861
3911
|
function unmount(vnode, parent, doRemove = false) {
|
|
3862
|
-
const { type, elm } = vnode;
|
|
3912
|
+
const { type, elm, sel } = vnode;
|
|
3863
3913
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3864
3914
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3865
3915
|
if (doRemove) {
|
|
3866
3916
|
removeNode(elm, parent);
|
|
3867
3917
|
}
|
|
3918
|
+
const removeChildren = sel === 'slot'; // slot content is removed to trigger slotchange event when removing slot
|
|
3868
3919
|
switch (type) {
|
|
3869
3920
|
case 2 /* Element */:
|
|
3870
|
-
unmountVNodes(vnode.children, elm);
|
|
3921
|
+
unmountVNodes(vnode.children, elm, removeChildren);
|
|
3871
3922
|
break;
|
|
3872
3923
|
case 3 /* CustomElement */: {
|
|
3873
3924
|
const { vm } = vnode;
|
|
@@ -4785,10 +4836,10 @@
|
|
|
4785
4836
|
const { renderMode, shadowMode } = vm;
|
|
4786
4837
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4787
4838
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4788
|
-
|
|
4839
|
+
insertStylesheet$1(stylesheets[i]);
|
|
4789
4840
|
}
|
|
4790
4841
|
}
|
|
4791
|
-
else if (ssr$1 ||
|
|
4842
|
+
else if (ssr$1 || vm.hydrated) {
|
|
4792
4843
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4793
4844
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4794
4845
|
// the first time the VM renders.
|
|
@@ -4799,15 +4850,10 @@
|
|
|
4799
4850
|
else {
|
|
4800
4851
|
// native shadow or light DOM, DOM renderer
|
|
4801
4852
|
const root = getNearestNativeShadowComponent(vm);
|
|
4802
|
-
|
|
4853
|
+
// null root means a global style
|
|
4854
|
+
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4803
4855
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4804
|
-
|
|
4805
|
-
insertGlobalStylesheet$1(stylesheets[i]);
|
|
4806
|
-
}
|
|
4807
|
-
else {
|
|
4808
|
-
// local level
|
|
4809
|
-
insertStylesheet$1(stylesheets[i], root.shadowRoot);
|
|
4810
|
-
}
|
|
4856
|
+
insertStylesheet$1(stylesheets[i], target);
|
|
4811
4857
|
}
|
|
4812
4858
|
}
|
|
4813
4859
|
return null;
|
|
@@ -5349,24 +5395,14 @@
|
|
|
5349
5395
|
|
|
5350
5396
|
resetComponentStateWhenRemoved(vm);
|
|
5351
5397
|
}
|
|
5352
|
-
|
|
5353
|
-
function getNearestShadowAncestor(vm) {
|
|
5354
|
-
let ancestor = vm.owner;
|
|
5355
|
-
|
|
5356
|
-
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5357
|
-
/* Light */
|
|
5358
|
-
) {
|
|
5359
|
-
ancestor = ancestor.owner;
|
|
5360
|
-
}
|
|
5361
|
-
|
|
5362
|
-
return ancestor;
|
|
5363
|
-
}
|
|
5364
|
-
|
|
5365
5398
|
function createVM(elm, ctor, options) {
|
|
5399
|
+
var _a;
|
|
5400
|
+
|
|
5366
5401
|
const {
|
|
5367
5402
|
mode,
|
|
5368
5403
|
owner,
|
|
5369
|
-
tagName
|
|
5404
|
+
tagName,
|
|
5405
|
+
hydrated
|
|
5370
5406
|
} = options;
|
|
5371
5407
|
const def = getComponentInternalDef(ctor);
|
|
5372
5408
|
const vm = {
|
|
@@ -5389,7 +5425,10 @@
|
|
|
5389
5425
|
cmpSlots: create(null),
|
|
5390
5426
|
oar: create(null),
|
|
5391
5427
|
cmpTemplate: null,
|
|
5428
|
+
hydrated: Boolean(hydrated),
|
|
5392
5429
|
renderMode: def.renderMode,
|
|
5430
|
+
shadowMode: computeShadowMode(def, owner),
|
|
5431
|
+
nearestShadowMode: (owner === null || owner === void 0 ? void 0 : owner.shadowRoot) ? owner.shadowMode : (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : null,
|
|
5393
5432
|
context: {
|
|
5394
5433
|
stylesheetToken: undefined,
|
|
5395
5434
|
hasTokenInClass: undefined,
|
|
@@ -5402,7 +5441,6 @@
|
|
|
5402
5441
|
},
|
|
5403
5442
|
// Properties set right after VM creation.
|
|
5404
5443
|
tro: null,
|
|
5405
|
-
shadowMode: null,
|
|
5406
5444
|
// Properties set by the LightningElement constructor.
|
|
5407
5445
|
component: null,
|
|
5408
5446
|
shadowRoot: null,
|
|
@@ -5411,7 +5449,6 @@
|
|
|
5411
5449
|
setHook,
|
|
5412
5450
|
getHook
|
|
5413
5451
|
};
|
|
5414
|
-
vm.shadowMode = computeShadowMode(vm);
|
|
5415
5452
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5416
5453
|
|
|
5417
5454
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5436,10 +5473,9 @@
|
|
|
5436
5473
|
return vm;
|
|
5437
5474
|
}
|
|
5438
5475
|
|
|
5439
|
-
function computeShadowMode(
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
} = vm;
|
|
5476
|
+
function computeShadowMode(def, owner) {
|
|
5477
|
+
var _a;
|
|
5478
|
+
|
|
5443
5479
|
let shadowMode;
|
|
5444
5480
|
|
|
5445
5481
|
if (isSyntheticShadowDefined$1) {
|
|
@@ -5462,23 +5498,13 @@
|
|
|
5462
5498
|
/* Native */
|
|
5463
5499
|
;
|
|
5464
5500
|
} else {
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
if
|
|
5468
|
-
|
|
5469
|
-
)
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
shadowMode = 0
|
|
5473
|
-
/* Native */
|
|
5474
|
-
;
|
|
5475
|
-
} else {
|
|
5476
|
-
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5477
|
-
// to be native.
|
|
5478
|
-
shadowMode = 1
|
|
5479
|
-
/* Synthetic */
|
|
5480
|
-
;
|
|
5481
|
-
}
|
|
5501
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5502
|
+
// transitively opts all of its descendants into native.
|
|
5503
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5504
|
+
// to be native.
|
|
5505
|
+
shadowMode = (_a = owner === null || owner === void 0 ? void 0 : owner.nearestShadowMode) !== null && _a !== void 0 ? _a : 1
|
|
5506
|
+
/* Synthetic */
|
|
5507
|
+
;
|
|
5482
5508
|
}
|
|
5483
5509
|
} else {
|
|
5484
5510
|
shadowMode = 1
|
|
@@ -6374,6 +6400,7 @@
|
|
|
6374
6400
|
mode,
|
|
6375
6401
|
owner,
|
|
6376
6402
|
tagName: sel,
|
|
6403
|
+
hydrated: true,
|
|
6377
6404
|
});
|
|
6378
6405
|
vnode.elm = elm;
|
|
6379
6406
|
vnode.vm = vm;
|
|
@@ -6567,7 +6594,6 @@
|
|
|
6567
6594
|
hooksAreSet = true;
|
|
6568
6595
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6569
6596
|
}
|
|
6570
|
-
/* version: 2.13.1 */
|
|
6571
6597
|
|
|
6572
6598
|
/*
|
|
6573
6599
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6575,25 +6601,270 @@
|
|
|
6575
6601
|
* SPDX-License-Identifier: MIT
|
|
6576
6602
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6577
6603
|
*/
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6604
|
+
// See @lwc/engine-core/src/framework/template.ts
|
|
6605
|
+
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6606
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
6607
|
+
const ARRAY_MUTATION_METHODS = [
|
|
6608
|
+
'pop',
|
|
6609
|
+
'push',
|
|
6610
|
+
'shift',
|
|
6611
|
+
'unshift',
|
|
6612
|
+
'reverse',
|
|
6613
|
+
'sort',
|
|
6614
|
+
'fill',
|
|
6615
|
+
'splice',
|
|
6616
|
+
'copyWithin',
|
|
6617
|
+
];
|
|
6618
|
+
function getOriginalArrayMethod(prop) {
|
|
6619
|
+
switch (prop) {
|
|
6620
|
+
case 'pop':
|
|
6621
|
+
return ArrayPop;
|
|
6622
|
+
case 'push':
|
|
6623
|
+
return ArrayPush$1;
|
|
6624
|
+
case 'shift':
|
|
6625
|
+
return ArrayShift;
|
|
6626
|
+
case 'unshift':
|
|
6627
|
+
return ArrayUnshift;
|
|
6628
|
+
case 'reverse':
|
|
6629
|
+
return ArrayReverse;
|
|
6630
|
+
case 'sort':
|
|
6631
|
+
return ArraySort;
|
|
6632
|
+
case 'fill':
|
|
6633
|
+
return ArrayFill;
|
|
6634
|
+
case 'splice':
|
|
6635
|
+
return ArraySplice;
|
|
6636
|
+
case 'copyWithin':
|
|
6637
|
+
return ArrayCopyWithin;
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
let mutationWarningsSilenced = false;
|
|
6641
|
+
// Warn if the user tries to mutate tmpl.stylesheets, e.g.:
|
|
6642
|
+
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6643
|
+
function warnOnArrayMutation(stylesheets) {
|
|
6644
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6645
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6646
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6647
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6648
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6649
|
+
logError(`Mutating the "stylesheets" array on a template function ` +
|
|
6650
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6651
|
+
// @ts-ignore
|
|
6652
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6653
|
+
};
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6657
|
+
// just warns on mutation.
|
|
6658
|
+
function freezeTemplate(tmpl) {
|
|
6659
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6660
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6661
|
+
warnOnArrayMutation(tmpl.stylesheets);
|
|
6662
|
+
}
|
|
6663
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6664
|
+
let value = tmpl[prop];
|
|
6665
|
+
defineProperty(tmpl, prop, {
|
|
6666
|
+
enumerable: true,
|
|
6667
|
+
configurable: true,
|
|
6668
|
+
get() {
|
|
6669
|
+
return value;
|
|
6670
|
+
},
|
|
6671
|
+
set(newValue) {
|
|
6672
|
+
if (!mutationWarningsSilenced) {
|
|
6673
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` +
|
|
6674
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6675
|
+
}
|
|
6676
|
+
value = newValue;
|
|
6677
|
+
},
|
|
6678
|
+
});
|
|
6584
6679
|
}
|
|
6585
|
-
|
|
6680
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6681
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6682
|
+
enumerable: true,
|
|
6683
|
+
configurable: true,
|
|
6684
|
+
get: originalDescriptor.get,
|
|
6685
|
+
set(value) {
|
|
6686
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
|
|
6687
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6688
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6689
|
+
mutationWarningsSilenced = true;
|
|
6690
|
+
originalDescriptor.set.call(this, value);
|
|
6691
|
+
mutationWarningsSilenced = false;
|
|
6692
|
+
},
|
|
6693
|
+
});
|
|
6694
|
+
}
|
|
6586
6695
|
}
|
|
6587
|
-
|
|
6588
|
-
|
|
6696
|
+
|
|
6697
|
+
/*
|
|
6698
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6699
|
+
* All rights reserved.
|
|
6700
|
+
* SPDX-License-Identifier: MIT
|
|
6701
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6702
|
+
*/
|
|
6703
|
+
/**
|
|
6704
|
+
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6705
|
+
* This API is subject to change or being removed.
|
|
6706
|
+
*/
|
|
6707
|
+
function getComponentConstructor(elm) {
|
|
6708
|
+
let ctor = null;
|
|
6709
|
+
// intentionally checking for undefined due to some funky libraries patching weakmap.get
|
|
6710
|
+
// to throw when undefined.
|
|
6711
|
+
if (!isUndefined$1(elm)) {
|
|
6712
|
+
const vm = getAssociatedVMIfPresent(elm);
|
|
6713
|
+
if (!isUndefined$1(vm)) {
|
|
6714
|
+
ctor = vm.def.ctor;
|
|
6715
|
+
}
|
|
6716
|
+
}
|
|
6717
|
+
return ctor;
|
|
6718
|
+
}
|
|
6719
|
+
/* version: 2.13.4 */
|
|
6720
|
+
|
|
6721
|
+
/*
|
|
6722
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6723
|
+
* All rights reserved.
|
|
6724
|
+
* SPDX-License-Identifier: MIT
|
|
6725
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6726
|
+
*/
|
|
6727
|
+
//
|
|
6728
|
+
// Feature detection
|
|
6729
|
+
//
|
|
6730
|
+
// This check for constructable style sheets is similar to Fast's:
|
|
6589
6731
|
// https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
|
|
6590
6732
|
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
6591
|
-
const
|
|
6592
|
-
|
|
6733
|
+
const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
6734
|
+
// The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
|
|
6735
|
+
// Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
|
|
6736
|
+
// (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
|
|
6737
|
+
// TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
|
|
6738
|
+
const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets &&
|
|
6593
6739
|
getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
6594
|
-
|
|
6595
|
-
const
|
|
6596
|
-
const
|
|
6740
|
+
// Detect IE, via https://stackoverflow.com/a/9851769
|
|
6741
|
+
const isIE11 = !isUndefined$1(document.documentMode);
|
|
6742
|
+
const stylesheetCache = new Map();
|
|
6743
|
+
//
|
|
6744
|
+
// Test utilities
|
|
6745
|
+
//
|
|
6746
|
+
if (process.env.NODE_ENV === 'development') {
|
|
6747
|
+
// @ts-ignore
|
|
6748
|
+
window.__lwcResetGlobalStylesheets = () => {
|
|
6749
|
+
stylesheetCache.clear();
|
|
6750
|
+
};
|
|
6751
|
+
}
|
|
6752
|
+
function isDocument(target) {
|
|
6753
|
+
return !isUndefined$1(target.head);
|
|
6754
|
+
}
|
|
6755
|
+
function createFreshStyleElement(content) {
|
|
6756
|
+
const elm = document.createElement('style');
|
|
6757
|
+
elm.type = 'text/css';
|
|
6758
|
+
elm.textContent = content;
|
|
6759
|
+
return elm;
|
|
6760
|
+
}
|
|
6761
|
+
function createStyleElement(content, cacheData) {
|
|
6762
|
+
const { stylesheet, used } = cacheData;
|
|
6763
|
+
// If the <style> was already used, then we should clone it. We cannot insert
|
|
6764
|
+
// the same <style> in two places in the DOM.
|
|
6765
|
+
if (used) {
|
|
6766
|
+
// For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
|
|
6767
|
+
// and will render the incorrect styles if we do things that way. It's just
|
|
6768
|
+
// a perf optimization, so we can skip it for IE11.
|
|
6769
|
+
if (isIE11) {
|
|
6770
|
+
return createFreshStyleElement(content);
|
|
6771
|
+
}
|
|
6772
|
+
// This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
6773
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
6774
|
+
return stylesheet.cloneNode(true);
|
|
6775
|
+
}
|
|
6776
|
+
// We don't clone every time, because that would be a perf tax on the first time
|
|
6777
|
+
cacheData.used = true;
|
|
6778
|
+
return stylesheet;
|
|
6779
|
+
}
|
|
6780
|
+
function createConstructableStylesheet(content) {
|
|
6781
|
+
const stylesheet = new CSSStyleSheet();
|
|
6782
|
+
stylesheet.replaceSync(content);
|
|
6783
|
+
return stylesheet;
|
|
6784
|
+
}
|
|
6785
|
+
function insertConstructableStylesheet(content, target, cacheData) {
|
|
6786
|
+
const { adoptedStyleSheets } = target;
|
|
6787
|
+
const { stylesheet } = cacheData;
|
|
6788
|
+
// Mutable adopted stylesheets are only supported in certain browsers.
|
|
6789
|
+
// The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
|
|
6790
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
6791
|
+
adoptedStyleSheets.push(stylesheet);
|
|
6792
|
+
}
|
|
6793
|
+
else {
|
|
6794
|
+
target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
|
|
6795
|
+
}
|
|
6796
|
+
}
|
|
6797
|
+
function insertStyleElement(content, target, cacheData) {
|
|
6798
|
+
const elm = createStyleElement(content, cacheData);
|
|
6799
|
+
const targetAnchorPoint = isDocument(target) ? target.head : target;
|
|
6800
|
+
targetAnchorPoint.appendChild(elm);
|
|
6801
|
+
}
|
|
6802
|
+
function doInsertStylesheet(content, target, cacheData) {
|
|
6803
|
+
// Constructable stylesheets are only supported in certain browsers:
|
|
6804
|
+
// https://caniuse.com/mdn-api_document_adoptedstylesheets
|
|
6805
|
+
// The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2460
|
|
6806
|
+
if (supportsConstructableStylesheets) {
|
|
6807
|
+
insertConstructableStylesheet(content, target, cacheData);
|
|
6808
|
+
}
|
|
6809
|
+
else {
|
|
6810
|
+
// Fall back to <style> element
|
|
6811
|
+
insertStyleElement(content, target, cacheData);
|
|
6812
|
+
}
|
|
6813
|
+
}
|
|
6814
|
+
function getCacheData(content) {
|
|
6815
|
+
let cacheData = stylesheetCache.get(content);
|
|
6816
|
+
if (isUndefined$1(cacheData)) {
|
|
6817
|
+
cacheData = {
|
|
6818
|
+
stylesheet: supportsConstructableStylesheets
|
|
6819
|
+
? createConstructableStylesheet(content)
|
|
6820
|
+
: createFreshStyleElement(content),
|
|
6821
|
+
roots: undefined,
|
|
6822
|
+
global: false,
|
|
6823
|
+
used: false,
|
|
6824
|
+
};
|
|
6825
|
+
stylesheetCache.set(content, cacheData);
|
|
6826
|
+
}
|
|
6827
|
+
return cacheData;
|
|
6828
|
+
}
|
|
6829
|
+
function insertGlobalStylesheet(content) {
|
|
6830
|
+
const cacheData = getCacheData(content);
|
|
6831
|
+
if (cacheData.global) {
|
|
6832
|
+
// already inserted
|
|
6833
|
+
return;
|
|
6834
|
+
}
|
|
6835
|
+
cacheData.global = true; // mark inserted
|
|
6836
|
+
doInsertStylesheet(content, document, cacheData);
|
|
6837
|
+
}
|
|
6838
|
+
function insertLocalStylesheet(content, target) {
|
|
6839
|
+
const cacheData = getCacheData(content);
|
|
6840
|
+
let { roots } = cacheData;
|
|
6841
|
+
if (isUndefined$1(roots)) {
|
|
6842
|
+
roots = cacheData.roots = new WeakSet(); // lazily initialize (not needed for global styles)
|
|
6843
|
+
}
|
|
6844
|
+
else if (roots.has(target)) {
|
|
6845
|
+
// already inserted
|
|
6846
|
+
return;
|
|
6847
|
+
}
|
|
6848
|
+
roots.add(target); // mark inserted
|
|
6849
|
+
doInsertStylesheet(content, target, cacheData);
|
|
6850
|
+
}
|
|
6851
|
+
function insertStylesheet(content, target) {
|
|
6852
|
+
if (isUndefined$1(target)) {
|
|
6853
|
+
// global
|
|
6854
|
+
insertGlobalStylesheet(content);
|
|
6855
|
+
}
|
|
6856
|
+
else {
|
|
6857
|
+
// local
|
|
6858
|
+
insertLocalStylesheet(content, target);
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
|
|
6862
|
+
/*
|
|
6863
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6864
|
+
* All rights reserved.
|
|
6865
|
+
* SPDX-License-Identifier: MIT
|
|
6866
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6867
|
+
*/
|
|
6597
6868
|
let getCustomElement;
|
|
6598
6869
|
let defineCustomElement;
|
|
6599
6870
|
let HTMLElementConstructor;
|
|
@@ -6620,52 +6891,6 @@
|
|
|
6620
6891
|
return false;
|
|
6621
6892
|
}
|
|
6622
6893
|
}
|
|
6623
|
-
function insertConstructableStyleSheet(content, target) {
|
|
6624
|
-
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
6625
|
-
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
6626
|
-
let styleSheet = styleSheets[content];
|
|
6627
|
-
if (isUndefined$1(styleSheet)) {
|
|
6628
|
-
styleSheet = new CSSStyleSheet();
|
|
6629
|
-
styleSheet.replaceSync(content);
|
|
6630
|
-
styleSheets[content] = styleSheet;
|
|
6631
|
-
}
|
|
6632
|
-
const { adoptedStyleSheets } = target;
|
|
6633
|
-
if (!adoptedStyleSheets.includes(styleSheet)) {
|
|
6634
|
-
if (supportsMutableAdoptedStyleSheets) {
|
|
6635
|
-
// This is only supported in later versions of Chromium:
|
|
6636
|
-
// https://chromestatus.com/feature/5638996492288000
|
|
6637
|
-
adoptedStyleSheets.push(styleSheet);
|
|
6638
|
-
}
|
|
6639
|
-
else {
|
|
6640
|
-
target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
|
|
6641
|
-
}
|
|
6642
|
-
}
|
|
6643
|
-
}
|
|
6644
|
-
function insertStyleElement(content, target) {
|
|
6645
|
-
// Avoid inserting duplicate `<style>`s
|
|
6646
|
-
let sheets = shadowRootsToStyleSheets.get(target);
|
|
6647
|
-
if (isUndefined$1(sheets)) {
|
|
6648
|
-
sheets = create(null);
|
|
6649
|
-
shadowRootsToStyleSheets.set(target, sheets);
|
|
6650
|
-
}
|
|
6651
|
-
if (sheets[content]) {
|
|
6652
|
-
return;
|
|
6653
|
-
}
|
|
6654
|
-
sheets[content] = true;
|
|
6655
|
-
// This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
6656
|
-
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
6657
|
-
let elm = styleElements[content];
|
|
6658
|
-
if (isUndefined$1(elm)) {
|
|
6659
|
-
elm = document.createElement('style');
|
|
6660
|
-
elm.type = 'text/css';
|
|
6661
|
-
elm.textContent = content;
|
|
6662
|
-
styleElements[content] = elm;
|
|
6663
|
-
}
|
|
6664
|
-
else {
|
|
6665
|
-
elm = elm.cloneNode(true);
|
|
6666
|
-
}
|
|
6667
|
-
target.appendChild(elm);
|
|
6668
|
-
}
|
|
6669
6894
|
if (isCustomElementRegistryAvailable()) {
|
|
6670
6895
|
getCustomElement = customElements.get.bind(customElements);
|
|
6671
6896
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -6704,9 +6929,6 @@
|
|
|
6704
6929
|
hydrating = value;
|
|
6705
6930
|
}
|
|
6706
6931
|
const ssr = false;
|
|
6707
|
-
function isHydrating() {
|
|
6708
|
-
return hydrating;
|
|
6709
|
-
}
|
|
6710
6932
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6711
6933
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6712
6934
|
function createElement$1(tagName, namespace) {
|
|
@@ -6821,25 +7043,6 @@
|
|
|
6821
7043
|
function isConnected(node) {
|
|
6822
7044
|
return node.isConnected;
|
|
6823
7045
|
}
|
|
6824
|
-
function insertGlobalStylesheet(content) {
|
|
6825
|
-
if (!isUndefined$1(globalStylesheets[content])) {
|
|
6826
|
-
return;
|
|
6827
|
-
}
|
|
6828
|
-
globalStylesheets[content] = true;
|
|
6829
|
-
const elm = document.createElement('style');
|
|
6830
|
-
elm.type = 'text/css';
|
|
6831
|
-
elm.textContent = content;
|
|
6832
|
-
globalStylesheetsParentElement.appendChild(elm);
|
|
6833
|
-
}
|
|
6834
|
-
function insertStylesheet(content, target) {
|
|
6835
|
-
if (supportsConstructableStyleSheets) {
|
|
6836
|
-
insertConstructableStyleSheet(content, target);
|
|
6837
|
-
}
|
|
6838
|
-
else {
|
|
6839
|
-
// Fall back to <style> element
|
|
6840
|
-
insertStyleElement(content, target);
|
|
6841
|
-
}
|
|
6842
|
-
}
|
|
6843
7046
|
function assertInstanceOfHTMLElement(elm, msg) {
|
|
6844
7047
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
6845
7048
|
}
|
|
@@ -6873,10 +7076,7 @@
|
|
|
6873
7076
|
setGetProperty(getProperty);
|
|
6874
7077
|
setHTMLElement(HTMLElementExported);
|
|
6875
7078
|
setInsert(insert);
|
|
6876
|
-
setInsertGlobalStylesheet(insertGlobalStylesheet);
|
|
6877
|
-
setInsertStylesheet(insertStylesheet);
|
|
6878
7079
|
setIsConnected(isConnected);
|
|
6879
|
-
setIsHydrating$1(isHydrating);
|
|
6880
7080
|
setIsNativeShadowDefined(isNativeShadowDefined);
|
|
6881
7081
|
setIsSyntheticShadowDefined(isSyntheticShadowDefined);
|
|
6882
7082
|
setNextSibling(nextSibling);
|
|
@@ -6891,6 +7091,32 @@
|
|
|
6891
7091
|
setSetText(setText);
|
|
6892
7092
|
setSsr(ssr);
|
|
6893
7093
|
setAddEventListener(addEventListener);
|
|
7094
|
+
setInsertStylesheet(insertStylesheet);
|
|
7095
|
+
|
|
7096
|
+
/*
|
|
7097
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7098
|
+
* All rights reserved.
|
|
7099
|
+
* SPDX-License-Identifier: MIT
|
|
7100
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7101
|
+
*/
|
|
7102
|
+
// @ts-ignore
|
|
7103
|
+
|
|
7104
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7105
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
7106
|
+
let hasFlag = false;
|
|
7107
|
+
|
|
7108
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7109
|
+
hasFlag = true;
|
|
7110
|
+
}
|
|
7111
|
+
|
|
7112
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7113
|
+
detail: {
|
|
7114
|
+
package: '@lwc/engine-dom',
|
|
7115
|
+
hasFlag
|
|
7116
|
+
}
|
|
7117
|
+
}));
|
|
7118
|
+
});
|
|
7119
|
+
}
|
|
6894
7120
|
|
|
6895
7121
|
/*
|
|
6896
7122
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6916,6 +7142,7 @@
|
|
|
6916
7142
|
mode: 'open',
|
|
6917
7143
|
owner: null,
|
|
6918
7144
|
tagName: element.tagName.toLowerCase(),
|
|
7145
|
+
hydrated: true,
|
|
6919
7146
|
});
|
|
6920
7147
|
for (const [key, value] of Object.entries(props)) {
|
|
6921
7148
|
element[key] = value;
|
|
@@ -7118,27 +7345,6 @@
|
|
|
7118
7345
|
return element;
|
|
7119
7346
|
}
|
|
7120
7347
|
|
|
7121
|
-
/*
|
|
7122
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7123
|
-
* All rights reserved.
|
|
7124
|
-
* SPDX-License-Identifier: MIT
|
|
7125
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7126
|
-
*/
|
|
7127
|
-
/**
|
|
7128
|
-
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
7129
|
-
* This API is subject to change or being removed.
|
|
7130
|
-
*/
|
|
7131
|
-
function getComponentConstructor(elm) {
|
|
7132
|
-
let ctor = null;
|
|
7133
|
-
if (elm instanceof HTMLElement) {
|
|
7134
|
-
const vm = getAssociatedVMIfPresent(elm);
|
|
7135
|
-
if (!isUndefined$1(vm)) {
|
|
7136
|
-
ctor = vm.def.ctor;
|
|
7137
|
-
}
|
|
7138
|
-
}
|
|
7139
|
-
return ctor;
|
|
7140
|
-
}
|
|
7141
|
-
|
|
7142
7348
|
/*
|
|
7143
7349
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7144
7350
|
* All rights reserved.
|
|
@@ -7207,7 +7413,7 @@
|
|
|
7207
7413
|
});
|
|
7208
7414
|
freeze(LightningElement);
|
|
7209
7415
|
seal(LightningElement.prototype);
|
|
7210
|
-
/* version: 2.13.
|
|
7416
|
+
/* version: 2.13.4 */
|
|
7211
7417
|
|
|
7212
7418
|
exports.LightningElement = LightningElement;
|
|
7213
7419
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7215,6 +7421,7 @@
|
|
|
7215
7421
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
7216
7422
|
exports.createContextProvider = createContextProvider;
|
|
7217
7423
|
exports.createElement = createElement;
|
|
7424
|
+
exports.freezeTemplate = freezeTemplate;
|
|
7218
7425
|
exports.getComponentConstructor = getComponentConstructor;
|
|
7219
7426
|
exports.getComponentDef = getComponentDef;
|
|
7220
7427
|
exports.hydrateComponent = hydrateComponent;
|