lwc 2.5.6 → 2.5.10-alpha1
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/esm/es2017/engine.js +7981 -0
- package/dist/engine/iife/es2017/engine.js +8013 -0
- package/dist/engine/iife/es2017/engine.min.js +9 -0
- package/dist/engine/iife/es2017/engine_debug.js +6541 -0
- package/dist/engine/iife/es5/engine.js +6060 -0
- package/dist/engine/iife/es5/engine.min.js +23 -0
- package/dist/engine/iife/es5/engine_debug.js +4856 -0
- package/dist/engine/umd/es2017/engine.js +8014 -0
- package/dist/engine/umd/es2017/engine.min.js +9 -0
- package/dist/engine/umd/es2017/engine_debug.js +6542 -0
- package/dist/engine/umd/es5/engine.js +6061 -0
- package/dist/engine/umd/es5/engine.min.js +23 -0
- package/dist/engine/umd/es5/engine_debug.js +4857 -0
- package/dist/engine-dom/esm/es2017/engine-dom.js +521 -122
- package/dist/engine-dom/iife/es2017/engine-dom.js +522 -123
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +337 -112
- package/dist/engine-dom/iife/es5/engine-dom.js +596 -185
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +392 -165
- package/dist/engine-dom/umd/es2017/engine-dom.js +523 -124
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +338 -113
- package/dist/engine-dom/umd/es5/engine-dom.js +597 -186
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +393 -166
- package/dist/engine-server/commonjs/es2017/engine-server.js +400 -74
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +401 -74
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +4 -4
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +4 -4
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +5 -5
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +5 -5
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +3 -3
- package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- package/dist/wire-service/umd/es2017/wire-service.js +4 -4
- package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.js +4 -4
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +4 -4
- package/package.json +8 -8
|
@@ -298,7 +298,7 @@ var LWC = (function (exports) {
|
|
|
298
298
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
299
299
|
return attributeName;
|
|
300
300
|
}
|
|
301
|
-
/** version: 2.5.
|
|
301
|
+
/** version: 2.5.10-alpha1 */
|
|
302
302
|
|
|
303
303
|
/*
|
|
304
304
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -470,7 +470,7 @@ var LWC = (function (exports) {
|
|
|
470
470
|
|
|
471
471
|
function setFeatureFlagForTest(name, value) {
|
|
472
472
|
}
|
|
473
|
-
/** version: 2.5.
|
|
473
|
+
/** version: 2.5.10-alpha1 */
|
|
474
474
|
|
|
475
475
|
/* proxy-compat-disable */
|
|
476
476
|
|
|
@@ -512,7 +512,7 @@ var LWC = (function (exports) {
|
|
|
512
512
|
}
|
|
513
513
|
|
|
514
514
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
515
|
-
}
|
|
515
|
+
} // Borrowed from Vue template compiler.
|
|
516
516
|
/*
|
|
517
517
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
518
518
|
* All rights reserved.
|
|
@@ -660,6 +660,20 @@ var LWC = (function (exports) {
|
|
|
660
660
|
return `<${StringToLowerCase.call(vm.tagName)}>`;
|
|
661
661
|
} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
|
|
662
662
|
|
|
663
|
+
|
|
664
|
+
function getComponentStack(vm) {
|
|
665
|
+
const stack = [];
|
|
666
|
+
let prefix = '';
|
|
667
|
+
|
|
668
|
+
while (!isNull(vm.owner)) {
|
|
669
|
+
ArrayPush$1.call(stack, prefix + getComponentTag(vm));
|
|
670
|
+
vm = vm.owner;
|
|
671
|
+
prefix += '\t';
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
return ArrayJoin.call(stack, '\n');
|
|
675
|
+
}
|
|
676
|
+
|
|
663
677
|
function getErrorComponentStack(vm) {
|
|
664
678
|
const wcStack = [];
|
|
665
679
|
let currentVm = vm;
|
|
@@ -679,6 +693,32 @@ var LWC = (function (exports) {
|
|
|
679
693
|
*/
|
|
680
694
|
|
|
681
695
|
|
|
696
|
+
function log(method, message, vm) {
|
|
697
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
698
|
+
|
|
699
|
+
if (!isUndefined$1(vm)) {
|
|
700
|
+
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
try {
|
|
704
|
+
throw new Error(msg);
|
|
705
|
+
} catch (e) {
|
|
706
|
+
/* eslint-disable-next-line no-console */
|
|
707
|
+
console[method](e);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
function logWarn(message, vm) {
|
|
712
|
+
log('warn', message, vm);
|
|
713
|
+
}
|
|
714
|
+
/*
|
|
715
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
716
|
+
* All rights reserved.
|
|
717
|
+
* SPDX-License-Identifier: MIT
|
|
718
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
719
|
+
*/
|
|
720
|
+
|
|
721
|
+
|
|
682
722
|
function handleEvent(event, vnode) {
|
|
683
723
|
const {
|
|
684
724
|
type
|
|
@@ -2431,8 +2471,10 @@ var LWC = (function (exports) {
|
|
|
2431
2471
|
} = vm;
|
|
2432
2472
|
|
|
2433
2473
|
return renderer[rendererMethod](elm);
|
|
2434
|
-
}
|
|
2474
|
+
},
|
|
2435
2475
|
|
|
2476
|
+
configurable: true,
|
|
2477
|
+
enumerable: true
|
|
2436
2478
|
};
|
|
2437
2479
|
}
|
|
2438
2480
|
|
|
@@ -2448,8 +2490,11 @@ var LWC = (function (exports) {
|
|
|
2448
2490
|
} = vm;
|
|
2449
2491
|
|
|
2450
2492
|
return renderer[queryMethod](elm, arg);
|
|
2451
|
-
}
|
|
2493
|
+
},
|
|
2452
2494
|
|
|
2495
|
+
configurable: true,
|
|
2496
|
+
enumerable: true,
|
|
2497
|
+
writable: true
|
|
2453
2498
|
};
|
|
2454
2499
|
}
|
|
2455
2500
|
|
|
@@ -3300,7 +3345,7 @@ var LWC = (function (exports) {
|
|
|
3300
3345
|
renderMode: 1
|
|
3301
3346
|
/* Shadow */
|
|
3302
3347
|
,
|
|
3303
|
-
shadowSupportMode: "
|
|
3348
|
+
shadowSupportMode: "reset"
|
|
3304
3349
|
/* Default */
|
|
3305
3350
|
,
|
|
3306
3351
|
wire: EmptyObject,
|
|
@@ -3426,6 +3471,17 @@ var LWC = (function (exports) {
|
|
|
3426
3471
|
modComputedStyle.create(vnode);
|
|
3427
3472
|
}
|
|
3428
3473
|
|
|
3474
|
+
function hydrateElmHook(vnode) {
|
|
3475
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
3476
|
+
// modAttrs.create(vnode);
|
|
3477
|
+
|
|
3478
|
+
modProps.create(vnode); // Already set.
|
|
3479
|
+
// modStaticClassName.create(vnode);
|
|
3480
|
+
// modStaticStyle.create(vnode);
|
|
3481
|
+
// modComputedClassName.create(vnode);
|
|
3482
|
+
// modComputedStyle.create(vnode);
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3429
3485
|
function fallbackElmHook(elm, vnode) {
|
|
3430
3486
|
const {
|
|
3431
3487
|
owner
|
|
@@ -3575,6 +3631,22 @@ var LWC = (function (exports) {
|
|
|
3575
3631
|
}
|
|
3576
3632
|
}
|
|
3577
3633
|
|
|
3634
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
3635
|
+
|
|
3636
|
+
let elmCurrentChildIdx = 0;
|
|
3637
|
+
|
|
3638
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
3639
|
+
const ch = children[j];
|
|
3640
|
+
|
|
3641
|
+
if (ch != null) {
|
|
3642
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
3643
|
+
|
|
3644
|
+
ch.hook.hydrate(ch, childNode);
|
|
3645
|
+
elmCurrentChildIdx++;
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
|
|
3578
3650
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
3579
3651
|
// Attrs need to be applied to element before props
|
|
3580
3652
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -3658,38 +3730,6 @@ var LWC = (function (exports) {
|
|
|
3658
3730
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3659
3731
|
*/
|
|
3660
3732
|
|
|
3661
|
-
/**
|
|
3662
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
3663
|
-
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
3664
|
-
* lwc:inner-html directive.
|
|
3665
|
-
* It is meant to be overridden with setSanitizeHtmlContentHook
|
|
3666
|
-
*/
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
let sanitizeHtmlContentHook = () => {
|
|
3670
|
-
// locker-service patches this function during runtime to sanitize HTML content.
|
|
3671
|
-
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
3672
|
-
};
|
|
3673
|
-
/**
|
|
3674
|
-
* Sets the sanitizeHtmlContentHook.
|
|
3675
|
-
*
|
|
3676
|
-
* @param newHookImpl
|
|
3677
|
-
* @returns oldHookImplementation.
|
|
3678
|
-
*/
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
3682
|
-
const currentHook = sanitizeHtmlContentHook;
|
|
3683
|
-
sanitizeHtmlContentHook = newHookImpl;
|
|
3684
|
-
return currentHook;
|
|
3685
|
-
}
|
|
3686
|
-
/*
|
|
3687
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
3688
|
-
* All rights reserved.
|
|
3689
|
-
* SPDX-License-Identifier: MIT
|
|
3690
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3691
|
-
*/
|
|
3692
|
-
|
|
3693
3733
|
|
|
3694
3734
|
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
3695
3735
|
const SymbolIterator = Symbol.iterator;
|
|
@@ -3708,7 +3748,14 @@ var LWC = (function (exports) {
|
|
|
3708
3748
|
update: updateNodeHook,
|
|
3709
3749
|
insert: insertNodeHook,
|
|
3710
3750
|
move: insertNodeHook,
|
|
3711
|
-
remove: removeNodeHook
|
|
3751
|
+
remove: removeNodeHook,
|
|
3752
|
+
hydrate: (vNode, node) => {
|
|
3753
|
+
var _a;
|
|
3754
|
+
|
|
3755
|
+
|
|
3756
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3757
|
+
vNode.elm = node;
|
|
3758
|
+
}
|
|
3712
3759
|
};
|
|
3713
3760
|
const CommentHook = {
|
|
3714
3761
|
create: vnode => {
|
|
@@ -3726,7 +3773,14 @@ var LWC = (function (exports) {
|
|
|
3726
3773
|
update: updateNodeHook,
|
|
3727
3774
|
insert: insertNodeHook,
|
|
3728
3775
|
move: insertNodeHook,
|
|
3729
|
-
remove: removeNodeHook
|
|
3776
|
+
remove: removeNodeHook,
|
|
3777
|
+
hydrate: (vNode, node) => {
|
|
3778
|
+
var _a;
|
|
3779
|
+
|
|
3780
|
+
|
|
3781
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
3782
|
+
vNode.elm = node;
|
|
3783
|
+
}
|
|
3730
3784
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3731
3785
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3732
3786
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -3766,6 +3820,38 @@ var LWC = (function (exports) {
|
|
|
3766
3820
|
remove: (vnode, parentNode) => {
|
|
3767
3821
|
removeNodeHook(vnode, parentNode);
|
|
3768
3822
|
removeElmHook(vnode);
|
|
3823
|
+
},
|
|
3824
|
+
hydrate: (vnode, node) => {
|
|
3825
|
+
const elm = node;
|
|
3826
|
+
vnode.elm = elm;
|
|
3827
|
+
const {
|
|
3828
|
+
context
|
|
3829
|
+
} = vnode.data;
|
|
3830
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
3831
|
+
/* manual */
|
|
3832
|
+
);
|
|
3833
|
+
|
|
3834
|
+
if (isDomManual) {
|
|
3835
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
3836
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
3837
|
+
const {
|
|
3838
|
+
props
|
|
3839
|
+
} = vnode.data;
|
|
3840
|
+
|
|
3841
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
3842
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
3843
|
+
delete props.innerHTML;
|
|
3844
|
+
} else {
|
|
3845
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
hydrateElmHook(vnode);
|
|
3851
|
+
|
|
3852
|
+
if (!isDomManual) {
|
|
3853
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
3854
|
+
}
|
|
3769
3855
|
}
|
|
3770
3856
|
};
|
|
3771
3857
|
const CustomElementHook = {
|
|
@@ -3849,6 +3935,38 @@ var LWC = (function (exports) {
|
|
|
3849
3935
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
3850
3936
|
removeVM(vm);
|
|
3851
3937
|
}
|
|
3938
|
+
},
|
|
3939
|
+
hydrate: (vnode, elm) => {
|
|
3940
|
+
// the element is created, but the vm is not
|
|
3941
|
+
const {
|
|
3942
|
+
sel,
|
|
3943
|
+
mode,
|
|
3944
|
+
ctor,
|
|
3945
|
+
owner
|
|
3946
|
+
} = vnode;
|
|
3947
|
+
const def = getComponentInternalDef(ctor);
|
|
3948
|
+
createVM(elm, def, {
|
|
3949
|
+
mode,
|
|
3950
|
+
owner,
|
|
3951
|
+
tagName: sel,
|
|
3952
|
+
renderer: owner.renderer
|
|
3953
|
+
});
|
|
3954
|
+
vnode.elm = elm;
|
|
3955
|
+
const vm = getAssociatedVM(elm);
|
|
3956
|
+
allocateChildrenHook(vnode, vm);
|
|
3957
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
3958
|
+
|
|
3959
|
+
runConnectedCallback(vm);
|
|
3960
|
+
|
|
3961
|
+
if (vm.renderMode !== 0
|
|
3962
|
+
/* Light */
|
|
3963
|
+
) {
|
|
3964
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
3965
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
3966
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children);
|
|
3967
|
+
}
|
|
3968
|
+
|
|
3969
|
+
hydrateVM(vm);
|
|
3852
3970
|
}
|
|
3853
3971
|
};
|
|
3854
3972
|
|
|
@@ -4058,7 +4176,7 @@ var LWC = (function (exports) {
|
|
|
4058
4176
|
|
|
4059
4177
|
|
|
4060
4178
|
function d(value) {
|
|
4061
|
-
return value == null ? '' : value;
|
|
4179
|
+
return value == null ? '' : String(value);
|
|
4062
4180
|
} // [b]ind function
|
|
4063
4181
|
|
|
4064
4182
|
|
|
@@ -4199,6 +4317,26 @@ var LWC = (function (exports) {
|
|
|
4199
4317
|
|
|
4200
4318
|
markAsDynamicChildren(vnodes);
|
|
4201
4319
|
return vnodes;
|
|
4320
|
+
}
|
|
4321
|
+
/**
|
|
4322
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
4323
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
4324
|
+
* lwc:inner-html directive.
|
|
4325
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
4326
|
+
*/
|
|
4327
|
+
|
|
4328
|
+
|
|
4329
|
+
let sanitizeHtmlContentHook = () => {
|
|
4330
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
4331
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
4332
|
+
};
|
|
4333
|
+
/**
|
|
4334
|
+
* Sets the sanitizeHtmlContentHook.
|
|
4335
|
+
*/
|
|
4336
|
+
|
|
4337
|
+
|
|
4338
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
4339
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
4202
4340
|
} // [s]anitize [h]tml [c]ontent
|
|
4203
4341
|
|
|
4204
4342
|
|
|
@@ -4387,7 +4525,10 @@ var LWC = (function (exports) {
|
|
|
4387
4525
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4388
4526
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
4389
4527
|
}
|
|
4390
|
-
} else if (renderer.ssr) {
|
|
4528
|
+
} else if (renderer.ssr || renderer.isHydrating()) {
|
|
4529
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
4530
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
4531
|
+
// the first time the VM renders.
|
|
4391
4532
|
// native shadow or light DOM, SSR
|
|
4392
4533
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
4393
4534
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -4886,6 +5027,12 @@ var LWC = (function (exports) {
|
|
|
4886
5027
|
, vm);
|
|
4887
5028
|
}
|
|
4888
5029
|
|
|
5030
|
+
function hydrateRootElement(elm) {
|
|
5031
|
+
const vm = getAssociatedVM(elm);
|
|
5032
|
+
runConnectedCallback(vm);
|
|
5033
|
+
hydrateVM(vm);
|
|
5034
|
+
}
|
|
5035
|
+
|
|
4889
5036
|
function disconnectRootElement(elm) {
|
|
4890
5037
|
const vm = getAssociatedVM(elm);
|
|
4891
5038
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -4893,6 +5040,10 @@ var LWC = (function (exports) {
|
|
|
4893
5040
|
|
|
4894
5041
|
function appendVM(vm) {
|
|
4895
5042
|
rehydrate(vm);
|
|
5043
|
+
}
|
|
5044
|
+
|
|
5045
|
+
function hydrateVM(vm) {
|
|
5046
|
+
hydrate(vm);
|
|
4896
5047
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4897
5048
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4898
5049
|
|
|
@@ -5087,6 +5238,22 @@ var LWC = (function (exports) {
|
|
|
5087
5238
|
}
|
|
5088
5239
|
}
|
|
5089
5240
|
|
|
5241
|
+
function hydrate(vm) {
|
|
5242
|
+
if (isTrue(vm.isDirty)) {
|
|
5243
|
+
// manually diffing/patching here.
|
|
5244
|
+
// This routine is:
|
|
5245
|
+
// patchShadowRoot(vm, children);
|
|
5246
|
+
// -> addVnodes.
|
|
5247
|
+
const children = renderComponent(vm);
|
|
5248
|
+
vm.children = children;
|
|
5249
|
+
const vmChildren = vm.renderMode === 0
|
|
5250
|
+
/* Light */
|
|
5251
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
5252
|
+
hydrateChildrenHook(vmChildren, children);
|
|
5253
|
+
runRenderedCallback(vm);
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5090
5257
|
function patchShadowRoot(vm, newCh) {
|
|
5091
5258
|
const {
|
|
5092
5259
|
children: oldCh
|
|
@@ -5876,25 +6043,12 @@ var LWC = (function (exports) {
|
|
|
5876
6043
|
|
|
5877
6044
|
let hooksAreSet = false;
|
|
5878
6045
|
|
|
5879
|
-
function overrideHooks(hooks) {
|
|
5880
|
-
const oldHooks = {};
|
|
5881
|
-
|
|
5882
|
-
if (!isUndefined$1(hooks.sanitizeHtmlContent)) {
|
|
5883
|
-
oldHooks.sanitizeHtmlContent = setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5884
|
-
}
|
|
5885
|
-
|
|
5886
|
-
return oldHooks;
|
|
5887
|
-
}
|
|
5888
|
-
|
|
5889
6046
|
function setHooks(hooks) {
|
|
5890
6047
|
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
5891
|
-
overrideHooks(hooks);
|
|
5892
6048
|
hooksAreSet = true;
|
|
6049
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
5893
6050
|
}
|
|
5894
|
-
|
|
5895
|
-
function setHooksForTest(hooks) {
|
|
5896
|
-
}
|
|
5897
|
-
/* version: 2.5.6 */
|
|
6051
|
+
/* version: 2.5.10-alpha1 */
|
|
5898
6052
|
|
|
5899
6053
|
/*
|
|
5900
6054
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6029,8 +6183,19 @@ var LWC = (function (exports) {
|
|
|
6029
6183
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
6030
6184
|
}
|
|
6031
6185
|
|
|
6186
|
+
let isHydrating = false;
|
|
6187
|
+
|
|
6188
|
+
function setIsHydrating(v) {
|
|
6189
|
+
isHydrating = v;
|
|
6190
|
+
}
|
|
6191
|
+
|
|
6032
6192
|
const renderer = {
|
|
6033
6193
|
ssr: false,
|
|
6194
|
+
|
|
6195
|
+
isHydrating() {
|
|
6196
|
+
return isHydrating;
|
|
6197
|
+
},
|
|
6198
|
+
|
|
6034
6199
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
6035
6200
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
6036
6201
|
|
|
@@ -6059,6 +6224,10 @@ var LWC = (function (exports) {
|
|
|
6059
6224
|
},
|
|
6060
6225
|
|
|
6061
6226
|
attachShadow(element, options) {
|
|
6227
|
+
if (isHydrating) {
|
|
6228
|
+
return element.shadowRoot;
|
|
6229
|
+
}
|
|
6230
|
+
|
|
6062
6231
|
return element.attachShadow(options);
|
|
6063
6232
|
},
|
|
6064
6233
|
|
|
@@ -6190,57 +6359,6 @@ var LWC = (function (exports) {
|
|
|
6190
6359
|
getCustomElement,
|
|
6191
6360
|
HTMLElement: HTMLElementConstructor
|
|
6192
6361
|
};
|
|
6193
|
-
/*
|
|
6194
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6195
|
-
* All rights reserved.
|
|
6196
|
-
* SPDX-License-Identifier: MIT
|
|
6197
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6198
|
-
*/
|
|
6199
|
-
|
|
6200
|
-
/**
|
|
6201
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6202
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6203
|
-
*
|
|
6204
|
-
* @deprecated since version 1.3.11
|
|
6205
|
-
*
|
|
6206
|
-
* @example
|
|
6207
|
-
* ```
|
|
6208
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6209
|
-
* import Foo from 'ns/foo';
|
|
6210
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6211
|
-
* customElements.define('x-foo', WC);
|
|
6212
|
-
* const elm = document.createElement('x-foo');
|
|
6213
|
-
* ```
|
|
6214
|
-
*/
|
|
6215
|
-
|
|
6216
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6217
|
-
|
|
6218
|
-
return Ctor.CustomElementConstructor;
|
|
6219
|
-
}
|
|
6220
|
-
|
|
6221
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6222
|
-
const def = getComponentInternalDef(Ctor);
|
|
6223
|
-
return class extends def.bridge {
|
|
6224
|
-
constructor() {
|
|
6225
|
-
super();
|
|
6226
|
-
createVM(this, def, {
|
|
6227
|
-
mode: 'open',
|
|
6228
|
-
owner: null,
|
|
6229
|
-
tagName: this.tagName,
|
|
6230
|
-
renderer
|
|
6231
|
-
});
|
|
6232
|
-
}
|
|
6233
|
-
|
|
6234
|
-
connectedCallback() {
|
|
6235
|
-
connectRootElement(this);
|
|
6236
|
-
}
|
|
6237
|
-
|
|
6238
|
-
disconnectedCallback() {
|
|
6239
|
-
disconnectRootElement(this);
|
|
6240
|
-
}
|
|
6241
|
-
|
|
6242
|
-
};
|
|
6243
|
-
}
|
|
6244
6362
|
/*
|
|
6245
6363
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6246
6364
|
* All rights reserved.
|
|
@@ -6250,7 +6368,6 @@ var LWC = (function (exports) {
|
|
|
6250
6368
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6251
6369
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6252
6370
|
|
|
6253
|
-
|
|
6254
6371
|
const _Node$1 = Node;
|
|
6255
6372
|
const ConnectingSlot = new WeakMap();
|
|
6256
6373
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -6358,6 +6475,114 @@ var LWC = (function (exports) {
|
|
|
6358
6475
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6359
6476
|
*/
|
|
6360
6477
|
|
|
6478
|
+
|
|
6479
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
6480
|
+
if (!isFunction$1(Ctor)) {
|
|
6481
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
6482
|
+
}
|
|
6483
|
+
|
|
6484
|
+
if (!isObject(props) || isNull(props)) {
|
|
6485
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
6486
|
+
}
|
|
6487
|
+
|
|
6488
|
+
const def = getComponentInternalDef(Ctor);
|
|
6489
|
+
|
|
6490
|
+
try {
|
|
6491
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
6492
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
6493
|
+
setIsHydrating(true);
|
|
6494
|
+
createVM(element, def, {
|
|
6495
|
+
mode: 'open',
|
|
6496
|
+
owner: null,
|
|
6497
|
+
renderer,
|
|
6498
|
+
tagName: element.tagName.toLowerCase()
|
|
6499
|
+
});
|
|
6500
|
+
|
|
6501
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6502
|
+
element[key] = value;
|
|
6503
|
+
}
|
|
6504
|
+
|
|
6505
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
6506
|
+
|
|
6507
|
+
setIsHydrating(false);
|
|
6508
|
+
} catch (e) {
|
|
6509
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
6510
|
+
// the client generated DOM.
|
|
6511
|
+
|
|
6512
|
+
/* eslint-disable-next-line no-console */
|
|
6513
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
6514
|
+
setIsHydrating(false);
|
|
6515
|
+
const newElem = createElement(element.tagName, {
|
|
6516
|
+
is: Ctor,
|
|
6517
|
+
mode: 'open'
|
|
6518
|
+
});
|
|
6519
|
+
|
|
6520
|
+
for (const [key, value] of Object.entries(props)) {
|
|
6521
|
+
newElem[key] = value;
|
|
6522
|
+
}
|
|
6523
|
+
|
|
6524
|
+
element.parentNode.replaceChild(newElem, element);
|
|
6525
|
+
}
|
|
6526
|
+
}
|
|
6527
|
+
/*
|
|
6528
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6529
|
+
* All rights reserved.
|
|
6530
|
+
* SPDX-License-Identifier: MIT
|
|
6531
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6532
|
+
*/
|
|
6533
|
+
|
|
6534
|
+
/**
|
|
6535
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6536
|
+
* registered as a new element via customElements.define() at any given time.
|
|
6537
|
+
*
|
|
6538
|
+
* @deprecated since version 1.3.11
|
|
6539
|
+
*
|
|
6540
|
+
* @example
|
|
6541
|
+
* ```
|
|
6542
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
6543
|
+
* import Foo from 'ns/foo';
|
|
6544
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
6545
|
+
* customElements.define('x-foo', WC);
|
|
6546
|
+
* const elm = document.createElement('x-foo');
|
|
6547
|
+
* ```
|
|
6548
|
+
*/
|
|
6549
|
+
|
|
6550
|
+
|
|
6551
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6552
|
+
|
|
6553
|
+
return Ctor.CustomElementConstructor;
|
|
6554
|
+
}
|
|
6555
|
+
|
|
6556
|
+
function buildCustomElementConstructor(Ctor) {
|
|
6557
|
+
const def = getComponentInternalDef(Ctor);
|
|
6558
|
+
return class extends def.bridge {
|
|
6559
|
+
constructor() {
|
|
6560
|
+
super();
|
|
6561
|
+
createVM(this, def, {
|
|
6562
|
+
mode: 'open',
|
|
6563
|
+
owner: null,
|
|
6564
|
+
tagName: this.tagName,
|
|
6565
|
+
renderer
|
|
6566
|
+
});
|
|
6567
|
+
}
|
|
6568
|
+
|
|
6569
|
+
connectedCallback() {
|
|
6570
|
+
connectRootElement(this);
|
|
6571
|
+
}
|
|
6572
|
+
|
|
6573
|
+
disconnectedCallback() {
|
|
6574
|
+
disconnectRootElement(this);
|
|
6575
|
+
}
|
|
6576
|
+
|
|
6577
|
+
};
|
|
6578
|
+
}
|
|
6579
|
+
/*
|
|
6580
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6581
|
+
* All rights reserved.
|
|
6582
|
+
* SPDX-License-Identifier: MIT
|
|
6583
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6584
|
+
*/
|
|
6585
|
+
|
|
6361
6586
|
/**
|
|
6362
6587
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6363
6588
|
* This API is subject to change or being removed.
|
|
@@ -6457,7 +6682,7 @@ var LWC = (function (exports) {
|
|
|
6457
6682
|
});
|
|
6458
6683
|
freeze(LightningElement);
|
|
6459
6684
|
seal(LightningElement.prototype);
|
|
6460
|
-
/* version: 2.5.
|
|
6685
|
+
/* version: 2.5.10-alpha1 */
|
|
6461
6686
|
|
|
6462
6687
|
exports.LightningElement = LightningElement;
|
|
6463
6688
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6467,6 +6692,7 @@ var LWC = (function (exports) {
|
|
|
6467
6692
|
exports.createElement = createElement;
|
|
6468
6693
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6469
6694
|
exports.getComponentDef = getComponentDef;
|
|
6695
|
+
exports.hydrateComponent = hydrateComponent;
|
|
6470
6696
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6471
6697
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
6472
6698
|
exports.readonly = readonly;
|
|
@@ -6478,7 +6704,6 @@ var LWC = (function (exports) {
|
|
|
6478
6704
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6479
6705
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
6480
6706
|
exports.setHooks = setHooks;
|
|
6481
|
-
exports.setHooksForTest = setHooksForTest;
|
|
6482
6707
|
exports.swapComponent = swapComponent;
|
|
6483
6708
|
exports.swapStyle = swapStyle;
|
|
6484
6709
|
exports.swapTemplate = swapTemplate;
|
|
@@ -6490,4 +6715,4 @@ var LWC = (function (exports) {
|
|
|
6490
6715
|
|
|
6491
6716
|
return exports;
|
|
6492
6717
|
|
|
6493
|
-
}
|
|
6718
|
+
}({}));
|