lwc 2.9.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +4353 -5789
- package/dist/engine-dom/iife/es2017/engine-dom.js +4353 -5789
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +3299 -4566
- package/dist/engine-dom/iife/es5/engine-dom.js +674 -505
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +542 -448
- package/dist/engine-dom/umd/es2017/engine-dom.js +4353 -5789
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +3299 -4566
- package/dist/engine-dom/umd/es5/engine-dom.js +674 -505
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +542 -448
- package/dist/engine-server/commonjs/es2017/engine-server.js +4061 -5290
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +4061 -5290
- 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
|
@@ -7,14 +7,6 @@ var LWC = (function (exports) {
|
|
|
7
7
|
|
|
8
8
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
9
9
|
|
|
10
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
11
|
-
|
|
12
|
-
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."); }
|
|
13
|
-
|
|
14
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
-
|
|
16
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
17
|
-
|
|
18
10
|
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); }
|
|
19
11
|
|
|
20
12
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf2(object); if (object === null) break; } return object; }
|
|
@@ -41,6 +33,14 @@ var LWC = (function (exports) {
|
|
|
41
33
|
|
|
42
34
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
35
|
|
|
36
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
37
|
+
|
|
38
|
+
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."); }
|
|
39
|
+
|
|
40
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
41
|
+
|
|
42
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
43
|
+
|
|
44
44
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
45
45
|
|
|
46
46
|
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."); }
|
|
@@ -345,7 +345,7 @@ var LWC = (function (exports) {
|
|
|
345
345
|
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
346
346
|
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
347
347
|
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
348
|
-
/** version: 2.
|
|
348
|
+
/** version: 2.11.1 */
|
|
349
349
|
|
|
350
350
|
/*
|
|
351
351
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -410,7 +410,7 @@ var LWC = (function (exports) {
|
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
function patch(propName) {
|
|
413
|
+
function patch$1(propName) {
|
|
414
414
|
// Typescript is inferring the wrong function type for this particular
|
|
415
415
|
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
416
416
|
// @ts-ignore type-mismatch
|
|
@@ -432,7 +432,7 @@ var LWC = (function (exports) {
|
|
|
432
432
|
var propName = ElementPrototypeAriaPropertyNames[_i2];
|
|
433
433
|
|
|
434
434
|
if (detect(propName)) {
|
|
435
|
-
patch(propName);
|
|
435
|
+
patch$1(propName);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
/**
|
|
@@ -448,14 +448,15 @@ var LWC = (function (exports) {
|
|
|
448
448
|
|
|
449
449
|
|
|
450
450
|
var features = {
|
|
451
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
452
|
-
ENABLE_HMR: null,
|
|
453
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
454
451
|
ENABLE_ELEMENT_PATCH: null,
|
|
455
452
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
456
|
-
|
|
453
|
+
ENABLE_HMR: null,
|
|
457
454
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
455
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
456
|
+
ENABLE_MIXED_SHADOW_MODE: null,
|
|
457
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
458
458
|
ENABLE_NODE_PATCH: null,
|
|
459
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
459
460
|
ENABLE_WIRE_SYNC_EMIT: null
|
|
460
461
|
};
|
|
461
462
|
|
|
@@ -514,7 +515,7 @@ var LWC = (function (exports) {
|
|
|
514
515
|
|
|
515
516
|
function setFeatureFlagForTest(name, value) {
|
|
516
517
|
}
|
|
517
|
-
/** version: 2.
|
|
518
|
+
/** version: 2.11.1 */
|
|
518
519
|
|
|
519
520
|
/* proxy-compat-disable */
|
|
520
521
|
|
|
@@ -571,7 +572,7 @@ var LWC = (function (exports) {
|
|
|
571
572
|
}
|
|
572
573
|
|
|
573
574
|
return result;
|
|
574
|
-
}
|
|
575
|
+
}
|
|
575
576
|
// Primitives
|
|
576
577
|
//
|
|
577
578
|
|
|
@@ -1050,6 +1051,7 @@ var LWC = (function (exports) {
|
|
|
1050
1051
|
* SPDX-License-Identifier: MIT
|
|
1051
1052
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1052
1053
|
*/
|
|
1054
|
+
// These properties get added to LWCElement.prototype publicProps automatically
|
|
1053
1055
|
|
|
1054
1056
|
var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1055
1057
|
|
|
@@ -2608,6 +2610,7 @@ var LWC = (function (exports) {
|
|
|
2608
2610
|
|
|
2609
2611
|
|
|
2610
2612
|
function registerTemplate(tpl) {
|
|
2613
|
+
|
|
2611
2614
|
signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
|
|
2612
2615
|
// assignment of templates easily, without too much transformation
|
|
2613
2616
|
|
|
@@ -2630,6 +2633,7 @@ var LWC = (function (exports) {
|
|
|
2630
2633
|
* SPDX-License-Identifier: MIT
|
|
2631
2634
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2632
2635
|
*/
|
|
2636
|
+
// A bridge descriptor is a descriptor whose job is just to get the component instance
|
|
2633
2637
|
// from the element instance, and get the value or set a new value on the component.
|
|
2634
2638
|
// This means that across different elements, similar names can get the exact same
|
|
2635
2639
|
// descriptor, so we can cache them:
|
|
@@ -3323,6 +3327,7 @@ var LWC = (function (exports) {
|
|
|
3323
3327
|
* SPDX-License-Identifier: MIT
|
|
3324
3328
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3325
3329
|
*/
|
|
3330
|
+
// The style property is a string when defined via an expression in the template.
|
|
3326
3331
|
|
|
3327
3332
|
|
|
3328
3333
|
function patchStyleAttribute(oldVnode, vnode) {
|
|
@@ -3367,6 +3372,7 @@ var LWC = (function (exports) {
|
|
|
3367
3372
|
* SPDX-License-Identifier: MIT
|
|
3368
3373
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3369
3374
|
*/
|
|
3375
|
+
// The HTML class property becomes the vnode.data.classMap object when defined as a string in the template.
|
|
3370
3376
|
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3371
3377
|
// different classnames properties individually instead of via a string.
|
|
3372
3378
|
|
|
@@ -3391,6 +3397,7 @@ var LWC = (function (exports) {
|
|
|
3391
3397
|
* SPDX-License-Identifier: MIT
|
|
3392
3398
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3393
3399
|
*/
|
|
3400
|
+
// The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template.
|
|
3394
3401
|
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3395
3402
|
// different style properties individually instead of via a string.
|
|
3396
3403
|
|
|
@@ -3420,138 +3427,245 @@ var LWC = (function (exports) {
|
|
|
3420
3427
|
*/
|
|
3421
3428
|
|
|
3422
3429
|
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
vnode.elm = elm;
|
|
3429
|
-
},
|
|
3430
|
-
update: updateNodeHook,
|
|
3431
|
-
insert: insertNode,
|
|
3432
|
-
move: insertNode,
|
|
3433
|
-
remove: removeNode
|
|
3434
|
-
};
|
|
3435
|
-
var CommentHook = {
|
|
3436
|
-
create: function create(vnode) {
|
|
3437
|
-
var owner = vnode.owner,
|
|
3438
|
-
text = vnode.text;
|
|
3439
|
-
var elm = createComment$1(text);
|
|
3440
|
-
linkNodeToShadow(elm, owner);
|
|
3441
|
-
vnode.elm = elm;
|
|
3442
|
-
},
|
|
3443
|
-
update: updateNodeHook,
|
|
3444
|
-
insert: insertNode,
|
|
3445
|
-
move: insertNode,
|
|
3446
|
-
remove: removeNode
|
|
3447
|
-
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3448
|
-
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3449
|
-
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
3450
|
-
// which breaks some invariants. For that reason, we have the following for any
|
|
3451
|
-
// Custom Element that is inserted via a template.
|
|
3452
|
-
|
|
3453
|
-
var ElementHook = {
|
|
3454
|
-
create: function create(vnode) {
|
|
3455
|
-
var sel = vnode.sel,
|
|
3456
|
-
owner = vnode.owner,
|
|
3457
|
-
svg = vnode.data.svg;
|
|
3458
|
-
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3459
|
-
var elm = createElement$2(sel, namespace);
|
|
3460
|
-
linkNodeToShadow(elm, owner);
|
|
3461
|
-
fallbackElmHook(elm, vnode);
|
|
3462
|
-
vnode.elm = elm;
|
|
3463
|
-
patchElementPropsAndAttrs$1(null, vnode);
|
|
3464
|
-
},
|
|
3465
|
-
update: function update(oldVnode, vnode) {
|
|
3466
|
-
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
3467
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
3468
|
-
},
|
|
3469
|
-
insert: function insert(vnode, parentNode, referenceNode) {
|
|
3470
|
-
insertNode(vnode, parentNode, referenceNode);
|
|
3471
|
-
createChildrenHook(vnode);
|
|
3472
|
-
},
|
|
3473
|
-
move: insertNode,
|
|
3474
|
-
remove: function remove(vnode, parentNode) {
|
|
3475
|
-
removeNode(vnode, parentNode);
|
|
3476
|
-
removeChildren(vnode);
|
|
3430
|
+
function patchChildren(c1, c2, parent) {
|
|
3431
|
+
if (hasDynamicChildren(c2)) {
|
|
3432
|
+
updateDynamicChildren(c1, c2, parent);
|
|
3433
|
+
} else {
|
|
3434
|
+
updateStaticChildren(c1, c2, parent);
|
|
3477
3435
|
}
|
|
3478
|
-
}
|
|
3479
|
-
var CustomElementHook = {
|
|
3480
|
-
create: function create(vnode) {
|
|
3481
|
-
var sel = vnode.sel,
|
|
3482
|
-
owner = vnode.owner;
|
|
3483
|
-
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3484
|
-
/**
|
|
3485
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3486
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
3487
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
3488
|
-
* an upgradable custom element.
|
|
3489
|
-
*/
|
|
3436
|
+
}
|
|
3490
3437
|
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
});
|
|
3496
|
-
linkNodeToShadow(elm, owner);
|
|
3497
|
-
vnode.elm = elm;
|
|
3438
|
+
function patch(n1, n2) {
|
|
3439
|
+
if (n1 === n2) {
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3498
3442
|
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3443
|
+
switch (n2.type) {
|
|
3444
|
+
case 0
|
|
3445
|
+
/* Text */
|
|
3446
|
+
:
|
|
3447
|
+
patchText(n1, n2);
|
|
3448
|
+
break;
|
|
3504
3449
|
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3450
|
+
case 1
|
|
3451
|
+
/* Comment */
|
|
3452
|
+
:
|
|
3453
|
+
patchComment(n1, n2);
|
|
3454
|
+
break;
|
|
3510
3455
|
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
// will happen, but in native, it does allocate the light dom
|
|
3456
|
+
case 2
|
|
3457
|
+
/* Element */
|
|
3458
|
+
:
|
|
3459
|
+
patchElement(n1, n2);
|
|
3460
|
+
break;
|
|
3517
3461
|
|
|
3462
|
+
case 3
|
|
3463
|
+
/* CustomElement */
|
|
3464
|
+
:
|
|
3465
|
+
patchCustomElement(n1, n2);
|
|
3466
|
+
break;
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3518
3469
|
|
|
3519
|
-
|
|
3470
|
+
function mount(node, parent, anchor) {
|
|
3471
|
+
switch (node.type) {
|
|
3472
|
+
case 0
|
|
3473
|
+
/* Text */
|
|
3474
|
+
:
|
|
3475
|
+
mountText(node, parent, anchor);
|
|
3476
|
+
break;
|
|
3520
3477
|
|
|
3521
|
-
|
|
3522
|
-
|
|
3478
|
+
case 1
|
|
3479
|
+
/* Comment */
|
|
3480
|
+
:
|
|
3481
|
+
mountComment(node, parent, anchor);
|
|
3482
|
+
break;
|
|
3523
3483
|
|
|
3484
|
+
case 2
|
|
3485
|
+
/* Element */
|
|
3486
|
+
:
|
|
3487
|
+
mountElement(node, parent, anchor);
|
|
3488
|
+
break;
|
|
3524
3489
|
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3490
|
+
case 3
|
|
3491
|
+
/* CustomElement */
|
|
3492
|
+
:
|
|
3493
|
+
mountCustomElement(node, parent, anchor);
|
|
3494
|
+
break;
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3531
3497
|
|
|
3532
|
-
|
|
3498
|
+
function patchText(n1, n2) {
|
|
3499
|
+
n2.elm = n1.elm;
|
|
3533
3500
|
|
|
3534
|
-
|
|
3535
|
-
|
|
3501
|
+
if (n2.text !== n1.text) {
|
|
3502
|
+
updateTextContent(n2);
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3536
3505
|
|
|
3537
|
-
|
|
3506
|
+
function mountText(node, parent, anchor) {
|
|
3507
|
+
var owner = node.owner;
|
|
3508
|
+
var textNode = node.elm = createText$1(node.text);
|
|
3509
|
+
linkNodeToShadow(textNode, owner);
|
|
3510
|
+
insertNode(textNode, parent, anchor);
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
function patchComment(n1, n2) {
|
|
3514
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3515
|
+
// it is the case today.
|
|
3516
|
+
|
|
3517
|
+
if (n2.text !== n1.text) {
|
|
3518
|
+
updateTextContent(n2);
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
function mountComment(node, parent, anchor) {
|
|
3523
|
+
var owner = node.owner;
|
|
3524
|
+
var commentNode = node.elm = createComment$1(node.text);
|
|
3525
|
+
linkNodeToShadow(commentNode, owner);
|
|
3526
|
+
insertNode(commentNode, parent, anchor);
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
function mountElement(vnode, parent, anchor) {
|
|
3530
|
+
var sel = vnode.sel,
|
|
3531
|
+
owner = vnode.owner,
|
|
3532
|
+
svg = vnode.data.svg;
|
|
3533
|
+
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
3534
|
+
var elm = createElement$2(sel, namespace);
|
|
3535
|
+
linkNodeToShadow(elm, owner);
|
|
3536
|
+
fallbackElmHook(elm, vnode);
|
|
3537
|
+
vnode.elm = elm;
|
|
3538
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
3539
|
+
insertNode(elm, parent, anchor);
|
|
3540
|
+
mountVNodes(vnode.children, elm, null);
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
function patchElement(n1, n2) {
|
|
3544
|
+
var elm = n2.elm = n1.elm;
|
|
3545
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
3546
|
+
patchChildren(n1.children, n2.children, elm);
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3549
|
+
function mountCustomElement(vnode, parent, anchor) {
|
|
3550
|
+
var sel = vnode.sel,
|
|
3551
|
+
owner = vnode.owner;
|
|
3552
|
+
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
3553
|
+
/**
|
|
3554
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
3555
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
3556
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
3557
|
+
* an upgradable custom element.
|
|
3558
|
+
*/
|
|
3559
|
+
|
|
3560
|
+
var vm;
|
|
3561
|
+
var elm = new UpgradableConstructor(function (elm) {
|
|
3562
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
3563
|
+
vm = createViewModelHook(elm, vnode);
|
|
3564
|
+
});
|
|
3565
|
+
linkNodeToShadow(elm, owner);
|
|
3566
|
+
vnode.elm = elm;
|
|
3567
|
+
vnode.vm = vm;
|
|
3568
|
+
|
|
3569
|
+
if (vm) {
|
|
3570
|
+
allocateChildren(vnode, vm);
|
|
3571
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
3572
|
+
throw new TypeError("Incorrect Component Constructor");
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
3576
|
+
insertNode(elm, parent, anchor);
|
|
3577
|
+
|
|
3578
|
+
if (vm) {
|
|
3579
|
+
|
|
3580
|
+
runConnectedCallback(vm);
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3583
|
+
mountVNodes(vnode.children, elm, null);
|
|
3584
|
+
|
|
3585
|
+
if (vm) {
|
|
3586
|
+
appendVM(vm);
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3538
3589
|
|
|
3539
|
-
|
|
3540
|
-
|
|
3590
|
+
function patchCustomElement(n1, n2) {
|
|
3591
|
+
var elm = n2.elm = n1.elm;
|
|
3592
|
+
var vm = n2.vm = n1.vm;
|
|
3593
|
+
patchElementPropsAndAttrs$1(n1, n2);
|
|
3594
|
+
|
|
3595
|
+
if (!isUndefined$1(vm)) {
|
|
3596
|
+
// in fallback mode, the allocation will always set children to
|
|
3597
|
+
// empty and delegate the real allocation to the slot elements
|
|
3598
|
+
allocateChildren(n2, vm);
|
|
3599
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
3600
|
+
// will happen, but in native, it does allocate the light dom
|
|
3601
|
+
|
|
3602
|
+
|
|
3603
|
+
patchChildren(n1.children, n2.children, elm);
|
|
3604
|
+
|
|
3605
|
+
if (!isUndefined$1(vm)) {
|
|
3606
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3607
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3608
|
+
rerenderVM(vm);
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3612
|
+
function mountVNodes(vnodes, parent, anchor) {
|
|
3613
|
+
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3614
|
+
var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
|
|
3615
|
+
|
|
3616
|
+
for (; start < end; ++start) {
|
|
3617
|
+
var vnode = vnodes[start];
|
|
3618
|
+
|
|
3619
|
+
if (isVNode(vnode)) {
|
|
3620
|
+
mount(vnode, parent, anchor);
|
|
3541
3621
|
}
|
|
3542
|
-
}
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
function unmount(vnode, parent) {
|
|
3626
|
+
var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3627
|
+
var type = vnode.type,
|
|
3628
|
+
elm = vnode.elm; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3629
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
3630
|
+
|
|
3631
|
+
if (doRemove) {
|
|
3632
|
+
removeNode(elm, parent);
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
switch (type) {
|
|
3636
|
+
case 2
|
|
3637
|
+
/* Element */
|
|
3638
|
+
:
|
|
3639
|
+
unmountVNodes(vnode.children, elm);
|
|
3640
|
+
break;
|
|
3641
|
+
|
|
3642
|
+
case 3
|
|
3643
|
+
/* CustomElement */
|
|
3644
|
+
:
|
|
3645
|
+
{
|
|
3646
|
+
var vm = vnode.vm; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
3647
|
+
// children.
|
|
3648
|
+
|
|
3649
|
+
if (!isUndefined$1(vm)) {
|
|
3650
|
+
removeVM(vm);
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
function unmountVNodes(vnodes, parent) {
|
|
3657
|
+
var doRemove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3658
|
+
var start = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
3659
|
+
var end = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : vnodes.length;
|
|
3660
|
+
|
|
3661
|
+
for (; start < end; ++start) {
|
|
3662
|
+
var ch = vnodes[start];
|
|
3663
|
+
|
|
3664
|
+
if (isVNode(ch)) {
|
|
3665
|
+
unmount(ch, parent, doRemove);
|
|
3552
3666
|
}
|
|
3553
3667
|
}
|
|
3554
|
-
}
|
|
3668
|
+
}
|
|
3555
3669
|
|
|
3556
3670
|
function isVNode(vnode) {
|
|
3557
3671
|
return vnode != null;
|
|
@@ -3592,24 +3706,21 @@ var LWC = (function (exports) {
|
|
|
3592
3706
|
}
|
|
3593
3707
|
}
|
|
3594
3708
|
|
|
3595
|
-
function
|
|
3709
|
+
function updateTextContent(vnode) {
|
|
3596
3710
|
var elm = vnode.elm,
|
|
3597
3711
|
text = vnode.text;
|
|
3598
3712
|
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
setText$1(elm, text);
|
|
3602
|
-
}
|
|
3713
|
+
setText$1(elm, text);
|
|
3603
3714
|
}
|
|
3604
3715
|
|
|
3605
|
-
function insertNode(
|
|
3716
|
+
function insertNode(node, parent, anchor) {
|
|
3606
3717
|
|
|
3607
|
-
insert$1(
|
|
3718
|
+
insert$1(node, parent, anchor);
|
|
3608
3719
|
}
|
|
3609
3720
|
|
|
3610
|
-
function removeNode(
|
|
3721
|
+
function removeNode(node, parent) {
|
|
3611
3722
|
|
|
3612
|
-
remove$1(
|
|
3723
|
+
remove$1(node, parent);
|
|
3613
3724
|
}
|
|
3614
3725
|
|
|
3615
3726
|
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
@@ -3652,14 +3763,6 @@ var LWC = (function (exports) {
|
|
|
3652
3763
|
}
|
|
3653
3764
|
}
|
|
3654
3765
|
|
|
3655
|
-
function patchChildren(parent, oldCh, newCh) {
|
|
3656
|
-
if (hasDynamicChildren(newCh)) {
|
|
3657
|
-
updateDynamicChildren(parent, oldCh, newCh);
|
|
3658
|
-
} else {
|
|
3659
|
-
updateStaticChildren(parent, oldCh, newCh);
|
|
3660
|
-
}
|
|
3661
|
-
}
|
|
3662
|
-
|
|
3663
3766
|
function allocateChildren(vnode, vm) {
|
|
3664
3767
|
// A component with slots will re-render because:
|
|
3665
3768
|
// 1- There is a change of the internal state.
|
|
@@ -3725,43 +3828,13 @@ var LWC = (function (exports) {
|
|
|
3725
3828
|
return vm;
|
|
3726
3829
|
}
|
|
3727
3830
|
|
|
3728
|
-
function createChildrenHook(vnode) {
|
|
3729
|
-
var elm = vnode.elm,
|
|
3730
|
-
children = vnode.children;
|
|
3731
|
-
|
|
3732
|
-
for (var j = 0; j < children.length; ++j) {
|
|
3733
|
-
var ch = children[j];
|
|
3734
|
-
|
|
3735
|
-
if (ch != null) {
|
|
3736
|
-
ch.hook.create(ch);
|
|
3737
|
-
ch.hook.insert(ch, elm, null);
|
|
3738
|
-
}
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
|
-
|
|
3742
|
-
function removeChildren(vnode) {
|
|
3743
|
-
// this method only needs to search on child vnodes from template
|
|
3744
|
-
// to trigger the remove hook just in case some of those children
|
|
3745
|
-
// are custom elements.
|
|
3746
|
-
var children = vnode.children,
|
|
3747
|
-
elm = vnode.elm;
|
|
3748
|
-
|
|
3749
|
-
for (var j = 0, _len5 = children.length; j < _len5; ++j) {
|
|
3750
|
-
var ch = children[j];
|
|
3751
|
-
|
|
3752
|
-
if (!isNull(ch)) {
|
|
3753
|
-
ch.hook.remove(ch, elm);
|
|
3754
|
-
}
|
|
3755
|
-
}
|
|
3756
|
-
}
|
|
3757
|
-
|
|
3758
3831
|
function allocateInSlot(vm, children) {
|
|
3759
3832
|
var _a;
|
|
3760
3833
|
|
|
3761
3834
|
var oldSlots = vm.cmpSlots;
|
|
3762
3835
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
3763
3836
|
|
|
3764
|
-
for (var _i13 = 0,
|
|
3837
|
+
for (var _i13 = 0, _len5 = children.length; _i13 < _len5; _i13 += 1) {
|
|
3765
3838
|
var vnode = children[_i13];
|
|
3766
3839
|
|
|
3767
3840
|
if (isNull(vnode)) {
|
|
@@ -3796,7 +3869,7 @@ var LWC = (function (exports) {
|
|
|
3796
3869
|
return;
|
|
3797
3870
|
}
|
|
3798
3871
|
|
|
3799
|
-
for (var _i14 = 0,
|
|
3872
|
+
for (var _i14 = 0, _len6 = oldKeys.length; _i14 < _len6; _i14 += 1) {
|
|
3800
3873
|
var key = oldKeys[_i14];
|
|
3801
3874
|
|
|
3802
3875
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
@@ -3847,28 +3920,7 @@ var LWC = (function (exports) {
|
|
|
3847
3920
|
return map;
|
|
3848
3921
|
}
|
|
3849
3922
|
|
|
3850
|
-
function
|
|
3851
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
3852
|
-
var ch = vnodes[startIdx];
|
|
3853
|
-
|
|
3854
|
-
if (isVNode(ch)) {
|
|
3855
|
-
ch.hook.create(ch);
|
|
3856
|
-
ch.hook.insert(ch, parentElm, before);
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
}
|
|
3860
|
-
|
|
3861
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
3862
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
3863
|
-
var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
3864
|
-
|
|
3865
|
-
if (isVNode(ch)) {
|
|
3866
|
-
ch.hook.remove(ch, parentElm);
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
}
|
|
3870
|
-
|
|
3871
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
3923
|
+
function updateDynamicChildren(oldCh, newCh, parent) {
|
|
3872
3924
|
var oldStartIdx = 0;
|
|
3873
3925
|
var newStartIdx = 0;
|
|
3874
3926
|
var oldEndIdx = oldCh.length - 1;
|
|
@@ -3894,23 +3946,23 @@ var LWC = (function (exports) {
|
|
|
3894
3946
|
} else if (!isVNode(newEndVnode)) {
|
|
3895
3947
|
newEndVnode = newCh[--newEndIdx];
|
|
3896
3948
|
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3897
|
-
|
|
3949
|
+
patch(oldStartVnode, newStartVnode);
|
|
3898
3950
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3899
3951
|
newStartVnode = newCh[++newStartIdx];
|
|
3900
3952
|
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3901
|
-
|
|
3953
|
+
patch(oldEndVnode, newEndVnode);
|
|
3902
3954
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3903
3955
|
newEndVnode = newCh[--newEndIdx];
|
|
3904
3956
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3905
3957
|
// Vnode moved right
|
|
3906
|
-
|
|
3907
|
-
|
|
3958
|
+
patch(oldStartVnode, newEndVnode);
|
|
3959
|
+
insertNode(oldStartVnode.elm, parent, nextSibling$1(oldEndVnode.elm));
|
|
3908
3960
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
3909
3961
|
newEndVnode = newCh[--newEndIdx];
|
|
3910
3962
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3911
3963
|
// Vnode moved left
|
|
3912
|
-
|
|
3913
|
-
newStartVnode.
|
|
3964
|
+
patch(oldEndVnode, newStartVnode);
|
|
3965
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm);
|
|
3914
3966
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
3915
3967
|
newStartVnode = newCh[++newStartIdx];
|
|
3916
3968
|
} else {
|
|
@@ -3922,8 +3974,7 @@ var LWC = (function (exports) {
|
|
|
3922
3974
|
|
|
3923
3975
|
if (isUndefined$1(idxInOld)) {
|
|
3924
3976
|
// New element
|
|
3925
|
-
newStartVnode.
|
|
3926
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
3977
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3927
3978
|
newStartVnode = newCh[++newStartIdx];
|
|
3928
3979
|
} else {
|
|
3929
3980
|
elmToMove = oldCh[idxInOld];
|
|
@@ -3931,10 +3982,9 @@ var LWC = (function (exports) {
|
|
|
3931
3982
|
if (isVNode(elmToMove)) {
|
|
3932
3983
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
3933
3984
|
// New element
|
|
3934
|
-
newStartVnode.
|
|
3935
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
3985
|
+
mount(newStartVnode, parent, oldStartVnode.elm);
|
|
3936
3986
|
} else {
|
|
3937
|
-
|
|
3987
|
+
patch(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.
|
|
3938
3988
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3939
3989
|
// so we only care about the `oldCh` object inside this function.
|
|
3940
3990
|
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
@@ -3947,7 +3997,7 @@ var LWC = (function (exports) {
|
|
|
3947
3997
|
|
|
3948
3998
|
|
|
3949
3999
|
oldCh[idxInOld] = undefined;
|
|
3950
|
-
|
|
4000
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm);
|
|
3951
4001
|
}
|
|
3952
4002
|
}
|
|
3953
4003
|
|
|
@@ -3968,65 +4018,55 @@ var LWC = (function (exports) {
|
|
|
3968
4018
|
} while (!isVNode(n) && _i15 < newChEnd);
|
|
3969
4019
|
|
|
3970
4020
|
before = isVNode(n) ? n.elm : null;
|
|
3971
|
-
|
|
4021
|
+
mountVNodes(newCh, parent, before, newStartIdx, newEndIdx + 1);
|
|
3972
4022
|
} else {
|
|
3973
|
-
|
|
4023
|
+
unmountVNodes(oldCh, parent, true, oldStartIdx, oldEndIdx + 1);
|
|
3974
4024
|
}
|
|
3975
4025
|
}
|
|
3976
4026
|
}
|
|
3977
4027
|
|
|
3978
|
-
function updateStaticChildren(
|
|
3979
|
-
var
|
|
3980
|
-
var
|
|
4028
|
+
function updateStaticChildren(c1, c2, parent) {
|
|
4029
|
+
var c1Length = c1.length;
|
|
4030
|
+
var c2Length = c2.length;
|
|
3981
4031
|
|
|
3982
|
-
if (
|
|
4032
|
+
if (c1Length === 0) {
|
|
3983
4033
|
// the old list is empty, we can directly insert anything new
|
|
3984
|
-
|
|
4034
|
+
mountVNodes(c2, parent, null);
|
|
3985
4035
|
return;
|
|
3986
4036
|
}
|
|
3987
4037
|
|
|
3988
|
-
if (
|
|
4038
|
+
if (c2Length === 0) {
|
|
3989
4039
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
3990
4040
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
3991
|
-
|
|
4041
|
+
unmountVNodes(c1, parent, true);
|
|
3992
4042
|
return;
|
|
3993
4043
|
} // if the old list is not empty, the new list MUST have the same
|
|
3994
4044
|
// amount of nodes, that's why we call this static children
|
|
3995
4045
|
|
|
3996
4046
|
|
|
3997
|
-
var
|
|
4047
|
+
var anchor = null;
|
|
3998
4048
|
|
|
3999
|
-
for (var _i16 =
|
|
4000
|
-
var
|
|
4001
|
-
var
|
|
4049
|
+
for (var _i16 = c2Length - 1; _i16 >= 0; _i16 -= 1) {
|
|
4050
|
+
var n1 = c1[_i16];
|
|
4051
|
+
var n2 = c2[_i16];
|
|
4002
4052
|
|
|
4003
|
-
if (
|
|
4004
|
-
if (isVNode(
|
|
4005
|
-
if (isVNode(
|
|
4006
|
-
// both vnodes
|
|
4007
|
-
|
|
4008
|
-
|
|
4053
|
+
if (n2 !== n1) {
|
|
4054
|
+
if (isVNode(n1)) {
|
|
4055
|
+
if (isVNode(n2)) {
|
|
4056
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
4057
|
+
patch(n1, n2);
|
|
4058
|
+
anchor = n2.elm;
|
|
4009
4059
|
} else {
|
|
4010
4060
|
// removing the old vnode since the new one is null
|
|
4011
|
-
|
|
4061
|
+
unmount(n1, parent, true);
|
|
4012
4062
|
}
|
|
4013
|
-
} else if (isVNode(
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
4018
|
-
referenceElm = vnode.elm;
|
|
4063
|
+
} else if (isVNode(n2)) {
|
|
4064
|
+
mount(n2, parent, anchor);
|
|
4065
|
+
anchor = n2.elm;
|
|
4019
4066
|
}
|
|
4020
4067
|
}
|
|
4021
4068
|
}
|
|
4022
4069
|
}
|
|
4023
|
-
|
|
4024
|
-
function patchVnode(oldVnode, vnode) {
|
|
4025
|
-
if (oldVnode !== vnode) {
|
|
4026
|
-
vnode.elm = oldVnode.elm;
|
|
4027
|
-
vnode.hook.update(oldVnode, vnode);
|
|
4028
|
-
}
|
|
4029
|
-
}
|
|
4030
4070
|
/*
|
|
4031
4071
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4032
4072
|
* All rights reserved.
|
|
@@ -4057,7 +4097,6 @@ var LWC = (function (exports) {
|
|
|
4057
4097
|
children: children,
|
|
4058
4098
|
elm: elm,
|
|
4059
4099
|
key: key,
|
|
4060
|
-
hook: ElementHook,
|
|
4061
4100
|
owner: vmBeingRendered
|
|
4062
4101
|
};
|
|
4063
4102
|
} // [t]ab[i]ndex function
|
|
@@ -4106,7 +4145,7 @@ var LWC = (function (exports) {
|
|
|
4106
4145
|
var vmBeingRendered = getVMBeingRendered();
|
|
4107
4146
|
|
|
4108
4147
|
var key = data.key;
|
|
4109
|
-
var elm;
|
|
4148
|
+
var elm, aChildren, vm;
|
|
4110
4149
|
var vnode = {
|
|
4111
4150
|
type: 3
|
|
4112
4151
|
/* CustomElement */
|
|
@@ -4116,11 +4155,11 @@ var LWC = (function (exports) {
|
|
|
4116
4155
|
children: children,
|
|
4117
4156
|
elm: elm,
|
|
4118
4157
|
key: key,
|
|
4119
|
-
hook: CustomElementHook,
|
|
4120
4158
|
ctor: Ctor,
|
|
4121
4159
|
owner: vmBeingRendered,
|
|
4122
|
-
mode: 'open'
|
|
4123
|
-
|
|
4160
|
+
mode: 'open',
|
|
4161
|
+
aChildren: aChildren,
|
|
4162
|
+
vm: vm
|
|
4124
4163
|
};
|
|
4125
4164
|
addVNodeToChildLWC(vnode);
|
|
4126
4165
|
return vnode;
|
|
@@ -4201,7 +4240,6 @@ var LWC = (function (exports) {
|
|
|
4201
4240
|
text: text,
|
|
4202
4241
|
elm: elm,
|
|
4203
4242
|
key: key,
|
|
4204
|
-
hook: TextHook,
|
|
4205
4243
|
owner: getVMBeingRendered()
|
|
4206
4244
|
};
|
|
4207
4245
|
} // [co]mment node
|
|
@@ -4217,7 +4255,6 @@ var LWC = (function (exports) {
|
|
|
4217
4255
|
text: text,
|
|
4218
4256
|
elm: elm,
|
|
4219
4257
|
key: key,
|
|
4220
|
-
hook: CommentHook,
|
|
4221
4258
|
owner: getVMBeingRendered()
|
|
4222
4259
|
};
|
|
4223
4260
|
} // [d]ynamic text
|
|
@@ -4912,11 +4949,17 @@ var LWC = (function (exports) {
|
|
|
4912
4949
|
* will prevent this function from being imported by userland code.
|
|
4913
4950
|
*/
|
|
4914
4951
|
|
|
4915
|
-
function registerComponent(
|
|
4952
|
+
function registerComponent( // We typically expect a LightningElementConstructor, but technically you can call this with anything
|
|
4953
|
+
Ctor, _ref2) {
|
|
4916
4954
|
var tmpl = _ref2.tmpl;
|
|
4917
|
-
|
|
4955
|
+
|
|
4956
|
+
if (isFunction$1(Ctor)) {
|
|
4957
|
+
|
|
4958
|
+
signedTemplateMap.set(Ctor, tmpl);
|
|
4959
|
+
} // chaining this method as a way to wrap existing assignment of component constructor easily,
|
|
4918
4960
|
// without too much transformation
|
|
4919
4961
|
|
|
4962
|
+
|
|
4920
4963
|
return Ctor;
|
|
4921
4964
|
}
|
|
4922
4965
|
|
|
@@ -5007,7 +5050,7 @@ var LWC = (function (exports) {
|
|
|
5007
5050
|
def = vm.def,
|
|
5008
5051
|
context = vm.context;
|
|
5009
5052
|
|
|
5010
|
-
for (var _i22 = 0,
|
|
5053
|
+
for (var _i22 = 0, _len7 = cbs.length; _i22 < _len7; ++_i22) {
|
|
5011
5054
|
cbs[_i22].call(undefined, component, {}, def, context);
|
|
5012
5055
|
}
|
|
5013
5056
|
}
|
|
@@ -5019,7 +5062,7 @@ var LWC = (function (exports) {
|
|
|
5019
5062
|
*/
|
|
5020
5063
|
|
|
5021
5064
|
|
|
5022
|
-
function hydrate
|
|
5065
|
+
function hydrate(vnode, node) {
|
|
5023
5066
|
switch (vnode.type) {
|
|
5024
5067
|
case 0
|
|
5025
5068
|
/* Text */
|
|
@@ -5051,7 +5094,7 @@ var LWC = (function (exports) {
|
|
|
5051
5094
|
var _a;
|
|
5052
5095
|
|
|
5053
5096
|
|
|
5054
|
-
node
|
|
5097
|
+
setText$1(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5055
5098
|
vnode.elm = node;
|
|
5056
5099
|
}
|
|
5057
5100
|
|
|
@@ -5059,7 +5102,7 @@ var LWC = (function (exports) {
|
|
|
5059
5102
|
var _a;
|
|
5060
5103
|
|
|
5061
5104
|
|
|
5062
|
-
node
|
|
5105
|
+
setProperty$1(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
5063
5106
|
vnode.elm = node;
|
|
5064
5107
|
}
|
|
5065
5108
|
|
|
@@ -5078,13 +5121,13 @@ var LWC = (function (exports) {
|
|
|
5078
5121
|
var props = vnode.data.props;
|
|
5079
5122
|
|
|
5080
5123
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5081
|
-
if (elm
|
|
5124
|
+
if (getProperty$1(elm, 'innerHTML') === props.innerHTML) {
|
|
5082
5125
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
5083
5126
|
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
5084
5127
|
props: cloneAndOmitKey(props, 'innerHTML')
|
|
5085
5128
|
});
|
|
5086
5129
|
} else {
|
|
5087
|
-
logWarn("Mismatch hydrating element <".concat(elm
|
|
5130
|
+
logWarn("Mismatch hydrating element <".concat(getProperty$1(elm, 'tagName').toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
5088
5131
|
}
|
|
5089
5132
|
}
|
|
5090
5133
|
}
|
|
@@ -5092,14 +5135,13 @@ var LWC = (function (exports) {
|
|
|
5092
5135
|
patchElementPropsAndAttrs(vnode);
|
|
5093
5136
|
|
|
5094
5137
|
if (!isDomManual) {
|
|
5095
|
-
hydrateChildren(vnode.elm
|
|
5138
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children, vnode.owner);
|
|
5096
5139
|
}
|
|
5097
5140
|
}
|
|
5098
5141
|
|
|
5099
5142
|
function hydrateCustomElement(vnode, node) {
|
|
5100
5143
|
|
|
5101
5144
|
var elm = node;
|
|
5102
|
-
vnode.elm = elm;
|
|
5103
5145
|
var sel = vnode.sel,
|
|
5104
5146
|
mode = vnode.mode,
|
|
5105
5147
|
ctor = vnode.ctor,
|
|
@@ -5109,6 +5151,8 @@ var LWC = (function (exports) {
|
|
|
5109
5151
|
owner: owner,
|
|
5110
5152
|
tagName: sel
|
|
5111
5153
|
});
|
|
5154
|
+
vnode.elm = elm;
|
|
5155
|
+
vnode.vm = vm;
|
|
5112
5156
|
allocateChildren(vnode, vm);
|
|
5113
5157
|
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
5114
5158
|
|
|
@@ -5119,7 +5163,7 @@ var LWC = (function (exports) {
|
|
|
5119
5163
|
) {
|
|
5120
5164
|
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5121
5165
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5122
|
-
hydrateChildren(vnode.elm
|
|
5166
|
+
hydrateChildren(getChildNodes$1(vnode.elm), vnode.children);
|
|
5123
5167
|
}
|
|
5124
5168
|
|
|
5125
5169
|
hydrateVM(vm);
|
|
@@ -5134,7 +5178,7 @@ var LWC = (function (exports) {
|
|
|
5134
5178
|
|
|
5135
5179
|
if (!isNull(childVnode)) {
|
|
5136
5180
|
var childNode = elmChildren[childNodeIndex];
|
|
5137
|
-
hydrate
|
|
5181
|
+
hydrate(childVnode, childNode);
|
|
5138
5182
|
childNodeIndex++;
|
|
5139
5183
|
}
|
|
5140
5184
|
}
|
|
@@ -5210,7 +5254,19 @@ var LWC = (function (exports) {
|
|
|
5210
5254
|
}
|
|
5211
5255
|
|
|
5212
5256
|
function hydrateVM(vm) {
|
|
5213
|
-
|
|
5257
|
+
if (isTrue(vm.isDirty)) {
|
|
5258
|
+
// manually diffing/patching here.
|
|
5259
|
+
// This routine is:
|
|
5260
|
+
// patchShadowRoot(vm, children);
|
|
5261
|
+
// -> addVnodes.
|
|
5262
|
+
var children = renderComponent(vm);
|
|
5263
|
+
vm.children = children;
|
|
5264
|
+
var vmChildren = vm.renderMode === 0
|
|
5265
|
+
/* Light */
|
|
5266
|
+
? getChildNodes$1(vm.elm) : getChildNodes$1(vm.elm.shadowRoot);
|
|
5267
|
+
hydrateChildren(vmChildren, children);
|
|
5268
|
+
runRenderedCallback(vm);
|
|
5269
|
+
}
|
|
5214
5270
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
5215
5271
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5216
5272
|
|
|
@@ -5330,30 +5386,38 @@ var LWC = (function (exports) {
|
|
|
5330
5386
|
/* Native */
|
|
5331
5387
|
;
|
|
5332
5388
|
} else if (isNativeShadowDefined$1) {
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
) {
|
|
5336
|
-
|
|
5337
|
-
/*
|
|
5338
|
-
;
|
|
5339
|
-
} else {
|
|
5340
|
-
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
5341
|
-
|
|
5342
|
-
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5343
|
-
/* Native */
|
|
5389
|
+
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5390
|
+
// the if-condition.
|
|
5391
|
+
if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5392
|
+
if (def.shadowSupportMode === "any"
|
|
5393
|
+
/* Any */
|
|
5344
5394
|
) {
|
|
5345
|
-
// Transitive support for native Shadow DOM. A component in native mode
|
|
5346
|
-
// transitively opts all of its descendants into native.
|
|
5347
5395
|
shadowMode = 0
|
|
5348
5396
|
/* Native */
|
|
5349
5397
|
;
|
|
5350
5398
|
} else {
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
shadowMode
|
|
5354
|
-
/*
|
|
5355
|
-
|
|
5399
|
+
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
5400
|
+
|
|
5401
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5402
|
+
/* Native */
|
|
5403
|
+
) {
|
|
5404
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
5405
|
+
// transitively opts all of its descendants into native.
|
|
5406
|
+
shadowMode = 0
|
|
5407
|
+
/* Native */
|
|
5408
|
+
;
|
|
5409
|
+
} else {
|
|
5410
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5411
|
+
// to be native.
|
|
5412
|
+
shadowMode = 1
|
|
5413
|
+
/* Synthetic */
|
|
5414
|
+
;
|
|
5415
|
+
}
|
|
5356
5416
|
}
|
|
5417
|
+
} else {
|
|
5418
|
+
shadowMode = 1
|
|
5419
|
+
/* Synthetic */
|
|
5420
|
+
;
|
|
5357
5421
|
}
|
|
5358
5422
|
} else {
|
|
5359
5423
|
// Synthetic if there is no native Shadow DOM support.
|
|
@@ -5394,22 +5458,6 @@ var LWC = (function (exports) {
|
|
|
5394
5458
|
}
|
|
5395
5459
|
}
|
|
5396
5460
|
|
|
5397
|
-
function hydrate(vm) {
|
|
5398
|
-
if (isTrue(vm.isDirty)) {
|
|
5399
|
-
// manually diffing/patching here.
|
|
5400
|
-
// This routine is:
|
|
5401
|
-
// patchShadowRoot(vm, children);
|
|
5402
|
-
// -> addVnodes.
|
|
5403
|
-
var children = renderComponent(vm);
|
|
5404
|
-
vm.children = children;
|
|
5405
|
-
var vmChildren = vm.renderMode === 0
|
|
5406
|
-
/* Light */
|
|
5407
|
-
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5408
|
-
hydrateChildren(vmChildren, children);
|
|
5409
|
-
runRenderedCallback(vm);
|
|
5410
|
-
}
|
|
5411
|
-
}
|
|
5412
|
-
|
|
5413
5461
|
function patchShadowRoot(vm, newCh) {
|
|
5414
5462
|
var renderRoot = vm.renderRoot,
|
|
5415
5463
|
oldCh = vm.children; // caching the new children collection
|
|
@@ -5427,7 +5475,7 @@ var LWC = (function (exports) {
|
|
|
5427
5475
|
, vm);
|
|
5428
5476
|
}, function () {
|
|
5429
5477
|
// job
|
|
5430
|
-
patchChildren(
|
|
5478
|
+
patchChildren(oldCh, newCh, renderRoot);
|
|
5431
5479
|
}, function () {
|
|
5432
5480
|
// post
|
|
5433
5481
|
logOperationEnd(2
|
|
@@ -5484,13 +5532,13 @@ var LWC = (function (exports) {
|
|
|
5484
5532
|
});
|
|
5485
5533
|
rehydrateQueue = []; // reset to a new queue
|
|
5486
5534
|
|
|
5487
|
-
for (var _i26 = 0,
|
|
5535
|
+
for (var _i26 = 0, _len8 = vms.length; _i26 < _len8; _i26 += 1) {
|
|
5488
5536
|
var vm = vms[_i26];
|
|
5489
5537
|
|
|
5490
5538
|
try {
|
|
5491
5539
|
rehydrate(vm);
|
|
5492
5540
|
} catch (error) {
|
|
5493
|
-
if (_i26 + 1 <
|
|
5541
|
+
if (_i26 + 1 < _len8) {
|
|
5494
5542
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
5495
5543
|
if (rehydrateQueue.length === 0) {
|
|
5496
5544
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
@@ -5630,7 +5678,7 @@ var LWC = (function (exports) {
|
|
|
5630
5678
|
|
|
5631
5679
|
|
|
5632
5680
|
function recursivelyDisconnectChildren(vnodes) {
|
|
5633
|
-
for (var _i28 = 0,
|
|
5681
|
+
for (var _i28 = 0, _len9 = vnodes.length; _i28 < _len9; _i28 += 1) {
|
|
5634
5682
|
var vnode = vnodes[_i28];
|
|
5635
5683
|
|
|
5636
5684
|
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
@@ -5662,7 +5710,7 @@ var LWC = (function (exports) {
|
|
|
5662
5710
|
var children = vm.children,
|
|
5663
5711
|
renderRoot = vm.renderRoot;
|
|
5664
5712
|
|
|
5665
|
-
for (var _i29 = 0,
|
|
5713
|
+
for (var _i29 = 0, _len10 = children.length; _i29 < _len10; _i29++) {
|
|
5666
5714
|
var child = children[_i29];
|
|
5667
5715
|
|
|
5668
5716
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
@@ -6013,7 +6061,7 @@ var LWC = (function (exports) {
|
|
|
6013
6061
|
function connectWireAdapters(vm) {
|
|
6014
6062
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
6015
6063
|
|
|
6016
|
-
for (var _i30 = 0,
|
|
6064
|
+
for (var _i30 = 0, _len11 = wiredConnecting.length; _i30 < _len11; _i30 += 1) {
|
|
6017
6065
|
wiredConnecting[_i30]();
|
|
6018
6066
|
}
|
|
6019
6067
|
}
|
|
@@ -6022,7 +6070,7 @@ var LWC = (function (exports) {
|
|
|
6022
6070
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
6023
6071
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6024
6072
|
// job
|
|
6025
|
-
for (var _i31 = 0,
|
|
6073
|
+
for (var _i31 = 0, _len12 = wiredDisconnecting.length; _i31 < _len12; _i31 += 1) {
|
|
6026
6074
|
wiredDisconnecting[_i31]();
|
|
6027
6075
|
}
|
|
6028
6076
|
}, noop);
|
|
@@ -6033,6 +6081,7 @@ var LWC = (function (exports) {
|
|
|
6033
6081
|
* SPDX-License-Identifier: MIT
|
|
6034
6082
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6035
6083
|
*/
|
|
6084
|
+
// this is lwc internal implementation
|
|
6036
6085
|
|
|
6037
6086
|
|
|
6038
6087
|
function createContextProvider(adapter) {
|
|
@@ -6107,7 +6156,7 @@ var LWC = (function (exports) {
|
|
|
6107
6156
|
hooksAreSet = true;
|
|
6108
6157
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6109
6158
|
}
|
|
6110
|
-
/* version: 2.
|
|
6159
|
+
/* version: 2.11.1 */
|
|
6111
6160
|
|
|
6112
6161
|
/*
|
|
6113
6162
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6124,9 +6173,10 @@ var LWC = (function (exports) {
|
|
|
6124
6173
|
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
6125
6174
|
|
|
6126
6175
|
var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
6176
|
+
var supportsMutableAdoptedStyleSheets = supportsConstructableStyleSheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
|
|
6127
6177
|
var styleElements = create(null);
|
|
6128
6178
|
var styleSheets = create(null);
|
|
6129
|
-
var
|
|
6179
|
+
var shadowRootsToStyleSheets = new WeakMap();
|
|
6130
6180
|
var getCustomElement;
|
|
6131
6181
|
var defineCustomElement;
|
|
6132
6182
|
var HTMLElementConstructor;
|
|
@@ -6178,18 +6228,26 @@ var LWC = (function (exports) {
|
|
|
6178
6228
|
styleSheets[content] = styleSheet;
|
|
6179
6229
|
}
|
|
6180
6230
|
|
|
6181
|
-
|
|
6182
|
-
|
|
6231
|
+
var adoptedStyleSheets = target.adoptedStyleSheets;
|
|
6232
|
+
|
|
6233
|
+
if (!adoptedStyleSheets.includes(styleSheet)) {
|
|
6234
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
6235
|
+
// This is only supported in later versions of Chromium:
|
|
6236
|
+
// https://chromestatus.com/feature/5638996492288000
|
|
6237
|
+
adoptedStyleSheets.push(styleSheet);
|
|
6238
|
+
} else {
|
|
6239
|
+
target.adoptedStyleSheets = [].concat(_toConsumableArray(adoptedStyleSheets), [styleSheet]);
|
|
6240
|
+
}
|
|
6183
6241
|
}
|
|
6184
6242
|
}
|
|
6185
6243
|
|
|
6186
6244
|
function insertStyleElement(content, target) {
|
|
6187
6245
|
// Avoid inserting duplicate `<style>`s
|
|
6188
|
-
var sheets =
|
|
6246
|
+
var sheets = shadowRootsToStyleSheets.get(target);
|
|
6189
6247
|
|
|
6190
6248
|
if (isUndefined$1(sheets)) {
|
|
6191
6249
|
sheets = create(null);
|
|
6192
|
-
|
|
6250
|
+
shadowRootsToStyleSheets.set(target, sheets);
|
|
6193
6251
|
}
|
|
6194
6252
|
|
|
6195
6253
|
if (sheets[content]) {
|
|
@@ -6461,6 +6519,173 @@ var LWC = (function (exports) {
|
|
|
6461
6519
|
setSetText(setText);
|
|
6462
6520
|
setSsr(ssr);
|
|
6463
6521
|
setAddEventListener(addEventListener);
|
|
6522
|
+
/*
|
|
6523
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6524
|
+
* All rights reserved.
|
|
6525
|
+
* SPDX-License-Identifier: MIT
|
|
6526
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6527
|
+
*/
|
|
6528
|
+
|
|
6529
|
+
function resetShadowRootAndLightDom(element, Ctor) {
|
|
6530
|
+
if (element.shadowRoot) {
|
|
6531
|
+
var shadowRoot = element.shadowRoot;
|
|
6532
|
+
|
|
6533
|
+
while (!isNull(shadowRoot.firstChild)) {
|
|
6534
|
+
shadowRoot.removeChild(shadowRoot.firstChild);
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
|
|
6538
|
+
if (Ctor.renderMode === 'light') {
|
|
6539
|
+
while (!isNull(element.firstChild)) {
|
|
6540
|
+
element.removeChild(element.firstChild);
|
|
6541
|
+
}
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
|
|
6545
|
+
function createVMWithProps(element, Ctor, props) {
|
|
6546
|
+
createVM(element, Ctor, {
|
|
6547
|
+
mode: 'open',
|
|
6548
|
+
owner: null,
|
|
6549
|
+
tagName: element.tagName.toLowerCase()
|
|
6550
|
+
});
|
|
6551
|
+
|
|
6552
|
+
for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
|
|
6553
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
|
|
6554
|
+
key = _Object$entries2$_i[0],
|
|
6555
|
+
value = _Object$entries2$_i[1];
|
|
6556
|
+
|
|
6557
|
+
element[key] = value;
|
|
6558
|
+
}
|
|
6559
|
+
}
|
|
6560
|
+
|
|
6561
|
+
function hydrateComponent(element, Ctor) {
|
|
6562
|
+
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6563
|
+
|
|
6564
|
+
if (!(element instanceof Element)) {
|
|
6565
|
+
throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
|
|
6566
|
+
}
|
|
6567
|
+
|
|
6568
|
+
if (!isFunction$1(Ctor)) {
|
|
6569
|
+
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
6570
|
+
}
|
|
6571
|
+
|
|
6572
|
+
if (!isObject(props) || isNull(props)) {
|
|
6573
|
+
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
6574
|
+
}
|
|
6575
|
+
|
|
6576
|
+
if (getAssociatedVMIfPresent(element)) {
|
|
6577
|
+
/* eslint-disable-next-line no-console */
|
|
6578
|
+
console.warn("\"hydrateComponent\" expects an element that is not hydrated.", element);
|
|
6579
|
+
return;
|
|
6580
|
+
}
|
|
6581
|
+
|
|
6582
|
+
try {
|
|
6583
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6584
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6585
|
+
setIsHydrating(true);
|
|
6586
|
+
createVMWithProps(element, Ctor, props);
|
|
6587
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6588
|
+
|
|
6589
|
+
setIsHydrating(false);
|
|
6590
|
+
} catch (e) {
|
|
6591
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
6592
|
+
// with the client generated DOM.
|
|
6593
|
+
|
|
6594
|
+
/* eslint-disable-next-line no-console */
|
|
6595
|
+
console.error('Recovering from error while hydrating: ', e); // We want to preserve the element, so we need to reset the shadowRoot and light dom.
|
|
6596
|
+
|
|
6597
|
+
resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
6598
|
+
|
|
6599
|
+
createVMWithProps(element, Ctor, props);
|
|
6600
|
+
setIsHydrating(false);
|
|
6601
|
+
connectRootElement(element);
|
|
6602
|
+
} finally {
|
|
6603
|
+
// in case there's an error during recovery
|
|
6604
|
+
setIsHydrating(false);
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
/*
|
|
6608
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6609
|
+
* All rights reserved.
|
|
6610
|
+
* SPDX-License-Identifier: MIT
|
|
6611
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6612
|
+
*/
|
|
6613
|
+
|
|
6614
|
+
/**
|
|
6615
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6616
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6617
|
+
*
|
|
6618
|
+
* @deprecated since version 1.3.11
|
|
6619
|
+
*
|
|
6620
|
+
* @example
|
|
6621
|
+
* ```
|
|
6622
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6623
|
+
* import Foo from 'ns/foo';
|
|
6624
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6625
|
+
* customElements.define('x-foo', WC);
|
|
6626
|
+
* const elm = document.createElement('x-foo');
|
|
6627
|
+
* ```
|
|
6628
|
+
*/
|
|
6629
|
+
|
|
6630
|
+
|
|
6631
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6632
|
+
|
|
6633
|
+
return Ctor.CustomElementConstructor;
|
|
6634
|
+
} // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
|
|
6635
|
+
// This WeakSet usage is valid because this functionality is not meant to run in IE11.
|
|
6636
|
+
|
|
6637
|
+
|
|
6638
|
+
var hydratedCustomElements = new WeakSet();
|
|
6639
|
+
|
|
6640
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6641
|
+
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
6642
|
+
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
6643
|
+
_inherits(_class, _HtmlPrototype);
|
|
6644
|
+
|
|
6645
|
+
var _super8 = _createSuper(_class);
|
|
6646
|
+
|
|
6647
|
+
function _class() {
|
|
6648
|
+
var _this6;
|
|
6649
|
+
|
|
6650
|
+
_classCallCheck(this, _class);
|
|
6651
|
+
|
|
6652
|
+
_this6 = _super8.call(this);
|
|
6653
|
+
|
|
6654
|
+
if (_this6.isConnected) {
|
|
6655
|
+
// this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
|
|
6656
|
+
hydrateComponent(_assertThisInitialized(_this6), Ctor, {});
|
|
6657
|
+
hydratedCustomElements.add(_assertThisInitialized(_this6));
|
|
6658
|
+
} else {
|
|
6659
|
+
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
6660
|
+
mode: 'open',
|
|
6661
|
+
owner: null,
|
|
6662
|
+
tagName: _this6.tagName
|
|
6663
|
+
});
|
|
6664
|
+
}
|
|
6665
|
+
|
|
6666
|
+
return _this6;
|
|
6667
|
+
}
|
|
6668
|
+
|
|
6669
|
+
_createClass(_class, [{
|
|
6670
|
+
key: "connectedCallback",
|
|
6671
|
+
value: function connectedCallback() {
|
|
6672
|
+
if (hydratedCustomElements.has(this)) {
|
|
6673
|
+
// This is an un-upgraded element that was hydrated in the constructor.
|
|
6674
|
+
hydratedCustomElements.delete(this);
|
|
6675
|
+
} else {
|
|
6676
|
+
connectRootElement(this);
|
|
6677
|
+
}
|
|
6678
|
+
}
|
|
6679
|
+
}, {
|
|
6680
|
+
key: "disconnectedCallback",
|
|
6681
|
+
value: function disconnectedCallback() {
|
|
6682
|
+
disconnectRootElement(this);
|
|
6683
|
+
}
|
|
6684
|
+
}]);
|
|
6685
|
+
|
|
6686
|
+
return _class;
|
|
6687
|
+
}(HtmlPrototype);
|
|
6688
|
+
}
|
|
6464
6689
|
/*
|
|
6465
6690
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6466
6691
|
* All rights reserved.
|
|
@@ -6470,6 +6695,7 @@ var LWC = (function (exports) {
|
|
|
6470
6695
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6471
6696
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6472
6697
|
|
|
6698
|
+
|
|
6473
6699
|
var _Node$1 = Node;
|
|
6474
6700
|
var ConnectingSlot = new WeakMap();
|
|
6475
6701
|
var DisconnectingSlot = new WeakMap();
|
|
@@ -6574,138 +6800,6 @@ var LWC = (function (exports) {
|
|
|
6574
6800
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6575
6801
|
*/
|
|
6576
6802
|
|
|
6577
|
-
|
|
6578
|
-
function hydrateComponent(element, Ctor) {
|
|
6579
|
-
var props = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
6580
|
-
|
|
6581
|
-
if (!(element instanceof Element)) {
|
|
6582
|
-
throw new TypeError("\"hydrateComponent\" expects a valid DOM element as the first parameter but instead received ".concat(element, "."));
|
|
6583
|
-
}
|
|
6584
|
-
|
|
6585
|
-
if (!isFunction$1(Ctor)) {
|
|
6586
|
-
throw new TypeError("\"hydrateComponent\" expects a valid component constructor as the second parameter but instead received ".concat(Ctor, "."));
|
|
6587
|
-
}
|
|
6588
|
-
|
|
6589
|
-
if (!isObject(props) || isNull(props)) {
|
|
6590
|
-
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
6591
|
-
}
|
|
6592
|
-
|
|
6593
|
-
try {
|
|
6594
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6595
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
6596
|
-
setIsHydrating(true);
|
|
6597
|
-
createVM(element, Ctor, {
|
|
6598
|
-
mode: 'open',
|
|
6599
|
-
owner: null,
|
|
6600
|
-
tagName: element.tagName.toLowerCase()
|
|
6601
|
-
});
|
|
6602
|
-
|
|
6603
|
-
for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
|
|
6604
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
|
|
6605
|
-
key = _Object$entries2$_i[0],
|
|
6606
|
-
value = _Object$entries2$_i[1];
|
|
6607
|
-
|
|
6608
|
-
element[key] = value;
|
|
6609
|
-
}
|
|
6610
|
-
|
|
6611
|
-
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6612
|
-
|
|
6613
|
-
setIsHydrating(false);
|
|
6614
|
-
} catch (e) {
|
|
6615
|
-
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6616
|
-
// the client generated DOM.
|
|
6617
|
-
|
|
6618
|
-
/* eslint-disable-next-line no-console */
|
|
6619
|
-
console.error('Recovering from error while hydrating: ', e);
|
|
6620
|
-
setIsHydrating(false);
|
|
6621
|
-
var newElem = createElement(element.tagName, {
|
|
6622
|
-
is: Ctor,
|
|
6623
|
-
mode: 'open'
|
|
6624
|
-
});
|
|
6625
|
-
|
|
6626
|
-
for (var _i34 = 0, _Object$entries3 = Object.entries(props); _i34 < _Object$entries3.length; _i34++) {
|
|
6627
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i34], 2),
|
|
6628
|
-
_key3 = _Object$entries3$_i[0],
|
|
6629
|
-
_value2 = _Object$entries3$_i[1];
|
|
6630
|
-
|
|
6631
|
-
newElem[_key3] = _value2;
|
|
6632
|
-
}
|
|
6633
|
-
|
|
6634
|
-
element.parentNode.replaceChild(newElem, element);
|
|
6635
|
-
}
|
|
6636
|
-
}
|
|
6637
|
-
/*
|
|
6638
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6639
|
-
* All rights reserved.
|
|
6640
|
-
* SPDX-License-Identifier: MIT
|
|
6641
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6642
|
-
*/
|
|
6643
|
-
|
|
6644
|
-
/**
|
|
6645
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6646
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6647
|
-
*
|
|
6648
|
-
* @deprecated since version 1.3.11
|
|
6649
|
-
*
|
|
6650
|
-
* @example
|
|
6651
|
-
* ```
|
|
6652
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6653
|
-
* import Foo from 'ns/foo';
|
|
6654
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6655
|
-
* customElements.define('x-foo', WC);
|
|
6656
|
-
* const elm = document.createElement('x-foo');
|
|
6657
|
-
* ```
|
|
6658
|
-
*/
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6662
|
-
|
|
6663
|
-
return Ctor.CustomElementConstructor;
|
|
6664
|
-
}
|
|
6665
|
-
|
|
6666
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6667
|
-
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
6668
|
-
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
6669
|
-
_inherits(_class, _HtmlPrototype);
|
|
6670
|
-
|
|
6671
|
-
var _super8 = _createSuper(_class);
|
|
6672
|
-
|
|
6673
|
-
function _class() {
|
|
6674
|
-
var _this6;
|
|
6675
|
-
|
|
6676
|
-
_classCallCheck(this, _class);
|
|
6677
|
-
|
|
6678
|
-
_this6 = _super8.call(this);
|
|
6679
|
-
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
6680
|
-
mode: 'open',
|
|
6681
|
-
owner: null,
|
|
6682
|
-
tagName: _this6.tagName
|
|
6683
|
-
});
|
|
6684
|
-
return _this6;
|
|
6685
|
-
}
|
|
6686
|
-
|
|
6687
|
-
_createClass(_class, [{
|
|
6688
|
-
key: "connectedCallback",
|
|
6689
|
-
value: function connectedCallback() {
|
|
6690
|
-
connectRootElement(this);
|
|
6691
|
-
}
|
|
6692
|
-
}, {
|
|
6693
|
-
key: "disconnectedCallback",
|
|
6694
|
-
value: function disconnectedCallback() {
|
|
6695
|
-
disconnectRootElement(this);
|
|
6696
|
-
}
|
|
6697
|
-
}]);
|
|
6698
|
-
|
|
6699
|
-
return _class;
|
|
6700
|
-
}(HtmlPrototype);
|
|
6701
|
-
}
|
|
6702
|
-
/*
|
|
6703
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6704
|
-
* All rights reserved.
|
|
6705
|
-
* SPDX-License-Identifier: MIT
|
|
6706
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6707
|
-
*/
|
|
6708
|
-
|
|
6709
6803
|
/**
|
|
6710
6804
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6711
6805
|
* This API is subject to change or being removed.
|
|
@@ -6805,7 +6899,7 @@ var LWC = (function (exports) {
|
|
|
6805
6899
|
});
|
|
6806
6900
|
freeze(LightningElement);
|
|
6807
6901
|
seal(LightningElement.prototype);
|
|
6808
|
-
/* version: 2.
|
|
6902
|
+
/* version: 2.11.1 */
|
|
6809
6903
|
|
|
6810
6904
|
exports.LightningElement = LightningElement;
|
|
6811
6905
|
exports.__unstable__ProfilerControl = profilerControl;
|