lwc 2.5.4 → 2.5.8
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 +567 -99
- package/dist/engine-dom/iife/es2017/engine-dom.js +568 -98
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +383 -90
- package/dist/engine-dom/iife/es5/engine-dom.js +634 -150
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +430 -133
- package/dist/engine-dom/umd/es2017/engine-dom.js +568 -98
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +383 -90
- package/dist/engine-dom/umd/es5/engine-dom.js +634 -150
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +430 -133
- package/dist/engine-server/commonjs/es2017/engine-server.js +457 -49
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +457 -50
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +9 -39
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +9 -39
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +9 -39
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +9 -39
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +9 -39
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +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.8 */
|
|
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.8 */
|
|
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
|
|
|
@@ -2881,15 +2926,14 @@ var LWC = (function (exports) {
|
|
|
2881
2926
|
return tpl;
|
|
2882
2927
|
}
|
|
2883
2928
|
/**
|
|
2884
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker
|
|
2885
|
-
*
|
|
2886
|
-
* This API is subject to change or being removed.
|
|
2929
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
2930
|
+
* libraries to sanitize vulnerable attributes.
|
|
2887
2931
|
*/
|
|
2888
2932
|
|
|
2889
2933
|
|
|
2890
2934
|
function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
|
|
2891
|
-
// locker-service patches this function during runtime to sanitize vulnerable attributes.
|
|
2892
|
-
//
|
|
2935
|
+
// locker-service patches this function during runtime to sanitize vulnerable attributes. When
|
|
2936
|
+
// ran off-core this function becomes a noop and returns the user authored value.
|
|
2893
2937
|
return attrValue;
|
|
2894
2938
|
}
|
|
2895
2939
|
/*
|
|
@@ -3301,7 +3345,7 @@ var LWC = (function (exports) {
|
|
|
3301
3345
|
renderMode: 1
|
|
3302
3346
|
/* Shadow */
|
|
3303
3347
|
,
|
|
3304
|
-
shadowSupportMode: "
|
|
3348
|
+
shadowSupportMode: "reset"
|
|
3305
3349
|
/* Default */
|
|
3306
3350
|
,
|
|
3307
3351
|
wire: EmptyObject,
|
|
@@ -3427,6 +3471,17 @@ var LWC = (function (exports) {
|
|
|
3427
3471
|
modComputedStyle.create(vnode);
|
|
3428
3472
|
}
|
|
3429
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
|
+
|
|
3430
3485
|
function fallbackElmHook(elm, vnode) {
|
|
3431
3486
|
const {
|
|
3432
3487
|
owner
|
|
@@ -3576,6 +3631,22 @@ var LWC = (function (exports) {
|
|
|
3576
3631
|
}
|
|
3577
3632
|
}
|
|
3578
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
|
+
|
|
3579
3650
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
3580
3651
|
// Attrs need to be applied to element before props
|
|
3581
3652
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -3677,7 +3748,14 @@ var LWC = (function (exports) {
|
|
|
3677
3748
|
update: updateNodeHook,
|
|
3678
3749
|
insert: insertNodeHook,
|
|
3679
3750
|
move: insertNodeHook,
|
|
3680
|
-
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
|
+
}
|
|
3681
3759
|
};
|
|
3682
3760
|
const CommentHook = {
|
|
3683
3761
|
create: vnode => {
|
|
@@ -3695,7 +3773,14 @@ var LWC = (function (exports) {
|
|
|
3695
3773
|
update: updateNodeHook,
|
|
3696
3774
|
insert: insertNodeHook,
|
|
3697
3775
|
move: insertNodeHook,
|
|
3698
|
-
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
|
+
}
|
|
3699
3784
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
3700
3785
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
3701
3786
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -3735,6 +3820,38 @@ var LWC = (function (exports) {
|
|
|
3735
3820
|
remove: (vnode, parentNode) => {
|
|
3736
3821
|
removeNodeHook(vnode, parentNode);
|
|
3737
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
|
+
}
|
|
3738
3855
|
}
|
|
3739
3856
|
};
|
|
3740
3857
|
const CustomElementHook = {
|
|
@@ -3818,6 +3935,38 @@ var LWC = (function (exports) {
|
|
|
3818
3935
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
3819
3936
|
removeVM(vm);
|
|
3820
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);
|
|
3821
3970
|
}
|
|
3822
3971
|
};
|
|
3823
3972
|
|
|
@@ -3953,7 +4102,7 @@ var LWC = (function (exports) {
|
|
|
3953
4102
|
next = iterator.next();
|
|
3954
4103
|
last = next.done; // template factory logic based on the previous collected value
|
|
3955
4104
|
|
|
3956
|
-
const vnode = factory(value, j, j === 0, last);
|
|
4105
|
+
const vnode = factory(value, j, j === 0, last === true);
|
|
3957
4106
|
|
|
3958
4107
|
if (isArray$1(vnode)) {
|
|
3959
4108
|
ArrayPush$1.apply(list, vnode);
|
|
@@ -4169,24 +4318,48 @@ var LWC = (function (exports) {
|
|
|
4169
4318
|
markAsDynamicChildren(vnodes);
|
|
4170
4319
|
return vnodes;
|
|
4171
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
|
+
*/
|
|
4172
4327
|
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
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;
|
|
4340
|
+
} // [s]anitize [h]tml [c]ontent
|
|
4341
|
+
|
|
4342
|
+
|
|
4343
|
+
function shc(content) {
|
|
4344
|
+
return sanitizeHtmlContentHook(content);
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4347
|
+
const api = freeze({
|
|
4348
|
+
s,
|
|
4349
|
+
h,
|
|
4350
|
+
c,
|
|
4351
|
+
i,
|
|
4352
|
+
f,
|
|
4353
|
+
t,
|
|
4354
|
+
d,
|
|
4355
|
+
b,
|
|
4356
|
+
k,
|
|
4357
|
+
co,
|
|
4358
|
+
dc,
|
|
4359
|
+
ti,
|
|
4360
|
+
gid,
|
|
4361
|
+
fid,
|
|
4362
|
+
shc
|
|
4190
4363
|
});
|
|
4191
4364
|
/*
|
|
4192
4365
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4200,12 +4373,12 @@ var LWC = (function (exports) {
|
|
|
4200
4373
|
}
|
|
4201
4374
|
|
|
4202
4375
|
function createInlineStyleVNode(content) {
|
|
4203
|
-
return h('style', {
|
|
4376
|
+
return api.h('style', {
|
|
4204
4377
|
key: 'style',
|
|
4205
4378
|
attrs: {
|
|
4206
4379
|
type: 'text/css'
|
|
4207
4380
|
}
|
|
4208
|
-
}, [t(content)]);
|
|
4381
|
+
}, [api.t(content)]);
|
|
4209
4382
|
}
|
|
4210
4383
|
|
|
4211
4384
|
function updateStylesheetToken(vm, template) {
|
|
@@ -4352,7 +4525,10 @@ var LWC = (function (exports) {
|
|
|
4352
4525
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
4353
4526
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
4354
4527
|
}
|
|
4355
|
-
} 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.
|
|
4356
4532
|
// native shadow or light DOM, SSR
|
|
4357
4533
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
4358
4534
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -4851,6 +5027,12 @@ var LWC = (function (exports) {
|
|
|
4851
5027
|
, vm);
|
|
4852
5028
|
}
|
|
4853
5029
|
|
|
5030
|
+
function hydrateRootElement(elm) {
|
|
5031
|
+
const vm = getAssociatedVM(elm);
|
|
5032
|
+
runConnectedCallback(vm);
|
|
5033
|
+
hydrateVM(vm);
|
|
5034
|
+
}
|
|
5035
|
+
|
|
4854
5036
|
function disconnectRootElement(elm) {
|
|
4855
5037
|
const vm = getAssociatedVM(elm);
|
|
4856
5038
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -4858,6 +5040,10 @@ var LWC = (function (exports) {
|
|
|
4858
5040
|
|
|
4859
5041
|
function appendVM(vm) {
|
|
4860
5042
|
rehydrate(vm);
|
|
5043
|
+
}
|
|
5044
|
+
|
|
5045
|
+
function hydrateVM(vm) {
|
|
5046
|
+
hydrate(vm);
|
|
4861
5047
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
4862
5048
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
4863
5049
|
|
|
@@ -5052,6 +5238,22 @@ var LWC = (function (exports) {
|
|
|
5052
5238
|
}
|
|
5053
5239
|
}
|
|
5054
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
|
+
|
|
5055
5257
|
function patchShadowRoot(vm, newCh) {
|
|
5056
5258
|
const {
|
|
5057
5259
|
children: oldCh
|
|
@@ -5831,7 +6033,22 @@ var LWC = (function (exports) {
|
|
|
5831
6033
|
|
|
5832
6034
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
5833
6035
|
}
|
|
5834
|
-
/*
|
|
6036
|
+
/*
|
|
6037
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6038
|
+
* All rights reserved.
|
|
6039
|
+
* SPDX-License-Identifier: MIT
|
|
6040
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6041
|
+
*/
|
|
6042
|
+
|
|
6043
|
+
|
|
6044
|
+
let hooksAreSet = false;
|
|
6045
|
+
|
|
6046
|
+
function setHooks(hooks) {
|
|
6047
|
+
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
6048
|
+
hooksAreSet = true;
|
|
6049
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6050
|
+
}
|
|
6051
|
+
/* version: 2.5.8 */
|
|
5835
6052
|
|
|
5836
6053
|
/*
|
|
5837
6054
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5843,8 +6060,11 @@ var LWC = (function (exports) {
|
|
|
5843
6060
|
|
|
5844
6061
|
const globalStylesheets = create(null);
|
|
5845
6062
|
|
|
5846
|
-
const globalStylesheetsParentElement = document.head || document.body || document;
|
|
5847
|
-
|
|
6063
|
+
const globalStylesheetsParentElement = document.head || document.body || document; // This check for constructable stylesheets is similar to Fast's:
|
|
6064
|
+
// https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
|
|
6065
|
+
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
6066
|
+
|
|
6067
|
+
const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
5848
6068
|
const styleElements = create(null);
|
|
5849
6069
|
const styleSheets = create(null);
|
|
5850
6070
|
const nodesToStyleSheets = new WeakMap();
|
|
@@ -5963,8 +6183,19 @@ var LWC = (function (exports) {
|
|
|
5963
6183
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
5964
6184
|
}
|
|
5965
6185
|
|
|
6186
|
+
let isHydrating = false;
|
|
6187
|
+
|
|
6188
|
+
function setIsHydrating(v) {
|
|
6189
|
+
isHydrating = v;
|
|
6190
|
+
}
|
|
6191
|
+
|
|
5966
6192
|
const renderer = {
|
|
5967
6193
|
ssr: false,
|
|
6194
|
+
|
|
6195
|
+
get isHydrating() {
|
|
6196
|
+
return isHydrating;
|
|
6197
|
+
},
|
|
6198
|
+
|
|
5968
6199
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
5969
6200
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
5970
6201
|
|
|
@@ -5993,6 +6224,10 @@ var LWC = (function (exports) {
|
|
|
5993
6224
|
},
|
|
5994
6225
|
|
|
5995
6226
|
attachShadow(element, options) {
|
|
6227
|
+
if (isHydrating) {
|
|
6228
|
+
return element.shadowRoot;
|
|
6229
|
+
}
|
|
6230
|
+
|
|
5996
6231
|
return element.attachShadow(options);
|
|
5997
6232
|
},
|
|
5998
6233
|
|
|
@@ -6124,57 +6359,6 @@ var LWC = (function (exports) {
|
|
|
6124
6359
|
getCustomElement,
|
|
6125
6360
|
HTMLElement: HTMLElementConstructor
|
|
6126
6361
|
};
|
|
6127
|
-
/*
|
|
6128
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6129
|
-
* All rights reserved.
|
|
6130
|
-
* SPDX-License-Identifier: MIT
|
|
6131
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6132
|
-
*/
|
|
6133
|
-
|
|
6134
|
-
/**
|
|
6135
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
6136
|
-
* registered as a new element via customElements.define() at any given time.
|
|
6137
|
-
*
|
|
6138
|
-
* @deprecated since version 1.3.11
|
|
6139
|
-
*
|
|
6140
|
-
* @example
|
|
6141
|
-
* ```
|
|
6142
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
6143
|
-
* import Foo from 'ns/foo';
|
|
6144
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
6145
|
-
* customElements.define('x-foo', WC);
|
|
6146
|
-
* const elm = document.createElement('x-foo');
|
|
6147
|
-
* ```
|
|
6148
|
-
*/
|
|
6149
|
-
|
|
6150
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
6151
|
-
|
|
6152
|
-
return Ctor.CustomElementConstructor;
|
|
6153
|
-
}
|
|
6154
|
-
|
|
6155
|
-
function buildCustomElementConstructor(Ctor) {
|
|
6156
|
-
const def = getComponentInternalDef(Ctor);
|
|
6157
|
-
return class extends def.bridge {
|
|
6158
|
-
constructor() {
|
|
6159
|
-
super();
|
|
6160
|
-
createVM(this, def, {
|
|
6161
|
-
mode: 'open',
|
|
6162
|
-
owner: null,
|
|
6163
|
-
tagName: this.tagName,
|
|
6164
|
-
renderer
|
|
6165
|
-
});
|
|
6166
|
-
}
|
|
6167
|
-
|
|
6168
|
-
connectedCallback() {
|
|
6169
|
-
connectRootElement(this);
|
|
6170
|
-
}
|
|
6171
|
-
|
|
6172
|
-
disconnectedCallback() {
|
|
6173
|
-
disconnectRootElement(this);
|
|
6174
|
-
}
|
|
6175
|
-
|
|
6176
|
-
};
|
|
6177
|
-
}
|
|
6178
6362
|
/*
|
|
6179
6363
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6180
6364
|
* All rights reserved.
|
|
@@ -6184,7 +6368,6 @@ var LWC = (function (exports) {
|
|
|
6184
6368
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
6185
6369
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6186
6370
|
|
|
6187
|
-
|
|
6188
6371
|
const _Node$1 = Node;
|
|
6189
6372
|
const ConnectingSlot = new WeakMap();
|
|
6190
6373
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -6292,6 +6475,114 @@ var LWC = (function (exports) {
|
|
|
6292
6475
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6293
6476
|
*/
|
|
6294
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
|
+
|
|
6295
6586
|
/**
|
|
6296
6587
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
6297
6588
|
* This API is subject to change or being removed.
|
|
@@ -6391,7 +6682,7 @@ var LWC = (function (exports) {
|
|
|
6391
6682
|
});
|
|
6392
6683
|
freeze(LightningElement);
|
|
6393
6684
|
seal(LightningElement.prototype);
|
|
6394
|
-
/* version: 2.5.
|
|
6685
|
+
/* version: 2.5.8 */
|
|
6395
6686
|
|
|
6396
6687
|
exports.LightningElement = LightningElement;
|
|
6397
6688
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -6401,6 +6692,7 @@ var LWC = (function (exports) {
|
|
|
6401
6692
|
exports.createElement = createElement;
|
|
6402
6693
|
exports.getComponentConstructor = getComponentConstructor;
|
|
6403
6694
|
exports.getComponentDef = getComponentDef;
|
|
6695
|
+
exports.hydrateComponent = hydrateComponent;
|
|
6404
6696
|
exports.isComponentConstructor = isComponentConstructor;
|
|
6405
6697
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
6406
6698
|
exports.readonly = readonly;
|
|
@@ -6411,6 +6703,7 @@ var LWC = (function (exports) {
|
|
|
6411
6703
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
6412
6704
|
exports.setFeatureFlag = setFeatureFlag;
|
|
6413
6705
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
6706
|
+
exports.setHooks = setHooks;
|
|
6414
6707
|
exports.swapComponent = swapComponent;
|
|
6415
6708
|
exports.swapStyle = swapStyle;
|
|
6416
6709
|
exports.swapTemplate = swapTemplate;
|