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