lwc 2.34.0 → 2.35.1
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 +939 -763
- package/dist/engine-dom/iife/es2017/engine-dom.js +939 -762
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +846 -684
- package/dist/engine-dom/iife/es5/engine-dom.js +1115 -922
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +801 -619
- package/dist/engine-dom/umd/es2017/engine-dom.js +939 -762
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +846 -684
- package/dist/engine-dom/umd/es5/engine-dom.js +1115 -922
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +801 -619
- package/dist/engine-server/commonjs/es2017/engine-server.js +1025 -1082
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +1025 -1082
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +21 -41
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +21 -41
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +20 -39
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +24 -38
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +23 -36
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +21 -41
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +20 -39
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +24 -38
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +23 -36
- 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
|
@@ -15,11 +15,6 @@
|
|
|
15
15
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
16
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
17
|
function _getPrototypeOf2(o) { _getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf2(o); }
|
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
20
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
18
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
24
19
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
20
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -28,6 +23,11 @@
|
|
|
28
23
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
24
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
30
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
30
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
31
31
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
32
32
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
33
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
var _String$prototype = String.prototype,
|
|
110
110
|
StringCharCodeAt = _String$prototype.charCodeAt,
|
|
111
111
|
StringReplace = _String$prototype.replace,
|
|
112
|
+
StringSplit = _String$prototype.split,
|
|
112
113
|
StringSlice = _String$prototype.slice,
|
|
113
114
|
StringToLowerCase = _String$prototype.toLowerCase;
|
|
114
115
|
function isUndefined$1(obj) {
|
|
@@ -204,6 +205,9 @@
|
|
|
204
205
|
}(),
|
|
205
206
|
AriaAttrNameToPropNameMap = _ref.AriaAttrNameToPropNameMap,
|
|
206
207
|
AriaPropNameToAttrNameMap = _ref.AriaPropNameToAttrNameMap;
|
|
208
|
+
// These attributes take either an ID or a list of IDs as values.
|
|
209
|
+
// This includes aria-* attributes as well as the special non-ARIA "for" attribute
|
|
210
|
+
var ID_REFERENCING_ATTRIBUTES_SET = new Set(['aria-activedescendant', 'aria-controls', 'aria-describedby', 'aria-details', 'aria-errormessage', 'aria-flowto', 'aria-labelledby', 'aria-owns', 'for']);
|
|
207
211
|
|
|
208
212
|
/*
|
|
209
213
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -211,39 +215,11 @@
|
|
|
211
215
|
* SPDX-License-Identifier: MIT
|
|
212
216
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
213
217
|
*/
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
var _globalThis;
|
|
221
|
-
try {
|
|
222
|
-
// eslint-disable-next-line no-extend-native
|
|
223
|
-
Object.defineProperty(Object.prototype, '__magic__', {
|
|
224
|
-
get: function get() {
|
|
225
|
-
return this;
|
|
226
|
-
},
|
|
227
|
-
configurable: true
|
|
228
|
-
});
|
|
229
|
-
// __magic__ is undefined in Safari 10 and IE10 and older.
|
|
230
|
-
// @ts-ignore
|
|
231
|
-
// eslint-disable-next-line no-undef
|
|
232
|
-
_globalThis = __magic__;
|
|
233
|
-
// @ts-ignore
|
|
234
|
-
delete Object.prototype.__magic__;
|
|
235
|
-
} catch (ex) {
|
|
236
|
-
// In IE8, Object.defineProperty only works on DOM objects.
|
|
237
|
-
} finally {
|
|
238
|
-
// If the magic above fails for some reason we assume that we are in a legacy browser.
|
|
239
|
-
// Assume `window` exists in this case.
|
|
240
|
-
if (typeof _globalThis === 'undefined') {
|
|
241
|
-
// @ts-ignore
|
|
242
|
-
_globalThis = window;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return _globalThis;
|
|
246
|
-
}();
|
|
218
|
+
// See browser support for globalThis:
|
|
219
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
|
|
220
|
+
/* istanbul ignore next */
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
var _globalThis = (typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object' ? globalThis : window;
|
|
247
223
|
|
|
248
224
|
/*
|
|
249
225
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -257,6 +233,8 @@
|
|
|
257
233
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
258
234
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
259
235
|
var KEY__SCOPED_CSS = '$scoped$';
|
|
236
|
+
var KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
237
|
+
var KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
260
238
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
261
239
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
262
240
|
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -352,9 +330,9 @@
|
|
|
352
330
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
353
331
|
*/
|
|
354
332
|
// Increment whenever the LWC template compiler changes
|
|
355
|
-
var LWC_VERSION = "2.
|
|
333
|
+
var LWC_VERSION = "2.35.1";
|
|
356
334
|
var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
357
|
-
/** version: 2.
|
|
335
|
+
/** version: 2.35.1 */
|
|
358
336
|
|
|
359
337
|
/**
|
|
360
338
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -408,7 +386,8 @@
|
|
|
408
386
|
console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
|
|
409
387
|
return;
|
|
410
388
|
}
|
|
411
|
-
|
|
389
|
+
// This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
|
|
390
|
+
if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
|
|
412
391
|
// Allow the same flag to be set more than once outside of production to enable testing
|
|
413
392
|
lwcRuntimeFlags[name] = value;
|
|
414
393
|
} else {
|
|
@@ -429,11 +408,12 @@
|
|
|
429
408
|
* purposes. It is a no-op when invoked in production mode.
|
|
430
409
|
*/
|
|
431
410
|
function setFeatureFlagForTest(name, value) {
|
|
432
|
-
|
|
411
|
+
// This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
|
|
412
|
+
if (process.env.NODE_ENV === 'test-karma-lwc' || process.env.NODE_ENV !== 'production') {
|
|
433
413
|
setFeatureFlag(name, value);
|
|
434
414
|
}
|
|
435
415
|
}
|
|
436
|
-
/** version: 2.
|
|
416
|
+
/** version: 2.35.1 */
|
|
437
417
|
|
|
438
418
|
/**
|
|
439
419
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -497,7 +477,7 @@
|
|
|
497
477
|
}
|
|
498
478
|
}
|
|
499
479
|
}
|
|
500
|
-
/** version: 2.
|
|
480
|
+
/** version: 2.35.1 */
|
|
501
481
|
|
|
502
482
|
/*
|
|
503
483
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -518,8 +498,7 @@
|
|
|
518
498
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
519
499
|
*/
|
|
520
500
|
// Only used in LWC's Karma tests
|
|
521
|
-
|
|
522
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
501
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
523
502
|
window.addEventListener('test-dummy-flag', function () {
|
|
524
503
|
var hasFlag = false;
|
|
525
504
|
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
@@ -543,8 +522,7 @@
|
|
|
543
522
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
544
523
|
*/
|
|
545
524
|
// Only used in LWC's Karma tests
|
|
546
|
-
|
|
547
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
525
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
548
526
|
window.addEventListener('test-dummy-flag', function () {
|
|
549
527
|
var hasFlag = false;
|
|
550
528
|
if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
@@ -565,113 +543,173 @@
|
|
|
565
543
|
* SPDX-License-Identifier: MIT
|
|
566
544
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
567
545
|
*/
|
|
568
|
-
|
|
569
|
-
var
|
|
570
|
-
|
|
571
|
-
var
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
546
|
+
/** Callbacks to invoke when reporting is enabled **/
|
|
547
|
+
var onReportingEnabledCallbacks = [];
|
|
548
|
+
/** The currently assigned reporting dispatcher. */
|
|
549
|
+
var currentDispatcher$1 = noop;
|
|
550
|
+
/**
|
|
551
|
+
* Whether reporting is enabled.
|
|
552
|
+
*
|
|
553
|
+
* Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
|
|
554
|
+
* but it turns out that Terser only strips out unused code if we use this explicit boolean.
|
|
555
|
+
*/
|
|
556
|
+
var enabled$1 = false;
|
|
557
|
+
var reportingControl = {
|
|
558
|
+
/**
|
|
559
|
+
* Attach a new reporting control (aka dispatcher).
|
|
560
|
+
*
|
|
561
|
+
* @param dispatcher - reporting control
|
|
562
|
+
*/
|
|
563
|
+
attachDispatcher: function attachDispatcher(dispatcher) {
|
|
564
|
+
enabled$1 = true;
|
|
565
|
+
currentDispatcher$1 = dispatcher;
|
|
566
|
+
var _iterator = _createForOfIteratorHelper(onReportingEnabledCallbacks),
|
|
567
|
+
_step;
|
|
568
|
+
try {
|
|
569
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
570
|
+
var callback = _step.value;
|
|
571
|
+
try {
|
|
572
|
+
callback();
|
|
573
|
+
} catch (err) {
|
|
574
|
+
// This should never happen. But if it does, we don't want one callback to cause another to fail
|
|
575
|
+
// eslint-disable-next-line no-console
|
|
576
|
+
console.error('Could not invoke callback', err);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
} catch (err) {
|
|
580
|
+
_iterator.e(err);
|
|
581
|
+
} finally {
|
|
582
|
+
_iterator.f();
|
|
576
583
|
}
|
|
584
|
+
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
585
|
+
},
|
|
586
|
+
/**
|
|
587
|
+
* Detach the current reporting control (aka dispatcher).
|
|
588
|
+
*/
|
|
589
|
+
detachDispatcher: function detachDispatcher() {
|
|
590
|
+
enabled$1 = false;
|
|
591
|
+
currentDispatcher$1 = noop;
|
|
577
592
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* Call a callback when reporting is enabled, or immediately if reporting is already enabled.
|
|
596
|
+
* Will only ever be called once.
|
|
597
|
+
* @param callback
|
|
598
|
+
*/
|
|
599
|
+
function onReportingEnabled(callback) {
|
|
600
|
+
if (enabled$1) {
|
|
601
|
+
// call immediately
|
|
602
|
+
callback();
|
|
603
|
+
} else {
|
|
604
|
+
// call later
|
|
605
|
+
onReportingEnabledCallbacks.push(callback);
|
|
582
606
|
}
|
|
583
607
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
608
|
+
/**
|
|
609
|
+
* Report to the current dispatcher, if there is one.
|
|
610
|
+
* @param reportingEventId
|
|
611
|
+
* @param vm
|
|
612
|
+
*/
|
|
613
|
+
function report(reportingEventId, vm) {
|
|
614
|
+
if (enabled$1) {
|
|
615
|
+
currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
|
|
589
616
|
}
|
|
590
|
-
|
|
591
|
-
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/*
|
|
620
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
621
|
+
* All rights reserved.
|
|
622
|
+
* SPDX-License-Identifier: MIT
|
|
623
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
624
|
+
*/
|
|
625
|
+
function getComponentTag(vm) {
|
|
626
|
+
return "<".concat(StringToLowerCase.call(vm.tagName), ">");
|
|
627
|
+
}
|
|
628
|
+
// TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
629
|
+
function getComponentStack(vm) {
|
|
630
|
+
var stack = [];
|
|
631
|
+
var prefix = '';
|
|
632
|
+
while (!isNull(vm.owner)) {
|
|
633
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
634
|
+
vm = vm.owner;
|
|
635
|
+
prefix += '\t';
|
|
592
636
|
}
|
|
593
|
-
|
|
637
|
+
return ArrayJoin.call(stack, '\n');
|
|
594
638
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
597
|
-
|
|
639
|
+
function getErrorComponentStack(vm) {
|
|
640
|
+
var wcStack = [];
|
|
641
|
+
var currentVm = vm;
|
|
642
|
+
while (!isNull(currentVm)) {
|
|
643
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
644
|
+
currentVm = currentVm.owner;
|
|
598
645
|
}
|
|
599
|
-
return
|
|
646
|
+
return wcStack.reverse().join('\n\t');
|
|
600
647
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
615
|
-
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
616
|
-
prop = _declaration$split2[0],
|
|
617
|
-
value = _declaration$split2[1];
|
|
618
|
-
if (prop !== undefined && value !== undefined) {
|
|
619
|
-
styleMap[prop.trim()] = value.trim();
|
|
620
|
-
}
|
|
648
|
+
|
|
649
|
+
/*
|
|
650
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
651
|
+
* All rights reserved.
|
|
652
|
+
* SPDX-License-Identifier: MIT
|
|
653
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
654
|
+
*/
|
|
655
|
+
function addErrorComponentStack(vm, error) {
|
|
656
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
657
|
+
var wcStack = getErrorComponentStack(vm);
|
|
658
|
+
defineProperty(error, 'wcStack', {
|
|
659
|
+
get: function get() {
|
|
660
|
+
return wcStack;
|
|
621
661
|
}
|
|
622
|
-
}
|
|
623
|
-
} catch (err) {
|
|
624
|
-
_iterator.e(err);
|
|
625
|
-
} finally {
|
|
626
|
-
_iterator.f();
|
|
662
|
+
});
|
|
627
663
|
}
|
|
628
|
-
return styleMap;
|
|
629
664
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
665
|
+
|
|
666
|
+
/*
|
|
667
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
668
|
+
* All rights reserved.
|
|
669
|
+
* SPDX-License-Identifier: MIT
|
|
670
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
671
|
+
*/
|
|
672
|
+
var alreadyLoggedMessages = new Set();
|
|
673
|
+
// Only used in LWC's Karma tests
|
|
674
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
675
|
+
// @ts-ignore
|
|
676
|
+
window.__lwcResetAlreadyLoggedMessages = function () {
|
|
677
|
+
alreadyLoggedMessages.clear();
|
|
678
|
+
};
|
|
640
679
|
}
|
|
641
|
-
function
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
list.push(stylesheet);
|
|
650
|
-
} else {
|
|
651
|
-
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
652
|
-
}
|
|
680
|
+
function log(method, message, vm, once) {
|
|
681
|
+
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
682
|
+
if (!isUndefined$1(vm)) {
|
|
683
|
+
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
684
|
+
}
|
|
685
|
+
if (once) {
|
|
686
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
687
|
+
return;
|
|
653
688
|
}
|
|
654
|
-
|
|
655
|
-
_iterator2.e(err);
|
|
656
|
-
} finally {
|
|
657
|
-
_iterator2.f();
|
|
689
|
+
alreadyLoggedMessages.add(msg);
|
|
658
690
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
throw new Error('refVNodes must be defined when setting a ref');
|
|
691
|
+
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
692
|
+
if (process.env.NODE_ENV === 'test') {
|
|
693
|
+
/* eslint-disable-next-line no-console */
|
|
694
|
+
console[method](msg);
|
|
695
|
+
return;
|
|
665
696
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
672
|
-
refVNodes[ref] = vnode;
|
|
697
|
+
try {
|
|
698
|
+
throw new Error(msg);
|
|
699
|
+
} catch (e) {
|
|
700
|
+
/* eslint-disable-next-line no-console */
|
|
701
|
+
console[method](e);
|
|
673
702
|
}
|
|
674
703
|
}
|
|
704
|
+
function logError(message, vm) {
|
|
705
|
+
log('error', message, vm, false);
|
|
706
|
+
}
|
|
707
|
+
function logWarn(message, vm) {
|
|
708
|
+
log('warn', message, vm, false);
|
|
709
|
+
}
|
|
710
|
+
function logWarnOnce(message, vm) {
|
|
711
|
+
log('warn', message, vm, true);
|
|
712
|
+
}
|
|
675
713
|
|
|
676
714
|
/*
|
|
677
715
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -695,8 +733,8 @@
|
|
|
695
733
|
if (!isUndefined$1(reactiveRecord)) {
|
|
696
734
|
var reactiveObservers = reactiveRecord[key];
|
|
697
735
|
if (!isUndefined$1(reactiveObservers)) {
|
|
698
|
-
for (var
|
|
699
|
-
var ro = reactiveObservers[
|
|
736
|
+
for (var _i3 = 0, len = reactiveObservers.length; _i3 < len; _i3 += 1) {
|
|
737
|
+
var ro = reactiveObservers[_i3];
|
|
700
738
|
ro.notify();
|
|
701
739
|
}
|
|
702
740
|
}
|
|
@@ -755,9 +793,9 @@
|
|
|
755
793
|
var listeners = this.listeners;
|
|
756
794
|
var len = listeners.length;
|
|
757
795
|
if (len > 0) {
|
|
758
|
-
for (var
|
|
759
|
-
var set = listeners[
|
|
760
|
-
var pos = ArrayIndexOf.call(listeners[
|
|
796
|
+
for (var _i4 = 0; _i4 < len; _i4 += 1) {
|
|
797
|
+
var set = listeners[_i4];
|
|
798
|
+
var pos = ArrayIndexOf.call(listeners[_i4], this);
|
|
761
799
|
ArraySplice.call(set, pos, 1);
|
|
762
800
|
}
|
|
763
801
|
listeners.length = 0;
|
|
@@ -802,76 +840,120 @@
|
|
|
802
840
|
* SPDX-License-Identifier: MIT
|
|
803
841
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
804
842
|
*/
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
function
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
843
|
+
var nextTickCallbackQueue = [];
|
|
844
|
+
var SPACE_CHAR = 32;
|
|
845
|
+
var EmptyObject = seal(create(null));
|
|
846
|
+
var EmptyArray = seal([]);
|
|
847
|
+
function flushCallbackQueue() {
|
|
848
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
849
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
850
|
+
throw new Error("Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.");
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
var callbacks = nextTickCallbackQueue;
|
|
854
|
+
nextTickCallbackQueue = []; // reset to a new queue
|
|
855
|
+
for (var _i5 = 0, len = callbacks.length; _i5 < len; _i5 += 1) {
|
|
856
|
+
callbacks[_i5]();
|
|
816
857
|
}
|
|
817
|
-
return ArrayJoin.call(stack, '\n');
|
|
818
858
|
}
|
|
819
|
-
function
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
currentVm = currentVm.owner;
|
|
859
|
+
function addCallbackToNextTick(callback) {
|
|
860
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
861
|
+
if (!isFunction$1(callback)) {
|
|
862
|
+
throw new Error("Internal Error: addCallbackToNextTick() can only accept a function callback");
|
|
863
|
+
}
|
|
825
864
|
}
|
|
826
|
-
|
|
865
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
866
|
+
Promise.resolve().then(flushCallbackQueue);
|
|
867
|
+
}
|
|
868
|
+
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
827
869
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
* All rights reserved.
|
|
832
|
-
* SPDX-License-Identifier: MIT
|
|
833
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
834
|
-
*/
|
|
835
|
-
function addErrorComponentStack(vm, error) {
|
|
836
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
837
|
-
var wcStack = getErrorComponentStack(vm);
|
|
838
|
-
defineProperty(error, 'wcStack', {
|
|
839
|
-
get: function get() {
|
|
840
|
-
return wcStack;
|
|
841
|
-
}
|
|
842
|
-
});
|
|
870
|
+
function guid() {
|
|
871
|
+
function s4() {
|
|
872
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
843
873
|
}
|
|
874
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
844
875
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
876
|
+
// Borrowed from Vue template compiler.
|
|
877
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
878
|
+
var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
879
|
+
var PROPERTY_DELIMITER = /:(.+)/;
|
|
880
|
+
function parseStyleText(cssText) {
|
|
881
|
+
var styleMap = {};
|
|
882
|
+
var declarations = cssText.split(DECLARATION_DELIMITER);
|
|
883
|
+
var _iterator2 = _createForOfIteratorHelper(declarations),
|
|
884
|
+
_step2;
|
|
885
|
+
try {
|
|
886
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
887
|
+
var declaration = _step2.value;
|
|
888
|
+
if (declaration) {
|
|
889
|
+
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
890
|
+
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
891
|
+
prop = _declaration$split2[0],
|
|
892
|
+
value = _declaration$split2[1];
|
|
893
|
+
if (prop !== undefined && value !== undefined) {
|
|
894
|
+
styleMap[prop.trim()] = value.trim();
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
} catch (err) {
|
|
899
|
+
_iterator2.e(err);
|
|
900
|
+
} finally {
|
|
901
|
+
_iterator2.f();
|
|
856
902
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
903
|
+
return styleMap;
|
|
904
|
+
}
|
|
905
|
+
// Make a shallow copy of an object but omit the given key
|
|
906
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
907
|
+
var result = {};
|
|
908
|
+
for (var _i6 = 0, _Object$keys = Object.keys(object); _i6 < _Object$keys.length; _i6++) {
|
|
909
|
+
var key = _Object$keys[_i6];
|
|
910
|
+
if (key !== keyToOmit) {
|
|
911
|
+
result[key] = object[key];
|
|
912
|
+
}
|
|
862
913
|
}
|
|
914
|
+
return result;
|
|
915
|
+
}
|
|
916
|
+
function flattenStylesheets(stylesheets) {
|
|
917
|
+
var list = [];
|
|
918
|
+
var _iterator3 = _createForOfIteratorHelper(stylesheets),
|
|
919
|
+
_step3;
|
|
863
920
|
try {
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
921
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
922
|
+
var stylesheet = _step3.value;
|
|
923
|
+
if (!Array.isArray(stylesheet)) {
|
|
924
|
+
list.push(stylesheet);
|
|
925
|
+
} else {
|
|
926
|
+
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
} catch (err) {
|
|
930
|
+
_iterator3.e(err);
|
|
931
|
+
} finally {
|
|
932
|
+
_iterator3.f();
|
|
868
933
|
}
|
|
934
|
+
return list;
|
|
869
935
|
}
|
|
870
|
-
|
|
871
|
-
|
|
936
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
937
|
+
function setRefVNode(vm, ref, vnode) {
|
|
938
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
939
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
940
|
+
}
|
|
941
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
942
|
+
// If not, then something went wrong and we threw an error above.
|
|
943
|
+
var refVNodes = vm.refVNodes;
|
|
944
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
945
|
+
// in depth-first traversal order.
|
|
946
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
947
|
+
refVNodes[ref] = vnode;
|
|
948
|
+
}
|
|
872
949
|
}
|
|
873
|
-
|
|
874
|
-
|
|
950
|
+
// Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
|
|
951
|
+
function assertNotProd() {
|
|
952
|
+
/* istanbul ignore if */
|
|
953
|
+
if (process.env.NODE_ENV === 'production') {
|
|
954
|
+
// this method should never leak to prod
|
|
955
|
+
throw new ReferenceError();
|
|
956
|
+
}
|
|
875
957
|
}
|
|
876
958
|
|
|
877
959
|
/*
|
|
@@ -916,7 +998,7 @@
|
|
|
916
998
|
//
|
|
917
999
|
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
918
1000
|
// for e.g. "dropzone" should suffice.
|
|
919
|
-
var globalHTMLProperties =
|
|
1001
|
+
var globalHTMLProperties = {
|
|
920
1002
|
accessKey: {
|
|
921
1003
|
attribute: 'accesskey'
|
|
922
1004
|
},
|
|
@@ -1001,7 +1083,7 @@
|
|
|
1001
1083
|
role: {
|
|
1002
1084
|
attribute: 'role'
|
|
1003
1085
|
}
|
|
1004
|
-
}
|
|
1086
|
+
};
|
|
1005
1087
|
var controlledElement = null;
|
|
1006
1088
|
var controlledAttributeName;
|
|
1007
1089
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -1068,27 +1150,18 @@
|
|
|
1068
1150
|
}
|
|
1069
1151
|
var isDomMutationAllowed = false;
|
|
1070
1152
|
function unlockDomMutation() {
|
|
1071
|
-
|
|
1072
|
-
// this method should never leak to prod
|
|
1073
|
-
throw new ReferenceError();
|
|
1074
|
-
}
|
|
1153
|
+
assertNotProd(); // this method should never leak to prod
|
|
1075
1154
|
isDomMutationAllowed = true;
|
|
1076
1155
|
}
|
|
1077
1156
|
function lockDomMutation() {
|
|
1078
|
-
|
|
1079
|
-
// this method should never leak to prod
|
|
1080
|
-
throw new ReferenceError();
|
|
1081
|
-
}
|
|
1157
|
+
assertNotProd(); // this method should never leak to prod
|
|
1082
1158
|
isDomMutationAllowed = false;
|
|
1083
1159
|
}
|
|
1084
1160
|
function logMissingPortalError(name, type) {
|
|
1085
1161
|
return logError("The `".concat(name, "` ").concat(type, " is available only on elements that use the `lwc:dom=\"manual\"` directive."));
|
|
1086
1162
|
}
|
|
1087
1163
|
function patchElementWithRestrictions(elm, options) {
|
|
1088
|
-
|
|
1089
|
-
// this method should never leak to prod
|
|
1090
|
-
throw new ReferenceError();
|
|
1091
|
-
}
|
|
1164
|
+
assertNotProd(); // this method should never leak to prod
|
|
1092
1165
|
var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
1093
1166
|
var descriptors = {
|
|
1094
1167
|
outerHTML: generateAccessorDescriptor({
|
|
@@ -1172,10 +1245,7 @@
|
|
|
1172
1245
|
defineProperties(elm, descriptors);
|
|
1173
1246
|
}
|
|
1174
1247
|
function getShadowRootRestrictionsDescriptors(sr) {
|
|
1175
|
-
|
|
1176
|
-
// this method should never leak to prod
|
|
1177
|
-
throw new ReferenceError();
|
|
1178
|
-
}
|
|
1248
|
+
assertNotProd(); // this method should never leak to prod
|
|
1179
1249
|
// Disallowing properties in dev mode only to avoid people doing the wrong
|
|
1180
1250
|
// thing when using the real shadow root, because if that's the case,
|
|
1181
1251
|
// the component will not work when running with synthetic shadow.
|
|
@@ -1216,10 +1286,7 @@
|
|
|
1216
1286
|
// Custom Elements Restrictions:
|
|
1217
1287
|
// -----------------------------
|
|
1218
1288
|
function getCustomElementRestrictionsDescriptors(elm) {
|
|
1219
|
-
|
|
1220
|
-
// this method should never leak to prod
|
|
1221
|
-
throw new ReferenceError();
|
|
1222
|
-
}
|
|
1289
|
+
assertNotProd(); // this method should never leak to prod
|
|
1223
1290
|
var originalAddEventListener = elm.addEventListener;
|
|
1224
1291
|
var originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
1225
1292
|
var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
@@ -1264,10 +1331,7 @@
|
|
|
1264
1331
|
};
|
|
1265
1332
|
}
|
|
1266
1333
|
function getComponentRestrictionsDescriptors() {
|
|
1267
|
-
|
|
1268
|
-
// this method should never leak to prod
|
|
1269
|
-
throw new ReferenceError();
|
|
1270
|
-
}
|
|
1334
|
+
assertNotProd(); // this method should never leak to prod
|
|
1271
1335
|
return {
|
|
1272
1336
|
tagName: generateAccessorDescriptor({
|
|
1273
1337
|
get: function get() {
|
|
@@ -1280,10 +1344,7 @@
|
|
|
1280
1344
|
}
|
|
1281
1345
|
|
|
1282
1346
|
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
1283
|
-
|
|
1284
|
-
// this method should never leak to prod
|
|
1285
|
-
throw new ReferenceError();
|
|
1286
|
-
}
|
|
1347
|
+
assertNotProd(); // this method should never leak to prod
|
|
1287
1348
|
var originalDispatchEvent = proto.dispatchEvent;
|
|
1288
1349
|
var descriptors = {
|
|
1289
1350
|
dispatchEvent: generateDataDescriptor({
|
|
@@ -2110,7 +2171,6 @@
|
|
|
2110
2171
|
}
|
|
2111
2172
|
};
|
|
2112
2173
|
}
|
|
2113
|
-
var EMPTY_REFS = freeze(create(null));
|
|
2114
2174
|
var refsCache = new WeakMap();
|
|
2115
2175
|
/**
|
|
2116
2176
|
* This class is the base class for any LWC element.
|
|
@@ -2326,7 +2386,6 @@
|
|
|
2326
2386
|
warnIfInvokedDuringConstruction(vm, 'refs');
|
|
2327
2387
|
}
|
|
2328
2388
|
var refVNodes = vm.refVNodes,
|
|
2329
|
-
hasRefVNodes = vm.hasRefVNodes,
|
|
2330
2389
|
cmpTemplate = vm.cmpTemplate;
|
|
2331
2390
|
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
2332
2391
|
// if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
|
|
@@ -2339,15 +2398,9 @@
|
|
|
2339
2398
|
// were introduced, we return undefined if the template has no refs defined
|
|
2340
2399
|
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2341
2400
|
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2342
|
-
// Note
|
|
2343
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2344
|
-
if (!hasRefVNodes) {
|
|
2345
|
-
return;
|
|
2346
|
-
}
|
|
2347
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2348
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2401
|
+
// Note we use a null refVNodes to indicate that the template has no refs defined.
|
|
2349
2402
|
if (isNull(refVNodes)) {
|
|
2350
|
-
return
|
|
2403
|
+
return;
|
|
2351
2404
|
}
|
|
2352
2405
|
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2353
2406
|
// are recreated from scratch every time the template is rendered.
|
|
@@ -2355,17 +2408,17 @@
|
|
|
2355
2408
|
var refs = refsCache.get(refVNodes);
|
|
2356
2409
|
if (isUndefined$1(refs)) {
|
|
2357
2410
|
refs = create(null);
|
|
2358
|
-
var
|
|
2359
|
-
|
|
2411
|
+
var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
|
|
2412
|
+
_step4;
|
|
2360
2413
|
try {
|
|
2361
|
-
for (
|
|
2362
|
-
var key =
|
|
2414
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2415
|
+
var key = _step4.value;
|
|
2363
2416
|
refs[key] = refVNodes[key].elm;
|
|
2364
2417
|
}
|
|
2365
2418
|
} catch (err) {
|
|
2366
|
-
|
|
2419
|
+
_iterator4.e(err);
|
|
2367
2420
|
} finally {
|
|
2368
|
-
|
|
2421
|
+
_iterator4.f();
|
|
2369
2422
|
}
|
|
2370
2423
|
freeze(refs);
|
|
2371
2424
|
refsCache.set(refVNodes, refs);
|
|
@@ -2515,111 +2568,278 @@
|
|
|
2515
2568
|
* SPDX-License-Identifier: MIT
|
|
2516
2569
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2517
2570
|
*/
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2571
|
+
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
2572
|
+
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
2573
|
+
var WIRE_DEBUG_ENTRY = '@wire';
|
|
2574
|
+
var WireMetaMap = new Map();
|
|
2575
|
+
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
2576
|
+
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
2577
|
+
var _super3 = _createSuper(WireContextRegistrationEvent);
|
|
2578
|
+
function WireContextRegistrationEvent(adapterToken, _ref3) {
|
|
2579
|
+
var _this2;
|
|
2580
|
+
var setNewContext = _ref3.setNewContext,
|
|
2581
|
+
setDisconnectedCallback = _ref3.setDisconnectedCallback;
|
|
2582
|
+
_classCallCheck(this, WireContextRegistrationEvent);
|
|
2583
|
+
_this2 = _super3.call(this, adapterToken, {
|
|
2584
|
+
bubbles: true,
|
|
2585
|
+
composed: true
|
|
2586
|
+
});
|
|
2587
|
+
defineProperties(_assertThisInitialized(_this2), {
|
|
2588
|
+
setNewContext: {
|
|
2589
|
+
value: setNewContext
|
|
2590
|
+
},
|
|
2591
|
+
setDisconnectedCallback: {
|
|
2592
|
+
value: setDisconnectedCallback
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2595
|
+
return _this2;
|
|
2521
2596
|
}
|
|
2522
|
-
|
|
2597
|
+
return _createClass(WireContextRegistrationEvent);
|
|
2598
|
+
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
2599
|
+
function createFieldDataCallback(vm, name) {
|
|
2600
|
+
return function (value) {
|
|
2601
|
+
updateComponentValue(vm, name, value);
|
|
2602
|
+
};
|
|
2523
2603
|
}
|
|
2524
|
-
function
|
|
2525
|
-
return {
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
}
|
|
2532
|
-
return;
|
|
2533
|
-
}
|
|
2534
|
-
componentValueObserved(vm, key);
|
|
2535
|
-
return vm.cmpProps[key];
|
|
2536
|
-
},
|
|
2537
|
-
set: function set(newValue) {
|
|
2538
|
-
var vm = getAssociatedVM(this);
|
|
2539
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2540
|
-
var _vmBeingRendered3 = getVMBeingRendered();
|
|
2541
|
-
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2542
|
-
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2543
|
-
}
|
|
2544
|
-
vm.cmpProps[key] = newValue;
|
|
2545
|
-
componentValueMutated(vm, key);
|
|
2546
|
-
},
|
|
2547
|
-
enumerable: true,
|
|
2548
|
-
configurable: true
|
|
2604
|
+
function createMethodDataCallback(vm, method) {
|
|
2605
|
+
return function (value) {
|
|
2606
|
+
// dispatching new value into the wired method
|
|
2607
|
+
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
2608
|
+
// job
|
|
2609
|
+
method.call(vm.component, value);
|
|
2610
|
+
}, noop);
|
|
2549
2611
|
};
|
|
2550
2612
|
}
|
|
2551
|
-
function
|
|
2552
|
-
var
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2613
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
2614
|
+
var hasPendingConfig = false;
|
|
2615
|
+
// creating the reactive observer for reactive params when needed
|
|
2616
|
+
var ro = createReactiveObserver(function () {
|
|
2617
|
+
if (hasPendingConfig === false) {
|
|
2618
|
+
hasPendingConfig = true;
|
|
2619
|
+
// collect new config in the micro-task
|
|
2620
|
+
Promise.resolve().then(function () {
|
|
2621
|
+
hasPendingConfig = false;
|
|
2622
|
+
// resetting current reactive params
|
|
2623
|
+
ro.reset();
|
|
2624
|
+
// dispatching a new config due to a change in the configuration
|
|
2625
|
+
computeConfigAndUpdate();
|
|
2626
|
+
});
|
|
2559
2627
|
}
|
|
2560
|
-
|
|
2561
|
-
|
|
2628
|
+
});
|
|
2629
|
+
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
2630
|
+
var config;
|
|
2631
|
+
ro.observe(function () {
|
|
2632
|
+
return config = configCallback(component);
|
|
2633
|
+
});
|
|
2634
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2635
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
2636
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
2637
|
+
callbackWhenConfigIsReady(config);
|
|
2638
|
+
};
|
|
2562
2639
|
return {
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
// Assert that the this value is an actual Component with an associated VM.
|
|
2566
|
-
getAssociatedVM(this);
|
|
2567
|
-
}
|
|
2568
|
-
return _get2.call(this);
|
|
2569
|
-
},
|
|
2570
|
-
set: function set(newValue) {
|
|
2571
|
-
var vm = getAssociatedVM(this);
|
|
2572
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2573
|
-
var _vmBeingRendered4 = getVMBeingRendered();
|
|
2574
|
-
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered4, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2575
|
-
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2576
|
-
}
|
|
2577
|
-
if (_set2) {
|
|
2578
|
-
_set2.call(this, newValue);
|
|
2579
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
2580
|
-
assert.fail("Invalid attempt to set a new value for property ".concat(toString$1(key), " of ").concat(vm, " that does not has a setter decorated with @api."));
|
|
2581
|
-
}
|
|
2582
|
-
},
|
|
2583
|
-
enumerable: enumerable,
|
|
2584
|
-
configurable: configurable
|
|
2640
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
2641
|
+
ro: ro
|
|
2585
2642
|
};
|
|
2586
2643
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2593
|
-
*/
|
|
2594
|
-
function track(target) {
|
|
2595
|
-
if (arguments.length === 1) {
|
|
2596
|
-
return getReactiveProxy(target);
|
|
2597
|
-
}
|
|
2598
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2599
|
-
assert.fail("@track decorator can only be used with one argument to return a trackable object, or as a decorator function.");
|
|
2644
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
2645
|
+
var adapter = wireDef.adapter;
|
|
2646
|
+
var adapterContextToken = getAdapterToken(adapter);
|
|
2647
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
2648
|
+
return; // no provider found, nothing to be done
|
|
2600
2649
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2650
|
+
|
|
2651
|
+
var elm = vm.elm,
|
|
2652
|
+
_vm$context = vm.context,
|
|
2653
|
+
wiredConnecting = _vm$context.wiredConnecting,
|
|
2654
|
+
wiredDisconnecting = _vm$context.wiredDisconnecting,
|
|
2655
|
+
dispatchEvent = vm.renderer.dispatchEvent;
|
|
2656
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
2657
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
2658
|
+
// This event is responsible for connecting the host element with another
|
|
2659
|
+
// element in the composed path that is providing contextual data. The provider
|
|
2660
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
2661
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
2662
|
+
// guarantee that the linkage can be forged.
|
|
2663
|
+
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
2664
|
+
setNewContext: function setNewContext(newContext) {
|
|
2665
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2666
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
2667
|
+
callbackWhenContextIsReady(newContext);
|
|
2668
|
+
},
|
|
2669
|
+
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
2670
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
2671
|
+
// the the element hosting the wire is disconnected
|
|
2672
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
2673
|
+
}
|
|
2674
|
+
});
|
|
2675
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
2676
|
+
});
|
|
2677
|
+
}
|
|
2678
|
+
function createConnector(vm, name, wireDef) {
|
|
2679
|
+
var method = wireDef.method,
|
|
2680
|
+
adapter = wireDef.adapter,
|
|
2681
|
+
configCallback = wireDef.configCallback,
|
|
2682
|
+
dynamic = wireDef.dynamic;
|
|
2683
|
+
var debugInfo;
|
|
2684
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2685
|
+
var wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
2686
|
+
debugInfo = create(null);
|
|
2687
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2688
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
2689
|
+
}
|
|
2690
|
+
var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
2691
|
+
var dataCallback = function dataCallback(value) {
|
|
2692
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2693
|
+
debugInfo.data = value;
|
|
2694
|
+
// Note: most of the time, the data provided is for the current config, but there may be
|
|
2695
|
+
// some conditions in which it does not, ex:
|
|
2696
|
+
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
2697
|
+
debugInfo.wasDataProvisionedForConfig = true;
|
|
2698
|
+
}
|
|
2699
|
+
fieldOrMethodCallback(value);
|
|
2700
|
+
};
|
|
2701
|
+
var context;
|
|
2702
|
+
var connector;
|
|
2703
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
2704
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
2705
|
+
value: vm.elm
|
|
2706
|
+
});
|
|
2707
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
2708
|
+
value: dynamic
|
|
2709
|
+
});
|
|
2710
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2711
|
+
// job
|
|
2712
|
+
connector = new adapter(dataCallback);
|
|
2713
|
+
}, noop);
|
|
2714
|
+
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
2715
|
+
// every time the config is recomputed due to tracking,
|
|
2716
|
+
// this callback will be invoked with the new computed config
|
|
2717
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2718
|
+
// job
|
|
2612
2719
|
if (process.env.NODE_ENV !== 'production') {
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2720
|
+
debugInfo.config = config;
|
|
2721
|
+
debugInfo.context = context;
|
|
2722
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2616
2723
|
}
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2724
|
+
connector.update(config, context);
|
|
2725
|
+
}, noop);
|
|
2726
|
+
};
|
|
2727
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
2728
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
2729
|
+
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
2730
|
+
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
2731
|
+
ro = _createConfigWatcher.ro;
|
|
2732
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
2733
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
2734
|
+
createContextWatcher(vm, wireDef, function (newContext) {
|
|
2735
|
+
// every time the context is pushed into this component,
|
|
2736
|
+
// this callback will be invoked with the new computed context
|
|
2737
|
+
if (context !== newContext) {
|
|
2738
|
+
context = newContext;
|
|
2739
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
2740
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
2741
|
+
// (ever), while context can have identity
|
|
2742
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
2743
|
+
computeConfigAndUpdate();
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
return {
|
|
2749
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
2750
|
+
connector: connector,
|
|
2751
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
2752
|
+
resetConfigWatcher: function resetConfigWatcher() {
|
|
2753
|
+
return ro.reset();
|
|
2754
|
+
}
|
|
2755
|
+
};
|
|
2756
|
+
}
|
|
2757
|
+
var AdapterToTokenMap = new Map();
|
|
2758
|
+
function getAdapterToken(adapter) {
|
|
2759
|
+
return AdapterToTokenMap.get(adapter);
|
|
2760
|
+
}
|
|
2761
|
+
function setAdapterToken(adapter, token) {
|
|
2762
|
+
AdapterToTokenMap.set(adapter, token);
|
|
2763
|
+
}
|
|
2764
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2765
|
+
// support for callable adapters
|
|
2766
|
+
if (adapter.adapter) {
|
|
2767
|
+
adapter = adapter.adapter;
|
|
2768
|
+
}
|
|
2769
|
+
var method = descriptor.value;
|
|
2770
|
+
var def = {
|
|
2771
|
+
adapter: adapter,
|
|
2772
|
+
method: method,
|
|
2773
|
+
configCallback: configCallback,
|
|
2774
|
+
dynamic: dynamic
|
|
2775
|
+
};
|
|
2776
|
+
WireMetaMap.set(descriptor, def);
|
|
2777
|
+
}
|
|
2778
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2779
|
+
// support for callable adapters
|
|
2780
|
+
if (adapter.adapter) {
|
|
2781
|
+
adapter = adapter.adapter;
|
|
2782
|
+
}
|
|
2783
|
+
var def = {
|
|
2784
|
+
adapter: adapter,
|
|
2785
|
+
configCallback: configCallback,
|
|
2786
|
+
dynamic: dynamic
|
|
2622
2787
|
};
|
|
2788
|
+
WireMetaMap.set(descriptor, def);
|
|
2789
|
+
}
|
|
2790
|
+
function installWireAdapters(vm) {
|
|
2791
|
+
var context = vm.context,
|
|
2792
|
+
wire = vm.def.wire;
|
|
2793
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2794
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
|
|
2795
|
+
}
|
|
2796
|
+
var wiredConnecting = context.wiredConnecting = [];
|
|
2797
|
+
var wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2798
|
+
for (var fieldNameOrMethod in wire) {
|
|
2799
|
+
var descriptor = wire[fieldNameOrMethod];
|
|
2800
|
+
var wireDef = WireMetaMap.get(descriptor);
|
|
2801
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2802
|
+
assert.invariant(wireDef, "Internal Error: invalid wire definition found.");
|
|
2803
|
+
}
|
|
2804
|
+
if (!isUndefined$1(wireDef)) {
|
|
2805
|
+
(function () {
|
|
2806
|
+
var _createConnector = createConnector(vm, fieldNameOrMethod, wireDef),
|
|
2807
|
+
connector = _createConnector.connector,
|
|
2808
|
+
computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
|
|
2809
|
+
resetConfigWatcher = _createConnector.resetConfigWatcher;
|
|
2810
|
+
var hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2811
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
2812
|
+
connector.connect();
|
|
2813
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2814
|
+
if (hasDynamicParams) {
|
|
2815
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2816
|
+
return;
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
computeConfigAndUpdate();
|
|
2820
|
+
});
|
|
2821
|
+
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
2822
|
+
connector.disconnect();
|
|
2823
|
+
resetConfigWatcher();
|
|
2824
|
+
});
|
|
2825
|
+
})();
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
function connectWireAdapters(vm) {
|
|
2830
|
+
var wiredConnecting = vm.context.wiredConnecting;
|
|
2831
|
+
for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
|
|
2832
|
+
wiredConnecting[_i8]();
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
function disconnectWireAdapters(vm) {
|
|
2836
|
+
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
2837
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2838
|
+
// job
|
|
2839
|
+
for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
|
|
2840
|
+
wiredDisconnecting[_i9]();
|
|
2841
|
+
}
|
|
2842
|
+
}, noop);
|
|
2623
2843
|
}
|
|
2624
2844
|
|
|
2625
2845
|
/*
|
|
@@ -2628,56 +2848,169 @@
|
|
|
2628
2848
|
* SPDX-License-Identifier: MIT
|
|
2629
2849
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2630
2850
|
*/
|
|
2631
|
-
|
|
2632
|
-
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2633
|
-
* LWC Components. This function implements the internals of this
|
|
2634
|
-
* decorator.
|
|
2635
|
-
*/
|
|
2636
|
-
function wire(_adapter, _config) {
|
|
2851
|
+
function api$1() {
|
|
2637
2852
|
if (process.env.NODE_ENV !== 'production') {
|
|
2638
|
-
assert.fail(
|
|
2853
|
+
assert.fail("@api decorator can only be used as a decorator function.");
|
|
2639
2854
|
}
|
|
2640
2855
|
throw new Error();
|
|
2641
2856
|
}
|
|
2642
|
-
function
|
|
2857
|
+
function createPublicPropertyDescriptor(key) {
|
|
2643
2858
|
return {
|
|
2644
2859
|
get: function get() {
|
|
2645
2860
|
var vm = getAssociatedVM(this);
|
|
2861
|
+
if (isBeingConstructed(vm)) {
|
|
2862
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2863
|
+
logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
|
|
2864
|
+
}
|
|
2865
|
+
return;
|
|
2866
|
+
}
|
|
2646
2867
|
componentValueObserved(vm, key);
|
|
2647
|
-
return vm.
|
|
2868
|
+
return vm.cmpProps[key];
|
|
2648
2869
|
},
|
|
2649
|
-
set: function set(
|
|
2870
|
+
set: function set(newValue) {
|
|
2650
2871
|
var vm = getAssociatedVM(this);
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2872
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2873
|
+
var _vmBeingRendered3 = getVMBeingRendered();
|
|
2874
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2875
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2876
|
+
}
|
|
2877
|
+
vm.cmpProps[key] = newValue;
|
|
2878
|
+
componentValueMutated(vm, key);
|
|
2658
2879
|
},
|
|
2659
2880
|
enumerable: true,
|
|
2660
2881
|
configurable: true
|
|
2661
2882
|
};
|
|
2662
2883
|
}
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2884
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2885
|
+
var _get2 = descriptor.get,
|
|
2886
|
+
_set2 = descriptor.set,
|
|
2887
|
+
enumerable = descriptor.enumerable,
|
|
2888
|
+
configurable = descriptor.configurable;
|
|
2889
|
+
if (!isFunction$1(_get2)) {
|
|
2890
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2891
|
+
assert.invariant(isFunction$1(_get2), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
|
|
2892
|
+
}
|
|
2893
|
+
throw new Error();
|
|
2894
|
+
}
|
|
2895
|
+
return {
|
|
2896
|
+
get: function get() {
|
|
2897
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2898
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2899
|
+
getAssociatedVM(this);
|
|
2900
|
+
}
|
|
2901
|
+
return _get2.call(this);
|
|
2902
|
+
},
|
|
2903
|
+
set: function set(newValue) {
|
|
2904
|
+
var vm = getAssociatedVM(this);
|
|
2905
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2906
|
+
var _vmBeingRendered4 = getVMBeingRendered();
|
|
2907
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered4, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2908
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2909
|
+
}
|
|
2910
|
+
if (_set2) {
|
|
2911
|
+
_set2.call(this, newValue);
|
|
2912
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
2913
|
+
assert.fail("Invalid attempt to set a new value for property ".concat(toString$1(key), " of ").concat(vm, " that does not has a setter decorated with @api."));
|
|
2914
|
+
}
|
|
2915
|
+
},
|
|
2916
|
+
enumerable: enumerable,
|
|
2917
|
+
configurable: configurable
|
|
2918
|
+
};
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
/*
|
|
2922
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2923
|
+
* All rights reserved.
|
|
2924
|
+
* SPDX-License-Identifier: MIT
|
|
2925
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2926
|
+
*/
|
|
2927
|
+
function track(target) {
|
|
2928
|
+
if (arguments.length === 1) {
|
|
2929
|
+
return getReactiveProxy(target);
|
|
2930
|
+
}
|
|
2931
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2932
|
+
assert.fail("@track decorator can only be used with one argument to return a trackable object, or as a decorator function.");
|
|
2933
|
+
}
|
|
2934
|
+
throw new Error();
|
|
2935
|
+
}
|
|
2936
|
+
function internalTrackDecorator(key) {
|
|
2937
|
+
return {
|
|
2938
|
+
get: function get() {
|
|
2939
|
+
var vm = getAssociatedVM(this);
|
|
2940
|
+
componentValueObserved(vm, key);
|
|
2941
|
+
return vm.cmpFields[key];
|
|
2942
|
+
},
|
|
2943
|
+
set: function set(newValue) {
|
|
2944
|
+
var vm = getAssociatedVM(this);
|
|
2945
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2946
|
+
var _vmBeingRendered5 = getVMBeingRendered();
|
|
2947
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered5, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2948
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2949
|
+
}
|
|
2950
|
+
var reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2951
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2952
|
+
},
|
|
2953
|
+
enumerable: true,
|
|
2954
|
+
configurable: true
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
/*
|
|
2959
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2960
|
+
* All rights reserved.
|
|
2961
|
+
* SPDX-License-Identifier: MIT
|
|
2962
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2963
|
+
*/
|
|
2964
|
+
/**
|
|
2965
|
+
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2966
|
+
* LWC Components. This function implements the internals of this
|
|
2967
|
+
* decorator.
|
|
2968
|
+
*/
|
|
2969
|
+
function wire(_adapter, _config) {
|
|
2970
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2971
|
+
assert.fail('@wire(adapter, config?) may only be used as a decorator.');
|
|
2972
|
+
}
|
|
2973
|
+
throw new Error();
|
|
2974
|
+
}
|
|
2975
|
+
function internalWireFieldDecorator(key) {
|
|
2976
|
+
return {
|
|
2977
|
+
get: function get() {
|
|
2978
|
+
var vm = getAssociatedVM(this);
|
|
2979
|
+
componentValueObserved(vm, key);
|
|
2980
|
+
return vm.cmpFields[key];
|
|
2981
|
+
},
|
|
2982
|
+
set: function set(value) {
|
|
2983
|
+
var vm = getAssociatedVM(this);
|
|
2984
|
+
/**
|
|
2985
|
+
* Reactivity for wired fields is provided in wiring.
|
|
2986
|
+
* We intentionally add reactivity here since this is just
|
|
2987
|
+
* letting the author to do the wrong thing, but it will keep our
|
|
2988
|
+
* system to be backward compatible.
|
|
2989
|
+
*/
|
|
2990
|
+
updateComponentValue(vm, key, value);
|
|
2991
|
+
},
|
|
2992
|
+
enumerable: true,
|
|
2993
|
+
configurable: true
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
/*
|
|
2998
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2999
|
+
* All rights reserved.
|
|
3000
|
+
* SPDX-License-Identifier: MIT
|
|
3001
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3002
|
+
*/
|
|
3003
|
+
function getClassDescriptorType(descriptor) {
|
|
3004
|
+
if (isFunction$1(descriptor.value)) {
|
|
3005
|
+
return "method" /* DescriptorType.Method */;
|
|
3006
|
+
} else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
|
|
3007
|
+
return "accessor" /* DescriptorType.Accessor */;
|
|
3008
|
+
} else {
|
|
3009
|
+
return "field" /* DescriptorType.Field */;
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
2681
3014
|
if (!isUndefined$1(descriptor)) {
|
|
2682
3015
|
var type = getClassDescriptorType(descriptor);
|
|
2683
3016
|
var message = "Invalid observed ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name.");
|
|
@@ -2838,8 +3171,8 @@
|
|
|
2838
3171
|
}
|
|
2839
3172
|
}
|
|
2840
3173
|
if (!isUndefined$1(fields)) {
|
|
2841
|
-
for (var
|
|
2842
|
-
var _fieldName2 = fields[
|
|
3174
|
+
for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
|
|
3175
|
+
var _fieldName2 = fields[_i10];
|
|
2843
3176
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
2844
3177
|
if (process.env.NODE_ENV !== 'production') {
|
|
2845
3178
|
validateObservedField(Ctor, _fieldName2, descriptor);
|
|
@@ -2887,8 +3220,8 @@
|
|
|
2887
3220
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2888
3221
|
*/
|
|
2889
3222
|
var warned = false;
|
|
2890
|
-
//
|
|
2891
|
-
if (process.env.NODE_ENV
|
|
3223
|
+
// Only used in LWC's Karma tests
|
|
3224
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
2892
3225
|
// @ts-ignore
|
|
2893
3226
|
window.__lwcResetWarnedOnVersionMismatch = function () {
|
|
2894
3227
|
warned = false;
|
|
@@ -3031,10 +3364,10 @@
|
|
|
3031
3364
|
if (isFunction$1(SuperClass)) {
|
|
3032
3365
|
HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
|
|
3033
3366
|
_inherits(HTMLBridgeElement, _SuperClass);
|
|
3034
|
-
var
|
|
3367
|
+
var _super4 = _createSuper(HTMLBridgeElement);
|
|
3035
3368
|
function HTMLBridgeElement() {
|
|
3036
3369
|
_classCallCheck(this, HTMLBridgeElement);
|
|
3037
|
-
return
|
|
3370
|
+
return _super4.apply(this, arguments);
|
|
3038
3371
|
}
|
|
3039
3372
|
return _createClass(HTMLBridgeElement);
|
|
3040
3373
|
}(SuperClass);
|
|
@@ -3061,8 +3394,8 @@
|
|
|
3061
3394
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
3062
3395
|
var descriptors = create(null);
|
|
3063
3396
|
// expose getters and setters for each public props on the new Element Bridge
|
|
3064
|
-
for (var
|
|
3065
|
-
var _propName = props[
|
|
3397
|
+
for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
|
|
3398
|
+
var _propName = props[_i11];
|
|
3066
3399
|
attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
|
|
3067
3400
|
descriptors[_propName] = {
|
|
3068
3401
|
get: createGetter(_propName),
|
|
@@ -3072,8 +3405,8 @@
|
|
|
3072
3405
|
};
|
|
3073
3406
|
}
|
|
3074
3407
|
// expose public methods as props on the new Element Bridge
|
|
3075
|
-
for (var
|
|
3076
|
-
var methodName = methods[
|
|
3408
|
+
for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
|
|
3409
|
+
var methodName = methods[_i12];
|
|
3077
3410
|
descriptors[methodName] = {
|
|
3078
3411
|
value: createMethodCaller(methodName),
|
|
3079
3412
|
writable: true,
|
|
@@ -3187,10 +3520,7 @@
|
|
|
3187
3520
|
return canRefreshAllInstances;
|
|
3188
3521
|
}
|
|
3189
3522
|
function getTemplateOrSwappedTemplate(tpl) {
|
|
3190
|
-
|
|
3191
|
-
// this method should never leak to prod
|
|
3192
|
-
throw new ReferenceError();
|
|
3193
|
-
}
|
|
3523
|
+
assertNotProd(); // this method should never leak to prod
|
|
3194
3524
|
var visited = new Set();
|
|
3195
3525
|
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
3196
3526
|
visited.add(tpl);
|
|
@@ -3199,10 +3529,7 @@
|
|
|
3199
3529
|
return tpl;
|
|
3200
3530
|
}
|
|
3201
3531
|
function getComponentOrSwappedComponent(Ctor) {
|
|
3202
|
-
|
|
3203
|
-
// this method should never leak to prod
|
|
3204
|
-
throw new ReferenceError();
|
|
3205
|
-
}
|
|
3532
|
+
assertNotProd(); // this method should never leak to prod
|
|
3206
3533
|
var visited = new Set();
|
|
3207
3534
|
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
3208
3535
|
visited.add(Ctor);
|
|
@@ -3211,10 +3538,7 @@
|
|
|
3211
3538
|
return Ctor;
|
|
3212
3539
|
}
|
|
3213
3540
|
function getStyleOrSwappedStyle(style) {
|
|
3214
|
-
|
|
3215
|
-
// this method should never leak to prod
|
|
3216
|
-
throw new ReferenceError();
|
|
3217
|
-
}
|
|
3541
|
+
assertNotProd(); // this method should never leak to prod
|
|
3218
3542
|
var visited = new Set();
|
|
3219
3543
|
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3220
3544
|
visited.add(style);
|
|
@@ -3223,10 +3547,7 @@
|
|
|
3223
3547
|
return style;
|
|
3224
3548
|
}
|
|
3225
3549
|
function setActiveVM(vm) {
|
|
3226
|
-
|
|
3227
|
-
// this method should never leak to prod
|
|
3228
|
-
throw new ReferenceError();
|
|
3229
|
-
}
|
|
3550
|
+
assertNotProd(); // this method should never leak to prod
|
|
3230
3551
|
// tracking active component
|
|
3231
3552
|
var Ctor = vm.def.ctor;
|
|
3232
3553
|
var componentVMs = activeComponents.get(Ctor);
|
|
@@ -3269,10 +3590,7 @@
|
|
|
3269
3590
|
}
|
|
3270
3591
|
}
|
|
3271
3592
|
function removeActiveVM(vm) {
|
|
3272
|
-
|
|
3273
|
-
// this method should never leak to prod
|
|
3274
|
-
throw new ReferenceError();
|
|
3275
|
-
}
|
|
3593
|
+
assertNotProd(); // this method should never leak to prod
|
|
3276
3594
|
// tracking inactive component
|
|
3277
3595
|
var Ctor = vm.def.ctor;
|
|
3278
3596
|
var list = activeComponents.get(Ctor);
|
|
@@ -3617,8 +3935,8 @@
|
|
|
3617
3935
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3618
3936
|
var content = [];
|
|
3619
3937
|
var root;
|
|
3620
|
-
for (var
|
|
3621
|
-
var stylesheet = stylesheets[
|
|
3938
|
+
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
3939
|
+
var stylesheet = stylesheets[_i13];
|
|
3622
3940
|
if (isArray$1(stylesheet)) {
|
|
3623
3941
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3624
3942
|
} else {
|
|
@@ -3726,8 +4044,8 @@
|
|
|
3726
4044
|
shadowMode = vm.shadowMode,
|
|
3727
4045
|
insertStylesheet = vm.renderer.insertStylesheet;
|
|
3728
4046
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3729
|
-
for (var
|
|
3730
|
-
insertStylesheet(stylesheets[
|
|
4047
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
4048
|
+
insertStylesheet(stylesheets[_i14]);
|
|
3731
4049
|
}
|
|
3732
4050
|
} else if (vm.hydrated) {
|
|
3733
4051
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -3740,8 +4058,8 @@
|
|
|
3740
4058
|
var root = getNearestNativeShadowComponent(vm);
|
|
3741
4059
|
// null root means a global style
|
|
3742
4060
|
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
3743
|
-
for (var
|
|
3744
|
-
insertStylesheet(stylesheets[
|
|
4061
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
4062
|
+
insertStylesheet(stylesheets[_i15], target);
|
|
3745
4063
|
}
|
|
3746
4064
|
}
|
|
3747
4065
|
return null;
|
|
@@ -4055,8 +4373,8 @@
|
|
|
4055
4373
|
return;
|
|
4056
4374
|
}
|
|
4057
4375
|
var setCSSStyleProperty = renderer.setCSSStyleProperty;
|
|
4058
|
-
for (var
|
|
4059
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
4376
|
+
for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
|
|
4377
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
|
|
4060
4378
|
prop = _styleDecls$_i[0],
|
|
4061
4379
|
value = _styleDecls$_i[1],
|
|
4062
4380
|
important = _styleDecls$_i[2];
|
|
@@ -4538,8 +4856,8 @@
|
|
|
4538
4856
|
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4539
4857
|
var nodeStack = [];
|
|
4540
4858
|
var fragmentFound = false;
|
|
4541
|
-
for (var
|
|
4542
|
-
var child = children[
|
|
4859
|
+
for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
|
|
4860
|
+
var child = children[_i17];
|
|
4543
4861
|
ArrayPush$1.call(nodeStack, child);
|
|
4544
4862
|
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4545
4863
|
}
|
|
@@ -4551,8 +4869,8 @@
|
|
|
4551
4869
|
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4552
4870
|
var fChildren = currentNode.children;
|
|
4553
4871
|
// Ignore the start and end text node delimiters
|
|
4554
|
-
for (var
|
|
4555
|
-
ArrayPush$1.call(nodeStack, fChildren[
|
|
4872
|
+
for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
|
|
4873
|
+
ArrayPush$1.call(nodeStack, fChildren[_i18]);
|
|
4556
4874
|
}
|
|
4557
4875
|
} else {
|
|
4558
4876
|
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
@@ -4591,8 +4909,8 @@
|
|
|
4591
4909
|
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
4592
4910
|
var cmpSlotsMapping = create(null);
|
|
4593
4911
|
// Collect all slots into cmpSlotsMapping
|
|
4594
|
-
for (var
|
|
4595
|
-
var vnode = children[
|
|
4912
|
+
for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
|
|
4913
|
+
var vnode = children[_i19];
|
|
4596
4914
|
if (isNull(vnode)) {
|
|
4597
4915
|
continue;
|
|
4598
4916
|
}
|
|
@@ -4617,8 +4935,8 @@
|
|
|
4617
4935
|
markComponentAsDirty(vm);
|
|
4618
4936
|
return;
|
|
4619
4937
|
}
|
|
4620
|
-
for (var
|
|
4621
|
-
var key = oldKeys[
|
|
4938
|
+
for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
|
|
4939
|
+
var key = oldKeys[_i20];
|
|
4622
4940
|
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4623
4941
|
markComponentAsDirty(vm);
|
|
4624
4942
|
return;
|
|
@@ -4741,11 +5059,11 @@
|
|
|
4741
5059
|
if (oldStartIdx > oldEndIdx) {
|
|
4742
5060
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4743
5061
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4744
|
-
var
|
|
5062
|
+
var _i21 = newEndIdx;
|
|
4745
5063
|
var n;
|
|
4746
5064
|
do {
|
|
4747
|
-
n = newCh[++
|
|
4748
|
-
} while (!isVNode(n) &&
|
|
5065
|
+
n = newCh[++_i21];
|
|
5066
|
+
} while (!isVNode(n) && _i21 < newChEnd);
|
|
4749
5067
|
before = isVNode(n) ? n.elm : null;
|
|
4750
5068
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4751
5069
|
} else {
|
|
@@ -4770,9 +5088,9 @@
|
|
|
4770
5088
|
// if the old list is not empty, the new list MUST have the same
|
|
4771
5089
|
// amount of nodes, that's why we call this static children
|
|
4772
5090
|
var anchor = null;
|
|
4773
|
-
for (var
|
|
4774
|
-
var n1 = c1[
|
|
4775
|
-
var n2 = c2[
|
|
5091
|
+
for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
|
|
5092
|
+
var n1 = c1[_i22];
|
|
5093
|
+
var n2 = c2[_i22];
|
|
4776
5094
|
if (n2 !== n1) {
|
|
4777
5095
|
if (isVNode(n1)) {
|
|
4778
5096
|
if (isVNode(n2)) {
|
|
@@ -4897,8 +5215,8 @@
|
|
|
4897
5215
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
4898
5216
|
var newChildren = [];
|
|
4899
5217
|
var slotAssignments = slotset.slotAssignments[slotName];
|
|
4900
|
-
for (var
|
|
4901
|
-
var vnode = slotAssignments[
|
|
5218
|
+
for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
|
|
5219
|
+
var vnode = slotAssignments[_i23];
|
|
4902
5220
|
if (!isNull(vnode)) {
|
|
4903
5221
|
var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
|
|
4904
5222
|
// The only sniff test for a scoped <slot> element is the presence of `slotData`
|
|
@@ -5367,10 +5685,7 @@
|
|
|
5367
5685
|
vmBeingRendered = vm;
|
|
5368
5686
|
}
|
|
5369
5687
|
function validateSlots(vm, html) {
|
|
5370
|
-
|
|
5371
|
-
// this method should never leak to prod
|
|
5372
|
-
throw new ReferenceError();
|
|
5373
|
-
}
|
|
5688
|
+
assertNotProd(); // this method should never leak to prod
|
|
5374
5689
|
var cmpSlots = vm.cmpSlots;
|
|
5375
5690
|
var _html$slots = html.slots,
|
|
5376
5691
|
slots = _html$slots === void 0 ? EmptyArray : _html$slots;
|
|
@@ -5423,23 +5738,23 @@
|
|
|
5423
5738
|
var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
|
|
5424
5739
|
var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
5425
5740
|
var htmlFragment = '';
|
|
5426
|
-
for (var
|
|
5427
|
-
switch (keys[
|
|
5741
|
+
for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
|
|
5742
|
+
switch (keys[_i24]) {
|
|
5428
5743
|
case 0:
|
|
5429
5744
|
// styleToken in existing class attr
|
|
5430
|
-
htmlFragment += strings[
|
|
5745
|
+
htmlFragment += strings[_i24] + classToken;
|
|
5431
5746
|
break;
|
|
5432
5747
|
case 1:
|
|
5433
5748
|
// styleToken for added class attr
|
|
5434
|
-
htmlFragment += strings[
|
|
5749
|
+
htmlFragment += strings[_i24] + classAttrToken;
|
|
5435
5750
|
break;
|
|
5436
5751
|
case 2:
|
|
5437
5752
|
// styleToken as attr
|
|
5438
|
-
htmlFragment += strings[
|
|
5753
|
+
htmlFragment += strings[_i24] + attrToken;
|
|
5439
5754
|
break;
|
|
5440
5755
|
case 3:
|
|
5441
5756
|
// ${1}${2}
|
|
5442
|
-
htmlFragment += strings[
|
|
5757
|
+
htmlFragment += strings[_i24] + classAttrToken + attrToken;
|
|
5443
5758
|
break;
|
|
5444
5759
|
}
|
|
5445
5760
|
}
|
|
@@ -5519,9 +5834,7 @@
|
|
|
5519
5834
|
setActiveVM(vm);
|
|
5520
5835
|
}
|
|
5521
5836
|
// reset the refs; they will be set during the tmpl() instantiation
|
|
5522
|
-
|
|
5523
|
-
vm.hasRefVNodes = hasRefVNodes;
|
|
5524
|
-
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
5837
|
+
vm.refVNodes = html.hasRefs ? create(null) : null;
|
|
5525
5838
|
// right before producing the vnodes, we clear up all internal references
|
|
5526
5839
|
// to custom elements from the template.
|
|
5527
5840
|
vm.velements = [];
|
|
@@ -5546,8 +5859,8 @@
|
|
|
5546
5859
|
}
|
|
5547
5860
|
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
5548
5861
|
if (hasStyles(stylesheets)) {
|
|
5549
|
-
for (var
|
|
5550
|
-
if (isTrue(stylesheets[
|
|
5862
|
+
for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
|
|
5863
|
+
if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
|
|
5551
5864
|
return true;
|
|
5552
5865
|
}
|
|
5553
5866
|
}
|
|
@@ -5667,8 +5980,8 @@
|
|
|
5667
5980
|
*/
|
|
5668
5981
|
function registerComponent(
|
|
5669
5982
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
5670
|
-
Ctor,
|
|
5671
|
-
var tmpl =
|
|
5983
|
+
Ctor, _ref4) {
|
|
5984
|
+
var tmpl = _ref4.tmpl;
|
|
5672
5985
|
if (isFunction$1(Ctor)) {
|
|
5673
5986
|
if (process.env.NODE_ENV !== 'production') {
|
|
5674
5987
|
checkVersionMismatch(Ctor, 'component');
|
|
@@ -5713,7 +6026,7 @@
|
|
|
5713
6026
|
var cmpEventListenerMap = new WeakMap();
|
|
5714
6027
|
function getWrappedComponentsListener(vm, listener) {
|
|
5715
6028
|
if (!isFunction$1(listener)) {
|
|
5716
|
-
throw new TypeError(); // avoiding problems with non-valid listeners
|
|
6029
|
+
throw new TypeError('Expected an EventListener but received ' + _typeof(listener)); // avoiding problems with non-valid listeners
|
|
5717
6030
|
}
|
|
5718
6031
|
|
|
5719
6032
|
var wrappedListener = cmpEventListenerMap.get(listener);
|
|
@@ -5743,8 +6056,8 @@
|
|
|
5743
6056
|
if (process.env.NODE_ENV !== 'production') {
|
|
5744
6057
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
5745
6058
|
}
|
|
5746
|
-
for (var
|
|
5747
|
-
var hookName = hooks[
|
|
6059
|
+
for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
|
|
6060
|
+
var hookName = hooks[_i26];
|
|
5748
6061
|
if (hookName in service) {
|
|
5749
6062
|
var l = Services[hookName];
|
|
5750
6063
|
if (isUndefined$1(l)) {
|
|
@@ -5761,8 +6074,8 @@
|
|
|
5761
6074
|
var component = vm.component,
|
|
5762
6075
|
def = vm.def,
|
|
5763
6076
|
context = vm.context;
|
|
5764
|
-
for (var
|
|
5765
|
-
cbs[
|
|
6077
|
+
for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
|
|
6078
|
+
cbs[_i27].call(undefined, component, {}, def, context);
|
|
5766
6079
|
}
|
|
5767
6080
|
}
|
|
5768
6081
|
|
|
@@ -5856,7 +6169,6 @@
|
|
|
5856
6169
|
mode: mode,
|
|
5857
6170
|
owner: owner,
|
|
5858
6171
|
refVNodes: null,
|
|
5859
|
-
hasRefVNodes: false,
|
|
5860
6172
|
children: EmptyArray,
|
|
5861
6173
|
aChildren: EmptyArray,
|
|
5862
6174
|
velements: EmptyArray,
|
|
@@ -5917,8 +6229,8 @@
|
|
|
5917
6229
|
var valid = true;
|
|
5918
6230
|
var validate = function validate(arrayOrStylesheet) {
|
|
5919
6231
|
if (isArray$1(arrayOrStylesheet)) {
|
|
5920
|
-
for (var
|
|
5921
|
-
validate(arrayOrStylesheet[
|
|
6232
|
+
for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
|
|
6233
|
+
validate(arrayOrStylesheet[_i28]);
|
|
5922
6234
|
}
|
|
5923
6235
|
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
5924
6236
|
// function assumed to be a stylesheet factory
|
|
@@ -6071,17 +6383,17 @@
|
|
|
6071
6383
|
return a.idx - b.idx;
|
|
6072
6384
|
});
|
|
6073
6385
|
rehydrateQueue = []; // reset to a new queue
|
|
6074
|
-
for (var
|
|
6075
|
-
var vm = vms[
|
|
6386
|
+
for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
|
|
6387
|
+
var vm = vms[_i29];
|
|
6076
6388
|
try {
|
|
6077
6389
|
rehydrate(vm);
|
|
6078
6390
|
} catch (error) {
|
|
6079
|
-
if (
|
|
6391
|
+
if (_i29 + 1 < len) {
|
|
6080
6392
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6081
6393
|
if (rehydrateQueue.length === 0) {
|
|
6082
6394
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6083
6395
|
}
|
|
6084
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6396
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
|
|
6085
6397
|
}
|
|
6086
6398
|
// we need to end the measure before throwing.
|
|
6087
6399
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
@@ -6125,439 +6437,320 @@
|
|
|
6125
6437
|
}
|
|
6126
6438
|
if (isFalse(vm.isDirty)) {
|
|
6127
6439
|
// this guarantees that if the component is reused/reinserted,
|
|
6128
|
-
// it will be re-rendered because we are disconnecting the reactivity
|
|
6129
|
-
// linking, so mutations are not automatically reflected on the state
|
|
6130
|
-
// of disconnected components.
|
|
6131
|
-
vm.isDirty = true;
|
|
6132
|
-
}
|
|
6133
|
-
vm.state = 2 /* VMState.disconnected */;
|
|
6134
|
-
// reporting disconnection
|
|
6135
|
-
var disconnected = Services.disconnected;
|
|
6136
|
-
if (disconnected) {
|
|
6137
|
-
invokeServiceHook(vm, disconnected);
|
|
6138
|
-
}
|
|
6139
|
-
if (hasWireAdapters(vm)) {
|
|
6140
|
-
disconnectWireAdapters(vm);
|
|
6141
|
-
}
|
|
6142
|
-
var disconnectedCallback = vm.def.disconnectedCallback;
|
|
6143
|
-
if (!isUndefined$1(disconnectedCallback)) {
|
|
6144
|
-
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6145
|
-
invokeComponentCallback(vm, disconnectedCallback);
|
|
6146
|
-
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6147
|
-
}
|
|
6148
|
-
}
|
|
6149
|
-
function runChildNodesDisconnectedCallback(vm) {
|
|
6150
|
-
var vCustomElementCollection = vm.velements;
|
|
6151
|
-
// Reporting disconnection for every child in inverse order since they are
|
|
6152
|
-
// inserted in reserved order.
|
|
6153
|
-
for (var
|
|
6154
|
-
var elm = vCustomElementCollection[
|
|
6155
|
-
// There are two cases where the element could be undefined:
|
|
6156
|
-
// * when there is an error during the construction phase, and an error
|
|
6157
|
-
// boundary picks it, there is a possibility that the VCustomElement
|
|
6158
|
-
// is not properly initialized, and therefore is should be ignored.
|
|
6159
|
-
// * when slotted custom element is not used by the element where it is
|
|
6160
|
-
// slotted into it, as a result, the custom element was never
|
|
6161
|
-
// initialized.
|
|
6162
|
-
if (!isUndefined$1(elm)) {
|
|
6163
|
-
var childVM = getAssociatedVMIfPresent(elm);
|
|
6164
|
-
// The VM associated with the element might be associated undefined
|
|
6165
|
-
// in the case where the VM failed in the middle of its creation,
|
|
6166
|
-
// eg: constructor throwing before invoking super().
|
|
6167
|
-
if (!isUndefined$1(childVM)) {
|
|
6168
|
-
resetComponentStateWhenRemoved(childVM);
|
|
6169
|
-
}
|
|
6170
|
-
}
|
|
6171
|
-
}
|
|
6172
|
-
}
|
|
6173
|
-
function runLightChildNodesDisconnectedCallback(vm) {
|
|
6174
|
-
var adoptedChildren = vm.aChildren;
|
|
6175
|
-
recursivelyDisconnectChildren(adoptedChildren);
|
|
6176
|
-
}
|
|
6177
|
-
/**
|
|
6178
|
-
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
6179
|
-
* instead it can be partial, when a custom element vnode is found, we don't
|
|
6180
|
-
* need to continue into its children because by attempting to disconnect the
|
|
6181
|
-
* custom element itself will trigger the removal of anything slotted or anything
|
|
6182
|
-
* defined on its shadow.
|
|
6183
|
-
*/
|
|
6184
|
-
function recursivelyDisconnectChildren(vnodes) {
|
|
6185
|
-
for (var _i29 = 0, len = vnodes.length; _i29 < len; _i29 += 1) {
|
|
6186
|
-
var vnode = vnodes[_i29];
|
|
6187
|
-
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6188
|
-
switch (vnode.type) {
|
|
6189
|
-
case 2 /* VNodeType.Element */:
|
|
6190
|
-
recursivelyDisconnectChildren(vnode.children);
|
|
6191
|
-
break;
|
|
6192
|
-
case 3 /* VNodeType.CustomElement */:
|
|
6193
|
-
{
|
|
6194
|
-
var vm = getAssociatedVM(vnode.elm);
|
|
6195
|
-
resetComponentStateWhenRemoved(vm);
|
|
6196
|
-
break;
|
|
6197
|
-
}
|
|
6198
|
-
}
|
|
6199
|
-
}
|
|
6200
|
-
}
|
|
6201
|
-
}
|
|
6202
|
-
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6203
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6204
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6205
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
6206
|
-
function resetComponentRoot(vm) {
|
|
6207
|
-
var children = vm.children,
|
|
6208
|
-
renderRoot = vm.renderRoot,
|
|
6209
|
-
remove = vm.renderer.remove;
|
|
6210
|
-
for (var _i30 = 0, len = children.length; _i30 < len; _i30++) {
|
|
6211
|
-
var child = children[_i30];
|
|
6212
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6213
|
-
remove(child.elm, renderRoot);
|
|
6214
|
-
}
|
|
6215
|
-
}
|
|
6216
|
-
vm.children = EmptyArray;
|
|
6217
|
-
runChildNodesDisconnectedCallback(vm);
|
|
6218
|
-
vm.velements = EmptyArray;
|
|
6219
|
-
}
|
|
6220
|
-
function scheduleRehydration(vm) {
|
|
6221
|
-
if (isTrue(vm.isScheduled)) {
|
|
6222
|
-
return;
|
|
6223
|
-
}
|
|
6224
|
-
vm.isScheduled = true;
|
|
6225
|
-
if (rehydrateQueue.length === 0) {
|
|
6226
|
-
addCallbackToNextTick(flushRehydrationQueue);
|
|
6227
|
-
}
|
|
6228
|
-
ArrayPush$1.call(rehydrateQueue, vm);
|
|
6229
|
-
}
|
|
6230
|
-
function getErrorBoundaryVM(vm) {
|
|
6231
|
-
var currentVm = vm;
|
|
6232
|
-
while (!isNull(currentVm)) {
|
|
6233
|
-
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6234
|
-
return currentVm;
|
|
6235
|
-
}
|
|
6236
|
-
currentVm = currentVm.owner;
|
|
6237
|
-
}
|
|
6238
|
-
}
|
|
6239
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6240
|
-
var error;
|
|
6241
|
-
pre();
|
|
6242
|
-
try {
|
|
6243
|
-
job();
|
|
6244
|
-
} catch (e) {
|
|
6245
|
-
error = Object(e);
|
|
6246
|
-
} finally {
|
|
6247
|
-
post();
|
|
6248
|
-
if (!isUndefined$1(error)) {
|
|
6249
|
-
addErrorComponentStack(vm, error);
|
|
6250
|
-
var errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6251
|
-
if (isUndefined$1(errorBoundaryVm)) {
|
|
6252
|
-
throw error; // eslint-disable-line no-unsafe-finally
|
|
6253
|
-
}
|
|
6254
|
-
|
|
6255
|
-
resetComponentRoot(vm); // remove offenders
|
|
6256
|
-
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6257
|
-
// error boundaries must have an ErrorCallback
|
|
6258
|
-
var errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6259
|
-
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6260
|
-
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6261
|
-
}
|
|
6262
|
-
}
|
|
6263
|
-
}
|
|
6264
|
-
function forceRehydration(vm) {
|
|
6265
|
-
// if we must reset the shadowRoot content and render the template
|
|
6266
|
-
// from scratch on an active instance, the way to force the reset
|
|
6267
|
-
// is by replacing the value of old template, which is used during
|
|
6268
|
-
// to determine if the template has changed or not during the rendering
|
|
6269
|
-
// process. If the template returned by render() is different from the
|
|
6270
|
-
// previous stored template, the styles will be reset, along with the
|
|
6271
|
-
// content of the shadowRoot, this way we can guarantee that all children
|
|
6272
|
-
// elements will be throw away, and new instances will be created.
|
|
6273
|
-
vm.cmpTemplate = function () {
|
|
6274
|
-
return [];
|
|
6275
|
-
};
|
|
6276
|
-
if (isFalse(vm.isDirty)) {
|
|
6277
|
-
// forcing the vm to rehydrate in the next tick
|
|
6278
|
-
markComponentAsDirty(vm);
|
|
6279
|
-
scheduleRehydration(vm);
|
|
6280
|
-
}
|
|
6281
|
-
}
|
|
6282
|
-
|
|
6283
|
-
/*
|
|
6284
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6285
|
-
* All rights reserved.
|
|
6286
|
-
* SPDX-License-Identifier: MIT
|
|
6287
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6288
|
-
*/
|
|
6289
|
-
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
6290
|
-
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
6291
|
-
var WIRE_DEBUG_ENTRY = '@wire';
|
|
6292
|
-
var WireMetaMap = new Map();
|
|
6293
|
-
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
6294
|
-
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
6295
|
-
var _super4 = _createSuper(WireContextRegistrationEvent);
|
|
6296
|
-
function WireContextRegistrationEvent(adapterToken, _ref4) {
|
|
6297
|
-
var _this2;
|
|
6298
|
-
var setNewContext = _ref4.setNewContext,
|
|
6299
|
-
setDisconnectedCallback = _ref4.setDisconnectedCallback;
|
|
6300
|
-
_classCallCheck(this, WireContextRegistrationEvent);
|
|
6301
|
-
_this2 = _super4.call(this, adapterToken, {
|
|
6302
|
-
bubbles: true,
|
|
6303
|
-
composed: true
|
|
6304
|
-
});
|
|
6305
|
-
defineProperties(_assertThisInitialized(_this2), {
|
|
6306
|
-
setNewContext: {
|
|
6307
|
-
value: setNewContext
|
|
6308
|
-
},
|
|
6309
|
-
setDisconnectedCallback: {
|
|
6310
|
-
value: setDisconnectedCallback
|
|
6311
|
-
}
|
|
6312
|
-
});
|
|
6313
|
-
return _this2;
|
|
6314
|
-
}
|
|
6315
|
-
return _createClass(WireContextRegistrationEvent);
|
|
6316
|
-
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
6317
|
-
function createFieldDataCallback(vm, name) {
|
|
6318
|
-
return function (value) {
|
|
6319
|
-
updateComponentValue(vm, name, value);
|
|
6320
|
-
};
|
|
6321
|
-
}
|
|
6322
|
-
function createMethodDataCallback(vm, method) {
|
|
6323
|
-
return function (value) {
|
|
6324
|
-
// dispatching new value into the wired method
|
|
6325
|
-
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
6326
|
-
// job
|
|
6327
|
-
method.call(vm.component, value);
|
|
6328
|
-
}, noop);
|
|
6329
|
-
};
|
|
6330
|
-
}
|
|
6331
|
-
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
6332
|
-
var hasPendingConfig = false;
|
|
6333
|
-
// creating the reactive observer for reactive params when needed
|
|
6334
|
-
var ro = createReactiveObserver(function () {
|
|
6335
|
-
if (hasPendingConfig === false) {
|
|
6336
|
-
hasPendingConfig = true;
|
|
6337
|
-
// collect new config in the micro-task
|
|
6338
|
-
Promise.resolve().then(function () {
|
|
6339
|
-
hasPendingConfig = false;
|
|
6340
|
-
// resetting current reactive params
|
|
6341
|
-
ro.reset();
|
|
6342
|
-
// dispatching a new config due to a change in the configuration
|
|
6343
|
-
computeConfigAndUpdate();
|
|
6344
|
-
});
|
|
6345
|
-
}
|
|
6346
|
-
});
|
|
6347
|
-
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
6348
|
-
var config;
|
|
6349
|
-
ro.observe(function () {
|
|
6350
|
-
return config = configCallback(component);
|
|
6351
|
-
});
|
|
6352
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6353
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
6354
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
6355
|
-
callbackWhenConfigIsReady(config);
|
|
6356
|
-
};
|
|
6357
|
-
return {
|
|
6358
|
-
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
6359
|
-
ro: ro
|
|
6360
|
-
};
|
|
6361
|
-
}
|
|
6362
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
6363
|
-
var adapter = wireDef.adapter;
|
|
6364
|
-
var adapterContextToken = getAdapterToken(adapter);
|
|
6365
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
6366
|
-
return; // no provider found, nothing to be done
|
|
6367
|
-
}
|
|
6368
|
-
|
|
6369
|
-
var elm = vm.elm,
|
|
6370
|
-
_vm$context = vm.context,
|
|
6371
|
-
wiredConnecting = _vm$context.wiredConnecting,
|
|
6372
|
-
wiredDisconnecting = _vm$context.wiredDisconnecting,
|
|
6373
|
-
dispatchEvent = vm.renderer.dispatchEvent;
|
|
6374
|
-
// waiting for the component to be connected to formally request the context via the token
|
|
6375
|
-
ArrayPush$1.call(wiredConnecting, function () {
|
|
6376
|
-
// This event is responsible for connecting the host element with another
|
|
6377
|
-
// element in the composed path that is providing contextual data. The provider
|
|
6378
|
-
// must be listening for a special dom event with the name corresponding to the value of
|
|
6379
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
6380
|
-
// guarantee that the linkage can be forged.
|
|
6381
|
-
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
6382
|
-
setNewContext: function setNewContext(newContext) {
|
|
6383
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6384
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
6385
|
-
callbackWhenContextIsReady(newContext);
|
|
6386
|
-
},
|
|
6387
|
-
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
6388
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
6389
|
-
// the the element hosting the wire is disconnected
|
|
6390
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
6391
|
-
}
|
|
6392
|
-
});
|
|
6393
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
6394
|
-
});
|
|
6395
|
-
}
|
|
6396
|
-
function createConnector(vm, name, wireDef) {
|
|
6397
|
-
var method = wireDef.method,
|
|
6398
|
-
adapter = wireDef.adapter,
|
|
6399
|
-
configCallback = wireDef.configCallback,
|
|
6400
|
-
dynamic = wireDef.dynamic;
|
|
6401
|
-
var debugInfo;
|
|
6402
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6403
|
-
var wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
6404
|
-
debugInfo = create(null);
|
|
6405
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6406
|
-
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
6407
|
-
}
|
|
6408
|
-
var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
6409
|
-
var dataCallback = function dataCallback(value) {
|
|
6410
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6411
|
-
debugInfo.data = value;
|
|
6412
|
-
// Note: most of the time, the data provided is for the current config, but there may be
|
|
6413
|
-
// some conditions in which it does not, ex:
|
|
6414
|
-
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
6415
|
-
debugInfo.wasDataProvisionedForConfig = true;
|
|
6416
|
-
}
|
|
6417
|
-
fieldOrMethodCallback(value);
|
|
6418
|
-
};
|
|
6419
|
-
var context;
|
|
6420
|
-
var connector;
|
|
6421
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
6422
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
6423
|
-
value: vm.elm
|
|
6424
|
-
});
|
|
6425
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
6426
|
-
value: dynamic
|
|
6427
|
-
});
|
|
6428
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6429
|
-
// job
|
|
6430
|
-
connector = new adapter(dataCallback);
|
|
6431
|
-
}, noop);
|
|
6432
|
-
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
6433
|
-
// every time the config is recomputed due to tracking,
|
|
6434
|
-
// this callback will be invoked with the new computed config
|
|
6435
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6436
|
-
// job
|
|
6437
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6438
|
-
debugInfo.config = config;
|
|
6439
|
-
debugInfo.context = context;
|
|
6440
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6441
|
-
}
|
|
6442
|
-
connector.update(config, context);
|
|
6443
|
-
}, noop);
|
|
6444
|
-
};
|
|
6445
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
6446
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
6447
|
-
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
6448
|
-
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
6449
|
-
ro = _createConfigWatcher.ro;
|
|
6450
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
6451
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
6452
|
-
createContextWatcher(vm, wireDef, function (newContext) {
|
|
6453
|
-
// every time the context is pushed into this component,
|
|
6454
|
-
// this callback will be invoked with the new computed context
|
|
6455
|
-
if (context !== newContext) {
|
|
6456
|
-
context = newContext;
|
|
6457
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
6458
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
6459
|
-
// (ever), while context can have identity
|
|
6460
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
6461
|
-
computeConfigAndUpdate();
|
|
6462
|
-
}
|
|
6440
|
+
// it will be re-rendered because we are disconnecting the reactivity
|
|
6441
|
+
// linking, so mutations are not automatically reflected on the state
|
|
6442
|
+
// of disconnected components.
|
|
6443
|
+
vm.isDirty = true;
|
|
6444
|
+
}
|
|
6445
|
+
vm.state = 2 /* VMState.disconnected */;
|
|
6446
|
+
// reporting disconnection
|
|
6447
|
+
var disconnected = Services.disconnected;
|
|
6448
|
+
if (disconnected) {
|
|
6449
|
+
invokeServiceHook(vm, disconnected);
|
|
6450
|
+
}
|
|
6451
|
+
if (hasWireAdapters(vm)) {
|
|
6452
|
+
disconnectWireAdapters(vm);
|
|
6453
|
+
}
|
|
6454
|
+
var disconnectedCallback = vm.def.disconnectedCallback;
|
|
6455
|
+
if (!isUndefined$1(disconnectedCallback)) {
|
|
6456
|
+
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6457
|
+
invokeComponentCallback(vm, disconnectedCallback);
|
|
6458
|
+
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6461
|
+
function runChildNodesDisconnectedCallback(vm) {
|
|
6462
|
+
var vCustomElementCollection = vm.velements;
|
|
6463
|
+
// Reporting disconnection for every child in inverse order since they are
|
|
6464
|
+
// inserted in reserved order.
|
|
6465
|
+
for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
|
|
6466
|
+
var elm = vCustomElementCollection[_i30].elm;
|
|
6467
|
+
// There are two cases where the element could be undefined:
|
|
6468
|
+
// * when there is an error during the construction phase, and an error
|
|
6469
|
+
// boundary picks it, there is a possibility that the VCustomElement
|
|
6470
|
+
// is not properly initialized, and therefore is should be ignored.
|
|
6471
|
+
// * when slotted custom element is not used by the element where it is
|
|
6472
|
+
// slotted into it, as a result, the custom element was never
|
|
6473
|
+
// initialized.
|
|
6474
|
+
if (!isUndefined$1(elm)) {
|
|
6475
|
+
var childVM = getAssociatedVMIfPresent(elm);
|
|
6476
|
+
// The VM associated with the element might be associated undefined
|
|
6477
|
+
// in the case where the VM failed in the middle of its creation,
|
|
6478
|
+
// eg: constructor throwing before invoking super().
|
|
6479
|
+
if (!isUndefined$1(childVM)) {
|
|
6480
|
+
resetComponentStateWhenRemoved(childVM);
|
|
6463
6481
|
}
|
|
6464
|
-
}
|
|
6482
|
+
}
|
|
6465
6483
|
}
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6484
|
+
}
|
|
6485
|
+
function runLightChildNodesDisconnectedCallback(vm) {
|
|
6486
|
+
var adoptedChildren = vm.aChildren;
|
|
6487
|
+
recursivelyDisconnectChildren(adoptedChildren);
|
|
6488
|
+
}
|
|
6489
|
+
/**
|
|
6490
|
+
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
6491
|
+
* instead it can be partial, when a custom element vnode is found, we don't
|
|
6492
|
+
* need to continue into its children because by attempting to disconnect the
|
|
6493
|
+
* custom element itself will trigger the removal of anything slotted or anything
|
|
6494
|
+
* defined on its shadow.
|
|
6495
|
+
*/
|
|
6496
|
+
function recursivelyDisconnectChildren(vnodes) {
|
|
6497
|
+
for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
|
|
6498
|
+
var vnode = vnodes[_i31];
|
|
6499
|
+
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6500
|
+
switch (vnode.type) {
|
|
6501
|
+
case 2 /* VNodeType.Element */:
|
|
6502
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
6503
|
+
break;
|
|
6504
|
+
case 3 /* VNodeType.CustomElement */:
|
|
6505
|
+
{
|
|
6506
|
+
var vm = getAssociatedVM(vnode.elm);
|
|
6507
|
+
resetComponentStateWhenRemoved(vm);
|
|
6508
|
+
break;
|
|
6509
|
+
}
|
|
6510
|
+
}
|
|
6472
6511
|
}
|
|
6473
|
-
}
|
|
6512
|
+
}
|
|
6474
6513
|
}
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6514
|
+
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6515
|
+
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6516
|
+
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6517
|
+
// children VNodes might not be representing the current state of the DOM.
|
|
6518
|
+
function resetComponentRoot(vm) {
|
|
6519
|
+
var children = vm.children,
|
|
6520
|
+
renderRoot = vm.renderRoot,
|
|
6521
|
+
remove = vm.renderer.remove;
|
|
6522
|
+
for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
|
|
6523
|
+
var child = children[_i32];
|
|
6524
|
+
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6525
|
+
remove(child.elm, renderRoot);
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
vm.children = EmptyArray;
|
|
6529
|
+
runChildNodesDisconnectedCallback(vm);
|
|
6530
|
+
vm.velements = EmptyArray;
|
|
6478
6531
|
}
|
|
6479
|
-
function
|
|
6480
|
-
|
|
6532
|
+
function scheduleRehydration(vm) {
|
|
6533
|
+
if (isTrue(vm.isScheduled)) {
|
|
6534
|
+
return;
|
|
6535
|
+
}
|
|
6536
|
+
vm.isScheduled = true;
|
|
6537
|
+
if (rehydrateQueue.length === 0) {
|
|
6538
|
+
addCallbackToNextTick(flushRehydrationQueue);
|
|
6539
|
+
}
|
|
6540
|
+
ArrayPush$1.call(rehydrateQueue, vm);
|
|
6481
6541
|
}
|
|
6482
|
-
function
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6542
|
+
function getErrorBoundaryVM(vm) {
|
|
6543
|
+
var currentVm = vm;
|
|
6544
|
+
while (!isNull(currentVm)) {
|
|
6545
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6546
|
+
return currentVm;
|
|
6547
|
+
}
|
|
6548
|
+
currentVm = currentVm.owner;
|
|
6486
6549
|
}
|
|
6487
|
-
var method = descriptor.value;
|
|
6488
|
-
var def = {
|
|
6489
|
-
adapter: adapter,
|
|
6490
|
-
method: method,
|
|
6491
|
-
configCallback: configCallback,
|
|
6492
|
-
dynamic: dynamic
|
|
6493
|
-
};
|
|
6494
|
-
WireMetaMap.set(descriptor, def);
|
|
6495
6550
|
}
|
|
6496
|
-
function
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6551
|
+
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6552
|
+
var error;
|
|
6553
|
+
pre();
|
|
6554
|
+
try {
|
|
6555
|
+
job();
|
|
6556
|
+
} catch (e) {
|
|
6557
|
+
error = Object(e);
|
|
6558
|
+
} finally {
|
|
6559
|
+
post();
|
|
6560
|
+
if (!isUndefined$1(error)) {
|
|
6561
|
+
addErrorComponentStack(vm, error);
|
|
6562
|
+
var errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6563
|
+
if (isUndefined$1(errorBoundaryVm)) {
|
|
6564
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
6565
|
+
}
|
|
6566
|
+
|
|
6567
|
+
resetComponentRoot(vm); // remove offenders
|
|
6568
|
+
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6569
|
+
// error boundaries must have an ErrorCallback
|
|
6570
|
+
var errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6571
|
+
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6572
|
+
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6573
|
+
}
|
|
6500
6574
|
}
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6575
|
+
}
|
|
6576
|
+
function forceRehydration(vm) {
|
|
6577
|
+
// if we must reset the shadowRoot content and render the template
|
|
6578
|
+
// from scratch on an active instance, the way to force the reset
|
|
6579
|
+
// is by replacing the value of old template, which is used during
|
|
6580
|
+
// to determine if the template has changed or not during the rendering
|
|
6581
|
+
// process. If the template returned by render() is different from the
|
|
6582
|
+
// previous stored template, the styles will be reset, along with the
|
|
6583
|
+
// content of the shadowRoot, this way we can guarantee that all children
|
|
6584
|
+
// elements will be throw away, and new instances will be created.
|
|
6585
|
+
vm.cmpTemplate = function () {
|
|
6586
|
+
return [];
|
|
6505
6587
|
};
|
|
6506
|
-
|
|
6588
|
+
if (isFalse(vm.isDirty)) {
|
|
6589
|
+
// forcing the vm to rehydrate in the next tick
|
|
6590
|
+
markComponentAsDirty(vm);
|
|
6591
|
+
scheduleRehydration(vm);
|
|
6592
|
+
}
|
|
6507
6593
|
}
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6594
|
+
|
|
6595
|
+
/*
|
|
6596
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6597
|
+
* All rights reserved.
|
|
6598
|
+
* SPDX-License-Identifier: MIT
|
|
6599
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6600
|
+
*/
|
|
6601
|
+
//
|
|
6602
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
6603
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
6604
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
6605
|
+
// See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
|
|
6606
|
+
//
|
|
6607
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
6608
|
+
var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6609
|
+
var querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6610
|
+
function isSyntheticShadowRootInstance(rootNode) {
|
|
6611
|
+
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
6612
|
+
}
|
|
6613
|
+
function reportViolation(source, target, attrName) {
|
|
6614
|
+
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
6615
|
+
// shadow for a violation to be detected.
|
|
6616
|
+
var vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
6617
|
+
if (isUndefined$1(vm)) {
|
|
6618
|
+
vm = getAssociatedVMIfPresent(target.getRootNode().host);
|
|
6619
|
+
}
|
|
6620
|
+
if (isUndefined$1(vm)) {
|
|
6621
|
+
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
6622
|
+
return;
|
|
6623
|
+
}
|
|
6624
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
|
|
6511
6625
|
if (process.env.NODE_ENV !== 'production') {
|
|
6512
|
-
|
|
6626
|
+
// Avoid excessively logging to the console in the case of duplicates.
|
|
6627
|
+
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://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates", vm);
|
|
6513
6628
|
}
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6629
|
+
}
|
|
6630
|
+
function parseIdRefAttributeValue(attrValue) {
|
|
6631
|
+
// split on whitespace and skip empty strings after splitting
|
|
6632
|
+
return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
|
|
6633
|
+
}
|
|
6634
|
+
function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
|
|
6635
|
+
var root = elm.getRootNode();
|
|
6636
|
+
if (!isSyntheticShadowRootInstance(root)) {
|
|
6637
|
+
return;
|
|
6638
|
+
}
|
|
6639
|
+
if (attrName === 'id') {
|
|
6640
|
+
// elm is the target, find the source
|
|
6641
|
+
if (!isString(attrValue) || attrValue.length === 0) {
|
|
6642
|
+
// if our id is null or empty, nobody can reference us
|
|
6643
|
+
return;
|
|
6521
6644
|
}
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6645
|
+
var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
|
|
6646
|
+
_step5;
|
|
6647
|
+
try {
|
|
6648
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
6649
|
+
var idRefAttrName = _step5.value;
|
|
6650
|
+
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
6651
|
+
// that reference multiple IDs, separated by whitespace.
|
|
6652
|
+
var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
|
|
6653
|
+
var sourceElements = querySelectorAll.call(document, query);
|
|
6654
|
+
for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
|
|
6655
|
+
var sourceElement = sourceElements[_i33];
|
|
6656
|
+
var sourceRoot = sourceElement.getRootNode();
|
|
6657
|
+
if (sourceRoot !== root) {
|
|
6658
|
+
reportViolation(sourceElement, elm, idRefAttrName);
|
|
6659
|
+
break;
|
|
6536
6660
|
}
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6661
|
+
}
|
|
6662
|
+
}
|
|
6663
|
+
} catch (err) {
|
|
6664
|
+
_iterator5.e(err);
|
|
6665
|
+
} finally {
|
|
6666
|
+
_iterator5.f();
|
|
6667
|
+
}
|
|
6668
|
+
} else {
|
|
6669
|
+
// elm is the source, find the target
|
|
6670
|
+
var ids = parseIdRefAttributeValue(attrValue);
|
|
6671
|
+
var _iterator6 = _createForOfIteratorHelper(ids),
|
|
6672
|
+
_step6;
|
|
6673
|
+
try {
|
|
6674
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
6675
|
+
var id = _step6.value;
|
|
6676
|
+
var target = getElementById.call(document, id);
|
|
6677
|
+
if (!isNull(target)) {
|
|
6678
|
+
var targetRoot = target.getRootNode();
|
|
6679
|
+
if (targetRoot !== root) {
|
|
6680
|
+
// target element's shadow root is not the same as ours
|
|
6681
|
+
reportViolation(elm, target, attrName);
|
|
6682
|
+
}
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
} catch (err) {
|
|
6686
|
+
_iterator6.e(err);
|
|
6687
|
+
} finally {
|
|
6688
|
+
_iterator6.f();
|
|
6544
6689
|
}
|
|
6545
6690
|
}
|
|
6546
6691
|
}
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6692
|
+
var enabled = false;
|
|
6693
|
+
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
6694
|
+
// reporting is not enabled. It should also only run once
|
|
6695
|
+
function enableDetection() {
|
|
6696
|
+
if (enabled) {
|
|
6697
|
+
return; // don't double-apply the patches
|
|
6551
6698
|
}
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
var
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6699
|
+
|
|
6700
|
+
enabled = true;
|
|
6701
|
+
var _setAttribute = Element.prototype.setAttribute;
|
|
6702
|
+
// Detect calling `setAttribute` to set an idref or an id
|
|
6703
|
+
assign(Element.prototype, {
|
|
6704
|
+
setAttribute: function setAttribute(attrName, attrValue) {
|
|
6705
|
+
_setAttribute.call(this, attrName, attrValue);
|
|
6706
|
+
if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
|
|
6707
|
+
detectSyntheticCrossRootAria(this, attrName, attrValue);
|
|
6708
|
+
}
|
|
6559
6709
|
}
|
|
6560
|
-
}
|
|
6710
|
+
});
|
|
6711
|
+
// Detect `elm.id = 'foo'`
|
|
6712
|
+
var idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
|
|
6713
|
+
if (!isUndefined$1(idDescriptor)) {
|
|
6714
|
+
var _get3 = idDescriptor.get,
|
|
6715
|
+
_set3 = idDescriptor.set;
|
|
6716
|
+
// These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
|
|
6717
|
+
if (isFunction$1(_get3) && isFunction$1(_set3)) {
|
|
6718
|
+
defineProperty(Element.prototype, 'id', {
|
|
6719
|
+
get: function get() {
|
|
6720
|
+
return _get3.call(this);
|
|
6721
|
+
},
|
|
6722
|
+
set: function set(value) {
|
|
6723
|
+
_set3.call(this, value);
|
|
6724
|
+
detectSyntheticCrossRootAria(this, 'id', value);
|
|
6725
|
+
},
|
|
6726
|
+
// On the default descriptor for 'id', enumerable and configurable are true
|
|
6727
|
+
enumerable: true,
|
|
6728
|
+
configurable: true
|
|
6729
|
+
});
|
|
6730
|
+
}
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
// Our detection logic relies on some modern browser features. We can just skip reporting the data
|
|
6734
|
+
// for unsupported browsers
|
|
6735
|
+
function supportsCssEscape() {
|
|
6736
|
+
return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
|
|
6737
|
+
}
|
|
6738
|
+
// If this page is not using synthetic shadow, then we don't need to install detection. Note
|
|
6739
|
+
// that we are assuming synthetic shadow is loaded before LWC.
|
|
6740
|
+
function isSyntheticShadowLoaded() {
|
|
6741
|
+
// We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
|
|
6742
|
+
// and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
|
|
6743
|
+
return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6744
|
+
}
|
|
6745
|
+
// Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
|
|
6746
|
+
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
6747
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
6748
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6749
|
+
enableDetection();
|
|
6750
|
+
} else {
|
|
6751
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
6752
|
+
onReportingEnabled(enableDetection);
|
|
6753
|
+
}
|
|
6561
6754
|
}
|
|
6562
6755
|
|
|
6563
6756
|
/*
|
|
@@ -6794,8 +6987,8 @@
|
|
|
6794
6987
|
var nextNode = node;
|
|
6795
6988
|
var anchor = null;
|
|
6796
6989
|
var renderer = owner.renderer;
|
|
6797
|
-
for (var
|
|
6798
|
-
var childVnode = children[
|
|
6990
|
+
for (var _i34 = 0; _i34 < children.length; _i34++) {
|
|
6991
|
+
var childVnode = children[_i34];
|
|
6799
6992
|
if (!isNull(childVnode)) {
|
|
6800
6993
|
if (nextNode) {
|
|
6801
6994
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
@@ -6873,8 +7066,8 @@
|
|
|
6873
7066
|
var nodesAreCompatible = true;
|
|
6874
7067
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6875
7068
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6876
|
-
for (var
|
|
6877
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[
|
|
7069
|
+
for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
|
|
7070
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
|
|
6878
7071
|
attrName = _Object$entries$_i[0],
|
|
6879
7072
|
attrValue = _Object$entries$_i[1];
|
|
6880
7073
|
var owner = vnode.owner;
|
|
@@ -6975,8 +7168,8 @@
|
|
|
6975
7168
|
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6976
7169
|
var expectedStyle = [];
|
|
6977
7170
|
// styleMap is used when style is set to static value.
|
|
6978
|
-
for (var
|
|
6979
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[
|
|
7171
|
+
for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
|
|
7172
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
|
|
6980
7173
|
prop = _styleDecls$_i2[0],
|
|
6981
7174
|
value = _styleDecls$_i2[1],
|
|
6982
7175
|
important = _styleDecls$_i2[2];
|
|
@@ -7093,11 +7286,11 @@
|
|
|
7093
7286
|
function warnOnArrayMutation(stylesheets) {
|
|
7094
7287
|
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
7095
7288
|
// we can at least warn when they use the most common mutation methods.
|
|
7096
|
-
var
|
|
7097
|
-
|
|
7289
|
+
var _iterator7 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
|
|
7290
|
+
_step7;
|
|
7098
7291
|
try {
|
|
7099
7292
|
var _loop2 = function _loop2() {
|
|
7100
|
-
var prop =
|
|
7293
|
+
var prop = _step7.value;
|
|
7101
7294
|
var originalArrayMethod = getOriginalArrayMethod(prop);
|
|
7102
7295
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
7103
7296
|
logError("Mutating the \"stylesheets\" array on a template function " + "is deprecated and may be removed in a future version of LWC.");
|
|
@@ -7105,24 +7298,24 @@
|
|
|
7105
7298
|
return originalArrayMethod.apply(this, arguments);
|
|
7106
7299
|
};
|
|
7107
7300
|
};
|
|
7108
|
-
for (
|
|
7301
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
7109
7302
|
_loop2();
|
|
7110
7303
|
}
|
|
7111
7304
|
} catch (err) {
|
|
7112
|
-
|
|
7305
|
+
_iterator7.e(err);
|
|
7113
7306
|
} finally {
|
|
7114
|
-
|
|
7307
|
+
_iterator7.f();
|
|
7115
7308
|
}
|
|
7116
7309
|
}
|
|
7117
7310
|
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
7118
7311
|
// `stylesheet.$scoped$ = true`
|
|
7119
7312
|
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
7120
7313
|
// We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
|
|
7121
|
-
var
|
|
7122
|
-
|
|
7314
|
+
var _iterator8 = _createForOfIteratorHelper(STYLESHEET_FUNCTION_EXPANDOS),
|
|
7315
|
+
_step8;
|
|
7123
7316
|
try {
|
|
7124
7317
|
var _loop3 = function _loop3() {
|
|
7125
|
-
var prop =
|
|
7318
|
+
var prop = _step8.value;
|
|
7126
7319
|
var value = stylesheet[prop];
|
|
7127
7320
|
defineProperty(stylesheet, prop, {
|
|
7128
7321
|
enumerable: true,
|
|
@@ -7136,13 +7329,13 @@
|
|
|
7136
7329
|
}
|
|
7137
7330
|
});
|
|
7138
7331
|
};
|
|
7139
|
-
for (
|
|
7332
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7140
7333
|
_loop3();
|
|
7141
7334
|
}
|
|
7142
7335
|
} catch (err) {
|
|
7143
|
-
|
|
7336
|
+
_iterator8.e(err);
|
|
7144
7337
|
} finally {
|
|
7145
|
-
|
|
7338
|
+
_iterator8.f();
|
|
7146
7339
|
}
|
|
7147
7340
|
}
|
|
7148
7341
|
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
@@ -7164,8 +7357,8 @@
|
|
|
7164
7357
|
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
7165
7358
|
function traverseStylesheets(stylesheets, callback) {
|
|
7166
7359
|
callback(stylesheets);
|
|
7167
|
-
for (var
|
|
7168
|
-
var stylesheet = stylesheets[
|
|
7360
|
+
for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
|
|
7361
|
+
var stylesheet = stylesheets[_i37];
|
|
7169
7362
|
if (isArray$1(stylesheet)) {
|
|
7170
7363
|
traverseStylesheets(stylesheet, callback);
|
|
7171
7364
|
} else {
|
|
@@ -7211,11 +7404,11 @@
|
|
|
7211
7404
|
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
7212
7405
|
warnOnStylesheetsMutation(tmpl.stylesheets);
|
|
7213
7406
|
}
|
|
7214
|
-
var
|
|
7215
|
-
|
|
7407
|
+
var _iterator9 = _createForOfIteratorHelper(TEMPLATE_PROPS),
|
|
7408
|
+
_step9;
|
|
7216
7409
|
try {
|
|
7217
7410
|
var _loop4 = function _loop4() {
|
|
7218
|
-
var prop =
|
|
7411
|
+
var prop = _step9.value;
|
|
7219
7412
|
var value = tmpl[prop];
|
|
7220
7413
|
defineProperty(tmpl, prop, {
|
|
7221
7414
|
enumerable: true,
|
|
@@ -7231,13 +7424,13 @@
|
|
|
7231
7424
|
}
|
|
7232
7425
|
});
|
|
7233
7426
|
};
|
|
7234
|
-
for (
|
|
7427
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
7235
7428
|
_loop4();
|
|
7236
7429
|
}
|
|
7237
7430
|
} catch (err) {
|
|
7238
|
-
|
|
7431
|
+
_iterator9.e(err);
|
|
7239
7432
|
} finally {
|
|
7240
|
-
|
|
7433
|
+
_iterator9.f();
|
|
7241
7434
|
}
|
|
7242
7435
|
var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7243
7436
|
defineProperty(tmpl, 'stylesheetTokens', {
|
|
@@ -7278,7 +7471,7 @@
|
|
|
7278
7471
|
}
|
|
7279
7472
|
return ctor;
|
|
7280
7473
|
}
|
|
7281
|
-
/* version: 2.
|
|
7474
|
+
/* version: 2.35.1 */
|
|
7282
7475
|
|
|
7283
7476
|
/*
|
|
7284
7477
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7382,8 +7575,7 @@
|
|
|
7382
7575
|
// Test utilities
|
|
7383
7576
|
//
|
|
7384
7577
|
// Only used in LWC's Karma tests
|
|
7385
|
-
|
|
7386
|
-
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7578
|
+
if (process.env.NODE_ENV === 'test-karma-lwc') {
|
|
7387
7579
|
// @ts-ignore
|
|
7388
7580
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7389
7581
|
stylesheetCache.clear();
|
|
@@ -7962,17 +8154,17 @@
|
|
|
7962
8154
|
function flushPendingWhenDefinedCallbacks(tagName, ctor) {
|
|
7963
8155
|
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
7964
8156
|
if (!isUndefined$1(resolvers)) {
|
|
7965
|
-
var
|
|
7966
|
-
|
|
8157
|
+
var _iterator10 = _createForOfIteratorHelper(resolvers),
|
|
8158
|
+
_step10;
|
|
7967
8159
|
try {
|
|
7968
|
-
for (
|
|
7969
|
-
var resolver =
|
|
8160
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
8161
|
+
var resolver = _step10.value;
|
|
7970
8162
|
resolver(ctor);
|
|
7971
8163
|
}
|
|
7972
8164
|
} catch (err) {
|
|
7973
|
-
|
|
8165
|
+
_iterator10.e(err);
|
|
7974
8166
|
} finally {
|
|
7975
|
-
|
|
8167
|
+
_iterator10.f();
|
|
7976
8168
|
}
|
|
7977
8169
|
}
|
|
7978
8170
|
pendingWhenDefinedCallbacks.delete(tagName);
|
|
@@ -8022,11 +8214,11 @@
|
|
|
8022
8214
|
var awaiting = awaitingUpgrade.get(tagName);
|
|
8023
8215
|
if (!isUndefined$1(awaiting)) {
|
|
8024
8216
|
awaitingUpgrade.delete(tagName);
|
|
8025
|
-
var
|
|
8026
|
-
|
|
8217
|
+
var _iterator11 = _createForOfIteratorHelper(awaiting),
|
|
8218
|
+
_step11;
|
|
8027
8219
|
try {
|
|
8028
|
-
for (
|
|
8029
|
-
var element =
|
|
8220
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
8221
|
+
var element = _step11.value;
|
|
8030
8222
|
var registeredDefinition = pendingRegistryForElement.get(element);
|
|
8031
8223
|
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
8032
8224
|
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
@@ -8038,9 +8230,9 @@
|
|
|
8038
8230
|
}
|
|
8039
8231
|
}
|
|
8040
8232
|
} catch (err) {
|
|
8041
|
-
|
|
8233
|
+
_iterator11.e(err);
|
|
8042
8234
|
} finally {
|
|
8043
|
-
|
|
8235
|
+
_iterator11.f();
|
|
8044
8236
|
}
|
|
8045
8237
|
}
|
|
8046
8238
|
// If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
|
|
@@ -8317,7 +8509,7 @@
|
|
|
8317
8509
|
function isNull(obj) {
|
|
8318
8510
|
return obj === null;
|
|
8319
8511
|
}
|
|
8320
|
-
/** version: 2.
|
|
8512
|
+
/** version: 2.35.1 */
|
|
8321
8513
|
|
|
8322
8514
|
/*
|
|
8323
8515
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8376,17 +8568,17 @@
|
|
|
8376
8568
|
exports.createFragment = function (html) {
|
|
8377
8569
|
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
8378
8570
|
if (!isUndefined(wrapperTags)) {
|
|
8379
|
-
var
|
|
8380
|
-
|
|
8571
|
+
var _iterator12 = _createForOfIteratorHelper(wrapperTags),
|
|
8572
|
+
_step12;
|
|
8381
8573
|
try {
|
|
8382
|
-
for (
|
|
8383
|
-
var wrapperTag =
|
|
8574
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
8575
|
+
var wrapperTag = _step12.value;
|
|
8384
8576
|
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
8385
8577
|
}
|
|
8386
8578
|
} catch (err) {
|
|
8387
|
-
|
|
8579
|
+
_iterator12.e(err);
|
|
8388
8580
|
} finally {
|
|
8389
|
-
|
|
8581
|
+
_iterator12.f();
|
|
8390
8582
|
}
|
|
8391
8583
|
}
|
|
8392
8584
|
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
@@ -8395,7 +8587,7 @@
|
|
|
8395
8587
|
doc.body.innerHTML = html;
|
|
8396
8588
|
var content = doc.body;
|
|
8397
8589
|
if (!isUndefined(wrapperTags)) {
|
|
8398
|
-
for (var
|
|
8590
|
+
for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
|
|
8399
8591
|
content = content.firstChild;
|
|
8400
8592
|
}
|
|
8401
8593
|
}
|
|
@@ -8588,8 +8780,8 @@
|
|
|
8588
8780
|
tagName: element.tagName.toLowerCase(),
|
|
8589
8781
|
hydrated: true
|
|
8590
8782
|
});
|
|
8591
|
-
for (var
|
|
8592
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
8783
|
+
for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
|
|
8784
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
|
|
8593
8785
|
key = _Object$entries2$_i[0],
|
|
8594
8786
|
value = _Object$entries2$_i[1];
|
|
8595
8787
|
element[key] = value;
|
|
@@ -8883,10 +9075,11 @@
|
|
|
8883
9075
|
});
|
|
8884
9076
|
freeze(LightningElement);
|
|
8885
9077
|
seal(LightningElement.prototype);
|
|
8886
|
-
/* version: 2.
|
|
9078
|
+
/* version: 2.35.1 */
|
|
8887
9079
|
|
|
8888
9080
|
exports.LightningElement = LightningElement;
|
|
8889
9081
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
9082
|
+
exports.__unstable__ReportingControl = reportingControl;
|
|
8890
9083
|
exports.api = api$1;
|
|
8891
9084
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
8892
9085
|
exports.createContextProvider = createContextProvider;
|