lwc 2.8.0 → 2.11.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 +4362 -5763
- package/dist/engine-dom/iife/es2017/engine-dom.js +4362 -5763
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +3303 -4535
- package/dist/engine-dom/iife/es5/engine-dom.js +789 -580
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +650 -518
- package/dist/engine-dom/umd/es2017/engine-dom.js +4362 -5763
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +3303 -4535
- package/dist/engine-dom/umd/es5/engine-dom.js +789 -580
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +650 -518
- package/dist/engine-server/commonjs/es2017/engine-server.js +4062 -5273
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +4062 -5273
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +2952 -3673
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +2952 -3673
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +2825 -3532
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +11 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +11 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +2952 -3673
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +2825 -3532
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +11 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +11 -3
- package/dist/wire-service/esm/es2017/wire-service.js +128 -174
- package/dist/wire-service/iife/es2017/wire-service.js +128 -174
- package/dist/wire-service/iife/es2017/wire-service_debug.js +128 -174
- 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 +128 -174
- package/dist/wire-service/umd/es2017/wire-service_debug.js +128 -174
- 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
|
@@ -10,14 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
12
12
|
|
|
13
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
-
|
|
15
|
-
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."); }
|
|
16
|
-
|
|
17
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
-
|
|
19
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
|
|
21
13
|
function _get2() { if (typeof Reflect !== "undefined" && Reflect.get) { _get2 = Reflect.get; } else { _get2 = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get2.apply(this, arguments); }
|
|
22
14
|
|
|
23
15
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
|
|
@@ -44,6 +36,14 @@
|
|
|
44
36
|
|
|
45
37
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
46
38
|
|
|
39
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
40
|
+
|
|
41
|
+
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."); }
|
|
42
|
+
|
|
43
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
44
|
+
|
|
45
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
46
|
+
|
|
47
47
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
48
48
|
|
|
49
49
|
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."); }
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
349
349
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
350
350
|
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
351
|
-
/** version: 2.
|
|
351
|
+
/** version: 2.11.0 */
|
|
352
352
|
|
|
353
353
|
/*
|
|
354
354
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -413,7 +413,7 @@
|
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
function patch(propName) {
|
|
416
|
+
function patch$1(propName) {
|
|
417
417
|
// Typescript is inferring the wrong function type for this particular
|
|
418
418
|
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
419
419
|
// @ts-ignore type-mismatch
|
|
@@ -435,7 +435,7 @@
|
|
|
435
435
|
var propName = ElementPrototypeAriaPropertyNames[_i2];
|
|
436
436
|
|
|
437
437
|
if (detect(propName)) {
|
|
438
|
-
patch(propName);
|
|
438
|
+
patch$1(propName);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
@@ -451,14 +451,15 @@
|
|
|
451
451
|
|
|
452
452
|
|
|
453
453
|
var features = {
|
|
454
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
455
|
-
ENABLE_HMR: null,
|
|
456
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
457
454
|
ENABLE_ELEMENT_PATCH: null,
|
|
458
455
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
459
|
-
|
|
456
|
+
ENABLE_HMR: null,
|
|
460
457
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
458
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
459
|
+
ENABLE_MIXED_SHADOW_MODE: null,
|
|
460
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
461
461
|
ENABLE_NODE_PATCH: null,
|
|
462
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
462
463
|
ENABLE_WIRE_SYNC_EMIT: null
|
|
463
464
|
};
|
|
464
465
|
|
|
@@ -517,7 +518,7 @@
|
|
|
517
518
|
|
|
518
519
|
function setFeatureFlagForTest(name, value) {
|
|
519
520
|
}
|
|
520
|
-
/** version: 2.
|
|
521
|
+
/** version: 2.11.0 */
|
|
521
522
|
|
|
522
523
|
/* proxy-compat-disable */
|
|
523
524
|
|
|
@@ -560,6 +561,21 @@
|
|
|
560
561
|
|
|
561
562
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
562
563
|
} // Borrowed from Vue template compiler.
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
function cloneAndOmitKey(object, keyToOmit) {
|
|
567
|
+
var result = {};
|
|
568
|
+
|
|
569
|
+
for (var _i4 = 0, _Object$keys = Object.keys(object); _i4 < _Object$keys.length; _i4++) {
|
|
570
|
+
var key = _Object$keys[_i4];
|
|
571
|
+
|
|
572
|
+
if (key !== keyToOmit) {
|
|
573
|
+
result[key] = object[key];
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return result;
|
|
578
|
+
}
|
|
563
579
|
// Primitives
|
|
564
580
|
//
|
|
565
581
|
|
|
@@ -828,8 +844,8 @@
|
|
|
828
844
|
var reactiveObservers = reactiveRecord[key];
|
|
829
845
|
|
|
830
846
|
if (!isUndefined$1(reactiveObservers)) {
|
|
831
|
-
for (var
|
|
832
|
-
var ro = reactiveObservers[
|
|
847
|
+
for (var _i5 = 0, _len2 = reactiveObservers.length; _i5 < _len2; _i5 += 1) {
|
|
848
|
+
var ro = reactiveObservers[_i5];
|
|
833
849
|
ro.notify();
|
|
834
850
|
}
|
|
835
851
|
}
|
|
@@ -898,9 +914,9 @@
|
|
|
898
914
|
var len = listeners.length;
|
|
899
915
|
|
|
900
916
|
if (len > 0) {
|
|
901
|
-
for (var
|
|
902
|
-
var set = listeners[
|
|
903
|
-
var pos = ArrayIndexOf.call(listeners[
|
|
917
|
+
for (var _i6 = 0; _i6 < len; _i6 += 1) {
|
|
918
|
+
var set = listeners[_i6];
|
|
919
|
+
var pos = ArrayIndexOf.call(listeners[_i6], this);
|
|
904
920
|
ArraySplice.call(set, pos, 1);
|
|
905
921
|
}
|
|
906
922
|
|
|
@@ -1038,6 +1054,7 @@
|
|
|
1038
1054
|
* SPDX-License-Identifier: MIT
|
|
1039
1055
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1040
1056
|
*/
|
|
1057
|
+
// These properties get added to LWCElement.prototype publicProps automatically
|
|
1041
1058
|
|
|
1042
1059
|
var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1043
1060
|
|
|
@@ -2120,7 +2137,7 @@
|
|
|
2120
2137
|
|
|
2121
2138
|
|
|
2122
2139
|
var _loop = function _loop() {
|
|
2123
|
-
var childGetter = _childGetters[
|
|
2140
|
+
var childGetter = _childGetters[_i7];
|
|
2124
2141
|
queryAndChildGetterDescriptors[childGetter] = {
|
|
2125
2142
|
get: function get() {
|
|
2126
2143
|
var vm = getAssociatedVM(this);
|
|
@@ -2133,7 +2150,7 @@
|
|
|
2133
2150
|
};
|
|
2134
2151
|
};
|
|
2135
2152
|
|
|
2136
|
-
for (var
|
|
2153
|
+
for (var _i7 = 0, _childGetters = childGetters; _i7 < _childGetters.length; _i7++) {
|
|
2137
2154
|
_loop();
|
|
2138
2155
|
}
|
|
2139
2156
|
|
|
@@ -2157,7 +2174,7 @@
|
|
|
2157
2174
|
|
|
2158
2175
|
|
|
2159
2176
|
var _loop2 = function _loop2() {
|
|
2160
|
-
var queryMethod = _queryMethods[
|
|
2177
|
+
var queryMethod = _queryMethods[_i8];
|
|
2161
2178
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2162
2179
|
value: function value(arg) {
|
|
2163
2180
|
var vm = getAssociatedVM(this);
|
|
@@ -2171,7 +2188,7 @@
|
|
|
2171
2188
|
};
|
|
2172
2189
|
};
|
|
2173
2190
|
|
|
2174
|
-
for (var
|
|
2191
|
+
for (var _i8 = 0, _queryMethods = queryMethods; _i8 < _queryMethods.length; _i8++) {
|
|
2175
2192
|
_loop2();
|
|
2176
2193
|
}
|
|
2177
2194
|
|
|
@@ -2532,8 +2549,8 @@
|
|
|
2532
2549
|
}
|
|
2533
2550
|
|
|
2534
2551
|
if (!isUndefined$1(fields)) {
|
|
2535
|
-
for (var
|
|
2536
|
-
var _fieldName2 = fields[
|
|
2552
|
+
for (var _i9 = 0, n = fields.length; _i9 < n; _i9++) {
|
|
2553
|
+
var _fieldName2 = fields[_i9];
|
|
2537
2554
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
2538
2555
|
// tracked property. This is only here for backward compatibility purposes.
|
|
2539
2556
|
|
|
@@ -2596,6 +2613,7 @@
|
|
|
2596
2613
|
|
|
2597
2614
|
|
|
2598
2615
|
function registerTemplate(tpl) {
|
|
2616
|
+
|
|
2599
2617
|
signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
|
|
2600
2618
|
// assignment of templates easily, without too much transformation
|
|
2601
2619
|
|
|
@@ -2618,6 +2636,7 @@
|
|
|
2618
2636
|
* SPDX-License-Identifier: MIT
|
|
2619
2637
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2620
2638
|
*/
|
|
2639
|
+
// A bridge descriptor is a descriptor whose job is just to get the component instance
|
|
2621
2640
|
// from the element instance, and get the value or set a new value on the component.
|
|
2622
2641
|
// This means that across different elements, similar names can get the exact same
|
|
2623
2642
|
// descriptor, so we can cache them:
|
|
@@ -2750,8 +2769,8 @@
|
|
|
2750
2769
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
2751
2770
|
var descriptors = create(null); // expose getters and setters for each public props on the new Element Bridge
|
|
2752
2771
|
|
|
2753
|
-
for (var
|
|
2754
|
-
var _propName2 = props[
|
|
2772
|
+
for (var _i10 = 0, _len3 = props.length; _i10 < _len3; _i10 += 1) {
|
|
2773
|
+
var _propName2 = props[_i10];
|
|
2755
2774
|
attributeToPropMap[htmlPropertyToAttribute(_propName2)] = _propName2;
|
|
2756
2775
|
descriptors[_propName2] = {
|
|
2757
2776
|
get: createGetter(_propName2),
|
|
@@ -2762,8 +2781,8 @@
|
|
|
2762
2781
|
} // expose public methods as props on the new Element Bridge
|
|
2763
2782
|
|
|
2764
2783
|
|
|
2765
|
-
for (var
|
|
2766
|
-
var methodName = methods[
|
|
2784
|
+
for (var _i11 = 0, _len4 = methods.length; _i11 < _len4; _i11 += 1) {
|
|
2785
|
+
var methodName = methods[_i11];
|
|
2767
2786
|
descriptors[methodName] = {
|
|
2768
2787
|
value: createMethodCaller(methodName),
|
|
2769
2788
|
writable: true,
|
|
@@ -3311,6 +3330,7 @@
|
|
|
3311
3330
|
* SPDX-License-Identifier: MIT
|
|
3312
3331
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3313
3332
|
*/
|
|
3333
|
+
// The style property is a string when defined via an expression in the template.
|
|
3314
3334
|
|
|
3315
3335
|
|
|
3316
3336
|
function patchStyleAttribute(oldVnode, vnode) {
|
|
@@ -3355,6 +3375,7 @@
|
|
|
3355
3375
|
* SPDX-License-Identifier: MIT
|
|
3356
3376
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3357
3377
|
*/
|
|
3378
|
+
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3358
3379
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3359
3380
|
// different classnames properties individually instead of via a string.
|
|
3360
3381
|
|
|
@@ -3379,6 +3400,7 @@
|
|
|
3379
3400
|
* SPDX-License-Identifier: MIT
|
|
3380
3401
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3381
3402
|
*/
|
|
3403
|
+
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3382
3404
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3383
3405
|
// different style properties individually instead of via a string.
|
|
3384
3406
|
|
|
@@ -3391,8 +3413,8 @@
|
|
|
3391
3413
|
return;
|
|
3392
3414
|
}
|
|
3393
3415
|
|
|
3394
|
-
for (var
|
|
3395
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
3416
|
+
for (var _i12 = 0; _i12 < styleDecls.length; _i12++) {
|
|
3417
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i12], 3),
|
|
3396
3418
|
prop = _styleDecls$_i[0],
|
|
3397
3419
|
value = _styleDecls$_i[1],
|
|
3398
3420
|
important = _styleDecls$_i[2];
|
|
@@ -3408,138 +3430,245 @@
|
|
|
3408
3430
|
*/
|
|
3409
3431
|
|
|
3410
3432
|
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
vnode.elm = elm;
|
|
3417
|
-
},
|
|
3418
|
-
update: updateNodeHook,
|
|
3419
|
-
insert: insertNode,
|
|
3420
|
-
move: insertNode,
|
|
3421
|
-
remove: removeNode
|
|
3422
|
-
};
|
|
3423
|
-
var CommentHook = {
|
|
3424
|
-
create: function create(vnode) {
|
|
3425
|
-
var owner = vnode.owner,
|
|
3426
|
-
text = vnode.text;
|
|
3427
|
-
var elm = createComment$1(text);
|
|
3428
|
-
linkNodeToShadow(elm, owner);
|
|
3429
|
-
vnode.elm = elm;
|
|
3430
|
-
},
|
|
3431
|
-
update: updateNodeHook,
|
|
3432
|
-
insert: insertNode,
|
|
3433
|
-
move: insertNode,
|
|
3434
|
-
remove: removeNode
|
|
3435
|
-
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3436
|
-
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3437
|
-
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
3438
|
-
// which breaks some invariants. For that reason, we have the following for any
|
|
3439
|
-
// Custom Element that is inserted via a template.
|
|
3440
|
-
|
|
3441
|
-
var ElementHook = {
|
|
3442
|
-
create: function create(vnode) {
|
|
3443
|
-
var sel = vnode.sel,
|
|
3444
|
-
owner = vnode.owner,
|
|
3445
|
-
svg = vnode.data.svg;
|
|
3446
|
-
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3447
|
-
var elm = createElement$2(sel, namespace);
|
|
3448
|
-
linkNodeToShadow(elm, owner);
|
|
3449
|
-
fallbackElmHook(elm, vnode);
|
|
3450
|
-
vnode.elm = elm;
|
|
3451
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3452
|
-
},
|
|
3453
|
-
update: function update(oldVnode, vnode) {
|
|
3454
|
-
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
3455
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
3456
|
-
},
|
|
3457
|
-
insert: function insert(vnode, parentNode, referenceNode) {
|
|
3458
|
-
insertNode(vnode, parentNode, referenceNode);
|
|
3459
|
-
createChildrenHook(vnode);
|
|
3460
|
-
},
|
|
3461
|
-
move: insertNode,
|
|
3462
|
-
remove: function remove(vnode, parentNode) {
|
|
3463
|
-
removeNode(vnode, parentNode);
|
|
3464
|
-
removeChildren(vnode);
|
|
3433
|
+
function patchChildren(c1, c2, parent) {
|
|
3434
|
+
if (hasDynamicChildren(c2)) {
|
|
3435
|
+
updateDynamicChildren(c1, c2, parent);
|
|
3436
|
+
} else {
|
|
3437
|
+
updateStaticChildren(c1, c2, parent);
|
|
3465
3438
|
}
|
|
3466
|
-
}
|
|
3467
|
-
var CustomElementHook = {
|
|
3468
|
-
create: function create(vnode) {
|
|
3469
|
-
var sel = vnode.sel,
|
|
3470
|
-
owner = vnode.owner;
|
|
3471
|
-
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3472
|
-
/**
|
|
3473
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3474
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
3475
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
3476
|
-
* an upgradable custom element.
|
|
3477
|
-
*/
|
|
3439
|
+
}
|
|
3478
3440
|
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
});
|
|
3484
|
-
linkNodeToShadow(elm, owner);
|
|
3485
|
-
vnode.elm = elm;
|
|
3441
|
+
function patch(n1, n2) {
|
|
3442
|
+
if (n1 === n2) {
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3486
3445
|
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3446
|
+
switch (n2.type) {
|
|
3447
|
+
case 0
|
|
3448
|
+
/* Text */
|
|
3449
|
+
:
|
|
3450
|
+
patchText(n1, n2);
|
|
3451
|
+
break;
|
|
3492
3452
|
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3453
|
+
case 1
|
|
3454
|
+
/* Comment */
|
|
3455
|
+
:
|
|
3456
|
+
patchComment(n1, n2);
|
|
3457
|
+
break;
|
|
3498
3458
|
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
// will happen, but in native, it does allocate the light dom
|
|
3459
|
+
case 2
|
|
3460
|
+
/* Element */
|
|
3461
|
+
:
|
|
3462
|
+
patchElement(n1, n2);
|
|
3463
|
+
break;
|
|
3505
3464
|
|
|
3465
|
+
case 3
|
|
3466
|
+
/* CustomElement */
|
|
3467
|
+
:
|
|
3468
|
+
patchCustomElement(n1, n2);
|
|
3469
|
+
break;
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3506
3472
|
|
|
3507
|
-
|
|
3473
|
+
function mount(node, parent, anchor) {
|
|
3474
|
+
switch (node.type) {
|
|
3475
|
+
case 0
|
|
3476
|
+
/* Text */
|
|
3477
|
+
:
|
|
3478
|
+
mountText(node, parent, anchor);
|
|
3479
|
+
break;
|
|
3508
3480
|
|
|
3509
|
-
|
|
3510
|
-
|
|
3481
|
+
case 1
|
|
3482
|
+
/* Comment */
|
|
3483
|
+
:
|
|
3484
|
+
mountComment(node, parent, anchor);
|
|
3485
|
+
break;
|
|
3511
3486
|
|
|
3487
|
+
case 2
|
|
3488
|
+
/* Element */
|
|
3489
|
+
:
|
|
3490
|
+
mountElement(node, parent, anchor);
|
|
3491
|
+
break;
|
|
3512
3492
|
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3493
|
+
case 3
|
|
3494
|
+
/* CustomElement */
|
|
3495
|
+
:
|
|
3496
|
+
mountCustomElement(node, parent, anchor);
|
|
3497
|
+
break;
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3519
3500
|
|
|
3520
|
-
|
|
3501
|
+
function patchText(n1, n2) {
|
|
3502
|
+
n2.elm = n1.elm;
|
|
3521
3503
|
|
|
3522
|
-
|
|
3523
|
-
|
|
3504
|
+
if (n2.text !== n1.text) {
|
|
3505
|
+
updateTextContent(n2);
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
function mountText(node, parent, anchor) {
|
|
3510
|
+
var owner = node.owner;
|
|
3511
|
+
var textNode = node.elm = createText$1(node.text);
|
|
3512
|
+
linkNodeToShadow(textNode, owner);
|
|
3513
|
+
insertNode(textNode, parent, anchor);
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
function patchComment(n1, n2) {
|
|
3517
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3518
|
+
// it is the case today.
|
|
3519
|
+
|
|
3520
|
+
if (n2.text !== n1.text) {
|
|
3521
|
+
updateTextContent(n2);
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
|
|
3525
|
+
function mountComment(node, parent, anchor) {
|
|
3526
|
+
var owner = node.owner;
|
|
3527
|
+
var commentNode = node.elm = createComment$1(node.text);
|
|
3528
|
+
linkNodeToShadow(commentNode, owner);
|
|
3529
|
+
insertNode(commentNode, parent, anchor);
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
function mountElement(vnode, parent, anchor) {
|
|
3533
|
+
var sel = vnode.sel,
|
|
3534
|
+
owner = vnode.owner,
|
|
3535
|
+
svg = vnode.data.svg;
|
|
3536
|
+
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3537
|
+
var elm = createElement$2(sel, namespace);
|
|
3538
|
+
linkNodeToShadow(elm, owner);
|
|
3539
|
+
fallbackElmHook(elm, vnode);
|
|
3540
|
+
vnode.elm = elm;
|
|
3541
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
3542
|
+
insertNode(elm, parent, anchor);
|
|
3543
|
+
mountVNodes(vnode.children, elm, null);
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
function patchElement(n1, n2) {
|
|
3547
|
+
var elm = n2.elm = n1.elm;
|
|
3548
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
3549
|
+
patchChildren(n1.children, n2.children, elm);
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
function mountCustomElement(vnode, parent, anchor) {
|
|
3553
|
+
var sel = vnode.sel,
|
|
3554
|
+
owner = vnode.owner;
|
|
3555
|
+
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3556
|
+
/**
|
|
3557
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3558
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
3559
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
3560
|
+
* an upgradable custom element.
|
|
3561
|
+
*/
|
|
3562
|
+
|
|
3563
|
+
var vm;
|
|
3564
|
+
var elm = new UpgradableConstructor(function (elm) {
|
|
3565
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
3566
|
+
vm = createViewModelHook(elm, vnode);
|
|
3567
|
+
});
|
|
3568
|
+
linkNodeToShadow(elm, owner);
|
|
3569
|
+
vnode.elm = elm;
|
|
3570
|
+
vnode.vm = vm;
|
|
3571
|
+
|
|
3572
|
+
if (vm) {
|
|
3573
|
+
allocateChildren(vnode, vm);
|
|
3574
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
3575
|
+
throw new TypeError("Incorrect Component Constructor");
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
3579
|
+
insertNode(elm, parent, anchor);
|
|
3580
|
+
|
|
3581
|
+
if (vm) {
|
|
3582
|
+
|
|
3583
|
+
runConnectedCallback(vm);
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
mountVNodes(vnode.children, elm, null);
|
|
3587
|
+
|
|
3588
|
+
if (vm) {
|
|
3589
|
+
appendVM(vm);
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
function patchCustomElement(n1, n2) {
|
|
3594
|
+
var elm = n2.elm = n1.elm;
|
|
3595
|
+
var vm = n2.vm = n1.vm;
|
|
3596
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
3597
|
+
|
|
3598
|
+
if (!isUndefined$1(vm)) {
|
|
3599
|
+
// in fallback mode, the allocation will always set children to
|
|
3600
|
+
// empty and delegate the real allocation to the slot elements
|
|
3601
|
+
allocateChildren(n2, vm);
|
|
3602
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
3603
|
+
// will happen, but in native, it does allocate the light dom
|
|
3604
|
+
|
|
3605
|
+
|
|
3606
|
+
patchChildren(n1.children, n2.children, elm);
|
|
3607
|
+
|
|
3608
|
+
if (!isUndefined$1(vm)) {
|
|
3609
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3610
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3611
|
+
rerenderVM(vm);
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
function mountVNodes(vnodes, parent, anchor) {
|
|
3616
|
+
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3617
|
+
var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
|
|
3524
3618
|
|
|
3525
|
-
|
|
3619
|
+
for (; start < end; ++start) {
|
|
3620
|
+
var vnode = vnodes[start];
|
|
3526
3621
|
|
|
3527
|
-
if (
|
|
3528
|
-
|
|
3622
|
+
if (isVNode(vnode)) {
|
|
3623
|
+
mount(vnode, parent, anchor);
|
|
3529
3624
|
}
|
|
3530
|
-
}
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
function unmount(vnode, parent) {
|
|
3629
|
+
var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3630
|
+
var type = vnode.type,
|
|
3631
|
+
elm = vnode.elm; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3632
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
3633
|
+
|
|
3634
|
+
if (doRemove) {
|
|
3635
|
+
removeNode(elm, parent);
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
switch (type) {
|
|
3639
|
+
case 2
|
|
3640
|
+
/* Element */
|
|
3641
|
+
:
|
|
3642
|
+
unmountVNodes(vnode.children, elm);
|
|
3643
|
+
break;
|
|
3644
|
+
|
|
3645
|
+
case 3
|
|
3646
|
+
/* CustomElement */
|
|
3647
|
+
:
|
|
3648
|
+
{
|
|
3649
|
+
var vm = vnode.vm; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
3650
|
+
// children.
|
|
3651
|
+
|
|
3652
|
+
if (!isUndefined$1(vm)) {
|
|
3653
|
+
removeVM(vm);
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
function unmountVNodes(vnodes, parent) {
|
|
3660
|
+
var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3661
|
+
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3662
|
+
var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
|
|
3663
|
+
|
|
3664
|
+
for (; start < end; ++start) {
|
|
3665
|
+
var ch = vnodes[start];
|
|
3666
|
+
|
|
3667
|
+
if (isVNode(ch)) {
|
|
3668
|
+
unmount(ch, parent, doRemove);
|
|
3540
3669
|
}
|
|
3541
3670
|
}
|
|
3542
|
-
}
|
|
3671
|
+
}
|
|
3543
3672
|
|
|
3544
3673
|
function isVNode(vnode) {
|
|
3545
3674
|
return vnode != null;
|
|
@@ -3580,24 +3709,21 @@
|
|
|
3580
3709
|
}
|
|
3581
3710
|
}
|
|
3582
3711
|
|
|
3583
|
-
function
|
|
3712
|
+
function updateTextContent(vnode) {
|
|
3584
3713
|
var elm = vnode.elm,
|
|
3585
3714
|
text = vnode.text;
|
|
3586
3715
|
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
setText$1(elm, text);
|
|
3590
|
-
}
|
|
3716
|
+
setText$1(elm, text);
|
|
3591
3717
|
}
|
|
3592
3718
|
|
|
3593
|
-
function insertNode(
|
|
3719
|
+
function insertNode(node, parent, anchor) {
|
|
3594
3720
|
|
|
3595
|
-
insert$1(
|
|
3721
|
+
insert$1(node, parent, anchor);
|
|
3596
3722
|
}
|
|
3597
3723
|
|
|
3598
|
-
function removeNode(
|
|
3724
|
+
function removeNode(node, parent) {
|
|
3599
3725
|
|
|
3600
|
-
remove$1(
|
|
3726
|
+
remove$1(node, parent);
|
|
3601
3727
|
}
|
|
3602
3728
|
|
|
3603
3729
|
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
@@ -3630,19 +3756,13 @@
|
|
|
3630
3756
|
) {
|
|
3631
3757
|
// this element will now accept any manual content inserted into it
|
|
3632
3758
|
observeElementChildNodes(elm);
|
|
3633
|
-
}
|
|
3634
|
-
// into each element from the template, so they can be styled accordingly.
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
setElementShadowToken(elm, stylesheetToken);
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3759
|
+
}
|
|
3640
3760
|
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3761
|
+
if (!isUndefined$1(stylesheetToken)) {
|
|
3762
|
+
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
3763
|
+
// into each element from the template, so they can be styled accordingly.
|
|
3764
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
3765
|
+
}
|
|
3646
3766
|
}
|
|
3647
3767
|
}
|
|
3648
3768
|
|
|
@@ -3697,7 +3817,9 @@
|
|
|
3697
3817
|
var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
3698
3818
|
// into each element from the template, so they can be styled accordingly.
|
|
3699
3819
|
|
|
3700
|
-
|
|
3820
|
+
if (!isUndefined$1(stylesheetToken)) {
|
|
3821
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
3822
|
+
}
|
|
3701
3823
|
}
|
|
3702
3824
|
|
|
3703
3825
|
vm = createVM(elm, ctor, {
|
|
@@ -3709,44 +3831,14 @@
|
|
|
3709
3831
|
return vm;
|
|
3710
3832
|
}
|
|
3711
3833
|
|
|
3712
|
-
function createChildrenHook(vnode) {
|
|
3713
|
-
var elm = vnode.elm,
|
|
3714
|
-
children = vnode.children;
|
|
3715
|
-
|
|
3716
|
-
for (var j = 0; j < children.length; ++j) {
|
|
3717
|
-
var ch = children[j];
|
|
3718
|
-
|
|
3719
|
-
if (ch != null) {
|
|
3720
|
-
ch.hook.create(ch);
|
|
3721
|
-
ch.hook.insert(ch, elm, null);
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
function removeChildren(vnode) {
|
|
3727
|
-
// this method only needs to search on child vnodes from template
|
|
3728
|
-
// to trigger the remove hook just in case some of those children
|
|
3729
|
-
// are custom elements.
|
|
3730
|
-
var children = vnode.children,
|
|
3731
|
-
elm = vnode.elm;
|
|
3732
|
-
|
|
3733
|
-
for (var j = 0, _len5 = children.length; j < _len5; ++j) {
|
|
3734
|
-
var ch = children[j];
|
|
3735
|
-
|
|
3736
|
-
if (!isNull(ch)) {
|
|
3737
|
-
ch.hook.remove(ch, elm);
|
|
3738
|
-
}
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
|
-
|
|
3742
3834
|
function allocateInSlot(vm, children) {
|
|
3743
3835
|
var _a;
|
|
3744
3836
|
|
|
3745
3837
|
var oldSlots = vm.cmpSlots;
|
|
3746
3838
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
3747
3839
|
|
|
3748
|
-
for (var
|
|
3749
|
-
var vnode = children[
|
|
3840
|
+
for (var _i13 = 0, _len5 = children.length; _i13 < _len5; _i13 += 1) {
|
|
3841
|
+
var vnode = children[_i13];
|
|
3750
3842
|
|
|
3751
3843
|
if (isNull(vnode)) {
|
|
3752
3844
|
continue;
|
|
@@ -3780,8 +3872,8 @@
|
|
|
3780
3872
|
return;
|
|
3781
3873
|
}
|
|
3782
3874
|
|
|
3783
|
-
for (var
|
|
3784
|
-
var key = oldKeys[
|
|
3875
|
+
for (var _i14 = 0, _len6 = oldKeys.length; _i14 < _len6; _i14 += 1) {
|
|
3876
|
+
var key = oldKeys[_i14];
|
|
3785
3877
|
|
|
3786
3878
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
3787
3879
|
markComponentAsDirty(vm);
|
|
@@ -3831,28 +3923,7 @@
|
|
|
3831
3923
|
return map;
|
|
3832
3924
|
}
|
|
3833
3925
|
|
|
3834
|
-
function
|
|
3835
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
3836
|
-
var ch = vnodes[startIdx];
|
|
3837
|
-
|
|
3838
|
-
if (isVNode(ch)) {
|
|
3839
|
-
ch.hook.create(ch);
|
|
3840
|
-
ch.hook.insert(ch, parentElm, before);
|
|
3841
|
-
}
|
|
3842
|
-
}
|
|
3843
|
-
}
|
|
3844
|
-
|
|
3845
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
3846
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
3847
|
-
var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
3848
|
-
|
|
3849
|
-
if (isVNode(ch)) {
|
|
3850
|
-
ch.hook.remove(ch, parentElm);
|
|
3851
|
-
}
|
|
3852
|
-
}
|
|
3853
|
-
}
|
|
3854
|
-
|
|
3855
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
3926
|
+
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3856
3927
|
var oldStartIdx = 0;
|
|
3857
3928
|
var newStartIdx = 0;
|
|
3858
3929
|
var oldEndIdx = oldCh.length - 1;
|
|
@@ -3866,6 +3937,7 @@
|
|
|
3866
3937
|
var idxInOld;
|
|
3867
3938
|
var elmToMove;
|
|
3868
3939
|
var before;
|
|
3940
|
+
var clonedOldCh = false;
|
|
3869
3941
|
|
|
3870
3942
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
3871
3943
|
if (!isVNode(oldStartVnode)) {
|
|
@@ -3877,23 +3949,23 @@
|
|
|
3877
3949
|
} else if (!isVNode(newEndVnode)) {
|
|
3878
3950
|
newEndVnode = newCh[--newEndIdx];
|
|
3879
3951
|
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3880
|
-
|
|
3952
|
+
patch(oldStartVnode, newStartVnode);
|
|
3881
3953
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3882
3954
|
newStartVnode = newCh[++newStartIdx];
|
|
3883
3955
|
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3884
|
-
|
|
3956
|
+
patch(oldEndVnode, newEndVnode);
|
|
3885
3957
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3886
3958
|
newEndVnode = newCh[--newEndIdx];
|
|
3887
3959
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3888
3960
|
// Vnode moved right
|
|
3889
|
-
|
|
3890
|
-
|
|
3961
|
+
patch(oldStartVnode, newEndVnode);
|
|
3962
|
+
insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
|
|
3891
3963
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3892
3964
|
newEndVnode = newCh[--newEndIdx];
|
|
3893
3965
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3894
3966
|
// Vnode moved left
|
|
3895
|
-
|
|
3896
|
-
newStartVnode.
|
|
3967
|
+
patch(oldEndVnode, newStartVnode);
|
|
3968
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3897
3969
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3898
3970
|
newStartVnode = newCh[++newStartIdx];
|
|
3899
3971
|
} else {
|
|
@@ -3905,8 +3977,7 @@
|
|
|
3905
3977
|
|
|
3906
3978
|
if (isUndefined$1(idxInOld)) {
|
|
3907
3979
|
// New element
|
|
3908
|
-
newStartVnode.
|
|
3909
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
3980
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3910
3981
|
newStartVnode = newCh[++newStartIdx];
|
|
3911
3982
|
} else {
|
|
3912
3983
|
elmToMove = oldCh[idxInOld];
|
|
@@ -3914,12 +3985,22 @@
|
|
|
3914
3985
|
if (isVNode(elmToMove)) {
|
|
3915
3986
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
3916
3987
|
// New element
|
|
3917
|
-
newStartVnode.
|
|
3918
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
3988
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3919
3989
|
} else {
|
|
3920
|
-
|
|
3990
|
+
patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
|
|
3991
|
+
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3992
|
+
// so we only care about the `oldCh` object inside this function.
|
|
3993
|
+
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
3994
|
+
// and only clone once.
|
|
3995
|
+
|
|
3996
|
+
if (!clonedOldCh) {
|
|
3997
|
+
clonedOldCh = true;
|
|
3998
|
+
oldCh = _toConsumableArray(oldCh);
|
|
3999
|
+
} // We've already cloned at least once, so it's no longer read-only
|
|
4000
|
+
|
|
4001
|
+
|
|
3921
4002
|
oldCh[idxInOld] = undefined;
|
|
3922
|
-
|
|
4003
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
3923
4004
|
}
|
|
3924
4005
|
}
|
|
3925
4006
|
|
|
@@ -3932,73 +4013,63 @@
|
|
|
3932
4013
|
if (oldStartIdx > oldEndIdx) {
|
|
3933
4014
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
3934
4015
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
3935
|
-
var
|
|
4016
|
+
var _i15 = newEndIdx;
|
|
3936
4017
|
var n;
|
|
3937
4018
|
|
|
3938
4019
|
do {
|
|
3939
|
-
n = newCh[++
|
|
3940
|
-
} while (!isVNode(n) &&
|
|
4020
|
+
n = newCh[++_i15];
|
|
4021
|
+
} while (!isVNode(n) && _i15 < newChEnd);
|
|
3941
4022
|
|
|
3942
4023
|
before = isVNode(n) ? n.elm : null;
|
|
3943
|
-
|
|
4024
|
+
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
3944
4025
|
} else {
|
|
3945
|
-
|
|
4026
|
+
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
3946
4027
|
}
|
|
3947
4028
|
}
|
|
3948
4029
|
}
|
|
3949
4030
|
|
|
3950
|
-
function updateStaticChildren(
|
|
3951
|
-
var
|
|
3952
|
-
var
|
|
4031
|
+
function updateStaticChildren(c1, c2, parent) {
|
|
4032
|
+
var c1Length = c1.length;
|
|
4033
|
+
var c2Length = c2.length;
|
|
3953
4034
|
|
|
3954
|
-
if (
|
|
4035
|
+
if (c1Length === 0) {
|
|
3955
4036
|
// the old list is empty, we can directly insert anything new
|
|
3956
|
-
|
|
4037
|
+
mountVNodes(c2, parent, null);
|
|
3957
4038
|
return;
|
|
3958
4039
|
}
|
|
3959
4040
|
|
|
3960
|
-
if (
|
|
4041
|
+
if (c2Length === 0) {
|
|
3961
4042
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
3962
4043
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
3963
|
-
|
|
4044
|
+
unmountVNodes(c1, parent, true);
|
|
3964
4045
|
return;
|
|
3965
4046
|
} // if the old list is not empty, the new list MUST have the same
|
|
3966
4047
|
// amount of nodes, that's why we call this static children
|
|
3967
4048
|
|
|
3968
4049
|
|
|
3969
|
-
var
|
|
4050
|
+
var anchor = null;
|
|
3970
4051
|
|
|
3971
|
-
for (var
|
|
3972
|
-
var
|
|
3973
|
-
var
|
|
4052
|
+
for (var _i16 = c2Length - 1; _i16 >= 0; _i16 -= 1) {
|
|
4053
|
+
var n1 = c1[_i16];
|
|
4054
|
+
var n2 = c2[_i16];
|
|
3974
4055
|
|
|
3975
|
-
if (
|
|
3976
|
-
if (isVNode(
|
|
3977
|
-
if (isVNode(
|
|
3978
|
-
// both vnodes
|
|
3979
|
-
|
|
3980
|
-
|
|
4056
|
+
if (n2 !== n1) {
|
|
4057
|
+
if (isVNode(n1)) {
|
|
4058
|
+
if (isVNode(n2)) {
|
|
4059
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
4060
|
+
patch(n1, n2);
|
|
4061
|
+
anchor = n2.elm;
|
|
3981
4062
|
} else {
|
|
3982
4063
|
// removing the old vnode since the new one is null
|
|
3983
|
-
|
|
4064
|
+
unmount(n1, parent, true);
|
|
3984
4065
|
}
|
|
3985
|
-
} else if (isVNode(
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
3990
|
-
referenceElm = vnode.elm;
|
|
4066
|
+
} else if (isVNode(n2)) {
|
|
4067
|
+
mount(n2, parent, anchor);
|
|
4068
|
+
anchor = n2.elm;
|
|
3991
4069
|
}
|
|
3992
4070
|
}
|
|
3993
4071
|
}
|
|
3994
4072
|
}
|
|
3995
|
-
|
|
3996
|
-
function patchVnode(oldVnode, vnode) {
|
|
3997
|
-
if (oldVnode !== vnode) {
|
|
3998
|
-
vnode.elm = oldVnode.elm;
|
|
3999
|
-
vnode.hook.update(oldVnode, vnode);
|
|
4000
|
-
}
|
|
4001
|
-
}
|
|
4002
4073
|
/*
|
|
4003
4074
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4004
4075
|
* All rights reserved.
|
|
@@ -4014,7 +4085,8 @@
|
|
|
4014
4085
|
} // [h]tml node
|
|
4015
4086
|
|
|
4016
4087
|
|
|
4017
|
-
function h(sel, data
|
|
4088
|
+
function h(sel, data) {
|
|
4089
|
+
var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EmptyArray;
|
|
4018
4090
|
var vmBeingRendered = getVMBeingRendered();
|
|
4019
4091
|
|
|
4020
4092
|
var elm;
|
|
@@ -4028,7 +4100,6 @@
|
|
|
4028
4100
|
children: children,
|
|
4029
4101
|
elm: elm,
|
|
4030
4102
|
key: key,
|
|
4031
|
-
hook: ElementHook,
|
|
4032
4103
|
owner: vmBeingRendered
|
|
4033
4104
|
};
|
|
4034
4105
|
} // [t]ab[i]ndex function
|
|
@@ -4077,7 +4148,7 @@
|
|
|
4077
4148
|
var vmBeingRendered = getVMBeingRendered();
|
|
4078
4149
|
|
|
4079
4150
|
var key = data.key;
|
|
4080
|
-
var elm;
|
|
4151
|
+
var elm, aChildren, vm;
|
|
4081
4152
|
var vnode = {
|
|
4082
4153
|
type: 3
|
|
4083
4154
|
/* CustomElement */
|
|
@@ -4087,11 +4158,11 @@
|
|
|
4087
4158
|
children: children,
|
|
4088
4159
|
elm: elm,
|
|
4089
4160
|
key: key,
|
|
4090
|
-
hook: CustomElementHook,
|
|
4091
4161
|
ctor: Ctor,
|
|
4092
4162
|
owner: vmBeingRendered,
|
|
4093
|
-
mode: 'open'
|
|
4094
|
-
|
|
4163
|
+
mode: 'open',
|
|
4164
|
+
aChildren: aChildren,
|
|
4165
|
+
vm: vm
|
|
4095
4166
|
};
|
|
4096
4167
|
addVNodeToChildLWC(vnode);
|
|
4097
4168
|
return vnode;
|
|
@@ -4172,7 +4243,6 @@
|
|
|
4172
4243
|
text: text,
|
|
4173
4244
|
elm: elm,
|
|
4174
4245
|
key: key,
|
|
4175
|
-
hook: TextHook,
|
|
4176
4246
|
owner: getVMBeingRendered()
|
|
4177
4247
|
};
|
|
4178
4248
|
} // [co]mment node
|
|
@@ -4188,7 +4258,6 @@
|
|
|
4188
4258
|
text: text,
|
|
4189
4259
|
elm: elm,
|
|
4190
4260
|
key: key,
|
|
4191
|
-
hook: CommentHook,
|
|
4192
4261
|
owner: getVMBeingRendered()
|
|
4193
4262
|
};
|
|
4194
4263
|
} // [d]ynamic text
|
|
@@ -4288,7 +4357,8 @@
|
|
|
4288
4357
|
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
4289
4358
|
*/
|
|
4290
4359
|
|
|
4291
|
-
function dc(sel, Ctor, data
|
|
4360
|
+
function dc(sel, Ctor, data) {
|
|
4361
|
+
var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
|
|
4292
4362
|
|
|
4293
4363
|
|
|
4294
4364
|
if (Ctor == null) {
|
|
@@ -4307,10 +4377,14 @@
|
|
|
4307
4377
|
} // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
|
|
4308
4378
|
// to identify different constructors as vnodes with different keys to avoid reusing the
|
|
4309
4379
|
// element used for previous constructors.
|
|
4380
|
+
// Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
|
|
4381
|
+
// hoisting optimization.
|
|
4310
4382
|
|
|
4311
4383
|
|
|
4312
|
-
|
|
4313
|
-
|
|
4384
|
+
var newData = Object.assign(Object.assign({}, data), {
|
|
4385
|
+
key: "dc:".concat(idx, ":").concat(data.key)
|
|
4386
|
+
});
|
|
4387
|
+
return c(sel, Ctor, newData, children);
|
|
4314
4388
|
}
|
|
4315
4389
|
/**
|
|
4316
4390
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
@@ -4419,12 +4493,14 @@
|
|
|
4419
4493
|
oldHasTokenInClass = context.hasTokenInClass,
|
|
4420
4494
|
oldHasTokenInAttribute = context.hasTokenInAttribute;
|
|
4421
4495
|
|
|
4422
|
-
if (
|
|
4423
|
-
|
|
4424
|
-
|
|
4496
|
+
if (!isUndefined$1(oldToken)) {
|
|
4497
|
+
if (oldHasTokenInClass) {
|
|
4498
|
+
getClassList$1(elm).remove(makeHostToken(oldToken));
|
|
4499
|
+
}
|
|
4425
4500
|
|
|
4426
|
-
|
|
4427
|
-
|
|
4501
|
+
if (oldHasTokenInAttribute) {
|
|
4502
|
+
removeAttribute$1(elm, makeHostToken(oldToken));
|
|
4503
|
+
}
|
|
4428
4504
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
4429
4505
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
4430
4506
|
|
|
@@ -4456,8 +4532,8 @@
|
|
|
4456
4532
|
var content = [];
|
|
4457
4533
|
var root;
|
|
4458
4534
|
|
|
4459
|
-
for (var
|
|
4460
|
-
var stylesheet = stylesheets[
|
|
4535
|
+
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
4536
|
+
var stylesheet = stylesheets[_i17];
|
|
4461
4537
|
|
|
4462
4538
|
if (isArray$1(stylesheet)) {
|
|
4463
4539
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -4561,8 +4637,8 @@
|
|
|
4561
4637
|
&& shadowMode === 1
|
|
4562
4638
|
/* Synthetic */
|
|
4563
4639
|
) {
|
|
4564
|
-
for (var
|
|
4565
|
-
insertGlobalStylesheet$1(stylesheets[
|
|
4640
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
4641
|
+
insertGlobalStylesheet$1(stylesheets[_i18]);
|
|
4566
4642
|
}
|
|
4567
4643
|
} else if (ssr$1 || isHydrating$1()) {
|
|
4568
4644
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -4576,12 +4652,12 @@
|
|
|
4576
4652
|
var root = getNearestNativeShadowComponent(vm);
|
|
4577
4653
|
var isGlobal = isNull(root);
|
|
4578
4654
|
|
|
4579
|
-
for (var
|
|
4655
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
4580
4656
|
if (isGlobal) {
|
|
4581
|
-
insertGlobalStylesheet$1(stylesheets[
|
|
4657
|
+
insertGlobalStylesheet$1(stylesheets[_i19]);
|
|
4582
4658
|
} else {
|
|
4583
4659
|
// local level
|
|
4584
|
-
insertStylesheet$1(stylesheets[
|
|
4660
|
+
insertStylesheet$1(stylesheets[_i19], root.shadowRoot);
|
|
4585
4661
|
}
|
|
4586
4662
|
}
|
|
4587
4663
|
}
|
|
@@ -4766,8 +4842,8 @@
|
|
|
4766
4842
|
var stylesheets = template.stylesheets;
|
|
4767
4843
|
|
|
4768
4844
|
if (!isUndefined$1(stylesheets)) {
|
|
4769
|
-
for (var
|
|
4770
|
-
if (isTrue(stylesheets[
|
|
4845
|
+
for (var _i20 = 0; _i20 < stylesheets.length; _i20++) {
|
|
4846
|
+
if (isTrue(stylesheets[_i20][KEY__SCOPED_CSS])) {
|
|
4771
4847
|
return true;
|
|
4772
4848
|
}
|
|
4773
4849
|
}
|
|
@@ -4878,6 +4954,7 @@
|
|
|
4878
4954
|
|
|
4879
4955
|
function registerComponent(Ctor, _ref2) {
|
|
4880
4956
|
var tmpl = _ref2.tmpl;
|
|
4957
|
+
|
|
4881
4958
|
signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
4882
4959
|
// without too much transformation
|
|
4883
4960
|
|
|
@@ -4950,8 +5027,8 @@
|
|
|
4950
5027
|
|
|
4951
5028
|
function register(service) {
|
|
4952
5029
|
|
|
4953
|
-
for (var
|
|
4954
|
-
var hookName = hooks[
|
|
5030
|
+
for (var _i21 = 0; _i21 < hooks.length; ++_i21) {
|
|
5031
|
+
var hookName = hooks[_i21];
|
|
4955
5032
|
|
|
4956
5033
|
if (hookName in service) {
|
|
4957
5034
|
var l = Services[hookName];
|
|
@@ -4971,8 +5048,8 @@
|
|
|
4971
5048
|
def = vm.def,
|
|
4972
5049
|
context = vm.context;
|
|
4973
5050
|
|
|
4974
|
-
for (var
|
|
4975
|
-
cbs[
|
|
5051
|
+
for (var _i22 = 0, _len7 = cbs.length; _i22 < _len7; ++_i22) {
|
|
5052
|
+
cbs[_i22].call(undefined, component, {}, def, context);
|
|
4976
5053
|
}
|
|
4977
5054
|
}
|
|
4978
5055
|
/*
|
|
@@ -4983,7 +5060,7 @@
|
|
|
4983
5060
|
*/
|
|
4984
5061
|
|
|
4985
5062
|
|
|
4986
|
-
function hydrate
|
|
5063
|
+
function hydrate(vnode, node) {
|
|
4987
5064
|
switch (vnode.type) {
|
|
4988
5065
|
case 0
|
|
4989
5066
|
/* Text */
|
|
@@ -5015,7 +5092,7 @@
|
|
|
5015
5092
|
var _a;
|
|
5016
5093
|
|
|
5017
5094
|
|
|
5018
|
-
node
|
|
5095
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5019
5096
|
vnode.elm = node;
|
|
5020
5097
|
}
|
|
5021
5098
|
|
|
@@ -5023,7 +5100,7 @@
|
|
|
5023
5100
|
var _a;
|
|
5024
5101
|
|
|
5025
5102
|
|
|
5026
|
-
node
|
|
5103
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5027
5104
|
vnode.elm = node;
|
|
5028
5105
|
}
|
|
5029
5106
|
|
|
@@ -5042,10 +5119,13 @@
|
|
|
5042
5119
|
var props = vnode.data.props;
|
|
5043
5120
|
|
|
5044
5121
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5045
|
-
if (elm
|
|
5046
|
-
|
|
5122
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5123
|
+
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5124
|
+
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
5125
|
+
props: cloneAndOmitKey(props, 'innerHTML')
|
|
5126
|
+
});
|
|
5047
5127
|
} else {
|
|
5048
|
-
logWarn("Mismatch hydrating element <".concat(elm
|
|
5128
|
+
logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
5049
5129
|
}
|
|
5050
5130
|
}
|
|
5051
5131
|
}
|
|
@@ -5053,14 +5133,13 @@
|
|
|
5053
5133
|
patchElementPropsAndAttrs(vnode);
|
|
5054
5134
|
|
|
5055
5135
|
if (!isDomManual) {
|
|
5056
|
-
hydrateChildren(vnode.elm
|
|
5136
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5057
5137
|
}
|
|
5058
5138
|
}
|
|
5059
5139
|
|
|
5060
5140
|
function hydrateCustomElement(vnode, node) {
|
|
5061
5141
|
|
|
5062
5142
|
var elm = node;
|
|
5063
|
-
vnode.elm = elm;
|
|
5064
5143
|
var sel = vnode.sel,
|
|
5065
5144
|
mode = vnode.mode,
|
|
5066
5145
|
ctor = vnode.ctor,
|
|
@@ -5070,6 +5149,8 @@
|
|
|
5070
5149
|
owner: owner,
|
|
5071
5150
|
tagName: sel
|
|
5072
5151
|
});
|
|
5152
|
+
vnode.elm = elm;
|
|
5153
|
+
vnode.vm = vm;
|
|
5073
5154
|
allocateChildren(vnode, vm);
|
|
5074
5155
|
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
5075
5156
|
|
|
@@ -5080,7 +5161,7 @@
|
|
|
5080
5161
|
) {
|
|
5081
5162
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5082
5163
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5083
|
-
hydrateChildren(vnode.elm
|
|
5164
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
|
|
5084
5165
|
}
|
|
5085
5166
|
|
|
5086
5167
|
hydrateVM(vm);
|
|
@@ -5090,12 +5171,12 @@
|
|
|
5090
5171
|
|
|
5091
5172
|
var childNodeIndex = 0;
|
|
5092
5173
|
|
|
5093
|
-
for (var
|
|
5094
|
-
var childVnode = children[
|
|
5174
|
+
for (var _i23 = 0; _i23 < children.length; _i23++) {
|
|
5175
|
+
var childVnode = children[_i23];
|
|
5095
5176
|
|
|
5096
5177
|
if (!isNull(childVnode)) {
|
|
5097
5178
|
var childNode = elmChildren[childNodeIndex];
|
|
5098
|
-
hydrate
|
|
5179
|
+
hydrate(childVnode, childNode);
|
|
5099
5180
|
childNodeIndex++;
|
|
5100
5181
|
}
|
|
5101
5182
|
}
|
|
@@ -5171,7 +5252,19 @@
|
|
|
5171
5252
|
}
|
|
5172
5253
|
|
|
5173
5254
|
function hydrateVM(vm) {
|
|
5174
|
-
|
|
5255
|
+
if (isTrue(vm.isDirty)) {
|
|
5256
|
+
// manually diffing/patching here.
|
|
5257
|
+
// This routine is:
|
|
5258
|
+
// patchShadowRoot(vm, children);
|
|
5259
|
+
// -> addVnodes.
|
|
5260
|
+
var children = renderComponent(vm);
|
|
5261
|
+
vm.children = children;
|
|
5262
|
+
var vmChildren = vm.renderMode === 0
|
|
5263
|
+
/* Light */
|
|
5264
|
+
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5265
|
+
hydrateChildren(vmChildren, children);
|
|
5266
|
+
runRenderedCallback(vm);
|
|
5267
|
+
}
|
|
5175
5268
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5176
5269
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5177
5270
|
|
|
@@ -5291,30 +5384,38 @@
|
|
|
5291
5384
|
/* Native */
|
|
5292
5385
|
;
|
|
5293
5386
|
} else if (isNativeShadowDefined$1) {
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
) {
|
|
5297
|
-
|
|
5298
|
-
/*
|
|
5299
|
-
;
|
|
5300
|
-
} else {
|
|
5301
|
-
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
5302
|
-
|
|
5303
|
-
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5304
|
-
/* Native */
|
|
5387
|
+
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5388
|
+
// the if-condition.
|
|
5389
|
+
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5390
|
+
if (def.shadowSupportMode === "any"
|
|
5391
|
+
/* Any */
|
|
5305
5392
|
) {
|
|
5306
|
-
// Transitive support for native Shadow DOM. A component in native mode
|
|
5307
|
-
// transitively opts all of its descendants into native.
|
|
5308
5393
|
shadowMode = 0
|
|
5309
5394
|
/* Native */
|
|
5310
5395
|
;
|
|
5311
5396
|
} else {
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
shadowMode
|
|
5315
|
-
/*
|
|
5316
|
-
|
|
5397
|
+
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
5398
|
+
|
|
5399
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5400
|
+
/* Native */
|
|
5401
|
+
) {
|
|
5402
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5403
|
+
// transitively opts all of its descendants into native.
|
|
5404
|
+
shadowMode = 0
|
|
5405
|
+
/* Native */
|
|
5406
|
+
;
|
|
5407
|
+
} else {
|
|
5408
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5409
|
+
// to be native.
|
|
5410
|
+
shadowMode = 1
|
|
5411
|
+
/* Synthetic */
|
|
5412
|
+
;
|
|
5413
|
+
}
|
|
5317
5414
|
}
|
|
5415
|
+
} else {
|
|
5416
|
+
shadowMode = 1
|
|
5417
|
+
/* Synthetic */
|
|
5418
|
+
;
|
|
5318
5419
|
}
|
|
5319
5420
|
} else {
|
|
5320
5421
|
// Synthetic if there is no native Shadow DOM support.
|
|
@@ -5355,22 +5456,6 @@
|
|
|
5355
5456
|
}
|
|
5356
5457
|
}
|
|
5357
5458
|
|
|
5358
|
-
function hydrate(vm) {
|
|
5359
|
-
if (isTrue(vm.isDirty)) {
|
|
5360
|
-
// manually diffing/patching here.
|
|
5361
|
-
// This routine is:
|
|
5362
|
-
// patchShadowRoot(vm, children);
|
|
5363
|
-
// -> addVnodes.
|
|
5364
|
-
var children = renderComponent(vm);
|
|
5365
|
-
vm.children = children;
|
|
5366
|
-
var vmChildren = vm.renderMode === 0
|
|
5367
|
-
/* Light */
|
|
5368
|
-
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5369
|
-
hydrateChildren(vmChildren, children);
|
|
5370
|
-
runRenderedCallback(vm);
|
|
5371
|
-
}
|
|
5372
|
-
}
|
|
5373
|
-
|
|
5374
5459
|
function patchShadowRoot(vm, newCh) {
|
|
5375
5460
|
var renderRoot = vm.renderRoot,
|
|
5376
5461
|
oldCh = vm.children; // caching the new children collection
|
|
@@ -5388,7 +5473,7 @@
|
|
|
5388
5473
|
, vm);
|
|
5389
5474
|
}, function () {
|
|
5390
5475
|
// job
|
|
5391
|
-
patchChildren(
|
|
5476
|
+
patchChildren(oldCh, newCh, renderRoot);
|
|
5392
5477
|
}, function () {
|
|
5393
5478
|
// post
|
|
5394
5479
|
logOperationEnd(2
|
|
@@ -5445,19 +5530,19 @@
|
|
|
5445
5530
|
});
|
|
5446
5531
|
rehydrateQueue = []; // reset to a new queue
|
|
5447
5532
|
|
|
5448
|
-
for (var
|
|
5449
|
-
var vm = vms[
|
|
5533
|
+
for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
|
|
5534
|
+
var vm = vms[_i26];
|
|
5450
5535
|
|
|
5451
5536
|
try {
|
|
5452
5537
|
rehydrate(vm);
|
|
5453
5538
|
} catch (error) {
|
|
5454
|
-
if (
|
|
5539
|
+
if (_i26 + 1 < _len8) {
|
|
5455
5540
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
5456
5541
|
if (rehydrateQueue.length === 0) {
|
|
5457
5542
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
5458
5543
|
}
|
|
5459
5544
|
|
|
5460
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
5545
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i26 + 1));
|
|
5461
5546
|
} // we need to end the measure before throwing.
|
|
5462
5547
|
|
|
5463
5548
|
|
|
@@ -5556,8 +5641,8 @@
|
|
|
5556
5641
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
5557
5642
|
// inserted in reserved order.
|
|
5558
5643
|
|
|
5559
|
-
for (var
|
|
5560
|
-
var elm = vCustomElementCollection[
|
|
5644
|
+
for (var _i27 = vCustomElementCollection.length - 1; _i27 >= 0; _i27 -= 1) {
|
|
5645
|
+
var elm = vCustomElementCollection[_i27].elm; // There are two cases where the element could be undefined:
|
|
5561
5646
|
// * when there is an error during the construction phase, and an error
|
|
5562
5647
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
5563
5648
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -5591,8 +5676,8 @@
|
|
|
5591
5676
|
|
|
5592
5677
|
|
|
5593
5678
|
function recursivelyDisconnectChildren(vnodes) {
|
|
5594
|
-
for (var
|
|
5595
|
-
var vnode = vnodes[
|
|
5679
|
+
for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
|
|
5680
|
+
var vnode = vnodes[_i28];
|
|
5596
5681
|
|
|
5597
5682
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
5598
5683
|
switch (vnode.type) {
|
|
@@ -5623,8 +5708,8 @@
|
|
|
5623
5708
|
var children = vm.children,
|
|
5624
5709
|
renderRoot = vm.renderRoot;
|
|
5625
5710
|
|
|
5626
|
-
for (var
|
|
5627
|
-
var child = children[
|
|
5711
|
+
for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
|
|
5712
|
+
var child = children[_i29];
|
|
5628
5713
|
|
|
5629
5714
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
5630
5715
|
remove$1(child.elm, renderRoot);
|
|
@@ -5974,8 +6059,8 @@
|
|
|
5974
6059
|
function connectWireAdapters(vm) {
|
|
5975
6060
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
5976
6061
|
|
|
5977
|
-
for (var
|
|
5978
|
-
wiredConnecting[
|
|
6062
|
+
for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
|
|
6063
|
+
wiredConnecting[_i30]();
|
|
5979
6064
|
}
|
|
5980
6065
|
}
|
|
5981
6066
|
|
|
@@ -5983,8 +6068,8 @@
|
|
|
5983
6068
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
5984
6069
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
5985
6070
|
// job
|
|
5986
|
-
for (var
|
|
5987
|
-
wiredDisconnecting[
|
|
6071
|
+
for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
|
|
6072
|
+
wiredDisconnecting[_i31]();
|
|
5988
6073
|
}
|
|
5989
6074
|
}, noop);
|
|
5990
6075
|
}
|
|
@@ -5994,6 +6079,7 @@
|
|
|
5994
6079
|
* SPDX-License-Identifier: MIT
|
|
5995
6080
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5996
6081
|
*/
|
|
6082
|
+
// this is lwc internal implementation
|
|
5997
6083
|
|
|
5998
6084
|
|
|
5999
6085
|
function createContextProvider(adapter) {
|
|
@@ -6068,7 +6154,7 @@
|
|
|
6068
6154
|
hooksAreSet = true;
|
|
6069
6155
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6070
6156
|
}
|
|
6071
|
-
/* version: 2.
|
|
6157
|
+
/* version: 2.11.0 */
|
|
6072
6158
|
|
|
6073
6159
|
/*
|
|
6074
6160
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6085,9 +6171,10 @@
|
|
|
6085
6171
|
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
6086
6172
|
|
|
6087
6173
|
var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
6174
|
+
var supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
6088
6175
|
var styleElements = create(null);
|
|
6089
6176
|
var styleSheets = create(null);
|
|
6090
|
-
var
|
|
6177
|
+
var shadowRootsToStyleSheets = new WeakMap();
|
|
6091
6178
|
var getCustomElement;
|
|
6092
6179
|
var defineCustomElement;
|
|
6093
6180
|
var HTMLElementConstructor;
|
|
@@ -6139,18 +6226,26 @@
|
|
|
6139
6226
|
styleSheets[content] = styleSheet;
|
|
6140
6227
|
}
|
|
6141
6228
|
|
|
6142
|
-
|
|
6143
|
-
|
|
6229
|
+
var adoptedStyleSheets = target.adoptedStyleSheets;
|
|
6230
|
+
|
|
6231
|
+
if (!adoptedStyleSheets.includes(styleSheet)) {
|
|
6232
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
6233
|
+
// This is only supported in later versions of Chromium:
|
|
6234
|
+
// https://chromestatus.com/feature/5638996492288000
|
|
6235
|
+
adoptedStyleSheets.push(styleSheet);
|
|
6236
|
+
} else {
|
|
6237
|
+
target.adoptedStyleSheets = [].concat(_toConsumableArray(adoptedStyleSheets), [styleSheet]);
|
|
6238
|
+
}
|
|
6144
6239
|
}
|
|
6145
6240
|
}
|
|
6146
6241
|
|
|
6147
6242
|
function insertStyleElement(content, target) {
|
|
6148
6243
|
// Avoid inserting duplicate `<style>`s
|
|
6149
|
-
var sheets =
|
|
6244
|
+
var sheets = shadowRootsToStyleSheets.get(target);
|
|
6150
6245
|
|
|
6151
6246
|
if (isUndefined$1(sheets)) {
|
|
6152
6247
|
sheets = create(null);
|
|
6153
|
-
|
|
6248
|
+
shadowRootsToStyleSheets.set(target, sheets);
|
|
6154
6249
|
}
|
|
6155
6250
|
|
|
6156
6251
|
if (sheets[content]) {
|
|
@@ -6422,6 +6517,173 @@
|
|
|
6422
6517
|
setSetText(setText);
|
|
6423
6518
|
setSsr(ssr);
|
|
6424
6519
|
setAddEventListener(addEventListener);
|
|
6520
|
+
/*
|
|
6521
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6522
|
+
* All rights reserved.
|
|
6523
|
+
* SPDX-License-Identifier: MIT
|
|
6524
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6525
|
+
*/
|
|
6526
|
+
|
|
6527
|
+
function resetShadowRootAndLightDom(element, Ctor) {
|
|
6528
|
+
if (element.shadowRoot) {
|
|
6529
|
+
var shadowRoot = element.shadowRoot;
|
|
6530
|
+
|
|
6531
|
+
while (!isNull(shadowRoot.firstChild)) {
|
|
6532
|
+
shadowRoot.removeChild(shadowRoot.firstChild);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
|
|
6536
|
+
if (Ctor.renderMode === 'light') {
|
|
6537
|
+
while (!isNull(element.firstChild)) {
|
|
6538
|
+
element.removeChild(element.firstChild);
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
|
|
6543
|
+
function createVMWithProps(element, Ctor, props) {
|
|
6544
|
+
createVM(element, Ctor, {
|
|
6545
|
+
mode: 'open',
|
|
6546
|
+
owner: null,
|
|
6547
|
+
tagName: element.tagName.toLowerCase()
|
|
6548
|
+
});
|
|
6549
|
+
|
|
6550
|
+
for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
|
|
6551
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
|
|
6552
|
+
key = _Object$entries2$_i[0],
|
|
6553
|
+
value = _Object$entries2$_i[1];
|
|
6554
|
+
|
|
6555
|
+
element[key] = value;
|
|
6556
|
+
}
|
|
6557
|
+
}
|
|
6558
|
+
|
|
6559
|
+
function hydrateComponent(element, Ctor) {
|
|
6560
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6561
|
+
|
|
6562
|
+
if (!(element instanceof Element)) {
|
|
6563
|
+
throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
|
|
6564
|
+
}
|
|
6565
|
+
|
|
6566
|
+
if (!isFunction$1(Ctor)) {
|
|
6567
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
6568
|
+
}
|
|
6569
|
+
|
|
6570
|
+
if (!isObject(props) || isNull(props)) {
|
|
6571
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6574
|
+
if (getAssociatedVMIfPresent(element)) {
|
|
6575
|
+
/* eslint-disable-next-line no-console */
|
|
6576
|
+
console.warn("\"hydrateComponent\" expects an element that is not hydrated.", element);
|
|
6577
|
+
return;
|
|
6578
|
+
}
|
|
6579
|
+
|
|
6580
|
+
try {
|
|
6581
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6582
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6583
|
+
setIsHydrating(true);
|
|
6584
|
+
createVMWithProps(element, Ctor, props);
|
|
6585
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6586
|
+
|
|
6587
|
+
setIsHydrating(false);
|
|
6588
|
+
} catch (e) {
|
|
6589
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
6590
|
+
// with the client generated DOM.
|
|
6591
|
+
|
|
6592
|
+
/* eslint-disable-next-line no-console */
|
|
6593
|
+
console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
|
|
6594
|
+
|
|
6595
|
+
resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
6596
|
+
|
|
6597
|
+
createVMWithProps(element, Ctor, props);
|
|
6598
|
+
setIsHydrating(false);
|
|
6599
|
+
connectRootElement(element);
|
|
6600
|
+
} finally {
|
|
6601
|
+
// in case there's an error during recovery
|
|
6602
|
+
setIsHydrating(false);
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6605
|
+
/*
|
|
6606
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6607
|
+
* All rights reserved.
|
|
6608
|
+
* SPDX-License-Identifier: MIT
|
|
6609
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6610
|
+
*/
|
|
6611
|
+
|
|
6612
|
+
/**
|
|
6613
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6614
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6615
|
+
*
|
|
6616
|
+
* @deprecated since version 1.3.11
|
|
6617
|
+
*
|
|
6618
|
+
* @example
|
|
6619
|
+
* ```
|
|
6620
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6621
|
+
* import Foo from 'ns/foo';
|
|
6622
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6623
|
+
* customElements.define('x-foo', WC);
|
|
6624
|
+
* const elm = document.createElement('x-foo');
|
|
6625
|
+
* ```
|
|
6626
|
+
*/
|
|
6627
|
+
|
|
6628
|
+
|
|
6629
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6630
|
+
|
|
6631
|
+
return Ctor.CustomElementConstructor;
|
|
6632
|
+
} // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
|
|
6633
|
+
// This WeakSet usage is valid because this functionality is not meant to run in IE11.
|
|
6634
|
+
|
|
6635
|
+
|
|
6636
|
+
var hydratedCustomElements = new WeakSet();
|
|
6637
|
+
|
|
6638
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6639
|
+
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
6640
|
+
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
6641
|
+
_inherits(_class, _HtmlPrototype);
|
|
6642
|
+
|
|
6643
|
+
var _super8 = _createSuper(_class);
|
|
6644
|
+
|
|
6645
|
+
function _class() {
|
|
6646
|
+
var _this6;
|
|
6647
|
+
|
|
6648
|
+
_classCallCheck(this, _class);
|
|
6649
|
+
|
|
6650
|
+
_this6 = _super8.call(this);
|
|
6651
|
+
|
|
6652
|
+
if (_this6.isConnected) {
|
|
6653
|
+
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
6654
|
+
hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
|
|
6655
|
+
hydratedCustomElements.add(_assertThisInitialized(_this6));
|
|
6656
|
+
} else {
|
|
6657
|
+
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
6658
|
+
mode: 'open',
|
|
6659
|
+
owner: null,
|
|
6660
|
+
tagName: _this6.tagName
|
|
6661
|
+
});
|
|
6662
|
+
}
|
|
6663
|
+
|
|
6664
|
+
return _this6;
|
|
6665
|
+
}
|
|
6666
|
+
|
|
6667
|
+
_createClass(_class, [{
|
|
6668
|
+
key: "connectedCallback",
|
|
6669
|
+
value: function connectedCallback() {
|
|
6670
|
+
if (hydratedCustomElements.has(this)) {
|
|
6671
|
+
// This is an un-upgraded element that was hydrated in the constructor.
|
|
6672
|
+
hydratedCustomElements.delete(this);
|
|
6673
|
+
} else {
|
|
6674
|
+
connectRootElement(this);
|
|
6675
|
+
}
|
|
6676
|
+
}
|
|
6677
|
+
}, {
|
|
6678
|
+
key: "disconnectedCallback",
|
|
6679
|
+
value: function disconnectedCallback() {
|
|
6680
|
+
disconnectRootElement(this);
|
|
6681
|
+
}
|
|
6682
|
+
}]);
|
|
6683
|
+
|
|
6684
|
+
return _class;
|
|
6685
|
+
}(HtmlPrototype);
|
|
6686
|
+
}
|
|
6425
6687
|
/*
|
|
6426
6688
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6427
6689
|
* All rights reserved.
|
|
@@ -6431,6 +6693,7 @@
|
|
|
6431
6693
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6432
6694
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6433
6695
|
|
|
6696
|
+
|
|
6434
6697
|
var _Node$1 = Node;
|
|
6435
6698
|
var ConnectingSlot = new WeakMap();
|
|
6436
6699
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -6535,138 +6798,6 @@
|
|
|
6535
6798
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6536
6799
|
*/
|
|
6537
6800
|
|
|
6538
|
-
|
|
6539
|
-
function hydrateComponent(element, Ctor) {
|
|
6540
|
-
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6541
|
-
|
|
6542
|
-
if (!(element instanceof Element)) {
|
|
6543
|
-
throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
|
|
6544
|
-
}
|
|
6545
|
-
|
|
6546
|
-
if (!isFunction$1(Ctor)) {
|
|
6547
|
-
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
6548
|
-
}
|
|
6549
|
-
|
|
6550
|
-
if (!isObject(props) || isNull(props)) {
|
|
6551
|
-
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
6552
|
-
}
|
|
6553
|
-
|
|
6554
|
-
try {
|
|
6555
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6556
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
6557
|
-
setIsHydrating(true);
|
|
6558
|
-
createVM(element, Ctor, {
|
|
6559
|
-
mode: 'open',
|
|
6560
|
-
owner: null,
|
|
6561
|
-
tagName: element.tagName.toLowerCase()
|
|
6562
|
-
});
|
|
6563
|
-
|
|
6564
|
-
for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
|
|
6565
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
|
|
6566
|
-
key = _Object$entries2$_i[0],
|
|
6567
|
-
value = _Object$entries2$_i[1];
|
|
6568
|
-
|
|
6569
|
-
element[key] = value;
|
|
6570
|
-
}
|
|
6571
|
-
|
|
6572
|
-
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6573
|
-
|
|
6574
|
-
setIsHydrating(false);
|
|
6575
|
-
} catch (e) {
|
|
6576
|
-
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6577
|
-
// the client generated DOM.
|
|
6578
|
-
|
|
6579
|
-
/* eslint-disable-next-line no-console */
|
|
6580
|
-
console.error('Recovering from error while hydrating: ', e);
|
|
6581
|
-
setIsHydrating(false);
|
|
6582
|
-
var newElem = createElement(element.tagName, {
|
|
6583
|
-
is: Ctor,
|
|
6584
|
-
mode: 'open'
|
|
6585
|
-
});
|
|
6586
|
-
|
|
6587
|
-
for (var _i33 = 0, _Object$entries3 = Object.entries(props); _i33 < _Object$entries3.length; _i33++) {
|
|
6588
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i33], 2),
|
|
6589
|
-
_key3 = _Object$entries3$_i[0],
|
|
6590
|
-
_value2 = _Object$entries3$_i[1];
|
|
6591
|
-
|
|
6592
|
-
newElem[_key3] = _value2;
|
|
6593
|
-
}
|
|
6594
|
-
|
|
6595
|
-
element.parentNode.replaceChild(newElem, element);
|
|
6596
|
-
}
|
|
6597
|
-
}
|
|
6598
|
-
/*
|
|
6599
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6600
|
-
* All rights reserved.
|
|
6601
|
-
* SPDX-License-Identifier: MIT
|
|
6602
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6603
|
-
*/
|
|
6604
|
-
|
|
6605
|
-
/**
|
|
6606
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6607
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6608
|
-
*
|
|
6609
|
-
* @deprecated since version 1.3.11
|
|
6610
|
-
*
|
|
6611
|
-
* @example
|
|
6612
|
-
* ```
|
|
6613
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6614
|
-
* import Foo from 'ns/foo';
|
|
6615
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6616
|
-
* customElements.define('x-foo', WC);
|
|
6617
|
-
* const elm = document.createElement('x-foo');
|
|
6618
|
-
* ```
|
|
6619
|
-
*/
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6623
|
-
|
|
6624
|
-
return Ctor.CustomElementConstructor;
|
|
6625
|
-
}
|
|
6626
|
-
|
|
6627
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6628
|
-
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
6629
|
-
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
6630
|
-
_inherits(_class, _HtmlPrototype);
|
|
6631
|
-
|
|
6632
|
-
var _super8 = _createSuper(_class);
|
|
6633
|
-
|
|
6634
|
-
function _class() {
|
|
6635
|
-
var _this6;
|
|
6636
|
-
|
|
6637
|
-
_classCallCheck(this, _class);
|
|
6638
|
-
|
|
6639
|
-
_this6 = _super8.call(this);
|
|
6640
|
-
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
6641
|
-
mode: 'open',
|
|
6642
|
-
owner: null,
|
|
6643
|
-
tagName: _this6.tagName
|
|
6644
|
-
});
|
|
6645
|
-
return _this6;
|
|
6646
|
-
}
|
|
6647
|
-
|
|
6648
|
-
_createClass(_class, [{
|
|
6649
|
-
key: "connectedCallback",
|
|
6650
|
-
value: function connectedCallback() {
|
|
6651
|
-
connectRootElement(this);
|
|
6652
|
-
}
|
|
6653
|
-
}, {
|
|
6654
|
-
key: "disconnectedCallback",
|
|
6655
|
-
value: function disconnectedCallback() {
|
|
6656
|
-
disconnectRootElement(this);
|
|
6657
|
-
}
|
|
6658
|
-
}]);
|
|
6659
|
-
|
|
6660
|
-
return _class;
|
|
6661
|
-
}(HtmlPrototype);
|
|
6662
|
-
}
|
|
6663
|
-
/*
|
|
6664
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6665
|
-
* All rights reserved.
|
|
6666
|
-
* SPDX-License-Identifier: MIT
|
|
6667
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6668
|
-
*/
|
|
6669
|
-
|
|
6670
6801
|
/**
|
|
6671
6802
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6672
6803
|
* This API is subject to change or being removed.
|
|
@@ -6698,30 +6829,31 @@
|
|
|
6698
6829
|
|
|
6699
6830
|
var _Node = Node;
|
|
6700
6831
|
/**
|
|
6701
|
-
* EXPERIMENTAL:
|
|
6702
|
-
*
|
|
6832
|
+
* EXPERIMENTAL: The purpose of this function is to detect shadowed nodes. THIS API WILL BE REMOVED
|
|
6833
|
+
* ONCE LOCKER V1 IS NO LONGER SUPPORTED.
|
|
6703
6834
|
*/
|
|
6704
6835
|
|
|
6705
|
-
function
|
|
6836
|
+
function isNodeShadowed(node) {
|
|
6706
6837
|
if (isFalse(node instanceof _Node)) {
|
|
6707
6838
|
return false;
|
|
6708
|
-
} //
|
|
6709
|
-
// this
|
|
6839
|
+
} // It's debatable whether shadow root instances should be considered as shadowed, but we keep
|
|
6840
|
+
// this unchanged for legacy reasons (#1250).
|
|
6710
6841
|
|
|
6711
6842
|
|
|
6712
6843
|
if (node instanceof ShadowRoot) {
|
|
6713
6844
|
return false;
|
|
6714
6845
|
}
|
|
6715
6846
|
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
return
|
|
6721
|
-
}
|
|
6847
|
+
var rootNode = node.getRootNode(); // Handle the native case. We can return early here because an invariant of LWC is that
|
|
6848
|
+
// synthetic roots cannot be descendants of native roots.
|
|
6849
|
+
|
|
6850
|
+
if (rootNode instanceof ShadowRoot && isFalse(hasOwnProperty$1.call(getPrototypeOf$1(rootNode), 'synthetic'))) {
|
|
6851
|
+
return true;
|
|
6852
|
+
} // TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
|
|
6853
|
+
// inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
|
|
6854
|
+
|
|
6722
6855
|
|
|
6723
|
-
|
|
6724
|
-
return root instanceof ShadowRoot;
|
|
6856
|
+
return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
6725
6857
|
}
|
|
6726
6858
|
/*
|
|
6727
6859
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6765,7 +6897,7 @@
|
|
|
6765
6897
|
});
|
|
6766
6898
|
freeze(LightningElement);
|
|
6767
6899
|
seal(LightningElement.prototype);
|
|
6768
|
-
/* version: 2.
|
|
6900
|
+
/* version: 2.11.0 */
|
|
6769
6901
|
|
|
6770
6902
|
exports.LightningElement = LightningElement;
|
|
6771
6903
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6777,7 +6909,7 @@
|
|
|
6777
6909
|
exports.getComponentDef = getComponentDef;
|
|
6778
6910
|
exports.hydrateComponent = hydrateComponent;
|
|
6779
6911
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6780
|
-
exports.isNodeFromTemplate =
|
|
6912
|
+
exports.isNodeFromTemplate = isNodeShadowed;
|
|
6781
6913
|
exports.readonly = readonly;
|
|
6782
6914
|
exports.register = register;
|
|
6783
6915
|
exports.registerComponent = registerComponent;
|