lwc 2.13.3 → 2.14.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 +351 -129
- package/dist/engine-dom/iife/es2017/engine-dom.js +351 -128
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +195 -122
- package/dist/engine-dom/iife/es5/engine-dom.js +7581 -5773
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +5966 -4601
- package/dist/engine-dom/umd/es2017/engine-dom.js +351 -128
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +195 -122
- package/dist/engine-dom/umd/es5/engine-dom.js +7581 -5773
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +5966 -4601
- package/dist/engine-server/commonjs/es2017/engine-server.js +188 -52
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +188 -53
- 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
|
@@ -43,7 +43,7 @@ var assert = /*#__PURE__*/Object.freeze({
|
|
|
43
43
|
*/
|
|
44
44
|
const { assign, create, defineProperties, defineProperty, freeze, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getPrototypeOf: getPrototypeOf$1, hasOwnProperty: hasOwnProperty$1, isFrozen, keys, seal, setPrototypeOf, } = Object;
|
|
45
45
|
const { isArray: isArray$1 } = Array;
|
|
46
|
-
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;
|
|
46
|
+
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;
|
|
47
47
|
const { fromCharCode: StringFromCharCode } = String;
|
|
48
48
|
const { charCodeAt: StringCharCodeAt, replace: StringReplace, slice: StringSlice, toLowerCase: StringToLowerCase, } = String.prototype;
|
|
49
49
|
function isUndefined$1(obj) {
|
|
@@ -298,9 +298,9 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
|
298
298
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
299
299
|
*/
|
|
300
300
|
// Increment whenever the LWC template compiler changes
|
|
301
|
-
const LWC_VERSION = "2.
|
|
301
|
+
const LWC_VERSION = "2.14.1";
|
|
302
302
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
303
|
-
/** version: 2.
|
|
303
|
+
/** version: 2.14.1 */
|
|
304
304
|
|
|
305
305
|
/*
|
|
306
306
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -390,6 +390,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
|
|
|
390
390
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
391
391
|
*/
|
|
392
392
|
const features = {
|
|
393
|
+
DUMMY_TEST_FLAG: null,
|
|
393
394
|
ENABLE_ELEMENT_PATCH: null,
|
|
394
395
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
395
396
|
ENABLE_HMR: null,
|
|
@@ -453,10 +454,35 @@ function setFeatureFlagForTest(name, value) {
|
|
|
453
454
|
setFeatureFlag(name, value);
|
|
454
455
|
}
|
|
455
456
|
}
|
|
456
|
-
/** version: 2.
|
|
457
|
+
/** version: 2.14.1 */
|
|
457
458
|
|
|
458
459
|
/* proxy-compat-disable */
|
|
459
460
|
|
|
461
|
+
/*
|
|
462
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
463
|
+
* All rights reserved.
|
|
464
|
+
* SPDX-License-Identifier: MIT
|
|
465
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
466
|
+
*/
|
|
467
|
+
// @ts-ignore
|
|
468
|
+
|
|
469
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
470
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
471
|
+
let hasFlag = false;
|
|
472
|
+
|
|
473
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
474
|
+
hasFlag = true;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
478
|
+
detail: {
|
|
479
|
+
package: '@lwc/engine-core',
|
|
480
|
+
hasFlag
|
|
481
|
+
}
|
|
482
|
+
}));
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
460
486
|
/*
|
|
461
487
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
462
488
|
* All rights reserved.
|
|
@@ -557,10 +583,6 @@ let HTMLElementExported$1;
|
|
|
557
583
|
function setHTMLElement(HTMLElementImpl) {
|
|
558
584
|
HTMLElementExported$1 = HTMLElementImpl;
|
|
559
585
|
}
|
|
560
|
-
let isHydrating$1;
|
|
561
|
-
function setIsHydrating$1(isHydratingImpl) {
|
|
562
|
-
isHydrating$1 = isHydratingImpl;
|
|
563
|
-
}
|
|
564
586
|
let insert$1;
|
|
565
587
|
function setInsert(insertImpl) {
|
|
566
588
|
insert$1 = insertImpl;
|
|
@@ -681,10 +703,6 @@ let isConnected$1;
|
|
|
681
703
|
function setIsConnected(isConnectedImpl) {
|
|
682
704
|
isConnected$1 = isConnectedImpl;
|
|
683
705
|
}
|
|
684
|
-
let insertGlobalStylesheet$1;
|
|
685
|
-
function setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {
|
|
686
|
-
insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;
|
|
687
|
-
}
|
|
688
706
|
let insertStylesheet$1;
|
|
689
707
|
function setInsertStylesheet(insertStylesheetImpl) {
|
|
690
708
|
insertStylesheet$1 = insertStylesheetImpl;
|
|
@@ -2751,7 +2769,8 @@ function getDecoratorsMeta(Ctor) {
|
|
|
2751
2769
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2752
2770
|
*/
|
|
2753
2771
|
let warned = false;
|
|
2754
|
-
|
|
2772
|
+
// @ts-ignore
|
|
2773
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
2755
2774
|
// @ts-ignore
|
|
2756
2775
|
window.__lwcResetWarnedOnVersionMismatch = () => {
|
|
2757
2776
|
warned = false;
|
|
@@ -2800,6 +2819,8 @@ function registerTemplate(tpl) {
|
|
|
2800
2819
|
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2801
2820
|
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2802
2821
|
defineProperty(tpl, 'stylesheetTokens', {
|
|
2822
|
+
enumerable: true,
|
|
2823
|
+
configurable: true,
|
|
2803
2824
|
get() {
|
|
2804
2825
|
const { stylesheetToken } = this;
|
|
2805
2826
|
if (isUndefined$1(stylesheetToken)) {
|
|
@@ -3883,16 +3904,20 @@ function mountVNodes(vnodes, parent, anchor, start = 0, end = vnodes.length) {
|
|
|
3883
3904
|
}
|
|
3884
3905
|
}
|
|
3885
3906
|
function unmount(vnode, parent, doRemove = false) {
|
|
3886
|
-
const { type, elm } = vnode;
|
|
3907
|
+
const { type, elm, sel } = vnode;
|
|
3887
3908
|
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3888
3909
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3889
3910
|
if (doRemove) {
|
|
3890
3911
|
removeNode(elm, parent);
|
|
3891
3912
|
}
|
|
3892
3913
|
switch (type) {
|
|
3893
|
-
case 2 /* Element */:
|
|
3894
|
-
|
|
3914
|
+
case 2 /* Element */: {
|
|
3915
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3916
|
+
// Only required for synthetic shadow.
|
|
3917
|
+
const removeChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* Synthetic */;
|
|
3918
|
+
unmountVNodes(vnode.children, elm, removeChildren);
|
|
3895
3919
|
break;
|
|
3920
|
+
}
|
|
3896
3921
|
case 3 /* CustomElement */: {
|
|
3897
3922
|
const { vm } = vnode;
|
|
3898
3923
|
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
@@ -4809,10 +4834,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4809
4834
|
const { renderMode, shadowMode } = vm;
|
|
4810
4835
|
if (renderMode === 1 /* Shadow */ && shadowMode === 1 /* Synthetic */) {
|
|
4811
4836
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4812
|
-
|
|
4837
|
+
insertStylesheet$1(stylesheets[i]);
|
|
4813
4838
|
}
|
|
4814
4839
|
}
|
|
4815
|
-
else if (ssr$1 ||
|
|
4840
|
+
else if (ssr$1 || vm.hydrated) {
|
|
4816
4841
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4817
4842
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4818
4843
|
// the first time the VM renders.
|
|
@@ -4823,15 +4848,10 @@ function createStylesheet(vm, stylesheets) {
|
|
|
4823
4848
|
else {
|
|
4824
4849
|
// native shadow or light DOM, DOM renderer
|
|
4825
4850
|
const root = getNearestNativeShadowComponent(vm);
|
|
4826
|
-
|
|
4851
|
+
// null root means a global style
|
|
4852
|
+
const target = isNull(root) ? undefined : root.shadowRoot;
|
|
4827
4853
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4828
|
-
|
|
4829
|
-
insertGlobalStylesheet$1(stylesheets[i]);
|
|
4830
|
-
}
|
|
4831
|
-
else {
|
|
4832
|
-
// local level
|
|
4833
|
-
insertStylesheet$1(stylesheets[i], root.shadowRoot);
|
|
4834
|
-
}
|
|
4854
|
+
insertStylesheet$1(stylesheets[i], target);
|
|
4835
4855
|
}
|
|
4836
4856
|
}
|
|
4837
4857
|
return null;
|
|
@@ -5373,13 +5393,25 @@ function removeVM(vm) {
|
|
|
5373
5393
|
|
|
5374
5394
|
resetComponentStateWhenRemoved(vm);
|
|
5375
5395
|
}
|
|
5376
|
-
function createVM(elm, ctor, options) {
|
|
5377
|
-
var _a;
|
|
5378
5396
|
|
|
5397
|
+
function getNearestShadowAncestor(vm) {
|
|
5398
|
+
let ancestor = vm.owner;
|
|
5399
|
+
|
|
5400
|
+
while (!isNull(ancestor) && ancestor.renderMode === 0
|
|
5401
|
+
/* Light */
|
|
5402
|
+
) {
|
|
5403
|
+
ancestor = ancestor.owner;
|
|
5404
|
+
}
|
|
5405
|
+
|
|
5406
|
+
return ancestor;
|
|
5407
|
+
}
|
|
5408
|
+
|
|
5409
|
+
function createVM(elm, ctor, options) {
|
|
5379
5410
|
const {
|
|
5380
5411
|
mode,
|
|
5381
5412
|
owner,
|
|
5382
|
-
tagName
|
|
5413
|
+
tagName,
|
|
5414
|
+
hydrated
|
|
5383
5415
|
} = options;
|
|
5384
5416
|
const def = getComponentInternalDef(ctor);
|
|
5385
5417
|
const vm = {
|
|
@@ -5402,9 +5434,8 @@ function createVM(elm, ctor, options) {
|
|
|
5402
5434
|
cmpSlots: create(null),
|
|
5403
5435
|
oar: create(null),
|
|
5404
5436
|
cmpTemplate: null,
|
|
5437
|
+
hydrated: Boolean(hydrated),
|
|
5405
5438
|
renderMode: def.renderMode,
|
|
5406
|
-
shadowMode: computeShadowMode(def, owner),
|
|
5407
|
-
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,
|
|
5408
5439
|
context: {
|
|
5409
5440
|
stylesheetToken: undefined,
|
|
5410
5441
|
hasTokenInClass: undefined,
|
|
@@ -5417,6 +5448,7 @@ function createVM(elm, ctor, options) {
|
|
|
5417
5448
|
},
|
|
5418
5449
|
// Properties set right after VM creation.
|
|
5419
5450
|
tro: null,
|
|
5451
|
+
shadowMode: null,
|
|
5420
5452
|
// Properties set by the LightningElement constructor.
|
|
5421
5453
|
component: null,
|
|
5422
5454
|
shadowRoot: null,
|
|
@@ -5425,6 +5457,7 @@ function createVM(elm, ctor, options) {
|
|
|
5425
5457
|
setHook,
|
|
5426
5458
|
getHook
|
|
5427
5459
|
};
|
|
5460
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
5428
5461
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5429
5462
|
|
|
5430
5463
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5449,9 +5482,10 @@ function createVM(elm, ctor, options) {
|
|
|
5449
5482
|
return vm;
|
|
5450
5483
|
}
|
|
5451
5484
|
|
|
5452
|
-
function computeShadowMode(
|
|
5453
|
-
|
|
5454
|
-
|
|
5485
|
+
function computeShadowMode(vm) {
|
|
5486
|
+
const {
|
|
5487
|
+
def
|
|
5488
|
+
} = vm;
|
|
5455
5489
|
let shadowMode;
|
|
5456
5490
|
|
|
5457
5491
|
if (isSyntheticShadowDefined$1) {
|
|
@@ -5474,13 +5508,23 @@ function computeShadowMode(def, owner) {
|
|
|
5474
5508
|
/* Native */
|
|
5475
5509
|
;
|
|
5476
5510
|
} else {
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5511
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5512
|
+
|
|
5513
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5514
|
+
/* Native */
|
|
5515
|
+
) {
|
|
5516
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5517
|
+
// transitively opts all of its descendants into native.
|
|
5518
|
+
shadowMode = 0
|
|
5519
|
+
/* Native */
|
|
5520
|
+
;
|
|
5521
|
+
} else {
|
|
5522
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5523
|
+
// to be native.
|
|
5524
|
+
shadowMode = 1
|
|
5525
|
+
/* Synthetic */
|
|
5526
|
+
;
|
|
5527
|
+
}
|
|
5484
5528
|
}
|
|
5485
5529
|
} else {
|
|
5486
5530
|
shadowMode = 1
|
|
@@ -6376,6 +6420,7 @@ function hydrateCustomElement(elm, vnode) {
|
|
|
6376
6420
|
mode,
|
|
6377
6421
|
owner,
|
|
6378
6422
|
tagName: sel,
|
|
6423
|
+
hydrated: true,
|
|
6379
6424
|
});
|
|
6380
6425
|
vnode.elm = elm;
|
|
6381
6426
|
vnode.vm = vm;
|
|
@@ -6570,6 +6615,105 @@ function setHooks(hooks) {
|
|
|
6570
6615
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6571
6616
|
}
|
|
6572
6617
|
|
|
6618
|
+
/*
|
|
6619
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6620
|
+
* All rights reserved.
|
|
6621
|
+
* SPDX-License-Identifier: MIT
|
|
6622
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6623
|
+
*/
|
|
6624
|
+
// See @lwc/engine-core/src/framework/template.ts
|
|
6625
|
+
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6626
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
6627
|
+
const ARRAY_MUTATION_METHODS = [
|
|
6628
|
+
'pop',
|
|
6629
|
+
'push',
|
|
6630
|
+
'shift',
|
|
6631
|
+
'unshift',
|
|
6632
|
+
'reverse',
|
|
6633
|
+
'sort',
|
|
6634
|
+
'fill',
|
|
6635
|
+
'splice',
|
|
6636
|
+
'copyWithin',
|
|
6637
|
+
];
|
|
6638
|
+
function getOriginalArrayMethod(prop) {
|
|
6639
|
+
switch (prop) {
|
|
6640
|
+
case 'pop':
|
|
6641
|
+
return ArrayPop;
|
|
6642
|
+
case 'push':
|
|
6643
|
+
return ArrayPush$1;
|
|
6644
|
+
case 'shift':
|
|
6645
|
+
return ArrayShift;
|
|
6646
|
+
case 'unshift':
|
|
6647
|
+
return ArrayUnshift;
|
|
6648
|
+
case 'reverse':
|
|
6649
|
+
return ArrayReverse;
|
|
6650
|
+
case 'sort':
|
|
6651
|
+
return ArraySort;
|
|
6652
|
+
case 'fill':
|
|
6653
|
+
return ArrayFill;
|
|
6654
|
+
case 'splice':
|
|
6655
|
+
return ArraySplice;
|
|
6656
|
+
case 'copyWithin':
|
|
6657
|
+
return ArrayCopyWithin;
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6660
|
+
let mutationWarningsSilenced = false;
|
|
6661
|
+
// Warn if the user tries to mutate tmpl.stylesheets, e.g.:
|
|
6662
|
+
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6663
|
+
function warnOnArrayMutation(stylesheets) {
|
|
6664
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6665
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6666
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6667
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6668
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6669
|
+
logError(`Mutating the "stylesheets" array on a template function ` +
|
|
6670
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6671
|
+
// @ts-ignore
|
|
6672
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6673
|
+
};
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6676
|
+
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6677
|
+
// just warns on mutation.
|
|
6678
|
+
function freezeTemplate(tmpl) {
|
|
6679
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6680
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6681
|
+
warnOnArrayMutation(tmpl.stylesheets);
|
|
6682
|
+
}
|
|
6683
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6684
|
+
let value = tmpl[prop];
|
|
6685
|
+
defineProperty(tmpl, prop, {
|
|
6686
|
+
enumerable: true,
|
|
6687
|
+
configurable: true,
|
|
6688
|
+
get() {
|
|
6689
|
+
return value;
|
|
6690
|
+
},
|
|
6691
|
+
set(newValue) {
|
|
6692
|
+
if (!mutationWarningsSilenced) {
|
|
6693
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` +
|
|
6694
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6695
|
+
}
|
|
6696
|
+
value = newValue;
|
|
6697
|
+
},
|
|
6698
|
+
});
|
|
6699
|
+
}
|
|
6700
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6701
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6702
|
+
enumerable: true,
|
|
6703
|
+
configurable: true,
|
|
6704
|
+
get: originalDescriptor.get,
|
|
6705
|
+
set(value) {
|
|
6706
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
|
|
6707
|
+
`is deprecated and may be removed in a future version of LWC.`);
|
|
6708
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6709
|
+
mutationWarningsSilenced = true;
|
|
6710
|
+
originalDescriptor.set.call(this, value);
|
|
6711
|
+
mutationWarningsSilenced = false;
|
|
6712
|
+
},
|
|
6713
|
+
});
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
|
|
6573
6717
|
/*
|
|
6574
6718
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6575
6719
|
* All rights reserved.
|
|
@@ -6592,7 +6736,7 @@ function getComponentConstructor(elm) {
|
|
|
6592
6736
|
}
|
|
6593
6737
|
return ctor;
|
|
6594
6738
|
}
|
|
6595
|
-
/* version: 2.
|
|
6739
|
+
/* version: 2.14.1 */
|
|
6596
6740
|
|
|
6597
6741
|
/*
|
|
6598
6742
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6600,25 +6744,147 @@ function getComponentConstructor(elm) {
|
|
|
6600
6744
|
* SPDX-License-Identifier: MIT
|
|
6601
6745
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6602
6746
|
*/
|
|
6603
|
-
|
|
6747
|
+
//
|
|
6748
|
+
// Feature detection
|
|
6749
|
+
//
|
|
6750
|
+
// This check for constructable style sheets is similar to Fast's:
|
|
6751
|
+
// https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
|
|
6752
|
+
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
6753
|
+
const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
6754
|
+
// The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
|
|
6755
|
+
// Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
|
|
6756
|
+
// (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
|
|
6757
|
+
// TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
|
|
6758
|
+
const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets &&
|
|
6759
|
+
getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
6760
|
+
// Detect IE, via https://stackoverflow.com/a/9851769
|
|
6761
|
+
const isIE11 = !isUndefined$1(document.documentMode);
|
|
6762
|
+
const stylesheetCache = new Map();
|
|
6763
|
+
//
|
|
6764
|
+
// Test utilities
|
|
6765
|
+
//
|
|
6604
6766
|
if (process.env.NODE_ENV === 'development') {
|
|
6605
6767
|
// @ts-ignore
|
|
6606
6768
|
window.__lwcResetGlobalStylesheets = () => {
|
|
6607
|
-
|
|
6608
|
-
delete globalStylesheets[key];
|
|
6609
|
-
}
|
|
6769
|
+
stylesheetCache.clear();
|
|
6610
6770
|
};
|
|
6611
6771
|
}
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
const
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6772
|
+
function isDocument(target) {
|
|
6773
|
+
return !isUndefined$1(target.head);
|
|
6774
|
+
}
|
|
6775
|
+
function createFreshStyleElement(content) {
|
|
6776
|
+
const elm = document.createElement('style');
|
|
6777
|
+
elm.type = 'text/css';
|
|
6778
|
+
elm.textContent = content;
|
|
6779
|
+
return elm;
|
|
6780
|
+
}
|
|
6781
|
+
function createStyleElement(content, cacheData) {
|
|
6782
|
+
const { stylesheet, used } = cacheData;
|
|
6783
|
+
// If the <style> was already used, then we should clone it. We cannot insert
|
|
6784
|
+
// the same <style> in two places in the DOM.
|
|
6785
|
+
if (used) {
|
|
6786
|
+
// For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
|
|
6787
|
+
// and will render the incorrect styles if we do things that way. It's just
|
|
6788
|
+
// a perf optimization, so we can skip it for IE11.
|
|
6789
|
+
if (isIE11) {
|
|
6790
|
+
return createFreshStyleElement(content);
|
|
6791
|
+
}
|
|
6792
|
+
// This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
6793
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
6794
|
+
return stylesheet.cloneNode(true);
|
|
6795
|
+
}
|
|
6796
|
+
// We don't clone every time, because that would be a perf tax on the first time
|
|
6797
|
+
cacheData.used = true;
|
|
6798
|
+
return stylesheet;
|
|
6799
|
+
}
|
|
6800
|
+
function createConstructableStylesheet(content) {
|
|
6801
|
+
const stylesheet = new CSSStyleSheet();
|
|
6802
|
+
stylesheet.replaceSync(content);
|
|
6803
|
+
return stylesheet;
|
|
6804
|
+
}
|
|
6805
|
+
function insertConstructableStylesheet(content, target, cacheData) {
|
|
6806
|
+
const { adoptedStyleSheets } = target;
|
|
6807
|
+
const { stylesheet } = cacheData;
|
|
6808
|
+
// Mutable adopted stylesheets are only supported in certain browsers.
|
|
6809
|
+
// The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
|
|
6810
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
6811
|
+
adoptedStyleSheets.push(stylesheet);
|
|
6812
|
+
}
|
|
6813
|
+
else {
|
|
6814
|
+
target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6817
|
+
function insertStyleElement(content, target, cacheData) {
|
|
6818
|
+
const elm = createStyleElement(content, cacheData);
|
|
6819
|
+
const targetAnchorPoint = isDocument(target) ? target.head : target;
|
|
6820
|
+
targetAnchorPoint.appendChild(elm);
|
|
6821
|
+
}
|
|
6822
|
+
function doInsertStylesheet(content, target, cacheData) {
|
|
6823
|
+
// Constructable stylesheets are only supported in certain browsers:
|
|
6824
|
+
// https://caniuse.com/mdn-api_document_adoptedstylesheets
|
|
6825
|
+
// The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2460
|
|
6826
|
+
if (supportsConstructableStylesheets) {
|
|
6827
|
+
insertConstructableStylesheet(content, target, cacheData);
|
|
6828
|
+
}
|
|
6829
|
+
else {
|
|
6830
|
+
// Fall back to <style> element
|
|
6831
|
+
insertStyleElement(content, target, cacheData);
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6834
|
+
function getCacheData(content) {
|
|
6835
|
+
let cacheData = stylesheetCache.get(content);
|
|
6836
|
+
if (isUndefined$1(cacheData)) {
|
|
6837
|
+
cacheData = {
|
|
6838
|
+
stylesheet: supportsConstructableStylesheets
|
|
6839
|
+
? createConstructableStylesheet(content)
|
|
6840
|
+
: createFreshStyleElement(content),
|
|
6841
|
+
roots: undefined,
|
|
6842
|
+
global: false,
|
|
6843
|
+
used: false,
|
|
6844
|
+
};
|
|
6845
|
+
stylesheetCache.set(content, cacheData);
|
|
6846
|
+
}
|
|
6847
|
+
return cacheData;
|
|
6848
|
+
}
|
|
6849
|
+
function insertGlobalStylesheet(content) {
|
|
6850
|
+
const cacheData = getCacheData(content);
|
|
6851
|
+
if (cacheData.global) {
|
|
6852
|
+
// already inserted
|
|
6853
|
+
return;
|
|
6854
|
+
}
|
|
6855
|
+
cacheData.global = true; // mark inserted
|
|
6856
|
+
doInsertStylesheet(content, document, cacheData);
|
|
6857
|
+
}
|
|
6858
|
+
function insertLocalStylesheet(content, target) {
|
|
6859
|
+
const cacheData = getCacheData(content);
|
|
6860
|
+
let { roots } = cacheData;
|
|
6861
|
+
if (isUndefined$1(roots)) {
|
|
6862
|
+
roots = cacheData.roots = new WeakSet(); // lazily initialize (not needed for global styles)
|
|
6863
|
+
}
|
|
6864
|
+
else if (roots.has(target)) {
|
|
6865
|
+
// already inserted
|
|
6866
|
+
return;
|
|
6867
|
+
}
|
|
6868
|
+
roots.add(target); // mark inserted
|
|
6869
|
+
doInsertStylesheet(content, target, cacheData);
|
|
6870
|
+
}
|
|
6871
|
+
function insertStylesheet(content, target) {
|
|
6872
|
+
if (isUndefined$1(target)) {
|
|
6873
|
+
// global
|
|
6874
|
+
insertGlobalStylesheet(content);
|
|
6875
|
+
}
|
|
6876
|
+
else {
|
|
6877
|
+
// local
|
|
6878
|
+
insertLocalStylesheet(content, target);
|
|
6879
|
+
}
|
|
6880
|
+
}
|
|
6881
|
+
|
|
6882
|
+
/*
|
|
6883
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6884
|
+
* All rights reserved.
|
|
6885
|
+
* SPDX-License-Identifier: MIT
|
|
6886
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6887
|
+
*/
|
|
6622
6888
|
let getCustomElement;
|
|
6623
6889
|
let defineCustomElement;
|
|
6624
6890
|
let HTMLElementConstructor;
|
|
@@ -6645,52 +6911,6 @@ function isCustomElementRegistryAvailable() {
|
|
|
6645
6911
|
return false;
|
|
6646
6912
|
}
|
|
6647
6913
|
}
|
|
6648
|
-
function insertConstructableStyleSheet(content, target) {
|
|
6649
|
-
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
6650
|
-
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
6651
|
-
let styleSheet = styleSheets[content];
|
|
6652
|
-
if (isUndefined$1(styleSheet)) {
|
|
6653
|
-
styleSheet = new CSSStyleSheet();
|
|
6654
|
-
styleSheet.replaceSync(content);
|
|
6655
|
-
styleSheets[content] = styleSheet;
|
|
6656
|
-
}
|
|
6657
|
-
const { adoptedStyleSheets } = target;
|
|
6658
|
-
if (!adoptedStyleSheets.includes(styleSheet)) {
|
|
6659
|
-
if (supportsMutableAdoptedStyleSheets) {
|
|
6660
|
-
// This is only supported in later versions of Chromium:
|
|
6661
|
-
// https://chromestatus.com/feature/5638996492288000
|
|
6662
|
-
adoptedStyleSheets.push(styleSheet);
|
|
6663
|
-
}
|
|
6664
|
-
else {
|
|
6665
|
-
target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
|
|
6666
|
-
}
|
|
6667
|
-
}
|
|
6668
|
-
}
|
|
6669
|
-
function insertStyleElement(content, target) {
|
|
6670
|
-
// Avoid inserting duplicate `<style>`s
|
|
6671
|
-
let sheets = shadowRootsToStyleSheets.get(target);
|
|
6672
|
-
if (isUndefined$1(sheets)) {
|
|
6673
|
-
sheets = create(null);
|
|
6674
|
-
shadowRootsToStyleSheets.set(target, sheets);
|
|
6675
|
-
}
|
|
6676
|
-
if (sheets[content]) {
|
|
6677
|
-
return;
|
|
6678
|
-
}
|
|
6679
|
-
sheets[content] = true;
|
|
6680
|
-
// This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
6681
|
-
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
6682
|
-
let elm = styleElements[content];
|
|
6683
|
-
if (isUndefined$1(elm)) {
|
|
6684
|
-
elm = document.createElement('style');
|
|
6685
|
-
elm.type = 'text/css';
|
|
6686
|
-
elm.textContent = content;
|
|
6687
|
-
styleElements[content] = elm;
|
|
6688
|
-
}
|
|
6689
|
-
else {
|
|
6690
|
-
elm = elm.cloneNode(true);
|
|
6691
|
-
}
|
|
6692
|
-
target.appendChild(elm);
|
|
6693
|
-
}
|
|
6694
6914
|
if (isCustomElementRegistryAvailable()) {
|
|
6695
6915
|
getCustomElement = customElements.get.bind(customElements);
|
|
6696
6916
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -6729,9 +6949,6 @@ function setIsHydrating(value) {
|
|
|
6729
6949
|
hydrating = value;
|
|
6730
6950
|
}
|
|
6731
6951
|
const ssr = false;
|
|
6732
|
-
function isHydrating() {
|
|
6733
|
-
return hydrating;
|
|
6734
|
-
}
|
|
6735
6952
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6736
6953
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6737
6954
|
function createElement$1(tagName, namespace) {
|
|
@@ -6846,25 +7063,6 @@ function getLastElementChild(element) {
|
|
|
6846
7063
|
function isConnected(node) {
|
|
6847
7064
|
return node.isConnected;
|
|
6848
7065
|
}
|
|
6849
|
-
function insertGlobalStylesheet(content) {
|
|
6850
|
-
if (!isUndefined$1(globalStylesheets[content])) {
|
|
6851
|
-
return;
|
|
6852
|
-
}
|
|
6853
|
-
globalStylesheets[content] = true;
|
|
6854
|
-
const elm = document.createElement('style');
|
|
6855
|
-
elm.type = 'text/css';
|
|
6856
|
-
elm.textContent = content;
|
|
6857
|
-
globalStylesheetsParentElement.appendChild(elm);
|
|
6858
|
-
}
|
|
6859
|
-
function insertStylesheet(content, target) {
|
|
6860
|
-
if (supportsConstructableStyleSheets) {
|
|
6861
|
-
insertConstructableStyleSheet(content, target);
|
|
6862
|
-
}
|
|
6863
|
-
else {
|
|
6864
|
-
// Fall back to <style> element
|
|
6865
|
-
insertStyleElement(content, target);
|
|
6866
|
-
}
|
|
6867
|
-
}
|
|
6868
7066
|
function assertInstanceOfHTMLElement(elm, msg) {
|
|
6869
7067
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
6870
7068
|
}
|
|
@@ -6898,10 +7096,7 @@ setGetLastElementChild(getLastElementChild);
|
|
|
6898
7096
|
setGetProperty(getProperty);
|
|
6899
7097
|
setHTMLElement(HTMLElementExported);
|
|
6900
7098
|
setInsert(insert);
|
|
6901
|
-
setInsertGlobalStylesheet(insertGlobalStylesheet);
|
|
6902
|
-
setInsertStylesheet(insertStylesheet);
|
|
6903
7099
|
setIsConnected(isConnected);
|
|
6904
|
-
setIsHydrating$1(isHydrating);
|
|
6905
7100
|
setIsNativeShadowDefined(isNativeShadowDefined);
|
|
6906
7101
|
setIsSyntheticShadowDefined(isSyntheticShadowDefined);
|
|
6907
7102
|
setNextSibling(nextSibling);
|
|
@@ -6916,6 +7111,32 @@ setSetProperty(setProperty);
|
|
|
6916
7111
|
setSetText(setText);
|
|
6917
7112
|
setSsr(ssr);
|
|
6918
7113
|
setAddEventListener(addEventListener);
|
|
7114
|
+
setInsertStylesheet(insertStylesheet);
|
|
7115
|
+
|
|
7116
|
+
/*
|
|
7117
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7118
|
+
* All rights reserved.
|
|
7119
|
+
* SPDX-License-Identifier: MIT
|
|
7120
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7121
|
+
*/
|
|
7122
|
+
// @ts-ignore
|
|
7123
|
+
|
|
7124
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7125
|
+
window.addEventListener('test-dummy-flag', () => {
|
|
7126
|
+
let hasFlag = false;
|
|
7127
|
+
|
|
7128
|
+
if (runtimeFlags.DUMMY_TEST_FLAG) {
|
|
7129
|
+
hasFlag = true;
|
|
7130
|
+
}
|
|
7131
|
+
|
|
7132
|
+
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
7133
|
+
detail: {
|
|
7134
|
+
package: '@lwc/engine-dom',
|
|
7135
|
+
hasFlag
|
|
7136
|
+
}
|
|
7137
|
+
}));
|
|
7138
|
+
});
|
|
7139
|
+
}
|
|
6919
7140
|
|
|
6920
7141
|
/*
|
|
6921
7142
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6941,6 +7162,7 @@ function createVMWithProps(element, Ctor, props) {
|
|
|
6941
7162
|
mode: 'open',
|
|
6942
7163
|
owner: null,
|
|
6943
7164
|
tagName: element.tagName.toLowerCase(),
|
|
7165
|
+
hydrated: true,
|
|
6944
7166
|
});
|
|
6945
7167
|
for (const [key, value] of Object.entries(props)) {
|
|
6946
7168
|
element[key] = value;
|
|
@@ -7211,6 +7433,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7211
7433
|
});
|
|
7212
7434
|
freeze(LightningElement);
|
|
7213
7435
|
seal(LightningElement.prototype);
|
|
7214
|
-
/* version: 2.
|
|
7436
|
+
/* version: 2.14.1 */
|
|
7215
7437
|
|
|
7216
|
-
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7438
|
+
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|