lwc 2.33.0 → 2.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +1022 -649
- package/dist/engine-dom/iife/es2017/engine-dom.js +1022 -648
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +824 -557
- package/dist/engine-dom/iife/es5/engine-dom.js +1179 -802
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +1002 -720
- package/dist/engine-dom/umd/es2017/engine-dom.js +1022 -648
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +824 -557
- package/dist/engine-dom/umd/es5/engine-dom.js +1179 -802
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +1002 -720
- package/dist/engine-server/commonjs/es2017/engine-server.js +789 -638
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +789 -638
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +15 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +18 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +18 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +15 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +15 -4
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +18 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +18 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -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.
|
|
@@ -254,6 +258,8 @@ var LWC = (function (exports) {
|
|
|
254
258
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
255
259
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
256
260
|
var KEY__SCOPED_CSS = '$scoped$';
|
|
261
|
+
var KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
262
|
+
var KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
257
263
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
258
264
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
259
265
|
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -349,9 +355,9 @@ var LWC = (function (exports) {
|
|
|
349
355
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
350
356
|
*/
|
|
351
357
|
// Increment whenever the LWC template compiler changes
|
|
352
|
-
var LWC_VERSION = "2.
|
|
358
|
+
var LWC_VERSION = "2.35.0";
|
|
353
359
|
var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
354
|
-
/** version: 2.
|
|
360
|
+
/** version: 2.35.0 */
|
|
355
361
|
|
|
356
362
|
/**
|
|
357
363
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -373,7 +379,8 @@ var LWC = (function (exports) {
|
|
|
373
379
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
374
380
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
375
381
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
376
|
-
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
382
|
+
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
383
|
+
ENABLE_PROGRAMMATIC_STYLESHEETS: null
|
|
377
384
|
};
|
|
378
385
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
379
386
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
@@ -429,7 +436,7 @@ var LWC = (function (exports) {
|
|
|
429
436
|
setFeatureFlag(name, value);
|
|
430
437
|
}
|
|
431
438
|
}
|
|
432
|
-
/** version: 2.
|
|
439
|
+
/** version: 2.35.0 */
|
|
433
440
|
|
|
434
441
|
/**
|
|
435
442
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -493,7 +500,7 @@ var LWC = (function (exports) {
|
|
|
493
500
|
}
|
|
494
501
|
}
|
|
495
502
|
}
|
|
496
|
-
/** version: 2.
|
|
503
|
+
/** version: 2.35.0 */
|
|
497
504
|
|
|
498
505
|
/*
|
|
499
506
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -561,113 +568,173 @@ var LWC = (function (exports) {
|
|
|
561
568
|
* SPDX-License-Identifier: MIT
|
|
562
569
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
563
570
|
*/
|
|
564
|
-
|
|
565
|
-
var
|
|
566
|
-
|
|
567
|
-
var
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
571
|
+
/** Callbacks to invoke when reporting is enabled **/
|
|
572
|
+
var onReportingEnabledCallbacks = [];
|
|
573
|
+
/** The currently assigned reporting dispatcher. */
|
|
574
|
+
var currentDispatcher$1 = noop;
|
|
575
|
+
/**
|
|
576
|
+
* Whether reporting is enabled.
|
|
577
|
+
*
|
|
578
|
+
* Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
|
|
579
|
+
* but it turns out that Terser only strips out unused code if we use this explicit boolean.
|
|
580
|
+
*/
|
|
581
|
+
var enabled$1 = false;
|
|
582
|
+
var reportingControl = {
|
|
583
|
+
/**
|
|
584
|
+
* Attach a new reporting control (aka dispatcher).
|
|
585
|
+
*
|
|
586
|
+
* @param dispatcher - reporting control
|
|
587
|
+
*/
|
|
588
|
+
attachDispatcher: function attachDispatcher(dispatcher) {
|
|
589
|
+
enabled$1 = true;
|
|
590
|
+
currentDispatcher$1 = dispatcher;
|
|
591
|
+
var _iterator = _createForOfIteratorHelper(onReportingEnabledCallbacks),
|
|
592
|
+
_step;
|
|
593
|
+
try {
|
|
594
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
595
|
+
var callback = _step.value;
|
|
596
|
+
try {
|
|
597
|
+
callback();
|
|
598
|
+
} catch (err) {
|
|
599
|
+
// This should never happen. But if it does, we don't want one callback to cause another to fail
|
|
600
|
+
// eslint-disable-next-line no-console
|
|
601
|
+
console.error('Could not invoke callback', err);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
} catch (err) {
|
|
605
|
+
_iterator.e(err);
|
|
606
|
+
} finally {
|
|
607
|
+
_iterator.f();
|
|
572
608
|
}
|
|
609
|
+
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
610
|
+
},
|
|
611
|
+
/**
|
|
612
|
+
* Detach the current reporting control (aka dispatcher).
|
|
613
|
+
*/
|
|
614
|
+
detachDispatcher: function detachDispatcher() {
|
|
615
|
+
enabled$1 = false;
|
|
616
|
+
currentDispatcher$1 = noop;
|
|
573
617
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
618
|
+
};
|
|
619
|
+
/**
|
|
620
|
+
* Call a callback when reporting is enabled, or immediately if reporting is already enabled.
|
|
621
|
+
* Will only ever be called once.
|
|
622
|
+
* @param callback
|
|
623
|
+
*/
|
|
624
|
+
function onReportingEnabled(callback) {
|
|
625
|
+
if (enabled$1) {
|
|
626
|
+
// call immediately
|
|
627
|
+
callback();
|
|
628
|
+
} else {
|
|
629
|
+
// call later
|
|
630
|
+
onReportingEnabledCallbacks.push(callback);
|
|
578
631
|
}
|
|
579
632
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
633
|
+
/**
|
|
634
|
+
* Report to the current dispatcher, if there is one.
|
|
635
|
+
* @param reportingEventId
|
|
636
|
+
* @param vm
|
|
637
|
+
*/
|
|
638
|
+
function report(reportingEventId, vm) {
|
|
639
|
+
if (enabled$1) {
|
|
640
|
+
currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
|
|
585
641
|
}
|
|
586
|
-
|
|
587
|
-
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/*
|
|
645
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
646
|
+
* All rights reserved.
|
|
647
|
+
* SPDX-License-Identifier: MIT
|
|
648
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
649
|
+
*/
|
|
650
|
+
function getComponentTag(vm) {
|
|
651
|
+
return "<".concat(StringToLowerCase.call(vm.tagName), ">");
|
|
652
|
+
}
|
|
653
|
+
// TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
654
|
+
function getComponentStack(vm) {
|
|
655
|
+
var stack = [];
|
|
656
|
+
var prefix = '';
|
|
657
|
+
while (!isNull(vm.owner)) {
|
|
658
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
659
|
+
vm = vm.owner;
|
|
660
|
+
prefix += '\t';
|
|
588
661
|
}
|
|
589
|
-
|
|
662
|
+
return ArrayJoin.call(stack, '\n');
|
|
590
663
|
}
|
|
591
|
-
function
|
|
592
|
-
|
|
593
|
-
|
|
664
|
+
function getErrorComponentStack(vm) {
|
|
665
|
+
var wcStack = [];
|
|
666
|
+
var currentVm = vm;
|
|
667
|
+
while (!isNull(currentVm)) {
|
|
668
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
669
|
+
currentVm = currentVm.owner;
|
|
594
670
|
}
|
|
595
|
-
return
|
|
671
|
+
return wcStack.reverse().join('\n\t');
|
|
596
672
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
611
|
-
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
612
|
-
prop = _declaration$split2[0],
|
|
613
|
-
value = _declaration$split2[1];
|
|
614
|
-
if (prop !== undefined && value !== undefined) {
|
|
615
|
-
styleMap[prop.trim()] = value.trim();
|
|
616
|
-
}
|
|
673
|
+
|
|
674
|
+
/*
|
|
675
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
676
|
+
* All rights reserved.
|
|
677
|
+
* SPDX-License-Identifier: MIT
|
|
678
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
679
|
+
*/
|
|
680
|
+
function addErrorComponentStack(vm, error) {
|
|
681
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
682
|
+
var wcStack = getErrorComponentStack(vm);
|
|
683
|
+
defineProperty(error, 'wcStack', {
|
|
684
|
+
get: function get() {
|
|
685
|
+
return wcStack;
|
|
617
686
|
}
|
|
618
|
-
}
|
|
619
|
-
} catch (err) {
|
|
620
|
-
_iterator.e(err);
|
|
621
|
-
} finally {
|
|
622
|
-
_iterator.f();
|
|
687
|
+
});
|
|
623
688
|
}
|
|
624
|
-
return styleMap;
|
|
625
689
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
690
|
+
|
|
691
|
+
/*
|
|
692
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
693
|
+
* All rights reserved.
|
|
694
|
+
* SPDX-License-Identifier: MIT
|
|
695
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
696
|
+
*/
|
|
697
|
+
var alreadyLoggedMessages = new Set();
|
|
698
|
+
// @ts-ignore
|
|
699
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
700
|
+
// @ts-ignore
|
|
701
|
+
window.__lwcResetAlreadyLoggedMessages = function () {
|
|
702
|
+
alreadyLoggedMessages.clear();
|
|
703
|
+
};
|
|
636
704
|
}
|
|
637
|
-
function
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
list.push(stylesheet);
|
|
646
|
-
} else {
|
|
647
|
-
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
648
|
-
}
|
|
705
|
+
function log(method, message, vm, once) {
|
|
706
|
+
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
707
|
+
if (!isUndefined$1(vm)) {
|
|
708
|
+
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
709
|
+
}
|
|
710
|
+
if (once) {
|
|
711
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
712
|
+
return;
|
|
649
713
|
}
|
|
650
|
-
|
|
651
|
-
_iterator2.e(err);
|
|
652
|
-
} finally {
|
|
653
|
-
_iterator2.f();
|
|
714
|
+
alreadyLoggedMessages.add(msg);
|
|
654
715
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
throw new Error('refVNodes must be defined when setting a ref');
|
|
716
|
+
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
717
|
+
if (process.env.NODE_ENV === 'test') {
|
|
718
|
+
/* eslint-disable-next-line no-console */
|
|
719
|
+
console[method](msg);
|
|
720
|
+
return;
|
|
661
721
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
668
|
-
refVNodes[ref] = vnode;
|
|
722
|
+
try {
|
|
723
|
+
throw new Error(msg);
|
|
724
|
+
} catch (e) {
|
|
725
|
+
/* eslint-disable-next-line no-console */
|
|
726
|
+
console[method](e);
|
|
669
727
|
}
|
|
670
728
|
}
|
|
729
|
+
function logError(message, vm) {
|
|
730
|
+
log('error', message, vm, false);
|
|
731
|
+
}
|
|
732
|
+
function logWarn(message, vm) {
|
|
733
|
+
log('warn', message, vm, false);
|
|
734
|
+
}
|
|
735
|
+
function logWarnOnce(message, vm) {
|
|
736
|
+
log('warn', message, vm, true);
|
|
737
|
+
}
|
|
671
738
|
|
|
672
739
|
/*
|
|
673
740
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -691,8 +758,8 @@ var LWC = (function (exports) {
|
|
|
691
758
|
if (!isUndefined$1(reactiveRecord)) {
|
|
692
759
|
var reactiveObservers = reactiveRecord[key];
|
|
693
760
|
if (!isUndefined$1(reactiveObservers)) {
|
|
694
|
-
for (var
|
|
695
|
-
var ro = reactiveObservers[
|
|
761
|
+
for (var _i3 = 0, len = reactiveObservers.length; _i3 < len; _i3 += 1) {
|
|
762
|
+
var ro = reactiveObservers[_i3];
|
|
696
763
|
ro.notify();
|
|
697
764
|
}
|
|
698
765
|
}
|
|
@@ -751,9 +818,9 @@ var LWC = (function (exports) {
|
|
|
751
818
|
var listeners = this.listeners;
|
|
752
819
|
var len = listeners.length;
|
|
753
820
|
if (len > 0) {
|
|
754
|
-
for (var
|
|
755
|
-
var set = listeners[
|
|
756
|
-
var pos = ArrayIndexOf.call(listeners[
|
|
821
|
+
for (var _i4 = 0; _i4 < len; _i4 += 1) {
|
|
822
|
+
var set = listeners[_i4];
|
|
823
|
+
var pos = ArrayIndexOf.call(listeners[_i4], this);
|
|
757
824
|
ArraySplice.call(set, pos, 1);
|
|
758
825
|
}
|
|
759
826
|
listeners.length = 0;
|
|
@@ -798,75 +865,112 @@ var LWC = (function (exports) {
|
|
|
798
865
|
* SPDX-License-Identifier: MIT
|
|
799
866
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
800
867
|
*/
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
function
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
vm = vm.owner;
|
|
811
|
-
prefix += '\t';
|
|
812
|
-
}
|
|
813
|
-
return ArrayJoin.call(stack, '\n');
|
|
814
|
-
}
|
|
815
|
-
function getErrorComponentStack(vm) {
|
|
816
|
-
var wcStack = [];
|
|
817
|
-
var currentVm = vm;
|
|
818
|
-
while (!isNull(currentVm)) {
|
|
819
|
-
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
820
|
-
currentVm = currentVm.owner;
|
|
868
|
+
var nextTickCallbackQueue = [];
|
|
869
|
+
var SPACE_CHAR = 32;
|
|
870
|
+
var EmptyObject = seal(create(null));
|
|
871
|
+
var EmptyArray = seal([]);
|
|
872
|
+
function flushCallbackQueue() {
|
|
873
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
874
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
875
|
+
throw new Error("Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.");
|
|
876
|
+
}
|
|
821
877
|
}
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
827
|
-
* All rights reserved.
|
|
828
|
-
* SPDX-License-Identifier: MIT
|
|
829
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
830
|
-
*/
|
|
831
|
-
function addErrorComponentStack(vm, error) {
|
|
832
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
833
|
-
var wcStack = getErrorComponentStack(vm);
|
|
834
|
-
defineProperty(error, 'wcStack', {
|
|
835
|
-
get: function get() {
|
|
836
|
-
return wcStack;
|
|
837
|
-
}
|
|
838
|
-
});
|
|
878
|
+
var callbacks = nextTickCallbackQueue;
|
|
879
|
+
nextTickCallbackQueue = []; // reset to a new queue
|
|
880
|
+
for (var _i5 = 0, len = callbacks.length; _i5 < len; _i5 += 1) {
|
|
881
|
+
callbacks[_i5]();
|
|
839
882
|
}
|
|
840
883
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
847
|
-
*/
|
|
848
|
-
function log(method, message, vm) {
|
|
849
|
-
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
850
|
-
if (!isUndefined$1(vm)) {
|
|
851
|
-
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
852
|
-
}
|
|
853
|
-
if (process.env.NODE_ENV === 'test') {
|
|
854
|
-
/* eslint-disable-next-line no-console */
|
|
855
|
-
console[method](msg);
|
|
856
|
-
return;
|
|
884
|
+
function addCallbackToNextTick(callback) {
|
|
885
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
886
|
+
if (!isFunction$1(callback)) {
|
|
887
|
+
throw new Error("Internal Error: addCallbackToNextTick() can only accept a function callback");
|
|
888
|
+
}
|
|
857
889
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
} catch (e) {
|
|
861
|
-
/* eslint-disable-next-line no-console */
|
|
862
|
-
console[method](e);
|
|
890
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
891
|
+
Promise.resolve().then(flushCallbackQueue);
|
|
863
892
|
}
|
|
893
|
+
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
864
894
|
}
|
|
865
|
-
function
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
895
|
+
function guid() {
|
|
896
|
+
function s4() {
|
|
897
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
898
|
+
}
|
|
899
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
900
|
+
}
|
|
901
|
+
// Borrowed from Vue template compiler.
|
|
902
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
903
|
+
var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
904
|
+
var PROPERTY_DELIMITER = /:(.+)/;
|
|
905
|
+
function parseStyleText(cssText) {
|
|
906
|
+
var styleMap = {};
|
|
907
|
+
var declarations = cssText.split(DECLARATION_DELIMITER);
|
|
908
|
+
var _iterator2 = _createForOfIteratorHelper(declarations),
|
|
909
|
+
_step2;
|
|
910
|
+
try {
|
|
911
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
912
|
+
var declaration = _step2.value;
|
|
913
|
+
if (declaration) {
|
|
914
|
+
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
915
|
+
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
916
|
+
prop = _declaration$split2[0],
|
|
917
|
+
value = _declaration$split2[1];
|
|
918
|
+
if (prop !== undefined && value !== undefined) {
|
|
919
|
+
styleMap[prop.trim()] = value.trim();
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
} catch (err) {
|
|
924
|
+
_iterator2.e(err);
|
|
925
|
+
} finally {
|
|
926
|
+
_iterator2.f();
|
|
927
|
+
}
|
|
928
|
+
return styleMap;
|
|
929
|
+
}
|
|
930
|
+
// Make a shallow copy of an object but omit the given key
|
|
931
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
932
|
+
var result = {};
|
|
933
|
+
for (var _i6 = 0, _Object$keys = Object.keys(object); _i6 < _Object$keys.length; _i6++) {
|
|
934
|
+
var key = _Object$keys[_i6];
|
|
935
|
+
if (key !== keyToOmit) {
|
|
936
|
+
result[key] = object[key];
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return result;
|
|
940
|
+
}
|
|
941
|
+
function flattenStylesheets(stylesheets) {
|
|
942
|
+
var list = [];
|
|
943
|
+
var _iterator3 = _createForOfIteratorHelper(stylesheets),
|
|
944
|
+
_step3;
|
|
945
|
+
try {
|
|
946
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
947
|
+
var stylesheet = _step3.value;
|
|
948
|
+
if (!Array.isArray(stylesheet)) {
|
|
949
|
+
list.push(stylesheet);
|
|
950
|
+
} else {
|
|
951
|
+
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
} catch (err) {
|
|
955
|
+
_iterator3.e(err);
|
|
956
|
+
} finally {
|
|
957
|
+
_iterator3.f();
|
|
958
|
+
}
|
|
959
|
+
return list;
|
|
960
|
+
}
|
|
961
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
962
|
+
function setRefVNode(vm, ref, vnode) {
|
|
963
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
964
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
965
|
+
}
|
|
966
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
967
|
+
// If not, then something went wrong and we threw an error above.
|
|
968
|
+
var refVNodes = vm.refVNodes;
|
|
969
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
970
|
+
// in depth-first traversal order.
|
|
971
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
972
|
+
refVNodes[ref] = vnode;
|
|
973
|
+
}
|
|
870
974
|
}
|
|
871
975
|
|
|
872
976
|
/*
|
|
@@ -908,7 +1012,10 @@ var LWC = (function (exports) {
|
|
|
908
1012
|
// Global HTML Attributes & Properties
|
|
909
1013
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
910
1014
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
911
|
-
|
|
1015
|
+
//
|
|
1016
|
+
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
1017
|
+
// for e.g. "dropzone" should suffice.
|
|
1018
|
+
var globalHTMLProperties = {
|
|
912
1019
|
accessKey: {
|
|
913
1020
|
attribute: 'accesskey'
|
|
914
1021
|
},
|
|
@@ -993,7 +1100,7 @@ var LWC = (function (exports) {
|
|
|
993
1100
|
role: {
|
|
994
1101
|
attribute: 'role'
|
|
995
1102
|
}
|
|
996
|
-
}
|
|
1103
|
+
};
|
|
997
1104
|
var controlledElement = null;
|
|
998
1105
|
var controlledAttributeName;
|
|
999
1106
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -2347,17 +2454,17 @@ var LWC = (function (exports) {
|
|
|
2347
2454
|
var refs = refsCache.get(refVNodes);
|
|
2348
2455
|
if (isUndefined$1(refs)) {
|
|
2349
2456
|
refs = create(null);
|
|
2350
|
-
var
|
|
2351
|
-
|
|
2457
|
+
var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
|
|
2458
|
+
_step4;
|
|
2352
2459
|
try {
|
|
2353
|
-
for (
|
|
2354
|
-
var key =
|
|
2460
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
2461
|
+
var key = _step4.value;
|
|
2355
2462
|
refs[key] = refVNodes[key].elm;
|
|
2356
2463
|
}
|
|
2357
2464
|
} catch (err) {
|
|
2358
|
-
|
|
2465
|
+
_iterator4.e(err);
|
|
2359
2466
|
} finally {
|
|
2360
|
-
|
|
2467
|
+
_iterator4.f();
|
|
2361
2468
|
}
|
|
2362
2469
|
freeze(refs);
|
|
2363
2470
|
refsCache.set(refVNodes, refs);
|
|
@@ -2507,97 +2614,377 @@ var LWC = (function (exports) {
|
|
|
2507
2614
|
* SPDX-License-Identifier: MIT
|
|
2508
2615
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2509
2616
|
*/
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2617
|
+
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
2618
|
+
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
2619
|
+
var WIRE_DEBUG_ENTRY = '@wire';
|
|
2620
|
+
var WireMetaMap = new Map();
|
|
2621
|
+
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
2622
|
+
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
2623
|
+
var _super3 = _createSuper(WireContextRegistrationEvent);
|
|
2624
|
+
function WireContextRegistrationEvent(adapterToken, _ref3) {
|
|
2625
|
+
var _this2;
|
|
2626
|
+
var setNewContext = _ref3.setNewContext,
|
|
2627
|
+
setDisconnectedCallback = _ref3.setDisconnectedCallback;
|
|
2628
|
+
_classCallCheck(this, WireContextRegistrationEvent);
|
|
2629
|
+
_this2 = _super3.call(this, adapterToken, {
|
|
2630
|
+
bubbles: true,
|
|
2631
|
+
composed: true
|
|
2632
|
+
});
|
|
2633
|
+
defineProperties(_assertThisInitialized(_this2), {
|
|
2634
|
+
setNewContext: {
|
|
2635
|
+
value: setNewContext
|
|
2636
|
+
},
|
|
2637
|
+
setDisconnectedCallback: {
|
|
2638
|
+
value: setDisconnectedCallback
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2641
|
+
return _this2;
|
|
2513
2642
|
}
|
|
2514
|
-
|
|
2643
|
+
return _createClass(WireContextRegistrationEvent);
|
|
2644
|
+
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
2645
|
+
function createFieldDataCallback(vm, name) {
|
|
2646
|
+
return function (value) {
|
|
2647
|
+
updateComponentValue(vm, name, value);
|
|
2648
|
+
};
|
|
2515
2649
|
}
|
|
2516
|
-
function
|
|
2517
|
-
return {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
}
|
|
2524
|
-
return;
|
|
2525
|
-
}
|
|
2526
|
-
componentValueObserved(vm, key);
|
|
2527
|
-
return vm.cmpProps[key];
|
|
2528
|
-
},
|
|
2529
|
-
set: function set(newValue) {
|
|
2530
|
-
var vm = getAssociatedVM(this);
|
|
2531
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2532
|
-
var _vmBeingRendered3 = getVMBeingRendered();
|
|
2533
|
-
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2534
|
-
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2535
|
-
}
|
|
2536
|
-
vm.cmpProps[key] = newValue;
|
|
2537
|
-
componentValueMutated(vm, key);
|
|
2538
|
-
},
|
|
2539
|
-
enumerable: true,
|
|
2540
|
-
configurable: true
|
|
2650
|
+
function createMethodDataCallback(vm, method) {
|
|
2651
|
+
return function (value) {
|
|
2652
|
+
// dispatching new value into the wired method
|
|
2653
|
+
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
2654
|
+
// job
|
|
2655
|
+
method.call(vm.component, value);
|
|
2656
|
+
}, noop);
|
|
2541
2657
|
};
|
|
2542
2658
|
}
|
|
2543
|
-
function
|
|
2544
|
-
var
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2659
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
2660
|
+
var hasPendingConfig = false;
|
|
2661
|
+
// creating the reactive observer for reactive params when needed
|
|
2662
|
+
var ro = createReactiveObserver(function () {
|
|
2663
|
+
if (hasPendingConfig === false) {
|
|
2664
|
+
hasPendingConfig = true;
|
|
2665
|
+
// collect new config in the micro-task
|
|
2666
|
+
Promise.resolve().then(function () {
|
|
2667
|
+
hasPendingConfig = false;
|
|
2668
|
+
// resetting current reactive params
|
|
2669
|
+
ro.reset();
|
|
2670
|
+
// dispatching a new config due to a change in the configuration
|
|
2671
|
+
computeConfigAndUpdate();
|
|
2672
|
+
});
|
|
2551
2673
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2674
|
+
});
|
|
2675
|
+
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
2676
|
+
var config;
|
|
2677
|
+
ro.observe(function () {
|
|
2678
|
+
return config = configCallback(component);
|
|
2679
|
+
});
|
|
2680
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2681
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
2682
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
2683
|
+
callbackWhenConfigIsReady(config);
|
|
2684
|
+
};
|
|
2554
2685
|
return {
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
// Assert that the this value is an actual Component with an associated VM.
|
|
2558
|
-
getAssociatedVM(this);
|
|
2559
|
-
}
|
|
2560
|
-
return _get2.call(this);
|
|
2561
|
-
},
|
|
2562
|
-
set: function set(newValue) {
|
|
2563
|
-
var vm = getAssociatedVM(this);
|
|
2564
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2565
|
-
var _vmBeingRendered4 = getVMBeingRendered();
|
|
2566
|
-
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered4, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2567
|
-
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2568
|
-
}
|
|
2569
|
-
if (_set2) {
|
|
2570
|
-
_set2.call(this, newValue);
|
|
2571
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
2572
|
-
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."));
|
|
2573
|
-
}
|
|
2574
|
-
},
|
|
2575
|
-
enumerable: enumerable,
|
|
2576
|
-
configurable: configurable
|
|
2686
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
2687
|
+
ro: ro
|
|
2577
2688
|
};
|
|
2578
2689
|
}
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2585
|
-
*/
|
|
2586
|
-
function track(target) {
|
|
2587
|
-
if (arguments.length === 1) {
|
|
2588
|
-
return getReactiveProxy(target);
|
|
2690
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
2691
|
+
var adapter = wireDef.adapter;
|
|
2692
|
+
var adapterContextToken = getAdapterToken(adapter);
|
|
2693
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
2694
|
+
return; // no provider found, nothing to be done
|
|
2589
2695
|
}
|
|
2696
|
+
|
|
2697
|
+
var elm = vm.elm,
|
|
2698
|
+
_vm$context = vm.context,
|
|
2699
|
+
wiredConnecting = _vm$context.wiredConnecting,
|
|
2700
|
+
wiredDisconnecting = _vm$context.wiredDisconnecting,
|
|
2701
|
+
dispatchEvent = vm.renderer.dispatchEvent;
|
|
2702
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
2703
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
2704
|
+
// This event is responsible for connecting the host element with another
|
|
2705
|
+
// element in the composed path that is providing contextual data. The provider
|
|
2706
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
2707
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
2708
|
+
// guarantee that the linkage can be forged.
|
|
2709
|
+
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
2710
|
+
setNewContext: function setNewContext(newContext) {
|
|
2711
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
2712
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
2713
|
+
callbackWhenContextIsReady(newContext);
|
|
2714
|
+
},
|
|
2715
|
+
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
2716
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
2717
|
+
// the the element hosting the wire is disconnected
|
|
2718
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
2719
|
+
}
|
|
2720
|
+
});
|
|
2721
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
function createConnector(vm, name, wireDef) {
|
|
2725
|
+
var method = wireDef.method,
|
|
2726
|
+
adapter = wireDef.adapter,
|
|
2727
|
+
configCallback = wireDef.configCallback,
|
|
2728
|
+
dynamic = wireDef.dynamic;
|
|
2729
|
+
var debugInfo;
|
|
2590
2730
|
if (process.env.NODE_ENV !== 'production') {
|
|
2591
|
-
|
|
2731
|
+
var wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
2732
|
+
debugInfo = create(null);
|
|
2733
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2734
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
2592
2735
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2736
|
+
var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
2737
|
+
var dataCallback = function dataCallback(value) {
|
|
2738
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2739
|
+
debugInfo.data = value;
|
|
2740
|
+
// Note: most of the time, the data provided is for the current config, but there may be
|
|
2741
|
+
// some conditions in which it does not, ex:
|
|
2742
|
+
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
2743
|
+
debugInfo.wasDataProvisionedForConfig = true;
|
|
2744
|
+
}
|
|
2745
|
+
fieldOrMethodCallback(value);
|
|
2746
|
+
};
|
|
2747
|
+
var context;
|
|
2748
|
+
var connector;
|
|
2749
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
2750
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
2751
|
+
value: vm.elm
|
|
2752
|
+
});
|
|
2753
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
2754
|
+
value: dynamic
|
|
2755
|
+
});
|
|
2756
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2757
|
+
// job
|
|
2758
|
+
connector = new adapter(dataCallback);
|
|
2759
|
+
}, noop);
|
|
2760
|
+
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
2761
|
+
// every time the config is recomputed due to tracking,
|
|
2762
|
+
// this callback will be invoked with the new computed config
|
|
2763
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2764
|
+
// job
|
|
2765
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2766
|
+
debugInfo.config = config;
|
|
2767
|
+
debugInfo.context = context;
|
|
2768
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
2769
|
+
}
|
|
2770
|
+
connector.update(config, context);
|
|
2771
|
+
}, noop);
|
|
2772
|
+
};
|
|
2773
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
2774
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
2775
|
+
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
2776
|
+
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
2777
|
+
ro = _createConfigWatcher.ro;
|
|
2778
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
2779
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
2780
|
+
createContextWatcher(vm, wireDef, function (newContext) {
|
|
2781
|
+
// every time the context is pushed into this component,
|
|
2782
|
+
// this callback will be invoked with the new computed context
|
|
2783
|
+
if (context !== newContext) {
|
|
2784
|
+
context = newContext;
|
|
2785
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
2786
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
2787
|
+
// (ever), while context can have identity
|
|
2788
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
2789
|
+
computeConfigAndUpdate();
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
return {
|
|
2795
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
2796
|
+
connector: connector,
|
|
2797
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
2798
|
+
resetConfigWatcher: function resetConfigWatcher() {
|
|
2799
|
+
return ro.reset();
|
|
2800
|
+
}
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
var AdapterToTokenMap = new Map();
|
|
2804
|
+
function getAdapterToken(adapter) {
|
|
2805
|
+
return AdapterToTokenMap.get(adapter);
|
|
2806
|
+
}
|
|
2807
|
+
function setAdapterToken(adapter, token) {
|
|
2808
|
+
AdapterToTokenMap.set(adapter, token);
|
|
2809
|
+
}
|
|
2810
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2811
|
+
// support for callable adapters
|
|
2812
|
+
if (adapter.adapter) {
|
|
2813
|
+
adapter = adapter.adapter;
|
|
2814
|
+
}
|
|
2815
|
+
var method = descriptor.value;
|
|
2816
|
+
var def = {
|
|
2817
|
+
adapter: adapter,
|
|
2818
|
+
method: method,
|
|
2819
|
+
configCallback: configCallback,
|
|
2820
|
+
dynamic: dynamic
|
|
2821
|
+
};
|
|
2822
|
+
WireMetaMap.set(descriptor, def);
|
|
2823
|
+
}
|
|
2824
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2825
|
+
// support for callable adapters
|
|
2826
|
+
if (adapter.adapter) {
|
|
2827
|
+
adapter = adapter.adapter;
|
|
2828
|
+
}
|
|
2829
|
+
var def = {
|
|
2830
|
+
adapter: adapter,
|
|
2831
|
+
configCallback: configCallback,
|
|
2832
|
+
dynamic: dynamic
|
|
2833
|
+
};
|
|
2834
|
+
WireMetaMap.set(descriptor, def);
|
|
2835
|
+
}
|
|
2836
|
+
function installWireAdapters(vm) {
|
|
2837
|
+
var context = vm.context,
|
|
2838
|
+
wire = vm.def.wire;
|
|
2839
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2840
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
|
|
2841
|
+
}
|
|
2842
|
+
var wiredConnecting = context.wiredConnecting = [];
|
|
2843
|
+
var wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2844
|
+
for (var fieldNameOrMethod in wire) {
|
|
2845
|
+
var descriptor = wire[fieldNameOrMethod];
|
|
2846
|
+
var wireDef = WireMetaMap.get(descriptor);
|
|
2847
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2848
|
+
assert.invariant(wireDef, "Internal Error: invalid wire definition found.");
|
|
2849
|
+
}
|
|
2850
|
+
if (!isUndefined$1(wireDef)) {
|
|
2851
|
+
(function () {
|
|
2852
|
+
var _createConnector = createConnector(vm, fieldNameOrMethod, wireDef),
|
|
2853
|
+
connector = _createConnector.connector,
|
|
2854
|
+
computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
|
|
2855
|
+
resetConfigWatcher = _createConnector.resetConfigWatcher;
|
|
2856
|
+
var hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2857
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
2858
|
+
connector.connect();
|
|
2859
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2860
|
+
if (hasDynamicParams) {
|
|
2861
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2862
|
+
return;
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
computeConfigAndUpdate();
|
|
2866
|
+
});
|
|
2867
|
+
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
2868
|
+
connector.disconnect();
|
|
2869
|
+
resetConfigWatcher();
|
|
2870
|
+
});
|
|
2871
|
+
})();
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
function connectWireAdapters(vm) {
|
|
2876
|
+
var wiredConnecting = vm.context.wiredConnecting;
|
|
2877
|
+
for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
|
|
2878
|
+
wiredConnecting[_i8]();
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
function disconnectWireAdapters(vm) {
|
|
2882
|
+
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
2883
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2884
|
+
// job
|
|
2885
|
+
for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
|
|
2886
|
+
wiredDisconnecting[_i9]();
|
|
2887
|
+
}
|
|
2888
|
+
}, noop);
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
/*
|
|
2892
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2893
|
+
* All rights reserved.
|
|
2894
|
+
* SPDX-License-Identifier: MIT
|
|
2895
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2896
|
+
*/
|
|
2897
|
+
function api$1() {
|
|
2898
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2899
|
+
assert.fail("@api decorator can only be used as a decorator function.");
|
|
2900
|
+
}
|
|
2901
|
+
throw new Error();
|
|
2902
|
+
}
|
|
2903
|
+
function createPublicPropertyDescriptor(key) {
|
|
2904
|
+
return {
|
|
2905
|
+
get: function get() {
|
|
2906
|
+
var vm = getAssociatedVM(this);
|
|
2907
|
+
if (isBeingConstructed(vm)) {
|
|
2908
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2909
|
+
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);
|
|
2910
|
+
}
|
|
2911
|
+
return;
|
|
2912
|
+
}
|
|
2913
|
+
componentValueObserved(vm, key);
|
|
2914
|
+
return vm.cmpProps[key];
|
|
2915
|
+
},
|
|
2916
|
+
set: function set(newValue) {
|
|
2917
|
+
var vm = getAssociatedVM(this);
|
|
2918
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2919
|
+
var _vmBeingRendered3 = getVMBeingRendered();
|
|
2920
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2921
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2922
|
+
}
|
|
2923
|
+
vm.cmpProps[key] = newValue;
|
|
2924
|
+
componentValueMutated(vm, key);
|
|
2925
|
+
},
|
|
2926
|
+
enumerable: true,
|
|
2927
|
+
configurable: true
|
|
2928
|
+
};
|
|
2929
|
+
}
|
|
2930
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2931
|
+
var _get2 = descriptor.get,
|
|
2932
|
+
_set2 = descriptor.set,
|
|
2933
|
+
enumerable = descriptor.enumerable,
|
|
2934
|
+
configurable = descriptor.configurable;
|
|
2935
|
+
if (!isFunction$1(_get2)) {
|
|
2936
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2937
|
+
assert.invariant(isFunction$1(_get2), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
|
|
2938
|
+
}
|
|
2939
|
+
throw new Error();
|
|
2940
|
+
}
|
|
2941
|
+
return {
|
|
2942
|
+
get: function get() {
|
|
2943
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2944
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2945
|
+
getAssociatedVM(this);
|
|
2946
|
+
}
|
|
2947
|
+
return _get2.call(this);
|
|
2948
|
+
},
|
|
2949
|
+
set: function set(newValue) {
|
|
2950
|
+
var vm = getAssociatedVM(this);
|
|
2951
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2952
|
+
var _vmBeingRendered4 = getVMBeingRendered();
|
|
2953
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered4, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2954
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
2955
|
+
}
|
|
2956
|
+
if (_set2) {
|
|
2957
|
+
_set2.call(this, newValue);
|
|
2958
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
2959
|
+
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."));
|
|
2960
|
+
}
|
|
2961
|
+
},
|
|
2962
|
+
enumerable: enumerable,
|
|
2963
|
+
configurable: configurable
|
|
2964
|
+
};
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
/*
|
|
2968
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2969
|
+
* All rights reserved.
|
|
2970
|
+
* SPDX-License-Identifier: MIT
|
|
2971
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2972
|
+
*/
|
|
2973
|
+
function track(target) {
|
|
2974
|
+
if (arguments.length === 1) {
|
|
2975
|
+
return getReactiveProxy(target);
|
|
2976
|
+
}
|
|
2977
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2978
|
+
assert.fail("@track decorator can only be used with one argument to return a trackable object, or as a decorator function.");
|
|
2979
|
+
}
|
|
2980
|
+
throw new Error();
|
|
2981
|
+
}
|
|
2982
|
+
function internalTrackDecorator(key) {
|
|
2983
|
+
return {
|
|
2984
|
+
get: function get() {
|
|
2985
|
+
var vm = getAssociatedVM(this);
|
|
2986
|
+
componentValueObserved(vm, key);
|
|
2987
|
+
return vm.cmpFields[key];
|
|
2601
2988
|
},
|
|
2602
2989
|
set: function set(newValue) {
|
|
2603
2990
|
var vm = getAssociatedVM(this);
|
|
@@ -2830,8 +3217,8 @@ var LWC = (function (exports) {
|
|
|
2830
3217
|
}
|
|
2831
3218
|
}
|
|
2832
3219
|
if (!isUndefined$1(fields)) {
|
|
2833
|
-
for (var
|
|
2834
|
-
var _fieldName2 = fields[
|
|
3220
|
+
for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
|
|
3221
|
+
var _fieldName2 = fields[_i10];
|
|
2835
3222
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
2836
3223
|
if (process.env.NODE_ENV !== 'production') {
|
|
2837
3224
|
validateObservedField(Ctor, _fieldName2, descriptor);
|
|
@@ -3023,10 +3410,10 @@ var LWC = (function (exports) {
|
|
|
3023
3410
|
if (isFunction$1(SuperClass)) {
|
|
3024
3411
|
HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
|
|
3025
3412
|
_inherits(HTMLBridgeElement, _SuperClass);
|
|
3026
|
-
var
|
|
3413
|
+
var _super4 = _createSuper(HTMLBridgeElement);
|
|
3027
3414
|
function HTMLBridgeElement() {
|
|
3028
3415
|
_classCallCheck(this, HTMLBridgeElement);
|
|
3029
|
-
return
|
|
3416
|
+
return _super4.apply(this, arguments);
|
|
3030
3417
|
}
|
|
3031
3418
|
return _createClass(HTMLBridgeElement);
|
|
3032
3419
|
}(SuperClass);
|
|
@@ -3053,8 +3440,8 @@ var LWC = (function (exports) {
|
|
|
3053
3440
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
3054
3441
|
var descriptors = create(null);
|
|
3055
3442
|
// expose getters and setters for each public props on the new Element Bridge
|
|
3056
|
-
for (var
|
|
3057
|
-
var _propName = props[
|
|
3443
|
+
for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
|
|
3444
|
+
var _propName = props[_i11];
|
|
3058
3445
|
attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
|
|
3059
3446
|
descriptors[_propName] = {
|
|
3060
3447
|
get: createGetter(_propName),
|
|
@@ -3064,8 +3451,8 @@ var LWC = (function (exports) {
|
|
|
3064
3451
|
};
|
|
3065
3452
|
}
|
|
3066
3453
|
// expose public methods as props on the new Element Bridge
|
|
3067
|
-
for (var
|
|
3068
|
-
var methodName = methods[
|
|
3454
|
+
for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
|
|
3455
|
+
var methodName = methods[_i12];
|
|
3069
3456
|
descriptors[methodName] = {
|
|
3070
3457
|
value: createMethodCaller(methodName),
|
|
3071
3458
|
writable: true,
|
|
@@ -3565,6 +3952,7 @@ var LWC = (function (exports) {
|
|
|
3565
3952
|
setAttribute = _vm$renderer.setAttribute;
|
|
3566
3953
|
var newStylesheets = template.stylesheets,
|
|
3567
3954
|
newStylesheetToken = template.stylesheetToken;
|
|
3955
|
+
var newVmStylesheets = vm.stylesheets;
|
|
3568
3956
|
var isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3569
3957
|
var hasScopedStyles = context.hasScopedStyles;
|
|
3570
3958
|
var newToken;
|
|
@@ -3584,7 +3972,9 @@ var LWC = (function (exports) {
|
|
|
3584
3972
|
}
|
|
3585
3973
|
// Apply the new template styling token to the host element, if the new template has any
|
|
3586
3974
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3587
|
-
|
|
3975
|
+
var hasNewStylesheets = hasStyles(newStylesheets);
|
|
3976
|
+
var hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
3977
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
3588
3978
|
newToken = newStylesheetToken;
|
|
3589
3979
|
}
|
|
3590
3980
|
// Set the new styling token on the host element
|
|
@@ -3606,8 +3996,8 @@ var LWC = (function (exports) {
|
|
|
3606
3996
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3607
3997
|
var content = [];
|
|
3608
3998
|
var root;
|
|
3609
|
-
for (var
|
|
3610
|
-
var stylesheet = stylesheets[
|
|
3999
|
+
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
4000
|
+
var stylesheet = stylesheets[_i13];
|
|
3611
4001
|
if (isArray$1(stylesheet)) {
|
|
3612
4002
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3613
4003
|
} else {
|
|
@@ -3654,10 +4044,15 @@ var LWC = (function (exports) {
|
|
|
3654
4044
|
function getStylesheetsContent(vm, template) {
|
|
3655
4045
|
var stylesheets = template.stylesheets,
|
|
3656
4046
|
stylesheetToken = template.stylesheetToken;
|
|
4047
|
+
var vmStylesheets = vm.stylesheets;
|
|
3657
4048
|
var content = [];
|
|
3658
|
-
if (
|
|
4049
|
+
if (hasStyles(stylesheets)) {
|
|
3659
4050
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3660
4051
|
}
|
|
4052
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
4053
|
+
if (hasStyles(vmStylesheets)) {
|
|
4054
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
4055
|
+
}
|
|
3661
4056
|
return content;
|
|
3662
4057
|
}
|
|
3663
4058
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -3692,8 +4087,9 @@ var LWC = (function (exports) {
|
|
|
3692
4087
|
function getStylesheetTokenHost(vnode) {
|
|
3693
4088
|
var _getComponentInternal = getComponentInternalDef(vnode.ctor),
|
|
3694
4089
|
template = _getComponentInternal.template;
|
|
4090
|
+
var vm = vnode.vm;
|
|
3695
4091
|
var stylesheetToken = template.stylesheetToken;
|
|
3696
|
-
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
4092
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
|
|
3697
4093
|
}
|
|
3698
4094
|
function getNearestNativeShadowComponent(vm) {
|
|
3699
4095
|
var owner = getNearestShadowComponent(vm);
|
|
@@ -3709,8 +4105,8 @@ var LWC = (function (exports) {
|
|
|
3709
4105
|
shadowMode = vm.shadowMode,
|
|
3710
4106
|
insertStylesheet = vm.renderer.insertStylesheet;
|
|
3711
4107
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3712
|
-
for (var
|
|
3713
|
-
insertStylesheet(stylesheets[
|
|
4108
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
4109
|
+
insertStylesheet(stylesheets[_i14]);
|
|
3714
4110
|
}
|
|
3715
4111
|
} else if (vm.hydrated) {
|
|
3716
4112
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -3723,8 +4119,8 @@ var LWC = (function (exports) {
|
|
|
3723
4119
|
var root = getNearestNativeShadowComponent(vm);
|
|
3724
4120
|
// null root means a global style
|
|
3725
4121
|
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
3726
|
-
for (var
|
|
3727
|
-
insertStylesheet(stylesheets[
|
|
4122
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
4123
|
+
insertStylesheet(stylesheets[_i15], target);
|
|
3728
4124
|
}
|
|
3729
4125
|
}
|
|
3730
4126
|
return null;
|
|
@@ -4038,8 +4434,8 @@ var LWC = (function (exports) {
|
|
|
4038
4434
|
return;
|
|
4039
4435
|
}
|
|
4040
4436
|
var setCSSStyleProperty = renderer.setCSSStyleProperty;
|
|
4041
|
-
for (var
|
|
4042
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
4437
|
+
for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
|
|
4438
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
|
|
4043
4439
|
prop = _styleDecls$_i[0],
|
|
4044
4440
|
value = _styleDecls$_i[1],
|
|
4045
4441
|
important = _styleDecls$_i[2];
|
|
@@ -4282,6 +4678,26 @@ var LWC = (function (exports) {
|
|
|
4282
4678
|
// in fallback mode, the allocation will always set children to
|
|
4283
4679
|
// empty and delegate the real allocation to the slot elements
|
|
4284
4680
|
allocateChildren(n2, vm);
|
|
4681
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
4682
|
+
//
|
|
4683
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
4684
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
4685
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
4686
|
+
//
|
|
4687
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
4688
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
4689
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
4690
|
+
// mark the new children dynamic.
|
|
4691
|
+
//
|
|
4692
|
+
// Example:
|
|
4693
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
4694
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
4695
|
+
var shadowMode = vm.shadowMode,
|
|
4696
|
+
renderMode = vm.renderMode;
|
|
4697
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
4698
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
4699
|
+
markAsDynamicChildren(n2.children);
|
|
4700
|
+
}
|
|
4285
4701
|
}
|
|
4286
4702
|
// in fallback mode, the children will be always empty, so, nothing
|
|
4287
4703
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -4460,7 +4876,6 @@ var LWC = (function (exports) {
|
|
|
4460
4876
|
//
|
|
4461
4877
|
// In case #2, we will always get a fresh VCustomElement.
|
|
4462
4878
|
var children = vnode.aChildren || vnode.children;
|
|
4463
|
-
vm.aChildren = children;
|
|
4464
4879
|
var renderMode = vm.renderMode,
|
|
4465
4880
|
shadowMode = vm.shadowMode;
|
|
4466
4881
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4473,21 +4888,67 @@ var LWC = (function (exports) {
|
|
|
4473
4888
|
logError("Invalid usage of 'lwc:slot-data' on ".concat(getComponentTag(vm), " tag. Scoped slot content can only be passed to a light dom child."));
|
|
4474
4889
|
}
|
|
4475
4890
|
}
|
|
4891
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
4892
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
4893
|
+
var allocatedChildren = flattenFragmentsInChildren(children);
|
|
4894
|
+
vnode.children = allocatedChildren;
|
|
4895
|
+
vm.aChildren = allocatedChildren;
|
|
4476
4896
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
4477
4897
|
// slow path
|
|
4478
|
-
allocateInSlot(vm,
|
|
4898
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
4479
4899
|
// save the allocated children in case this vnode is reused.
|
|
4480
|
-
vnode.aChildren =
|
|
4900
|
+
vnode.aChildren = allocatedChildren;
|
|
4481
4901
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4482
4902
|
vnode.children = EmptyArray;
|
|
4483
4903
|
}
|
|
4484
4904
|
}
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4905
|
+
/**
|
|
4906
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
4907
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
4908
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
4909
|
+
*
|
|
4910
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
4911
|
+
*
|
|
4912
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
4913
|
+
*/
|
|
4914
|
+
function flattenFragmentsInChildren(children) {
|
|
4915
|
+
var flattenedChildren = [];
|
|
4916
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
4917
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4918
|
+
var nodeStack = [];
|
|
4919
|
+
var fragmentFound = false;
|
|
4920
|
+
for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
|
|
4921
|
+
var child = children[_i17];
|
|
4922
|
+
ArrayPush$1.call(nodeStack, child);
|
|
4923
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4924
|
+
}
|
|
4925
|
+
if (!fragmentFound) {
|
|
4926
|
+
return children;
|
|
4927
|
+
}
|
|
4928
|
+
var currentNode;
|
|
4929
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
4930
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4931
|
+
var fChildren = currentNode.children;
|
|
4932
|
+
// Ignore the start and end text node delimiters
|
|
4933
|
+
for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
|
|
4934
|
+
ArrayPush$1.call(nodeStack, fChildren[_i18]);
|
|
4935
|
+
}
|
|
4936
|
+
} else {
|
|
4937
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
4938
|
+
}
|
|
4939
|
+
}
|
|
4940
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
4941
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
4942
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
4943
|
+
markAsDynamicChildren(flattenedChildren);
|
|
4944
|
+
return flattenedChildren;
|
|
4945
|
+
}
|
|
4946
|
+
function createViewModelHook(elm, vnode, renderer) {
|
|
4947
|
+
var vm = getAssociatedVMIfPresent(elm);
|
|
4948
|
+
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4949
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4950
|
+
// called right after invoking `document.createElement`.
|
|
4951
|
+
if (!isUndefined$1(vm)) {
|
|
4491
4952
|
return vm;
|
|
4492
4953
|
}
|
|
4493
4954
|
var sel = vnode.sel,
|
|
@@ -4504,22 +4965,16 @@ var LWC = (function (exports) {
|
|
|
4504
4965
|
}
|
|
4505
4966
|
return vm;
|
|
4506
4967
|
}
|
|
4507
|
-
|
|
4508
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
4509
|
-
*/
|
|
4510
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
4968
|
+
function allocateInSlot(vm, children, owner) {
|
|
4511
4969
|
var _a, _b;
|
|
4512
|
-
|
|
4513
|
-
|
|
4970
|
+
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
4971
|
+
var cmpSlotsMapping = create(null);
|
|
4972
|
+
// Collect all slots into cmpSlotsMapping
|
|
4973
|
+
for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
|
|
4974
|
+
var vnode = children[_i19];
|
|
4514
4975
|
if (isNull(vnode)) {
|
|
4515
4976
|
continue;
|
|
4516
4977
|
}
|
|
4517
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
4518
|
-
if (isVFragment(vnode)) {
|
|
4519
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
4520
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
4521
|
-
continue;
|
|
4522
|
-
}
|
|
4523
4978
|
var slotName = '';
|
|
4524
4979
|
if (isVBaseElement(vnode)) {
|
|
4525
4980
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
@@ -4529,11 +4984,6 @@ var LWC = (function (exports) {
|
|
|
4529
4984
|
var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4530
4985
|
ArrayPush$1.call(vnodes, vnode);
|
|
4531
4986
|
}
|
|
4532
|
-
}
|
|
4533
|
-
function allocateInSlot(vm, children, owner) {
|
|
4534
|
-
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
4535
|
-
var cmpSlotsMapping = create(null);
|
|
4536
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
4537
4987
|
vm.cmpSlots = {
|
|
4538
4988
|
owner: owner,
|
|
4539
4989
|
slotAssignments: cmpSlotsMapping
|
|
@@ -4546,16 +4996,16 @@ var LWC = (function (exports) {
|
|
|
4546
4996
|
markComponentAsDirty(vm);
|
|
4547
4997
|
return;
|
|
4548
4998
|
}
|
|
4549
|
-
for (var
|
|
4550
|
-
var key = oldKeys[
|
|
4999
|
+
for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
|
|
5000
|
+
var key = oldKeys[_i20];
|
|
4551
5001
|
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4552
5002
|
markComponentAsDirty(vm);
|
|
4553
5003
|
return;
|
|
4554
5004
|
}
|
|
4555
5005
|
var oldVNodes = oldSlotsMapping[key];
|
|
4556
|
-
var
|
|
5006
|
+
var _vnodes = cmpSlotsMapping[key];
|
|
4557
5007
|
for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4558
|
-
if (oldVNodes[j] !==
|
|
5008
|
+
if (oldVNodes[j] !== _vnodes[j]) {
|
|
4559
5009
|
markComponentAsDirty(vm);
|
|
4560
5010
|
return;
|
|
4561
5011
|
}
|
|
@@ -4564,14 +5014,14 @@ var LWC = (function (exports) {
|
|
|
4564
5014
|
}
|
|
4565
5015
|
}
|
|
4566
5016
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4567
|
-
var
|
|
4568
|
-
// dynamic children means it was generated by an iteration
|
|
4569
|
-
//
|
|
5017
|
+
var DynamicChildren = new WeakMap();
|
|
5018
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
5019
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
4570
5020
|
function markAsDynamicChildren(children) {
|
|
4571
|
-
|
|
5021
|
+
DynamicChildren.set(children, 1);
|
|
4572
5022
|
}
|
|
4573
5023
|
function hasDynamicChildren(children) {
|
|
4574
|
-
return
|
|
5024
|
+
return DynamicChildren.has(children);
|
|
4575
5025
|
}
|
|
4576
5026
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4577
5027
|
var map = {};
|
|
@@ -4670,11 +5120,11 @@ var LWC = (function (exports) {
|
|
|
4670
5120
|
if (oldStartIdx > oldEndIdx) {
|
|
4671
5121
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4672
5122
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4673
|
-
var
|
|
5123
|
+
var _i21 = newEndIdx;
|
|
4674
5124
|
var n;
|
|
4675
5125
|
do {
|
|
4676
|
-
n = newCh[++
|
|
4677
|
-
} while (!isVNode(n) &&
|
|
5126
|
+
n = newCh[++_i21];
|
|
5127
|
+
} while (!isVNode(n) && _i21 < newChEnd);
|
|
4678
5128
|
before = isVNode(n) ? n.elm : null;
|
|
4679
5129
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4680
5130
|
} else {
|
|
@@ -4699,9 +5149,9 @@ var LWC = (function (exports) {
|
|
|
4699
5149
|
// if the old list is not empty, the new list MUST have the same
|
|
4700
5150
|
// amount of nodes, that's why we call this static children
|
|
4701
5151
|
var anchor = null;
|
|
4702
|
-
for (var
|
|
4703
|
-
var n1 = c1[
|
|
4704
|
-
var n2 = c2[
|
|
5152
|
+
for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
|
|
5153
|
+
var n1 = c1[_i22];
|
|
5154
|
+
var n2 = c2[_i22];
|
|
4705
5155
|
if (n2 !== n1) {
|
|
4706
5156
|
if (isVNode(n1)) {
|
|
4707
5157
|
if (isVNode(n2)) {
|
|
@@ -4826,8 +5276,8 @@ var LWC = (function (exports) {
|
|
|
4826
5276
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
4827
5277
|
var newChildren = [];
|
|
4828
5278
|
var slotAssignments = slotset.slotAssignments[slotName];
|
|
4829
|
-
for (var
|
|
4830
|
-
var vnode = slotAssignments[
|
|
5279
|
+
for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
|
|
5280
|
+
var vnode = slotAssignments[_i23];
|
|
4831
5281
|
if (!isNull(vnode)) {
|
|
4832
5282
|
var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
|
|
4833
5283
|
// The only sniff test for a scoped <slot> element is the presence of `slotData`
|
|
@@ -5323,7 +5773,7 @@ var LWC = (function (exports) {
|
|
|
5323
5773
|
}
|
|
5324
5774
|
function buildParseFragmentFn(createFragmentFn) {
|
|
5325
5775
|
return function (strings) {
|
|
5326
|
-
for (var
|
|
5776
|
+
for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
5327
5777
|
keys[_key3 - 1] = arguments[_key3];
|
|
5328
5778
|
}
|
|
5329
5779
|
var cache = create(null);
|
|
@@ -5352,23 +5802,23 @@ var LWC = (function (exports) {
|
|
|
5352
5802
|
var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
|
|
5353
5803
|
var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
5354
5804
|
var htmlFragment = '';
|
|
5355
|
-
for (var
|
|
5356
|
-
switch (keys[
|
|
5805
|
+
for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
|
|
5806
|
+
switch (keys[_i24]) {
|
|
5357
5807
|
case 0:
|
|
5358
5808
|
// styleToken in existing class attr
|
|
5359
|
-
htmlFragment += strings[
|
|
5809
|
+
htmlFragment += strings[_i24] + classToken;
|
|
5360
5810
|
break;
|
|
5361
5811
|
case 1:
|
|
5362
5812
|
// styleToken for added class attr
|
|
5363
|
-
htmlFragment += strings[
|
|
5813
|
+
htmlFragment += strings[_i24] + classAttrToken;
|
|
5364
5814
|
break;
|
|
5365
5815
|
case 2:
|
|
5366
5816
|
// styleToken as attr
|
|
5367
|
-
htmlFragment += strings[
|
|
5817
|
+
htmlFragment += strings[_i24] + attrToken;
|
|
5368
5818
|
break;
|
|
5369
5819
|
case 3:
|
|
5370
5820
|
// ${1}${2}
|
|
5371
|
-
htmlFragment += strings[
|
|
5821
|
+
htmlFragment += strings[_i24] + classAttrToken + attrToken;
|
|
5372
5822
|
break;
|
|
5373
5823
|
}
|
|
5374
5824
|
}
|
|
@@ -5433,7 +5883,7 @@ var LWC = (function (exports) {
|
|
|
5433
5883
|
// Create a brand new template cache for the swapped templated.
|
|
5434
5884
|
context.tplCache = create(null);
|
|
5435
5885
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5436
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
5886
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
5437
5887
|
// Update the scoping token on the host element.
|
|
5438
5888
|
updateStylesheetToken(vm, html);
|
|
5439
5889
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -5473,17 +5923,24 @@ var LWC = (function (exports) {
|
|
|
5473
5923
|
}
|
|
5474
5924
|
return vnodes;
|
|
5475
5925
|
}
|
|
5476
|
-
function
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
|
|
5926
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
5927
|
+
if (hasStyles(stylesheets)) {
|
|
5928
|
+
for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
|
|
5929
|
+
if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
|
|
5481
5930
|
return true;
|
|
5482
5931
|
}
|
|
5483
5932
|
}
|
|
5484
5933
|
}
|
|
5485
5934
|
return false;
|
|
5486
5935
|
}
|
|
5936
|
+
function computeHasScopedStyles(template, vm) {
|
|
5937
|
+
var stylesheets = template.stylesheets;
|
|
5938
|
+
var vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
5939
|
+
return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
|
|
5940
|
+
}
|
|
5941
|
+
function hasStyles(stylesheets) {
|
|
5942
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
5943
|
+
}
|
|
5487
5944
|
|
|
5488
5945
|
/*
|
|
5489
5946
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5589,8 +6046,8 @@ var LWC = (function (exports) {
|
|
|
5589
6046
|
*/
|
|
5590
6047
|
function registerComponent(
|
|
5591
6048
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
5592
|
-
Ctor,
|
|
5593
|
-
var tmpl =
|
|
6049
|
+
Ctor, _ref4) {
|
|
6050
|
+
var tmpl = _ref4.tmpl;
|
|
5594
6051
|
if (isFunction$1(Ctor)) {
|
|
5595
6052
|
if (process.env.NODE_ENV !== 'production') {
|
|
5596
6053
|
checkVersionMismatch(Ctor, 'component');
|
|
@@ -5665,8 +6122,8 @@ var LWC = (function (exports) {
|
|
|
5665
6122
|
if (process.env.NODE_ENV !== 'production') {
|
|
5666
6123
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
5667
6124
|
}
|
|
5668
|
-
for (var
|
|
5669
|
-
var hookName = hooks[
|
|
6125
|
+
for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
|
|
6126
|
+
var hookName = hooks[_i26];
|
|
5670
6127
|
if (hookName in service) {
|
|
5671
6128
|
var l = Services[hookName];
|
|
5672
6129
|
if (isUndefined$1(l)) {
|
|
@@ -5683,8 +6140,8 @@ var LWC = (function (exports) {
|
|
|
5683
6140
|
var component = vm.component,
|
|
5684
6141
|
def = vm.def,
|
|
5685
6142
|
context = vm.context;
|
|
5686
|
-
for (var
|
|
5687
|
-
cbs[
|
|
6143
|
+
for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
|
|
6144
|
+
cbs[_i27].call(undefined, component, {}, def, context);
|
|
5688
6145
|
}
|
|
5689
6146
|
}
|
|
5690
6147
|
|
|
@@ -5803,6 +6260,7 @@ var LWC = (function (exports) {
|
|
|
5803
6260
|
// Properties set right after VM creation.
|
|
5804
6261
|
tro: null,
|
|
5805
6262
|
shadowMode: null,
|
|
6263
|
+
stylesheets: null,
|
|
5806
6264
|
// Properties set by the LightningElement constructor.
|
|
5807
6265
|
component: null,
|
|
5808
6266
|
shadowRoot: null,
|
|
@@ -5815,6 +6273,7 @@ var LWC = (function (exports) {
|
|
|
5815
6273
|
if (process.env.NODE_ENV !== 'production') {
|
|
5816
6274
|
vm.debugInfo = create(null);
|
|
5817
6275
|
}
|
|
6276
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
5818
6277
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5819
6278
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5820
6279
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5833,6 +6292,40 @@ var LWC = (function (exports) {
|
|
|
5833
6292
|
}
|
|
5834
6293
|
return vm;
|
|
5835
6294
|
}
|
|
6295
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
6296
|
+
var valid = true;
|
|
6297
|
+
var validate = function validate(arrayOrStylesheet) {
|
|
6298
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
6299
|
+
for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
|
|
6300
|
+
validate(arrayOrStylesheet[_i28]);
|
|
6301
|
+
}
|
|
6302
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
6303
|
+
// function assumed to be a stylesheet factory
|
|
6304
|
+
valid = false;
|
|
6305
|
+
}
|
|
6306
|
+
};
|
|
6307
|
+
if (!isArray$1(stylesheets)) {
|
|
6308
|
+
valid = false;
|
|
6309
|
+
} else {
|
|
6310
|
+
validate(stylesheets);
|
|
6311
|
+
}
|
|
6312
|
+
return valid;
|
|
6313
|
+
}
|
|
6314
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
6315
|
+
function computeStylesheets(vm, ctor) {
|
|
6316
|
+
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
6317
|
+
var stylesheets = ctor.stylesheets;
|
|
6318
|
+
if (!isUndefined$1(stylesheets)) {
|
|
6319
|
+
var valid = validateComponentStylesheets(vm, stylesheets);
|
|
6320
|
+
if (valid) {
|
|
6321
|
+
return flattenStylesheets(stylesheets);
|
|
6322
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
6323
|
+
logError("static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <".concat(vm.tagName, ">"), vm);
|
|
6324
|
+
}
|
|
6325
|
+
}
|
|
6326
|
+
}
|
|
6327
|
+
return null;
|
|
6328
|
+
}
|
|
5836
6329
|
function computeShadowMode(vm, renderer) {
|
|
5837
6330
|
var def = vm.def;
|
|
5838
6331
|
var isSyntheticShadowDefined = renderer.isSyntheticShadowDefined,
|
|
@@ -5957,17 +6450,17 @@ var LWC = (function (exports) {
|
|
|
5957
6450
|
return a.idx - b.idx;
|
|
5958
6451
|
});
|
|
5959
6452
|
rehydrateQueue = []; // reset to a new queue
|
|
5960
|
-
for (var
|
|
5961
|
-
var vm = vms[
|
|
6453
|
+
for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
|
|
6454
|
+
var vm = vms[_i29];
|
|
5962
6455
|
try {
|
|
5963
6456
|
rehydrate(vm);
|
|
5964
6457
|
} catch (error) {
|
|
5965
|
-
if (
|
|
6458
|
+
if (_i29 + 1 < len) {
|
|
5966
6459
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
5967
6460
|
if (rehydrateQueue.length === 0) {
|
|
5968
6461
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
5969
6462
|
}
|
|
5970
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6463
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
|
|
5971
6464
|
}
|
|
5972
6465
|
// we need to end the measure before throwing.
|
|
5973
6466
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
@@ -6013,437 +6506,318 @@ var LWC = (function (exports) {
|
|
|
6013
6506
|
// this guarantees that if the component is reused/reinserted,
|
|
6014
6507
|
// it will be re-rendered because we are disconnecting the reactivity
|
|
6015
6508
|
// linking, so mutations are not automatically reflected on the state
|
|
6016
|
-
// of disconnected components.
|
|
6017
|
-
vm.isDirty = true;
|
|
6018
|
-
}
|
|
6019
|
-
vm.state = 2 /* VMState.disconnected */;
|
|
6020
|
-
// reporting disconnection
|
|
6021
|
-
var disconnected = Services.disconnected;
|
|
6022
|
-
if (disconnected) {
|
|
6023
|
-
invokeServiceHook(vm, disconnected);
|
|
6024
|
-
}
|
|
6025
|
-
if (hasWireAdapters(vm)) {
|
|
6026
|
-
disconnectWireAdapters(vm);
|
|
6027
|
-
}
|
|
6028
|
-
var disconnectedCallback = vm.def.disconnectedCallback;
|
|
6029
|
-
if (!isUndefined$1(disconnectedCallback)) {
|
|
6030
|
-
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6031
|
-
invokeComponentCallback(vm, disconnectedCallback);
|
|
6032
|
-
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6033
|
-
}
|
|
6034
|
-
}
|
|
6035
|
-
function runChildNodesDisconnectedCallback(vm) {
|
|
6036
|
-
var vCustomElementCollection = vm.velements;
|
|
6037
|
-
// Reporting disconnection for every child in inverse order since they are
|
|
6038
|
-
// inserted in reserved order.
|
|
6039
|
-
for (var
|
|
6040
|
-
var elm = vCustomElementCollection[
|
|
6041
|
-
// There are two cases where the element could be undefined:
|
|
6042
|
-
// * when there is an error during the construction phase, and an error
|
|
6043
|
-
// boundary picks it, there is a possibility that the VCustomElement
|
|
6044
|
-
// is not properly initialized, and therefore is should be ignored.
|
|
6045
|
-
// * when slotted custom element is not used by the element where it is
|
|
6046
|
-
// slotted into it, as a result, the custom element was never
|
|
6047
|
-
// initialized.
|
|
6048
|
-
if (!isUndefined$1(elm)) {
|
|
6049
|
-
var childVM = getAssociatedVMIfPresent(elm);
|
|
6050
|
-
// The VM associated with the element might be associated undefined
|
|
6051
|
-
// in the case where the VM failed in the middle of its creation,
|
|
6052
|
-
// eg: constructor throwing before invoking super().
|
|
6053
|
-
if (!isUndefined$1(childVM)) {
|
|
6054
|
-
resetComponentStateWhenRemoved(childVM);
|
|
6055
|
-
}
|
|
6056
|
-
}
|
|
6057
|
-
}
|
|
6058
|
-
}
|
|
6059
|
-
function runLightChildNodesDisconnectedCallback(vm) {
|
|
6060
|
-
var adoptedChildren = vm.aChildren;
|
|
6061
|
-
recursivelyDisconnectChildren(adoptedChildren);
|
|
6062
|
-
}
|
|
6063
|
-
/**
|
|
6064
|
-
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
6065
|
-
* instead it can be partial, when a custom element vnode is found, we don't
|
|
6066
|
-
* need to continue into its children because by attempting to disconnect the
|
|
6067
|
-
* custom element itself will trigger the removal of anything slotted or anything
|
|
6068
|
-
* defined on its shadow.
|
|
6069
|
-
*/
|
|
6070
|
-
function recursivelyDisconnectChildren(vnodes) {
|
|
6071
|
-
for (var _i26 = 0, len = vnodes.length; _i26 < len; _i26 += 1) {
|
|
6072
|
-
var vnode = vnodes[_i26];
|
|
6073
|
-
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6074
|
-
switch (vnode.type) {
|
|
6075
|
-
case 2 /* VNodeType.Element */:
|
|
6076
|
-
recursivelyDisconnectChildren(vnode.children);
|
|
6077
|
-
break;
|
|
6078
|
-
case 3 /* VNodeType.CustomElement */:
|
|
6079
|
-
{
|
|
6080
|
-
var vm = getAssociatedVM(vnode.elm);
|
|
6081
|
-
resetComponentStateWhenRemoved(vm);
|
|
6082
|
-
break;
|
|
6083
|
-
}
|
|
6084
|
-
}
|
|
6085
|
-
}
|
|
6086
|
-
}
|
|
6087
|
-
}
|
|
6088
|
-
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6089
|
-
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6090
|
-
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6091
|
-
// children VNodes might not be representing the current state of the DOM.
|
|
6092
|
-
function resetComponentRoot(vm) {
|
|
6093
|
-
var children = vm.children,
|
|
6094
|
-
renderRoot = vm.renderRoot,
|
|
6095
|
-
remove = vm.renderer.remove;
|
|
6096
|
-
for (var _i27 = 0, len = children.length; _i27 < len; _i27++) {
|
|
6097
|
-
var child = children[_i27];
|
|
6098
|
-
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6099
|
-
remove(child.elm, renderRoot);
|
|
6100
|
-
}
|
|
6101
|
-
}
|
|
6102
|
-
vm.children = EmptyArray;
|
|
6103
|
-
runChildNodesDisconnectedCallback(vm);
|
|
6104
|
-
vm.velements = EmptyArray;
|
|
6105
|
-
}
|
|
6106
|
-
function scheduleRehydration(vm) {
|
|
6107
|
-
if (isTrue(vm.isScheduled)) {
|
|
6108
|
-
return;
|
|
6109
|
-
}
|
|
6110
|
-
vm.isScheduled = true;
|
|
6111
|
-
if (rehydrateQueue.length === 0) {
|
|
6112
|
-
addCallbackToNextTick(flushRehydrationQueue);
|
|
6113
|
-
}
|
|
6114
|
-
ArrayPush$1.call(rehydrateQueue, vm);
|
|
6115
|
-
}
|
|
6116
|
-
function getErrorBoundaryVM(vm) {
|
|
6117
|
-
var currentVm = vm;
|
|
6118
|
-
while (!isNull(currentVm)) {
|
|
6119
|
-
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6120
|
-
return currentVm;
|
|
6121
|
-
}
|
|
6122
|
-
currentVm = currentVm.owner;
|
|
6123
|
-
}
|
|
6124
|
-
}
|
|
6125
|
-
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6126
|
-
var error;
|
|
6127
|
-
pre();
|
|
6128
|
-
try {
|
|
6129
|
-
job();
|
|
6130
|
-
} catch (e) {
|
|
6131
|
-
error = Object(e);
|
|
6132
|
-
} finally {
|
|
6133
|
-
post();
|
|
6134
|
-
if (!isUndefined$1(error)) {
|
|
6135
|
-
addErrorComponentStack(vm, error);
|
|
6136
|
-
var errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6137
|
-
if (isUndefined$1(errorBoundaryVm)) {
|
|
6138
|
-
throw error; // eslint-disable-line no-unsafe-finally
|
|
6139
|
-
}
|
|
6140
|
-
|
|
6141
|
-
resetComponentRoot(vm); // remove offenders
|
|
6142
|
-
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6143
|
-
// error boundaries must have an ErrorCallback
|
|
6144
|
-
var errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6145
|
-
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6146
|
-
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6147
|
-
}
|
|
6148
|
-
}
|
|
6149
|
-
}
|
|
6150
|
-
function forceRehydration(vm) {
|
|
6151
|
-
// if we must reset the shadowRoot content and render the template
|
|
6152
|
-
// from scratch on an active instance, the way to force the reset
|
|
6153
|
-
// is by replacing the value of old template, which is used during
|
|
6154
|
-
// to determine if the template has changed or not during the rendering
|
|
6155
|
-
// process. If the template returned by render() is different from the
|
|
6156
|
-
// previous stored template, the styles will be reset, along with the
|
|
6157
|
-
// content of the shadowRoot, this way we can guarantee that all children
|
|
6158
|
-
// elements will be throw away, and new instances will be created.
|
|
6159
|
-
vm.cmpTemplate = function () {
|
|
6160
|
-
return [];
|
|
6161
|
-
};
|
|
6162
|
-
if (isFalse(vm.isDirty)) {
|
|
6163
|
-
// forcing the vm to rehydrate in the next tick
|
|
6164
|
-
markComponentAsDirty(vm);
|
|
6165
|
-
scheduleRehydration(vm);
|
|
6166
|
-
}
|
|
6167
|
-
}
|
|
6168
|
-
|
|
6169
|
-
/*
|
|
6170
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6171
|
-
* All rights reserved.
|
|
6172
|
-
* SPDX-License-Identifier: MIT
|
|
6173
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6174
|
-
*/
|
|
6175
|
-
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
6176
|
-
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
6177
|
-
var WIRE_DEBUG_ENTRY = '@wire';
|
|
6178
|
-
var WireMetaMap = new Map();
|
|
6179
|
-
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
6180
|
-
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
6181
|
-
var _super4 = _createSuper(WireContextRegistrationEvent);
|
|
6182
|
-
function WireContextRegistrationEvent(adapterToken, _ref4) {
|
|
6183
|
-
var _this2;
|
|
6184
|
-
var setNewContext = _ref4.setNewContext,
|
|
6185
|
-
setDisconnectedCallback = _ref4.setDisconnectedCallback;
|
|
6186
|
-
_classCallCheck(this, WireContextRegistrationEvent);
|
|
6187
|
-
_this2 = _super4.call(this, adapterToken, {
|
|
6188
|
-
bubbles: true,
|
|
6189
|
-
composed: true
|
|
6190
|
-
});
|
|
6191
|
-
defineProperties(_assertThisInitialized(_this2), {
|
|
6192
|
-
setNewContext: {
|
|
6193
|
-
value: setNewContext
|
|
6194
|
-
},
|
|
6195
|
-
setDisconnectedCallback: {
|
|
6196
|
-
value: setDisconnectedCallback
|
|
6197
|
-
}
|
|
6198
|
-
});
|
|
6199
|
-
return _this2;
|
|
6200
|
-
}
|
|
6201
|
-
return _createClass(WireContextRegistrationEvent);
|
|
6202
|
-
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
6203
|
-
function createFieldDataCallback(vm, name) {
|
|
6204
|
-
return function (value) {
|
|
6205
|
-
updateComponentValue(vm, name, value);
|
|
6206
|
-
};
|
|
6207
|
-
}
|
|
6208
|
-
function createMethodDataCallback(vm, method) {
|
|
6209
|
-
return function (value) {
|
|
6210
|
-
// dispatching new value into the wired method
|
|
6211
|
-
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
6212
|
-
// job
|
|
6213
|
-
method.call(vm.component, value);
|
|
6214
|
-
}, noop);
|
|
6215
|
-
};
|
|
6216
|
-
}
|
|
6217
|
-
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
6218
|
-
var hasPendingConfig = false;
|
|
6219
|
-
// creating the reactive observer for reactive params when needed
|
|
6220
|
-
var ro = createReactiveObserver(function () {
|
|
6221
|
-
if (hasPendingConfig === false) {
|
|
6222
|
-
hasPendingConfig = true;
|
|
6223
|
-
// collect new config in the micro-task
|
|
6224
|
-
Promise.resolve().then(function () {
|
|
6225
|
-
hasPendingConfig = false;
|
|
6226
|
-
// resetting current reactive params
|
|
6227
|
-
ro.reset();
|
|
6228
|
-
// dispatching a new config due to a change in the configuration
|
|
6229
|
-
computeConfigAndUpdate();
|
|
6230
|
-
});
|
|
6231
|
-
}
|
|
6232
|
-
});
|
|
6233
|
-
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
6234
|
-
var config;
|
|
6235
|
-
ro.observe(function () {
|
|
6236
|
-
return config = configCallback(component);
|
|
6237
|
-
});
|
|
6238
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6239
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
6240
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
6241
|
-
callbackWhenConfigIsReady(config);
|
|
6242
|
-
};
|
|
6243
|
-
return {
|
|
6244
|
-
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
6245
|
-
ro: ro
|
|
6246
|
-
};
|
|
6247
|
-
}
|
|
6248
|
-
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
6249
|
-
var adapter = wireDef.adapter;
|
|
6250
|
-
var adapterContextToken = getAdapterToken(adapter);
|
|
6251
|
-
if (isUndefined$1(adapterContextToken)) {
|
|
6252
|
-
return; // no provider found, nothing to be done
|
|
6253
|
-
}
|
|
6254
|
-
|
|
6255
|
-
var elm = vm.elm,
|
|
6256
|
-
_vm$context = vm.context,
|
|
6257
|
-
wiredConnecting = _vm$context.wiredConnecting,
|
|
6258
|
-
wiredDisconnecting = _vm$context.wiredDisconnecting,
|
|
6259
|
-
dispatchEvent = vm.renderer.dispatchEvent;
|
|
6260
|
-
// waiting for the component to be connected to formally request the context via the token
|
|
6261
|
-
ArrayPush$1.call(wiredConnecting, function () {
|
|
6262
|
-
// This event is responsible for connecting the host element with another
|
|
6263
|
-
// element in the composed path that is providing contextual data. The provider
|
|
6264
|
-
// must be listening for a special dom event with the name corresponding to the value of
|
|
6265
|
-
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
6266
|
-
// guarantee that the linkage can be forged.
|
|
6267
|
-
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
6268
|
-
setNewContext: function setNewContext(newContext) {
|
|
6269
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6270
|
-
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
6271
|
-
callbackWhenContextIsReady(newContext);
|
|
6272
|
-
},
|
|
6273
|
-
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
6274
|
-
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
6275
|
-
// the the element hosting the wire is disconnected
|
|
6276
|
-
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
6277
|
-
}
|
|
6278
|
-
});
|
|
6279
|
-
dispatchEvent(elm, contextRegistrationEvent);
|
|
6280
|
-
});
|
|
6281
|
-
}
|
|
6282
|
-
function createConnector(vm, name, wireDef) {
|
|
6283
|
-
var method = wireDef.method,
|
|
6284
|
-
adapter = wireDef.adapter,
|
|
6285
|
-
configCallback = wireDef.configCallback,
|
|
6286
|
-
dynamic = wireDef.dynamic;
|
|
6287
|
-
var debugInfo;
|
|
6288
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6289
|
-
var wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
|
|
6290
|
-
debugInfo = create(null);
|
|
6291
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6292
|
-
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
6293
|
-
}
|
|
6294
|
-
var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
6295
|
-
var dataCallback = function dataCallback(value) {
|
|
6296
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6297
|
-
debugInfo.data = value;
|
|
6298
|
-
// Note: most of the time, the data provided is for the current config, but there may be
|
|
6299
|
-
// some conditions in which it does not, ex:
|
|
6300
|
-
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
6301
|
-
debugInfo.wasDataProvisionedForConfig = true;
|
|
6302
|
-
}
|
|
6303
|
-
fieldOrMethodCallback(value);
|
|
6304
|
-
};
|
|
6305
|
-
var context;
|
|
6306
|
-
var connector;
|
|
6307
|
-
// Workaround to pass the component element associated to this wire adapter instance.
|
|
6308
|
-
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
6309
|
-
value: vm.elm
|
|
6310
|
-
});
|
|
6311
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
6312
|
-
value: dynamic
|
|
6313
|
-
});
|
|
6314
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6315
|
-
// job
|
|
6316
|
-
connector = new adapter(dataCallback);
|
|
6317
|
-
}, noop);
|
|
6318
|
-
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
6319
|
-
// every time the config is recomputed due to tracking,
|
|
6320
|
-
// this callback will be invoked with the new computed config
|
|
6321
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6322
|
-
// job
|
|
6323
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6324
|
-
debugInfo.config = config;
|
|
6325
|
-
debugInfo.context = context;
|
|
6326
|
-
debugInfo.wasDataProvisionedForConfig = false;
|
|
6327
|
-
}
|
|
6328
|
-
connector.update(config, context);
|
|
6329
|
-
}, noop);
|
|
6330
|
-
};
|
|
6331
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
6332
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
6333
|
-
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
6334
|
-
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
6335
|
-
ro = _createConfigWatcher.ro;
|
|
6336
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
6337
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
6338
|
-
createContextWatcher(vm, wireDef, function (newContext) {
|
|
6339
|
-
// every time the context is pushed into this component,
|
|
6340
|
-
// this callback will be invoked with the new computed context
|
|
6341
|
-
if (context !== newContext) {
|
|
6342
|
-
context = newContext;
|
|
6343
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
6344
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
6345
|
-
// (ever), while context can have identity
|
|
6346
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
6347
|
-
computeConfigAndUpdate();
|
|
6348
|
-
}
|
|
6509
|
+
// of disconnected components.
|
|
6510
|
+
vm.isDirty = true;
|
|
6511
|
+
}
|
|
6512
|
+
vm.state = 2 /* VMState.disconnected */;
|
|
6513
|
+
// reporting disconnection
|
|
6514
|
+
var disconnected = Services.disconnected;
|
|
6515
|
+
if (disconnected) {
|
|
6516
|
+
invokeServiceHook(vm, disconnected);
|
|
6517
|
+
}
|
|
6518
|
+
if (hasWireAdapters(vm)) {
|
|
6519
|
+
disconnectWireAdapters(vm);
|
|
6520
|
+
}
|
|
6521
|
+
var disconnectedCallback = vm.def.disconnectedCallback;
|
|
6522
|
+
if (!isUndefined$1(disconnectedCallback)) {
|
|
6523
|
+
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6524
|
+
invokeComponentCallback(vm, disconnectedCallback);
|
|
6525
|
+
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
function runChildNodesDisconnectedCallback(vm) {
|
|
6529
|
+
var vCustomElementCollection = vm.velements;
|
|
6530
|
+
// Reporting disconnection for every child in inverse order since they are
|
|
6531
|
+
// inserted in reserved order.
|
|
6532
|
+
for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
|
|
6533
|
+
var elm = vCustomElementCollection[_i30].elm;
|
|
6534
|
+
// There are two cases where the element could be undefined:
|
|
6535
|
+
// * when there is an error during the construction phase, and an error
|
|
6536
|
+
// boundary picks it, there is a possibility that the VCustomElement
|
|
6537
|
+
// is not properly initialized, and therefore is should be ignored.
|
|
6538
|
+
// * when slotted custom element is not used by the element where it is
|
|
6539
|
+
// slotted into it, as a result, the custom element was never
|
|
6540
|
+
// initialized.
|
|
6541
|
+
if (!isUndefined$1(elm)) {
|
|
6542
|
+
var childVM = getAssociatedVMIfPresent(elm);
|
|
6543
|
+
// The VM associated with the element might be associated undefined
|
|
6544
|
+
// in the case where the VM failed in the middle of its creation,
|
|
6545
|
+
// eg: constructor throwing before invoking super().
|
|
6546
|
+
if (!isUndefined$1(childVM)) {
|
|
6547
|
+
resetComponentStateWhenRemoved(childVM);
|
|
6349
6548
|
}
|
|
6350
|
-
}
|
|
6549
|
+
}
|
|
6351
6550
|
}
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6551
|
+
}
|
|
6552
|
+
function runLightChildNodesDisconnectedCallback(vm) {
|
|
6553
|
+
var adoptedChildren = vm.aChildren;
|
|
6554
|
+
recursivelyDisconnectChildren(adoptedChildren);
|
|
6555
|
+
}
|
|
6556
|
+
/**
|
|
6557
|
+
* The recursion doesn't need to be a complete traversal of the vnode graph,
|
|
6558
|
+
* instead it can be partial, when a custom element vnode is found, we don't
|
|
6559
|
+
* need to continue into its children because by attempting to disconnect the
|
|
6560
|
+
* custom element itself will trigger the removal of anything slotted or anything
|
|
6561
|
+
* defined on its shadow.
|
|
6562
|
+
*/
|
|
6563
|
+
function recursivelyDisconnectChildren(vnodes) {
|
|
6564
|
+
for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
|
|
6565
|
+
var vnode = vnodes[_i31];
|
|
6566
|
+
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6567
|
+
switch (vnode.type) {
|
|
6568
|
+
case 2 /* VNodeType.Element */:
|
|
6569
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
6570
|
+
break;
|
|
6571
|
+
case 3 /* VNodeType.CustomElement */:
|
|
6572
|
+
{
|
|
6573
|
+
var vm = getAssociatedVM(vnode.elm);
|
|
6574
|
+
resetComponentStateWhenRemoved(vm);
|
|
6575
|
+
break;
|
|
6576
|
+
}
|
|
6577
|
+
}
|
|
6358
6578
|
}
|
|
6359
|
-
}
|
|
6579
|
+
}
|
|
6360
6580
|
}
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6581
|
+
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
6582
|
+
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
6583
|
+
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
6584
|
+
// children VNodes might not be representing the current state of the DOM.
|
|
6585
|
+
function resetComponentRoot(vm) {
|
|
6586
|
+
var children = vm.children,
|
|
6587
|
+
renderRoot = vm.renderRoot,
|
|
6588
|
+
remove = vm.renderer.remove;
|
|
6589
|
+
for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
|
|
6590
|
+
var child = children[_i32];
|
|
6591
|
+
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6592
|
+
remove(child.elm, renderRoot);
|
|
6593
|
+
}
|
|
6594
|
+
}
|
|
6595
|
+
vm.children = EmptyArray;
|
|
6596
|
+
runChildNodesDisconnectedCallback(vm);
|
|
6597
|
+
vm.velements = EmptyArray;
|
|
6364
6598
|
}
|
|
6365
|
-
function
|
|
6366
|
-
|
|
6599
|
+
function scheduleRehydration(vm) {
|
|
6600
|
+
if (isTrue(vm.isScheduled)) {
|
|
6601
|
+
return;
|
|
6602
|
+
}
|
|
6603
|
+
vm.isScheduled = true;
|
|
6604
|
+
if (rehydrateQueue.length === 0) {
|
|
6605
|
+
addCallbackToNextTick(flushRehydrationQueue);
|
|
6606
|
+
}
|
|
6607
|
+
ArrayPush$1.call(rehydrateQueue, vm);
|
|
6367
6608
|
}
|
|
6368
|
-
function
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6609
|
+
function getErrorBoundaryVM(vm) {
|
|
6610
|
+
var currentVm = vm;
|
|
6611
|
+
while (!isNull(currentVm)) {
|
|
6612
|
+
if (!isUndefined$1(currentVm.def.errorCallback)) {
|
|
6613
|
+
return currentVm;
|
|
6614
|
+
}
|
|
6615
|
+
currentVm = currentVm.owner;
|
|
6372
6616
|
}
|
|
6373
|
-
var method = descriptor.value;
|
|
6374
|
-
var def = {
|
|
6375
|
-
adapter: adapter,
|
|
6376
|
-
method: method,
|
|
6377
|
-
configCallback: configCallback,
|
|
6378
|
-
dynamic: dynamic
|
|
6379
|
-
};
|
|
6380
|
-
WireMetaMap.set(descriptor, def);
|
|
6381
6617
|
}
|
|
6382
|
-
function
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6618
|
+
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
6619
|
+
var error;
|
|
6620
|
+
pre();
|
|
6621
|
+
try {
|
|
6622
|
+
job();
|
|
6623
|
+
} catch (e) {
|
|
6624
|
+
error = Object(e);
|
|
6625
|
+
} finally {
|
|
6626
|
+
post();
|
|
6627
|
+
if (!isUndefined$1(error)) {
|
|
6628
|
+
addErrorComponentStack(vm, error);
|
|
6629
|
+
var errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
6630
|
+
if (isUndefined$1(errorBoundaryVm)) {
|
|
6631
|
+
throw error; // eslint-disable-line no-unsafe-finally
|
|
6632
|
+
}
|
|
6633
|
+
|
|
6634
|
+
resetComponentRoot(vm); // remove offenders
|
|
6635
|
+
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
6636
|
+
// error boundaries must have an ErrorCallback
|
|
6637
|
+
var errorCallback = errorBoundaryVm.def.errorCallback;
|
|
6638
|
+
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
6639
|
+
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6640
|
+
}
|
|
6386
6641
|
}
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6642
|
+
}
|
|
6643
|
+
function forceRehydration(vm) {
|
|
6644
|
+
// if we must reset the shadowRoot content and render the template
|
|
6645
|
+
// from scratch on an active instance, the way to force the reset
|
|
6646
|
+
// is by replacing the value of old template, which is used during
|
|
6647
|
+
// to determine if the template has changed or not during the rendering
|
|
6648
|
+
// process. If the template returned by render() is different from the
|
|
6649
|
+
// previous stored template, the styles will be reset, along with the
|
|
6650
|
+
// content of the shadowRoot, this way we can guarantee that all children
|
|
6651
|
+
// elements will be throw away, and new instances will be created.
|
|
6652
|
+
vm.cmpTemplate = function () {
|
|
6653
|
+
return [];
|
|
6391
6654
|
};
|
|
6392
|
-
|
|
6655
|
+
if (isFalse(vm.isDirty)) {
|
|
6656
|
+
// forcing the vm to rehydrate in the next tick
|
|
6657
|
+
markComponentAsDirty(vm);
|
|
6658
|
+
scheduleRehydration(vm);
|
|
6659
|
+
}
|
|
6393
6660
|
}
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6661
|
+
|
|
6662
|
+
/*
|
|
6663
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6664
|
+
* All rights reserved.
|
|
6665
|
+
* SPDX-License-Identifier: MIT
|
|
6666
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6667
|
+
*/
|
|
6668
|
+
//
|
|
6669
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
6670
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
6671
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
6672
|
+
// See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
|
|
6673
|
+
//
|
|
6674
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
6675
|
+
var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6676
|
+
var querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6677
|
+
function isSyntheticShadowRootInstance(rootNode) {
|
|
6678
|
+
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
6679
|
+
}
|
|
6680
|
+
function reportViolation(source, target, attrName) {
|
|
6681
|
+
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
6682
|
+
// shadow for a violation to be detected.
|
|
6683
|
+
var vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
6684
|
+
if (isUndefined$1(vm)) {
|
|
6685
|
+
vm = getAssociatedVMIfPresent(target.getRootNode().host);
|
|
6686
|
+
}
|
|
6687
|
+
if (isUndefined$1(vm)) {
|
|
6688
|
+
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
6689
|
+
return;
|
|
6690
|
+
}
|
|
6691
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
|
|
6397
6692
|
if (process.env.NODE_ENV !== 'production') {
|
|
6398
|
-
|
|
6693
|
+
// Avoid excessively logging to the console in the case of duplicates.
|
|
6694
|
+
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);
|
|
6399
6695
|
}
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6696
|
+
}
|
|
6697
|
+
function parseIdRefAttributeValue(attrValue) {
|
|
6698
|
+
// split on whitespace and skip empty strings after splitting
|
|
6699
|
+
return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
|
|
6700
|
+
}
|
|
6701
|
+
function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
|
|
6702
|
+
var root = elm.getRootNode();
|
|
6703
|
+
if (!isSyntheticShadowRootInstance(root)) {
|
|
6704
|
+
return;
|
|
6705
|
+
}
|
|
6706
|
+
if (attrName === 'id') {
|
|
6707
|
+
// elm is the target, find the source
|
|
6708
|
+
if (!isString(attrValue) || attrValue.length === 0) {
|
|
6709
|
+
// if our id is null or empty, nobody can reference us
|
|
6710
|
+
return;
|
|
6407
6711
|
}
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6712
|
+
var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
|
|
6713
|
+
_step5;
|
|
6714
|
+
try {
|
|
6715
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
6716
|
+
var idRefAttrName = _step5.value;
|
|
6717
|
+
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
6718
|
+
// that reference multiple IDs, separated by whitespace.
|
|
6719
|
+
var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
|
|
6720
|
+
var sourceElements = querySelectorAll.call(document, query);
|
|
6721
|
+
for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
|
|
6722
|
+
var sourceElement = sourceElements[_i33];
|
|
6723
|
+
var sourceRoot = sourceElement.getRootNode();
|
|
6724
|
+
if (sourceRoot !== root) {
|
|
6725
|
+
reportViolation(sourceElement, elm, idRefAttrName);
|
|
6726
|
+
break;
|
|
6422
6727
|
}
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6728
|
+
}
|
|
6729
|
+
}
|
|
6730
|
+
} catch (err) {
|
|
6731
|
+
_iterator5.e(err);
|
|
6732
|
+
} finally {
|
|
6733
|
+
_iterator5.f();
|
|
6734
|
+
}
|
|
6735
|
+
} else {
|
|
6736
|
+
// elm is the source, find the target
|
|
6737
|
+
var ids = parseIdRefAttributeValue(attrValue);
|
|
6738
|
+
var _iterator6 = _createForOfIteratorHelper(ids),
|
|
6739
|
+
_step6;
|
|
6740
|
+
try {
|
|
6741
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
6742
|
+
var id = _step6.value;
|
|
6743
|
+
var target = getElementById.call(document, id);
|
|
6744
|
+
if (!isNull(target)) {
|
|
6745
|
+
var targetRoot = target.getRootNode();
|
|
6746
|
+
if (targetRoot !== root) {
|
|
6747
|
+
// target element's shadow root is not the same as ours
|
|
6748
|
+
reportViolation(elm, target, attrName);
|
|
6749
|
+
}
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
} catch (err) {
|
|
6753
|
+
_iterator6.e(err);
|
|
6754
|
+
} finally {
|
|
6755
|
+
_iterator6.f();
|
|
6430
6756
|
}
|
|
6431
6757
|
}
|
|
6432
6758
|
}
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6759
|
+
var enabled = false;
|
|
6760
|
+
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
6761
|
+
// reporting is not enabled. It should also only run once
|
|
6762
|
+
function enableDetection() {
|
|
6763
|
+
if (enabled) {
|
|
6764
|
+
return; // don't double-apply the patches
|
|
6437
6765
|
}
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
var
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6766
|
+
|
|
6767
|
+
enabled = true;
|
|
6768
|
+
var _setAttribute = Element.prototype.setAttribute;
|
|
6769
|
+
// Detect calling `setAttribute` to set an idref or an id
|
|
6770
|
+
assign(Element.prototype, {
|
|
6771
|
+
setAttribute: function setAttribute(attrName, attrValue) {
|
|
6772
|
+
_setAttribute.call(this, attrName, attrValue);
|
|
6773
|
+
if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
|
|
6774
|
+
detectSyntheticCrossRootAria(this, attrName, attrValue);
|
|
6775
|
+
}
|
|
6445
6776
|
}
|
|
6446
|
-
}
|
|
6777
|
+
});
|
|
6778
|
+
// Detect `elm.id = 'foo'`
|
|
6779
|
+
var idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
|
|
6780
|
+
if (!isUndefined$1(idDescriptor)) {
|
|
6781
|
+
var _get3 = idDescriptor.get,
|
|
6782
|
+
_set3 = idDescriptor.set;
|
|
6783
|
+
// These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
|
|
6784
|
+
if (isFunction$1(_get3) && isFunction$1(_set3)) {
|
|
6785
|
+
defineProperty(Element.prototype, 'id', {
|
|
6786
|
+
get: function get() {
|
|
6787
|
+
return _get3.call(this);
|
|
6788
|
+
},
|
|
6789
|
+
set: function set(value) {
|
|
6790
|
+
_set3.call(this, value);
|
|
6791
|
+
detectSyntheticCrossRootAria(this, 'id', value);
|
|
6792
|
+
},
|
|
6793
|
+
// On the default descriptor for 'id', enumerable and configurable are true
|
|
6794
|
+
enumerable: true,
|
|
6795
|
+
configurable: true
|
|
6796
|
+
});
|
|
6797
|
+
}
|
|
6798
|
+
}
|
|
6799
|
+
}
|
|
6800
|
+
// Our detection logic relies on some modern browser features. We can just skip reporting the data
|
|
6801
|
+
// for unsupported browsers
|
|
6802
|
+
function supportsCssEscape() {
|
|
6803
|
+
return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
|
|
6804
|
+
}
|
|
6805
|
+
// If this page is not using synthetic shadow, then we don't need to install detection. Note
|
|
6806
|
+
// that we are assuming synthetic shadow is loaded before LWC.
|
|
6807
|
+
function isSyntheticShadowLoaded() {
|
|
6808
|
+
// We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
|
|
6809
|
+
// and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
|
|
6810
|
+
return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
6811
|
+
}
|
|
6812
|
+
// Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
|
|
6813
|
+
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
6814
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
6815
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6816
|
+
enableDetection();
|
|
6817
|
+
} else {
|
|
6818
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
6819
|
+
onReportingEnabled(enableDetection);
|
|
6820
|
+
}
|
|
6447
6821
|
}
|
|
6448
6822
|
|
|
6449
6823
|
/*
|
|
@@ -6680,8 +7054,8 @@ var LWC = (function (exports) {
|
|
|
6680
7054
|
var nextNode = node;
|
|
6681
7055
|
var anchor = null;
|
|
6682
7056
|
var renderer = owner.renderer;
|
|
6683
|
-
for (var
|
|
6684
|
-
var childVnode = children[
|
|
7057
|
+
for (var _i34 = 0; _i34 < children.length; _i34++) {
|
|
7058
|
+
var childVnode = children[_i34];
|
|
6685
7059
|
if (!isNull(childVnode)) {
|
|
6686
7060
|
if (nextNode) {
|
|
6687
7061
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
@@ -6759,8 +7133,8 @@ var LWC = (function (exports) {
|
|
|
6759
7133
|
var nodesAreCompatible = true;
|
|
6760
7134
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
6761
7135
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6762
|
-
for (var
|
|
6763
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[
|
|
7136
|
+
for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
|
|
7137
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
|
|
6764
7138
|
attrName = _Object$entries$_i[0],
|
|
6765
7139
|
attrValue = _Object$entries$_i[1];
|
|
6766
7140
|
var owner = vnode.owner;
|
|
@@ -6861,8 +7235,8 @@ var LWC = (function (exports) {
|
|
|
6861
7235
|
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6862
7236
|
var expectedStyle = [];
|
|
6863
7237
|
// styleMap is used when style is set to static value.
|
|
6864
|
-
for (var
|
|
6865
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[
|
|
7238
|
+
for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
|
|
7239
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
|
|
6866
7240
|
prop = _styleDecls$_i2[0],
|
|
6867
7241
|
value = _styleDecls$_i2[1],
|
|
6868
7242
|
important = _styleDecls$_i2[2];
|
|
@@ -6979,11 +7353,11 @@ var LWC = (function (exports) {
|
|
|
6979
7353
|
function warnOnArrayMutation(stylesheets) {
|
|
6980
7354
|
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6981
7355
|
// we can at least warn when they use the most common mutation methods.
|
|
6982
|
-
var
|
|
6983
|
-
|
|
7356
|
+
var _iterator7 = _createForOfIteratorHelper(ARRAY_MUTATION_METHODS),
|
|
7357
|
+
_step7;
|
|
6984
7358
|
try {
|
|
6985
7359
|
var _loop2 = function _loop2() {
|
|
6986
|
-
var prop =
|
|
7360
|
+
var prop = _step7.value;
|
|
6987
7361
|
var originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6988
7362
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6989
7363
|
logError("Mutating the \"stylesheets\" array on a template function " + "is deprecated and may be removed in a future version of LWC.");
|
|
@@ -6991,24 +7365,24 @@ var LWC = (function (exports) {
|
|
|
6991
7365
|
return originalArrayMethod.apply(this, arguments);
|
|
6992
7366
|
};
|
|
6993
7367
|
};
|
|
6994
|
-
for (
|
|
7368
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
6995
7369
|
_loop2();
|
|
6996
7370
|
}
|
|
6997
7371
|
} catch (err) {
|
|
6998
|
-
|
|
7372
|
+
_iterator7.e(err);
|
|
6999
7373
|
} finally {
|
|
7000
|
-
|
|
7374
|
+
_iterator7.f();
|
|
7001
7375
|
}
|
|
7002
7376
|
}
|
|
7003
7377
|
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
7004
7378
|
// `stylesheet.$scoped$ = true`
|
|
7005
7379
|
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
7006
7380
|
// We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
|
|
7007
|
-
var
|
|
7008
|
-
|
|
7381
|
+
var _iterator8 = _createForOfIteratorHelper(STYLESHEET_FUNCTION_EXPANDOS),
|
|
7382
|
+
_step8;
|
|
7009
7383
|
try {
|
|
7010
7384
|
var _loop3 = function _loop3() {
|
|
7011
|
-
var prop =
|
|
7385
|
+
var prop = _step8.value;
|
|
7012
7386
|
var value = stylesheet[prop];
|
|
7013
7387
|
defineProperty(stylesheet, prop, {
|
|
7014
7388
|
enumerable: true,
|
|
@@ -7022,13 +7396,13 @@ var LWC = (function (exports) {
|
|
|
7022
7396
|
}
|
|
7023
7397
|
});
|
|
7024
7398
|
};
|
|
7025
|
-
for (
|
|
7399
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7026
7400
|
_loop3();
|
|
7027
7401
|
}
|
|
7028
7402
|
} catch (err) {
|
|
7029
|
-
|
|
7403
|
+
_iterator8.e(err);
|
|
7030
7404
|
} finally {
|
|
7031
|
-
|
|
7405
|
+
_iterator8.f();
|
|
7032
7406
|
}
|
|
7033
7407
|
}
|
|
7034
7408
|
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
@@ -7050,8 +7424,8 @@ var LWC = (function (exports) {
|
|
|
7050
7424
|
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
7051
7425
|
function traverseStylesheets(stylesheets, callback) {
|
|
7052
7426
|
callback(stylesheets);
|
|
7053
|
-
for (var
|
|
7054
|
-
var stylesheet = stylesheets[
|
|
7427
|
+
for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
|
|
7428
|
+
var stylesheet = stylesheets[_i37];
|
|
7055
7429
|
if (isArray$1(stylesheet)) {
|
|
7056
7430
|
traverseStylesheets(stylesheet, callback);
|
|
7057
7431
|
} else {
|
|
@@ -7097,11 +7471,11 @@ var LWC = (function (exports) {
|
|
|
7097
7471
|
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
7098
7472
|
warnOnStylesheetsMutation(tmpl.stylesheets);
|
|
7099
7473
|
}
|
|
7100
|
-
var
|
|
7101
|
-
|
|
7474
|
+
var _iterator9 = _createForOfIteratorHelper(TEMPLATE_PROPS),
|
|
7475
|
+
_step9;
|
|
7102
7476
|
try {
|
|
7103
7477
|
var _loop4 = function _loop4() {
|
|
7104
|
-
var prop =
|
|
7478
|
+
var prop = _step9.value;
|
|
7105
7479
|
var value = tmpl[prop];
|
|
7106
7480
|
defineProperty(tmpl, prop, {
|
|
7107
7481
|
enumerable: true,
|
|
@@ -7117,13 +7491,13 @@ var LWC = (function (exports) {
|
|
|
7117
7491
|
}
|
|
7118
7492
|
});
|
|
7119
7493
|
};
|
|
7120
|
-
for (
|
|
7494
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
7121
7495
|
_loop4();
|
|
7122
7496
|
}
|
|
7123
7497
|
} catch (err) {
|
|
7124
|
-
|
|
7498
|
+
_iterator9.e(err);
|
|
7125
7499
|
} finally {
|
|
7126
|
-
|
|
7500
|
+
_iterator9.f();
|
|
7127
7501
|
}
|
|
7128
7502
|
var originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7129
7503
|
defineProperty(tmpl, 'stylesheetTokens', {
|
|
@@ -7164,7 +7538,7 @@ var LWC = (function (exports) {
|
|
|
7164
7538
|
}
|
|
7165
7539
|
return ctor;
|
|
7166
7540
|
}
|
|
7167
|
-
/* version: 2.
|
|
7541
|
+
/* version: 2.35.0 */
|
|
7168
7542
|
|
|
7169
7543
|
/*
|
|
7170
7544
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7267,7 +7641,9 @@ var LWC = (function (exports) {
|
|
|
7267
7641
|
//
|
|
7268
7642
|
// Test utilities
|
|
7269
7643
|
//
|
|
7270
|
-
|
|
7644
|
+
// Only used in LWC's Karma tests
|
|
7645
|
+
// @ts-ignore
|
|
7646
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7271
7647
|
// @ts-ignore
|
|
7272
7648
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7273
7649
|
stylesheetCache.clear();
|
|
@@ -7846,17 +8222,17 @@ var LWC = (function (exports) {
|
|
|
7846
8222
|
function flushPendingWhenDefinedCallbacks(tagName, ctor) {
|
|
7847
8223
|
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
7848
8224
|
if (!isUndefined$1(resolvers)) {
|
|
7849
|
-
var
|
|
7850
|
-
|
|
8225
|
+
var _iterator10 = _createForOfIteratorHelper(resolvers),
|
|
8226
|
+
_step10;
|
|
7851
8227
|
try {
|
|
7852
|
-
for (
|
|
7853
|
-
var resolver =
|
|
8228
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
8229
|
+
var resolver = _step10.value;
|
|
7854
8230
|
resolver(ctor);
|
|
7855
8231
|
}
|
|
7856
8232
|
} catch (err) {
|
|
7857
|
-
|
|
8233
|
+
_iterator10.e(err);
|
|
7858
8234
|
} finally {
|
|
7859
|
-
|
|
8235
|
+
_iterator10.f();
|
|
7860
8236
|
}
|
|
7861
8237
|
}
|
|
7862
8238
|
pendingWhenDefinedCallbacks.delete(tagName);
|
|
@@ -7906,11 +8282,11 @@ var LWC = (function (exports) {
|
|
|
7906
8282
|
var awaiting = awaitingUpgrade.get(tagName);
|
|
7907
8283
|
if (!isUndefined$1(awaiting)) {
|
|
7908
8284
|
awaitingUpgrade.delete(tagName);
|
|
7909
|
-
var
|
|
7910
|
-
|
|
8285
|
+
var _iterator11 = _createForOfIteratorHelper(awaiting),
|
|
8286
|
+
_step11;
|
|
7911
8287
|
try {
|
|
7912
|
-
for (
|
|
7913
|
-
var element =
|
|
8288
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
8289
|
+
var element = _step11.value;
|
|
7914
8290
|
var registeredDefinition = pendingRegistryForElement.get(element);
|
|
7915
8291
|
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
7916
8292
|
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
@@ -7922,9 +8298,9 @@ var LWC = (function (exports) {
|
|
|
7922
8298
|
}
|
|
7923
8299
|
}
|
|
7924
8300
|
} catch (err) {
|
|
7925
|
-
|
|
8301
|
+
_iterator11.e(err);
|
|
7926
8302
|
} finally {
|
|
7927
|
-
|
|
8303
|
+
_iterator11.f();
|
|
7928
8304
|
}
|
|
7929
8305
|
}
|
|
7930
8306
|
// If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
|
|
@@ -8201,7 +8577,7 @@ var LWC = (function (exports) {
|
|
|
8201
8577
|
function isNull(obj) {
|
|
8202
8578
|
return obj === null;
|
|
8203
8579
|
}
|
|
8204
|
-
/** version: 2.
|
|
8580
|
+
/** version: 2.35.0 */
|
|
8205
8581
|
|
|
8206
8582
|
/*
|
|
8207
8583
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8260,17 +8636,17 @@ var LWC = (function (exports) {
|
|
|
8260
8636
|
exports.createFragment = function (html) {
|
|
8261
8637
|
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
8262
8638
|
if (!isUndefined(wrapperTags)) {
|
|
8263
|
-
var
|
|
8264
|
-
|
|
8639
|
+
var _iterator12 = _createForOfIteratorHelper(wrapperTags),
|
|
8640
|
+
_step12;
|
|
8265
8641
|
try {
|
|
8266
|
-
for (
|
|
8267
|
-
var wrapperTag =
|
|
8642
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
8643
|
+
var wrapperTag = _step12.value;
|
|
8268
8644
|
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
8269
8645
|
}
|
|
8270
8646
|
} catch (err) {
|
|
8271
|
-
|
|
8647
|
+
_iterator12.e(err);
|
|
8272
8648
|
} finally {
|
|
8273
|
-
|
|
8649
|
+
_iterator12.f();
|
|
8274
8650
|
}
|
|
8275
8651
|
}
|
|
8276
8652
|
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
@@ -8279,7 +8655,7 @@ var LWC = (function (exports) {
|
|
|
8279
8655
|
doc.body.innerHTML = html;
|
|
8280
8656
|
var content = doc.body;
|
|
8281
8657
|
if (!isUndefined(wrapperTags)) {
|
|
8282
|
-
for (var
|
|
8658
|
+
for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
|
|
8283
8659
|
content = content.firstChild;
|
|
8284
8660
|
}
|
|
8285
8661
|
}
|
|
@@ -8472,8 +8848,8 @@ var LWC = (function (exports) {
|
|
|
8472
8848
|
tagName: element.tagName.toLowerCase(),
|
|
8473
8849
|
hydrated: true
|
|
8474
8850
|
});
|
|
8475
|
-
for (var
|
|
8476
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
8851
|
+
for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
|
|
8852
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
|
|
8477
8853
|
key = _Object$entries2$_i[0],
|
|
8478
8854
|
value = _Object$entries2$_i[1];
|
|
8479
8855
|
element[key] = value;
|
|
@@ -8767,10 +9143,11 @@ var LWC = (function (exports) {
|
|
|
8767
9143
|
});
|
|
8768
9144
|
freeze(LightningElement);
|
|
8769
9145
|
seal(LightningElement.prototype);
|
|
8770
|
-
/* version: 2.
|
|
9146
|
+
/* version: 2.35.0 */
|
|
8771
9147
|
|
|
8772
9148
|
exports.LightningElement = LightningElement;
|
|
8773
9149
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
9150
|
+
exports.__unstable__ReportingControl = reportingControl;
|
|
8774
9151
|
exports.api = api$1;
|
|
8775
9152
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
8776
9153
|
exports.createContextProvider = createContextProvider;
|