@lwc/engine-core 5.3.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/framework/modules/attrs.d.ts +2 -1
- package/dist/framework/renderer.d.ts +1 -1
- package/dist/framework/restrictions.d.ts +0 -2
- package/dist/framework/utils.d.ts +2 -0
- package/dist/framework/vm.d.ts +0 -1
- package/dist/framework/vnodes.d.ts +4 -0
- package/dist/index.cjs.js +86 -76
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +87 -77
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (
|
|
2
|
+
* Copyright (c) 2024 Salesforce, Inc.
|
|
3
3
|
*/
|
|
4
|
-
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1,
|
|
4
|
+
import { noop, StringToLowerCase, isNull, ArrayPush as ArrayPush$1, ArrayJoin, isFrozen, isUndefined as isUndefined$1, defineProperty, ArrayIndexOf, ArraySplice, create, seal, isAPIFeatureEnabled, isArray as isArray$1, isFunction as isFunction$1, keys, hasOwnProperty as hasOwnProperty$1, entries, AriaPropNameToAttrNameMap, getPropertyDescriptor, forEach, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, freeze, isObject, KEY__SYNTHETIC_MODE, isString, assert, toString as toString$1, getOwnPropertyDescriptor as getOwnPropertyDescriptor$1, isFalse, LWC_VERSION_COMMENT_REGEX, LWC_VERSION, getOwnPropertyNames as getOwnPropertyNames$1, getOwnPropertyDescriptors, htmlPropertyToAttribute, ArraySlice, ArrayMap, KEY__SCOPED_CSS, kebabCaseToCamelCase, StringCharCodeAt, XML_NAMESPACE, XLINK_NAMESPACE, StringSlice, ArrayShift, ArrayUnshift, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, LOWEST_API_VERSION, KEY__NATIVE_GET_ELEMENT_BY_ID, KEY__NATIVE_QUERY_SELECTOR_ALL, ID_REFERENCING_ATTRIBUTES_SET, KEY__SHADOW_TOKEN, ArrayFilter, StringSplit, arrayEvery, ArrayIncludes, ArrayCopyWithin, ArrayFill, ArraySort, ArrayReverse } from '@lwc/shared';
|
|
5
5
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -354,6 +354,14 @@ function guid() {
|
|
|
354
354
|
}
|
|
355
355
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
356
356
|
}
|
|
357
|
+
function shouldUseNativeCustomElementLifecycle(ctor) {
|
|
358
|
+
if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
359
|
+
// temporary "kill switch"
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
const apiVersion = getComponentAPIVersion(ctor);
|
|
363
|
+
return isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
|
364
|
+
}
|
|
357
365
|
// Borrowed from Vue template compiler.
|
|
358
366
|
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
359
367
|
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
@@ -417,8 +425,8 @@ function isCircularModuleDependency(obj) {
|
|
|
417
425
|
}
|
|
418
426
|
|
|
419
427
|
var _a, _b;
|
|
420
|
-
const instrumentDef = (_a = globalThis
|
|
421
|
-
const instrumentInstance = (_b = globalThis
|
|
428
|
+
const instrumentDef = (_a = globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : noop;
|
|
429
|
+
const instrumentInstance = (_b = globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
|
|
422
430
|
|
|
423
431
|
/*
|
|
424
432
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -722,28 +730,6 @@ function getCustomElementRestrictionsDescriptors(elm) {
|
|
|
722
730
|
}),
|
|
723
731
|
};
|
|
724
732
|
}
|
|
725
|
-
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
726
|
-
assertNotProd(); // this method should never leak to prod
|
|
727
|
-
const originalDispatchEvent = proto.dispatchEvent;
|
|
728
|
-
return {
|
|
729
|
-
dispatchEvent: generateDataDescriptor({
|
|
730
|
-
value(event) {
|
|
731
|
-
const vm = getAssociatedVM(this);
|
|
732
|
-
if (!isNull(event) && isObject(event)) {
|
|
733
|
-
const { type } = event;
|
|
734
|
-
if (!/^[a-z][a-z0-9_]*$/.test(type)) {
|
|
735
|
-
logError(`Invalid event type "${type}" dispatched in element ${getComponentTag(vm)}.` +
|
|
736
|
-
` Event name must start with a lowercase letter and followed only lowercase` +
|
|
737
|
-
` letters, numbers, and underscores`, vm);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
// Typescript does not like it when you treat the `arguments` object as an array
|
|
741
|
-
// @ts-ignore type-mismatch
|
|
742
|
-
return originalDispatchEvent.apply(this, arguments);
|
|
743
|
-
},
|
|
744
|
-
}),
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
733
|
// This routine will prevent access to certain properties on a shadow root instance to guarantee
|
|
748
734
|
// that all components will work fine in IE11 and other browsers without shadow dom support.
|
|
749
735
|
function patchShadowRootWithRestrictions(sr) {
|
|
@@ -754,9 +740,6 @@ function patchCustomElementWithRestrictions(elm) {
|
|
|
754
740
|
const elmProto = getPrototypeOf$1(elm);
|
|
755
741
|
setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
|
|
756
742
|
}
|
|
757
|
-
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
758
|
-
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
759
|
-
}
|
|
760
743
|
|
|
761
744
|
function updateComponentValue(vm, key, newValue) {
|
|
762
745
|
const { cmpFields } = vm;
|
|
@@ -1940,9 +1923,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
1940
1923
|
},
|
|
1941
1924
|
configurable: true,
|
|
1942
1925
|
});
|
|
1943
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1944
|
-
patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
|
|
1945
|
-
}
|
|
1946
1926
|
|
|
1947
1927
|
function createObservedFieldPropertyDescriptor(key) {
|
|
1948
1928
|
return {
|
|
@@ -3163,7 +3143,6 @@ function createComponentDef(Ctor) {
|
|
|
3163
3143
|
logError(`Missing ${ctorName}.constructor, ${ctorName} should have a "constructor" property.`);
|
|
3164
3144
|
}
|
|
3165
3145
|
if (!isUndefined$1(ctorShadowSupportMode) &&
|
|
3166
|
-
ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
|
|
3167
3146
|
ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
|
|
3168
3147
|
ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
|
|
3169
3148
|
logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
@@ -3591,6 +3570,9 @@ function isVFragment(vnode) {
|
|
|
3591
3570
|
function isVScopedSlotFragment(vnode) {
|
|
3592
3571
|
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
3593
3572
|
}
|
|
3573
|
+
function isVStatic(vnode) {
|
|
3574
|
+
return vnode.type === 4 /* VNodeType.Static */;
|
|
3575
|
+
}
|
|
3594
3576
|
|
|
3595
3577
|
/*
|
|
3596
3578
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3639,6 +3621,20 @@ function patchAttributes(oldVnode, vnode, renderer) {
|
|
|
3639
3621
|
}
|
|
3640
3622
|
}
|
|
3641
3623
|
}
|
|
3624
|
+
function patchSlotAssignment(oldVnode, vnode, renderer) {
|
|
3625
|
+
const { slotAssignment } = vnode;
|
|
3626
|
+
if ((oldVnode === null || oldVnode === void 0 ? void 0 : oldVnode.slotAssignment) === slotAssignment) {
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3629
|
+
const { elm } = vnode;
|
|
3630
|
+
const { setAttribute, removeAttribute } = renderer;
|
|
3631
|
+
if (isUndefined$1(slotAssignment) || isNull(slotAssignment)) {
|
|
3632
|
+
removeAttribute(elm, 'slot');
|
|
3633
|
+
}
|
|
3634
|
+
else {
|
|
3635
|
+
setAttribute(elm, 'slot', slotAssignment);
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3642
3638
|
|
|
3643
3639
|
/*
|
|
3644
3640
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4088,6 +4084,8 @@ function mountElement(vnode, parent, anchor, renderer) {
|
|
|
4088
4084
|
}
|
|
4089
4085
|
function patchStatic(n1, n2, renderer) {
|
|
4090
4086
|
const elm = (n2.elm = n1.elm);
|
|
4087
|
+
// slotAssignments can only apply to the top level element, never to a static part.
|
|
4088
|
+
patchSlotAssignment(n1, n2, renderer);
|
|
4091
4089
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
|
4092
4090
|
applyStaticParts(elm, n2, renderer, false);
|
|
4093
4091
|
}
|
|
@@ -4109,11 +4107,13 @@ function mountStatic(vnode, parent, anchor, renderer) {
|
|
|
4109
4107
|
elm[KEY__SHADOW_STATIC] = true;
|
|
4110
4108
|
}
|
|
4111
4109
|
}
|
|
4110
|
+
// slotAssignments can only apply to the top level element, never to a static part.
|
|
4111
|
+
patchSlotAssignment(null, vnode, renderer);
|
|
4112
4112
|
insertNode(elm, parent, anchor, renderer);
|
|
4113
4113
|
applyStaticParts(elm, vnode, renderer, true);
|
|
4114
4114
|
}
|
|
4115
4115
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
4116
|
-
const { sel, owner } = vnode;
|
|
4116
|
+
const { sel, owner, ctor } = vnode;
|
|
4117
4117
|
const { createCustomElement } = renderer;
|
|
4118
4118
|
/**
|
|
4119
4119
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
@@ -4131,7 +4131,8 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4131
4131
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
4132
4132
|
// compatibility, we lower case the tagname here.
|
|
4133
4133
|
const normalizedTagname = sel.toLowerCase();
|
|
4134
|
-
const
|
|
4134
|
+
const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
|
|
4135
|
+
const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle);
|
|
4135
4136
|
vnode.elm = elm;
|
|
4136
4137
|
vnode.vm = vm;
|
|
4137
4138
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -4143,7 +4144,7 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
4143
4144
|
insertNode(elm, parent, anchor, renderer);
|
|
4144
4145
|
if (vm) {
|
|
4145
4146
|
if (process.env.IS_BROWSER) {
|
|
4146
|
-
if (!
|
|
4147
|
+
if (!useNativeLifecycle) {
|
|
4147
4148
|
if (process.env.NODE_ENV !== 'production') {
|
|
4148
4149
|
// With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
|
|
4149
4150
|
// noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
|
|
@@ -4334,6 +4335,7 @@ function patchElementPropsAndAttrsAndRefs$1(oldVnode, vnode, renderer) {
|
|
|
4334
4335
|
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
4335
4336
|
patchAttributes(oldVnode, vnode, renderer);
|
|
4336
4337
|
patchProps(oldVnode, vnode, renderer);
|
|
4338
|
+
patchSlotAssignment(oldVnode, vnode, renderer);
|
|
4337
4339
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
|
4338
4340
|
applyRefs(vnode, vnode.owner);
|
|
4339
4341
|
}
|
|
@@ -4487,7 +4489,7 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4487
4489
|
return vm;
|
|
4488
4490
|
}
|
|
4489
4491
|
function allocateInSlot(vm, children, owner) {
|
|
4490
|
-
var _a
|
|
4492
|
+
var _a;
|
|
4491
4493
|
const { cmpSlots: { slotAssignments: oldSlotsMapping }, } = vm;
|
|
4492
4494
|
const cmpSlotsMapping = create(null);
|
|
4493
4495
|
// Collect all slots into cmpSlotsMapping
|
|
@@ -4497,8 +4499,8 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4497
4499
|
continue;
|
|
4498
4500
|
}
|
|
4499
4501
|
let slotName = '';
|
|
4500
|
-
if (isVBaseElement(vnode)) {
|
|
4501
|
-
slotName = (
|
|
4502
|
+
if (isVBaseElement(vnode) || isVStatic(vnode)) {
|
|
4503
|
+
slotName = (_a = vnode.slotAssignment) !== null && _a !== void 0 ? _a : '';
|
|
4502
4504
|
}
|
|
4503
4505
|
else if (isVScopedSlotFragment(vnode)) {
|
|
4504
4506
|
slotName = vnode.slotName;
|
|
@@ -4768,6 +4770,7 @@ function st(fragment, key, parts) {
|
|
|
4768
4770
|
fragment,
|
|
4769
4771
|
owner,
|
|
4770
4772
|
parts,
|
|
4773
|
+
slotAssignment: undefined,
|
|
4771
4774
|
};
|
|
4772
4775
|
return vnode;
|
|
4773
4776
|
}
|
|
@@ -4812,7 +4815,7 @@ function h(sel, data, children = EmptyArray) {
|
|
|
4812
4815
|
}
|
|
4813
4816
|
});
|
|
4814
4817
|
}
|
|
4815
|
-
const { key } = data;
|
|
4818
|
+
const { key, slotAssignment } = data;
|
|
4816
4819
|
const vnode = {
|
|
4817
4820
|
type: 2 /* VNodeType.Element */,
|
|
4818
4821
|
sel,
|
|
@@ -4821,6 +4824,7 @@ function h(sel, data, children = EmptyArray) {
|
|
|
4821
4824
|
elm: undefined,
|
|
4822
4825
|
key,
|
|
4823
4826
|
owner: vmBeingRendered,
|
|
4827
|
+
slotAssignment,
|
|
4824
4828
|
};
|
|
4825
4829
|
return vnode;
|
|
4826
4830
|
}
|
|
@@ -4845,6 +4849,8 @@ function s(slotName, data, children, slotset) {
|
|
|
4845
4849
|
assert.isTrue(isObject(data), `s() 2nd argument data must be an object.`);
|
|
4846
4850
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
|
4847
4851
|
}
|
|
4852
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
4853
|
+
const { renderMode, apiVersion } = vmBeingRendered;
|
|
4848
4854
|
if (!isUndefined$1(slotset) &&
|
|
4849
4855
|
!isUndefined$1(slotset.slotAssignments) &&
|
|
4850
4856
|
!isUndefined$1(slotset.slotAssignments[slotName]) &&
|
|
@@ -4867,7 +4873,6 @@ function s(slotName, data, children, slotset) {
|
|
|
4867
4873
|
}
|
|
4868
4874
|
// If the passed slot content is factory, evaluate it and add the produced vnodes
|
|
4869
4875
|
if (assignedNodeIsScopedSlot) {
|
|
4870
|
-
const vmBeingRenderedInception = getVMBeingRendered();
|
|
4871
4876
|
// Evaluate in the scope of the slot content's owner
|
|
4872
4877
|
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
4873
4878
|
// undefined is for root components, but root components cannot accept slotted content
|
|
@@ -4881,20 +4886,33 @@ function s(slotName, data, children, slotset) {
|
|
|
4881
4886
|
});
|
|
4882
4887
|
}
|
|
4883
4888
|
finally {
|
|
4884
|
-
setVMBeingRendered(
|
|
4889
|
+
setVMBeingRendered(vmBeingRendered);
|
|
4885
4890
|
}
|
|
4886
4891
|
}
|
|
4887
4892
|
else {
|
|
4893
|
+
// This block is for standard slots (non-scoped slots)
|
|
4894
|
+
let clonedVNode;
|
|
4895
|
+
if (renderMode === 0 /* RenderMode.Light */ &&
|
|
4896
|
+
isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) &&
|
|
4897
|
+
(isVBaseElement(vnode) || isVStatic(vnode)) &&
|
|
4898
|
+
// We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
|
|
4899
|
+
// disconnected/connected callback firing.
|
|
4900
|
+
vnode.slotAssignment !== data.slotAssignment) {
|
|
4901
|
+
// When the light DOM slot assignment (slot attribute) changes we can't use the same reference
|
|
4902
|
+
// to the vnode because the current way the diffing algo works, it will replace the original reference
|
|
4903
|
+
// to the host element with a new one. This means the new element will be mounted and immediately unmounted.
|
|
4904
|
+
// Creating a copy of the vnode to preserve a reference to the previous host element.
|
|
4905
|
+
clonedVNode = Object.assign(Object.assign({}, vnode), { slotAssignment: data.slotAssignment });
|
|
4906
|
+
}
|
|
4888
4907
|
// If the slot content is standard type, the content is static, no additional
|
|
4889
4908
|
// processing needed on the vnode
|
|
4890
|
-
ArrayPush$1.call(newChildren, vnode);
|
|
4909
|
+
ArrayPush$1.call(newChildren, clonedVNode !== null && clonedVNode !== void 0 ? clonedVNode : vnode);
|
|
4891
4910
|
}
|
|
4892
4911
|
}
|
|
4893
4912
|
}
|
|
4894
4913
|
children = newChildren;
|
|
4895
4914
|
}
|
|
4896
|
-
const
|
|
4897
|
-
const { renderMode, shadowMode, apiVersion } = vmBeingRendered;
|
|
4915
|
+
const { shadowMode } = vmBeingRendered;
|
|
4898
4916
|
if (renderMode === 0 /* RenderMode.Light */) {
|
|
4899
4917
|
// light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
|
|
4900
4918
|
if (isAPIFeatureEnabled(2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */, apiVersion)) {
|
|
@@ -4936,7 +4954,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
4936
4954
|
});
|
|
4937
4955
|
}
|
|
4938
4956
|
}
|
|
4939
|
-
const { key } = data;
|
|
4957
|
+
const { key, slotAssignment } = data;
|
|
4940
4958
|
let elm, aChildren, vm;
|
|
4941
4959
|
const vnode = {
|
|
4942
4960
|
type: 3 /* VNodeType.CustomElement */,
|
|
@@ -4945,6 +4963,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
4945
4963
|
children,
|
|
4946
4964
|
elm,
|
|
4947
4965
|
key,
|
|
4966
|
+
slotAssignment,
|
|
4948
4967
|
ctor: Ctor,
|
|
4949
4968
|
owner: vmBeingRendered,
|
|
4950
4969
|
mode: 'open', // TODO [#1294]: this should be defined in Ctor
|
|
@@ -5459,7 +5478,6 @@ const parseSVGFragment = buildParseFragmentFn((html, renderer) => {
|
|
|
5459
5478
|
});
|
|
5460
5479
|
function evaluateTemplate(vm, html) {
|
|
5461
5480
|
if (process.env.NODE_ENV !== 'production') {
|
|
5462
|
-
assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`);
|
|
5463
5481
|
// in dev-mode, we support hot swapping of templates, which means that
|
|
5464
5482
|
// the component instance might be attempting to use an old version of
|
|
5465
5483
|
// the template, while internally, we have a replacement for it.
|
|
@@ -5478,6 +5496,10 @@ function evaluateTemplate(vm, html) {
|
|
|
5478
5496
|
tro.observe(() => {
|
|
5479
5497
|
// Reset the cache memoizer for template when needed.
|
|
5480
5498
|
if (html !== cmpTemplate) {
|
|
5499
|
+
// Check that the template was built by the compiler.
|
|
5500
|
+
if (!isTemplateRegistered(html)) {
|
|
5501
|
+
throw new TypeError(`Invalid template returned by the render() method on ${vm.tagName}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${toString$1(html)}.`);
|
|
5502
|
+
}
|
|
5481
5503
|
if (process.env.NODE_ENV !== 'production') {
|
|
5482
5504
|
validateLightDomTemplate(html, vm);
|
|
5483
5505
|
}
|
|
@@ -5489,10 +5511,6 @@ function evaluateTemplate(vm, html) {
|
|
|
5489
5511
|
// and snabbdom just rely on the IDs.
|
|
5490
5512
|
resetComponentRoot(vm);
|
|
5491
5513
|
}
|
|
5492
|
-
// Check that the template was built by the compiler.
|
|
5493
|
-
if (!isTemplateRegistered(html)) {
|
|
5494
|
-
throw new TypeError(`Invalid template returned by the render() method on ${vm}. It must return an imported template (e.g.: \`import html from "./${vm.def.name}.html"\`), instead, it has returned: ${toString$1(html)}.`);
|
|
5495
|
-
}
|
|
5496
5514
|
vm.cmpTemplate = html;
|
|
5497
5515
|
// Create a brand new template cache for the swapped templated.
|
|
5498
5516
|
context.tplCache = create(null);
|
|
@@ -5794,7 +5812,7 @@ function resetComponentStateWhenRemoved(vm) {
|
|
|
5794
5812
|
// old vnode.children is removed from the DOM.
|
|
5795
5813
|
function removeVM(vm) {
|
|
5796
5814
|
if (process.env.NODE_ENV !== 'production') {
|
|
5797
|
-
if (!
|
|
5815
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
|
|
5798
5816
|
// With native lifecycle, we cannot be certain that connectedCallback was called before a component
|
|
5799
5817
|
// was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
|
|
5800
5818
|
// in native mode, although it will fire in synthetic mode due to appendChild triggering it.
|
|
@@ -5966,36 +5984,28 @@ function computeShadowMode(def, owner, renderer) {
|
|
|
5966
5984
|
}
|
|
5967
5985
|
const { isSyntheticShadowDefined } = renderer;
|
|
5968
5986
|
let shadowMode;
|
|
5969
|
-
// If ENABLE_FORCE_SHADOW_MIGRATE_MODE is true, then ShadowMode.Synthetic here will mean "force-migrate" mode.
|
|
5970
5987
|
if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
|
5971
5988
|
if (def.renderMode === 0 /* RenderMode.Light */) {
|
|
5972
5989
|
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
5973
5990
|
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
5974
5991
|
shadowMode = 0 /* ShadowMode.Native */;
|
|
5975
5992
|
}
|
|
5976
|
-
else if (
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5993
|
+
else if (def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
|
|
5994
|
+
shadowMode = 0 /* ShadowMode.Native */;
|
|
5995
|
+
}
|
|
5996
|
+
else {
|
|
5997
|
+
const shadowAncestor = getNearestShadowAncestor(owner);
|
|
5998
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
|
|
5999
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6000
|
+
// transitively opts all of its descendants into native.
|
|
5980
6001
|
shadowMode = 0 /* ShadowMode.Native */;
|
|
5981
6002
|
}
|
|
5982
6003
|
else {
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
// transitively opts all of its descendants into native.
|
|
5987
|
-
shadowMode = 0 /* ShadowMode.Native */;
|
|
5988
|
-
}
|
|
5989
|
-
else {
|
|
5990
|
-
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5991
|
-
// to be native.
|
|
5992
|
-
shadowMode = 1 /* ShadowMode.Synthetic */;
|
|
5993
|
-
}
|
|
6004
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6005
|
+
// to be native.
|
|
6006
|
+
shadowMode = 1 /* ShadowMode.Synthetic */;
|
|
5994
6007
|
}
|
|
5995
6008
|
}
|
|
5996
|
-
else {
|
|
5997
|
-
shadowMode = 1 /* ShadowMode.Synthetic */;
|
|
5998
|
-
}
|
|
5999
6009
|
}
|
|
6000
6010
|
else {
|
|
6001
6011
|
// Native if the synthetic shadow polyfill is unavailable.
|
|
@@ -6122,7 +6132,7 @@ function runConnectedCallback(vm) {
|
|
|
6122
6132
|
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
|
|
6123
6133
|
// we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
|
|
6124
6134
|
if (process.env.IS_BROWSER &&
|
|
6125
|
-
!
|
|
6135
|
+
!shouldUseNativeCustomElementLifecycle(vm.component.constructor) &&
|
|
6126
6136
|
(process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
|
|
6127
6137
|
if (!vm.renderer.isConnected(vm.elm)) {
|
|
6128
6138
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6370,12 +6380,12 @@ function resetRefVNodes(vm) {
|
|
|
6370
6380
|
// See: https://sfdc.co/synthetic-aria
|
|
6371
6381
|
//
|
|
6372
6382
|
// Use the unpatched native getElementById/querySelectorAll rather than the synthetic one
|
|
6373
|
-
const getElementById = globalThis
|
|
6374
|
-
const querySelectorAll = globalThis
|
|
6383
|
+
const getElementById = globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6384
|
+
const querySelectorAll = globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6375
6385
|
// This is a "handoff" from synthetic-shadow to engine-core – we want to clean up after ourselves
|
|
6376
6386
|
// so nobody else can misuse these global APIs.
|
|
6377
|
-
delete globalThis
|
|
6378
|
-
delete globalThis
|
|
6387
|
+
delete globalThis[KEY__NATIVE_GET_ELEMENT_BY_ID];
|
|
6388
|
+
delete globalThis[KEY__NATIVE_QUERY_SELECTOR_ALL];
|
|
6379
6389
|
function isSyntheticShadowRootInstance(rootNode) {
|
|
6380
6390
|
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
6381
6391
|
}
|
|
@@ -7384,5 +7394,5 @@ function readonly(obj) {
|
|
|
7384
7394
|
}
|
|
7385
7395
|
|
|
7386
7396
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
7387
|
-
/** version:
|
|
7397
|
+
/** version: 6.1.0 */
|
|
7388
7398
|
//# sourceMappingURL=index.js.map
|