lwc 2.13.2 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +339 -113
- package/dist/engine-dom/iife/es2017/engine-dom.js +339 -112
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +185 -107
- package/dist/engine-dom/iife/es5/engine-dom.js +7560 -5747
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +5942 -4572
- package/dist/engine-dom/umd/es2017/engine-dom.js +339 -112
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +185 -107
- package/dist/engine-dom/umd/es5/engine-dom.js +7560 -5747
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +5942 -4572
- package/dist/engine-server/commonjs/es2017/engine-server.js +176 -36
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +176 -37
- 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.
|
|
307
|
+
const LWC_VERSION = "2.14.0";
|
|
308
308
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
309
|
-
/** version: 2.
|
|
309
|
+
/** version: 2.14.0 */
|
|
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.
|
|
463
|
+
/** version: 2.14.0 */
|
|
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;
|
|
@@ -5355,7 +5401,8 @@
|
|
|
5355
5401
|
const {
|
|
5356
5402
|
mode,
|
|
5357
5403
|
owner,
|
|
5358
|
-
tagName
|
|
5404
|
+
tagName,
|
|
5405
|
+
hydrated
|
|
5359
5406
|
} = options;
|
|
5360
5407
|
const def = getComponentInternalDef(ctor);
|
|
5361
5408
|
const vm = {
|
|
@@ -5378,6 +5425,7 @@
|
|
|
5378
5425
|
cmpSlots: create(null),
|
|
5379
5426
|
oar: create(null),
|
|
5380
5427
|
cmpTemplate: null,
|
|
5428
|
+
hydrated: Boolean(hydrated),
|
|
5381
5429
|
renderMode: def.renderMode,
|
|
5382
5430
|
shadowMode: computeShadowMode(def, owner),
|
|
5383
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,
|
|
@@ -6352,6 +6400,7 @@
|
|
|
6352
6400
|
mode,
|
|
6353
6401
|
owner,
|
|
6354
6402
|
tagName: sel,
|
|
6403
|
+
hydrated: true,
|
|
6355
6404
|
});
|
|
6356
6405
|
vnode.elm = elm;
|
|
6357
6406
|
vnode.vm = vm;
|
|
@@ -6546,6 +6595,105 @@
|
|
|
6546
6595
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6547
6596
|
}
|
|
6548
6597
|
|
|
6598
|
+
/*
|
|
6599
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6600
|
+
* All rights reserved.
|
|
6601
|
+
* SPDX-License-Identifier: MIT
|
|
6602
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6603
|
+
*/
|
|
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
|
+
});
|
|
6679
|
+
}
|
|
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
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
|
|
6549
6697
|
/*
|
|
6550
6698
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6551
6699
|
* All rights reserved.
|
|
@@ -6568,7 +6716,7 @@
|
|
|
6568
6716
|
}
|
|
6569
6717
|
return ctor;
|
|
6570
6718
|
}
|
|
6571
|
-
/* version: 2.
|
|
6719
|
+
/* version: 2.14.0 */
|
|
6572
6720
|
|
|
6573
6721
|
/*
|
|
6574
6722
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6576,25 +6724,147 @@
|
|
|
6576
6724
|
* SPDX-License-Identifier: MIT
|
|
6577
6725
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6578
6726
|
*/
|
|
6579
|
-
|
|
6727
|
+
//
|
|
6728
|
+
// Feature detection
|
|
6729
|
+
//
|
|
6730
|
+
// This check for constructable style sheets is similar to Fast's:
|
|
6731
|
+
// https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
|
|
6732
|
+
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
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 &&
|
|
6739
|
+
getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
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
|
+
//
|
|
6580
6746
|
if (process.env.NODE_ENV === 'development') {
|
|
6581
6747
|
// @ts-ignore
|
|
6582
6748
|
window.__lwcResetGlobalStylesheets = () => {
|
|
6583
|
-
|
|
6584
|
-
delete globalStylesheets[key];
|
|
6585
|
-
}
|
|
6749
|
+
stylesheetCache.clear();
|
|
6586
6750
|
};
|
|
6587
6751
|
}
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
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
|
+
*/
|
|
6598
6868
|
let getCustomElement;
|
|
6599
6869
|
let defineCustomElement;
|
|
6600
6870
|
let HTMLElementConstructor;
|
|
@@ -6621,52 +6891,6 @@
|
|
|
6621
6891
|
return false;
|
|
6622
6892
|
}
|
|
6623
6893
|
}
|
|
6624
|
-
function insertConstructableStyleSheet(content, target) {
|
|
6625
|
-
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
6626
|
-
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
6627
|
-
let styleSheet = styleSheets[content];
|
|
6628
|
-
if (isUndefined$1(styleSheet)) {
|
|
6629
|
-
styleSheet = new CSSStyleSheet();
|
|
6630
|
-
styleSheet.replaceSync(content);
|
|
6631
|
-
styleSheets[content] = styleSheet;
|
|
6632
|
-
}
|
|
6633
|
-
const { adoptedStyleSheets } = target;
|
|
6634
|
-
if (!adoptedStyleSheets.includes(styleSheet)) {
|
|
6635
|
-
if (supportsMutableAdoptedStyleSheets) {
|
|
6636
|
-
// This is only supported in later versions of Chromium:
|
|
6637
|
-
// https://chromestatus.com/feature/5638996492288000
|
|
6638
|
-
adoptedStyleSheets.push(styleSheet);
|
|
6639
|
-
}
|
|
6640
|
-
else {
|
|
6641
|
-
target.adoptedStyleSheets = [...adoptedStyleSheets, styleSheet];
|
|
6642
|
-
}
|
|
6643
|
-
}
|
|
6644
|
-
}
|
|
6645
|
-
function insertStyleElement(content, target) {
|
|
6646
|
-
// Avoid inserting duplicate `<style>`s
|
|
6647
|
-
let sheets = shadowRootsToStyleSheets.get(target);
|
|
6648
|
-
if (isUndefined$1(sheets)) {
|
|
6649
|
-
sheets = create(null);
|
|
6650
|
-
shadowRootsToStyleSheets.set(target, sheets);
|
|
6651
|
-
}
|
|
6652
|
-
if (sheets[content]) {
|
|
6653
|
-
return;
|
|
6654
|
-
}
|
|
6655
|
-
sheets[content] = true;
|
|
6656
|
-
// This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
6657
|
-
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
6658
|
-
let elm = styleElements[content];
|
|
6659
|
-
if (isUndefined$1(elm)) {
|
|
6660
|
-
elm = document.createElement('style');
|
|
6661
|
-
elm.type = 'text/css';
|
|
6662
|
-
elm.textContent = content;
|
|
6663
|
-
styleElements[content] = elm;
|
|
6664
|
-
}
|
|
6665
|
-
else {
|
|
6666
|
-
elm = elm.cloneNode(true);
|
|
6667
|
-
}
|
|
6668
|
-
target.appendChild(elm);
|
|
6669
|
-
}
|
|
6670
6894
|
if (isCustomElementRegistryAvailable()) {
|
|
6671
6895
|
getCustomElement = customElements.get.bind(customElements);
|
|
6672
6896
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -6705,9 +6929,6 @@
|
|
|
6705
6929
|
hydrating = value;
|
|
6706
6930
|
}
|
|
6707
6931
|
const ssr = false;
|
|
6708
|
-
function isHydrating() {
|
|
6709
|
-
return hydrating;
|
|
6710
|
-
}
|
|
6711
6932
|
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6712
6933
|
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6713
6934
|
function createElement$1(tagName, namespace) {
|
|
@@ -6822,25 +7043,6 @@
|
|
|
6822
7043
|
function isConnected(node) {
|
|
6823
7044
|
return node.isConnected;
|
|
6824
7045
|
}
|
|
6825
|
-
function insertGlobalStylesheet(content) {
|
|
6826
|
-
if (!isUndefined$1(globalStylesheets[content])) {
|
|
6827
|
-
return;
|
|
6828
|
-
}
|
|
6829
|
-
globalStylesheets[content] = true;
|
|
6830
|
-
const elm = document.createElement('style');
|
|
6831
|
-
elm.type = 'text/css';
|
|
6832
|
-
elm.textContent = content;
|
|
6833
|
-
globalStylesheetsParentElement.appendChild(elm);
|
|
6834
|
-
}
|
|
6835
|
-
function insertStylesheet(content, target) {
|
|
6836
|
-
if (supportsConstructableStyleSheets) {
|
|
6837
|
-
insertConstructableStyleSheet(content, target);
|
|
6838
|
-
}
|
|
6839
|
-
else {
|
|
6840
|
-
// Fall back to <style> element
|
|
6841
|
-
insertStyleElement(content, target);
|
|
6842
|
-
}
|
|
6843
|
-
}
|
|
6844
7046
|
function assertInstanceOfHTMLElement(elm, msg) {
|
|
6845
7047
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
6846
7048
|
}
|
|
@@ -6874,10 +7076,7 @@
|
|
|
6874
7076
|
setGetProperty(getProperty);
|
|
6875
7077
|
setHTMLElement(HTMLElementExported);
|
|
6876
7078
|
setInsert(insert);
|
|
6877
|
-
setInsertGlobalStylesheet(insertGlobalStylesheet);
|
|
6878
|
-
setInsertStylesheet(insertStylesheet);
|
|
6879
7079
|
setIsConnected(isConnected);
|
|
6880
|
-
setIsHydrating$1(isHydrating);
|
|
6881
7080
|
setIsNativeShadowDefined(isNativeShadowDefined);
|
|
6882
7081
|
setIsSyntheticShadowDefined(isSyntheticShadowDefined);
|
|
6883
7082
|
setNextSibling(nextSibling);
|
|
@@ -6892,6 +7091,32 @@
|
|
|
6892
7091
|
setSetText(setText);
|
|
6893
7092
|
setSsr(ssr);
|
|
6894
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
|
+
}
|
|
6895
7120
|
|
|
6896
7121
|
/*
|
|
6897
7122
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6917,6 +7142,7 @@
|
|
|
6917
7142
|
mode: 'open',
|
|
6918
7143
|
owner: null,
|
|
6919
7144
|
tagName: element.tagName.toLowerCase(),
|
|
7145
|
+
hydrated: true,
|
|
6920
7146
|
});
|
|
6921
7147
|
for (const [key, value] of Object.entries(props)) {
|
|
6922
7148
|
element[key] = value;
|
|
@@ -7187,7 +7413,7 @@
|
|
|
7187
7413
|
});
|
|
7188
7414
|
freeze(LightningElement);
|
|
7189
7415
|
seal(LightningElement.prototype);
|
|
7190
|
-
/* version: 2.
|
|
7416
|
+
/* version: 2.14.0 */
|
|
7191
7417
|
|
|
7192
7418
|
exports.LightningElement = LightningElement;
|
|
7193
7419
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7195,6 +7421,7 @@
|
|
|
7195
7421
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
7196
7422
|
exports.createContextProvider = createContextProvider;
|
|
7197
7423
|
exports.createElement = createElement;
|
|
7424
|
+
exports.freezeTemplate = freezeTemplate;
|
|
7198
7425
|
exports.getComponentConstructor = getComponentConstructor;
|
|
7199
7426
|
exports.getComponentDef = getComponentDef;
|
|
7200
7427
|
exports.hydrateComponent = hydrateComponent;
|