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
|
@@ -330,9 +330,9 @@
|
|
|
330
330
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
331
331
|
*/
|
|
332
332
|
// Increment whenever the LWC template compiler changes
|
|
333
|
-
var LWC_VERSION = "2.
|
|
333
|
+
var LWC_VERSION = "2.37.0";
|
|
334
334
|
var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
335
|
-
/** version: 2.
|
|
335
|
+
/** version: 2.37.0 */
|
|
336
336
|
|
|
337
337
|
/**
|
|
338
338
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -352,10 +352,8 @@
|
|
|
352
352
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
353
353
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
354
354
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
355
|
-
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
356
355
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
357
|
-
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
358
|
-
ENABLE_PROGRAMMATIC_STYLESHEETS: null
|
|
356
|
+
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
359
357
|
};
|
|
360
358
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
361
359
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
@@ -413,7 +411,7 @@
|
|
|
413
411
|
setFeatureFlag(name, value);
|
|
414
412
|
}
|
|
415
413
|
}
|
|
416
|
-
/** version: 2.
|
|
414
|
+
/** version: 2.37.0 */
|
|
417
415
|
|
|
418
416
|
/**
|
|
419
417
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -477,7 +475,7 @@
|
|
|
477
475
|
}
|
|
478
476
|
}
|
|
479
477
|
}
|
|
480
|
-
/** version: 2.
|
|
478
|
+
/** version: 2.37.0 */
|
|
481
479
|
|
|
482
480
|
/*
|
|
483
481
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -543,7 +541,6 @@
|
|
|
543
541
|
* SPDX-License-Identifier: MIT
|
|
544
542
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
545
543
|
*/
|
|
546
|
-
/** Callbacks to invoke when reporting is enabled **/
|
|
547
544
|
var onReportingEnabledCallbacks = [];
|
|
548
545
|
/** The currently assigned reporting dispatcher. */
|
|
549
546
|
var currentDispatcher$1 = noop;
|
|
@@ -600,11 +597,11 @@
|
|
|
600
597
|
/**
|
|
601
598
|
* Report to the current dispatcher, if there is one.
|
|
602
599
|
* @param reportingEventId
|
|
603
|
-
* @param
|
|
600
|
+
* @param payload - data to report
|
|
604
601
|
*/
|
|
605
|
-
function report(reportingEventId,
|
|
602
|
+
function report(reportingEventId, payload) {
|
|
606
603
|
if (enabled$1) {
|
|
607
|
-
currentDispatcher$1(reportingEventId,
|
|
604
|
+
currentDispatcher$1(reportingEventId, payload);
|
|
608
605
|
}
|
|
609
606
|
}
|
|
610
607
|
|
|
@@ -897,31 +894,39 @@
|
|
|
897
894
|
// Make a shallow copy of an object but omit the given key
|
|
898
895
|
function cloneAndOmitKey(object, keyToOmit) {
|
|
899
896
|
var result = {};
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
897
|
+
var _iterator2 = _createForOfIteratorHelper(keys(object)),
|
|
898
|
+
_step2;
|
|
899
|
+
try {
|
|
900
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
901
|
+
var key = _step2.value;
|
|
902
|
+
if (key !== keyToOmit) {
|
|
903
|
+
result[key] = object[key];
|
|
904
|
+
}
|
|
904
905
|
}
|
|
906
|
+
} catch (err) {
|
|
907
|
+
_iterator2.e(err);
|
|
908
|
+
} finally {
|
|
909
|
+
_iterator2.f();
|
|
905
910
|
}
|
|
906
911
|
return result;
|
|
907
912
|
}
|
|
908
913
|
function flattenStylesheets(stylesheets) {
|
|
909
914
|
var list = [];
|
|
910
|
-
var
|
|
911
|
-
|
|
915
|
+
var _iterator3 = _createForOfIteratorHelper(stylesheets),
|
|
916
|
+
_step3;
|
|
912
917
|
try {
|
|
913
|
-
for (
|
|
914
|
-
var stylesheet =
|
|
915
|
-
if (!
|
|
918
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
919
|
+
var stylesheet = _step3.value;
|
|
920
|
+
if (!isArray$1(stylesheet)) {
|
|
916
921
|
list.push(stylesheet);
|
|
917
922
|
} else {
|
|
918
923
|
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
919
924
|
}
|
|
920
925
|
}
|
|
921
926
|
} catch (err) {
|
|
922
|
-
|
|
927
|
+
_iterator3.e(err);
|
|
923
928
|
} finally {
|
|
924
|
-
|
|
929
|
+
_iterator3.f();
|
|
925
930
|
}
|
|
926
931
|
return list;
|
|
927
932
|
}
|
|
@@ -2400,17 +2405,17 @@
|
|
|
2400
2405
|
var refs = refsCache.get(refVNodes);
|
|
2401
2406
|
if (isUndefined$1(refs)) {
|
|
2402
2407
|
refs = create(null);
|
|
2403
|
-
var
|
|
2404
|
-
|
|
2408
|
+
var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
|
|
2409
|
+
_step4;
|
|
2405
2410
|
try {
|
|
2406
|
-
for (
|
|
2407
|
-
var key =
|
|
2411
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2412
|
+
var key = _step4.value;
|
|
2408
2413
|
refs[key] = refVNodes[key].elm;
|
|
2409
2414
|
}
|
|
2410
2415
|
} catch (err) {
|
|
2411
|
-
|
|
2416
|
+
_iterator4.e(err);
|
|
2412
2417
|
} finally {
|
|
2413
|
-
|
|
2418
|
+
_iterator4.f();
|
|
2414
2419
|
}
|
|
2415
2420
|
freeze(refs);
|
|
2416
2421
|
refsCache.set(refVNodes, refs);
|
|
@@ -2492,7 +2497,7 @@
|
|
|
2492
2497
|
var queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2493
2498
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2494
2499
|
var _loop = function _loop() {
|
|
2495
|
-
var queryMethod = _queryMethods[
|
|
2500
|
+
var queryMethod = _queryMethods[_i7];
|
|
2496
2501
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2497
2502
|
value: function value(arg) {
|
|
2498
2503
|
var vm = getAssociatedVM(this);
|
|
@@ -2508,7 +2513,7 @@
|
|
|
2508
2513
|
writable: true
|
|
2509
2514
|
};
|
|
2510
2515
|
};
|
|
2511
|
-
for (var
|
|
2516
|
+
for (var _i7 = 0, _queryMethods = queryMethods; _i7 < _queryMethods.length; _i7++) {
|
|
2512
2517
|
_loop();
|
|
2513
2518
|
}
|
|
2514
2519
|
defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
|
|
@@ -2821,16 +2826,16 @@
|
|
|
2821
2826
|
}
|
|
2822
2827
|
function connectWireAdapters(vm) {
|
|
2823
2828
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
2824
|
-
for (var
|
|
2825
|
-
wiredConnecting[
|
|
2829
|
+
for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
|
|
2830
|
+
wiredConnecting[_i8]();
|
|
2826
2831
|
}
|
|
2827
2832
|
}
|
|
2828
2833
|
function disconnectWireAdapters(vm) {
|
|
2829
2834
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
2830
2835
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2831
2836
|
// job
|
|
2832
|
-
for (var
|
|
2833
|
-
wiredDisconnecting[
|
|
2837
|
+
for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
|
|
2838
|
+
wiredDisconnecting[_i9]();
|
|
2834
2839
|
}
|
|
2835
2840
|
}, noop);
|
|
2836
2841
|
}
|
|
@@ -3164,8 +3169,8 @@
|
|
|
3164
3169
|
}
|
|
3165
3170
|
}
|
|
3166
3171
|
if (!isUndefined$1(fields)) {
|
|
3167
|
-
for (var
|
|
3168
|
-
var _fieldName2 = fields[
|
|
3172
|
+
for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
|
|
3173
|
+
var _fieldName2 = fields[_i10];
|
|
3169
3174
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
3170
3175
|
if (process.env.NODE_ENV !== 'production') {
|
|
3171
3176
|
validateObservedField(Ctor, _fieldName2, descriptor);
|
|
@@ -3237,6 +3242,10 @@
|
|
|
3237
3242
|
// stylesheets and templates do not have user-meaningful names, but components do
|
|
3238
3243
|
var friendlyName = type === 'component' ? "".concat(type, " ").concat(func.name) : type;
|
|
3239
3244
|
logError("LWC WARNING: current engine is v".concat(LWC_VERSION, ", but ").concat(friendlyName, " was compiled with v").concat(version, ".\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear."));
|
|
3245
|
+
report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
|
|
3246
|
+
compilerVersion: version,
|
|
3247
|
+
runtimeVersion: LWC_VERSION
|
|
3248
|
+
});
|
|
3240
3249
|
}
|
|
3241
3250
|
}
|
|
3242
3251
|
}
|
|
@@ -3387,8 +3396,8 @@
|
|
|
3387
3396
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
3388
3397
|
var descriptors = create(null);
|
|
3389
3398
|
// expose getters and setters for each public props on the new Element Bridge
|
|
3390
|
-
for (var
|
|
3391
|
-
var _propName = props[
|
|
3399
|
+
for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
|
|
3400
|
+
var _propName = props[_i11];
|
|
3392
3401
|
attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
|
|
3393
3402
|
descriptors[_propName] = {
|
|
3394
3403
|
get: createGetter(_propName),
|
|
@@ -3398,8 +3407,8 @@
|
|
|
3398
3407
|
};
|
|
3399
3408
|
}
|
|
3400
3409
|
// expose public methods as props on the new Element Bridge
|
|
3401
|
-
for (var
|
|
3402
|
-
var methodName = methods[
|
|
3410
|
+
for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
|
|
3411
|
+
var methodName = methods[_i12];
|
|
3403
3412
|
descriptors[methodName] = {
|
|
3404
3413
|
value: createMethodCaller(methodName),
|
|
3405
3414
|
writable: true,
|
|
@@ -3928,8 +3937,8 @@
|
|
|
3928
3937
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3929
3938
|
var content = [];
|
|
3930
3939
|
var root;
|
|
3931
|
-
for (var
|
|
3932
|
-
var stylesheet = stylesheets[
|
|
3940
|
+
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
3941
|
+
var stylesheet = stylesheets[_i13];
|
|
3933
3942
|
if (isArray$1(stylesheet)) {
|
|
3934
3943
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3935
3944
|
} else {
|
|
@@ -4037,8 +4046,8 @@
|
|
|
4037
4046
|
shadowMode = vm.shadowMode,
|
|
4038
4047
|
insertStylesheet = vm.renderer.insertStylesheet;
|
|
4039
4048
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
4040
|
-
for (var
|
|
4041
|
-
insertStylesheet(stylesheets[
|
|
4049
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
4050
|
+
insertStylesheet(stylesheets[_i14]);
|
|
4042
4051
|
}
|
|
4043
4052
|
} else if (vm.hydrated) {
|
|
4044
4053
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -4051,8 +4060,8 @@
|
|
|
4051
4060
|
var root = getNearestNativeShadowComponent(vm);
|
|
4052
4061
|
// null root means a global style
|
|
4053
4062
|
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
4054
|
-
for (var
|
|
4055
|
-
insertStylesheet(stylesheets[
|
|
4063
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
4064
|
+
insertStylesheet(stylesheets[_i15], target);
|
|
4056
4065
|
}
|
|
4057
4066
|
}
|
|
4058
4067
|
return null;
|
|
@@ -4366,8 +4375,8 @@
|
|
|
4366
4375
|
return;
|
|
4367
4376
|
}
|
|
4368
4377
|
var setCSSStyleProperty = renderer.setCSSStyleProperty;
|
|
4369
|
-
for (var
|
|
4370
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
4378
|
+
for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
|
|
4379
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
|
|
4371
4380
|
prop = _styleDecls$_i[0],
|
|
4372
4381
|
value = _styleDecls$_i[1],
|
|
4373
4382
|
important = _styleDecls$_i[2];
|
|
@@ -4849,8 +4858,8 @@
|
|
|
4849
4858
|
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4850
4859
|
var nodeStack = [];
|
|
4851
4860
|
var fragmentFound = false;
|
|
4852
|
-
for (var
|
|
4853
|
-
var child = children[
|
|
4861
|
+
for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
|
|
4862
|
+
var child = children[_i17];
|
|
4854
4863
|
ArrayPush$1.call(nodeStack, child);
|
|
4855
4864
|
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4856
4865
|
}
|
|
@@ -4862,8 +4871,8 @@
|
|
|
4862
4871
|
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4863
4872
|
var fChildren = currentNode.children;
|
|
4864
4873
|
// Ignore the start and end text node delimiters
|
|
4865
|
-
for (var
|
|
4866
|
-
ArrayPush$1.call(nodeStack, fChildren[
|
|
4874
|
+
for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
|
|
4875
|
+
ArrayPush$1.call(nodeStack, fChildren[_i18]);
|
|
4867
4876
|
}
|
|
4868
4877
|
} else {
|
|
4869
4878
|
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
@@ -4902,8 +4911,8 @@
|
|
|
4902
4911
|
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
4903
4912
|
var cmpSlotsMapping = create(null);
|
|
4904
4913
|
// Collect all slots into cmpSlotsMapping
|
|
4905
|
-
for (var
|
|
4906
|
-
var vnode = children[
|
|
4914
|
+
for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
|
|
4915
|
+
var vnode = children[_i19];
|
|
4907
4916
|
if (isNull(vnode)) {
|
|
4908
4917
|
continue;
|
|
4909
4918
|
}
|
|
@@ -4913,7 +4922,12 @@
|
|
|
4913
4922
|
} else if (isVScopedSlotFragment(vnode)) {
|
|
4914
4923
|
slotName = vnode.slotName;
|
|
4915
4924
|
}
|
|
4916
|
-
|
|
4925
|
+
// Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
|
|
4926
|
+
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
|
4927
|
+
// the following line also throws same error for symbols
|
|
4928
|
+
// Similar for Object.create(null)
|
|
4929
|
+
var normalizedSlotName = '' + slotName;
|
|
4930
|
+
var vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
|
|
4917
4931
|
ArrayPush$1.call(vnodes, vnode);
|
|
4918
4932
|
}
|
|
4919
4933
|
vm.cmpSlots = {
|
|
@@ -4928,8 +4942,8 @@
|
|
|
4928
4942
|
markComponentAsDirty(vm);
|
|
4929
4943
|
return;
|
|
4930
4944
|
}
|
|
4931
|
-
for (var
|
|
4932
|
-
var key = oldKeys[
|
|
4945
|
+
for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
|
|
4946
|
+
var key = oldKeys[_i20];
|
|
4933
4947
|
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4934
4948
|
markComponentAsDirty(vm);
|
|
4935
4949
|
return;
|
|
@@ -5052,11 +5066,11 @@
|
|
|
5052
5066
|
if (oldStartIdx > oldEndIdx) {
|
|
5053
5067
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
5054
5068
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
5055
|
-
var
|
|
5069
|
+
var _i21 = newEndIdx;
|
|
5056
5070
|
var n;
|
|
5057
5071
|
do {
|
|
5058
|
-
n = newCh[++
|
|
5059
|
-
} while (!isVNode(n) &&
|
|
5072
|
+
n = newCh[++_i21];
|
|
5073
|
+
} while (!isVNode(n) && _i21 < newChEnd);
|
|
5060
5074
|
before = isVNode(n) ? n.elm : null;
|
|
5061
5075
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
5062
5076
|
} else {
|
|
@@ -5081,9 +5095,9 @@
|
|
|
5081
5095
|
// if the old list is not empty, the new list MUST have the same
|
|
5082
5096
|
// amount of nodes, that's why we call this static children
|
|
5083
5097
|
var anchor = null;
|
|
5084
|
-
for (var
|
|
5085
|
-
var n1 = c1[
|
|
5086
|
-
var n2 = c2[
|
|
5098
|
+
for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
|
|
5099
|
+
var n1 = c1[_i22];
|
|
5100
|
+
var n2 = c2[_i22];
|
|
5087
5101
|
if (n2 !== n1) {
|
|
5088
5102
|
if (isVNode(n1)) {
|
|
5089
5103
|
if (isVNode(n2)) {
|
|
@@ -5208,8 +5222,8 @@
|
|
|
5208
5222
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
5209
5223
|
var newChildren = [];
|
|
5210
5224
|
var slotAssignments = slotset.slotAssignments[slotName];
|
|
5211
|
-
for (var
|
|
5212
|
-
var vnode = slotAssignments[
|
|
5225
|
+
for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
|
|
5226
|
+
var vnode = slotAssignments[_i23];
|
|
5213
5227
|
if (!isNull(vnode)) {
|
|
5214
5228
|
var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
|
|
5215
5229
|
// The only sniff test for a scoped <slot> element is the presence of `slotData`
|
|
@@ -5731,23 +5745,23 @@
|
|
|
5731
5745
|
var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
|
|
5732
5746
|
var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
5733
5747
|
var htmlFragment = '';
|
|
5734
|
-
for (var
|
|
5735
|
-
switch (keys[
|
|
5748
|
+
for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
|
|
5749
|
+
switch (keys[_i24]) {
|
|
5736
5750
|
case 0:
|
|
5737
5751
|
// styleToken in existing class attr
|
|
5738
|
-
htmlFragment += strings[
|
|
5752
|
+
htmlFragment += strings[_i24] + classToken;
|
|
5739
5753
|
break;
|
|
5740
5754
|
case 1:
|
|
5741
5755
|
// styleToken for added class attr
|
|
5742
|
-
htmlFragment += strings[
|
|
5756
|
+
htmlFragment += strings[_i24] + classAttrToken;
|
|
5743
5757
|
break;
|
|
5744
5758
|
case 2:
|
|
5745
5759
|
// styleToken as attr
|
|
5746
|
-
htmlFragment += strings[
|
|
5760
|
+
htmlFragment += strings[_i24] + attrToken;
|
|
5747
5761
|
break;
|
|
5748
5762
|
case 3:
|
|
5749
5763
|
// ${1}${2}
|
|
5750
|
-
htmlFragment += strings[
|
|
5764
|
+
htmlFragment += strings[_i24] + classAttrToken + attrToken;
|
|
5751
5765
|
break;
|
|
5752
5766
|
}
|
|
5753
5767
|
}
|
|
@@ -5852,8 +5866,8 @@
|
|
|
5852
5866
|
}
|
|
5853
5867
|
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
5854
5868
|
if (hasStyles(stylesheets)) {
|
|
5855
|
-
for (var
|
|
5856
|
-
if (isTrue(stylesheets[
|
|
5869
|
+
for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
|
|
5870
|
+
if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
|
|
5857
5871
|
return true;
|
|
5858
5872
|
}
|
|
5859
5873
|
}
|
|
@@ -5977,6 +5991,8 @@
|
|
|
5977
5991
|
var tmpl = _ref4.tmpl;
|
|
5978
5992
|
if (isFunction$1(Ctor)) {
|
|
5979
5993
|
if (process.env.NODE_ENV !== 'production') {
|
|
5994
|
+
// There is no point in running this in production, because the version mismatch check relies
|
|
5995
|
+
// on code comments which are stripped out in production by minifiers
|
|
5980
5996
|
checkVersionMismatch(Ctor, 'component');
|
|
5981
5997
|
}
|
|
5982
5998
|
signedTemplateMap.set(Ctor, tmpl);
|
|
@@ -6049,8 +6065,8 @@
|
|
|
6049
6065
|
if (process.env.NODE_ENV !== 'production') {
|
|
6050
6066
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
6051
6067
|
}
|
|
6052
|
-
for (var
|
|
6053
|
-
var hookName = hooks[
|
|
6068
|
+
for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
|
|
6069
|
+
var hookName = hooks[_i26];
|
|
6054
6070
|
if (hookName in service) {
|
|
6055
6071
|
var l = Services[hookName];
|
|
6056
6072
|
if (isUndefined$1(l)) {
|
|
@@ -6067,8 +6083,8 @@
|
|
|
6067
6083
|
var component = vm.component,
|
|
6068
6084
|
def = vm.def,
|
|
6069
6085
|
context = vm.context;
|
|
6070
|
-
for (var
|
|
6071
|
-
cbs[
|
|
6086
|
+
for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
|
|
6087
|
+
cbs[_i27].call(undefined, component, {}, def, context);
|
|
6072
6088
|
}
|
|
6073
6089
|
}
|
|
6074
6090
|
|
|
@@ -6222,8 +6238,8 @@
|
|
|
6222
6238
|
var valid = true;
|
|
6223
6239
|
var validate = function validate(arrayOrStylesheet) {
|
|
6224
6240
|
if (isArray$1(arrayOrStylesheet)) {
|
|
6225
|
-
for (var
|
|
6226
|
-
validate(arrayOrStylesheet[
|
|
6241
|
+
for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
|
|
6242
|
+
validate(arrayOrStylesheet[_i28]);
|
|
6227
6243
|
}
|
|
6228
6244
|
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
6229
6245
|
// function assumed to be a stylesheet factory
|
|
@@ -6239,19 +6255,34 @@
|
|
|
6239
6255
|
}
|
|
6240
6256
|
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
6241
6257
|
function computeStylesheets(vm, ctor) {
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
}
|
|
6258
|
+
warnOnStylesheetsMutation(ctor);
|
|
6259
|
+
var stylesheets = ctor.stylesheets;
|
|
6260
|
+
if (!isUndefined$1(stylesheets)) {
|
|
6261
|
+
var valid = validateComponentStylesheets(vm, stylesheets);
|
|
6262
|
+
if (valid) {
|
|
6263
|
+
return flattenStylesheets(stylesheets);
|
|
6264
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
6265
|
+
logError("static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <".concat(vm.tagName, ">"), vm);
|
|
6251
6266
|
}
|
|
6252
6267
|
}
|
|
6253
6268
|
return null;
|
|
6254
6269
|
}
|
|
6270
|
+
function warnOnStylesheetsMutation(ctor) {
|
|
6271
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6272
|
+
var stylesheets = ctor.stylesheets;
|
|
6273
|
+
defineProperty(ctor, 'stylesheets', {
|
|
6274
|
+
enumerable: true,
|
|
6275
|
+
configurable: true,
|
|
6276
|
+
get: function get() {
|
|
6277
|
+
return stylesheets;
|
|
6278
|
+
},
|
|
6279
|
+
set: function set(newValue) {
|
|
6280
|
+
logWarnOnce("Dynamically setting the \"stylesheets\" static property on ".concat(ctor.name, " ") + 'will not affect the stylesheets injected.');
|
|
6281
|
+
stylesheets = newValue;
|
|
6282
|
+
}
|
|
6283
|
+
});
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6255
6286
|
function computeShadowMode(vm, renderer) {
|
|
6256
6287
|
var def = vm.def;
|
|
6257
6288
|
var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
|
|
@@ -6376,17 +6407,17 @@
|
|
|
6376
6407
|
return a.idx - b.idx;
|
|
6377
6408
|
});
|
|
6378
6409
|
rehydrateQueue = []; // reset to a new queue
|
|
6379
|
-
for (var
|
|
6380
|
-
var vm = vms[
|
|
6410
|
+
for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
|
|
6411
|
+
var vm = vms[_i29];
|
|
6381
6412
|
try {
|
|
6382
6413
|
rehydrate(vm);
|
|
6383
6414
|
} catch (error) {
|
|
6384
|
-
if (
|
|
6415
|
+
if (_i29 + 1 < len) {
|
|
6385
6416
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6386
6417
|
if (rehydrateQueue.length === 0) {
|
|
6387
6418
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6388
6419
|
}
|
|
6389
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6420
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
|
|
6390
6421
|
}
|
|
6391
6422
|
// we need to end the measure before throwing.
|
|
6392
6423
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
@@ -6455,8 +6486,8 @@
|
|
|
6455
6486
|
var vCustomElementCollection = vm.velements;
|
|
6456
6487
|
// Reporting disconnection for every child in inverse order since they are
|
|
6457
6488
|
// inserted in reserved order.
|
|
6458
|
-
for (var
|
|
6459
|
-
var elm = vCustomElementCollection[
|
|
6489
|
+
for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
|
|
6490
|
+
var elm = vCustomElementCollection[_i30].elm;
|
|
6460
6491
|
// There are two cases where the element could be undefined:
|
|
6461
6492
|
// * when there is an error during the construction phase, and an error
|
|
6462
6493
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
@@ -6487,8 +6518,8 @@
|
|
|
6487
6518
|
* defined on its shadow.
|
|
6488
6519
|
*/
|
|
6489
6520
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6490
|
-
for (var
|
|
6491
|
-
var vnode = vnodes[
|
|
6521
|
+
for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
|
|
6522
|
+
var vnode = vnodes[_i31];
|
|
6492
6523
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6493
6524
|
switch (vnode.type) {
|
|
6494
6525
|
case 2 /* VNodeType.Element */:
|
|
@@ -6512,8 +6543,8 @@
|
|
|
6512
6543
|
var children = vm.children,
|
|
6513
6544
|
renderRoot = vm.renderRoot,
|
|
6514
6545
|
remove = vm.renderer.remove;
|
|
6515
|
-
for (var
|
|
6516
|
-
var child = children[
|
|
6546
|
+
for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
|
|
6547
|
+
var child = children[_i32];
|
|
6517
6548
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6518
6549
|
remove(child.elm, renderRoot);
|
|
6519
6550
|
}
|
|
@@ -6595,7 +6626,7 @@
|
|
|
6595
6626
|
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
6596
6627
|
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
6597
6628
|
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
6598
|
-
// See: https://
|
|
6629
|
+
// See: https://sfdc.co/synthetic-aria
|
|
6599
6630
|
//
|
|
6600
6631
|
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
6601
6632
|
var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
@@ -6603,7 +6634,7 @@
|
|
|
6603
6634
|
function isSyntheticShadowRootInstance(rootNode) {
|
|
6604
6635
|
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
6605
6636
|
}
|
|
6606
|
-
function reportViolation(source, target, attrName) {
|
|
6637
|
+
function reportViolation$1(source, target, attrName) {
|
|
6607
6638
|
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
6608
6639
|
// shadow for a violation to be detected.
|
|
6609
6640
|
var vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
@@ -6614,10 +6645,13 @@
|
|
|
6614
6645
|
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
6615
6646
|
return;
|
|
6616
6647
|
}
|
|
6617
|
-
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */,
|
|
6648
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
|
|
6649
|
+
tagName: vm.tagName,
|
|
6650
|
+
attributeName: attrName
|
|
6651
|
+
});
|
|
6618
6652
|
if (process.env.NODE_ENV !== 'production') {
|
|
6619
6653
|
// Avoid excessively logging to the console in the case of duplicates.
|
|
6620
|
-
logWarnOnce("Element <".concat(source.tagName.toLowerCase(), "> uses attribute \"").concat(attrName, "\" to reference element ") + "<".concat(target.tagName.toLowerCase(), ">, which is not in the same shadow root. This will break in native shadow DOM. ") + "For details, see: https://
|
|
6654
|
+
logWarnOnce("Element <".concat(source.tagName.toLowerCase(), "> uses attribute \"").concat(attrName, "\" to reference element ") + "<".concat(target.tagName.toLowerCase(), ">, which is not in the same shadow root. This will break in native shadow DOM. ") + "For details, see: https://sfdc.co/synthetic-aria", vm);
|
|
6621
6655
|
}
|
|
6622
6656
|
}
|
|
6623
6657
|
function parseIdRefAttributeValue(attrValue) {
|
|
@@ -6635,57 +6669,57 @@
|
|
|
6635
6669
|
// if our id is null or empty, nobody can reference us
|
|
6636
6670
|
return;
|
|
6637
6671
|
}
|
|
6638
|
-
var
|
|
6639
|
-
|
|
6672
|
+
var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
|
|
6673
|
+
_step5;
|
|
6640
6674
|
try {
|
|
6641
|
-
for (
|
|
6642
|
-
var idRefAttrName =
|
|
6675
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
6676
|
+
var idRefAttrName = _step5.value;
|
|
6643
6677
|
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
6644
6678
|
// that reference multiple IDs, separated by whitespace.
|
|
6645
6679
|
var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
|
|
6646
6680
|
var sourceElements = querySelectorAll.call(document, query);
|
|
6647
|
-
for (var
|
|
6648
|
-
var sourceElement = sourceElements[
|
|
6681
|
+
for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
|
|
6682
|
+
var sourceElement = sourceElements[_i33];
|
|
6649
6683
|
var sourceRoot = sourceElement.getRootNode();
|
|
6650
6684
|
if (sourceRoot !== root) {
|
|
6651
|
-
reportViolation(sourceElement, elm, idRefAttrName);
|
|
6685
|
+
reportViolation$1(sourceElement, elm, idRefAttrName);
|
|
6652
6686
|
break;
|
|
6653
6687
|
}
|
|
6654
6688
|
}
|
|
6655
6689
|
}
|
|
6656
6690
|
} catch (err) {
|
|
6657
|
-
|
|
6691
|
+
_iterator5.e(err);
|
|
6658
6692
|
} finally {
|
|
6659
|
-
|
|
6693
|
+
_iterator5.f();
|
|
6660
6694
|
}
|
|
6661
6695
|
} else {
|
|
6662
6696
|
// elm is the source, find the target
|
|
6663
6697
|
var ids = parseIdRefAttributeValue(attrValue);
|
|
6664
|
-
var
|
|
6665
|
-
|
|
6698
|
+
var _iterator6 = _createForOfIteratorHelper(ids),
|
|
6699
|
+
_step6;
|
|
6666
6700
|
try {
|
|
6667
|
-
for (
|
|
6668
|
-
var id =
|
|
6701
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
6702
|
+
var id = _step6.value;
|
|
6669
6703
|
var target = getElementById.call(document, id);
|
|
6670
6704
|
if (!isNull(target)) {
|
|
6671
6705
|
var targetRoot = target.getRootNode();
|
|
6672
6706
|
if (targetRoot !== root) {
|
|
6673
6707
|
// target element's shadow root is not the same as ours
|
|
6674
|
-
reportViolation(elm, target, attrName);
|
|
6708
|
+
reportViolation$1(elm, target, attrName);
|
|
6675
6709
|
}
|
|
6676
6710
|
}
|
|
6677
6711
|
}
|
|
6678
6712
|
} catch (err) {
|
|
6679
|
-
|
|
6713
|
+
_iterator6.e(err);
|
|
6680
6714
|
} finally {
|
|
6681
|
-
|
|
6715
|
+
_iterator6.f();
|
|
6682
6716
|
}
|
|
6683
6717
|
}
|
|
6684
6718
|
}
|
|
6685
6719
|
var enabled = false;
|
|
6686
6720
|
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
6687
6721
|
// reporting is not enabled. It should also only run once
|
|
6688
|
-
function enableDetection() {
|
|
6722
|
+
function enableDetection$1() {
|
|
6689
6723
|
if (enabled) {
|
|
6690
6724
|
return; // don't double-apply the patches
|
|
6691
6725
|
}
|
|
@@ -6739,10 +6773,116 @@
|
|
|
6739
6773
|
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
6740
6774
|
// Always run detection in dev mode, so we can at least print to the console
|
|
6741
6775
|
if (process.env.NODE_ENV !== 'production') {
|
|
6742
|
-
enableDetection();
|
|
6776
|
+
enableDetection$1();
|
|
6743
6777
|
} else {
|
|
6744
6778
|
// In prod mode, only enable detection if reporting is enabled
|
|
6745
|
-
onReportingEnabled(enableDetection);
|
|
6779
|
+
onReportingEnabled(enableDetection$1);
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
|
|
6783
|
+
/*
|
|
6784
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6785
|
+
* All rights reserved.
|
|
6786
|
+
* SPDX-License-Identifier: MIT
|
|
6787
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6788
|
+
*/
|
|
6789
|
+
//
|
|
6790
|
+
// The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
|
|
6791
|
+
// legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
|
|
6792
|
+
//
|
|
6793
|
+
// See the README for @lwc/aria-reflection
|
|
6794
|
+
var NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
|
|
6795
|
+
function isLightningElement(elm) {
|
|
6796
|
+
// The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
|
|
6797
|
+
// In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
|
|
6798
|
+
return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
|
|
6799
|
+
}
|
|
6800
|
+
function findVM(elm) {
|
|
6801
|
+
// If it's a shadow DOM component, then it has a host
|
|
6802
|
+
var _elm$getRootNode = elm.getRootNode(),
|
|
6803
|
+
host = _elm$getRootNode.host;
|
|
6804
|
+
var vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
|
|
6805
|
+
if (!isUndefined$1(vm)) {
|
|
6806
|
+
return vm;
|
|
6807
|
+
}
|
|
6808
|
+
// Else it might be a light DOM component. Walk up the tree trying to find the owner
|
|
6809
|
+
var parentElement = elm;
|
|
6810
|
+
while (!isNull(parentElement = parentElement.parentElement)) {
|
|
6811
|
+
if (isLightningElement(parentElement)) {
|
|
6812
|
+
var _vm = getAssociatedVMIfPresent(parentElement);
|
|
6813
|
+
if (!isUndefined$1(_vm)) {
|
|
6814
|
+
return _vm;
|
|
6815
|
+
}
|
|
6816
|
+
}
|
|
6817
|
+
}
|
|
6818
|
+
// If we return undefined, it's because the element was rendered wholly outside a LightningElement
|
|
6819
|
+
}
|
|
6820
|
+
|
|
6821
|
+
function checkAndReportViolation(elm, prop) {
|
|
6822
|
+
if (!isLightningElement(elm)) {
|
|
6823
|
+
var vm = findVM(elm);
|
|
6824
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6825
|
+
logWarnOnce("Element <".concat(elm.tagName.toLowerCase(), "> ") + (isUndefined$1(vm) ? '' : "owned by <".concat(vm.elm.tagName.toLowerCase(), "> ")) + "uses non-standard property \"".concat(prop, "\". This will be removed in a future version of LWC. ") + "See https://sfdc.co/deprecated-aria");
|
|
6826
|
+
}
|
|
6827
|
+
report(2 /* ReportingEventId.NonStandardAriaReflection */, {
|
|
6828
|
+
tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
|
|
6829
|
+
propertyName: prop
|
|
6830
|
+
});
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
function enableDetection() {
|
|
6834
|
+
var _Element = Element,
|
|
6835
|
+
prototype = _Element.prototype;
|
|
6836
|
+
var _iterator7 = _createForOfIteratorHelper(NON_STANDARD_ARIA_PROPS),
|
|
6837
|
+
_step7;
|
|
6838
|
+
try {
|
|
6839
|
+
var _loop3 = function _loop3() {
|
|
6840
|
+
var prop = _step7.value;
|
|
6841
|
+
var descriptor = getOwnPropertyDescriptor$1(prototype, prop);
|
|
6842
|
+
// The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
|
|
6843
|
+
// This happens automatically because of the ordering of imports.
|
|
6844
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6845
|
+
/* istanbul ignore if */
|
|
6846
|
+
if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
|
|
6847
|
+
// should never happen
|
|
6848
|
+
throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
|
|
6849
|
+
}
|
|
6850
|
+
}
|
|
6851
|
+
// @ts-ignore
|
|
6852
|
+
var _get4 = descriptor.get,
|
|
6853
|
+
_set4 = descriptor.set;
|
|
6854
|
+
defineProperty(prototype, prop, {
|
|
6855
|
+
get: function get() {
|
|
6856
|
+
checkAndReportViolation(this, prop);
|
|
6857
|
+
return _get4.call(this);
|
|
6858
|
+
},
|
|
6859
|
+
set: function set(val) {
|
|
6860
|
+
checkAndReportViolation(this, prop);
|
|
6861
|
+
return _set4.call(this, val);
|
|
6862
|
+
},
|
|
6863
|
+
configurable: true,
|
|
6864
|
+
enumerable: true
|
|
6865
|
+
});
|
|
6866
|
+
};
|
|
6867
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
6868
|
+
_loop3();
|
|
6869
|
+
}
|
|
6870
|
+
} catch (err) {
|
|
6871
|
+
_iterator7.e(err);
|
|
6872
|
+
} finally {
|
|
6873
|
+
_iterator7.f();
|
|
6874
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
// No point in running this code if we're not in a browser, or if the global polyfill is not loaded
|
|
6877
|
+
{
|
|
6878
|
+
if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
6879
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
6880
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6881
|
+
enableDetection();
|
|
6882
|
+
} else {
|
|
6883
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
6884
|
+
onReportingEnabled(enableDetection);
|
|
6885
|
+
}
|
|
6746
6886
|
}
|
|
6747
6887
|
}
|
|
6748
6888
|
|
|
@@ -6980,8 +7120,8 @@
|
|
|
6980
7120
|
var nextNode = node;
|
|
6981
7121
|
var anchor = null;
|
|
6982
7122
|
var renderer = owner.renderer;
|
|
6983
|
-
for (var
|
|
6984
|
-
var childVnode = children[
|
|
7123
|
+
for (var _i34 = 0; _i34 < children.length; _i34++) {
|
|
7124
|
+
var childVnode = children[_i34];
|
|
6985
7125
|
if (!isNull(childVnode)) {
|
|
6986
7126
|
if (nextNode) {
|
|
6987
7127
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
@@ -7059,8 +7199,8 @@
|
|
|
7059
7199
|
var nodesAreCompatible = true;
|
|
7060
7200
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
7061
7201
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
7062
|
-
for (var
|
|
7063
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[
|
|
7202
|
+
for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
|
|
7203
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
|
|
7064
7204
|
attrName = _Object$entries$_i[0],
|
|
7065
7205
|
attrValue = _Object$entries$_i[1];
|
|
7066
7206
|
var owner = vnode.owner;
|
|
@@ -7161,8 +7301,8 @@
|
|
|
7161
7301
|
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
7162
7302
|
var expectedStyle = [];
|
|
7163
7303
|
// styleMap is used when style is set to static value.
|
|
7164
|
-
for (var
|
|
7165
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[
|
|
7304
|
+
for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
|
|
7305
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
|
|
7166
7306
|
prop = _styleDecls$_i2[0],
|
|
7167
7307
|
value = _styleDecls$_i2[1],
|
|
7168
7308
|
important = _styleDecls$_i2[2];
|
|
@@ -7245,12 +7385,13 @@
|
|
|
7245
7385
|
*/
|
|
7246
7386
|
// See @lwc/engine-core/src/framework/template.ts
|
|
7247
7387
|
var TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
7248
|
-
// Via https://www.npmjs.com/package/object-observer
|
|
7249
|
-
var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
7250
7388
|
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
7251
|
-
var
|
|
7389
|
+
var STYLESHEET_PROPS = [
|
|
7252
7390
|
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
7253
7391
|
'$scoped$'];
|
|
7392
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
7393
|
+
var ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
7394
|
+
var mutationTrackingDisabled = false;
|
|
7254
7395
|
function getOriginalArrayMethod(prop) {
|
|
7255
7396
|
switch (prop) {
|
|
7256
7397
|
case 'pop':
|
|
@@ -7273,42 +7414,54 @@
|
|
|
7273
7414
|
return ArrayCopyWithin;
|
|
7274
7415
|
}
|
|
7275
7416
|
}
|
|
7276
|
-
|
|
7417
|
+
function reportViolation(type, eventId, prop) {
|
|
7418
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7419
|
+
logWarnOnce("Mutating the \"".concat(prop, "\" property on a ").concat(type, " ") + "is deprecated and will be removed in a future version of LWC. " + "See: https://sfdc.co/template-mutation");
|
|
7420
|
+
}
|
|
7421
|
+
report(eventId, {
|
|
7422
|
+
propertyName: prop
|
|
7423
|
+
});
|
|
7424
|
+
}
|
|
7425
|
+
function reportTemplateViolation(prop) {
|
|
7426
|
+
reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
|
|
7427
|
+
}
|
|
7428
|
+
function reportStylesheetViolation(prop) {
|
|
7429
|
+
reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
|
|
7430
|
+
}
|
|
7277
7431
|
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
7278
7432
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
7279
7433
|
function warnOnArrayMutation(stylesheets) {
|
|
7280
7434
|
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
7281
7435
|
// we can at least warn when they use the most common mutation methods.
|
|
7282
|
-
var
|
|
7283
|
-
|
|
7436
|
+
var _iterator8 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
|
|
7437
|
+
_step8;
|
|
7284
7438
|
try {
|
|
7285
|
-
var
|
|
7286
|
-
var prop =
|
|
7439
|
+
var _loop4 = function _loop4() {
|
|
7440
|
+
var prop = _step8.value;
|
|
7287
7441
|
var originalArrayMethod = getOriginalArrayMethod(prop);
|
|
7288
7442
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
7289
|
-
|
|
7443
|
+
reportTemplateViolation('stylesheets');
|
|
7290
7444
|
// @ts-ignore
|
|
7291
7445
|
return originalArrayMethod.apply(this, arguments);
|
|
7292
7446
|
};
|
|
7293
7447
|
};
|
|
7294
|
-
for (
|
|
7295
|
-
|
|
7448
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7449
|
+
_loop4();
|
|
7296
7450
|
}
|
|
7297
7451
|
} catch (err) {
|
|
7298
|
-
|
|
7452
|
+
_iterator8.e(err);
|
|
7299
7453
|
} finally {
|
|
7300
|
-
|
|
7454
|
+
_iterator8.f();
|
|
7301
7455
|
}
|
|
7302
7456
|
}
|
|
7303
7457
|
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
7304
7458
|
// `stylesheet.$scoped$ = true`
|
|
7305
7459
|
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
_step7;
|
|
7460
|
+
var _iterator9 = _createForOfIteratorHelper(STYLESHEET_PROPS),
|
|
7461
|
+
_step9;
|
|
7309
7462
|
try {
|
|
7310
|
-
var
|
|
7311
|
-
var prop =
|
|
7463
|
+
var _loop5 = function _loop5() {
|
|
7464
|
+
var prop = _step9.value;
|
|
7312
7465
|
var value = stylesheet[prop];
|
|
7313
7466
|
defineProperty(stylesheet, prop, {
|
|
7314
7467
|
enumerable: true,
|
|
@@ -7317,22 +7470,22 @@
|
|
|
7317
7470
|
return value;
|
|
7318
7471
|
},
|
|
7319
7472
|
set: function set(newValue) {
|
|
7320
|
-
|
|
7473
|
+
reportStylesheetViolation(prop);
|
|
7321
7474
|
value = newValue;
|
|
7322
7475
|
}
|
|
7323
7476
|
});
|
|
7324
7477
|
};
|
|
7325
|
-
for (
|
|
7326
|
-
|
|
7478
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
7479
|
+
_loop5();
|
|
7327
7480
|
}
|
|
7328
7481
|
} catch (err) {
|
|
7329
|
-
|
|
7482
|
+
_iterator9.e(err);
|
|
7330
7483
|
} finally {
|
|
7331
|
-
|
|
7484
|
+
_iterator9.f();
|
|
7332
7485
|
}
|
|
7333
7486
|
}
|
|
7334
7487
|
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
7335
|
-
function
|
|
7488
|
+
function trackStylesheetsMutation(stylesheets) {
|
|
7336
7489
|
traverseStylesheets(stylesheets, function (subStylesheets) {
|
|
7337
7490
|
if (isArray$1(subStylesheets)) {
|
|
7338
7491
|
warnOnArrayMutation(subStylesheets);
|
|
@@ -7350,8 +7503,8 @@
|
|
|
7350
7503
|
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
7351
7504
|
function traverseStylesheets(stylesheets, callback) {
|
|
7352
7505
|
callback(stylesheets);
|
|
7353
|
-
for (var
|
|
7354
|
-
var stylesheet = stylesheets[
|
|
7506
|
+
for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
|
|
7507
|
+
var stylesheet = stylesheets[_i37];
|
|
7355
7508
|
if (isArray$1(stylesheet)) {
|
|
7356
7509
|
traverseStylesheets(stylesheet, callback);
|
|
7357
7510
|
} else {
|
|
@@ -7359,7 +7512,80 @@
|
|
|
7359
7512
|
}
|
|
7360
7513
|
}
|
|
7361
7514
|
}
|
|
7515
|
+
function trackMutations(tmpl) {
|
|
7516
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
7517
|
+
trackStylesheetsMutation(tmpl.stylesheets);
|
|
7518
|
+
}
|
|
7519
|
+
var _iterator10 = _createForOfIteratorHelper(TEMPLATE_PROPS),
|
|
7520
|
+
_step10;
|
|
7521
|
+
try {
|
|
7522
|
+
var _loop6 = function _loop6() {
|
|
7523
|
+
var prop = _step10.value;
|
|
7524
|
+
var value = tmpl[prop];
|
|
7525
|
+
defineProperty(tmpl, prop, {
|
|
7526
|
+
enumerable: true,
|
|
7527
|
+
configurable: true,
|
|
7528
|
+
get: function get() {
|
|
7529
|
+
return value;
|
|
7530
|
+
},
|
|
7531
|
+
set: function set(newValue) {
|
|
7532
|
+
if (!mutationTrackingDisabled) {
|
|
7533
|
+
reportTemplateViolation(prop);
|
|
7534
|
+
}
|
|
7535
|
+
value = newValue;
|
|
7536
|
+
}
|
|
7537
|
+
});
|
|
7538
|
+
};
|
|
7539
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
7540
|
+
_loop6();
|
|
7541
|
+
}
|
|
7542
|
+
} catch (err) {
|
|
7543
|
+
_iterator10.e(err);
|
|
7544
|
+
} finally {
|
|
7545
|
+
_iterator10.f();
|
|
7546
|
+
}
|
|
7547
|
+
var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7548
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7549
|
+
enumerable: true,
|
|
7550
|
+
configurable: true,
|
|
7551
|
+
get: originalDescriptor.get,
|
|
7552
|
+
set: function set(value) {
|
|
7553
|
+
reportTemplateViolation('stylesheetTokens');
|
|
7554
|
+
// Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
|
|
7555
|
+
mutationTrackingDisabled = true;
|
|
7556
|
+
originalDescriptor.set.call(this, value);
|
|
7557
|
+
mutationTrackingDisabled = false;
|
|
7558
|
+
}
|
|
7559
|
+
});
|
|
7560
|
+
}
|
|
7561
|
+
function addLegacyStylesheetTokensShim(tmpl) {
|
|
7562
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
7563
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
7564
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7565
|
+
enumerable: true,
|
|
7566
|
+
configurable: true,
|
|
7567
|
+
get: function get() {
|
|
7568
|
+
var stylesheetToken = this.stylesheetToken;
|
|
7569
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
7570
|
+
return stylesheetToken;
|
|
7571
|
+
}
|
|
7572
|
+
// Shim for the old `stylesheetTokens` property
|
|
7573
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
7574
|
+
return {
|
|
7575
|
+
hostAttribute: "".concat(stylesheetToken, "-host"),
|
|
7576
|
+
shadowAttribute: stylesheetToken
|
|
7577
|
+
};
|
|
7578
|
+
},
|
|
7579
|
+
set: function set(value) {
|
|
7580
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
7581
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
7582
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
7583
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
7584
|
+
}
|
|
7585
|
+
});
|
|
7586
|
+
}
|
|
7362
7587
|
function freezeTemplate(tmpl) {
|
|
7588
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
7363
7589
|
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
7364
7590
|
// Deep freeze the template
|
|
7365
7591
|
freeze(tmpl);
|
|
@@ -7367,76 +7593,16 @@
|
|
|
7367
7593
|
deepFreeze(tmpl.stylesheets);
|
|
7368
7594
|
}
|
|
7369
7595
|
} else {
|
|
7370
|
-
//
|
|
7371
|
-
//
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
enumerable: true,
|
|
7375
|
-
configurable: true,
|
|
7376
|
-
get: function get() {
|
|
7377
|
-
var stylesheetToken = this.stylesheetToken;
|
|
7378
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
7379
|
-
return stylesheetToken;
|
|
7380
|
-
}
|
|
7381
|
-
// Shim for the old `stylesheetTokens` property
|
|
7382
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
7383
|
-
return {
|
|
7384
|
-
hostAttribute: "".concat(stylesheetToken, "-host"),
|
|
7385
|
-
shadowAttribute: stylesheetToken
|
|
7386
|
-
};
|
|
7387
|
-
},
|
|
7388
|
-
set: function set(value) {
|
|
7389
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
7390
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
7391
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
7392
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
7393
|
-
}
|
|
7394
|
-
});
|
|
7395
|
-
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
7596
|
+
// template is not frozen - shim, report, and warn
|
|
7597
|
+
// this shim should be applied in both dev and prod
|
|
7598
|
+
addLegacyStylesheetTokensShim(tmpl);
|
|
7599
|
+
// When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
|
|
7396
7600
|
if (process.env.NODE_ENV !== 'production') {
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
try {
|
|
7403
|
-
var _loop5 = function _loop5() {
|
|
7404
|
-
var prop = _step8.value;
|
|
7405
|
-
var value = tmpl[prop];
|
|
7406
|
-
defineProperty(tmpl, prop, {
|
|
7407
|
-
enumerable: true,
|
|
7408
|
-
configurable: true,
|
|
7409
|
-
get: function get() {
|
|
7410
|
-
return value;
|
|
7411
|
-
},
|
|
7412
|
-
set: function set(newValue) {
|
|
7413
|
-
if (!mutationWarningsSilenced) {
|
|
7414
|
-
logError("Dynamically setting the \"".concat(prop, "\" property on a template function ") + "is deprecated and may be removed in a future version of LWC.");
|
|
7415
|
-
}
|
|
7416
|
-
value = newValue;
|
|
7417
|
-
}
|
|
7418
|
-
});
|
|
7419
|
-
};
|
|
7420
|
-
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7421
|
-
_loop5();
|
|
7422
|
-
}
|
|
7423
|
-
} catch (err) {
|
|
7424
|
-
_iterator8.e(err);
|
|
7425
|
-
} finally {
|
|
7426
|
-
_iterator8.f();
|
|
7427
|
-
}
|
|
7428
|
-
var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7429
|
-
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7430
|
-
enumerable: true,
|
|
7431
|
-
configurable: true,
|
|
7432
|
-
get: originalDescriptor.get,
|
|
7433
|
-
set: function set(value) {
|
|
7434
|
-
logError("Dynamically setting the \"stylesheetTokens\" property on a template function " + "is deprecated and may be removed in a future version of LWC.");
|
|
7435
|
-
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
7436
|
-
mutationWarningsSilenced = true;
|
|
7437
|
-
originalDescriptor.set.call(this, value);
|
|
7438
|
-
mutationWarningsSilenced = false;
|
|
7439
|
-
}
|
|
7601
|
+
trackMutations(tmpl);
|
|
7602
|
+
} else {
|
|
7603
|
+
// In prod mode, we only track mutations if reporting is enabled
|
|
7604
|
+
onReportingEnabled(function () {
|
|
7605
|
+
trackMutations(tmpl);
|
|
7440
7606
|
});
|
|
7441
7607
|
}
|
|
7442
7608
|
}
|
|
@@ -7464,7 +7630,7 @@
|
|
|
7464
7630
|
}
|
|
7465
7631
|
return ctor;
|
|
7466
7632
|
}
|
|
7467
|
-
/* version: 2.
|
|
7633
|
+
/* version: 2.37.0 */
|
|
7468
7634
|
|
|
7469
7635
|
/*
|
|
7470
7636
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7808,610 +7974,6 @@
|
|
|
7808
7974
|
}
|
|
7809
7975
|
};
|
|
7810
7976
|
|
|
7811
|
-
/*
|
|
7812
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
7813
|
-
* All rights reserved.
|
|
7814
|
-
* SPDX-License-Identifier: MIT
|
|
7815
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7816
|
-
*/
|
|
7817
|
-
/**
|
|
7818
|
-
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
7819
|
-
* do not conflict with third-party custom elements having the same tag name.
|
|
7820
|
-
*/
|
|
7821
|
-
function createScopedRegistry() {
|
|
7822
|
-
if (!hasCustomElements) {
|
|
7823
|
-
// This code should never be reached, because we don't use the pivot registry if
|
|
7824
|
-
// custom elements are unavailable.
|
|
7825
|
-
throw new Error('Custom elements are not supported in this environment.');
|
|
7826
|
-
}
|
|
7827
|
-
var _window = window,
|
|
7828
|
-
NativeHTMLElement = _window.HTMLElement;
|
|
7829
|
-
var _NativeHTMLElement$pr = NativeHTMLElement.prototype,
|
|
7830
|
-
nativeHasAttribute = _NativeHTMLElement$pr.hasAttribute,
|
|
7831
|
-
nativeSetAttribute = _NativeHTMLElement$pr.setAttribute,
|
|
7832
|
-
nativeRemoveAttribute = _NativeHTMLElement$pr.removeAttribute,
|
|
7833
|
-
nativeGetAttribute = _NativeHTMLElement$pr.getAttribute;
|
|
7834
|
-
var definitionForElement = new WeakMap();
|
|
7835
|
-
var pendingRegistryForElement = new WeakMap();
|
|
7836
|
-
var definitionForConstructor = new WeakMap();
|
|
7837
|
-
var registeredUserCtors = new WeakSet();
|
|
7838
|
-
var registeredPivotCtors = new WeakSet();
|
|
7839
|
-
var pivotCtorByTag = new Map();
|
|
7840
|
-
var globalDefinitionsByTag = new Map();
|
|
7841
|
-
var globalDefinitionsByClass = new Map();
|
|
7842
|
-
var awaitingUpgrade = new Map();
|
|
7843
|
-
var pendingWhenDefinedCallbacks = new Map();
|
|
7844
|
-
var EMPTY_SET = new Set();
|
|
7845
|
-
function createDefinitionRecord(constructor) {
|
|
7846
|
-
var _a;
|
|
7847
|
-
var _constructor$prototyp = constructor.prototype,
|
|
7848
|
-
connectedCallback = _constructor$prototyp.connectedCallback,
|
|
7849
|
-
disconnectedCallback = _constructor$prototyp.disconnectedCallback,
|
|
7850
|
-
formAssociatedCallback = _constructor$prototyp.formAssociatedCallback,
|
|
7851
|
-
formDisabledCallback = _constructor$prototyp.formDisabledCallback,
|
|
7852
|
-
formResetCallback = _constructor$prototyp.formResetCallback,
|
|
7853
|
-
formStateRestoreCallback = _constructor$prototyp.formStateRestoreCallback,
|
|
7854
|
-
adoptedCallback = _constructor$prototyp.adoptedCallback,
|
|
7855
|
-
attributeChangedCallback = _constructor$prototyp.attributeChangedCallback;
|
|
7856
|
-
var formAssociated = Boolean(constructor.formAssociated);
|
|
7857
|
-
var observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
|
|
7858
|
-
return {
|
|
7859
|
-
UserCtor: constructor,
|
|
7860
|
-
PivotCtor: undefined,
|
|
7861
|
-
connectedCallback: connectedCallback,
|
|
7862
|
-
disconnectedCallback: disconnectedCallback,
|
|
7863
|
-
formAssociatedCallback: formAssociatedCallback,
|
|
7864
|
-
formDisabledCallback: formDisabledCallback,
|
|
7865
|
-
formResetCallback: formResetCallback,
|
|
7866
|
-
formStateRestoreCallback: formStateRestoreCallback,
|
|
7867
|
-
adoptedCallback: adoptedCallback,
|
|
7868
|
-
attributeChangedCallback: attributeChangedCallback,
|
|
7869
|
-
observedAttributes: observedAttributes,
|
|
7870
|
-
formAssociated: formAssociated
|
|
7871
|
-
};
|
|
7872
|
-
}
|
|
7873
|
-
// Helper to create stand-in element for each tagName registered that delegates out to the registry for the given
|
|
7874
|
-
// element. Note that the `registeredDefinition` represents the constructor that was used to register during
|
|
7875
|
-
// `customElements.define()`. Whereas the `pivotDefinition` represents the constructor that is passed when the pivot
|
|
7876
|
-
// constructor is invoked with another constructor.
|
|
7877
|
-
function createPivotingClass(tagName, registeredDefinition) {
|
|
7878
|
-
var PivotCtor = /*#__PURE__*/function (_NativeHTMLElement) {
|
|
7879
|
-
_inherits(PivotCtor, _NativeHTMLElement);
|
|
7880
|
-
var _super7 = _createSuper(PivotCtor);
|
|
7881
|
-
function PivotCtor(UserCtor) {
|
|
7882
|
-
var _this4;
|
|
7883
|
-
_classCallCheck(this, PivotCtor);
|
|
7884
|
-
// This constructor can only be invoked by:
|
|
7885
|
-
// a) the browser instantiating an element from parsing or via document.createElement.
|
|
7886
|
-
// b) LWC new PivotClass (This constructor is NOT observable/accessible in user-land).
|
|
7887
|
-
// b) new UserClass.
|
|
7888
|
-
// When LWC instantiates it, it will pass the upgrading definition as an argument
|
|
7889
|
-
// If the caller signals via UserCtor that this is in fact a controlled
|
|
7890
|
-
// definition, we use that one, otherwise fallback to the global
|
|
7891
|
-
// internal registry.
|
|
7892
|
-
_this4 = _super7.call(this);
|
|
7893
|
-
var userCtorIsDefined = !isUndefined$1(UserCtor);
|
|
7894
|
-
if (userCtorIsDefined) {
|
|
7895
|
-
if (!isConstructor(UserCtor)) {
|
|
7896
|
-
throw new TypeError("Failed to create custom element: the provided constructor is not a constructor.");
|
|
7897
|
-
}
|
|
7898
|
-
if (!registeredUserCtors.has(UserCtor)) {
|
|
7899
|
-
throw new Error("Failed to create custom element: the provided constructor is unregistered: ".concat(UserCtor.name, "."));
|
|
7900
|
-
}
|
|
7901
|
-
}
|
|
7902
|
-
var definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
|
|
7903
|
-
if (!isUndefined$1(definition)) {
|
|
7904
|
-
internalUpgrade(_assertThisInitialized(_this4), registeredDefinition, definition);
|
|
7905
|
-
} else {
|
|
7906
|
-
// This is the case in which there is no global definition, and
|
|
7907
|
-
// it is not handled by LWC (otherwise it will have a valid UserCtor)
|
|
7908
|
-
// so we need to add it to the pending queue just in case it eventually
|
|
7909
|
-
// gets defined in the global registry.
|
|
7910
|
-
pendingRegistryForElement.set(_assertThisInitialized(_this4), registeredDefinition);
|
|
7911
|
-
}
|
|
7912
|
-
return _this4;
|
|
7913
|
-
}
|
|
7914
|
-
_createClass(PivotCtor, [{
|
|
7915
|
-
key: "connectedCallback",
|
|
7916
|
-
value: function connectedCallback() {
|
|
7917
|
-
var _a;
|
|
7918
|
-
var definition = definitionForElement.get(this);
|
|
7919
|
-
if (!isUndefined$1(definition)) {
|
|
7920
|
-
// Delegate out to user callback
|
|
7921
|
-
(_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7922
|
-
} else {
|
|
7923
|
-
// Register for upgrade when defined (only when connected, so we don't leak)
|
|
7924
|
-
var awaiting = awaitingUpgrade.get(tagName);
|
|
7925
|
-
if (isUndefined$1(awaiting)) {
|
|
7926
|
-
awaitingUpgrade.set(tagName, awaiting = new Set());
|
|
7927
|
-
}
|
|
7928
|
-
awaiting.add(this);
|
|
7929
|
-
}
|
|
7930
|
-
}
|
|
7931
|
-
}, {
|
|
7932
|
-
key: "disconnectedCallback",
|
|
7933
|
-
value: function disconnectedCallback() {
|
|
7934
|
-
var _a;
|
|
7935
|
-
var definition = definitionForElement.get(this);
|
|
7936
|
-
if (!isUndefined$1(definition)) {
|
|
7937
|
-
// Delegate out to user callback
|
|
7938
|
-
(_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7939
|
-
} else {
|
|
7940
|
-
// Un-register for upgrade when defined (so we don't leak)
|
|
7941
|
-
var awaiting = awaitingUpgrade.get(tagName);
|
|
7942
|
-
// At this point, awaiting should never be undefined, because connectedCallback
|
|
7943
|
-
// must have been called before disconnectedCallback. But just to be safe, we check
|
|
7944
|
-
if (!isUndefined$1(awaiting)) {
|
|
7945
|
-
awaiting.delete(this);
|
|
7946
|
-
}
|
|
7947
|
-
}
|
|
7948
|
-
}
|
|
7949
|
-
}, {
|
|
7950
|
-
key: "formAssociatedCallback",
|
|
7951
|
-
value: function formAssociatedCallback(form) {
|
|
7952
|
-
var _a;
|
|
7953
|
-
var definition = definitionForElement.get(this);
|
|
7954
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
|
|
7955
|
-
}
|
|
7956
|
-
}, {
|
|
7957
|
-
key: "formDisabledCallback",
|
|
7958
|
-
value: function formDisabledCallback(disabled) {
|
|
7959
|
-
var _a;
|
|
7960
|
-
var definition = definitionForElement.get(this);
|
|
7961
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
|
|
7962
|
-
}
|
|
7963
|
-
}, {
|
|
7964
|
-
key: "formResetCallback",
|
|
7965
|
-
value: function formResetCallback() {
|
|
7966
|
-
var _a;
|
|
7967
|
-
var definition = definitionForElement.get(this);
|
|
7968
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7969
|
-
}
|
|
7970
|
-
}, {
|
|
7971
|
-
key: "formStateRestoreCallback",
|
|
7972
|
-
value: function formStateRestoreCallback(state, mode) {
|
|
7973
|
-
var _a;
|
|
7974
|
-
var definition = definitionForElement.get(this);
|
|
7975
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
|
|
7976
|
-
}
|
|
7977
|
-
}, {
|
|
7978
|
-
key: "adoptedCallback",
|
|
7979
|
-
value: function adoptedCallback() {
|
|
7980
|
-
var _a;
|
|
7981
|
-
var definition = definitionForElement.get(this);
|
|
7982
|
-
(_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
7983
|
-
}
|
|
7984
|
-
}, {
|
|
7985
|
-
key: "attributeChangedCallback",
|
|
7986
|
-
value: function attributeChangedCallback(name, oldValue, newValue) {
|
|
7987
|
-
var _a;
|
|
7988
|
-
var definition = definitionForElement.get(this);
|
|
7989
|
-
// if both definitions are the same, then the observedAttributes is the same,
|
|
7990
|
-
// but if they are different, only if the runtime definition has the attribute
|
|
7991
|
-
// marked as observed, then it should invoke attributeChangedCallback.
|
|
7992
|
-
if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
|
|
7993
|
-
(_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
|
|
7994
|
-
}
|
|
7995
|
-
}
|
|
7996
|
-
}]);
|
|
7997
|
-
return PivotCtor;
|
|
7998
|
-
}(NativeHTMLElement);
|
|
7999
|
-
PivotCtor.observedAttributes = _toConsumableArray(registeredDefinition.observedAttributes);
|
|
8000
|
-
// TODO [#3000]: support case where registeredDefinition is not form-associated, but later definition is.
|
|
8001
|
-
PivotCtor.formAssociated = registeredDefinition.formAssociated;
|
|
8002
|
-
registeredPivotCtors.add(PivotCtor);
|
|
8003
|
-
return PivotCtor;
|
|
8004
|
-
}
|
|
8005
|
-
function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
|
|
8006
|
-
var observedAttributes = pivotDefinition.observedAttributes,
|
|
8007
|
-
attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
8008
|
-
if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
|
|
8009
|
-
// This instance does not need to observe any attributes, no need to patch
|
|
8010
|
-
return EMPTY_SET;
|
|
8011
|
-
}
|
|
8012
|
-
// Natively, the attributes observed by the registered definition are going to be taken
|
|
8013
|
-
// care of by the browser, only the difference between the two sets has to be taken
|
|
8014
|
-
// care by the patched version.
|
|
8015
|
-
return new Set(_toConsumableArray(pivotDefinition.observedAttributes).filter(function (x) {
|
|
8016
|
-
return !registeredDefinition.observedAttributes.has(x);
|
|
8017
|
-
}));
|
|
8018
|
-
}
|
|
8019
|
-
function throwAsyncError(error) {
|
|
8020
|
-
// Per native custom element behavior, errors thrown in attributeChangedCallback
|
|
8021
|
-
// become unhandled async errors. We use setTimeout() instead of Promise.resolve()
|
|
8022
|
-
// to make it an unhandled error rather than an unhandled rejection.
|
|
8023
|
-
setTimeout(function () {
|
|
8024
|
-
throw error;
|
|
8025
|
-
});
|
|
8026
|
-
}
|
|
8027
|
-
// Helper to patch `setAttribute`/`getAttribute` to implement `attributeChangedCallback`.
|
|
8028
|
-
// Why is this necessary? Well basically, you can't change the `observedAttributes` after
|
|
8029
|
-
// a custom element is defined. So with pivots, if two classes share the same tag name,
|
|
8030
|
-
// and the second class observes attributes that aren't observed by the first one,
|
|
8031
|
-
// then those attributes can never be observed by the native `observedAttributes` system.
|
|
8032
|
-
// So we have to simulate it by patching `getAttribute`/`removeAttribute`. Note that
|
|
8033
|
-
// we only do this when absolutely necessary, though; i.e. because we've determined
|
|
8034
|
-
// that we aren't observing the attributes we need to.
|
|
8035
|
-
function patchAttributes(instance, registeredDefinition, pivotDefinition) {
|
|
8036
|
-
var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
8037
|
-
if (newObservedAttributes.size === 0) {
|
|
8038
|
-
return;
|
|
8039
|
-
}
|
|
8040
|
-
var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
8041
|
-
// Patch the instance.
|
|
8042
|
-
// Note we use the native `getAttribute` rather than the super's `getAttribute` because
|
|
8043
|
-
// we don't actually want it to be observable that we're calling `getAttribute` from
|
|
8044
|
-
// `setAttribute` and `removeAttribute`.
|
|
8045
|
-
// TODO [#2994]: this should handle reflected properties such as `ariaLabel` and `role`.
|
|
8046
|
-
defineProperties(instance, {
|
|
8047
|
-
setAttribute: {
|
|
8048
|
-
value: function setAttribute(name, value) {
|
|
8049
|
-
if (newObservedAttributes.has(name)) {
|
|
8050
|
-
var old = nativeGetAttribute.call(this, name);
|
|
8051
|
-
nativeSetAttribute.call(this, name, value);
|
|
8052
|
-
try {
|
|
8053
|
-
attributeChangedCallback.call(this, name, old, value + '');
|
|
8054
|
-
} catch (error) {
|
|
8055
|
-
throwAsyncError(error);
|
|
8056
|
-
}
|
|
8057
|
-
} else {
|
|
8058
|
-
nativeSetAttribute.call(this, name, value);
|
|
8059
|
-
}
|
|
8060
|
-
},
|
|
8061
|
-
writable: true,
|
|
8062
|
-
enumerable: true,
|
|
8063
|
-
configurable: true
|
|
8064
|
-
},
|
|
8065
|
-
removeAttribute: {
|
|
8066
|
-
value: function removeAttribute(name) {
|
|
8067
|
-
if (newObservedAttributes.has(name)) {
|
|
8068
|
-
var old = nativeGetAttribute.call(this, name);
|
|
8069
|
-
nativeRemoveAttribute.call(this, name);
|
|
8070
|
-
try {
|
|
8071
|
-
attributeChangedCallback.call(this, name, old, null);
|
|
8072
|
-
} catch (error) {
|
|
8073
|
-
throwAsyncError(error);
|
|
8074
|
-
}
|
|
8075
|
-
} else {
|
|
8076
|
-
nativeRemoveAttribute.call(this, name);
|
|
8077
|
-
}
|
|
8078
|
-
},
|
|
8079
|
-
writable: true,
|
|
8080
|
-
enumerable: true,
|
|
8081
|
-
configurable: true
|
|
8082
|
-
}
|
|
8083
|
-
});
|
|
8084
|
-
}
|
|
8085
|
-
function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
8086
|
-
// The below case patches observed attributes for the case where the HTML element is upgraded
|
|
8087
|
-
// from a pre-existing one in the DOM.
|
|
8088
|
-
var newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
|
|
8089
|
-
if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
|
|
8090
|
-
return;
|
|
8091
|
-
}
|
|
8092
|
-
var attributeChangedCallback = pivotDefinition.attributeChangedCallback;
|
|
8093
|
-
// Approximate observedAttributes from the user class, but only for the new observed attributes
|
|
8094
|
-
newObservedAttributes.forEach(function (name) {
|
|
8095
|
-
if (nativeHasAttribute.call(instance, name)) {
|
|
8096
|
-
var newValue = nativeGetAttribute.call(instance, name);
|
|
8097
|
-
attributeChangedCallback.call(instance, name, null, newValue);
|
|
8098
|
-
}
|
|
8099
|
-
});
|
|
8100
|
-
}
|
|
8101
|
-
// User extends this HTMLElement, which returns the CE being upgraded
|
|
8102
|
-
var upgradingInstance;
|
|
8103
|
-
// Helper to upgrade an instance with a CE definition using "constructor call trick"
|
|
8104
|
-
function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
|
|
8105
|
-
setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
|
|
8106
|
-
definitionForElement.set(instance, pivotDefinition);
|
|
8107
|
-
// attributes patches when needed
|
|
8108
|
-
if (pivotDefinition !== registeredDefinition) {
|
|
8109
|
-
patchAttributes(instance, registeredDefinition, pivotDefinition);
|
|
8110
|
-
}
|
|
8111
|
-
// Tricking the construction path to believe that a new instance is being created,
|
|
8112
|
-
// that way it will execute the super initialization mechanism but the HTMLElement
|
|
8113
|
-
// constructor will reuse the instance by returning the upgradingInstance.
|
|
8114
|
-
// This is by far the most important piece of the puzzle
|
|
8115
|
-
upgradingInstance = instance;
|
|
8116
|
-
// By `new`ing the UserCtor, we now jump to the constructor for the overridden global HTMLElement
|
|
8117
|
-
// The reason this happens is that the UserCtor extends HTMLElement, so it calls the `super()`.
|
|
8118
|
-
// Note that `upgradingInstance` is explicitly handled in the HTMLElement constructor.
|
|
8119
|
-
new pivotDefinition.UserCtor();
|
|
8120
|
-
patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
|
|
8121
|
-
}
|
|
8122
|
-
function isConstructor(constructor) {
|
|
8123
|
-
return isFunction$1(constructor) && isObject(constructor.prototype);
|
|
8124
|
-
}
|
|
8125
|
-
function getOrCreateDefinitionForConstructor(constructor) {
|
|
8126
|
-
if (!isConstructor(constructor)) {
|
|
8127
|
-
throw new TypeError('The referenced constructor is not a constructor.');
|
|
8128
|
-
}
|
|
8129
|
-
var definition = definitionForConstructor.get(constructor);
|
|
8130
|
-
if (!isUndefined$1(definition)) {
|
|
8131
|
-
return definition;
|
|
8132
|
-
}
|
|
8133
|
-
return createDefinitionRecord(constructor);
|
|
8134
|
-
}
|
|
8135
|
-
// Defer a `whenDefined()` callback until an externally-visible custom element is defined
|
|
8136
|
-
function createPendingWhenDefinedCallback(tagName) {
|
|
8137
|
-
return new Promise(function (resolve) {
|
|
8138
|
-
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
8139
|
-
if (isUndefined$1(resolvers)) {
|
|
8140
|
-
resolvers = [];
|
|
8141
|
-
pendingWhenDefinedCallbacks.set(tagName, resolvers);
|
|
8142
|
-
}
|
|
8143
|
-
resolvers.push(resolve);
|
|
8144
|
-
});
|
|
8145
|
-
}
|
|
8146
|
-
// Call any pending `whenDefined()` callbacks
|
|
8147
|
-
function flushPendingWhenDefinedCallbacks(tagName, ctor) {
|
|
8148
|
-
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
8149
|
-
if (!isUndefined$1(resolvers)) {
|
|
8150
|
-
var _iterator9 = _createForOfIteratorHelper(resolvers),
|
|
8151
|
-
_step9;
|
|
8152
|
-
try {
|
|
8153
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
8154
|
-
var resolver = _step9.value;
|
|
8155
|
-
resolver(ctor);
|
|
8156
|
-
}
|
|
8157
|
-
} catch (err) {
|
|
8158
|
-
_iterator9.e(err);
|
|
8159
|
-
} finally {
|
|
8160
|
-
_iterator9.f();
|
|
8161
|
-
}
|
|
8162
|
-
}
|
|
8163
|
-
pendingWhenDefinedCallbacks.delete(tagName);
|
|
8164
|
-
}
|
|
8165
|
-
var _window2 = window,
|
|
8166
|
-
nativeRegistry = _window2.customElements;
|
|
8167
|
-
var nativeDefine = nativeRegistry.define,
|
|
8168
|
-
nativeWhenDefined = nativeRegistry.whenDefined,
|
|
8169
|
-
nativeGet = nativeRegistry.get;
|
|
8170
|
-
// patch for the global registry define mechanism
|
|
8171
|
-
CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
|
|
8172
|
-
if (options && options.extends) {
|
|
8173
|
-
// TODO [#2983]: should we support `extends`?
|
|
8174
|
-
throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
|
|
8175
|
-
}
|
|
8176
|
-
if (globalDefinitionsByTag.has(tagName)) {
|
|
8177
|
-
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"".concat(tagName, "\" has already been used with this registry"));
|
|
8178
|
-
}
|
|
8179
|
-
if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
|
|
8180
|
-
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
|
|
8181
|
-
}
|
|
8182
|
-
var definition = getOrCreateDefinitionForConstructor(constructor);
|
|
8183
|
-
registeredUserCtors.add(constructor);
|
|
8184
|
-
var PivotCtor = pivotCtorByTag.get(tagName);
|
|
8185
|
-
if (isUndefined$1(PivotCtor)) {
|
|
8186
|
-
PivotCtor = createPivotingClass(tagName, definition);
|
|
8187
|
-
// Register a pivoting class which will handle global registry initializations
|
|
8188
|
-
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
8189
|
-
}
|
|
8190
|
-
// Only cache after nativeDefine has been called, because if it throws an error
|
|
8191
|
-
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
8192
|
-
definitionForConstructor.set(constructor, definition);
|
|
8193
|
-
pivotCtorByTag.set(tagName, PivotCtor);
|
|
8194
|
-
globalDefinitionsByTag.set(tagName, definition);
|
|
8195
|
-
globalDefinitionsByClass.set(constructor, definition);
|
|
8196
|
-
// For globally defined custom elements, the definition associated
|
|
8197
|
-
// to the UserCtor has a back-pointer to PivotCtor in case the user
|
|
8198
|
-
// new the UserCtor, so we know how to create the underlying element.
|
|
8199
|
-
definition.PivotCtor = PivotCtor;
|
|
8200
|
-
// Upgrade any elements created in this scope before customElements.define
|
|
8201
|
-
// was called, which should be exhibited by the following steps:
|
|
8202
|
-
// 1) LWC registers a tagName for an LWC component.
|
|
8203
|
-
// 2) Element with same tagName is created with document.createElement()
|
|
8204
|
-
// and inserted into DOM.
|
|
8205
|
-
// 3) customElements.define() is called with tagName and non-LWC constructor.
|
|
8206
|
-
// This requires immediate upgrade when the new global tagName is defined.
|
|
8207
|
-
var awaiting = awaitingUpgrade.get(tagName);
|
|
8208
|
-
if (!isUndefined$1(awaiting)) {
|
|
8209
|
-
awaitingUpgrade.delete(tagName);
|
|
8210
|
-
var _iterator10 = _createForOfIteratorHelper(awaiting),
|
|
8211
|
-
_step10;
|
|
8212
|
-
try {
|
|
8213
|
-
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
8214
|
-
var element = _step10.value;
|
|
8215
|
-
var registeredDefinition = pendingRegistryForElement.get(element);
|
|
8216
|
-
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
8217
|
-
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
8218
|
-
// pendingRegistryForElement when internalUpgrade hasn't run yet.
|
|
8219
|
-
// But just to be safe, we check.
|
|
8220
|
-
if (!isUndefined$1(registeredDefinition)) {
|
|
8221
|
-
pendingRegistryForElement.delete(element);
|
|
8222
|
-
internalUpgrade(element, registeredDefinition, definition);
|
|
8223
|
-
}
|
|
8224
|
-
}
|
|
8225
|
-
} catch (err) {
|
|
8226
|
-
_iterator10.e(err);
|
|
8227
|
-
} finally {
|
|
8228
|
-
_iterator10.f();
|
|
8229
|
-
}
|
|
8230
|
-
}
|
|
8231
|
-
// If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
|
|
8232
|
-
flushPendingWhenDefinedCallbacks(tagName, constructor);
|
|
8233
|
-
};
|
|
8234
|
-
CustomElementRegistry.prototype.get = function get(tagName) {
|
|
8235
|
-
var NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
8236
|
-
if (!isUndefined$1(NativeCtor)) {
|
|
8237
|
-
var definition = globalDefinitionsByTag.get(tagName);
|
|
8238
|
-
if (!isUndefined$1(definition)) {
|
|
8239
|
-
return definition.UserCtor; // defined by the patched custom elements registry
|
|
8240
|
-
}
|
|
8241
|
-
|
|
8242
|
-
if (registeredPivotCtors.has(NativeCtor)) {
|
|
8243
|
-
return undefined; // pivot constructors should not be observable, return undefined
|
|
8244
|
-
}
|
|
8245
|
-
|
|
8246
|
-
return NativeCtor; // constructor that existed before patching
|
|
8247
|
-
}
|
|
8248
|
-
};
|
|
8249
|
-
|
|
8250
|
-
CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
|
|
8251
|
-
return nativeWhenDefined.call(nativeRegistry, tagName).then(function (NativeCtor) {
|
|
8252
|
-
var definition = globalDefinitionsByTag.get(tagName);
|
|
8253
|
-
if (!isUndefined$1(definition)) {
|
|
8254
|
-
return definition.UserCtor;
|
|
8255
|
-
}
|
|
8256
|
-
// In this case, the custom element must have been defined before the registry patches
|
|
8257
|
-
// were applied. So return the non-pivot constructor
|
|
8258
|
-
if (isUndefined$1(NativeCtor)) {
|
|
8259
|
-
// Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1335247
|
|
8260
|
-
// We can patch the correct behavior using customElements.get()
|
|
8261
|
-
NativeCtor = nativeGet.call(nativeRegistry, tagName);
|
|
8262
|
-
}
|
|
8263
|
-
if (registeredPivotCtors.has(NativeCtor)) {
|
|
8264
|
-
// Pivot constructors should not be observable. Wait to resolve the promise
|
|
8265
|
-
// if a constructor is ever defined in userland
|
|
8266
|
-
return createPendingWhenDefinedCallback(tagName);
|
|
8267
|
-
}
|
|
8268
|
-
return NativeCtor;
|
|
8269
|
-
});
|
|
8270
|
-
};
|
|
8271
|
-
// This constructor is invoked when we call `new pivotDefinition.UserCtor()`
|
|
8272
|
-
// @ts-ignore
|
|
8273
|
-
window.HTMLElement = function HTMLElement() {
|
|
8274
|
-
// Upgrading case: the pivoting class constructor was run by the browser's
|
|
8275
|
-
// native custom elements and we're in the process of running the
|
|
8276
|
-
// "constructor-call trick" on the natively constructed instance, so just
|
|
8277
|
-
// return that here.
|
|
8278
|
-
// This code path is also called when LWC `new`s a PivotCtor.
|
|
8279
|
-
var instance = upgradingInstance;
|
|
8280
|
-
if (!isUndefined$1(instance)) {
|
|
8281
|
-
upgradingInstance = undefined;
|
|
8282
|
-
return instance;
|
|
8283
|
-
}
|
|
8284
|
-
// Construction case: we need to construct the pivoting instance and return it.
|
|
8285
|
-
// This is possible when the user register it via global registry and instantiate
|
|
8286
|
-
// it via `new Ctor()`.
|
|
8287
|
-
var constructor = this.constructor;
|
|
8288
|
-
var definition = globalDefinitionsByClass.get(constructor);
|
|
8289
|
-
if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
|
|
8290
|
-
// This code path is hit if someone `new`s a class that extends `HTMLElement` without
|
|
8291
|
-
// doing `customElements.define()` first. This matches native browser behavior:
|
|
8292
|
-
// https://stackoverflow.com/a/61883392
|
|
8293
|
-
throw new TypeError('Illegal constructor');
|
|
8294
|
-
}
|
|
8295
|
-
// This constructor is ONLY invoked when it is the user instantiating
|
|
8296
|
-
// an element via new Ctor while Ctor is a registered global constructor.
|
|
8297
|
-
var PivotCtor = definition.PivotCtor,
|
|
8298
|
-
UserCtor = definition.UserCtor;
|
|
8299
|
-
return new PivotCtor(UserCtor);
|
|
8300
|
-
};
|
|
8301
|
-
HTMLElement.prototype = NativeHTMLElement.prototype;
|
|
8302
|
-
/**
|
|
8303
|
-
* Create a new PivotConstructor for the given tagName, which is capable of being constructed
|
|
8304
|
-
* with a UserConstructor defining the behavior. Passing in the UserConstructor here
|
|
8305
|
-
* is a hint that can be used when registering a custom element with the global custom elements
|
|
8306
|
-
* registry for the first time, which provides certain optimizations. It also marks the UserConstructor
|
|
8307
|
-
* as "safe" to be used when passed in to a PivotConstructor.
|
|
8308
|
-
*
|
|
8309
|
-
* @param tagName - element tag name
|
|
8310
|
-
* @param UserCtor - userland custom element constructor
|
|
8311
|
-
* @returns a new custom element constructor
|
|
8312
|
-
*/
|
|
8313
|
-
return function createPivotConstructor(tagName, UserCtor) {
|
|
8314
|
-
tagName = StringToLowerCase.call(tagName);
|
|
8315
|
-
var PivotCtor = pivotCtorByTag.get(tagName);
|
|
8316
|
-
if (isUndefined$1(PivotCtor)) {
|
|
8317
|
-
var definition = getOrCreateDefinitionForConstructor(UserCtor);
|
|
8318
|
-
PivotCtor = createPivotingClass(tagName, definition);
|
|
8319
|
-
// Register a pivoting class as a global custom element
|
|
8320
|
-
nativeDefine.call(nativeRegistry, tagName, PivotCtor);
|
|
8321
|
-
definition.PivotCtor = PivotCtor;
|
|
8322
|
-
// Only cache after nativeDefine has been called, because if it throws an error
|
|
8323
|
-
// (e.g. for an invalid tag name), then we don't want to cache anything.
|
|
8324
|
-
definitionForConstructor.set(UserCtor, definition);
|
|
8325
|
-
pivotCtorByTag.set(tagName, PivotCtor);
|
|
8326
|
-
}
|
|
8327
|
-
// Register a UserConstructor as "safe" to be used within a PivotConstructor
|
|
8328
|
-
registeredUserCtors.add(UserCtor);
|
|
8329
|
-
return PivotCtor;
|
|
8330
|
-
};
|
|
8331
|
-
}
|
|
8332
|
-
|
|
8333
|
-
/*
|
|
8334
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
8335
|
-
* All rights reserved.
|
|
8336
|
-
* SPDX-License-Identifier: MIT
|
|
8337
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8338
|
-
*/
|
|
8339
|
-
var createScopedConstructor;
|
|
8340
|
-
var CachedHTMLElement;
|
|
8341
|
-
// We only call `createScopedRegistry()` if the browser supports custom elements and
|
|
8342
|
-
// ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
|
|
8343
|
-
// or we're in a legacy browser.
|
|
8344
|
-
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
8345
|
-
if (hasCustomElements) {
|
|
8346
|
-
// If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
|
|
8347
|
-
// It's assumed that ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is set *before* LWC loads, and never changes.
|
|
8348
|
-
//
|
|
8349
|
-
// Why not lazily patch in `createCustomElement`? Well, this could lead to subtle bugs, e.g.:
|
|
8350
|
-
//
|
|
8351
|
-
// 1. LWC loads
|
|
8352
|
-
// 2. `const Ctor = class extends HTMLElement {}`
|
|
8353
|
-
// 3. `lwc.createElement(...)` // here we lazily patch
|
|
8354
|
-
// 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
|
|
8355
|
-
//
|
|
8356
|
-
// To reduce the risk of this, it's safer to patch the registry eagerly.
|
|
8357
|
-
createScopedConstructor = createScopedRegistry();
|
|
8358
|
-
// It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
|
|
8359
|
-
// another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
|
|
8360
|
-
// because the HTMLElement prototypes are mixed up.
|
|
8361
|
-
//
|
|
8362
|
-
// The reason this happens is that the scoping implementation overwrites window.HTMLElement and expects to work
|
|
8363
|
-
// with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
|
|
8364
|
-
// the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
|
|
8365
|
-
// Caching avoids this problem.
|
|
8366
|
-
CachedHTMLElement = window.HTMLElement;
|
|
8367
|
-
}
|
|
8368
|
-
}
|
|
8369
|
-
// Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
|
|
8370
|
-
// In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
|
|
8371
|
-
// multiple times per tag name.
|
|
8372
|
-
var createUserConstructor = function createUserConstructor(HTMLElementToExtend, upgradeCallback, _connectedCallback, _disconnectedCallback) {
|
|
8373
|
-
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
8374
|
-
return /*#__PURE__*/function (_HTMLElementToExtend) {
|
|
8375
|
-
_inherits(UserConstructor, _HTMLElementToExtend);
|
|
8376
|
-
var _super8 = _createSuper(UserConstructor);
|
|
8377
|
-
function UserConstructor() {
|
|
8378
|
-
var _this5;
|
|
8379
|
-
_classCallCheck(this, UserConstructor);
|
|
8380
|
-
_this5 = _super8.call(this);
|
|
8381
|
-
upgradeCallback(_assertThisInitialized(_this5));
|
|
8382
|
-
return _this5;
|
|
8383
|
-
}
|
|
8384
|
-
// Note that there is no need to do the "avoid defining connectedCallback/disconnectedCallback" optimization
|
|
8385
|
-
// here, because in create-scoped-registry.ts, the registered class will always have these callbacks anyway.
|
|
8386
|
-
// See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
|
|
8387
|
-
_createClass(UserConstructor, [{
|
|
8388
|
-
key: "connectedCallback",
|
|
8389
|
-
value: function connectedCallback() {
|
|
8390
|
-
if (!isUndefined$1(_connectedCallback)) {
|
|
8391
|
-
_connectedCallback(this);
|
|
8392
|
-
}
|
|
8393
|
-
}
|
|
8394
|
-
}, {
|
|
8395
|
-
key: "disconnectedCallback",
|
|
8396
|
-
value: function disconnectedCallback() {
|
|
8397
|
-
if (!isUndefined$1(_disconnectedCallback)) {
|
|
8398
|
-
_disconnectedCallback(this);
|
|
8399
|
-
}
|
|
8400
|
-
}
|
|
8401
|
-
}]);
|
|
8402
|
-
return UserConstructor;
|
|
8403
|
-
}(HTMLElementToExtend);
|
|
8404
|
-
};
|
|
8405
|
-
function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
|
|
8406
|
-
if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
|
|
8407
|
-
// This error should be impossible to hit
|
|
8408
|
-
throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
|
|
8409
|
-
}
|
|
8410
|
-
var UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
8411
|
-
var ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
|
|
8412
|
-
return new ScopedConstructor(UserConstructor);
|
|
8413
|
-
}
|
|
8414
|
-
|
|
8415
7977
|
/*
|
|
8416
7978
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
8417
7979
|
* All rights reserved.
|
|
@@ -8419,26 +7981,18 @@
|
|
|
8419
7981
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8420
7982
|
*/
|
|
8421
7983
|
/**
|
|
8422
|
-
* We have
|
|
7984
|
+
* We have two modes for creating custom elements:
|
|
8423
7985
|
*
|
|
8424
7986
|
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
8425
7987
|
* 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
|
|
8426
7988
|
* via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
|
|
8427
7989
|
* a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
|
|
8428
7990
|
* constructor"), which allows us to have completely customized functionality for different components.
|
|
8429
|
-
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
8430
|
-
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
8431
|
-
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
8432
|
-
* because it must patch the global `customElements` and `HTMLElement` objects.
|
|
8433
7991
|
*/
|
|
8434
7992
|
var createCustomElement;
|
|
8435
7993
|
if (hasCustomElements) {
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
} else {
|
|
8439
|
-
// use the global registry, with an upgradable constructor for the defined custom element
|
|
8440
|
-
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
8441
|
-
}
|
|
7994
|
+
// use the global registry, with an upgradable constructor for the defined custom element
|
|
7995
|
+
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
8442
7996
|
} else {
|
|
8443
7997
|
// no registry available here
|
|
8444
7998
|
createCustomElement = createCustomElementCompat;
|
|
@@ -8502,7 +8056,7 @@
|
|
|
8502
8056
|
function isNull(obj) {
|
|
8503
8057
|
return obj === null;
|
|
8504
8058
|
}
|
|
8505
|
-
/** version: 2.
|
|
8059
|
+
/** version: 2.37.0 */
|
|
8506
8060
|
|
|
8507
8061
|
/*
|
|
8508
8062
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8580,7 +8134,7 @@
|
|
|
8580
8134
|
doc.body.innerHTML = html;
|
|
8581
8135
|
var content = doc.body;
|
|
8582
8136
|
if (!isUndefined(wrapperTags)) {
|
|
8583
|
-
for (var
|
|
8137
|
+
for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
|
|
8584
8138
|
content = content.firstChild;
|
|
8585
8139
|
}
|
|
8586
8140
|
}
|
|
@@ -8773,8 +8327,8 @@
|
|
|
8773
8327
|
tagName: element.tagName.toLowerCase(),
|
|
8774
8328
|
hydrated: true
|
|
8775
8329
|
});
|
|
8776
|
-
for (var
|
|
8777
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
8330
|
+
for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
|
|
8331
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
|
|
8778
8332
|
key = _Object$entries2$_i[0],
|
|
8779
8333
|
value = _Object$entries2$_i[1];
|
|
8780
8334
|
element[key] = value;
|
|
@@ -8851,23 +8405,23 @@
|
|
|
8851
8405
|
var _attributeChangedCallback = HtmlPrototype.prototype.attributeChangedCallback;
|
|
8852
8406
|
return _a = /*#__PURE__*/function (_HTMLElement2) {
|
|
8853
8407
|
_inherits(_a, _HTMLElement2);
|
|
8854
|
-
var
|
|
8408
|
+
var _super7 = _createSuper(_a);
|
|
8855
8409
|
function _a() {
|
|
8856
|
-
var
|
|
8410
|
+
var _this4;
|
|
8857
8411
|
_classCallCheck(this, _a);
|
|
8858
|
-
|
|
8859
|
-
if (
|
|
8412
|
+
_this4 = _super7.call(this);
|
|
8413
|
+
if (_this4.isConnected) {
|
|
8860
8414
|
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
8861
|
-
hydrateComponent(_assertThisInitialized(
|
|
8862
|
-
hydratedCustomElements.add(_assertThisInitialized(
|
|
8415
|
+
hydrateComponent(_assertThisInitialized(_this4), Ctor, {});
|
|
8416
|
+
hydratedCustomElements.add(_assertThisInitialized(_this4));
|
|
8863
8417
|
} else {
|
|
8864
|
-
createVM(_assertThisInitialized(
|
|
8418
|
+
createVM(_assertThisInitialized(_this4), Ctor, renderer, {
|
|
8865
8419
|
mode: 'open',
|
|
8866
8420
|
owner: null,
|
|
8867
|
-
tagName:
|
|
8421
|
+
tagName: _this4.tagName
|
|
8868
8422
|
});
|
|
8869
8423
|
}
|
|
8870
|
-
return
|
|
8424
|
+
return _this4;
|
|
8871
8425
|
}
|
|
8872
8426
|
_createClass(_a, [{
|
|
8873
8427
|
key: "connectedCallback",
|
|
@@ -9068,7 +8622,7 @@
|
|
|
9068
8622
|
});
|
|
9069
8623
|
freeze(LightningElement);
|
|
9070
8624
|
seal(LightningElement.prototype);
|
|
9071
|
-
/* version: 2.
|
|
8625
|
+
/* version: 2.37.0 */
|
|
9072
8626
|
|
|
9073
8627
|
exports.LightningElement = LightningElement;
|
|
9074
8628
|
exports.__unstable__ProfilerControl = profilerControl;
|