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