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
|
@@ -302,7 +302,7 @@ var LWC = (function (exports) {
|
|
|
302
302
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
303
303
|
return attributeName;
|
|
304
304
|
}
|
|
305
|
-
/** version: 2.5.
|
|
305
|
+
/** version: 2.5.8 */
|
|
306
306
|
|
|
307
307
|
/*
|
|
308
308
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -482,7 +482,7 @@ var LWC = (function (exports) {
|
|
|
482
482
|
setFeatureFlag(name, value);
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
/** version: 2.5.
|
|
485
|
+
/** version: 2.5.8 */
|
|
486
486
|
|
|
487
487
|
/* proxy-compat-disable */
|
|
488
488
|
|
|
@@ -534,6 +534,28 @@ var LWC = (function (exports) {
|
|
|
534
534
|
}
|
|
535
535
|
|
|
536
536
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
537
|
+
} // Borrowed from Vue template compiler.
|
|
538
|
+
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
542
|
+
const PROPERTY_DELIMITER = /:(.+)/;
|
|
543
|
+
|
|
544
|
+
function parseStyleText(cssText) {
|
|
545
|
+
const styleMap = {};
|
|
546
|
+
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
547
|
+
|
|
548
|
+
for (const declaration of declarations) {
|
|
549
|
+
if (declaration) {
|
|
550
|
+
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
551
|
+
|
|
552
|
+
if (prop !== undefined && value !== undefined) {
|
|
553
|
+
styleMap[prop.trim()] = value.trim();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return styleMap;
|
|
537
559
|
}
|
|
538
560
|
/*
|
|
539
561
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -715,8 +737,8 @@ var LWC = (function (exports) {
|
|
|
715
737
|
*/
|
|
716
738
|
|
|
717
739
|
|
|
718
|
-
function
|
|
719
|
-
let msg = `[LWC
|
|
740
|
+
function log(method, message, vm) {
|
|
741
|
+
let msg = `[LWC ${method}]: ${message}`;
|
|
720
742
|
|
|
721
743
|
if (!isUndefined$1(vm)) {
|
|
722
744
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
@@ -724,7 +746,7 @@ var LWC = (function (exports) {
|
|
|
724
746
|
|
|
725
747
|
if (process.env.NODE_ENV === 'test') {
|
|
726
748
|
/* eslint-disable-next-line no-console */
|
|
727
|
-
console
|
|
749
|
+
console[method](msg);
|
|
728
750
|
return;
|
|
729
751
|
}
|
|
730
752
|
|
|
@@ -732,9 +754,17 @@ var LWC = (function (exports) {
|
|
|
732
754
|
throw new Error(msg);
|
|
733
755
|
} catch (e) {
|
|
734
756
|
/* eslint-disable-next-line no-console */
|
|
735
|
-
console
|
|
757
|
+
console[method](e);
|
|
736
758
|
}
|
|
737
759
|
}
|
|
760
|
+
|
|
761
|
+
function logError(message, vm) {
|
|
762
|
+
log('error', message, vm);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function logWarn(message, vm) {
|
|
766
|
+
log('warn', message, vm);
|
|
767
|
+
}
|
|
738
768
|
/*
|
|
739
769
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
740
770
|
* All rights reserved.
|
|
@@ -3098,8 +3128,10 @@ var LWC = (function (exports) {
|
|
|
3098
3128
|
}
|
|
3099
3129
|
|
|
3100
3130
|
return renderer[rendererMethod](elm);
|
|
3101
|
-
}
|
|
3131
|
+
},
|
|
3102
3132
|
|
|
3133
|
+
configurable: true,
|
|
3134
|
+
enumerable: true
|
|
3103
3135
|
};
|
|
3104
3136
|
}
|
|
3105
3137
|
|
|
@@ -3119,8 +3151,11 @@ var LWC = (function (exports) {
|
|
|
3119
3151
|
}
|
|
3120
3152
|
|
|
3121
3153
|
return renderer[queryMethod](elm, arg);
|
|
3122
|
-
}
|
|
3154
|
+
},
|
|
3123
3155
|
|
|
3156
|
+
configurable: true,
|
|
3157
|
+
enumerable: true,
|
|
3158
|
+
writable: true
|
|
3124
3159
|
};
|
|
3125
3160
|
}
|
|
3126
3161
|
|
|
@@ -3715,15 +3750,14 @@ var LWC = (function (exports) {
|
|
|
3715
3750
|
return tpl;
|
|
3716
3751
|
}
|
|
3717
3752
|
/**
|
|
3718
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker
|
|
3719
|
-
*
|
|
3720
|
-
* This API is subject to change or being removed.
|
|
3753
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
3754
|
+
* libraries to sanitize vulnerable attributes.
|
|
3721
3755
|
*/
|
|
3722
3756
|
|
|
3723
3757
|
|
|
3724
3758
|
function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
|
|
3725
|
-
// locker-service patches this function during runtime to sanitize vulnerable attributes.
|
|
3726
|
-
//
|
|
3759
|
+
// locker-service patches this function during runtime to sanitize vulnerable attributes. When
|
|
3760
|
+
// ran off-core this function becomes a noop and returns the user authored value.
|
|
3727
3761
|
return attrValue;
|
|
3728
3762
|
}
|
|
3729
3763
|
/*
|
|
@@ -4279,7 +4313,7 @@ var LWC = (function (exports) {
|
|
|
4279
4313
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4280
4314
|
assert.invariant(ctorShadowSupportMode === "any"
|
|
4281
4315
|
/* Any */
|
|
4282
|
-
|| ctorShadowSupportMode === "
|
|
4316
|
+
|| ctorShadowSupportMode === "reset"
|
|
4283
4317
|
/* Default */
|
|
4284
4318
|
, `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
4285
4319
|
}
|
|
@@ -4441,7 +4475,7 @@ var LWC = (function (exports) {
|
|
|
4441
4475
|
renderMode: 1
|
|
4442
4476
|
/* Shadow */
|
|
4443
4477
|
,
|
|
4444
|
-
shadowSupportMode: "
|
|
4478
|
+
shadowSupportMode: "reset"
|
|
4445
4479
|
/* Default */
|
|
4446
4480
|
,
|
|
4447
4481
|
wire: EmptyObject,
|
|
@@ -4590,6 +4624,17 @@ var LWC = (function (exports) {
|
|
|
4590
4624
|
modComputedStyle.create(vnode);
|
|
4591
4625
|
}
|
|
4592
4626
|
|
|
4627
|
+
function hydrateElmHook(vnode) {
|
|
4628
|
+
modEvents.create(vnode); // Attrs are already on the element.
|
|
4629
|
+
// modAttrs.create(vnode);
|
|
4630
|
+
|
|
4631
|
+
modProps.create(vnode); // Already set.
|
|
4632
|
+
// modStaticClassName.create(vnode);
|
|
4633
|
+
// modStaticStyle.create(vnode);
|
|
4634
|
+
// modComputedClassName.create(vnode);
|
|
4635
|
+
// modComputedStyle.create(vnode);
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4593
4638
|
function fallbackElmHook(elm, vnode) {
|
|
4594
4639
|
const {
|
|
4595
4640
|
owner
|
|
@@ -4761,6 +4806,179 @@ var LWC = (function (exports) {
|
|
|
4761
4806
|
}
|
|
4762
4807
|
}
|
|
4763
4808
|
|
|
4809
|
+
function isElementNode(node) {
|
|
4810
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4811
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
4812
|
+
}
|
|
4813
|
+
|
|
4814
|
+
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4815
|
+
const {
|
|
4816
|
+
data: {
|
|
4817
|
+
attrs = {}
|
|
4818
|
+
},
|
|
4819
|
+
owner: {
|
|
4820
|
+
renderer
|
|
4821
|
+
}
|
|
4822
|
+
} = vnode;
|
|
4823
|
+
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4824
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4825
|
+
|
|
4826
|
+
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4827
|
+
const elmAttrValue = renderer.getAttribute(elm, attrName);
|
|
4828
|
+
|
|
4829
|
+
if (attrValue !== elmAttrValue) {
|
|
4830
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4831
|
+
nodesAreCompatible = false;
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4835
|
+
return nodesAreCompatible;
|
|
4836
|
+
}
|
|
4837
|
+
|
|
4838
|
+
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4839
|
+
const {
|
|
4840
|
+
data: {
|
|
4841
|
+
className,
|
|
4842
|
+
classMap
|
|
4843
|
+
},
|
|
4844
|
+
owner: {
|
|
4845
|
+
renderer
|
|
4846
|
+
}
|
|
4847
|
+
} = vnode;
|
|
4848
|
+
let nodesAreCompatible = true;
|
|
4849
|
+
let vnodeClassName;
|
|
4850
|
+
|
|
4851
|
+
if (!isUndefined$1(className) && className !== elm.className) {
|
|
4852
|
+
// className is used when class is bound to an expr.
|
|
4853
|
+
nodesAreCompatible = false;
|
|
4854
|
+
vnodeClassName = className;
|
|
4855
|
+
} else if (!isUndefined$1(classMap)) {
|
|
4856
|
+
// classMap is used when class is set to static value.
|
|
4857
|
+
const classList = renderer.getClassList(elm);
|
|
4858
|
+
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4859
|
+
|
|
4860
|
+
for (const name in classMap) {
|
|
4861
|
+
computedClassName += ' ' + name;
|
|
4862
|
+
|
|
4863
|
+
if (!classList.contains(name)) {
|
|
4864
|
+
nodesAreCompatible = false;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
|
|
4868
|
+
vnodeClassName = computedClassName.trim();
|
|
4869
|
+
|
|
4870
|
+
if (classList.length > keys(classMap).length) {
|
|
4871
|
+
nodesAreCompatible = false;
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4874
|
+
|
|
4875
|
+
if (!nodesAreCompatible) {
|
|
4876
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4877
|
+
}
|
|
4878
|
+
|
|
4879
|
+
return nodesAreCompatible;
|
|
4880
|
+
}
|
|
4881
|
+
|
|
4882
|
+
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4883
|
+
const {
|
|
4884
|
+
data: {
|
|
4885
|
+
style,
|
|
4886
|
+
styleDecls
|
|
4887
|
+
},
|
|
4888
|
+
owner: {
|
|
4889
|
+
renderer
|
|
4890
|
+
}
|
|
4891
|
+
} = vnode;
|
|
4892
|
+
const elmStyle = renderer.getAttribute(elm, 'style') || '';
|
|
4893
|
+
let vnodeStyle;
|
|
4894
|
+
let nodesAreCompatible = true;
|
|
4895
|
+
|
|
4896
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4897
|
+
nodesAreCompatible = false;
|
|
4898
|
+
vnodeStyle = style;
|
|
4899
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
4900
|
+
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4901
|
+
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4902
|
+
|
|
4903
|
+
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4904
|
+
const [prop, value, important] = styleDecls[i];
|
|
4905
|
+
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4906
|
+
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4907
|
+
|
|
4908
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
4909
|
+
nodesAreCompatible = false;
|
|
4910
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
4911
|
+
nodesAreCompatible = false;
|
|
4912
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4913
|
+
nodesAreCompatible = false;
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4917
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4918
|
+
nodesAreCompatible = false;
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4921
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4922
|
+
}
|
|
4923
|
+
|
|
4924
|
+
if (!nodesAreCompatible) {
|
|
4925
|
+
// style is used when class is bound to an expr.
|
|
4926
|
+
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4927
|
+
}
|
|
4928
|
+
|
|
4929
|
+
return nodesAreCompatible;
|
|
4930
|
+
}
|
|
4931
|
+
|
|
4932
|
+
function throwHydrationError() {
|
|
4933
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4934
|
+
}
|
|
4935
|
+
|
|
4936
|
+
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4937
|
+
var _a, _b;
|
|
4938
|
+
|
|
4939
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4940
|
+
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4941
|
+
|
|
4942
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
4943
|
+
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4944
|
+
throwHydrationError();
|
|
4945
|
+
}
|
|
4946
|
+
}
|
|
4947
|
+
|
|
4948
|
+
let elmCurrentChildIdx = 0;
|
|
4949
|
+
|
|
4950
|
+
for (let j = 0, n = children.length; j < n; j++) {
|
|
4951
|
+
const ch = children[j];
|
|
4952
|
+
|
|
4953
|
+
if (ch != null) {
|
|
4954
|
+
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4955
|
+
|
|
4956
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4957
|
+
// VComments and VTexts validation is handled in their hooks
|
|
4958
|
+
if (isElementNode(childNode)) {
|
|
4959
|
+
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4960
|
+
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4961
|
+
throwHydrationError();
|
|
4962
|
+
} // Note: props are not yet set
|
|
4963
|
+
|
|
4964
|
+
|
|
4965
|
+
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4966
|
+
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4967
|
+
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4968
|
+
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4969
|
+
|
|
4970
|
+
if (!isVNodeAndElementCompatible) {
|
|
4971
|
+
throwHydrationError();
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
ch.hook.hydrate(ch, childNode);
|
|
4977
|
+
elmCurrentChildIdx++;
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4981
|
+
|
|
4764
4982
|
function updateCustomElmHook(oldVnode, vnode) {
|
|
4765
4983
|
// Attrs need to be applied to element before props
|
|
4766
4984
|
// IE11 will wipe out value on radio inputs if value
|
|
@@ -4862,7 +5080,26 @@ var LWC = (function (exports) {
|
|
|
4862
5080
|
update: updateNodeHook,
|
|
4863
5081
|
insert: insertNodeHook,
|
|
4864
5082
|
move: insertNodeHook,
|
|
4865
|
-
remove: removeNodeHook
|
|
5083
|
+
remove: removeNodeHook,
|
|
5084
|
+
hydrate: (vNode, node) => {
|
|
5085
|
+
var _a;
|
|
5086
|
+
|
|
5087
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5088
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5089
|
+
if (node.nodeType !== Node.TEXT_NODE) {
|
|
5090
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5091
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5092
|
+
}
|
|
5093
|
+
|
|
5094
|
+
if (node.nodeValue !== vNode.text) {
|
|
5095
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
5096
|
+
}
|
|
5097
|
+
} // always set the text value to the one from the vnode.
|
|
5098
|
+
|
|
5099
|
+
|
|
5100
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5101
|
+
vNode.elm = node;
|
|
5102
|
+
}
|
|
4866
5103
|
};
|
|
4867
5104
|
const CommentHook = {
|
|
4868
5105
|
create: vnode => {
|
|
@@ -4880,7 +5117,26 @@ var LWC = (function (exports) {
|
|
|
4880
5117
|
update: updateNodeHook,
|
|
4881
5118
|
insert: insertNodeHook,
|
|
4882
5119
|
move: insertNodeHook,
|
|
4883
|
-
remove: removeNodeHook
|
|
5120
|
+
remove: removeNodeHook,
|
|
5121
|
+
hydrate: (vNode, node) => {
|
|
5122
|
+
var _a;
|
|
5123
|
+
|
|
5124
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5125
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5126
|
+
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5127
|
+
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5128
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5129
|
+
}
|
|
5130
|
+
|
|
5131
|
+
if (node.nodeValue !== vNode.text) {
|
|
5132
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5133
|
+
}
|
|
5134
|
+
} // always set the text value to the one from the vnode.
|
|
5135
|
+
|
|
5136
|
+
|
|
5137
|
+
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5138
|
+
vNode.elm = node;
|
|
5139
|
+
}
|
|
4884
5140
|
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4885
5141
|
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4886
5142
|
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
@@ -4920,6 +5176,38 @@ var LWC = (function (exports) {
|
|
|
4920
5176
|
remove: (vnode, parentNode) => {
|
|
4921
5177
|
removeNodeHook(vnode, parentNode);
|
|
4922
5178
|
removeElmHook(vnode);
|
|
5179
|
+
},
|
|
5180
|
+
hydrate: (vnode, node) => {
|
|
5181
|
+
const elm = node;
|
|
5182
|
+
vnode.elm = elm;
|
|
5183
|
+
const {
|
|
5184
|
+
context
|
|
5185
|
+
} = vnode.data;
|
|
5186
|
+
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5187
|
+
/* manual */
|
|
5188
|
+
);
|
|
5189
|
+
|
|
5190
|
+
if (isDomManual) {
|
|
5191
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5192
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5193
|
+
const {
|
|
5194
|
+
props
|
|
5195
|
+
} = vnode.data;
|
|
5196
|
+
|
|
5197
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5198
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
5199
|
+
delete props.innerHTML;
|
|
5200
|
+
} else {
|
|
5201
|
+
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5202
|
+
}
|
|
5203
|
+
}
|
|
5204
|
+
}
|
|
5205
|
+
|
|
5206
|
+
hydrateElmHook(vnode);
|
|
5207
|
+
|
|
5208
|
+
if (!isDomManual) {
|
|
5209
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5210
|
+
}
|
|
4923
5211
|
}
|
|
4924
5212
|
};
|
|
4925
5213
|
const CustomElementHook = {
|
|
@@ -5011,6 +5299,44 @@ var LWC = (function (exports) {
|
|
|
5011
5299
|
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
5012
5300
|
removeVM(vm);
|
|
5013
5301
|
}
|
|
5302
|
+
},
|
|
5303
|
+
hydrate: (vnode, elm) => {
|
|
5304
|
+
// the element is created, but the vm is not
|
|
5305
|
+
const {
|
|
5306
|
+
sel,
|
|
5307
|
+
mode,
|
|
5308
|
+
ctor,
|
|
5309
|
+
owner
|
|
5310
|
+
} = vnode;
|
|
5311
|
+
const def = getComponentInternalDef(ctor);
|
|
5312
|
+
createVM(elm, def, {
|
|
5313
|
+
mode,
|
|
5314
|
+
owner,
|
|
5315
|
+
tagName: sel,
|
|
5316
|
+
renderer: owner.renderer
|
|
5317
|
+
});
|
|
5318
|
+
vnode.elm = elm;
|
|
5319
|
+
const vm = getAssociatedVM(elm);
|
|
5320
|
+
allocateChildrenHook(vnode, vm);
|
|
5321
|
+
hydrateElmHook(vnode); // Insert hook section:
|
|
5322
|
+
|
|
5323
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5324
|
+
assert.isTrue(vm.state === 0
|
|
5325
|
+
/* created */
|
|
5326
|
+
, `${vm} cannot be recycled.`);
|
|
5327
|
+
}
|
|
5328
|
+
|
|
5329
|
+
runConnectedCallback(vm);
|
|
5330
|
+
|
|
5331
|
+
if (vm.renderMode !== 0
|
|
5332
|
+
/* Light */
|
|
5333
|
+
) {
|
|
5334
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5335
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5336
|
+
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5337
|
+
}
|
|
5338
|
+
|
|
5339
|
+
hydrateVM(vm);
|
|
5014
5340
|
}
|
|
5015
5341
|
};
|
|
5016
5342
|
|
|
@@ -5219,7 +5545,7 @@ var LWC = (function (exports) {
|
|
|
5219
5545
|
next = iterator.next();
|
|
5220
5546
|
last = next.done; // template factory logic based on the previous collected value
|
|
5221
5547
|
|
|
5222
|
-
const vnode = factory(value, j, j === 0, last);
|
|
5548
|
+
const vnode = factory(value, j, j === 0, last === true);
|
|
5223
5549
|
|
|
5224
5550
|
if (isArray$1(vnode)) {
|
|
5225
5551
|
ArrayPush$1.apply(list, vnode);
|
|
@@ -5486,24 +5812,48 @@ var LWC = (function (exports) {
|
|
|
5486
5812
|
markAsDynamicChildren(vnodes);
|
|
5487
5813
|
return vnodes;
|
|
5488
5814
|
}
|
|
5815
|
+
/**
|
|
5816
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
5817
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
|
5818
|
+
* lwc:inner-html directive.
|
|
5819
|
+
* It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.
|
|
5820
|
+
*/
|
|
5489
5821
|
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5822
|
+
|
|
5823
|
+
let sanitizeHtmlContentHook = () => {
|
|
5824
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
|
5825
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
|
5826
|
+
};
|
|
5827
|
+
/**
|
|
5828
|
+
* Sets the sanitizeHtmlContentHook.
|
|
5829
|
+
*/
|
|
5830
|
+
|
|
5831
|
+
|
|
5832
|
+
function setSanitizeHtmlContentHook(newHookImpl) {
|
|
5833
|
+
sanitizeHtmlContentHook = newHookImpl;
|
|
5834
|
+
} // [s]anitize [h]tml [c]ontent
|
|
5835
|
+
|
|
5836
|
+
|
|
5837
|
+
function shc(content) {
|
|
5838
|
+
return sanitizeHtmlContentHook(content);
|
|
5839
|
+
}
|
|
5840
|
+
|
|
5841
|
+
const api = freeze({
|
|
5842
|
+
s,
|
|
5843
|
+
h,
|
|
5844
|
+
c,
|
|
5845
|
+
i,
|
|
5846
|
+
f,
|
|
5847
|
+
t,
|
|
5848
|
+
d,
|
|
5849
|
+
b,
|
|
5850
|
+
k,
|
|
5851
|
+
co,
|
|
5852
|
+
dc,
|
|
5853
|
+
ti,
|
|
5854
|
+
gid,
|
|
5855
|
+
fid,
|
|
5856
|
+
shc
|
|
5507
5857
|
});
|
|
5508
5858
|
/*
|
|
5509
5859
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5517,12 +5867,12 @@ var LWC = (function (exports) {
|
|
|
5517
5867
|
}
|
|
5518
5868
|
|
|
5519
5869
|
function createInlineStyleVNode(content) {
|
|
5520
|
-
return h('style', {
|
|
5870
|
+
return api.h('style', {
|
|
5521
5871
|
key: 'style',
|
|
5522
5872
|
attrs: {
|
|
5523
5873
|
type: 'text/css'
|
|
5524
5874
|
}
|
|
5525
|
-
}, [t(content)]);
|
|
5875
|
+
}, [api.t(content)]);
|
|
5526
5876
|
}
|
|
5527
5877
|
|
|
5528
5878
|
function updateStylesheetToken(vm, template) {
|
|
@@ -5675,7 +6025,10 @@ var LWC = (function (exports) {
|
|
|
5675
6025
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5676
6026
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5677
6027
|
}
|
|
5678
|
-
} else if (renderer.ssr) {
|
|
6028
|
+
} else if (renderer.ssr || renderer.isHydrating) {
|
|
6029
|
+
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
6030
|
+
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
6031
|
+
// the first time the VM renders.
|
|
5679
6032
|
// native shadow or light DOM, SSR
|
|
5680
6033
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5681
6034
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
@@ -6300,6 +6653,12 @@ var LWC = (function (exports) {
|
|
|
6300
6653
|
, vm);
|
|
6301
6654
|
}
|
|
6302
6655
|
|
|
6656
|
+
function hydrateRootElement(elm) {
|
|
6657
|
+
const vm = getAssociatedVM(elm);
|
|
6658
|
+
runConnectedCallback(vm);
|
|
6659
|
+
hydrateVM(vm);
|
|
6660
|
+
}
|
|
6661
|
+
|
|
6303
6662
|
function disconnectRootElement(elm) {
|
|
6304
6663
|
const vm = getAssociatedVM(elm);
|
|
6305
6664
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -6307,6 +6666,10 @@ var LWC = (function (exports) {
|
|
|
6307
6666
|
|
|
6308
6667
|
function appendVM(vm) {
|
|
6309
6668
|
rehydrate(vm);
|
|
6669
|
+
}
|
|
6670
|
+
|
|
6671
|
+
function hydrateVM(vm) {
|
|
6672
|
+
hydrate(vm);
|
|
6310
6673
|
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6311
6674
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
6312
6675
|
|
|
@@ -6540,6 +6903,22 @@ var LWC = (function (exports) {
|
|
|
6540
6903
|
}
|
|
6541
6904
|
}
|
|
6542
6905
|
|
|
6906
|
+
function hydrate(vm) {
|
|
6907
|
+
if (isTrue(vm.isDirty)) {
|
|
6908
|
+
// manually diffing/patching here.
|
|
6909
|
+
// This routine is:
|
|
6910
|
+
// patchShadowRoot(vm, children);
|
|
6911
|
+
// -> addVnodes.
|
|
6912
|
+
const children = renderComponent(vm);
|
|
6913
|
+
vm.children = children;
|
|
6914
|
+
const vmChildren = vm.renderMode === 0
|
|
6915
|
+
/* Light */
|
|
6916
|
+
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6917
|
+
hydrateChildrenHook(vmChildren, children, vm);
|
|
6918
|
+
runRenderedCallback(vm);
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6921
|
+
|
|
6543
6922
|
function patchShadowRoot(vm, newCh) {
|
|
6544
6923
|
const {
|
|
6545
6924
|
children: oldCh
|
|
@@ -7356,7 +7735,22 @@ var LWC = (function (exports) {
|
|
|
7356
7735
|
|
|
7357
7736
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
7358
7737
|
}
|
|
7359
|
-
/*
|
|
7738
|
+
/*
|
|
7739
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7740
|
+
* All rights reserved.
|
|
7741
|
+
* SPDX-License-Identifier: MIT
|
|
7742
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7743
|
+
*/
|
|
7744
|
+
|
|
7745
|
+
|
|
7746
|
+
let hooksAreSet = false;
|
|
7747
|
+
|
|
7748
|
+
function setHooks(hooks) {
|
|
7749
|
+
assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
|
7750
|
+
hooksAreSet = true;
|
|
7751
|
+
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7752
|
+
}
|
|
7753
|
+
/* version: 2.5.8 */
|
|
7360
7754
|
|
|
7361
7755
|
/*
|
|
7362
7756
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7377,8 +7771,11 @@ var LWC = (function (exports) {
|
|
|
7377
7771
|
};
|
|
7378
7772
|
}
|
|
7379
7773
|
|
|
7380
|
-
const globalStylesheetsParentElement = document.head || document.body || document;
|
|
7381
|
-
|
|
7774
|
+
const globalStylesheetsParentElement = document.head || document.body || document; // This check for constructable stylesheets is similar to Fast's:
|
|
7775
|
+
// https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
|
|
7776
|
+
// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
|
|
7777
|
+
|
|
7778
|
+
const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
|
|
7382
7779
|
const styleElements = create(null);
|
|
7383
7780
|
const styleSheets = create(null);
|
|
7384
7781
|
const nodesToStyleSheets = new WeakMap();
|
|
@@ -7497,8 +7894,19 @@ var LWC = (function (exports) {
|
|
|
7497
7894
|
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
7498
7895
|
}
|
|
7499
7896
|
|
|
7897
|
+
let isHydrating = false;
|
|
7898
|
+
|
|
7899
|
+
function setIsHydrating(v) {
|
|
7900
|
+
isHydrating = v;
|
|
7901
|
+
}
|
|
7902
|
+
|
|
7500
7903
|
const renderer = {
|
|
7501
7904
|
ssr: false,
|
|
7905
|
+
|
|
7906
|
+
get isHydrating() {
|
|
7907
|
+
return isHydrating;
|
|
7908
|
+
},
|
|
7909
|
+
|
|
7502
7910
|
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7503
7911
|
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7504
7912
|
|
|
@@ -7527,6 +7935,10 @@ var LWC = (function (exports) {
|
|
|
7527
7935
|
},
|
|
7528
7936
|
|
|
7529
7937
|
attachShadow(element, options) {
|
|
7938
|
+
if (isHydrating) {
|
|
7939
|
+
return element.shadowRoot;
|
|
7940
|
+
}
|
|
7941
|
+
|
|
7530
7942
|
return element.attachShadow(options);
|
|
7531
7943
|
},
|
|
7532
7944
|
|
|
@@ -7664,61 +8076,6 @@ var LWC = (function (exports) {
|
|
|
7664
8076
|
getCustomElement,
|
|
7665
8077
|
HTMLElement: HTMLElementConstructor
|
|
7666
8078
|
};
|
|
7667
|
-
/*
|
|
7668
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
7669
|
-
* All rights reserved.
|
|
7670
|
-
* SPDX-License-Identifier: MIT
|
|
7671
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7672
|
-
*/
|
|
7673
|
-
|
|
7674
|
-
/**
|
|
7675
|
-
* This function builds a Web Component class from a LWC constructor so it can be
|
|
7676
|
-
* registered as a new element via customElements.define() at any given time.
|
|
7677
|
-
*
|
|
7678
|
-
* @deprecated since version 1.3.11
|
|
7679
|
-
*
|
|
7680
|
-
* @example
|
|
7681
|
-
* ```
|
|
7682
|
-
* import { buildCustomElementConstructor } from 'lwc';
|
|
7683
|
-
* import Foo from 'ns/foo';
|
|
7684
|
-
* const WC = buildCustomElementConstructor(Foo);
|
|
7685
|
-
* customElements.define('x-foo', WC);
|
|
7686
|
-
* const elm = document.createElement('x-foo');
|
|
7687
|
-
* ```
|
|
7688
|
-
*/
|
|
7689
|
-
|
|
7690
|
-
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
7691
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
7692
|
-
/* eslint-disable-next-line no-console */
|
|
7693
|
-
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + `Use "${Ctor.name}.CustomElementConstructor" static property of the component constructor to access the corresponding custom element constructor instead.`);
|
|
7694
|
-
}
|
|
7695
|
-
|
|
7696
|
-
return Ctor.CustomElementConstructor;
|
|
7697
|
-
}
|
|
7698
|
-
|
|
7699
|
-
function buildCustomElementConstructor(Ctor) {
|
|
7700
|
-
const def = getComponentInternalDef(Ctor);
|
|
7701
|
-
return class extends def.bridge {
|
|
7702
|
-
constructor() {
|
|
7703
|
-
super();
|
|
7704
|
-
createVM(this, def, {
|
|
7705
|
-
mode: 'open',
|
|
7706
|
-
owner: null,
|
|
7707
|
-
tagName: this.tagName,
|
|
7708
|
-
renderer
|
|
7709
|
-
});
|
|
7710
|
-
}
|
|
7711
|
-
|
|
7712
|
-
connectedCallback() {
|
|
7713
|
-
connectRootElement(this);
|
|
7714
|
-
}
|
|
7715
|
-
|
|
7716
|
-
disconnectedCallback() {
|
|
7717
|
-
disconnectRootElement(this);
|
|
7718
|
-
}
|
|
7719
|
-
|
|
7720
|
-
};
|
|
7721
|
-
}
|
|
7722
8079
|
/*
|
|
7723
8080
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7724
8081
|
* All rights reserved.
|
|
@@ -7728,7 +8085,6 @@ var LWC = (function (exports) {
|
|
|
7728
8085
|
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7729
8086
|
// eslint-disable-next-line lwc-internal/no-global-node
|
|
7730
8087
|
|
|
7731
|
-
|
|
7732
8088
|
const _Node$1 = Node;
|
|
7733
8089
|
const ConnectingSlot = new WeakMap();
|
|
7734
8090
|
const DisconnectingSlot = new WeakMap();
|
|
@@ -7839,6 +8195,118 @@ var LWC = (function (exports) {
|
|
|
7839
8195
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7840
8196
|
*/
|
|
7841
8197
|
|
|
8198
|
+
|
|
8199
|
+
function hydrateComponent(element, Ctor, props = {}) {
|
|
8200
|
+
if (!isFunction$1(Ctor)) {
|
|
8201
|
+
throw new TypeError(`"hydrateComponent" expects a valid component constructor as the second parameter but instead received ${Ctor}.`);
|
|
8202
|
+
}
|
|
8203
|
+
|
|
8204
|
+
if (!isObject(props) || isNull(props)) {
|
|
8205
|
+
throw new TypeError(`"hydrateComponent" expects an object as the third parameter but instead received ${props}.`);
|
|
8206
|
+
}
|
|
8207
|
+
|
|
8208
|
+
const def = getComponentInternalDef(Ctor);
|
|
8209
|
+
|
|
8210
|
+
try {
|
|
8211
|
+
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8212
|
+
// and uses the same algo to create the stylesheets as in SSR.
|
|
8213
|
+
setIsHydrating(true);
|
|
8214
|
+
createVM(element, def, {
|
|
8215
|
+
mode: 'open',
|
|
8216
|
+
owner: null,
|
|
8217
|
+
renderer,
|
|
8218
|
+
tagName: element.tagName.toLowerCase()
|
|
8219
|
+
});
|
|
8220
|
+
|
|
8221
|
+
for (const [key, value] of Object.entries(props)) {
|
|
8222
|
+
element[key] = value;
|
|
8223
|
+
}
|
|
8224
|
+
|
|
8225
|
+
hydrateRootElement(element); // set it back since now we finished hydration.
|
|
8226
|
+
|
|
8227
|
+
setIsHydrating(false);
|
|
8228
|
+
} catch (e) {
|
|
8229
|
+
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element with
|
|
8230
|
+
// the client generated DOM.
|
|
8231
|
+
|
|
8232
|
+
/* eslint-disable-next-line no-console */
|
|
8233
|
+
console.error('Recovering from error while hydrating: ', e);
|
|
8234
|
+
setIsHydrating(false);
|
|
8235
|
+
const newElem = createElement(element.tagName, {
|
|
8236
|
+
is: Ctor,
|
|
8237
|
+
mode: 'open'
|
|
8238
|
+
});
|
|
8239
|
+
|
|
8240
|
+
for (const [key, value] of Object.entries(props)) {
|
|
8241
|
+
newElem[key] = value;
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8244
|
+
element.parentNode.replaceChild(newElem, element);
|
|
8245
|
+
}
|
|
8246
|
+
}
|
|
8247
|
+
/*
|
|
8248
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8249
|
+
* All rights reserved.
|
|
8250
|
+
* SPDX-License-Identifier: MIT
|
|
8251
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8252
|
+
*/
|
|
8253
|
+
|
|
8254
|
+
/**
|
|
8255
|
+
* This function builds a Web Component class from a LWC constructor so it can be
|
|
8256
|
+
* registered as a new element via customElements.define() at any given time.
|
|
8257
|
+
*
|
|
8258
|
+
* @deprecated since version 1.3.11
|
|
8259
|
+
*
|
|
8260
|
+
* @example
|
|
8261
|
+
* ```
|
|
8262
|
+
* import { buildCustomElementConstructor } from 'lwc';
|
|
8263
|
+
* import Foo from 'ns/foo';
|
|
8264
|
+
* const WC = buildCustomElementConstructor(Foo);
|
|
8265
|
+
* customElements.define('x-foo', WC);
|
|
8266
|
+
* const elm = document.createElement('x-foo');
|
|
8267
|
+
* ```
|
|
8268
|
+
*/
|
|
8269
|
+
|
|
8270
|
+
|
|
8271
|
+
function deprecatedBuildCustomElementConstructor(Ctor) {
|
|
8272
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
8273
|
+
/* eslint-disable-next-line no-console */
|
|
8274
|
+
console.warn('Deprecated function called: "buildCustomElementConstructor" function is deprecated and it will be removed.' + `Use "${Ctor.name}.CustomElementConstructor" static property of the component constructor to access the corresponding custom element constructor instead.`);
|
|
8275
|
+
}
|
|
8276
|
+
|
|
8277
|
+
return Ctor.CustomElementConstructor;
|
|
8278
|
+
}
|
|
8279
|
+
|
|
8280
|
+
function buildCustomElementConstructor(Ctor) {
|
|
8281
|
+
const def = getComponentInternalDef(Ctor);
|
|
8282
|
+
return class extends def.bridge {
|
|
8283
|
+
constructor() {
|
|
8284
|
+
super();
|
|
8285
|
+
createVM(this, def, {
|
|
8286
|
+
mode: 'open',
|
|
8287
|
+
owner: null,
|
|
8288
|
+
tagName: this.tagName,
|
|
8289
|
+
renderer
|
|
8290
|
+
});
|
|
8291
|
+
}
|
|
8292
|
+
|
|
8293
|
+
connectedCallback() {
|
|
8294
|
+
connectRootElement(this);
|
|
8295
|
+
}
|
|
8296
|
+
|
|
8297
|
+
disconnectedCallback() {
|
|
8298
|
+
disconnectRootElement(this);
|
|
8299
|
+
}
|
|
8300
|
+
|
|
8301
|
+
};
|
|
8302
|
+
}
|
|
8303
|
+
/*
|
|
8304
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
8305
|
+
* All rights reserved.
|
|
8306
|
+
* SPDX-License-Identifier: MIT
|
|
8307
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8308
|
+
*/
|
|
8309
|
+
|
|
7842
8310
|
/**
|
|
7843
8311
|
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
|
|
7844
8312
|
* This API is subject to change or being removed.
|
|
@@ -7938,7 +8406,7 @@ var LWC = (function (exports) {
|
|
|
7938
8406
|
});
|
|
7939
8407
|
freeze(LightningElement);
|
|
7940
8408
|
seal(LightningElement.prototype);
|
|
7941
|
-
/* version: 2.5.
|
|
8409
|
+
/* version: 2.5.8 */
|
|
7942
8410
|
|
|
7943
8411
|
exports.LightningElement = LightningElement;
|
|
7944
8412
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7948,6 +8416,7 @@ var LWC = (function (exports) {
|
|
|
7948
8416
|
exports.createElement = createElement;
|
|
7949
8417
|
exports.getComponentConstructor = getComponentConstructor;
|
|
7950
8418
|
exports.getComponentDef = getComponentDef;
|
|
8419
|
+
exports.hydrateComponent = hydrateComponent;
|
|
7951
8420
|
exports.isComponentConstructor = isComponentConstructor;
|
|
7952
8421
|
exports.isNodeFromTemplate = isNodeFromTemplate;
|
|
7953
8422
|
exports.readonly = readonly;
|
|
@@ -7958,6 +8427,7 @@ var LWC = (function (exports) {
|
|
|
7958
8427
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7959
8428
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7960
8429
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|
|
8430
|
+
exports.setHooks = setHooks;
|
|
7961
8431
|
exports.swapComponent = swapComponent;
|
|
7962
8432
|
exports.swapStyle = swapStyle;
|
|
7963
8433
|
exports.swapTemplate = swapTemplate;
|