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