lwc 2.35.2 → 2.37.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 +260 -654
- package/dist/engine-dom/iife/es2017/engine-dom.js +260 -654
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +286 -608
- package/dist/engine-dom/iife/es5/engine-dom.js +406 -852
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +450 -778
- package/dist/engine-dom/umd/es2017/engine-dom.js +260 -654
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +286 -608
- package/dist/engine-dom/umd/es5/engine-dom.js +406 -852
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +450 -778
- package/dist/engine-server/commonjs/es2017/engine-server.js +153 -92
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +153 -93
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -89,13 +89,18 @@
|
|
|
89
89
|
setPrototypeOf = Object.setPrototypeOf;
|
|
90
90
|
var isArray$1 = Array.isArray;
|
|
91
91
|
var _Array$prototype = Array.prototype,
|
|
92
|
+
ArrayCopyWithin = _Array$prototype.copyWithin,
|
|
93
|
+
ArrayFill = _Array$prototype.fill,
|
|
92
94
|
ArrayFilter = _Array$prototype.filter,
|
|
93
95
|
ArrayIndexOf = _Array$prototype.indexOf,
|
|
94
96
|
ArrayJoin = _Array$prototype.join,
|
|
95
97
|
ArrayMap = _Array$prototype.map,
|
|
96
98
|
ArrayPop = _Array$prototype.pop,
|
|
97
99
|
ArrayPush$1 = _Array$prototype.push,
|
|
100
|
+
ArrayReverse = _Array$prototype.reverse,
|
|
101
|
+
ArrayShift = _Array$prototype.shift,
|
|
98
102
|
ArraySlice = _Array$prototype.slice,
|
|
103
|
+
ArraySort = _Array$prototype.sort,
|
|
99
104
|
ArraySplice = _Array$prototype.splice,
|
|
100
105
|
ArrayUnshift = _Array$prototype.unshift,
|
|
101
106
|
forEach = _Array$prototype.forEach;
|
|
@@ -313,7 +318,7 @@
|
|
|
313
318
|
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
314
319
|
return propertyName;
|
|
315
320
|
}
|
|
316
|
-
/** version: 2.
|
|
321
|
+
/** version: 2.37.0 */
|
|
317
322
|
|
|
318
323
|
/**
|
|
319
324
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -333,10 +338,8 @@
|
|
|
333
338
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
334
339
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
335
340
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
336
|
-
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
337
341
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
338
|
-
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
339
|
-
ENABLE_PROGRAMMATIC_STYLESHEETS: null
|
|
342
|
+
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
340
343
|
};
|
|
341
344
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
342
345
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
@@ -385,7 +388,7 @@
|
|
|
385
388
|
*/
|
|
386
389
|
function setFeatureFlagForTest(name, value) {
|
|
387
390
|
}
|
|
388
|
-
/** version: 2.
|
|
391
|
+
/** version: 2.37.0 */
|
|
389
392
|
|
|
390
393
|
/**
|
|
391
394
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -449,7 +452,7 @@
|
|
|
449
452
|
}
|
|
450
453
|
}
|
|
451
454
|
}
|
|
452
|
-
/** version: 2.
|
|
455
|
+
/** version: 2.37.0 */
|
|
453
456
|
|
|
454
457
|
/*
|
|
455
458
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -469,7 +472,6 @@
|
|
|
469
472
|
* SPDX-License-Identifier: MIT
|
|
470
473
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
471
474
|
*/
|
|
472
|
-
/** Callbacks to invoke when reporting is enabled **/
|
|
473
475
|
var onReportingEnabledCallbacks = [];
|
|
474
476
|
/** The currently assigned reporting dispatcher. */
|
|
475
477
|
var currentDispatcher$1 = noop;
|
|
@@ -526,11 +528,11 @@
|
|
|
526
528
|
/**
|
|
527
529
|
* Report to the current dispatcher, if there is one.
|
|
528
530
|
* @param reportingEventId
|
|
529
|
-
* @param
|
|
531
|
+
* @param payload - data to report
|
|
530
532
|
*/
|
|
531
|
-
function report(reportingEventId,
|
|
533
|
+
function report(reportingEventId, payload) {
|
|
532
534
|
if (enabled$1) {
|
|
533
|
-
currentDispatcher$1(reportingEventId,
|
|
535
|
+
currentDispatcher$1(reportingEventId, payload);
|
|
534
536
|
}
|
|
535
537
|
}
|
|
536
538
|
|
|
@@ -794,31 +796,39 @@
|
|
|
794
796
|
// Make a shallow copy of an object but omit the given key
|
|
795
797
|
function cloneAndOmitKey(object, keyToOmit) {
|
|
796
798
|
var result = {};
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
799
|
+
var _iterator2 = _createForOfIteratorHelper(keys(object)),
|
|
800
|
+
_step2;
|
|
801
|
+
try {
|
|
802
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
803
|
+
var key = _step2.value;
|
|
804
|
+
if (key !== keyToOmit) {
|
|
805
|
+
result[key] = object[key];
|
|
806
|
+
}
|
|
801
807
|
}
|
|
808
|
+
} catch (err) {
|
|
809
|
+
_iterator2.e(err);
|
|
810
|
+
} finally {
|
|
811
|
+
_iterator2.f();
|
|
802
812
|
}
|
|
803
813
|
return result;
|
|
804
814
|
}
|
|
805
815
|
function flattenStylesheets(stylesheets) {
|
|
806
816
|
var list = [];
|
|
807
|
-
var
|
|
808
|
-
|
|
817
|
+
var _iterator3 = _createForOfIteratorHelper(stylesheets),
|
|
818
|
+
_step3;
|
|
809
819
|
try {
|
|
810
|
-
for (
|
|
811
|
-
var stylesheet =
|
|
812
|
-
if (!
|
|
820
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
821
|
+
var stylesheet = _step3.value;
|
|
822
|
+
if (!isArray$1(stylesheet)) {
|
|
813
823
|
list.push(stylesheet);
|
|
814
824
|
} else {
|
|
815
825
|
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
816
826
|
}
|
|
817
827
|
}
|
|
818
828
|
} catch (err) {
|
|
819
|
-
|
|
829
|
+
_iterator3.e(err);
|
|
820
830
|
} finally {
|
|
821
|
-
|
|
831
|
+
_iterator3.f();
|
|
822
832
|
}
|
|
823
833
|
return list;
|
|
824
834
|
}
|
|
@@ -1720,17 +1730,17 @@
|
|
|
1720
1730
|
var refs = refsCache.get(refVNodes);
|
|
1721
1731
|
if (isUndefined$1(refs)) {
|
|
1722
1732
|
refs = create(null);
|
|
1723
|
-
var
|
|
1724
|
-
|
|
1733
|
+
var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
|
|
1734
|
+
_step4;
|
|
1725
1735
|
try {
|
|
1726
|
-
for (
|
|
1727
|
-
var key =
|
|
1736
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1737
|
+
var key = _step4.value;
|
|
1728
1738
|
refs[key] = refVNodes[key].elm;
|
|
1729
1739
|
}
|
|
1730
1740
|
} catch (err) {
|
|
1731
|
-
|
|
1741
|
+
_iterator4.e(err);
|
|
1732
1742
|
} finally {
|
|
1733
|
-
|
|
1743
|
+
_iterator4.f();
|
|
1734
1744
|
}
|
|
1735
1745
|
freeze(refs);
|
|
1736
1746
|
refsCache.set(refVNodes, refs);
|
|
@@ -1794,7 +1804,7 @@
|
|
|
1794
1804
|
var queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
1795
1805
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
1796
1806
|
var _loop = function _loop() {
|
|
1797
|
-
var queryMethod = _queryMethods[
|
|
1807
|
+
var queryMethod = _queryMethods[_i7];
|
|
1798
1808
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
1799
1809
|
value: function value(arg) {
|
|
1800
1810
|
var vm = getAssociatedVM(this);
|
|
@@ -1807,7 +1817,7 @@
|
|
|
1807
1817
|
writable: true
|
|
1808
1818
|
};
|
|
1809
1819
|
};
|
|
1810
|
-
for (var
|
|
1820
|
+
for (var _i7 = 0, _queryMethods = queryMethods; _i7 < _queryMethods.length; _i7++) {
|
|
1811
1821
|
_loop();
|
|
1812
1822
|
}
|
|
1813
1823
|
defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
|
|
@@ -2093,16 +2103,16 @@
|
|
|
2093
2103
|
}
|
|
2094
2104
|
function connectWireAdapters(vm) {
|
|
2095
2105
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
2096
|
-
for (var
|
|
2097
|
-
wiredConnecting[
|
|
2106
|
+
for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
|
|
2107
|
+
wiredConnecting[_i8]();
|
|
2098
2108
|
}
|
|
2099
2109
|
}
|
|
2100
2110
|
function disconnectWireAdapters(vm) {
|
|
2101
2111
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
2102
2112
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2103
2113
|
// job
|
|
2104
|
-
for (var
|
|
2105
|
-
wiredDisconnecting[
|
|
2114
|
+
for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
|
|
2115
|
+
wiredDisconnecting[_i9]();
|
|
2106
2116
|
}
|
|
2107
2117
|
}, noop);
|
|
2108
2118
|
}
|
|
@@ -2304,8 +2314,8 @@
|
|
|
2304
2314
|
}
|
|
2305
2315
|
}
|
|
2306
2316
|
if (!isUndefined$1(fields)) {
|
|
2307
|
-
for (var
|
|
2308
|
-
var _fieldName2 = fields[
|
|
2317
|
+
for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
|
|
2318
|
+
var _fieldName2 = fields[_i10];
|
|
2309
2319
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
2310
2320
|
// [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
|
|
2311
2321
|
// tracked property. This is only here for backward compatibility purposes.
|
|
@@ -2486,8 +2496,8 @@
|
|
|
2486
2496
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
2487
2497
|
var descriptors = create(null);
|
|
2488
2498
|
// expose getters and setters for each public props on the new Element Bridge
|
|
2489
|
-
for (var
|
|
2490
|
-
var _propName = props[
|
|
2499
|
+
for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
|
|
2500
|
+
var _propName = props[_i11];
|
|
2491
2501
|
attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
|
|
2492
2502
|
descriptors[_propName] = {
|
|
2493
2503
|
get: createGetter(_propName),
|
|
@@ -2497,8 +2507,8 @@
|
|
|
2497
2507
|
};
|
|
2498
2508
|
}
|
|
2499
2509
|
// expose public methods as props on the new Element Bridge
|
|
2500
|
-
for (var
|
|
2501
|
-
var methodName = methods[
|
|
2510
|
+
for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
|
|
2511
|
+
var methodName = methods[_i12];
|
|
2502
2512
|
descriptors[methodName] = {
|
|
2503
2513
|
value: createMethodCaller(methodName),
|
|
2504
2514
|
writable: true,
|
|
@@ -2866,8 +2876,8 @@
|
|
|
2866
2876
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
2867
2877
|
var content = [];
|
|
2868
2878
|
var root;
|
|
2869
|
-
for (var
|
|
2870
|
-
var stylesheet = stylesheets[
|
|
2879
|
+
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
2880
|
+
var stylesheet = stylesheets[_i13];
|
|
2871
2881
|
if (isArray$1(stylesheet)) {
|
|
2872
2882
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
2873
2883
|
} else {
|
|
@@ -2967,8 +2977,8 @@
|
|
|
2967
2977
|
shadowMode = vm.shadowMode,
|
|
2968
2978
|
insertStylesheet = vm.renderer.insertStylesheet;
|
|
2969
2979
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
2970
|
-
for (var
|
|
2971
|
-
insertStylesheet(stylesheets[
|
|
2980
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
2981
|
+
insertStylesheet(stylesheets[_i14]);
|
|
2972
2982
|
}
|
|
2973
2983
|
} else if (vm.hydrated) {
|
|
2974
2984
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -2981,8 +2991,8 @@
|
|
|
2981
2991
|
var root = getNearestNativeShadowComponent(vm);
|
|
2982
2992
|
// null root means a global style
|
|
2983
2993
|
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
2984
|
-
for (var
|
|
2985
|
-
insertStylesheet(stylesheets[
|
|
2994
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
2995
|
+
insertStylesheet(stylesheets[_i15], target);
|
|
2986
2996
|
}
|
|
2987
2997
|
}
|
|
2988
2998
|
return null;
|
|
@@ -3284,8 +3294,8 @@
|
|
|
3284
3294
|
return;
|
|
3285
3295
|
}
|
|
3286
3296
|
var setCSSStyleProperty = renderer.setCSSStyleProperty;
|
|
3287
|
-
for (var
|
|
3288
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
3297
|
+
for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
|
|
3298
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
|
|
3289
3299
|
prop = _styleDecls$_i[0],
|
|
3290
3300
|
value = _styleDecls$_i[1],
|
|
3291
3301
|
important = _styleDecls$_i[2];
|
|
@@ -3708,8 +3718,8 @@
|
|
|
3708
3718
|
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
3709
3719
|
var nodeStack = [];
|
|
3710
3720
|
var fragmentFound = false;
|
|
3711
|
-
for (var
|
|
3712
|
-
var child = children[
|
|
3721
|
+
for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
|
|
3722
|
+
var child = children[_i17];
|
|
3713
3723
|
ArrayPush$1.call(nodeStack, child);
|
|
3714
3724
|
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
3715
3725
|
}
|
|
@@ -3721,8 +3731,8 @@
|
|
|
3721
3731
|
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
3722
3732
|
var fChildren = currentNode.children;
|
|
3723
3733
|
// Ignore the start and end text node delimiters
|
|
3724
|
-
for (var
|
|
3725
|
-
ArrayPush$1.call(nodeStack, fChildren[
|
|
3734
|
+
for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
|
|
3735
|
+
ArrayPush$1.call(nodeStack, fChildren[_i18]);
|
|
3726
3736
|
}
|
|
3727
3737
|
} else {
|
|
3728
3738
|
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
@@ -3758,8 +3768,8 @@
|
|
|
3758
3768
|
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
3759
3769
|
var cmpSlotsMapping = create(null);
|
|
3760
3770
|
// Collect all slots into cmpSlotsMapping
|
|
3761
|
-
for (var
|
|
3762
|
-
var vnode = children[
|
|
3771
|
+
for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
|
|
3772
|
+
var vnode = children[_i19];
|
|
3763
3773
|
if (isNull(vnode)) {
|
|
3764
3774
|
continue;
|
|
3765
3775
|
}
|
|
@@ -3769,7 +3779,12 @@
|
|
|
3769
3779
|
} else if (isVScopedSlotFragment(vnode)) {
|
|
3770
3780
|
slotName = vnode.slotName;
|
|
3771
3781
|
}
|
|
3772
|
-
|
|
3782
|
+
// Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
|
|
3783
|
+
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
|
3784
|
+
// the following line also throws same error for symbols
|
|
3785
|
+
// Similar for Object.create(null)
|
|
3786
|
+
var normalizedSlotName = '' + slotName;
|
|
3787
|
+
var vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
|
|
3773
3788
|
ArrayPush$1.call(vnodes, vnode);
|
|
3774
3789
|
}
|
|
3775
3790
|
vm.cmpSlots = {
|
|
@@ -3784,8 +3799,8 @@
|
|
|
3784
3799
|
markComponentAsDirty(vm);
|
|
3785
3800
|
return;
|
|
3786
3801
|
}
|
|
3787
|
-
for (var
|
|
3788
|
-
var key = oldKeys[
|
|
3802
|
+
for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
|
|
3803
|
+
var key = oldKeys[_i20];
|
|
3789
3804
|
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
3790
3805
|
markComponentAsDirty(vm);
|
|
3791
3806
|
return;
|
|
@@ -3908,11 +3923,11 @@
|
|
|
3908
3923
|
if (oldStartIdx > oldEndIdx) {
|
|
3909
3924
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
3910
3925
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
3911
|
-
var
|
|
3926
|
+
var _i21 = newEndIdx;
|
|
3912
3927
|
var n;
|
|
3913
3928
|
do {
|
|
3914
|
-
n = newCh[++
|
|
3915
|
-
} while (!isVNode(n) &&
|
|
3929
|
+
n = newCh[++_i21];
|
|
3930
|
+
} while (!isVNode(n) && _i21 < newChEnd);
|
|
3916
3931
|
before = isVNode(n) ? n.elm : null;
|
|
3917
3932
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
3918
3933
|
} else {
|
|
@@ -3937,9 +3952,9 @@
|
|
|
3937
3952
|
// if the old list is not empty, the new list MUST have the same
|
|
3938
3953
|
// amount of nodes, that's why we call this static children
|
|
3939
3954
|
var anchor = null;
|
|
3940
|
-
for (var
|
|
3941
|
-
var n1 = c1[
|
|
3942
|
-
var n2 = c2[
|
|
3955
|
+
for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
|
|
3956
|
+
var n1 = c1[_i22];
|
|
3957
|
+
var n2 = c2[_i22];
|
|
3943
3958
|
if (n2 !== n1) {
|
|
3944
3959
|
if (isVNode(n1)) {
|
|
3945
3960
|
if (isVNode(n2)) {
|
|
@@ -4036,8 +4051,8 @@
|
|
|
4036
4051
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
4037
4052
|
var newChildren = [];
|
|
4038
4053
|
var slotAssignments = slotset.slotAssignments[slotName];
|
|
4039
|
-
for (var
|
|
4040
|
-
var vnode = slotAssignments[
|
|
4054
|
+
for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
|
|
4055
|
+
var vnode = slotAssignments[_i23];
|
|
4041
4056
|
if (!isNull(vnode)) {
|
|
4042
4057
|
var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
|
|
4043
4058
|
// The only sniff test for a scoped <slot> element is the presence of `slotData`
|
|
@@ -4425,23 +4440,23 @@
|
|
|
4425
4440
|
var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
|
|
4426
4441
|
var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
4427
4442
|
var htmlFragment = '';
|
|
4428
|
-
for (var
|
|
4429
|
-
switch (keys[
|
|
4443
|
+
for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
|
|
4444
|
+
switch (keys[_i24]) {
|
|
4430
4445
|
case 0:
|
|
4431
4446
|
// styleToken in existing class attr
|
|
4432
|
-
htmlFragment += strings[
|
|
4447
|
+
htmlFragment += strings[_i24] + classToken;
|
|
4433
4448
|
break;
|
|
4434
4449
|
case 1:
|
|
4435
4450
|
// styleToken for added class attr
|
|
4436
|
-
htmlFragment += strings[
|
|
4451
|
+
htmlFragment += strings[_i24] + classAttrToken;
|
|
4437
4452
|
break;
|
|
4438
4453
|
case 2:
|
|
4439
4454
|
// styleToken as attr
|
|
4440
|
-
htmlFragment += strings[
|
|
4455
|
+
htmlFragment += strings[_i24] + attrToken;
|
|
4441
4456
|
break;
|
|
4442
4457
|
case 3:
|
|
4443
4458
|
// ${1}${2}
|
|
4444
|
-
htmlFragment += strings[
|
|
4459
|
+
htmlFragment += strings[_i24] + classAttrToken + attrToken;
|
|
4445
4460
|
break;
|
|
4446
4461
|
}
|
|
4447
4462
|
}
|
|
@@ -4529,8 +4544,8 @@
|
|
|
4529
4544
|
}
|
|
4530
4545
|
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
4531
4546
|
if (hasStyles(stylesheets)) {
|
|
4532
|
-
for (var
|
|
4533
|
-
if (isTrue(stylesheets[
|
|
4547
|
+
for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
|
|
4548
|
+
if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
|
|
4534
4549
|
return true;
|
|
4535
4550
|
}
|
|
4536
4551
|
}
|
|
@@ -4696,8 +4711,8 @@
|
|
|
4696
4711
|
* subject to change or being removed.
|
|
4697
4712
|
*/
|
|
4698
4713
|
function register(service) {
|
|
4699
|
-
for (var
|
|
4700
|
-
var hookName = hooks[
|
|
4714
|
+
for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
|
|
4715
|
+
var hookName = hooks[_i26];
|
|
4701
4716
|
if (hookName in service) {
|
|
4702
4717
|
var l = Services[hookName];
|
|
4703
4718
|
if (isUndefined$1(l)) {
|
|
@@ -4711,8 +4726,8 @@
|
|
|
4711
4726
|
var component = vm.component,
|
|
4712
4727
|
def = vm.def,
|
|
4713
4728
|
context = vm.context;
|
|
4714
|
-
for (var
|
|
4715
|
-
cbs[
|
|
4729
|
+
for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
|
|
4730
|
+
cbs[_i27].call(undefined, component, {}, def, context);
|
|
4716
4731
|
}
|
|
4717
4732
|
}
|
|
4718
4733
|
|
|
@@ -4849,8 +4864,8 @@
|
|
|
4849
4864
|
var valid = true;
|
|
4850
4865
|
var validate = function validate(arrayOrStylesheet) {
|
|
4851
4866
|
if (isArray$1(arrayOrStylesheet)) {
|
|
4852
|
-
for (var
|
|
4853
|
-
validate(arrayOrStylesheet[
|
|
4867
|
+
for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
|
|
4868
|
+
validate(arrayOrStylesheet[_i28]);
|
|
4854
4869
|
}
|
|
4855
4870
|
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
4856
4871
|
// function assumed to be a stylesheet factory
|
|
@@ -4866,13 +4881,11 @@
|
|
|
4866
4881
|
}
|
|
4867
4882
|
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
4868
4883
|
function computeStylesheets(vm, ctor) {
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
return flattenStylesheets(stylesheets);
|
|
4875
|
-
}
|
|
4884
|
+
var stylesheets = ctor.stylesheets;
|
|
4885
|
+
if (!isUndefined$1(stylesheets)) {
|
|
4886
|
+
var valid = validateComponentStylesheets(vm, stylesheets);
|
|
4887
|
+
if (valid) {
|
|
4888
|
+
return flattenStylesheets(stylesheets);
|
|
4876
4889
|
}
|
|
4877
4890
|
}
|
|
4878
4891
|
return null;
|
|
@@ -4985,17 +4998,17 @@
|
|
|
4985
4998
|
return a.idx - b.idx;
|
|
4986
4999
|
});
|
|
4987
5000
|
rehydrateQueue = []; // reset to a new queue
|
|
4988
|
-
for (var
|
|
4989
|
-
var vm = vms[
|
|
5001
|
+
for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
|
|
5002
|
+
var vm = vms[_i29];
|
|
4990
5003
|
try {
|
|
4991
5004
|
rehydrate(vm);
|
|
4992
5005
|
} catch (error) {
|
|
4993
|
-
if (
|
|
5006
|
+
if (_i29 + 1 < len) {
|
|
4994
5007
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
4995
5008
|
if (rehydrateQueue.length === 0) {
|
|
4996
5009
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
4997
5010
|
}
|
|
4998
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
5011
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
|
|
4999
5012
|
}
|
|
5000
5013
|
// we need to end the measure before throwing.
|
|
5001
5014
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
@@ -5061,8 +5074,8 @@
|
|
|
5061
5074
|
var vCustomElementCollection = vm.velements;
|
|
5062
5075
|
// Reporting disconnection for every child in inverse order since they are
|
|
5063
5076
|
// inserted in reserved order.
|
|
5064
|
-
for (var
|
|
5065
|
-
var elm = vCustomElementCollection[
|
|
5077
|
+
for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
|
|
5078
|
+
var elm = vCustomElementCollection[_i30].elm;
|
|
5066
5079
|
// There are two cases where the element could be undefined:
|
|
5067
5080
|
// * when there is an error during the construction phase, and an error
|
|
5068
5081
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
@@ -5093,8 +5106,8 @@
|
|
|
5093
5106
|
* defined on its shadow.
|
|
5094
5107
|
*/
|
|
5095
5108
|
function recursivelyDisconnectChildren(vnodes) {
|
|
5096
|
-
for (var
|
|
5097
|
-
var vnode = vnodes[
|
|
5109
|
+
for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
|
|
5110
|
+
var vnode = vnodes[_i31];
|
|
5098
5111
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
5099
5112
|
switch (vnode.type) {
|
|
5100
5113
|
case 2 /* VNodeType.Element */:
|
|
@@ -5118,8 +5131,8 @@
|
|
|
5118
5131
|
var children = vm.children,
|
|
5119
5132
|
renderRoot = vm.renderRoot,
|
|
5120
5133
|
remove = vm.renderer.remove;
|
|
5121
|
-
for (var
|
|
5122
|
-
var child = children[
|
|
5134
|
+
for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
|
|
5135
|
+
var child = children[_i32];
|
|
5123
5136
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5124
5137
|
remove(child.elm, renderRoot);
|
|
5125
5138
|
}
|
|
@@ -5183,7 +5196,7 @@
|
|
|
5183
5196
|
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
5184
5197
|
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
5185
5198
|
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
5186
|
-
// See: https://
|
|
5199
|
+
// See: https://sfdc.co/synthetic-aria
|
|
5187
5200
|
//
|
|
5188
5201
|
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
5189
5202
|
var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
@@ -5191,7 +5204,7 @@
|
|
|
5191
5204
|
function isSyntheticShadowRootInstance(rootNode) {
|
|
5192
5205
|
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
5193
5206
|
}
|
|
5194
|
-
function reportViolation(source, target, attrName) {
|
|
5207
|
+
function reportViolation$1(source, target, attrName) {
|
|
5195
5208
|
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
5196
5209
|
// shadow for a violation to be detected.
|
|
5197
5210
|
var vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
@@ -5202,7 +5215,10 @@
|
|
|
5202
5215
|
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
5203
5216
|
return;
|
|
5204
5217
|
}
|
|
5205
|
-
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */,
|
|
5218
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
|
|
5219
|
+
tagName: vm.tagName,
|
|
5220
|
+
attributeName: attrName
|
|
5221
|
+
});
|
|
5206
5222
|
}
|
|
5207
5223
|
function parseIdRefAttributeValue(attrValue) {
|
|
5208
5224
|
// split on whitespace and skip empty strings after splitting
|
|
@@ -5219,57 +5235,57 @@
|
|
|
5219
5235
|
// if our id is null or empty, nobody can reference us
|
|
5220
5236
|
return;
|
|
5221
5237
|
}
|
|
5222
|
-
var
|
|
5223
|
-
|
|
5238
|
+
var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
|
|
5239
|
+
_step5;
|
|
5224
5240
|
try {
|
|
5225
|
-
for (
|
|
5226
|
-
var idRefAttrName =
|
|
5241
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
5242
|
+
var idRefAttrName = _step5.value;
|
|
5227
5243
|
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
5228
5244
|
// that reference multiple IDs, separated by whitespace.
|
|
5229
5245
|
var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
|
|
5230
5246
|
var sourceElements = querySelectorAll.call(document, query);
|
|
5231
|
-
for (var
|
|
5232
|
-
var sourceElement = sourceElements[
|
|
5247
|
+
for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
|
|
5248
|
+
var sourceElement = sourceElements[_i33];
|
|
5233
5249
|
var sourceRoot = sourceElement.getRootNode();
|
|
5234
5250
|
if (sourceRoot !== root) {
|
|
5235
|
-
reportViolation(sourceElement, elm, idRefAttrName);
|
|
5251
|
+
reportViolation$1(sourceElement, elm, idRefAttrName);
|
|
5236
5252
|
break;
|
|
5237
5253
|
}
|
|
5238
5254
|
}
|
|
5239
5255
|
}
|
|
5240
5256
|
} catch (err) {
|
|
5241
|
-
|
|
5257
|
+
_iterator5.e(err);
|
|
5242
5258
|
} finally {
|
|
5243
|
-
|
|
5259
|
+
_iterator5.f();
|
|
5244
5260
|
}
|
|
5245
5261
|
} else {
|
|
5246
5262
|
// elm is the source, find the target
|
|
5247
5263
|
var ids = parseIdRefAttributeValue(attrValue);
|
|
5248
|
-
var
|
|
5249
|
-
|
|
5264
|
+
var _iterator6 = _createForOfIteratorHelper(ids),
|
|
5265
|
+
_step6;
|
|
5250
5266
|
try {
|
|
5251
|
-
for (
|
|
5252
|
-
var id =
|
|
5267
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
5268
|
+
var id = _step6.value;
|
|
5253
5269
|
var target = getElementById.call(document, id);
|
|
5254
5270
|
if (!isNull(target)) {
|
|
5255
5271
|
var targetRoot = target.getRootNode();
|
|
5256
5272
|
if (targetRoot !== root) {
|
|
5257
5273
|
// target element's shadow root is not the same as ours
|
|
5258
|
-
reportViolation(elm, target, attrName);
|
|
5274
|
+
reportViolation$1(elm, target, attrName);
|
|
5259
5275
|
}
|
|
5260
5276
|
}
|
|
5261
5277
|
}
|
|
5262
5278
|
} catch (err) {
|
|
5263
|
-
|
|
5279
|
+
_iterator6.e(err);
|
|
5264
5280
|
} finally {
|
|
5265
|
-
|
|
5281
|
+
_iterator6.f();
|
|
5266
5282
|
}
|
|
5267
5283
|
}
|
|
5268
5284
|
}
|
|
5269
5285
|
var enabled = false;
|
|
5270
5286
|
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
5271
5287
|
// reporting is not enabled. It should also only run once
|
|
5272
|
-
function enableDetection() {
|
|
5288
|
+
function enableDetection$1() {
|
|
5273
5289
|
if (enabled) {
|
|
5274
5290
|
return; // don't double-apply the patches
|
|
5275
5291
|
}
|
|
@@ -5324,7 +5340,102 @@
|
|
|
5324
5340
|
// Always run detection in dev mode, so we can at least print to the console
|
|
5325
5341
|
{
|
|
5326
5342
|
// In prod mode, only enable detection if reporting is enabled
|
|
5327
|
-
onReportingEnabled(enableDetection);
|
|
5343
|
+
onReportingEnabled(enableDetection$1);
|
|
5344
|
+
}
|
|
5345
|
+
}
|
|
5346
|
+
|
|
5347
|
+
/*
|
|
5348
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5349
|
+
* All rights reserved.
|
|
5350
|
+
* SPDX-License-Identifier: MIT
|
|
5351
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5352
|
+
*/
|
|
5353
|
+
//
|
|
5354
|
+
// The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
|
|
5355
|
+
// legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
|
|
5356
|
+
//
|
|
5357
|
+
// See the README for @lwc/aria-reflection
|
|
5358
|
+
var NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
|
|
5359
|
+
function isLightningElement(elm) {
|
|
5360
|
+
// The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
|
|
5361
|
+
// In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
|
|
5362
|
+
return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
|
|
5363
|
+
}
|
|
5364
|
+
function findVM(elm) {
|
|
5365
|
+
// If it's a shadow DOM component, then it has a host
|
|
5366
|
+
var _elm$getRootNode = elm.getRootNode(),
|
|
5367
|
+
host = _elm$getRootNode.host;
|
|
5368
|
+
var vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
|
|
5369
|
+
if (!isUndefined$1(vm)) {
|
|
5370
|
+
return vm;
|
|
5371
|
+
}
|
|
5372
|
+
// Else it might be a light DOM component. Walk up the tree trying to find the owner
|
|
5373
|
+
var parentElement = elm;
|
|
5374
|
+
while (!isNull(parentElement = parentElement.parentElement)) {
|
|
5375
|
+
if (isLightningElement(parentElement)) {
|
|
5376
|
+
var _vm = getAssociatedVMIfPresent(parentElement);
|
|
5377
|
+
if (!isUndefined$1(_vm)) {
|
|
5378
|
+
return _vm;
|
|
5379
|
+
}
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
// If we return undefined, it's because the element was rendered wholly outside a LightningElement
|
|
5383
|
+
}
|
|
5384
|
+
|
|
5385
|
+
function checkAndReportViolation(elm, prop) {
|
|
5386
|
+
if (!isLightningElement(elm)) {
|
|
5387
|
+
var vm = findVM(elm);
|
|
5388
|
+
report(2 /* ReportingEventId.NonStandardAriaReflection */, {
|
|
5389
|
+
tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
|
|
5390
|
+
propertyName: prop
|
|
5391
|
+
});
|
|
5392
|
+
}
|
|
5393
|
+
}
|
|
5394
|
+
function enableDetection() {
|
|
5395
|
+
var _Element = Element,
|
|
5396
|
+
prototype = _Element.prototype;
|
|
5397
|
+
var _iterator7 = _createForOfIteratorHelper(NON_STANDARD_ARIA_PROPS),
|
|
5398
|
+
_step7;
|
|
5399
|
+
try {
|
|
5400
|
+
var _loop3 = function _loop3() {
|
|
5401
|
+
var prop = _step7.value;
|
|
5402
|
+
var descriptor = getOwnPropertyDescriptor$1(prototype, prop);
|
|
5403
|
+
// The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
|
|
5404
|
+
// This happens automatically because of the ordering of imports.
|
|
5405
|
+
if ("production" !== 'production') ;
|
|
5406
|
+
// @ts-ignore
|
|
5407
|
+
var _get4 = descriptor.get,
|
|
5408
|
+
_set4 = descriptor.set;
|
|
5409
|
+
defineProperty(prototype, prop, {
|
|
5410
|
+
get: function get() {
|
|
5411
|
+
checkAndReportViolation(this, prop);
|
|
5412
|
+
return _get4.call(this);
|
|
5413
|
+
},
|
|
5414
|
+
set: function set(val) {
|
|
5415
|
+
checkAndReportViolation(this, prop);
|
|
5416
|
+
return _set4.call(this, val);
|
|
5417
|
+
},
|
|
5418
|
+
configurable: true,
|
|
5419
|
+
enumerable: true
|
|
5420
|
+
});
|
|
5421
|
+
};
|
|
5422
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
5423
|
+
_loop3();
|
|
5424
|
+
}
|
|
5425
|
+
} catch (err) {
|
|
5426
|
+
_iterator7.e(err);
|
|
5427
|
+
} finally {
|
|
5428
|
+
_iterator7.f();
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
// No point in running this code if we're not in a browser, or if the global polyfill is not loaded
|
|
5432
|
+
{
|
|
5433
|
+
if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
5434
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
5435
|
+
{
|
|
5436
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
5437
|
+
onReportingEnabled(enableDetection);
|
|
5438
|
+
}
|
|
5328
5439
|
}
|
|
5329
5440
|
}
|
|
5330
5441
|
|
|
@@ -5533,8 +5644,8 @@
|
|
|
5533
5644
|
var nextNode = node;
|
|
5534
5645
|
var anchor = null;
|
|
5535
5646
|
var renderer = owner.renderer;
|
|
5536
|
-
for (var
|
|
5537
|
-
var childVnode = children[
|
|
5647
|
+
for (var _i34 = 0; _i34 < children.length; _i34++) {
|
|
5648
|
+
var childVnode = children[_i34];
|
|
5538
5649
|
if (!isNull(childVnode)) {
|
|
5539
5650
|
if (nextNode) {
|
|
5540
5651
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
@@ -5595,8 +5706,8 @@
|
|
|
5595
5706
|
var nodesAreCompatible = true;
|
|
5596
5707
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5597
5708
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5598
|
-
for (var
|
|
5599
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[
|
|
5709
|
+
for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
|
|
5710
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
|
|
5600
5711
|
attrName = _Object$entries$_i[0],
|
|
5601
5712
|
attrValue = _Object$entries$_i[1];
|
|
5602
5713
|
vnode.owner;
|
|
@@ -5683,8 +5794,8 @@
|
|
|
5683
5794
|
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5684
5795
|
var expectedStyle = [];
|
|
5685
5796
|
// styleMap is used when style is set to static value.
|
|
5686
|
-
for (var
|
|
5687
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[
|
|
5797
|
+
for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
|
|
5798
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
|
|
5688
5799
|
prop = _styleDecls$_i2[0],
|
|
5689
5800
|
value = _styleDecls$_i2[1],
|
|
5690
5801
|
important = _styleDecls$_i2[2];
|
|
@@ -5749,6 +5860,121 @@
|
|
|
5749
5860
|
hooksAreSet = true;
|
|
5750
5861
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5751
5862
|
}
|
|
5863
|
+
|
|
5864
|
+
/*
|
|
5865
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5866
|
+
* All rights reserved.
|
|
5867
|
+
* SPDX-License-Identifier: MIT
|
|
5868
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5869
|
+
*/
|
|
5870
|
+
// See @lwc/engine-core/src/framework/template.ts
|
|
5871
|
+
var TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
5872
|
+
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
5873
|
+
var STYLESHEET_PROPS = [
|
|
5874
|
+
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
5875
|
+
'$scoped$'];
|
|
5876
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
5877
|
+
var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
5878
|
+
var mutationTrackingDisabled = false;
|
|
5879
|
+
function getOriginalArrayMethod(prop) {
|
|
5880
|
+
switch (prop) {
|
|
5881
|
+
case 'pop':
|
|
5882
|
+
return ArrayPop;
|
|
5883
|
+
case 'push':
|
|
5884
|
+
return ArrayPush$1;
|
|
5885
|
+
case 'shift':
|
|
5886
|
+
return ArrayShift;
|
|
5887
|
+
case 'unshift':
|
|
5888
|
+
return ArrayUnshift;
|
|
5889
|
+
case 'reverse':
|
|
5890
|
+
return ArrayReverse;
|
|
5891
|
+
case 'sort':
|
|
5892
|
+
return ArraySort;
|
|
5893
|
+
case 'fill':
|
|
5894
|
+
return ArrayFill;
|
|
5895
|
+
case 'splice':
|
|
5896
|
+
return ArraySplice;
|
|
5897
|
+
case 'copyWithin':
|
|
5898
|
+
return ArrayCopyWithin;
|
|
5899
|
+
}
|
|
5900
|
+
}
|
|
5901
|
+
function reportViolation(type, eventId, prop) {
|
|
5902
|
+
report(eventId, {
|
|
5903
|
+
propertyName: prop
|
|
5904
|
+
});
|
|
5905
|
+
}
|
|
5906
|
+
function reportTemplateViolation(prop) {
|
|
5907
|
+
reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
|
|
5908
|
+
}
|
|
5909
|
+
function reportStylesheetViolation(prop) {
|
|
5910
|
+
reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
|
|
5911
|
+
}
|
|
5912
|
+
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
5913
|
+
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
5914
|
+
function warnOnArrayMutation(stylesheets) {
|
|
5915
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
5916
|
+
// we can at least warn when they use the most common mutation methods.
|
|
5917
|
+
var _iterator8 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
|
|
5918
|
+
_step8;
|
|
5919
|
+
try {
|
|
5920
|
+
var _loop4 = function _loop4() {
|
|
5921
|
+
var prop = _step8.value;
|
|
5922
|
+
var originalArrayMethod = getOriginalArrayMethod(prop);
|
|
5923
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
5924
|
+
reportTemplateViolation('stylesheets');
|
|
5925
|
+
// @ts-ignore
|
|
5926
|
+
return originalArrayMethod.apply(this, arguments);
|
|
5927
|
+
};
|
|
5928
|
+
};
|
|
5929
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
5930
|
+
_loop4();
|
|
5931
|
+
}
|
|
5932
|
+
} catch (err) {
|
|
5933
|
+
_iterator8.e(err);
|
|
5934
|
+
} finally {
|
|
5935
|
+
_iterator8.f();
|
|
5936
|
+
}
|
|
5937
|
+
}
|
|
5938
|
+
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
5939
|
+
// `stylesheet.$scoped$ = true`
|
|
5940
|
+
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
5941
|
+
var _iterator9 = _createForOfIteratorHelper(STYLESHEET_PROPS),
|
|
5942
|
+
_step9;
|
|
5943
|
+
try {
|
|
5944
|
+
var _loop5 = function _loop5() {
|
|
5945
|
+
var prop = _step9.value;
|
|
5946
|
+
var value = stylesheet[prop];
|
|
5947
|
+
defineProperty(stylesheet, prop, {
|
|
5948
|
+
enumerable: true,
|
|
5949
|
+
configurable: true,
|
|
5950
|
+
get: function get() {
|
|
5951
|
+
return value;
|
|
5952
|
+
},
|
|
5953
|
+
set: function set(newValue) {
|
|
5954
|
+
reportStylesheetViolation(prop);
|
|
5955
|
+
value = newValue;
|
|
5956
|
+
}
|
|
5957
|
+
});
|
|
5958
|
+
};
|
|
5959
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
5960
|
+
_loop5();
|
|
5961
|
+
}
|
|
5962
|
+
} catch (err) {
|
|
5963
|
+
_iterator9.e(err);
|
|
5964
|
+
} finally {
|
|
5965
|
+
_iterator9.f();
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
5969
|
+
function trackStylesheetsMutation(stylesheets) {
|
|
5970
|
+
traverseStylesheets(stylesheets, function (subStylesheets) {
|
|
5971
|
+
if (isArray$1(subStylesheets)) {
|
|
5972
|
+
warnOnArrayMutation(subStylesheets);
|
|
5973
|
+
} else {
|
|
5974
|
+
warnOnStylesheetFunctionMutation(subStylesheets);
|
|
5975
|
+
}
|
|
5976
|
+
});
|
|
5977
|
+
}
|
|
5752
5978
|
// Deeply freeze the entire array (of arrays) of stylesheet factory functions
|
|
5753
5979
|
function deepFreeze(stylesheets) {
|
|
5754
5980
|
traverseStylesheets(stylesheets, function (subStylesheets) {
|
|
@@ -5758,8 +5984,8 @@
|
|
|
5758
5984
|
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
5759
5985
|
function traverseStylesheets(stylesheets, callback) {
|
|
5760
5986
|
callback(stylesheets);
|
|
5761
|
-
for (var
|
|
5762
|
-
var stylesheet = stylesheets[
|
|
5987
|
+
for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
|
|
5988
|
+
var stylesheet = stylesheets[_i37];
|
|
5763
5989
|
if (isArray$1(stylesheet)) {
|
|
5764
5990
|
traverseStylesheets(stylesheet, callback);
|
|
5765
5991
|
} else {
|
|
@@ -5767,7 +5993,80 @@
|
|
|
5767
5993
|
}
|
|
5768
5994
|
}
|
|
5769
5995
|
}
|
|
5996
|
+
function trackMutations(tmpl) {
|
|
5997
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
5998
|
+
trackStylesheetsMutation(tmpl.stylesheets);
|
|
5999
|
+
}
|
|
6000
|
+
var _iterator10 = _createForOfIteratorHelper(TEMPLATE_PROPS),
|
|
6001
|
+
_step10;
|
|
6002
|
+
try {
|
|
6003
|
+
var _loop6 = function _loop6() {
|
|
6004
|
+
var prop = _step10.value;
|
|
6005
|
+
var value = tmpl[prop];
|
|
6006
|
+
defineProperty(tmpl, prop, {
|
|
6007
|
+
enumerable: true,
|
|
6008
|
+
configurable: true,
|
|
6009
|
+
get: function get() {
|
|
6010
|
+
return value;
|
|
6011
|
+
},
|
|
6012
|
+
set: function set(newValue) {
|
|
6013
|
+
if (!mutationTrackingDisabled) {
|
|
6014
|
+
reportTemplateViolation(prop);
|
|
6015
|
+
}
|
|
6016
|
+
value = newValue;
|
|
6017
|
+
}
|
|
6018
|
+
});
|
|
6019
|
+
};
|
|
6020
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
6021
|
+
_loop6();
|
|
6022
|
+
}
|
|
6023
|
+
} catch (err) {
|
|
6024
|
+
_iterator10.e(err);
|
|
6025
|
+
} finally {
|
|
6026
|
+
_iterator10.f();
|
|
6027
|
+
}
|
|
6028
|
+
var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6029
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6030
|
+
enumerable: true,
|
|
6031
|
+
configurable: true,
|
|
6032
|
+
get: originalDescriptor.get,
|
|
6033
|
+
set: function set(value) {
|
|
6034
|
+
reportTemplateViolation('stylesheetTokens');
|
|
6035
|
+
// Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
|
|
6036
|
+
mutationTrackingDisabled = true;
|
|
6037
|
+
originalDescriptor.set.call(this, value);
|
|
6038
|
+
mutationTrackingDisabled = false;
|
|
6039
|
+
}
|
|
6040
|
+
});
|
|
6041
|
+
}
|
|
6042
|
+
function addLegacyStylesheetTokensShim(tmpl) {
|
|
6043
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6044
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
6045
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6046
|
+
enumerable: true,
|
|
6047
|
+
configurable: true,
|
|
6048
|
+
get: function get() {
|
|
6049
|
+
var stylesheetToken = this.stylesheetToken;
|
|
6050
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
6051
|
+
return stylesheetToken;
|
|
6052
|
+
}
|
|
6053
|
+
// Shim for the old `stylesheetTokens` property
|
|
6054
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
6055
|
+
return {
|
|
6056
|
+
hostAttribute: "".concat(stylesheetToken, "-host"),
|
|
6057
|
+
shadowAttribute: stylesheetToken
|
|
6058
|
+
};
|
|
6059
|
+
},
|
|
6060
|
+
set: function set(value) {
|
|
6061
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
6062
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
6063
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
6064
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
6065
|
+
}
|
|
6066
|
+
});
|
|
6067
|
+
}
|
|
5770
6068
|
function freezeTemplate(tmpl) {
|
|
6069
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
5771
6070
|
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
5772
6071
|
// Deep freeze the template
|
|
5773
6072
|
freeze(tmpl);
|
|
@@ -5775,31 +6074,16 @@
|
|
|
5775
6074
|
deepFreeze(tmpl.stylesheets);
|
|
5776
6075
|
}
|
|
5777
6076
|
} else {
|
|
5778
|
-
//
|
|
5779
|
-
//
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
}
|
|
5789
|
-
// Shim for the old `stylesheetTokens` property
|
|
5790
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
5791
|
-
return {
|
|
5792
|
-
hostAttribute: "".concat(stylesheetToken, "-host"),
|
|
5793
|
-
shadowAttribute: stylesheetToken
|
|
5794
|
-
};
|
|
5795
|
-
},
|
|
5796
|
-
set: function set(value) {
|
|
5797
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
5798
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
5799
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
5800
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
5801
|
-
}
|
|
5802
|
-
});
|
|
6077
|
+
// template is not frozen - shim, report, and warn
|
|
6078
|
+
// this shim should be applied in both dev and prod
|
|
6079
|
+
addLegacyStylesheetTokensShim(tmpl);
|
|
6080
|
+
// When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
|
|
6081
|
+
{
|
|
6082
|
+
// In prod mode, we only track mutations if reporting is enabled
|
|
6083
|
+
onReportingEnabled(function () {
|
|
6084
|
+
trackMutations(tmpl);
|
|
6085
|
+
});
|
|
6086
|
+
}
|
|
5803
6087
|
}
|
|
5804
6088
|
}
|
|
5805
6089
|
|
|
@@ -6081,610 +6365,6 @@
|
|
|
6081
6365
|
}
|
|
6082
6366
|
};
|
|
6083
6367
|
|
|
6084
|
-
/*
|
|
6085
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
6086
|
-
* All rights reserved.
|
|
6087
|
-
* SPDX-License-Identifier: MIT
|
|
6088
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6089
|
-
*/
|
|
6090
|
-
/**
|
|
6091
|
-
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
6092
|
-
* do not conflict with third-party custom elements having the same tag name.
|
|
6093
|
-
*/
|
|
6094
|
-
function createScopedRegistry() {
|
|
6095
|
-
if (!hasCustomElements) {
|
|
6096
|
-
// This code should never be reached, because we don't use the pivot registry if
|
|
6097
|
-
// custom elements are unavailable.
|
|
6098
|
-
throw new Error('Custom elements are not supported in this environment.');
|
|
6099
|
-
}
|
|
6100
|
-
var _window = window,
|
|
6101
|
-
NativeHTMLElement = _window.HTMLElement;
|
|
6102
|
-
var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
|
|
6103
|
-
nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
|
|
6104
|
-
nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
|
|
6105
|
-
nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
|
|
6106
|
-
nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
|
|
6107
|
-
var definitionForElement = new WeakMap();
|
|
6108
|
-
var pendingRegistryForElement = new WeakMap();
|
|
6109
|
-
var definitionForConstructor = new WeakMap();
|
|
6110
|
-
var registeredUserCtors = new WeakSet();
|
|
6111
|
-
var registeredPivotCtors = new WeakSet();
|
|
6112
|
-
var pivotCtorByTag = new Map();
|
|
6113
|
-
var globalDefinitionsByTag = new Map();
|
|
6114
|
-
var globalDefinitionsByClass = new Map();
|
|
6115
|
-
var awaitingUpgrade = new Map();
|
|
6116
|
-
var pendingWhenDefinedCallbacks = new Map();
|
|
6117
|
-
var EMPTY_SET = new Set();
|
|
6118
|
-
function createDefinitionRecord(constructor) {
|
|
6119
|
-
var _a;
|
|
6120
|
-
var _constructor$prototyp = constructor.prototype,
|
|
6121
|
-
connectedCallback = _constructor$prototyp.connectedCallback,
|
|
6122
|
-
disconnectedCallback = _constructor$prototyp.disconnectedCallback,
|
|
6123
|
-
formAssociatedCallback = _constructor$prototyp.formAssociatedCallback,
|
|
6124
|
-
formDisabledCallback = _constructor$prototyp.formDisabledCallback,
|
|
6125
|
-
formResetCallback = _constructor$prototyp.formResetCallback,
|
|
6126
|
-
formStateRestoreCallback = _constructor$prototyp.formStateRestoreCallback,
|
|
6127
|
-
adoptedCallback = _constructor$prototyp.adoptedCallback,
|
|
6128
|
-
attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
|
|
6129
|
-
var formAssociated = Boolean(constructor.formAssociated);
|
|
6130
|
-
var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
|
|
6131
|
-
return {
|
|
6132
|
-
UserCtor: constructor,
|
|
6133
|
-
PivotCtor: undefined,
|
|
6134
|
-
connectedCallback: connectedCallback,
|
|
6135
|
-
disconnectedCallback: disconnectedCallback,
|
|
6136
|
-
formAssociatedCallback: formAssociatedCallback,
|
|
6137
|
-
formDisabledCallback: formDisabledCallback,
|
|
6138
|
-
formResetCallback: formResetCallback,
|
|
6139
|
-
formStateRestoreCallback: formStateRestoreCallback,
|
|
6140
|
-
adoptedCallback: adoptedCallback,
|
|
6141
|
-
attributeChangedCallback: attributeChangedCallback,
|
|
6142
|
-
observedAttributes: observedAttributes,
|
|
6143
|
-
formAssociated: formAssociated
|
|
6144
|
-
};
|
|
6145
|
-
}
|
|
6146
|
-
// Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
|
|
6147
|
-
// element. Note that the `registeredDefinition` represents the constructor that was used to register during
|
|
6148
|
-
// `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
|
|
6149
|
-
// constructor is invoked with another constructor.
|
|
6150
|
-
function createPivotingClass(tagName, registeredDefinition) {
|
|
6151
|
-
var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
|
|
6152
|
-
_inherits(PivotCtor, _NativeHTMLElement);
|
|
6153
|
-
var _super7 = _createSuper(PivotCtor);
|
|
6154
|
-
function PivotCtor(UserCtor) {
|
|
6155
|
-
var _this4;
|
|
6156
|
-
_classCallCheck(this, PivotCtor);
|
|
6157
|
-
// This constructor can only be invoked by:
|
|
6158
|
-
// a) the browser instantiating an element from parsing or via document.createElement.
|
|
6159
|
-
// b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
|
|
6160
|
-
// b) new UserClass.
|
|
6161
|
-
// When LWC instantiates it, it will pass the upgrading definition as an argument
|
|
6162
|
-
// If the caller signals via UserCtor that this is in fact a controlled
|
|
6163
|
-
// definition, we use that one, otherwise fallback to the global
|
|
6164
|
-
// internal registry.
|
|
6165
|
-
_this4 = _super7.call(this);
|
|
6166
|
-
var userCtorIsDefined = !isUndefined$1(UserCtor);
|
|
6167
|
-
if (userCtorIsDefined) {
|
|
6168
|
-
if (!isConstructor(UserCtor)) {
|
|
6169
|
-
throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
|
|
6170
|
-
}
|
|
6171
|
-
if (!registeredUserCtors.has(UserCtor)) {
|
|
6172
|
-
throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
|
|
6173
|
-
}
|
|
6174
|
-
}
|
|
6175
|
-
var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
|
|
6176
|
-
if (!isUndefined$1(definition)) {
|
|
6177
|
-
internalUpgrade(_assertThisInitialized(_this4), registeredDefinition, definition);
|
|
6178
|
-
} else {
|
|
6179
|
-
// This is the case in which there is no global definition, and
|
|
6180
|
-
// it is not handled by LWC (otherwise it will have a valid UserCtor)
|
|
6181
|
-
// so we need to add it to the pending queue just in case it eventually
|
|
6182
|
-
// gets defined in the global registry.
|
|
6183
|
-
pendingRegistryForElement.set(_assertThisInitialized(_this4), registeredDefinition);
|
|
6184
|
-
}
|
|
6185
|
-
return _this4;
|
|
6186
|
-
}
|
|
6187
|
-
_createClass(PivotCtor, [{
|
|
6188
|
-
key: "connectedCallback",
|
|
6189
|
-
value: function connectedCallback() {
|
|
6190
|
-
var _a;
|
|
6191
|
-
var definition = definitionForElement.get(this);
|
|
6192
|
-
if (!isUndefined$1(definition)) {
|
|
6193
|
-
// Delegate out to user callback
|
|
6194
|
-
(_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6195
|
-
} else {
|
|
6196
|
-
// Register for upgrade when defined (only when connected, so we don't leak)
|
|
6197
|
-
var awaiting = awaitingUpgrade.get(tagName);
|
|
6198
|
-
if (isUndefined$1(awaiting)) {
|
|
6199
|
-
awaitingUpgrade.set(tagName, awaiting = new Set());
|
|
6200
|
-
}
|
|
6201
|
-
awaiting.add(this);
|
|
6202
|
-
}
|
|
6203
|
-
}
|
|
6204
|
-
}, {
|
|
6205
|
-
key: "disconnectedCallback",
|
|
6206
|
-
value: function disconnectedCallback() {
|
|
6207
|
-
var _a;
|
|
6208
|
-
var definition = definitionForElement.get(this);
|
|
6209
|
-
if (!isUndefined$1(definition)) {
|
|
6210
|
-
// Delegate out to user callback
|
|
6211
|
-
(_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6212
|
-
} else {
|
|
6213
|
-
// Un-register for upgrade when defined (so we don't leak)
|
|
6214
|
-
var awaiting = awaitingUpgrade.get(tagName);
|
|
6215
|
-
// At this point, awaiting should never be undefined, because connectedCallback
|
|
6216
|
-
// must have been called before disconnectedCallback. But just to be safe, we check
|
|
6217
|
-
if (!isUndefined$1(awaiting)) {
|
|
6218
|
-
awaiting.delete(this);
|
|
6219
|
-
}
|
|
6220
|
-
}
|
|
6221
|
-
}
|
|
6222
|
-
}, {
|
|
6223
|
-
key: "formAssociatedCallback",
|
|
6224
|
-
value: function formAssociatedCallback(form) {
|
|
6225
|
-
var _a;
|
|
6226
|
-
var definition = definitionForElement.get(this);
|
|
6227
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
|
|
6228
|
-
}
|
|
6229
|
-
}, {
|
|
6230
|
-
key: "formDisabledCallback",
|
|
6231
|
-
value: function formDisabledCallback(disabled) {
|
|
6232
|
-
var _a;
|
|
6233
|
-
var definition = definitionForElement.get(this);
|
|
6234
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
|
|
6235
|
-
}
|
|
6236
|
-
}, {
|
|
6237
|
-
key: "formResetCallback",
|
|
6238
|
-
value: function formResetCallback() {
|
|
6239
|
-
var _a;
|
|
6240
|
-
var definition = definitionForElement.get(this);
|
|
6241
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6242
|
-
}
|
|
6243
|
-
}, {
|
|
6244
|
-
key: "formStateRestoreCallback",
|
|
6245
|
-
value: function formStateRestoreCallback(state, mode) {
|
|
6246
|
-
var _a;
|
|
6247
|
-
var definition = definitionForElement.get(this);
|
|
6248
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
|
|
6249
|
-
}
|
|
6250
|
-
}, {
|
|
6251
|
-
key: "adoptedCallback",
|
|
6252
|
-
value: function adoptedCallback() {
|
|
6253
|
-
var _a;
|
|
6254
|
-
var definition = definitionForElement.get(this);
|
|
6255
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
6256
|
-
}
|
|
6257
|
-
}, {
|
|
6258
|
-
key: "attributeChangedCallback",
|
|
6259
|
-
value: function attributeChangedCallback(name, oldValue, newValue) {
|
|
6260
|
-
var _a;
|
|
6261
|
-
var definition = definitionForElement.get(this);
|
|
6262
|
-
// if both definitions are the same, then the observedAttributes is the same,
|
|
6263
|
-
// but if they are different, only if the runtime definition has the attribute
|
|
6264
|
-
// marked as observed, then it should invoke attributeChangedCallback.
|
|
6265
|
-
if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
|
|
6266
|
-
(_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
|
|
6267
|
-
}
|
|
6268
|
-
}
|
|
6269
|
-
}]);
|
|
6270
|
-
return PivotCtor;
|
|
6271
|
-
}(NativeHTMLElement);
|
|
6272
|
-
PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
|
|
6273
|
-
// TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
|
|
6274
|
-
PivotCtor.formAssociated = registeredDefinition.formAssociated;
|
|
6275
|
-
registeredPivotCtors.add(PivotCtor);
|
|
6276
|
-
return PivotCtor;
|
|
6277
|
-
}
|
|
6278
|
-
function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
|
|
6279
|
-
var observedAttributes = pivotDefinition.observedAttributes,
|
|
6280
|
-
attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
6281
|
-
if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
|
|
6282
|
-
// This instance does not need to observe any attributes, no need to patch
|
|
6283
|
-
return EMPTY_SET;
|
|
6284
|
-
}
|
|
6285
|
-
// Natively, the attributes observed by the registered definition are going to be taken
|
|
6286
|
-
// care of by the browser, only the difference between the two sets has to be taken
|
|
6287
|
-
// care by the patched version.
|
|
6288
|
-
return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
|
|
6289
|
-
return !registeredDefinition.observedAttributes.has(x);
|
|
6290
|
-
}));
|
|
6291
|
-
}
|
|
6292
|
-
function throwAsyncError(error) {
|
|
6293
|
-
// Per native custom element behavior, errors thrown in attributeChangedCallback
|
|
6294
|
-
// become unhandled async errors. We use setTimeout() instead of Promise.resolve()
|
|
6295
|
-
// to make it an unhandled error rather than an unhandled rejection.
|
|
6296
|
-
setTimeout(function () {
|
|
6297
|
-
throw error;
|
|
6298
|
-
});
|
|
6299
|
-
}
|
|
6300
|
-
// Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
|
|
6301
|
-
// Why is this necessary? Well basically, you can't change the `observedAttributes` after
|
|
6302
|
-
// a custom element is defined. So with pivots, if two classes share the same tag name,
|
|
6303
|
-
// and the second class observes attributes that aren't observed by the first one,
|
|
6304
|
-
// then those attributes can never be observed by the native `observedAttributes` system.
|
|
6305
|
-
// So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
|
|
6306
|
-
// we only do this when absolutely necessary, though; i.e. because we've determined
|
|
6307
|
-
// that we aren't observing the attributes we need to.
|
|
6308
|
-
function patchAttributes(instance, registeredDefinition, pivotDefinition) {
|
|
6309
|
-
var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
6310
|
-
if (newObservedAttributes.size === 0) {
|
|
6311
|
-
return;
|
|
6312
|
-
}
|
|
6313
|
-
var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
6314
|
-
// Patch the instance.
|
|
6315
|
-
// Note we use the native `getAttribute` rather than the super's `getAttribute` because
|
|
6316
|
-
// we don't actually want it to be observable that we're calling `getAttribute` from
|
|
6317
|
-
// `setAttribute` and `removeAttribute`.
|
|
6318
|
-
// TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
|
|
6319
|
-
defineProperties(instance, {
|
|
6320
|
-
setAttribute: {
|
|
6321
|
-
value: function setAttribute(name, value) {
|
|
6322
|
-
if (newObservedAttributes.has(name)) {
|
|
6323
|
-
var old = nativeGetAttribute.call(this, name);
|
|
6324
|
-
nativeSetAttribute.call(this, name, value);
|
|
6325
|
-
try {
|
|
6326
|
-
attributeChangedCallback.call(this, name, old, value + '');
|
|
6327
|
-
} catch (error) {
|
|
6328
|
-
throwAsyncError(error);
|
|
6329
|
-
}
|
|
6330
|
-
} else {
|
|
6331
|
-
nativeSetAttribute.call(this, name, value);
|
|
6332
|
-
}
|
|
6333
|
-
},
|
|
6334
|
-
writable: true,
|
|
6335
|
-
enumerable: true,
|
|
6336
|
-
configurable: true
|
|
6337
|
-
},
|
|
6338
|
-
removeAttribute: {
|
|
6339
|
-
value: function removeAttribute(name) {
|
|
6340
|
-
if (newObservedAttributes.has(name)) {
|
|
6341
|
-
var old = nativeGetAttribute.call(this, name);
|
|
6342
|
-
nativeRemoveAttribute.call(this, name);
|
|
6343
|
-
try {
|
|
6344
|
-
attributeChangedCallback.call(this, name, old, null);
|
|
6345
|
-
} catch (error) {
|
|
6346
|
-
throwAsyncError(error);
|
|
6347
|
-
}
|
|
6348
|
-
} else {
|
|
6349
|
-
nativeRemoveAttribute.call(this, name);
|
|
6350
|
-
}
|
|
6351
|
-
},
|
|
6352
|
-
writable: true,
|
|
6353
|
-
enumerable: true,
|
|
6354
|
-
configurable: true
|
|
6355
|
-
}
|
|
6356
|
-
});
|
|
6357
|
-
}
|
|
6358
|
-
function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
6359
|
-
// The below case patches observed attributes for the case where the HTML element is upgraded
|
|
6360
|
-
// from a pre-existing one in the DOM.
|
|
6361
|
-
var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
6362
|
-
if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
|
|
6363
|
-
return;
|
|
6364
|
-
}
|
|
6365
|
-
var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
6366
|
-
// Approximate observedAttributes from the user class, but only for the new observed attributes
|
|
6367
|
-
newObservedAttributes.forEach(function (name) {
|
|
6368
|
-
if (nativeHasAttribute.call(instance, name)) {
|
|
6369
|
-
var newValue = nativeGetAttribute.call(instance, name);
|
|
6370
|
-
attributeChangedCallback.call(instance, name, null, newValue);
|
|
6371
|
-
}
|
|
6372
|
-
});
|
|
6373
|
-
}
|
|
6374
|
-
// User extends this HTMLElement, which returns the CE being upgraded
|
|
6375
|
-
var upgradingInstance;
|
|
6376
|
-
// Helper to upgrade an instance with a CE definition using "constructor call trick"
|
|
6377
|
-
function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
6378
|
-
setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
|
|
6379
|
-
definitionForElement.set(instance, pivotDefinition);
|
|
6380
|
-
// attributes patches when needed
|
|
6381
|
-
if (pivotDefinition !== registeredDefinition) {
|
|
6382
|
-
patchAttributes(instance, registeredDefinition, pivotDefinition);
|
|
6383
|
-
}
|
|
6384
|
-
// Tricking the construction path to believe that a new instance is being created,
|
|
6385
|
-
// that way it will execute the super initialization mechanism but the HTMLElement
|
|
6386
|
-
// constructor will reuse the instance by returning the upgradingInstance.
|
|
6387
|
-
// This is by far the most important piece of the puzzle
|
|
6388
|
-
upgradingInstance = instance;
|
|
6389
|
-
// By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
|
|
6390
|
-
// The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
|
|
6391
|
-
// Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
|
|
6392
|
-
new pivotDefinition.UserCtor();
|
|
6393
|
-
patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
|
|
6394
|
-
}
|
|
6395
|
-
function isConstructor(constructor) {
|
|
6396
|
-
return isFunction$1(constructor) && isObject(constructor.prototype);
|
|
6397
|
-
}
|
|
6398
|
-
function getOrCreateDefinitionForConstructor(constructor) {
|
|
6399
|
-
if (!isConstructor(constructor)) {
|
|
6400
|
-
throw new TypeError('The referenced constructor is not a constructor.');
|
|
6401
|
-
}
|
|
6402
|
-
var definition = definitionForConstructor.get(constructor);
|
|
6403
|
-
if (!isUndefined$1(definition)) {
|
|
6404
|
-
return definition;
|
|
6405
|
-
}
|
|
6406
|
-
return createDefinitionRecord(constructor);
|
|
6407
|
-
}
|
|
6408
|
-
// Defer a `whenDefined()` callback until an externally-visible custom element is defined
|
|
6409
|
-
function createPendingWhenDefinedCallback(tagName) {
|
|
6410
|
-
return new Promise(function (resolve) {
|
|
6411
|
-
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
6412
|
-
if (isUndefined$1(resolvers)) {
|
|
6413
|
-
resolvers = [];
|
|
6414
|
-
pendingWhenDefinedCallbacks.set(tagName, resolvers);
|
|
6415
|
-
}
|
|
6416
|
-
resolvers.push(resolve);
|
|
6417
|
-
});
|
|
6418
|
-
}
|
|
6419
|
-
// Call any pending `whenDefined()` callbacks
|
|
6420
|
-
function flushPendingWhenDefinedCallbacks(tagName, ctor) {
|
|
6421
|
-
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
6422
|
-
if (!isUndefined$1(resolvers)) {
|
|
6423
|
-
var _iterator9 = _createForOfIteratorHelper(resolvers),
|
|
6424
|
-
_step9;
|
|
6425
|
-
try {
|
|
6426
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
6427
|
-
var resolver = _step9.value;
|
|
6428
|
-
resolver(ctor);
|
|
6429
|
-
}
|
|
6430
|
-
} catch (err) {
|
|
6431
|
-
_iterator9.e(err);
|
|
6432
|
-
} finally {
|
|
6433
|
-
_iterator9.f();
|
|
6434
|
-
}
|
|
6435
|
-
}
|
|
6436
|
-
pendingWhenDefinedCallbacks.delete(tagName);
|
|
6437
|
-
}
|
|
6438
|
-
var _window2 = window,
|
|
6439
|
-
nativeRegistry = _window2.customElements;
|
|
6440
|
-
var nativeDefine = nativeRegistry.define,
|
|
6441
|
-
nativeWhenDefined = nativeRegistry.whenDefined,
|
|
6442
|
-
nativeGet = nativeRegistry.get;
|
|
6443
|
-
// patch for the global registry define mechanism
|
|
6444
|
-
CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
|
|
6445
|
-
if (options && options.extends) {
|
|
6446
|
-
// TODO [#2983]: should we support `extends`?
|
|
6447
|
-
throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
|
|
6448
|
-
}
|
|
6449
|
-
if (globalDefinitionsByTag.has(tagName)) {
|
|
6450
|
-
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
|
|
6451
|
-
}
|
|
6452
|
-
if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
|
|
6453
|
-
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
|
|
6454
|
-
}
|
|
6455
|
-
var definition = getOrCreateDefinitionForConstructor(constructor);
|
|
6456
|
-
registeredUserCtors.add(constructor);
|
|
6457
|
-
var PivotCtor = pivotCtorByTag.get(tagName);
|
|
6458
|
-
if (isUndefined$1(PivotCtor)) {
|
|
6459
|
-
PivotCtor = createPivotingClass(tagName, definition);
|
|
6460
|
-
// Register a pivoting class which will handle global registry initializations
|
|
6461
|
-
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
6462
|
-
}
|
|
6463
|
-
// Only cache after nativeDefine has been called, because if it throws an error
|
|
6464
|
-
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
6465
|
-
definitionForConstructor.set(constructor, definition);
|
|
6466
|
-
pivotCtorByTag.set(tagName, PivotCtor);
|
|
6467
|
-
globalDefinitionsByTag.set(tagName, definition);
|
|
6468
|
-
globalDefinitionsByClass.set(constructor, definition);
|
|
6469
|
-
// For globally defined custom elements, the definition associated
|
|
6470
|
-
// to the UserCtor has a back-pointer to PivotCtor in case the user
|
|
6471
|
-
// new the UserCtor, so we know how to create the underlying element.
|
|
6472
|
-
definition.PivotCtor = PivotCtor;
|
|
6473
|
-
// Upgrade any elements created in this scope before customElements.define
|
|
6474
|
-
// was called, which should be exhibited by the following steps:
|
|
6475
|
-
// 1) LWC registers a tagName for an LWC component.
|
|
6476
|
-
// 2) Element with same tagName is created with document.createElement()
|
|
6477
|
-
// and inserted into DOM.
|
|
6478
|
-
// 3) customElements.define() is called with tagName and non-LWC constructor.
|
|
6479
|
-
// This requires immediate upgrade when the new global tagName is defined.
|
|
6480
|
-
var awaiting = awaitingUpgrade.get(tagName);
|
|
6481
|
-
if (!isUndefined$1(awaiting)) {
|
|
6482
|
-
awaitingUpgrade.delete(tagName);
|
|
6483
|
-
var _iterator10 = _createForOfIteratorHelper(awaiting),
|
|
6484
|
-
_step10;
|
|
6485
|
-
try {
|
|
6486
|
-
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
6487
|
-
var element = _step10.value;
|
|
6488
|
-
var registeredDefinition = pendingRegistryForElement.get(element);
|
|
6489
|
-
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
6490
|
-
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
6491
|
-
// pendingRegistryForElement when internalUpgrade hasn't run yet.
|
|
6492
|
-
// But just to be safe, we check.
|
|
6493
|
-
if (!isUndefined$1(registeredDefinition)) {
|
|
6494
|
-
pendingRegistryForElement.delete(element);
|
|
6495
|
-
internalUpgrade(element, registeredDefinition, definition);
|
|
6496
|
-
}
|
|
6497
|
-
}
|
|
6498
|
-
} catch (err) {
|
|
6499
|
-
_iterator10.e(err);
|
|
6500
|
-
} finally {
|
|
6501
|
-
_iterator10.f();
|
|
6502
|
-
}
|
|
6503
|
-
}
|
|
6504
|
-
// If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
|
|
6505
|
-
flushPendingWhenDefinedCallbacks(tagName, constructor);
|
|
6506
|
-
};
|
|
6507
|
-
CustomElementRegistry.prototype.get = function get(tagName) {
|
|
6508
|
-
var NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
6509
|
-
if (!isUndefined$1(NativeCtor)) {
|
|
6510
|
-
var definition = globalDefinitionsByTag.get(tagName);
|
|
6511
|
-
if (!isUndefined$1(definition)) {
|
|
6512
|
-
return definition.UserCtor; // defined by the patched custom elements registry
|
|
6513
|
-
}
|
|
6514
|
-
|
|
6515
|
-
if (registeredPivotCtors.has(NativeCtor)) {
|
|
6516
|
-
return undefined; // pivot constructors should not be observable, return undefined
|
|
6517
|
-
}
|
|
6518
|
-
|
|
6519
|
-
return NativeCtor; // constructor that existed before patching
|
|
6520
|
-
}
|
|
6521
|
-
};
|
|
6522
|
-
|
|
6523
|
-
CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
|
|
6524
|
-
return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
|
|
6525
|
-
var definition = globalDefinitionsByTag.get(tagName);
|
|
6526
|
-
if (!isUndefined$1(definition)) {
|
|
6527
|
-
return definition.UserCtor;
|
|
6528
|
-
}
|
|
6529
|
-
// In this case, the custom element must have been defined before the registry patches
|
|
6530
|
-
// were applied. So return the non-pivot constructor
|
|
6531
|
-
if (isUndefined$1(NativeCtor)) {
|
|
6532
|
-
// Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
|
|
6533
|
-
// We can patch the correct behavior using customElements.get()
|
|
6534
|
-
NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
6535
|
-
}
|
|
6536
|
-
if (registeredPivotCtors.has(NativeCtor)) {
|
|
6537
|
-
// Pivot constructors should not be observable. Wait to resolve the promise
|
|
6538
|
-
// if a constructor is ever defined in userland
|
|
6539
|
-
return createPendingWhenDefinedCallback(tagName);
|
|
6540
|
-
}
|
|
6541
|
-
return NativeCtor;
|
|
6542
|
-
});
|
|
6543
|
-
};
|
|
6544
|
-
// This constructor is invoked when we call `new pivotDefinition.UserCtor()`
|
|
6545
|
-
// @ts-ignore
|
|
6546
|
-
window.HTMLElement = function HTMLElement() {
|
|
6547
|
-
// Upgrading case: the pivoting class constructor was run by the browser's
|
|
6548
|
-
// native custom elements and we're in the process of running the
|
|
6549
|
-
// "constructor-call trick" on the natively constructed instance, so just
|
|
6550
|
-
// return that here.
|
|
6551
|
-
// This code path is also called when LWC `new`s a PivotCtor.
|
|
6552
|
-
var instance = upgradingInstance;
|
|
6553
|
-
if (!isUndefined$1(instance)) {
|
|
6554
|
-
upgradingInstance = undefined;
|
|
6555
|
-
return instance;
|
|
6556
|
-
}
|
|
6557
|
-
// Construction case: we need to construct the pivoting instance and return it.
|
|
6558
|
-
// This is possible when the user register it via global registry and instantiate
|
|
6559
|
-
// it via `new Ctor()`.
|
|
6560
|
-
var constructor = this.constructor;
|
|
6561
|
-
var definition = globalDefinitionsByClass.get(constructor);
|
|
6562
|
-
if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
|
|
6563
|
-
// This code path is hit if someone `new`s a class that extends `HTMLElement` without
|
|
6564
|
-
// doing `customElements.define()` first. This matches native browser behavior:
|
|
6565
|
-
// https://stackoverflow.com/a/61883392
|
|
6566
|
-
throw new TypeError('Illegal constructor');
|
|
6567
|
-
}
|
|
6568
|
-
// This constructor is ONLY invoked when it is the user instantiating
|
|
6569
|
-
// an element via new Ctor while Ctor is a registered global constructor.
|
|
6570
|
-
var PivotCtor = definition.PivotCtor,
|
|
6571
|
-
UserCtor = definition.UserCtor;
|
|
6572
|
-
return new PivotCtor(UserCtor);
|
|
6573
|
-
};
|
|
6574
|
-
HTMLElement.prototype = NativeHTMLElement.prototype;
|
|
6575
|
-
/**
|
|
6576
|
-
* Create a new PivotConstructor for the given tagName, which is capable of being constructed
|
|
6577
|
-
* with a UserConstructor defining the behavior. Passing in the UserConstructor here
|
|
6578
|
-
* is a hint that can be used when registering a custom element with the global custom elements
|
|
6579
|
-
* registry for the first time, which provides certain optimizations. It also marks the UserConstructor
|
|
6580
|
-
* as "safe" to be used when passed in to a PivotConstructor.
|
|
6581
|
-
*
|
|
6582
|
-
* @param tagName - element tag name
|
|
6583
|
-
* @param UserCtor - userland custom element constructor
|
|
6584
|
-
* @returns a new custom element constructor
|
|
6585
|
-
*/
|
|
6586
|
-
return function createPivotConstructor(tagName, UserCtor) {
|
|
6587
|
-
tagName = StringToLowerCase.call(tagName);
|
|
6588
|
-
var PivotCtor = pivotCtorByTag.get(tagName);
|
|
6589
|
-
if (isUndefined$1(PivotCtor)) {
|
|
6590
|
-
var definition = getOrCreateDefinitionForConstructor(UserCtor);
|
|
6591
|
-
PivotCtor = createPivotingClass(tagName, definition);
|
|
6592
|
-
// Register a pivoting class as a global custom element
|
|
6593
|
-
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
6594
|
-
definition.PivotCtor = PivotCtor;
|
|
6595
|
-
// Only cache after nativeDefine has been called, because if it throws an error
|
|
6596
|
-
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
6597
|
-
definitionForConstructor.set(UserCtor, definition);
|
|
6598
|
-
pivotCtorByTag.set(tagName, PivotCtor);
|
|
6599
|
-
}
|
|
6600
|
-
// Register a UserConstructor as "safe" to be used within a PivotConstructor
|
|
6601
|
-
registeredUserCtors.add(UserCtor);
|
|
6602
|
-
return PivotCtor;
|
|
6603
|
-
};
|
|
6604
|
-
}
|
|
6605
|
-
|
|
6606
|
-
/*
|
|
6607
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6608
|
-
* All rights reserved.
|
|
6609
|
-
* SPDX-License-Identifier: MIT
|
|
6610
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6611
|
-
*/
|
|
6612
|
-
var createScopedConstructor;
|
|
6613
|
-
var CachedHTMLElement;
|
|
6614
|
-
// We only call `createScopedRegistry()` if the browser supports custom elements and
|
|
6615
|
-
// ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
|
|
6616
|
-
// or we're in a legacy browser.
|
|
6617
|
-
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
6618
|
-
if (hasCustomElements) {
|
|
6619
|
-
// If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
|
|
6620
|
-
// It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
|
|
6621
|
-
//
|
|
6622
|
-
// Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
|
|
6623
|
-
//
|
|
6624
|
-
// 1. LWC loads
|
|
6625
|
-
// 2. `const Ctor = class extends HTMLElement {}`
|
|
6626
|
-
// 3. `lwc.createElement(...)` // here we lazily patch
|
|
6627
|
-
// 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
|
|
6628
|
-
//
|
|
6629
|
-
// To reduce the risk of this, it's safer to patch the registry eagerly.
|
|
6630
|
-
createScopedConstructor = createScopedRegistry();
|
|
6631
|
-
// It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
|
|
6632
|
-
// another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
|
|
6633
|
-
// because the HTMLElement prototypes are mixed up.
|
|
6634
|
-
//
|
|
6635
|
-
// The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
|
|
6636
|
-
// with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
|
|
6637
|
-
// the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
|
|
6638
|
-
// Caching avoids this problem.
|
|
6639
|
-
CachedHTMLElement = window.HTMLElement;
|
|
6640
|
-
}
|
|
6641
|
-
}
|
|
6642
|
-
// Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
|
|
6643
|
-
// In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
|
|
6644
|
-
// multiple times per tag name.
|
|
6645
|
-
var createUserConstructor = function createUserConstructor(HTMLElementToExtend, upgradeCallback, _connectedCallback, _disconnectedCallback) {
|
|
6646
|
-
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
6647
|
-
return /*#__PURE__*/function (_HTMLElementToExtend) {
|
|
6648
|
-
_inherits(UserConstructor, _HTMLElementToExtend);
|
|
6649
|
-
var _super8 = _createSuper(UserConstructor);
|
|
6650
|
-
function UserConstructor() {
|
|
6651
|
-
var _this5;
|
|
6652
|
-
_classCallCheck(this, UserConstructor);
|
|
6653
|
-
_this5 = _super8.call(this);
|
|
6654
|
-
upgradeCallback(_assertThisInitialized(_this5));
|
|
6655
|
-
return _this5;
|
|
6656
|
-
}
|
|
6657
|
-
// Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
|
|
6658
|
-
// here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
|
|
6659
|
-
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
|
|
6660
|
-
_createClass(UserConstructor, [{
|
|
6661
|
-
key: "connectedCallback",
|
|
6662
|
-
value: function connectedCallback() {
|
|
6663
|
-
if (!isUndefined$1(_connectedCallback)) {
|
|
6664
|
-
_connectedCallback(this);
|
|
6665
|
-
}
|
|
6666
|
-
}
|
|
6667
|
-
}, {
|
|
6668
|
-
key: "disconnectedCallback",
|
|
6669
|
-
value: function disconnectedCallback() {
|
|
6670
|
-
if (!isUndefined$1(_disconnectedCallback)) {
|
|
6671
|
-
_disconnectedCallback(this);
|
|
6672
|
-
}
|
|
6673
|
-
}
|
|
6674
|
-
}]);
|
|
6675
|
-
return UserConstructor;
|
|
6676
|
-
}(HTMLElementToExtend);
|
|
6677
|
-
};
|
|
6678
|
-
function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
|
|
6679
|
-
if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
|
|
6680
|
-
// This error should be impossible to hit
|
|
6681
|
-
throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
|
|
6682
|
-
}
|
|
6683
|
-
var UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
6684
|
-
var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
|
|
6685
|
-
return new ScopedConstructor(UserConstructor);
|
|
6686
|
-
}
|
|
6687
|
-
|
|
6688
6368
|
/*
|
|
6689
6369
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6690
6370
|
* All rights reserved.
|
|
@@ -6692,26 +6372,18 @@
|
|
|
6692
6372
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6693
6373
|
*/
|
|
6694
6374
|
/**
|
|
6695
|
-
* We have
|
|
6375
|
+
* We have two modes for creating custom elements:
|
|
6696
6376
|
*
|
|
6697
6377
|
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
6698
6378
|
* 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
|
|
6699
6379
|
* via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
|
|
6700
6380
|
* a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
|
|
6701
6381
|
* constructor"), which allows us to have completely customized functionality for different components.
|
|
6702
|
-
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
6703
|
-
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
6704
|
-
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
6705
|
-
* because it must patch the global `customElements` and `HTMLElement` objects.
|
|
6706
6382
|
*/
|
|
6707
6383
|
var createCustomElement;
|
|
6708
6384
|
if (hasCustomElements) {
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
} else {
|
|
6712
|
-
// use the global registry, with an upgradable constructor for the defined custom element
|
|
6713
|
-
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
6714
|
-
}
|
|
6385
|
+
// use the global registry, with an upgradable constructor for the defined custom element
|
|
6386
|
+
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
6715
6387
|
} else {
|
|
6716
6388
|
// no registry available here
|
|
6717
6389
|
createCustomElement = createCustomElementCompat;
|
|
@@ -6775,7 +6447,7 @@
|
|
|
6775
6447
|
function isNull(obj) {
|
|
6776
6448
|
return obj === null;
|
|
6777
6449
|
}
|
|
6778
|
-
/** version: 2.
|
|
6450
|
+
/** version: 2.37.0 */
|
|
6779
6451
|
|
|
6780
6452
|
/*
|
|
6781
6453
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6853,7 +6525,7 @@
|
|
|
6853
6525
|
doc.body.innerHTML = html;
|
|
6854
6526
|
var content = doc.body;
|
|
6855
6527
|
if (!isUndefined(wrapperTags)) {
|
|
6856
|
-
for (var
|
|
6528
|
+
for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
|
|
6857
6529
|
content = content.firstChild;
|
|
6858
6530
|
}
|
|
6859
6531
|
}
|
|
@@ -7046,8 +6718,8 @@
|
|
|
7046
6718
|
tagName: element.tagName.toLowerCase(),
|
|
7047
6719
|
hydrated: true
|
|
7048
6720
|
});
|
|
7049
|
-
for (var
|
|
7050
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
6721
|
+
for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
|
|
6722
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
|
|
7051
6723
|
key = _Object$entries2$_i[0],
|
|
7052
6724
|
value = _Object$entries2$_i[1];
|
|
7053
6725
|
element[key] = value;
|
|
@@ -7120,23 +6792,23 @@
|
|
|
7120
6792
|
var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
|
|
7121
6793
|
return _a = /*#__PURE__*/function (_HTMLElement2) {
|
|
7122
6794
|
_inherits(_a, _HTMLElement2);
|
|
7123
|
-
var
|
|
6795
|
+
var _super7 = _createSuper(_a);
|
|
7124
6796
|
function _a() {
|
|
7125
|
-
var
|
|
6797
|
+
var _this4;
|
|
7126
6798
|
_classCallCheck(this, _a);
|
|
7127
|
-
|
|
7128
|
-
if (
|
|
6799
|
+
_this4 = _super7.call(this);
|
|
6800
|
+
if (_this4.isConnected) {
|
|
7129
6801
|
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
7130
|
-
hydrateComponent(_assertThisInitialized(
|
|
7131
|
-
hydratedCustomElements.add(_assertThisInitialized(
|
|
6802
|
+
hydrateComponent(_assertThisInitialized(_this4), Ctor, {});
|
|
6803
|
+
hydratedCustomElements.add(_assertThisInitialized(_this4));
|
|
7132
6804
|
} else {
|
|
7133
|
-
createVM(_assertThisInitialized(
|
|
6805
|
+
createVM(_assertThisInitialized(_this4), Ctor, renderer, {
|
|
7134
6806
|
mode: 'open',
|
|
7135
6807
|
owner: null,
|
|
7136
|
-
tagName:
|
|
6808
|
+
tagName: _this4.tagName
|
|
7137
6809
|
});
|
|
7138
6810
|
}
|
|
7139
|
-
return
|
|
6811
|
+
return _this4;
|
|
7140
6812
|
}
|
|
7141
6813
|
_createClass(_a, [{
|
|
7142
6814
|
key: "connectedCallback",
|
|
@@ -7334,7 +7006,7 @@
|
|
|
7334
7006
|
});
|
|
7335
7007
|
freeze(LightningElement);
|
|
7336
7008
|
seal(LightningElement.prototype);
|
|
7337
|
-
/* version: 2.
|
|
7009
|
+
/* version: 2.37.0 */
|
|
7338
7010
|
|
|
7339
7011
|
exports.LightningElement = LightningElement;
|
|
7340
7012
|
exports.__unstable__ProfilerControl = profilerControl;
|