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