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; }
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
ArrayIndexOf = _Array$prototype.indexOf,
|
|
94
94
|
ArrayJoin = _Array$prototype.join,
|
|
95
95
|
ArrayMap = _Array$prototype.map,
|
|
96
|
+
ArrayPop = _Array$prototype.pop,
|
|
96
97
|
ArrayPush$1 = _Array$prototype.push,
|
|
97
98
|
ArraySlice = _Array$prototype.slice,
|
|
98
99
|
ArraySplice = _Array$prototype.splice,
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
var _String$prototype = String.prototype,
|
|
103
104
|
StringCharCodeAt = _String$prototype.charCodeAt,
|
|
104
105
|
StringReplace = _String$prototype.replace,
|
|
106
|
+
StringSplit = _String$prototype.split,
|
|
105
107
|
StringSlice = _String$prototype.slice,
|
|
106
108
|
StringToLowerCase = _String$prototype.toLowerCase;
|
|
107
109
|
function isUndefined$1(obj) {
|
|
@@ -194,6 +196,9 @@
|
|
|
194
196
|
}(),
|
|
195
197
|
AriaAttrNameToPropNameMap = _ref.AriaAttrNameToPropNameMap,
|
|
196
198
|
AriaPropNameToAttrNameMap = _ref.AriaPropNameToAttrNameMap;
|
|
199
|
+
// These attributes take either an ID or a list of IDs as values.
|
|
200
|
+
// This includes aria-* attributes as well as the special non-ARIA "for" attribute
|
|
201
|
+
var ID_REFERENCING_ATTRIBUTES_SET = new Set(['aria-activedescendant', 'aria-controls', 'aria-describedby', 'aria-details', 'aria-errormessage', 'aria-flowto', 'aria-labelledby', 'aria-owns', 'for']);
|
|
197
202
|
|
|
198
203
|
/*
|
|
199
204
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -247,6 +252,8 @@
|
|
|
247
252
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
248
253
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
249
254
|
var KEY__SCOPED_CSS = '$scoped$';
|
|
255
|
+
var KEY__NATIVE_GET_ELEMENT_BY_ID = '$nativeGetElementById$';
|
|
256
|
+
var KEY__NATIVE_QUERY_SELECTOR_ALL = '$nativeQuerySelectorAll$';
|
|
250
257
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
251
258
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
252
259
|
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
@@ -334,7 +341,7 @@
|
|
|
334
341
|
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
335
342
|
return propertyName;
|
|
336
343
|
}
|
|
337
|
-
/** version: 2.
|
|
344
|
+
/** version: 2.35.0 */
|
|
338
345
|
|
|
339
346
|
/**
|
|
340
347
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -356,7 +363,8 @@
|
|
|
356
363
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
357
364
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
358
365
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
359
|
-
DISABLE_ARIA_REFLECTION_POLYFILL: null
|
|
366
|
+
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
367
|
+
ENABLE_PROGRAMMATIC_STYLESHEETS: null
|
|
360
368
|
};
|
|
361
369
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
362
370
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
@@ -404,7 +412,7 @@
|
|
|
404
412
|
*/
|
|
405
413
|
function setFeatureFlagForTest(name, value) {
|
|
406
414
|
}
|
|
407
|
-
/** version: 2.
|
|
415
|
+
/** version: 2.35.0 */
|
|
408
416
|
|
|
409
417
|
/**
|
|
410
418
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -468,7 +476,7 @@
|
|
|
468
476
|
}
|
|
469
477
|
}
|
|
470
478
|
}
|
|
471
|
-
/** version: 2.
|
|
479
|
+
/** version: 2.35.0 */
|
|
472
480
|
|
|
473
481
|
/*
|
|
474
482
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -488,80 +496,154 @@
|
|
|
488
496
|
* SPDX-License-Identifier: MIT
|
|
489
497
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
490
498
|
*/
|
|
491
|
-
|
|
492
|
-
var
|
|
493
|
-
|
|
494
|
-
var
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
499
|
+
/** Callbacks to invoke when reporting is enabled **/
|
|
500
|
+
var onReportingEnabledCallbacks = [];
|
|
501
|
+
/** The currently assigned reporting dispatcher. */
|
|
502
|
+
var currentDispatcher$1 = noop;
|
|
503
|
+
/**
|
|
504
|
+
* Whether reporting is enabled.
|
|
505
|
+
*
|
|
506
|
+
* Note that this may seem redundant, given you can just check if the currentDispatcher is undefined,
|
|
507
|
+
* but it turns out that Terser only strips out unused code if we use this explicit boolean.
|
|
508
|
+
*/
|
|
509
|
+
var enabled$1 = false;
|
|
510
|
+
var reportingControl = {
|
|
511
|
+
/**
|
|
512
|
+
* Attach a new reporting control (aka dispatcher).
|
|
513
|
+
*
|
|
514
|
+
* @param dispatcher - reporting control
|
|
515
|
+
*/
|
|
516
|
+
attachDispatcher: function attachDispatcher(dispatcher) {
|
|
517
|
+
enabled$1 = true;
|
|
518
|
+
currentDispatcher$1 = dispatcher;
|
|
519
|
+
var _iterator = _createForOfIteratorHelper(onReportingEnabledCallbacks),
|
|
520
|
+
_step;
|
|
521
|
+
try {
|
|
522
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
523
|
+
var callback = _step.value;
|
|
524
|
+
try {
|
|
525
|
+
callback();
|
|
526
|
+
} catch (err) {
|
|
527
|
+
// This should never happen. But if it does, we don't want one callback to cause another to fail
|
|
528
|
+
// eslint-disable-next-line no-console
|
|
529
|
+
console.error('Could not invoke callback', err);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
} catch (err) {
|
|
533
|
+
_iterator.e(err);
|
|
534
|
+
} finally {
|
|
535
|
+
_iterator.f();
|
|
536
|
+
}
|
|
537
|
+
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
538
|
+
},
|
|
539
|
+
/**
|
|
540
|
+
* Detach the current reporting control (aka dispatcher).
|
|
541
|
+
*/
|
|
542
|
+
detachDispatcher: function detachDispatcher() {
|
|
543
|
+
enabled$1 = false;
|
|
544
|
+
currentDispatcher$1 = noop;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Call a callback when reporting is enabled, or immediately if reporting is already enabled.
|
|
549
|
+
* Will only ever be called once.
|
|
550
|
+
* @param callback
|
|
551
|
+
*/
|
|
552
|
+
function onReportingEnabled(callback) {
|
|
553
|
+
if (enabled$1) {
|
|
554
|
+
// call immediately
|
|
555
|
+
callback();
|
|
556
|
+
} else {
|
|
557
|
+
// call later
|
|
558
|
+
onReportingEnabledCallbacks.push(callback);
|
|
500
559
|
}
|
|
501
560
|
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
561
|
+
/**
|
|
562
|
+
* Report to the current dispatcher, if there is one.
|
|
563
|
+
* @param reportingEventId
|
|
564
|
+
* @param vm
|
|
565
|
+
*/
|
|
566
|
+
function report(reportingEventId, vm) {
|
|
567
|
+
if (enabled$1) {
|
|
568
|
+
currentDispatcher$1(reportingEventId, vm.tagName, vm.idx);
|
|
505
569
|
}
|
|
506
|
-
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
507
570
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
571
|
+
|
|
572
|
+
/*
|
|
573
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
574
|
+
* All rights reserved.
|
|
575
|
+
* SPDX-License-Identifier: MIT
|
|
576
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
577
|
+
*/
|
|
578
|
+
function getComponentTag(vm) {
|
|
579
|
+
return "<".concat(StringToLowerCase.call(vm.tagName), ">");
|
|
580
|
+
}
|
|
581
|
+
// TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
582
|
+
function getComponentStack(vm) {
|
|
583
|
+
var stack = [];
|
|
584
|
+
var prefix = '';
|
|
585
|
+
while (!isNull(vm.owner)) {
|
|
586
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
587
|
+
vm = vm.owner;
|
|
588
|
+
prefix += '\t';
|
|
511
589
|
}
|
|
512
|
-
return
|
|
590
|
+
return ArrayJoin.call(stack, '\n');
|
|
513
591
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
592
|
+
function getErrorComponentStack(vm) {
|
|
593
|
+
var wcStack = [];
|
|
594
|
+
var currentVm = vm;
|
|
595
|
+
while (!isNull(currentVm)) {
|
|
596
|
+
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
597
|
+
currentVm = currentVm.owner;
|
|
598
|
+
}
|
|
599
|
+
return wcStack.reverse().join('\n\t');
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/*
|
|
603
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
604
|
+
* All rights reserved.
|
|
605
|
+
* SPDX-License-Identifier: MIT
|
|
606
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
607
|
+
*/
|
|
608
|
+
function addErrorComponentStack(vm, error) {
|
|
609
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
610
|
+
var wcStack = getErrorComponentStack(vm);
|
|
611
|
+
defineProperty(error, 'wcStack', {
|
|
612
|
+
get: function get() {
|
|
613
|
+
return wcStack;
|
|
534
614
|
}
|
|
535
|
-
}
|
|
536
|
-
} catch (err) {
|
|
537
|
-
_iterator.e(err);
|
|
538
|
-
} finally {
|
|
539
|
-
_iterator.f();
|
|
615
|
+
});
|
|
540
616
|
}
|
|
541
|
-
return styleMap;
|
|
542
617
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
618
|
+
|
|
619
|
+
/*
|
|
620
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
621
|
+
* All rights reserved.
|
|
622
|
+
* SPDX-License-Identifier: MIT
|
|
623
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
624
|
+
*/
|
|
625
|
+
var alreadyLoggedMessages = new Set();
|
|
626
|
+
function log(method, message, vm, once) {
|
|
627
|
+
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
628
|
+
if (!isUndefined$1(vm)) {
|
|
629
|
+
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
630
|
+
}
|
|
631
|
+
if (once) {
|
|
632
|
+
if (alreadyLoggedMessages.has(msg)) {
|
|
633
|
+
return;
|
|
550
634
|
}
|
|
635
|
+
alreadyLoggedMessages.add(msg);
|
|
551
636
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
// If not, then something went wrong and we threw an error above.
|
|
558
|
-
var refVNodes = vm.refVNodes;
|
|
559
|
-
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
560
|
-
// in depth-first traversal order.
|
|
561
|
-
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
562
|
-
refVNodes[ref] = vnode;
|
|
637
|
+
try {
|
|
638
|
+
throw new Error(msg);
|
|
639
|
+
} catch (e) {
|
|
640
|
+
/* eslint-disable-next-line no-console */
|
|
641
|
+
console[method](e);
|
|
563
642
|
}
|
|
564
643
|
}
|
|
644
|
+
function logError(message, vm) {
|
|
645
|
+
log('error', message, vm, false);
|
|
646
|
+
}
|
|
565
647
|
|
|
566
648
|
/*
|
|
567
649
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -585,8 +667,8 @@
|
|
|
585
667
|
if (!isUndefined$1(reactiveRecord)) {
|
|
586
668
|
var reactiveObservers = reactiveRecord[key];
|
|
587
669
|
if (!isUndefined$1(reactiveObservers)) {
|
|
588
|
-
for (var
|
|
589
|
-
var ro = reactiveObservers[
|
|
670
|
+
for (var _i3 = 0, len = reactiveObservers.length; _i3 < len; _i3 += 1) {
|
|
671
|
+
var ro = reactiveObservers[_i3];
|
|
590
672
|
ro.notify();
|
|
591
673
|
}
|
|
592
674
|
}
|
|
@@ -645,9 +727,9 @@
|
|
|
645
727
|
var listeners = this.listeners;
|
|
646
728
|
var len = listeners.length;
|
|
647
729
|
if (len > 0) {
|
|
648
|
-
for (var
|
|
649
|
-
var set = listeners[
|
|
650
|
-
var pos = ArrayIndexOf.call(listeners[
|
|
730
|
+
for (var _i4 = 0; _i4 < len; _i4 += 1) {
|
|
731
|
+
var set = listeners[_i4];
|
|
732
|
+
var pos = ArrayIndexOf.call(listeners[_i4], this);
|
|
651
733
|
ArraySplice.call(set, pos, 1);
|
|
652
734
|
}
|
|
653
735
|
listeners.length = 0;
|
|
@@ -692,67 +774,99 @@
|
|
|
692
774
|
* SPDX-License-Identifier: MIT
|
|
693
775
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
694
776
|
*/
|
|
695
|
-
|
|
696
|
-
|
|
777
|
+
var nextTickCallbackQueue = [];
|
|
778
|
+
var SPACE_CHAR = 32;
|
|
779
|
+
var EmptyObject = seal(create(null));
|
|
780
|
+
var EmptyArray = seal([]);
|
|
781
|
+
function flushCallbackQueue() {
|
|
782
|
+
var callbacks = nextTickCallbackQueue;
|
|
783
|
+
nextTickCallbackQueue = []; // reset to a new queue
|
|
784
|
+
for (var _i5 = 0, len = callbacks.length; _i5 < len; _i5 += 1) {
|
|
785
|
+
callbacks[_i5]();
|
|
786
|
+
}
|
|
697
787
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
var prefix = '';
|
|
702
|
-
while (!isNull(vm.owner)) {
|
|
703
|
-
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
704
|
-
vm = vm.owner;
|
|
705
|
-
prefix += '\t';
|
|
788
|
+
function addCallbackToNextTick(callback) {
|
|
789
|
+
if (nextTickCallbackQueue.length === 0) {
|
|
790
|
+
Promise.resolve().then(flushCallbackQueue);
|
|
706
791
|
}
|
|
707
|
-
|
|
792
|
+
ArrayPush$1.call(nextTickCallbackQueue, callback);
|
|
708
793
|
}
|
|
709
|
-
function
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
while (!isNull(currentVm)) {
|
|
713
|
-
ArrayPush$1.call(wcStack, getComponentTag(currentVm));
|
|
714
|
-
currentVm = currentVm.owner;
|
|
794
|
+
function guid() {
|
|
795
|
+
function s4() {
|
|
796
|
+
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
|
|
715
797
|
}
|
|
716
|
-
return
|
|
798
|
+
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
717
799
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
800
|
+
// Borrowed from Vue template compiler.
|
|
801
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
802
|
+
var DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
803
|
+
var PROPERTY_DELIMITER = /:(.+)/;
|
|
804
|
+
function parseStyleText(cssText) {
|
|
805
|
+
var styleMap = {};
|
|
806
|
+
var declarations = cssText.split(DECLARATION_DELIMITER);
|
|
807
|
+
var _iterator2 = _createForOfIteratorHelper(declarations),
|
|
808
|
+
_step2;
|
|
809
|
+
try {
|
|
810
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
811
|
+
var declaration = _step2.value;
|
|
812
|
+
if (declaration) {
|
|
813
|
+
var _declaration$split = declaration.split(PROPERTY_DELIMITER),
|
|
814
|
+
_declaration$split2 = _slicedToArray(_declaration$split, 2),
|
|
815
|
+
prop = _declaration$split2[0],
|
|
816
|
+
value = _declaration$split2[1];
|
|
817
|
+
if (prop !== undefined && value !== undefined) {
|
|
818
|
+
styleMap[prop.trim()] = value.trim();
|
|
819
|
+
}
|
|
731
820
|
}
|
|
732
|
-
}
|
|
821
|
+
}
|
|
822
|
+
} catch (err) {
|
|
823
|
+
_iterator2.e(err);
|
|
824
|
+
} finally {
|
|
825
|
+
_iterator2.f();
|
|
733
826
|
}
|
|
827
|
+
return styleMap;
|
|
734
828
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
744
|
-
if (!isUndefined$1(vm)) {
|
|
745
|
-
msg = "".concat(msg, "\n").concat(getComponentStack(vm));
|
|
829
|
+
// Make a shallow copy of an object but omit the given key
|
|
830
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
831
|
+
var result = {};
|
|
832
|
+
for (var _i6 = 0, _Object$keys = Object.keys(object); _i6 < _Object$keys.length; _i6++) {
|
|
833
|
+
var key = _Object$keys[_i6];
|
|
834
|
+
if (key !== keyToOmit) {
|
|
835
|
+
result[key] = object[key];
|
|
836
|
+
}
|
|
746
837
|
}
|
|
838
|
+
return result;
|
|
839
|
+
}
|
|
840
|
+
function flattenStylesheets(stylesheets) {
|
|
841
|
+
var list = [];
|
|
842
|
+
var _iterator3 = _createForOfIteratorHelper(stylesheets),
|
|
843
|
+
_step3;
|
|
747
844
|
try {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
845
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
846
|
+
var stylesheet = _step3.value;
|
|
847
|
+
if (!Array.isArray(stylesheet)) {
|
|
848
|
+
list.push(stylesheet);
|
|
849
|
+
} else {
|
|
850
|
+
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
} catch (err) {
|
|
854
|
+
_iterator3.e(err);
|
|
855
|
+
} finally {
|
|
856
|
+
_iterator3.f();
|
|
752
857
|
}
|
|
858
|
+
return list;
|
|
753
859
|
}
|
|
754
|
-
|
|
755
|
-
|
|
860
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
861
|
+
function setRefVNode(vm, ref, vnode) {
|
|
862
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
863
|
+
// If not, then something went wrong and we threw an error above.
|
|
864
|
+
var refVNodes = vm.refVNodes;
|
|
865
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
866
|
+
// in depth-first traversal order.
|
|
867
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
868
|
+
refVNodes[ref] = vnode;
|
|
869
|
+
}
|
|
756
870
|
}
|
|
757
871
|
|
|
758
872
|
/*
|
|
@@ -788,98 +902,6 @@
|
|
|
788
902
|
*/
|
|
789
903
|
// These properties get added to LWCElement.prototype publicProps automatically
|
|
790
904
|
var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
791
|
-
function offsetPropertyErrorMessage(name) {
|
|
792
|
-
return "Using the `".concat(name, "` property is an anti-pattern because it rounds the value to an integer. Instead, use the `getBoundingClientRect` method to obtain fractional values for the size of an element and its position relative to the viewport.");
|
|
793
|
-
}
|
|
794
|
-
// Global HTML Attributes & Properties
|
|
795
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
796
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
797
|
-
assign(create(null), {
|
|
798
|
-
accessKey: {
|
|
799
|
-
attribute: 'accesskey'
|
|
800
|
-
},
|
|
801
|
-
accessKeyLabel: {
|
|
802
|
-
readOnly: true
|
|
803
|
-
},
|
|
804
|
-
className: {
|
|
805
|
-
attribute: 'class',
|
|
806
|
-
error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.'
|
|
807
|
-
},
|
|
808
|
-
contentEditable: {
|
|
809
|
-
attribute: 'contenteditable'
|
|
810
|
-
},
|
|
811
|
-
dataset: {
|
|
812
|
-
readOnly: true,
|
|
813
|
-
error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead."
|
|
814
|
-
},
|
|
815
|
-
dir: {
|
|
816
|
-
attribute: 'dir'
|
|
817
|
-
},
|
|
818
|
-
draggable: {
|
|
819
|
-
attribute: 'draggable'
|
|
820
|
-
},
|
|
821
|
-
dropzone: {
|
|
822
|
-
attribute: 'dropzone',
|
|
823
|
-
readOnly: true
|
|
824
|
-
},
|
|
825
|
-
hidden: {
|
|
826
|
-
attribute: 'hidden'
|
|
827
|
-
},
|
|
828
|
-
id: {
|
|
829
|
-
attribute: 'id'
|
|
830
|
-
},
|
|
831
|
-
inputMode: {
|
|
832
|
-
attribute: 'inputmode'
|
|
833
|
-
},
|
|
834
|
-
lang: {
|
|
835
|
-
attribute: 'lang'
|
|
836
|
-
},
|
|
837
|
-
slot: {
|
|
838
|
-
attribute: 'slot',
|
|
839
|
-
error: 'Using the `slot` property is an anti-pattern.'
|
|
840
|
-
},
|
|
841
|
-
spellcheck: {
|
|
842
|
-
attribute: 'spellcheck'
|
|
843
|
-
},
|
|
844
|
-
style: {
|
|
845
|
-
attribute: 'style'
|
|
846
|
-
},
|
|
847
|
-
tabIndex: {
|
|
848
|
-
attribute: 'tabindex'
|
|
849
|
-
},
|
|
850
|
-
title: {
|
|
851
|
-
attribute: 'title'
|
|
852
|
-
},
|
|
853
|
-
translate: {
|
|
854
|
-
attribute: 'translate'
|
|
855
|
-
},
|
|
856
|
-
// additional "global attributes" that are not present in the link above.
|
|
857
|
-
isContentEditable: {
|
|
858
|
-
readOnly: true
|
|
859
|
-
},
|
|
860
|
-
offsetHeight: {
|
|
861
|
-
readOnly: true,
|
|
862
|
-
error: offsetPropertyErrorMessage('offsetHeight')
|
|
863
|
-
},
|
|
864
|
-
offsetLeft: {
|
|
865
|
-
readOnly: true,
|
|
866
|
-
error: offsetPropertyErrorMessage('offsetLeft')
|
|
867
|
-
},
|
|
868
|
-
offsetParent: {
|
|
869
|
-
readOnly: true
|
|
870
|
-
},
|
|
871
|
-
offsetTop: {
|
|
872
|
-
readOnly: true,
|
|
873
|
-
error: offsetPropertyErrorMessage('offsetTop')
|
|
874
|
-
},
|
|
875
|
-
offsetWidth: {
|
|
876
|
-
readOnly: true,
|
|
877
|
-
error: offsetPropertyErrorMessage('offsetWidth')
|
|
878
|
-
},
|
|
879
|
-
role: {
|
|
880
|
-
attribute: 'role'
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
905
|
var controlledElement = null;
|
|
884
906
|
var controlledAttributeName;
|
|
885
907
|
function isAttributeLocked(elm, attrName) {
|
|
@@ -1733,17 +1755,17 @@
|
|
|
1733
1755
|
var refs = refsCache.get(refVNodes);
|
|
1734
1756
|
if (isUndefined$1(refs)) {
|
|
1735
1757
|
refs = create(null);
|
|
1736
|
-
var
|
|
1737
|
-
|
|
1758
|
+
var _iterator4 = _createForOfIteratorHelper(keys(refVNodes)),
|
|
1759
|
+
_step4;
|
|
1738
1760
|
try {
|
|
1739
|
-
for (
|
|
1740
|
-
var key =
|
|
1761
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1762
|
+
var key = _step4.value;
|
|
1741
1763
|
refs[key] = refVNodes[key].elm;
|
|
1742
1764
|
}
|
|
1743
1765
|
} catch (err) {
|
|
1744
|
-
|
|
1766
|
+
_iterator4.e(err);
|
|
1745
1767
|
} finally {
|
|
1746
|
-
|
|
1768
|
+
_iterator4.f();
|
|
1747
1769
|
}
|
|
1748
1770
|
freeze(refs);
|
|
1749
1771
|
refsCache.set(refVNodes, refs);
|
|
@@ -1869,166 +1891,422 @@
|
|
|
1869
1891
|
* SPDX-License-Identifier: MIT
|
|
1870
1892
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1871
1893
|
*/
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
function
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1894
|
+
var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
1895
|
+
var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
1896
|
+
var WireMetaMap = new Map();
|
|
1897
|
+
var WireContextRegistrationEvent = /*#__PURE__*/function (_CustomEvent) {
|
|
1898
|
+
_inherits(WireContextRegistrationEvent, _CustomEvent);
|
|
1899
|
+
var _super3 = _createSuper(WireContextRegistrationEvent);
|
|
1900
|
+
function WireContextRegistrationEvent(adapterToken, _ref3) {
|
|
1901
|
+
var _this2;
|
|
1902
|
+
var setNewContext = _ref3.setNewContext,
|
|
1903
|
+
setDisconnectedCallback = _ref3.setDisconnectedCallback;
|
|
1904
|
+
_classCallCheck(this, WireContextRegistrationEvent);
|
|
1905
|
+
_this2 = _super3.call(this, adapterToken, {
|
|
1906
|
+
bubbles: true,
|
|
1907
|
+
composed: true
|
|
1908
|
+
});
|
|
1909
|
+
defineProperties(_assertThisInitialized(_this2), {
|
|
1910
|
+
setNewContext: {
|
|
1911
|
+
value: setNewContext
|
|
1912
|
+
},
|
|
1913
|
+
setDisconnectedCallback: {
|
|
1914
|
+
value: setDisconnectedCallback
|
|
1881
1915
|
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
},
|
|
1885
|
-
set: function set(newValue) {
|
|
1886
|
-
var vm = getAssociatedVM(this);
|
|
1887
|
-
vm.cmpProps[key] = newValue;
|
|
1888
|
-
componentValueMutated(vm, key);
|
|
1889
|
-
},
|
|
1890
|
-
enumerable: true,
|
|
1891
|
-
configurable: true
|
|
1892
|
-
};
|
|
1893
|
-
}
|
|
1894
|
-
function createPublicAccessorDescriptor(key, descriptor) {
|
|
1895
|
-
var _get2 = descriptor.get,
|
|
1896
|
-
_set2 = descriptor.set,
|
|
1897
|
-
enumerable = descriptor.enumerable,
|
|
1898
|
-
configurable = descriptor.configurable;
|
|
1899
|
-
if (!isFunction$1(_get2)) {
|
|
1900
|
-
throw new Error();
|
|
1916
|
+
});
|
|
1917
|
+
return _this2;
|
|
1901
1918
|
}
|
|
1902
|
-
return
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
getAssociatedVM(this);
|
|
1908
|
-
if (_set2) {
|
|
1909
|
-
_set2.call(this, newValue);
|
|
1910
|
-
}
|
|
1911
|
-
},
|
|
1912
|
-
enumerable: enumerable,
|
|
1913
|
-
configurable: configurable
|
|
1919
|
+
return _createClass(WireContextRegistrationEvent);
|
|
1920
|
+
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
1921
|
+
function createFieldDataCallback(vm, name) {
|
|
1922
|
+
return function (value) {
|
|
1923
|
+
updateComponentValue(vm, name, value);
|
|
1914
1924
|
};
|
|
1915
1925
|
}
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
function track(target) {
|
|
1924
|
-
if (arguments.length === 1) {
|
|
1925
|
-
return getReactiveProxy(target);
|
|
1926
|
-
}
|
|
1927
|
-
throw new Error();
|
|
1928
|
-
}
|
|
1929
|
-
function internalTrackDecorator(key) {
|
|
1930
|
-
return {
|
|
1931
|
-
get: function get() {
|
|
1932
|
-
var vm = getAssociatedVM(this);
|
|
1933
|
-
componentValueObserved(vm, key);
|
|
1934
|
-
return vm.cmpFields[key];
|
|
1935
|
-
},
|
|
1936
|
-
set: function set(newValue) {
|
|
1937
|
-
var vm = getAssociatedVM(this);
|
|
1938
|
-
var reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
1939
|
-
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
1940
|
-
},
|
|
1941
|
-
enumerable: true,
|
|
1942
|
-
configurable: true
|
|
1926
|
+
function createMethodDataCallback(vm, method) {
|
|
1927
|
+
return function (value) {
|
|
1928
|
+
// dispatching new value into the wired method
|
|
1929
|
+
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
1930
|
+
// job
|
|
1931
|
+
method.call(vm.component, value);
|
|
1932
|
+
}, noop);
|
|
1943
1933
|
};
|
|
1944
1934
|
}
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1935
|
+
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
1936
|
+
var hasPendingConfig = false;
|
|
1937
|
+
// creating the reactive observer for reactive params when needed
|
|
1938
|
+
var ro = createReactiveObserver(function () {
|
|
1939
|
+
if (hasPendingConfig === false) {
|
|
1940
|
+
hasPendingConfig = true;
|
|
1941
|
+
// collect new config in the micro-task
|
|
1942
|
+
Promise.resolve().then(function () {
|
|
1943
|
+
hasPendingConfig = false;
|
|
1944
|
+
// resetting current reactive params
|
|
1945
|
+
ro.reset();
|
|
1946
|
+
// dispatching a new config due to a change in the configuration
|
|
1947
|
+
computeConfigAndUpdate();
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
});
|
|
1951
|
+
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
1952
|
+
var config;
|
|
1953
|
+
ro.observe(function () {
|
|
1954
|
+
return config = configCallback(component);
|
|
1955
|
+
});
|
|
1956
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1957
|
+
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
1958
|
+
// @ts-ignore it is assigned in the observe() callback
|
|
1959
|
+
callbackWhenConfigIsReady(config);
|
|
1960
|
+
};
|
|
1961
1961
|
return {
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
componentValueObserved(vm, key);
|
|
1965
|
-
return vm.cmpFields[key];
|
|
1966
|
-
},
|
|
1967
|
-
set: function set(value) {
|
|
1968
|
-
var vm = getAssociatedVM(this);
|
|
1969
|
-
/**
|
|
1970
|
-
* Reactivity for wired fields is provided in wiring.
|
|
1971
|
-
* We intentionally add reactivity here since this is just
|
|
1972
|
-
* letting the author to do the wrong thing, but it will keep our
|
|
1973
|
-
* system to be backward compatible.
|
|
1974
|
-
*/
|
|
1975
|
-
updateComponentValue(vm, key, value);
|
|
1976
|
-
},
|
|
1977
|
-
enumerable: true,
|
|
1978
|
-
configurable: true
|
|
1962
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
1963
|
+
ro: ro
|
|
1979
1964
|
};
|
|
1980
1965
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
var proto = Ctor.prototype;
|
|
1987
|
-
var publicProps = meta.publicProps,
|
|
1988
|
-
publicMethods = meta.publicMethods,
|
|
1989
|
-
wire = meta.wire,
|
|
1990
|
-
track = meta.track,
|
|
1991
|
-
fields = meta.fields;
|
|
1992
|
-
var apiMethods = create(null);
|
|
1993
|
-
var apiFields = create(null);
|
|
1994
|
-
var wiredMethods = create(null);
|
|
1995
|
-
var wiredFields = create(null);
|
|
1996
|
-
var observedFields = create(null);
|
|
1997
|
-
var apiFieldsConfig = create(null);
|
|
1998
|
-
var descriptor;
|
|
1999
|
-
if (!isUndefined$1(publicProps)) {
|
|
2000
|
-
for (var fieldName in publicProps) {
|
|
2001
|
-
var propConfig = publicProps[fieldName];
|
|
2002
|
-
apiFieldsConfig[fieldName] = propConfig.config;
|
|
2003
|
-
descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
|
|
2004
|
-
if (propConfig.config > 0) {
|
|
2005
|
-
if (isUndefined$1(descriptor)) {
|
|
2006
|
-
throw new Error();
|
|
2007
|
-
}
|
|
2008
|
-
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
2009
|
-
} else {
|
|
2010
|
-
// [W-9927596] If a component has both a public property and a private setter/getter
|
|
2011
|
-
// with the same name, the property is defined as a public accessor. This branch is
|
|
2012
|
-
// only here for backward compatibility reasons.
|
|
2013
|
-
if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
|
|
2014
|
-
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
2015
|
-
} else {
|
|
2016
|
-
descriptor = createPublicPropertyDescriptor(fieldName);
|
|
2017
|
-
}
|
|
2018
|
-
}
|
|
2019
|
-
apiFields[fieldName] = descriptor;
|
|
2020
|
-
defineProperty(proto, fieldName, descriptor);
|
|
2021
|
-
}
|
|
1966
|
+
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
1967
|
+
var adapter = wireDef.adapter;
|
|
1968
|
+
var adapterContextToken = getAdapterToken(adapter);
|
|
1969
|
+
if (isUndefined$1(adapterContextToken)) {
|
|
1970
|
+
return; // no provider found, nothing to be done
|
|
2022
1971
|
}
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
1972
|
+
|
|
1973
|
+
var elm = vm.elm,
|
|
1974
|
+
_vm$context = vm.context,
|
|
1975
|
+
wiredConnecting = _vm$context.wiredConnecting,
|
|
1976
|
+
wiredDisconnecting = _vm$context.wiredDisconnecting,
|
|
1977
|
+
dispatchEvent = vm.renderer.dispatchEvent;
|
|
1978
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
1979
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
1980
|
+
// This event is responsible for connecting the host element with another
|
|
1981
|
+
// element in the composed path that is providing contextual data. The provider
|
|
1982
|
+
// must be listening for a special dom event with the name corresponding to the value of
|
|
1983
|
+
// `adapterContextToken`, which will remain secret and internal to this file only to
|
|
1984
|
+
// guarantee that the linkage can be forged.
|
|
1985
|
+
var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
|
|
1986
|
+
setNewContext: function setNewContext(newContext) {
|
|
1987
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
1988
|
+
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
1989
|
+
callbackWhenContextIsReady(newContext);
|
|
1990
|
+
},
|
|
1991
|
+
setDisconnectedCallback: function setDisconnectedCallback(disconnectCallback) {
|
|
1992
|
+
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
1993
|
+
// the the element hosting the wire is disconnected
|
|
1994
|
+
ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
|
|
2028
1995
|
}
|
|
2029
|
-
apiMethods[methodName] = descriptor;
|
|
2030
1996
|
});
|
|
2031
|
-
|
|
1997
|
+
dispatchEvent(elm, contextRegistrationEvent);
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
function createConnector(vm, name, wireDef) {
|
|
2001
|
+
var method = wireDef.method,
|
|
2002
|
+
adapter = wireDef.adapter,
|
|
2003
|
+
configCallback = wireDef.configCallback,
|
|
2004
|
+
dynamic = wireDef.dynamic;
|
|
2005
|
+
var debugInfo;
|
|
2006
|
+
var fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
2007
|
+
var dataCallback = function dataCallback(value) {
|
|
2008
|
+
fieldOrMethodCallback(value);
|
|
2009
|
+
};
|
|
2010
|
+
var context;
|
|
2011
|
+
var connector;
|
|
2012
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
2013
|
+
defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
2014
|
+
value: vm.elm
|
|
2015
|
+
});
|
|
2016
|
+
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
2017
|
+
value: dynamic
|
|
2018
|
+
});
|
|
2019
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2020
|
+
// job
|
|
2021
|
+
connector = new adapter(dataCallback);
|
|
2022
|
+
}, noop);
|
|
2023
|
+
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
2024
|
+
// every time the config is recomputed due to tracking,
|
|
2025
|
+
// this callback will be invoked with the new computed config
|
|
2026
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2027
|
+
// job
|
|
2028
|
+
if ("production" !== 'production') ;
|
|
2029
|
+
connector.update(config, context);
|
|
2030
|
+
}, noop);
|
|
2031
|
+
};
|
|
2032
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
2033
|
+
// If it has params, we will need to observe changes in the next tick.
|
|
2034
|
+
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
2035
|
+
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
2036
|
+
ro = _createConfigWatcher.ro;
|
|
2037
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
2038
|
+
if (!isUndefined$1(adapter.contextSchema)) {
|
|
2039
|
+
createContextWatcher(vm, wireDef, function (newContext) {
|
|
2040
|
+
// every time the context is pushed into this component,
|
|
2041
|
+
// this callback will be invoked with the new computed context
|
|
2042
|
+
if (context !== newContext) {
|
|
2043
|
+
context = newContext;
|
|
2044
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
2045
|
+
// context, this is to preserve the identity characteristics, config should not have identity
|
|
2046
|
+
// (ever), while context can have identity
|
|
2047
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
2048
|
+
computeConfigAndUpdate();
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
return {
|
|
2054
|
+
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
2055
|
+
connector: connector,
|
|
2056
|
+
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
2057
|
+
resetConfigWatcher: function resetConfigWatcher() {
|
|
2058
|
+
return ro.reset();
|
|
2059
|
+
}
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
var AdapterToTokenMap = new Map();
|
|
2063
|
+
function getAdapterToken(adapter) {
|
|
2064
|
+
return AdapterToTokenMap.get(adapter);
|
|
2065
|
+
}
|
|
2066
|
+
function setAdapterToken(adapter, token) {
|
|
2067
|
+
AdapterToTokenMap.set(adapter, token);
|
|
2068
|
+
}
|
|
2069
|
+
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2070
|
+
// support for callable adapters
|
|
2071
|
+
if (adapter.adapter) {
|
|
2072
|
+
adapter = adapter.adapter;
|
|
2073
|
+
}
|
|
2074
|
+
var method = descriptor.value;
|
|
2075
|
+
var def = {
|
|
2076
|
+
adapter: adapter,
|
|
2077
|
+
method: method,
|
|
2078
|
+
configCallback: configCallback,
|
|
2079
|
+
dynamic: dynamic
|
|
2080
|
+
};
|
|
2081
|
+
WireMetaMap.set(descriptor, def);
|
|
2082
|
+
}
|
|
2083
|
+
function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
2084
|
+
// support for callable adapters
|
|
2085
|
+
if (adapter.adapter) {
|
|
2086
|
+
adapter = adapter.adapter;
|
|
2087
|
+
}
|
|
2088
|
+
var def = {
|
|
2089
|
+
adapter: adapter,
|
|
2090
|
+
configCallback: configCallback,
|
|
2091
|
+
dynamic: dynamic
|
|
2092
|
+
};
|
|
2093
|
+
WireMetaMap.set(descriptor, def);
|
|
2094
|
+
}
|
|
2095
|
+
function installWireAdapters(vm) {
|
|
2096
|
+
var context = vm.context,
|
|
2097
|
+
wire = vm.def.wire;
|
|
2098
|
+
var wiredConnecting = context.wiredConnecting = [];
|
|
2099
|
+
var wiredDisconnecting = context.wiredDisconnecting = [];
|
|
2100
|
+
for (var fieldNameOrMethod in wire) {
|
|
2101
|
+
var descriptor = wire[fieldNameOrMethod];
|
|
2102
|
+
var wireDef = WireMetaMap.get(descriptor);
|
|
2103
|
+
if (!isUndefined$1(wireDef)) {
|
|
2104
|
+
(function () {
|
|
2105
|
+
var _createConnector = createConnector(vm, fieldNameOrMethod, wireDef),
|
|
2106
|
+
connector = _createConnector.connector,
|
|
2107
|
+
computeConfigAndUpdate = _createConnector.computeConfigAndUpdate,
|
|
2108
|
+
resetConfigWatcher = _createConnector.resetConfigWatcher;
|
|
2109
|
+
var hasDynamicParams = wireDef.dynamic.length > 0;
|
|
2110
|
+
ArrayPush$1.call(wiredConnecting, function () {
|
|
2111
|
+
connector.connect();
|
|
2112
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
2113
|
+
if (hasDynamicParams) {
|
|
2114
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
2115
|
+
return;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
computeConfigAndUpdate();
|
|
2119
|
+
});
|
|
2120
|
+
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
2121
|
+
connector.disconnect();
|
|
2122
|
+
resetConfigWatcher();
|
|
2123
|
+
});
|
|
2124
|
+
})();
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
function connectWireAdapters(vm) {
|
|
2129
|
+
var wiredConnecting = vm.context.wiredConnecting;
|
|
2130
|
+
for (var _i8 = 0, len = wiredConnecting.length; _i8 < len; _i8 += 1) {
|
|
2131
|
+
wiredConnecting[_i8]();
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
function disconnectWireAdapters(vm) {
|
|
2135
|
+
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
2136
|
+
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
2137
|
+
// job
|
|
2138
|
+
for (var _i9 = 0, len = wiredDisconnecting.length; _i9 < len; _i9 += 1) {
|
|
2139
|
+
wiredDisconnecting[_i9]();
|
|
2140
|
+
}
|
|
2141
|
+
}, noop);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
/*
|
|
2145
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2146
|
+
* All rights reserved.
|
|
2147
|
+
* SPDX-License-Identifier: MIT
|
|
2148
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2149
|
+
*/
|
|
2150
|
+
function api$1() {
|
|
2151
|
+
throw new Error();
|
|
2152
|
+
}
|
|
2153
|
+
function createPublicPropertyDescriptor(key) {
|
|
2154
|
+
return {
|
|
2155
|
+
get: function get() {
|
|
2156
|
+
var vm = getAssociatedVM(this);
|
|
2157
|
+
if (isBeingConstructed(vm)) {
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
componentValueObserved(vm, key);
|
|
2161
|
+
return vm.cmpProps[key];
|
|
2162
|
+
},
|
|
2163
|
+
set: function set(newValue) {
|
|
2164
|
+
var vm = getAssociatedVM(this);
|
|
2165
|
+
vm.cmpProps[key] = newValue;
|
|
2166
|
+
componentValueMutated(vm, key);
|
|
2167
|
+
},
|
|
2168
|
+
enumerable: true,
|
|
2169
|
+
configurable: true
|
|
2170
|
+
};
|
|
2171
|
+
}
|
|
2172
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2173
|
+
var _get2 = descriptor.get,
|
|
2174
|
+
_set2 = descriptor.set,
|
|
2175
|
+
enumerable = descriptor.enumerable,
|
|
2176
|
+
configurable = descriptor.configurable;
|
|
2177
|
+
if (!isFunction$1(_get2)) {
|
|
2178
|
+
throw new Error();
|
|
2179
|
+
}
|
|
2180
|
+
return {
|
|
2181
|
+
get: function get() {
|
|
2182
|
+
return _get2.call(this);
|
|
2183
|
+
},
|
|
2184
|
+
set: function set(newValue) {
|
|
2185
|
+
getAssociatedVM(this);
|
|
2186
|
+
if (_set2) {
|
|
2187
|
+
_set2.call(this, newValue);
|
|
2188
|
+
}
|
|
2189
|
+
},
|
|
2190
|
+
enumerable: enumerable,
|
|
2191
|
+
configurable: configurable
|
|
2192
|
+
};
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
/*
|
|
2196
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2197
|
+
* All rights reserved.
|
|
2198
|
+
* SPDX-License-Identifier: MIT
|
|
2199
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2200
|
+
*/
|
|
2201
|
+
function track(target) {
|
|
2202
|
+
if (arguments.length === 1) {
|
|
2203
|
+
return getReactiveProxy(target);
|
|
2204
|
+
}
|
|
2205
|
+
throw new Error();
|
|
2206
|
+
}
|
|
2207
|
+
function internalTrackDecorator(key) {
|
|
2208
|
+
return {
|
|
2209
|
+
get: function get() {
|
|
2210
|
+
var vm = getAssociatedVM(this);
|
|
2211
|
+
componentValueObserved(vm, key);
|
|
2212
|
+
return vm.cmpFields[key];
|
|
2213
|
+
},
|
|
2214
|
+
set: function set(newValue) {
|
|
2215
|
+
var vm = getAssociatedVM(this);
|
|
2216
|
+
var reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2217
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2218
|
+
},
|
|
2219
|
+
enumerable: true,
|
|
2220
|
+
configurable: true
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
/*
|
|
2225
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2226
|
+
* All rights reserved.
|
|
2227
|
+
* SPDX-License-Identifier: MIT
|
|
2228
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2229
|
+
*/
|
|
2230
|
+
/**
|
|
2231
|
+
* @wire decorator to wire fields and methods to a wire adapter in
|
|
2232
|
+
* LWC Components. This function implements the internals of this
|
|
2233
|
+
* decorator.
|
|
2234
|
+
*/
|
|
2235
|
+
function wire(_adapter, _config) {
|
|
2236
|
+
throw new Error();
|
|
2237
|
+
}
|
|
2238
|
+
function internalWireFieldDecorator(key) {
|
|
2239
|
+
return {
|
|
2240
|
+
get: function get() {
|
|
2241
|
+
var vm = getAssociatedVM(this);
|
|
2242
|
+
componentValueObserved(vm, key);
|
|
2243
|
+
return vm.cmpFields[key];
|
|
2244
|
+
},
|
|
2245
|
+
set: function set(value) {
|
|
2246
|
+
var vm = getAssociatedVM(this);
|
|
2247
|
+
/**
|
|
2248
|
+
* Reactivity for wired fields is provided in wiring.
|
|
2249
|
+
* We intentionally add reactivity here since this is just
|
|
2250
|
+
* letting the author to do the wrong thing, but it will keep our
|
|
2251
|
+
* system to be backward compatible.
|
|
2252
|
+
*/
|
|
2253
|
+
updateComponentValue(vm, key, value);
|
|
2254
|
+
},
|
|
2255
|
+
enumerable: true,
|
|
2256
|
+
configurable: true
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
2261
|
+
* will prevent this function from being imported by user-land code.
|
|
2262
|
+
*/
|
|
2263
|
+
function registerDecorators(Ctor, meta) {
|
|
2264
|
+
var proto = Ctor.prototype;
|
|
2265
|
+
var publicProps = meta.publicProps,
|
|
2266
|
+
publicMethods = meta.publicMethods,
|
|
2267
|
+
wire = meta.wire,
|
|
2268
|
+
track = meta.track,
|
|
2269
|
+
fields = meta.fields;
|
|
2270
|
+
var apiMethods = create(null);
|
|
2271
|
+
var apiFields = create(null);
|
|
2272
|
+
var wiredMethods = create(null);
|
|
2273
|
+
var wiredFields = create(null);
|
|
2274
|
+
var observedFields = create(null);
|
|
2275
|
+
var apiFieldsConfig = create(null);
|
|
2276
|
+
var descriptor;
|
|
2277
|
+
if (!isUndefined$1(publicProps)) {
|
|
2278
|
+
for (var fieldName in publicProps) {
|
|
2279
|
+
var propConfig = publicProps[fieldName];
|
|
2280
|
+
apiFieldsConfig[fieldName] = propConfig.config;
|
|
2281
|
+
descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
|
|
2282
|
+
if (propConfig.config > 0) {
|
|
2283
|
+
if (isUndefined$1(descriptor)) {
|
|
2284
|
+
throw new Error();
|
|
2285
|
+
}
|
|
2286
|
+
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
2287
|
+
} else {
|
|
2288
|
+
// [W-9927596] If a component has both a public property and a private setter/getter
|
|
2289
|
+
// with the same name, the property is defined as a public accessor. This branch is
|
|
2290
|
+
// only here for backward compatibility reasons.
|
|
2291
|
+
if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
|
|
2292
|
+
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
2293
|
+
} else {
|
|
2294
|
+
descriptor = createPublicPropertyDescriptor(fieldName);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
apiFields[fieldName] = descriptor;
|
|
2298
|
+
defineProperty(proto, fieldName, descriptor);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
if (!isUndefined$1(publicMethods)) {
|
|
2302
|
+
forEach.call(publicMethods, function (methodName) {
|
|
2303
|
+
descriptor = getOwnPropertyDescriptor$1(proto, methodName);
|
|
2304
|
+
if (isUndefined$1(descriptor)) {
|
|
2305
|
+
throw new Error();
|
|
2306
|
+
}
|
|
2307
|
+
apiMethods[methodName] = descriptor;
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2032
2310
|
if (!isUndefined$1(wire)) {
|
|
2033
2311
|
for (var fieldOrMethodName in wire) {
|
|
2034
2312
|
var _wire$fieldOrMethodNa = wire[fieldOrMethodName],
|
|
@@ -2060,8 +2338,8 @@
|
|
|
2060
2338
|
}
|
|
2061
2339
|
}
|
|
2062
2340
|
if (!isUndefined$1(fields)) {
|
|
2063
|
-
for (var
|
|
2064
|
-
var _fieldName2 = fields[
|
|
2341
|
+
for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
|
|
2342
|
+
var _fieldName2 = fields[_i10];
|
|
2065
2343
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
2066
2344
|
// [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
|
|
2067
2345
|
// tracked property. This is only here for backward compatibility purposes.
|
|
@@ -2212,10 +2490,10 @@
|
|
|
2212
2490
|
if (isFunction$1(SuperClass)) {
|
|
2213
2491
|
HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
|
|
2214
2492
|
_inherits(HTMLBridgeElement, _SuperClass);
|
|
2215
|
-
var
|
|
2493
|
+
var _super4 = _createSuper(HTMLBridgeElement);
|
|
2216
2494
|
function HTMLBridgeElement() {
|
|
2217
2495
|
_classCallCheck(this, HTMLBridgeElement);
|
|
2218
|
-
return
|
|
2496
|
+
return _super4.apply(this, arguments);
|
|
2219
2497
|
}
|
|
2220
2498
|
return _createClass(HTMLBridgeElement);
|
|
2221
2499
|
}(SuperClass);
|
|
@@ -2242,8 +2520,8 @@
|
|
|
2242
2520
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
2243
2521
|
var descriptors = create(null);
|
|
2244
2522
|
// expose getters and setters for each public props on the new Element Bridge
|
|
2245
|
-
for (var
|
|
2246
|
-
var _propName = props[
|
|
2523
|
+
for (var _i11 = 0, len = props.length; _i11 < len; _i11 += 1) {
|
|
2524
|
+
var _propName = props[_i11];
|
|
2247
2525
|
attributeToPropMap[htmlPropertyToAttribute(_propName)] = _propName;
|
|
2248
2526
|
descriptors[_propName] = {
|
|
2249
2527
|
get: createGetter(_propName),
|
|
@@ -2253,8 +2531,8 @@
|
|
|
2253
2531
|
};
|
|
2254
2532
|
}
|
|
2255
2533
|
// expose public methods as props on the new Element Bridge
|
|
2256
|
-
for (var
|
|
2257
|
-
var methodName = methods[
|
|
2534
|
+
for (var _i12 = 0, _len = methods.length; _i12 < _len; _i12 += 1) {
|
|
2535
|
+
var methodName = methods[_i12];
|
|
2258
2536
|
descriptors[methodName] = {
|
|
2259
2537
|
value: createMethodCaller(methodName),
|
|
2260
2538
|
writable: true,
|
|
@@ -2528,6 +2806,7 @@
|
|
|
2528
2806
|
setAttribute = _vm$renderer.setAttribute;
|
|
2529
2807
|
var newStylesheets = template.stylesheets,
|
|
2530
2808
|
newStylesheetToken = template.stylesheetToken;
|
|
2809
|
+
var newVmStylesheets = vm.stylesheets;
|
|
2531
2810
|
var isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
2532
2811
|
var hasScopedStyles = context.hasScopedStyles;
|
|
2533
2812
|
var newToken;
|
|
@@ -2547,7 +2826,9 @@
|
|
|
2547
2826
|
}
|
|
2548
2827
|
// Apply the new template styling token to the host element, if the new template has any
|
|
2549
2828
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
2550
|
-
|
|
2829
|
+
var hasNewStylesheets = hasStyles(newStylesheets);
|
|
2830
|
+
var hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
2831
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
2551
2832
|
newToken = newStylesheetToken;
|
|
2552
2833
|
}
|
|
2553
2834
|
// Set the new styling token on the host element
|
|
@@ -2569,8 +2850,8 @@
|
|
|
2569
2850
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
2570
2851
|
var content = [];
|
|
2571
2852
|
var root;
|
|
2572
|
-
for (var
|
|
2573
|
-
var stylesheet = stylesheets[
|
|
2853
|
+
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
2854
|
+
var stylesheet = stylesheets[_i13];
|
|
2574
2855
|
if (isArray$1(stylesheet)) {
|
|
2575
2856
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
2576
2857
|
} else {
|
|
@@ -2609,10 +2890,15 @@
|
|
|
2609
2890
|
function getStylesheetsContent(vm, template) {
|
|
2610
2891
|
var stylesheets = template.stylesheets,
|
|
2611
2892
|
stylesheetToken = template.stylesheetToken;
|
|
2893
|
+
var vmStylesheets = vm.stylesheets;
|
|
2612
2894
|
var content = [];
|
|
2613
|
-
if (
|
|
2895
|
+
if (hasStyles(stylesheets)) {
|
|
2614
2896
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
2615
2897
|
}
|
|
2898
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
2899
|
+
if (hasStyles(vmStylesheets)) {
|
|
2900
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
2901
|
+
}
|
|
2616
2902
|
return content;
|
|
2617
2903
|
}
|
|
2618
2904
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -2647,8 +2933,9 @@
|
|
|
2647
2933
|
function getStylesheetTokenHost(vnode) {
|
|
2648
2934
|
var _getComponentInternal = getComponentInternalDef(vnode.ctor),
|
|
2649
2935
|
template = _getComponentInternal.template;
|
|
2936
|
+
var vm = vnode.vm;
|
|
2650
2937
|
var stylesheetToken = template.stylesheetToken;
|
|
2651
|
-
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
2938
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
|
|
2652
2939
|
}
|
|
2653
2940
|
function getNearestNativeShadowComponent(vm) {
|
|
2654
2941
|
var owner = getNearestShadowComponent(vm);
|
|
@@ -2664,8 +2951,8 @@
|
|
|
2664
2951
|
shadowMode = vm.shadowMode,
|
|
2665
2952
|
insertStylesheet = vm.renderer.insertStylesheet;
|
|
2666
2953
|
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
2667
|
-
for (var
|
|
2668
|
-
insertStylesheet(stylesheets[
|
|
2954
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
2955
|
+
insertStylesheet(stylesheets[_i14]);
|
|
2669
2956
|
}
|
|
2670
2957
|
} else if (vm.hydrated) {
|
|
2671
2958
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -2678,8 +2965,8 @@
|
|
|
2678
2965
|
var root = getNearestNativeShadowComponent(vm);
|
|
2679
2966
|
// null root means a global style
|
|
2680
2967
|
var target = isNull(root) ? undefined : root.shadowRoot;
|
|
2681
|
-
for (var
|
|
2682
|
-
insertStylesheet(stylesheets[
|
|
2968
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
2969
|
+
insertStylesheet(stylesheets[_i15], target);
|
|
2683
2970
|
}
|
|
2684
2971
|
}
|
|
2685
2972
|
return null;
|
|
@@ -2981,8 +3268,8 @@
|
|
|
2981
3268
|
return;
|
|
2982
3269
|
}
|
|
2983
3270
|
var setCSSStyleProperty = renderer.setCSSStyleProperty;
|
|
2984
|
-
for (var
|
|
2985
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
3271
|
+
for (var _i16 = 0; _i16 < styleDecls.length; _i16++) {
|
|
3272
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i16], 3),
|
|
2986
3273
|
prop = _styleDecls$_i[0],
|
|
2987
3274
|
value = _styleDecls$_i[1],
|
|
2988
3275
|
important = _styleDecls$_i[2];
|
|
@@ -3207,6 +3494,26 @@
|
|
|
3207
3494
|
// in fallback mode, the allocation will always set children to
|
|
3208
3495
|
// empty and delegate the real allocation to the slot elements
|
|
3209
3496
|
allocateChildren(n2, vm);
|
|
3497
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
3498
|
+
//
|
|
3499
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
3500
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
3501
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
3502
|
+
//
|
|
3503
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
3504
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
3505
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
3506
|
+
// mark the new children dynamic.
|
|
3507
|
+
//
|
|
3508
|
+
// Example:
|
|
3509
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
3510
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
3511
|
+
var shadowMode = vm.shadowMode,
|
|
3512
|
+
renderMode = vm.renderMode;
|
|
3513
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
3514
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
3515
|
+
markAsDynamicChildren(n2.children);
|
|
3516
|
+
}
|
|
3210
3517
|
}
|
|
3211
3518
|
// in fallback mode, the children will be always empty, so, nothing
|
|
3212
3519
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -3354,18 +3661,63 @@
|
|
|
3354
3661
|
//
|
|
3355
3662
|
// In case #2, we will always get a fresh VCustomElement.
|
|
3356
3663
|
var children = vnode.aChildren || vnode.children;
|
|
3357
|
-
vm.aChildren = children;
|
|
3358
3664
|
var renderMode = vm.renderMode,
|
|
3359
3665
|
shadowMode = vm.shadowMode;
|
|
3666
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
3667
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
3668
|
+
var allocatedChildren = flattenFragmentsInChildren(children);
|
|
3669
|
+
vnode.children = allocatedChildren;
|
|
3670
|
+
vm.aChildren = allocatedChildren;
|
|
3360
3671
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
3361
3672
|
// slow path
|
|
3362
|
-
allocateInSlot(vm,
|
|
3673
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
3363
3674
|
// save the allocated children in case this vnode is reused.
|
|
3364
|
-
vnode.aChildren =
|
|
3675
|
+
vnode.aChildren = allocatedChildren;
|
|
3365
3676
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
3366
3677
|
vnode.children = EmptyArray;
|
|
3367
3678
|
}
|
|
3368
3679
|
}
|
|
3680
|
+
/**
|
|
3681
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
3682
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
3683
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
3684
|
+
*
|
|
3685
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
3686
|
+
*
|
|
3687
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
3688
|
+
*/
|
|
3689
|
+
function flattenFragmentsInChildren(children) {
|
|
3690
|
+
var flattenedChildren = [];
|
|
3691
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
3692
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
3693
|
+
var nodeStack = [];
|
|
3694
|
+
var fragmentFound = false;
|
|
3695
|
+
for (var _i17 = children.length - 1; _i17 > -1; _i17 -= 1) {
|
|
3696
|
+
var child = children[_i17];
|
|
3697
|
+
ArrayPush$1.call(nodeStack, child);
|
|
3698
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
3699
|
+
}
|
|
3700
|
+
if (!fragmentFound) {
|
|
3701
|
+
return children;
|
|
3702
|
+
}
|
|
3703
|
+
var currentNode;
|
|
3704
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
3705
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
3706
|
+
var fChildren = currentNode.children;
|
|
3707
|
+
// Ignore the start and end text node delimiters
|
|
3708
|
+
for (var _i18 = fChildren.length - 2; _i18 > 0; _i18 -= 1) {
|
|
3709
|
+
ArrayPush$1.call(nodeStack, fChildren[_i18]);
|
|
3710
|
+
}
|
|
3711
|
+
} else {
|
|
3712
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
3716
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
3717
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
3718
|
+
markAsDynamicChildren(flattenedChildren);
|
|
3719
|
+
return flattenedChildren;
|
|
3720
|
+
}
|
|
3369
3721
|
function createViewModelHook(elm, vnode, renderer) {
|
|
3370
3722
|
var vm = getAssociatedVMIfPresent(elm);
|
|
3371
3723
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
@@ -3385,22 +3737,16 @@
|
|
|
3385
3737
|
});
|
|
3386
3738
|
return vm;
|
|
3387
3739
|
}
|
|
3388
|
-
|
|
3389
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
3390
|
-
*/
|
|
3391
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
3740
|
+
function allocateInSlot(vm, children, owner) {
|
|
3392
3741
|
var _a, _b;
|
|
3393
|
-
|
|
3394
|
-
|
|
3742
|
+
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
3743
|
+
var cmpSlotsMapping = create(null);
|
|
3744
|
+
// Collect all slots into cmpSlotsMapping
|
|
3745
|
+
for (var _i19 = 0, len = children.length; _i19 < len; _i19 += 1) {
|
|
3746
|
+
var vnode = children[_i19];
|
|
3395
3747
|
if (isNull(vnode)) {
|
|
3396
3748
|
continue;
|
|
3397
3749
|
}
|
|
3398
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
3399
|
-
if (isVFragment(vnode)) {
|
|
3400
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
3401
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
3402
|
-
continue;
|
|
3403
|
-
}
|
|
3404
3750
|
var slotName = '';
|
|
3405
3751
|
if (isVBaseElement(vnode)) {
|
|
3406
3752
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
@@ -3410,11 +3756,6 @@
|
|
|
3410
3756
|
var vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
3411
3757
|
ArrayPush$1.call(vnodes, vnode);
|
|
3412
3758
|
}
|
|
3413
|
-
}
|
|
3414
|
-
function allocateInSlot(vm, children, owner) {
|
|
3415
|
-
var oldSlotsMapping = vm.cmpSlots.slotAssignments;
|
|
3416
|
-
var cmpSlotsMapping = create(null);
|
|
3417
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
3418
3759
|
vm.cmpSlots = {
|
|
3419
3760
|
owner: owner,
|
|
3420
3761
|
slotAssignments: cmpSlotsMapping
|
|
@@ -3427,16 +3768,16 @@
|
|
|
3427
3768
|
markComponentAsDirty(vm);
|
|
3428
3769
|
return;
|
|
3429
3770
|
}
|
|
3430
|
-
for (var
|
|
3431
|
-
var key = oldKeys[
|
|
3771
|
+
for (var _i20 = 0, _len2 = oldKeys.length; _i20 < _len2; _i20 += 1) {
|
|
3772
|
+
var key = oldKeys[_i20];
|
|
3432
3773
|
if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
3433
3774
|
markComponentAsDirty(vm);
|
|
3434
3775
|
return;
|
|
3435
3776
|
}
|
|
3436
3777
|
var oldVNodes = oldSlotsMapping[key];
|
|
3437
|
-
var
|
|
3778
|
+
var _vnodes = cmpSlotsMapping[key];
|
|
3438
3779
|
for (var j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
3439
|
-
if (oldVNodes[j] !==
|
|
3780
|
+
if (oldVNodes[j] !== _vnodes[j]) {
|
|
3440
3781
|
markComponentAsDirty(vm);
|
|
3441
3782
|
return;
|
|
3442
3783
|
}
|
|
@@ -3445,14 +3786,14 @@
|
|
|
3445
3786
|
}
|
|
3446
3787
|
}
|
|
3447
3788
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3448
|
-
var
|
|
3449
|
-
// dynamic children means it was generated by an iteration
|
|
3450
|
-
//
|
|
3789
|
+
var DynamicChildren = new WeakMap();
|
|
3790
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
3791
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
3451
3792
|
function markAsDynamicChildren(children) {
|
|
3452
|
-
|
|
3793
|
+
DynamicChildren.set(children, 1);
|
|
3453
3794
|
}
|
|
3454
3795
|
function hasDynamicChildren(children) {
|
|
3455
|
-
return
|
|
3796
|
+
return DynamicChildren.has(children);
|
|
3456
3797
|
}
|
|
3457
3798
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
3458
3799
|
var map = {};
|
|
@@ -3551,11 +3892,11 @@
|
|
|
3551
3892
|
if (oldStartIdx > oldEndIdx) {
|
|
3552
3893
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
3553
3894
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
3554
|
-
var
|
|
3895
|
+
var _i21 = newEndIdx;
|
|
3555
3896
|
var n;
|
|
3556
3897
|
do {
|
|
3557
|
-
n = newCh[++
|
|
3558
|
-
} while (!isVNode(n) &&
|
|
3898
|
+
n = newCh[++_i21];
|
|
3899
|
+
} while (!isVNode(n) && _i21 < newChEnd);
|
|
3559
3900
|
before = isVNode(n) ? n.elm : null;
|
|
3560
3901
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
3561
3902
|
} else {
|
|
@@ -3580,9 +3921,9 @@
|
|
|
3580
3921
|
// if the old list is not empty, the new list MUST have the same
|
|
3581
3922
|
// amount of nodes, that's why we call this static children
|
|
3582
3923
|
var anchor = null;
|
|
3583
|
-
for (var
|
|
3584
|
-
var n1 = c1[
|
|
3585
|
-
var n2 = c2[
|
|
3924
|
+
for (var _i22 = c2Length - 1; _i22 >= 0; _i22 -= 1) {
|
|
3925
|
+
var n1 = c1[_i22];
|
|
3926
|
+
var n2 = c2[_i22];
|
|
3586
3927
|
if (n2 !== n1) {
|
|
3587
3928
|
if (isVNode(n1)) {
|
|
3588
3929
|
if (isVNode(n2)) {
|
|
@@ -3679,8 +4020,8 @@
|
|
|
3679
4020
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
3680
4021
|
var newChildren = [];
|
|
3681
4022
|
var slotAssignments = slotset.slotAssignments[slotName];
|
|
3682
|
-
for (var
|
|
3683
|
-
var vnode = slotAssignments[
|
|
4023
|
+
for (var _i23 = 0; _i23 < slotAssignments.length; _i23++) {
|
|
4024
|
+
var vnode = slotAssignments[_i23];
|
|
3684
4025
|
if (!isNull(vnode)) {
|
|
3685
4026
|
var assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
|
|
3686
4027
|
// The only sniff test for a scoped <slot> element is the presence of `slotData`
|
|
@@ -4030,7 +4371,7 @@
|
|
|
4030
4371
|
}
|
|
4031
4372
|
function buildParseFragmentFn(createFragmentFn) {
|
|
4032
4373
|
return function (strings) {
|
|
4033
|
-
for (var
|
|
4374
|
+
for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
4034
4375
|
keys[_key3 - 1] = arguments[_key3];
|
|
4035
4376
|
}
|
|
4036
4377
|
var cache = create(null);
|
|
@@ -4059,23 +4400,23 @@
|
|
|
4059
4400
|
var classAttrToken = hasScopedStyles && hasStyleToken ? " class=\"".concat(stylesheetToken, "\"") : '';
|
|
4060
4401
|
var attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetToken : '';
|
|
4061
4402
|
var htmlFragment = '';
|
|
4062
|
-
for (var
|
|
4063
|
-
switch (keys[
|
|
4403
|
+
for (var _i24 = 0, n = keys.length; _i24 < n; _i24++) {
|
|
4404
|
+
switch (keys[_i24]) {
|
|
4064
4405
|
case 0:
|
|
4065
4406
|
// styleToken in existing class attr
|
|
4066
|
-
htmlFragment += strings[
|
|
4407
|
+
htmlFragment += strings[_i24] + classToken;
|
|
4067
4408
|
break;
|
|
4068
4409
|
case 1:
|
|
4069
4410
|
// styleToken for added class attr
|
|
4070
|
-
htmlFragment += strings[
|
|
4411
|
+
htmlFragment += strings[_i24] + classAttrToken;
|
|
4071
4412
|
break;
|
|
4072
4413
|
case 2:
|
|
4073
4414
|
// styleToken as attr
|
|
4074
|
-
htmlFragment += strings[
|
|
4415
|
+
htmlFragment += strings[_i24] + attrToken;
|
|
4075
4416
|
break;
|
|
4076
4417
|
case 3:
|
|
4077
4418
|
// ${1}${2}
|
|
4078
|
-
htmlFragment += strings[
|
|
4419
|
+
htmlFragment += strings[_i24] + classAttrToken + attrToken;
|
|
4079
4420
|
break;
|
|
4080
4421
|
}
|
|
4081
4422
|
}
|
|
@@ -4131,7 +4472,7 @@
|
|
|
4131
4472
|
// Create a brand new template cache for the swapped templated.
|
|
4132
4473
|
context.tplCache = create(null);
|
|
4133
4474
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
4134
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
4475
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
4135
4476
|
// Update the scoping token on the host element.
|
|
4136
4477
|
updateStylesheetToken(vm, html);
|
|
4137
4478
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -4163,17 +4504,24 @@
|
|
|
4163
4504
|
});
|
|
4164
4505
|
return vnodes;
|
|
4165
4506
|
}
|
|
4166
|
-
function
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
|
|
4507
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
4508
|
+
if (hasStyles(stylesheets)) {
|
|
4509
|
+
for (var _i25 = 0; _i25 < stylesheets.length; _i25++) {
|
|
4510
|
+
if (isTrue(stylesheets[_i25][KEY__SCOPED_CSS])) {
|
|
4171
4511
|
return true;
|
|
4172
4512
|
}
|
|
4173
4513
|
}
|
|
4174
4514
|
}
|
|
4175
4515
|
return false;
|
|
4176
4516
|
}
|
|
4517
|
+
function computeHasScopedStyles(template, vm) {
|
|
4518
|
+
var stylesheets = template.stylesheets;
|
|
4519
|
+
var vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
4520
|
+
return computeHasScopedStylesInStylesheets(stylesheets) || computeHasScopedStylesInStylesheets(vmStylesheets);
|
|
4521
|
+
}
|
|
4522
|
+
function hasStyles(stylesheets) {
|
|
4523
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
4524
|
+
}
|
|
4177
4525
|
var vmBeingConstructed = null;
|
|
4178
4526
|
function isBeingConstructed(vm) {
|
|
4179
4527
|
return vmBeingConstructed === vm;
|
|
@@ -4264,8 +4612,8 @@
|
|
|
4264
4612
|
*/
|
|
4265
4613
|
function registerComponent(
|
|
4266
4614
|
// We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
4267
|
-
Ctor,
|
|
4268
|
-
var tmpl =
|
|
4615
|
+
Ctor, _ref4) {
|
|
4616
|
+
var tmpl = _ref4.tmpl;
|
|
4269
4617
|
if (isFunction$1(Ctor)) {
|
|
4270
4618
|
signedTemplateMap.set(Ctor, tmpl);
|
|
4271
4619
|
}
|
|
@@ -4325,8 +4673,8 @@
|
|
|
4325
4673
|
* subject to change or being removed.
|
|
4326
4674
|
*/
|
|
4327
4675
|
function register(service) {
|
|
4328
|
-
for (var
|
|
4329
|
-
var hookName = hooks[
|
|
4676
|
+
for (var _i26 = 0; _i26 < hooks.length; ++_i26) {
|
|
4677
|
+
var hookName = hooks[_i26];
|
|
4330
4678
|
if (hookName in service) {
|
|
4331
4679
|
var l = Services[hookName];
|
|
4332
4680
|
if (isUndefined$1(l)) {
|
|
@@ -4340,8 +4688,8 @@
|
|
|
4340
4688
|
var component = vm.component,
|
|
4341
4689
|
def = vm.def,
|
|
4342
4690
|
context = vm.context;
|
|
4343
|
-
for (var
|
|
4344
|
-
cbs[
|
|
4691
|
+
for (var _i27 = 0, len = cbs.length; _i27 < len; ++_i27) {
|
|
4692
|
+
cbs[_i27].call(undefined, component, {}, def, context);
|
|
4345
4693
|
}
|
|
4346
4694
|
}
|
|
4347
4695
|
|
|
@@ -4454,6 +4802,7 @@
|
|
|
4454
4802
|
// Properties set right after VM creation.
|
|
4455
4803
|
tro: null,
|
|
4456
4804
|
shadowMode: null,
|
|
4805
|
+
stylesheets: null,
|
|
4457
4806
|
// Properties set by the LightningElement constructor.
|
|
4458
4807
|
component: null,
|
|
4459
4808
|
shadowRoot: null,
|
|
@@ -4463,6 +4812,7 @@
|
|
|
4463
4812
|
getHook: getHook,
|
|
4464
4813
|
renderer: renderer
|
|
4465
4814
|
};
|
|
4815
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
4466
4816
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
4467
4817
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
4468
4818
|
// Create component instance associated to the vm and the element.
|
|
@@ -4471,7 +4821,39 @@
|
|
|
4471
4821
|
if (hasWireAdapters(vm)) {
|
|
4472
4822
|
installWireAdapters(vm);
|
|
4473
4823
|
}
|
|
4474
|
-
return vm;
|
|
4824
|
+
return vm;
|
|
4825
|
+
}
|
|
4826
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
4827
|
+
var valid = true;
|
|
4828
|
+
var validate = function validate(arrayOrStylesheet) {
|
|
4829
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
4830
|
+
for (var _i28 = 0; _i28 < arrayOrStylesheet.length; _i28++) {
|
|
4831
|
+
validate(arrayOrStylesheet[_i28]);
|
|
4832
|
+
}
|
|
4833
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
4834
|
+
// function assumed to be a stylesheet factory
|
|
4835
|
+
valid = false;
|
|
4836
|
+
}
|
|
4837
|
+
};
|
|
4838
|
+
if (!isArray$1(stylesheets)) {
|
|
4839
|
+
valid = false;
|
|
4840
|
+
} else {
|
|
4841
|
+
validate(stylesheets);
|
|
4842
|
+
}
|
|
4843
|
+
return valid;
|
|
4844
|
+
}
|
|
4845
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
4846
|
+
function computeStylesheets(vm, ctor) {
|
|
4847
|
+
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
4848
|
+
var stylesheets = ctor.stylesheets;
|
|
4849
|
+
if (!isUndefined$1(stylesheets)) {
|
|
4850
|
+
var valid = validateComponentStylesheets(vm, stylesheets);
|
|
4851
|
+
if (valid) {
|
|
4852
|
+
return flattenStylesheets(stylesheets);
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
return null;
|
|
4475
4857
|
}
|
|
4476
4858
|
function computeShadowMode(vm, renderer) {
|
|
4477
4859
|
var def = vm.def;
|
|
@@ -4581,17 +4963,17 @@
|
|
|
4581
4963
|
return a.idx - b.idx;
|
|
4582
4964
|
});
|
|
4583
4965
|
rehydrateQueue = []; // reset to a new queue
|
|
4584
|
-
for (var
|
|
4585
|
-
var vm = vms[
|
|
4966
|
+
for (var _i29 = 0, len = vms.length; _i29 < len; _i29 += 1) {
|
|
4967
|
+
var vm = vms[_i29];
|
|
4586
4968
|
try {
|
|
4587
4969
|
rehydrate(vm);
|
|
4588
4970
|
} catch (error) {
|
|
4589
|
-
if (
|
|
4971
|
+
if (_i29 + 1 < len) {
|
|
4590
4972
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
4591
4973
|
if (rehydrateQueue.length === 0) {
|
|
4592
4974
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
4593
4975
|
}
|
|
4594
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
4976
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i29 + 1));
|
|
4595
4977
|
}
|
|
4596
4978
|
// we need to end the measure before throwing.
|
|
4597
4979
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
@@ -4657,8 +5039,8 @@
|
|
|
4657
5039
|
var vCustomElementCollection = vm.velements;
|
|
4658
5040
|
// Reporting disconnection for every child in inverse order since they are
|
|
4659
5041
|
// inserted in reserved order.
|
|
4660
|
-
for (var
|
|
4661
|
-
var elm = vCustomElementCollection[
|
|
5042
|
+
for (var _i30 = vCustomElementCollection.length - 1; _i30 >= 0; _i30 -= 1) {
|
|
5043
|
+
var elm = vCustomElementCollection[_i30].elm;
|
|
4662
5044
|
// There are two cases where the element could be undefined:
|
|
4663
5045
|
// * when there is an error during the construction phase, and an error
|
|
4664
5046
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
@@ -4689,8 +5071,8 @@
|
|
|
4689
5071
|
* defined on its shadow.
|
|
4690
5072
|
*/
|
|
4691
5073
|
function recursivelyDisconnectChildren(vnodes) {
|
|
4692
|
-
for (var
|
|
4693
|
-
var vnode = vnodes[
|
|
5074
|
+
for (var _i31 = 0, len = vnodes.length; _i31 < len; _i31 += 1) {
|
|
5075
|
+
var vnode = vnodes[_i31];
|
|
4694
5076
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
4695
5077
|
switch (vnode.type) {
|
|
4696
5078
|
case 2 /* VNodeType.Element */:
|
|
@@ -4714,8 +5096,8 @@
|
|
|
4714
5096
|
var children = vm.children,
|
|
4715
5097
|
renderRoot = vm.renderRoot,
|
|
4716
5098
|
remove = vm.renderer.remove;
|
|
4717
|
-
for (var
|
|
4718
|
-
var child = children[
|
|
5099
|
+
for (var _i32 = 0, len = children.length; _i32 < len; _i32++) {
|
|
5100
|
+
var child = children[_i32];
|
|
4719
5101
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
4720
5102
|
remove(child.elm, renderRoot);
|
|
4721
5103
|
}
|
|
@@ -4775,254 +5157,153 @@
|
|
|
4775
5157
|
* SPDX-License-Identifier: MIT
|
|
4776
5158
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4777
5159
|
*/
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
});
|
|
4801
|
-
return _this2;
|
|
5160
|
+
//
|
|
5161
|
+
// The goal of this code is to detect invalid cross-root ARIA references in synthetic shadow DOM.
|
|
5162
|
+
// These invalid references should be fixed before the offending components can be migrated to native shadow DOM.
|
|
5163
|
+
// When invalid usage is detected, we warn in dev mode and call the reporting API if enabled.
|
|
5164
|
+
// See: https://lwc.dev/guide/accessibility#link-ids-and-aria-attributes-from-different-templates
|
|
5165
|
+
//
|
|
5166
|
+
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
5167
|
+
var getElementById = _globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
5168
|
+
var querySelectorAll = _globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
5169
|
+
function isSyntheticShadowRootInstance(rootNode) {
|
|
5170
|
+
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
5171
|
+
}
|
|
5172
|
+
function reportViolation(source, target, attrName) {
|
|
5173
|
+
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
5174
|
+
// shadow for a violation to be detected.
|
|
5175
|
+
var vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
5176
|
+
if (isUndefined$1(vm)) {
|
|
5177
|
+
vm = getAssociatedVMIfPresent(target.getRootNode().host);
|
|
5178
|
+
}
|
|
5179
|
+
if (isUndefined$1(vm)) {
|
|
5180
|
+
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
5181
|
+
return;
|
|
4802
5182
|
}
|
|
4803
|
-
|
|
4804
|
-
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
4805
|
-
function createFieldDataCallback(vm, name) {
|
|
4806
|
-
return function (value) {
|
|
4807
|
-
updateComponentValue(vm, name, value);
|
|
4808
|
-
};
|
|
4809
|
-
}
|
|
4810
|
-
function createMethodDataCallback(vm, method) {
|
|
4811
|
-
return function (value) {
|
|
4812
|
-
// dispatching new value into the wired method
|
|
4813
|
-
runWithBoundaryProtection(vm, vm.owner, noop, function () {
|
|
4814
|
-
// job
|
|
4815
|
-
method.call(vm.component, value);
|
|
4816
|
-
}, noop);
|
|
4817
|
-
};
|
|
5183
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, vm);
|
|
4818
5184
|
}
|
|
4819
|
-
function
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
var ro = createReactiveObserver(function () {
|
|
4823
|
-
if (hasPendingConfig === false) {
|
|
4824
|
-
hasPendingConfig = true;
|
|
4825
|
-
// collect new config in the micro-task
|
|
4826
|
-
Promise.resolve().then(function () {
|
|
4827
|
-
hasPendingConfig = false;
|
|
4828
|
-
// resetting current reactive params
|
|
4829
|
-
ro.reset();
|
|
4830
|
-
// dispatching a new config due to a change in the configuration
|
|
4831
|
-
computeConfigAndUpdate();
|
|
4832
|
-
});
|
|
4833
|
-
}
|
|
4834
|
-
});
|
|
4835
|
-
var computeConfigAndUpdate = function computeConfigAndUpdate() {
|
|
4836
|
-
var config;
|
|
4837
|
-
ro.observe(function () {
|
|
4838
|
-
return config = configCallback(component);
|
|
4839
|
-
});
|
|
4840
|
-
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
4841
|
-
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
4842
|
-
// @ts-ignore it is assigned in the observe() callback
|
|
4843
|
-
callbackWhenConfigIsReady(config);
|
|
4844
|
-
};
|
|
4845
|
-
return {
|
|
4846
|
-
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
4847
|
-
ro: ro
|
|
4848
|
-
};
|
|
5185
|
+
function parseIdRefAttributeValue(attrValue) {
|
|
5186
|
+
// split on whitespace and skip empty strings after splitting
|
|
5187
|
+
return isString(attrValue) ? ArrayFilter.call(StringSplit.call(attrValue, /\s+/), Boolean) : [];
|
|
4849
5188
|
}
|
|
4850
|
-
function
|
|
4851
|
-
var
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
return; // no provider found, nothing to be done
|
|
5189
|
+
function detectSyntheticCrossRootAria(elm, attrName, attrValue) {
|
|
5190
|
+
var root = elm.getRootNode();
|
|
5191
|
+
if (!isSyntheticShadowRootInstance(root)) {
|
|
5192
|
+
return;
|
|
4855
5193
|
}
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
5194
|
+
if (attrName === 'id') {
|
|
5195
|
+
// elm is the target, find the source
|
|
5196
|
+
if (!isString(attrValue) || attrValue.length === 0) {
|
|
5197
|
+
// if our id is null or empty, nobody can reference us
|
|
5198
|
+
return;
|
|
5199
|
+
}
|
|
5200
|
+
var _iterator5 = _createForOfIteratorHelper(ID_REFERENCING_ATTRIBUTES_SET),
|
|
5201
|
+
_step5;
|
|
5202
|
+
try {
|
|
5203
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
5204
|
+
var idRefAttrName = _step5.value;
|
|
5205
|
+
// Query all global elements with this attribute. The attribute selector syntax `~=` is for values
|
|
5206
|
+
// that reference multiple IDs, separated by whitespace.
|
|
5207
|
+
var query = "[".concat(idRefAttrName, "~=\"").concat(CSS.escape(attrValue), "\"]");
|
|
5208
|
+
var sourceElements = querySelectorAll.call(document, query);
|
|
5209
|
+
for (var _i33 = 0; _i33 < sourceElements.length; _i33++) {
|
|
5210
|
+
var sourceElement = sourceElements[_i33];
|
|
5211
|
+
var sourceRoot = sourceElement.getRootNode();
|
|
5212
|
+
if (sourceRoot !== root) {
|
|
5213
|
+
reportViolation(sourceElement, elm, idRefAttrName);
|
|
5214
|
+
break;
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
4879
5217
|
}
|
|
4880
|
-
})
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
defineProperty(dataCallback, DeprecatedWiredParamsMeta, {
|
|
4901
|
-
value: dynamic
|
|
4902
|
-
});
|
|
4903
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
4904
|
-
// job
|
|
4905
|
-
connector = new adapter(dataCallback);
|
|
4906
|
-
}, noop);
|
|
4907
|
-
var updateConnectorConfig = function updateConnectorConfig(config) {
|
|
4908
|
-
// every time the config is recomputed due to tracking,
|
|
4909
|
-
// this callback will be invoked with the new computed config
|
|
4910
|
-
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
4911
|
-
// job
|
|
4912
|
-
if ("production" !== 'production') ;
|
|
4913
|
-
connector.update(config, context);
|
|
4914
|
-
}, noop);
|
|
4915
|
-
};
|
|
4916
|
-
// Computes the current wire config and calls the update method on the wire adapter.
|
|
4917
|
-
// If it has params, we will need to observe changes in the next tick.
|
|
4918
|
-
var _createConfigWatcher = createConfigWatcher(vm.component, configCallback, updateConnectorConfig),
|
|
4919
|
-
computeConfigAndUpdate = _createConfigWatcher.computeConfigAndUpdate,
|
|
4920
|
-
ro = _createConfigWatcher.ro;
|
|
4921
|
-
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
4922
|
-
if (!isUndefined$1(adapter.contextSchema)) {
|
|
4923
|
-
createContextWatcher(vm, wireDef, function (newContext) {
|
|
4924
|
-
// every time the context is pushed into this component,
|
|
4925
|
-
// this callback will be invoked with the new computed context
|
|
4926
|
-
if (context !== newContext) {
|
|
4927
|
-
context = newContext;
|
|
4928
|
-
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
4929
|
-
// context, this is to preserve the identity characteristics, config should not have identity
|
|
4930
|
-
// (ever), while context can have identity
|
|
4931
|
-
if (vm.state === 1 /* VMState.connected */) {
|
|
4932
|
-
computeConfigAndUpdate();
|
|
5218
|
+
} catch (err) {
|
|
5219
|
+
_iterator5.e(err);
|
|
5220
|
+
} finally {
|
|
5221
|
+
_iterator5.f();
|
|
5222
|
+
}
|
|
5223
|
+
} else {
|
|
5224
|
+
// elm is the source, find the target
|
|
5225
|
+
var ids = parseIdRefAttributeValue(attrValue);
|
|
5226
|
+
var _iterator6 = _createForOfIteratorHelper(ids),
|
|
5227
|
+
_step6;
|
|
5228
|
+
try {
|
|
5229
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
5230
|
+
var id = _step6.value;
|
|
5231
|
+
var target = getElementById.call(document, id);
|
|
5232
|
+
if (!isNull(target)) {
|
|
5233
|
+
var targetRoot = target.getRootNode();
|
|
5234
|
+
if (targetRoot !== root) {
|
|
5235
|
+
// target element's shadow root is not the same as ours
|
|
5236
|
+
reportViolation(elm, target, attrName);
|
|
5237
|
+
}
|
|
4933
5238
|
}
|
|
4934
5239
|
}
|
|
4935
|
-
})
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
connector: connector,
|
|
4940
|
-
computeConfigAndUpdate: computeConfigAndUpdate,
|
|
4941
|
-
resetConfigWatcher: function resetConfigWatcher() {
|
|
4942
|
-
return ro.reset();
|
|
5240
|
+
} catch (err) {
|
|
5241
|
+
_iterator6.e(err);
|
|
5242
|
+
} finally {
|
|
5243
|
+
_iterator6.f();
|
|
4943
5244
|
}
|
|
4944
|
-
};
|
|
4945
|
-
}
|
|
4946
|
-
var AdapterToTokenMap = new Map();
|
|
4947
|
-
function getAdapterToken(adapter) {
|
|
4948
|
-
return AdapterToTokenMap.get(adapter);
|
|
4949
|
-
}
|
|
4950
|
-
function setAdapterToken(adapter, token) {
|
|
4951
|
-
AdapterToTokenMap.set(adapter, token);
|
|
4952
|
-
}
|
|
4953
|
-
function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
4954
|
-
// support for callable adapters
|
|
4955
|
-
if (adapter.adapter) {
|
|
4956
|
-
adapter = adapter.adapter;
|
|
4957
5245
|
}
|
|
4958
|
-
var method = descriptor.value;
|
|
4959
|
-
var def = {
|
|
4960
|
-
adapter: adapter,
|
|
4961
|
-
method: method,
|
|
4962
|
-
configCallback: configCallback,
|
|
4963
|
-
dynamic: dynamic
|
|
4964
|
-
};
|
|
4965
|
-
WireMetaMap.set(descriptor, def);
|
|
4966
5246
|
}
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
5247
|
+
var enabled = false;
|
|
5248
|
+
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
5249
|
+
// reporting is not enabled. It should also only run once
|
|
5250
|
+
function enableDetection() {
|
|
5251
|
+
if (enabled) {
|
|
5252
|
+
return; // don't double-apply the patches
|
|
4971
5253
|
}
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
});
|
|
5004
|
-
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
5005
|
-
connector.disconnect();
|
|
5006
|
-
resetConfigWatcher();
|
|
5007
|
-
});
|
|
5008
|
-
})();
|
|
5254
|
+
|
|
5255
|
+
enabled = true;
|
|
5256
|
+
var _setAttribute = Element.prototype.setAttribute;
|
|
5257
|
+
// Detect calling `setAttribute` to set an idref or an id
|
|
5258
|
+
assign(Element.prototype, {
|
|
5259
|
+
setAttribute: function setAttribute(attrName, attrValue) {
|
|
5260
|
+
_setAttribute.call(this, attrName, attrValue);
|
|
5261
|
+
if (attrName === 'id' || ID_REFERENCING_ATTRIBUTES_SET.has(attrName)) {
|
|
5262
|
+
detectSyntheticCrossRootAria(this, attrName, attrValue);
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
});
|
|
5266
|
+
// Detect `elm.id = 'foo'`
|
|
5267
|
+
var idDescriptor = getOwnPropertyDescriptor$1(Element.prototype, 'id');
|
|
5268
|
+
if (!isUndefined$1(idDescriptor)) {
|
|
5269
|
+
var _get3 = idDescriptor.get,
|
|
5270
|
+
_set3 = idDescriptor.set;
|
|
5271
|
+
// These should always be a getter and a setter, but if someone is monkeying with the global descriptor, ignore it
|
|
5272
|
+
if (isFunction$1(_get3) && isFunction$1(_set3)) {
|
|
5273
|
+
defineProperty(Element.prototype, 'id', {
|
|
5274
|
+
get: function get() {
|
|
5275
|
+
return _get3.call(this);
|
|
5276
|
+
},
|
|
5277
|
+
set: function set(value) {
|
|
5278
|
+
_set3.call(this, value);
|
|
5279
|
+
detectSyntheticCrossRootAria(this, 'id', value);
|
|
5280
|
+
},
|
|
5281
|
+
// On the default descriptor for 'id', enumerable and configurable are true
|
|
5282
|
+
enumerable: true,
|
|
5283
|
+
configurable: true
|
|
5284
|
+
});
|
|
5009
5285
|
}
|
|
5010
5286
|
}
|
|
5011
5287
|
}
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
}
|
|
5288
|
+
// Our detection logic relies on some modern browser features. We can just skip reporting the data
|
|
5289
|
+
// for unsupported browsers
|
|
5290
|
+
function supportsCssEscape() {
|
|
5291
|
+
return typeof CSS !== 'undefined' && isFunction$1(CSS.escape);
|
|
5017
5292
|
}
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5293
|
+
// If this page is not using synthetic shadow, then we don't need to install detection. Note
|
|
5294
|
+
// that we are assuming synthetic shadow is loaded before LWC.
|
|
5295
|
+
function isSyntheticShadowLoaded() {
|
|
5296
|
+
// We should probably be calling `renderer.isSyntheticShadowDefined`, but 1) we don't have access to the renderer,
|
|
5297
|
+
// and 2) this code needs to run in @lwc/engine-core, so it can access `logWarn()` and `report()`.
|
|
5298
|
+
return hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5299
|
+
}
|
|
5300
|
+
// Detecting cross-root ARIA in synthetic shadow only makes sense for the browser
|
|
5301
|
+
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
5302
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
5303
|
+
{
|
|
5304
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
5305
|
+
onReportingEnabled(enableDetection);
|
|
5306
|
+
}
|
|
5026
5307
|
}
|
|
5027
5308
|
|
|
5028
5309
|
/*
|
|
@@ -5230,8 +5511,8 @@
|
|
|
5230
5511
|
var nextNode = node;
|
|
5231
5512
|
var anchor = null;
|
|
5232
5513
|
var renderer = owner.renderer;
|
|
5233
|
-
for (var
|
|
5234
|
-
var childVnode = children[
|
|
5514
|
+
for (var _i34 = 0; _i34 < children.length; _i34++) {
|
|
5515
|
+
var childVnode = children[_i34];
|
|
5235
5516
|
if (!isNull(childVnode)) {
|
|
5236
5517
|
if (nextNode) {
|
|
5237
5518
|
nextNode = hydrateNode(nextNode, childVnode, renderer);
|
|
@@ -5292,8 +5573,8 @@
|
|
|
5292
5573
|
var nodesAreCompatible = true;
|
|
5293
5574
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
|
5294
5575
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
5295
|
-
for (var
|
|
5296
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[
|
|
5576
|
+
for (var _i35 = 0, _Object$entries = Object.entries(attrs); _i35 < _Object$entries.length; _i35++) {
|
|
5577
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i35], 2),
|
|
5297
5578
|
attrName = _Object$entries$_i[0],
|
|
5298
5579
|
attrValue = _Object$entries$_i[1];
|
|
5299
5580
|
vnode.owner;
|
|
@@ -5380,8 +5661,8 @@
|
|
|
5380
5661
|
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
5381
5662
|
var expectedStyle = [];
|
|
5382
5663
|
// styleMap is used when style is set to static value.
|
|
5383
|
-
for (var
|
|
5384
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[
|
|
5664
|
+
for (var _i36 = 0, n = styleDecls.length; _i36 < n; _i36++) {
|
|
5665
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i36], 3),
|
|
5385
5666
|
prop = _styleDecls$_i2[0],
|
|
5386
5667
|
value = _styleDecls$_i2[1],
|
|
5387
5668
|
important = _styleDecls$_i2[2];
|
|
@@ -5455,8 +5736,8 @@
|
|
|
5455
5736
|
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
5456
5737
|
function traverseStylesheets(stylesheets, callback) {
|
|
5457
5738
|
callback(stylesheets);
|
|
5458
|
-
for (var
|
|
5459
|
-
var stylesheet = stylesheets[
|
|
5739
|
+
for (var _i37 = 0; _i37 < stylesheets.length; _i37++) {
|
|
5740
|
+
var stylesheet = stylesheets[_i37];
|
|
5460
5741
|
if (isArray$1(stylesheet)) {
|
|
5461
5742
|
traverseStylesheets(stylesheet, callback);
|
|
5462
5743
|
} else {
|
|
@@ -6117,17 +6398,17 @@
|
|
|
6117
6398
|
function flushPendingWhenDefinedCallbacks(tagName, ctor) {
|
|
6118
6399
|
var resolvers = pendingWhenDefinedCallbacks.get(tagName);
|
|
6119
6400
|
if (!isUndefined$1(resolvers)) {
|
|
6120
|
-
var
|
|
6121
|
-
|
|
6401
|
+
var _iterator10 = _createForOfIteratorHelper(resolvers),
|
|
6402
|
+
_step10;
|
|
6122
6403
|
try {
|
|
6123
|
-
for (
|
|
6124
|
-
var resolver =
|
|
6404
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
6405
|
+
var resolver = _step10.value;
|
|
6125
6406
|
resolver(ctor);
|
|
6126
6407
|
}
|
|
6127
6408
|
} catch (err) {
|
|
6128
|
-
|
|
6409
|
+
_iterator10.e(err);
|
|
6129
6410
|
} finally {
|
|
6130
|
-
|
|
6411
|
+
_iterator10.f();
|
|
6131
6412
|
}
|
|
6132
6413
|
}
|
|
6133
6414
|
pendingWhenDefinedCallbacks.delete(tagName);
|
|
@@ -6177,11 +6458,11 @@
|
|
|
6177
6458
|
var awaiting = awaitingUpgrade.get(tagName);
|
|
6178
6459
|
if (!isUndefined$1(awaiting)) {
|
|
6179
6460
|
awaitingUpgrade.delete(tagName);
|
|
6180
|
-
var
|
|
6181
|
-
|
|
6461
|
+
var _iterator11 = _createForOfIteratorHelper(awaiting),
|
|
6462
|
+
_step11;
|
|
6182
6463
|
try {
|
|
6183
|
-
for (
|
|
6184
|
-
var element =
|
|
6464
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
6465
|
+
var element = _step11.value;
|
|
6185
6466
|
var registeredDefinition = pendingRegistryForElement.get(element);
|
|
6186
6467
|
// At this point, registeredDefinition should never be undefined because awaitingUpgrade
|
|
6187
6468
|
// is only populated when we haven't run internalUpgrade yet, and we only populate
|
|
@@ -6193,9 +6474,9 @@
|
|
|
6193
6474
|
}
|
|
6194
6475
|
}
|
|
6195
6476
|
} catch (err) {
|
|
6196
|
-
|
|
6477
|
+
_iterator11.e(err);
|
|
6197
6478
|
} finally {
|
|
6198
|
-
|
|
6479
|
+
_iterator11.f();
|
|
6199
6480
|
}
|
|
6200
6481
|
}
|
|
6201
6482
|
// If anyone called customElements.whenDefined() and is still waiting for a promise resolution, resolve now
|
|
@@ -6472,7 +6753,7 @@
|
|
|
6472
6753
|
function isNull(obj) {
|
|
6473
6754
|
return obj === null;
|
|
6474
6755
|
}
|
|
6475
|
-
/** version: 2.
|
|
6756
|
+
/** version: 2.35.0 */
|
|
6476
6757
|
|
|
6477
6758
|
/*
|
|
6478
6759
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6531,17 +6812,17 @@
|
|
|
6531
6812
|
exports.createFragment = function (html) {
|
|
6532
6813
|
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
6533
6814
|
if (!isUndefined(wrapperTags)) {
|
|
6534
|
-
var
|
|
6535
|
-
|
|
6815
|
+
var _iterator12 = _createForOfIteratorHelper(wrapperTags),
|
|
6816
|
+
_step12;
|
|
6536
6817
|
try {
|
|
6537
|
-
for (
|
|
6538
|
-
var wrapperTag =
|
|
6818
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
6819
|
+
var wrapperTag = _step12.value;
|
|
6539
6820
|
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
6540
6821
|
}
|
|
6541
6822
|
} catch (err) {
|
|
6542
|
-
|
|
6823
|
+
_iterator12.e(err);
|
|
6543
6824
|
} finally {
|
|
6544
|
-
|
|
6825
|
+
_iterator12.f();
|
|
6545
6826
|
}
|
|
6546
6827
|
}
|
|
6547
6828
|
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
@@ -6550,7 +6831,7 @@
|
|
|
6550
6831
|
doc.body.innerHTML = html;
|
|
6551
6832
|
var content = doc.body;
|
|
6552
6833
|
if (!isUndefined(wrapperTags)) {
|
|
6553
|
-
for (var
|
|
6834
|
+
for (var _i38 = 0; _i38 < wrapperTags.length; _i38++) {
|
|
6554
6835
|
content = content.firstChild;
|
|
6555
6836
|
}
|
|
6556
6837
|
}
|
|
@@ -6743,8 +7024,8 @@
|
|
|
6743
7024
|
tagName: element.tagName.toLowerCase(),
|
|
6744
7025
|
hydrated: true
|
|
6745
7026
|
});
|
|
6746
|
-
for (var
|
|
6747
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
7027
|
+
for (var _i39 = 0, _Object$entries2 = Object.entries(props); _i39 < _Object$entries2.length; _i39++) {
|
|
7028
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i39], 2),
|
|
6748
7029
|
key = _Object$entries2$_i[0],
|
|
6749
7030
|
value = _Object$entries2$_i[1];
|
|
6750
7031
|
element[key] = value;
|
|
@@ -7031,10 +7312,11 @@
|
|
|
7031
7312
|
});
|
|
7032
7313
|
freeze(LightningElement);
|
|
7033
7314
|
seal(LightningElement.prototype);
|
|
7034
|
-
/* version: 2.
|
|
7315
|
+
/* version: 2.35.0 */
|
|
7035
7316
|
|
|
7036
7317
|
exports.LightningElement = LightningElement;
|
|
7037
7318
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
7319
|
+
exports.__unstable__ReportingControl = reportingControl;
|
|
7038
7320
|
exports.api = api$1;
|
|
7039
7321
|
exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
|
|
7040
7322
|
exports.createContextProvider = createContextProvider;
|