@lwc/engine-core 3.4.0 → 3.5.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/base-lightning-element.d.ts +5 -0
- package/dist/framework/def.d.ts +5 -0
- package/dist/framework/main.d.ts +1 -1
- package/dist/framework/renderer.d.ts +1 -1
- package/dist/framework/vm.d.ts +5 -0
- package/dist/index.cjs.js +159 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +157 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -17,6 +17,7 @@ export interface LightningElementConstructor {
|
|
|
17
17
|
readonly CustomElementConstructor: HTMLElementConstructor;
|
|
18
18
|
delegatesFocus?: boolean;
|
|
19
19
|
renderMode?: 'light' | 'shadow';
|
|
20
|
+
formAssociated?: boolean;
|
|
20
21
|
shadowSupportMode?: ShadowSupportMode;
|
|
21
22
|
stylesheets: TemplateStylesheetFactories;
|
|
22
23
|
}
|
|
@@ -32,6 +33,10 @@ export interface LightningElement extends HTMLElementTheGoodParts, AccessibleEle
|
|
|
32
33
|
disconnectedCallback?(): void;
|
|
33
34
|
renderedCallback?(): void;
|
|
34
35
|
errorCallback?(error: any, stack: string): void;
|
|
36
|
+
formAssociatedCallback?(): void;
|
|
37
|
+
formResetCallback?(): void;
|
|
38
|
+
formDisabledCallback?(): void;
|
|
39
|
+
formStateRestoreCallback?(): void;
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
42
|
* This class is the base class for any LWC element.
|
package/dist/framework/def.d.ts
CHANGED
|
@@ -20,12 +20,17 @@ export interface ComponentDef {
|
|
|
20
20
|
template: Template;
|
|
21
21
|
renderMode: RenderMode;
|
|
22
22
|
shadowSupportMode: ShadowSupportMode;
|
|
23
|
+
formAssociated: boolean | undefined;
|
|
23
24
|
ctor: LightningElementConstructor;
|
|
24
25
|
bridge: HTMLElementConstructor;
|
|
25
26
|
connectedCallback?: LightningElement['connectedCallback'];
|
|
26
27
|
disconnectedCallback?: LightningElement['disconnectedCallback'];
|
|
27
28
|
renderedCallback?: LightningElement['renderedCallback'];
|
|
28
29
|
errorCallback?: LightningElement['errorCallback'];
|
|
30
|
+
formAssociatedCallback?: LightningElement['formAssociatedCallback'];
|
|
31
|
+
formResetCallback?: LightningElement['formResetCallback'];
|
|
32
|
+
formDisabledCallback?: LightningElement['formDisabledCallback'];
|
|
33
|
+
formStateRestoreCallback?: LightningElement['formStateRestoreCallback'];
|
|
29
34
|
render: LightningElement['render'];
|
|
30
35
|
}
|
|
31
36
|
/**
|
package/dist/framework/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getComponentHtmlPrototype } from './def';
|
|
2
|
-
export { RenderMode, ShadowMode, connectRootElement, createVM, disconnectRootElement, getAssociatedVMIfPresent, computeShadowAndRenderMode, } from './vm';
|
|
2
|
+
export { RenderMode, ShadowMode, connectRootElement, createVM, disconnectRootElement, getAssociatedVMIfPresent, computeShadowAndRenderMode, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, } from './vm';
|
|
3
3
|
export { createContextProviderWithRegister } from './wiring';
|
|
4
4
|
export { parseFragment, parseSVGFragment } from './template';
|
|
5
5
|
export { hydrateRoot } from './hydration';
|
|
@@ -41,7 +41,7 @@ export interface RendererAPI {
|
|
|
41
41
|
isConnected: (node: N) => boolean;
|
|
42
42
|
insertStylesheet: (content: string, target?: ShadowRoot) => void;
|
|
43
43
|
assertInstanceOfHTMLElement: (elm: any, msg: string) => void;
|
|
44
|
-
createCustomElement: (tagName: string, upgradeCallback: LifecycleCallback, connectedCallback?: LifecycleCallback, disconnectedCallback?: LifecycleCallback) => E;
|
|
44
|
+
createCustomElement: (tagName: string, upgradeCallback: LifecycleCallback, connectedCallback?: LifecycleCallback, disconnectedCallback?: LifecycleCallback, formAssociatedCallback?: LifecycleCallback, formDisabledCallback?: LifecycleCallback, formResetCallback?: LifecycleCallback, formStateRestoreCallback?: LifecycleCallback) => E;
|
|
45
45
|
ownerDocument(elm: E): Document;
|
|
46
46
|
registerContextConsumer: (element: E, adapterContextToken: string, subscriptionPayload: WireContextSubscriptionPayload) => void;
|
|
47
47
|
attachInternals: (elm: E) => ElementInternals;
|
package/dist/framework/vm.d.ts
CHANGED
|
@@ -166,4 +166,9 @@ export declare function resetComponentRoot(vm: VM): void;
|
|
|
166
166
|
export declare function scheduleRehydration(vm: VM): void;
|
|
167
167
|
export declare function runWithBoundaryProtection(vm: VM, owner: VM | null, pre: () => void, job: () => void, post: () => void): void;
|
|
168
168
|
export declare function forceRehydration(vm: VM): void;
|
|
169
|
+
export declare function runFormAssociatedCustomElementCallback(vm: VM, faceCb: () => void): void;
|
|
170
|
+
export declare function runFormAssociatedCallback(elm: HTMLElement): void;
|
|
171
|
+
export declare function runFormDisabledCallback(elm: HTMLElement): void;
|
|
172
|
+
export declare function runFormResetCallback(elm: HTMLElement): void;
|
|
173
|
+
export declare function runFormStateRestoreCallback(elm: HTMLElement): void;
|
|
169
174
|
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -523,8 +523,8 @@ function lockDomMutation() {
|
|
|
523
523
|
assertNotProd(); // this method should never leak to prod
|
|
524
524
|
isDomMutationAllowed = false;
|
|
525
525
|
}
|
|
526
|
-
function
|
|
527
|
-
return
|
|
526
|
+
function logMissingPortalWarn(name, type) {
|
|
527
|
+
return logWarn(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
|
|
528
528
|
}
|
|
529
529
|
function patchElementWithRestrictions(elm, options) {
|
|
530
530
|
assertNotProd(); // this method should never leak to prod
|
|
@@ -549,14 +549,14 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
549
549
|
shared.assign(descriptors, {
|
|
550
550
|
appendChild: generateDataDescriptor({
|
|
551
551
|
value(aChild) {
|
|
552
|
-
|
|
552
|
+
logMissingPortalWarn('appendChild', 'method');
|
|
553
553
|
return appendChild.call(this, aChild);
|
|
554
554
|
},
|
|
555
555
|
}),
|
|
556
556
|
insertBefore: generateDataDescriptor({
|
|
557
557
|
value(newNode, referenceNode) {
|
|
558
558
|
if (!isDomMutationAllowed) {
|
|
559
|
-
|
|
559
|
+
logMissingPortalWarn('insertBefore', 'method');
|
|
560
560
|
}
|
|
561
561
|
return insertBefore.call(this, newNode, referenceNode);
|
|
562
562
|
},
|
|
@@ -564,14 +564,14 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
564
564
|
removeChild: generateDataDescriptor({
|
|
565
565
|
value(aChild) {
|
|
566
566
|
if (!isDomMutationAllowed) {
|
|
567
|
-
|
|
567
|
+
logMissingPortalWarn('removeChild', 'method');
|
|
568
568
|
}
|
|
569
569
|
return removeChild.call(this, aChild);
|
|
570
570
|
},
|
|
571
571
|
}),
|
|
572
572
|
replaceChild: generateDataDescriptor({
|
|
573
573
|
value(newChild, oldChild) {
|
|
574
|
-
|
|
574
|
+
logMissingPortalWarn('replaceChild', 'method');
|
|
575
575
|
return replaceChild.call(this, newChild, oldChild);
|
|
576
576
|
},
|
|
577
577
|
}),
|
|
@@ -581,7 +581,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
581
581
|
},
|
|
582
582
|
set(value) {
|
|
583
583
|
if (!isDomMutationAllowed) {
|
|
584
|
-
|
|
584
|
+
logMissingPortalWarn('nodeValue', 'property');
|
|
585
585
|
}
|
|
586
586
|
originalNodeValueDescriptor.set.call(this, value);
|
|
587
587
|
},
|
|
@@ -591,7 +591,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
591
591
|
return originalTextContentDescriptor.get.call(this);
|
|
592
592
|
},
|
|
593
593
|
set(value) {
|
|
594
|
-
|
|
594
|
+
logMissingPortalWarn('textContent', 'property');
|
|
595
595
|
originalTextContentDescriptor.set.call(this, value);
|
|
596
596
|
},
|
|
597
597
|
}),
|
|
@@ -600,7 +600,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
600
600
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
601
601
|
},
|
|
602
602
|
set(value) {
|
|
603
|
-
|
|
603
|
+
logMissingPortalWarn('innerHTML', 'property');
|
|
604
604
|
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
605
605
|
},
|
|
606
606
|
}),
|
|
@@ -1458,7 +1458,51 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
|
1458
1458
|
logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
|
-
|
|
1461
|
+
// List of properties on ElementInternals that are formAssociated can be found in the spec:
|
|
1462
|
+
// https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-elements
|
|
1463
|
+
const formAssociatedProps = new Set([
|
|
1464
|
+
'setFormValue',
|
|
1465
|
+
'form',
|
|
1466
|
+
'setValidity',
|
|
1467
|
+
'willValidate',
|
|
1468
|
+
'validity',
|
|
1469
|
+
'validationMessage',
|
|
1470
|
+
'checkValidity',
|
|
1471
|
+
'reportValidity',
|
|
1472
|
+
'labels',
|
|
1473
|
+
]);
|
|
1474
|
+
// Verify that access to a form-associated property of the ElementInternals proxy has formAssociated set in the LWC.
|
|
1475
|
+
function assertFormAssociatedPropertySet(propertyKey, isFormAssociated) {
|
|
1476
|
+
if (formAssociatedProps.has(propertyKey) && !isFormAssociated) {
|
|
1477
|
+
//Note this error message mirrors Chrome and Firefox error messages, in Safari the error is slightly different.
|
|
1478
|
+
throw new DOMException(`Failed to execute '${propertyKey}' on 'ElementInternals': The target element is not a form-associated custom element.`);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
// Wrap all ElementInternal objects in a proxy to prevent form association when `formAssociated` is not set on an LWC.
|
|
1482
|
+
// This is needed because the 1UpgradeableConstructor1 always sets `formAssociated=true`, which means all
|
|
1483
|
+
// ElementInternal objects will have form-associated properties set when an LWC is placed in a form.
|
|
1484
|
+
// We are doing this to guard against customers taking a dependency on form elements being associated to ElementInternals
|
|
1485
|
+
// when 'formAssociated' has not been set on the LWC.
|
|
1486
|
+
function createElementInternalsProxy(elementInternals, isFormAssociated) {
|
|
1487
|
+
const elementInternalsProxy = new Proxy(elementInternals, {
|
|
1488
|
+
set(target, propertyKey, newValue) {
|
|
1489
|
+
// ElementInternals implementation uses strings as property keys exclusively in chrome, firefox, and safari
|
|
1490
|
+
assertFormAssociatedPropertySet(propertyKey, isFormAssociated);
|
|
1491
|
+
return Reflect.set(target, propertyKey, newValue);
|
|
1492
|
+
},
|
|
1493
|
+
get(target, propertyKey) {
|
|
1494
|
+
// ElementInternals implementation uses strings as property keys exclusively in chrome, firefox, and safari
|
|
1495
|
+
assertFormAssociatedPropertySet(propertyKey, isFormAssociated);
|
|
1496
|
+
const internalsPropertyValue = Reflect.get(target, propertyKey);
|
|
1497
|
+
// Bind the property value to the target so that function invocations are called with the
|
|
1498
|
+
// correct context ('this' value).
|
|
1499
|
+
return typeof internalsPropertyValue === 'function'
|
|
1500
|
+
? internalsPropertyValue.bind(target)
|
|
1501
|
+
: internalsPropertyValue;
|
|
1502
|
+
},
|
|
1503
|
+
});
|
|
1504
|
+
return elementInternalsProxy;
|
|
1505
|
+
}
|
|
1462
1506
|
// @ts-ignore
|
|
1463
1507
|
LightningElement.prototype = {
|
|
1464
1508
|
constructor: LightningElement,
|
|
@@ -1552,15 +1596,13 @@ LightningElement.prototype = {
|
|
|
1552
1596
|
},
|
|
1553
1597
|
attachInternals() {
|
|
1554
1598
|
const vm = getAssociatedVM(this);
|
|
1555
|
-
const { elm, renderer: { attachInternals }, } = vm;
|
|
1556
|
-
if (
|
|
1557
|
-
// Browsers that don't support attachInternals will need to be polyfilled before LWC is loaded.
|
|
1558
|
-
throw new Error('attachInternals API is not supported in this browser environment.');
|
|
1559
|
-
}
|
|
1560
|
-
if (vm.renderMode === 0 /* RenderMode.Light */ || vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
1599
|
+
const { elm, def: { formAssociated }, renderer: { attachInternals }, } = vm;
|
|
1600
|
+
if (vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
1561
1601
|
throw new Error('attachInternals API is not supported in light DOM or synthetic shadow.');
|
|
1562
1602
|
}
|
|
1563
|
-
|
|
1603
|
+
const internals = attachInternals(elm);
|
|
1604
|
+
// #TODO[2970]: remove proxy once `UpgradeableConstructor` has been removed
|
|
1605
|
+
return createElementInternalsProxy(internals, Boolean(formAssociated));
|
|
1564
1606
|
},
|
|
1565
1607
|
get isConnected() {
|
|
1566
1608
|
const vm = getAssociatedVM(this);
|
|
@@ -2641,9 +2683,26 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2641
2683
|
};
|
|
2642
2684
|
// To avoid leaking private component details, accessing internals from outside a component is not allowed.
|
|
2643
2685
|
descriptors.attachInternals = {
|
|
2686
|
+
set() {
|
|
2687
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2688
|
+
logWarn('attachInternals cannot be accessed outside of a component. Use this.attachInternals instead.');
|
|
2689
|
+
}
|
|
2690
|
+
},
|
|
2644
2691
|
get() {
|
|
2645
2692
|
if (process.env.NODE_ENV !== 'production') {
|
|
2646
|
-
|
|
2693
|
+
logWarn('attachInternals cannot be accessed outside of a component. Use this.attachInternals instead.');
|
|
2694
|
+
}
|
|
2695
|
+
},
|
|
2696
|
+
};
|
|
2697
|
+
descriptors.formAssociated = {
|
|
2698
|
+
set() {
|
|
2699
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2700
|
+
logWarn('formAssociated cannot be accessed outside of a component. Set the value within the component class.');
|
|
2701
|
+
}
|
|
2702
|
+
},
|
|
2703
|
+
get() {
|
|
2704
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2705
|
+
logWarn('formAssociated cannot be accessed outside of a component. Set the value within the component class.');
|
|
2647
2706
|
}
|
|
2648
2707
|
},
|
|
2649
2708
|
};
|
|
@@ -2955,7 +3014,7 @@ function getCtorProto(Ctor) {
|
|
|
2955
3014
|
return proto;
|
|
2956
3015
|
}
|
|
2957
3016
|
function createComponentDef(Ctor) {
|
|
2958
|
-
const { shadowSupportMode: ctorShadowSupportMode, renderMode: ctorRenderMode } = Ctor;
|
|
3017
|
+
const { shadowSupportMode: ctorShadowSupportMode, renderMode: ctorRenderMode, formAssociated: ctorFormAssociated, } = Ctor;
|
|
2959
3018
|
if (process.env.NODE_ENV !== 'production') {
|
|
2960
3019
|
const ctorName = Ctor.name;
|
|
2961
3020
|
// Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
@@ -2979,7 +3038,7 @@ function createComponentDef(Ctor) {
|
|
|
2979
3038
|
const decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
2980
3039
|
const { apiFields, apiFieldsConfig, apiMethods, wiredFields, wiredMethods, observedFields } = decoratorsMeta;
|
|
2981
3040
|
const proto = Ctor.prototype;
|
|
2982
|
-
let { connectedCallback, disconnectedCallback, renderedCallback, errorCallback, render } = proto;
|
|
3041
|
+
let { connectedCallback, disconnectedCallback, renderedCallback, errorCallback, formAssociatedCallback, formResetCallback, formDisabledCallback, formStateRestoreCallback, render, } = proto;
|
|
2983
3042
|
const superProto = getCtorProto(Ctor);
|
|
2984
3043
|
const superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
|
|
2985
3044
|
const bridge = HTMLBridgeElementFactory(superDef.bridge, shared.keys(apiFields), shared.keys(apiMethods), shared.keys(observedFields), proto);
|
|
@@ -2991,6 +3050,10 @@ function createComponentDef(Ctor) {
|
|
|
2991
3050
|
disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
|
|
2992
3051
|
renderedCallback = renderedCallback || superDef.renderedCallback;
|
|
2993
3052
|
errorCallback = errorCallback || superDef.errorCallback;
|
|
3053
|
+
formAssociatedCallback = formAssociatedCallback || superDef.formAssociatedCallback;
|
|
3054
|
+
formResetCallback = formResetCallback || superDef.formResetCallback;
|
|
3055
|
+
formDisabledCallback = formDisabledCallback || superDef.formDisabledCallback;
|
|
3056
|
+
formStateRestoreCallback = formStateRestoreCallback || superDef.formStateRestoreCallback;
|
|
2994
3057
|
render = render || superDef.render;
|
|
2995
3058
|
let shadowSupportMode = superDef.shadowSupportMode;
|
|
2996
3059
|
if (!shared.isUndefined(ctorShadowSupportMode)) {
|
|
@@ -3000,6 +3063,10 @@ function createComponentDef(Ctor) {
|
|
|
3000
3063
|
if (!shared.isUndefined(ctorRenderMode)) {
|
|
3001
3064
|
renderMode = ctorRenderMode === 'light' ? 0 /* RenderMode.Light */ : 1 /* RenderMode.Shadow */;
|
|
3002
3065
|
}
|
|
3066
|
+
let formAssociated = superDef.formAssociated;
|
|
3067
|
+
if (!shared.isUndefined(ctorFormAssociated)) {
|
|
3068
|
+
formAssociated = ctorFormAssociated;
|
|
3069
|
+
}
|
|
3003
3070
|
const template = getComponentRegisteredTemplate(Ctor) || superDef.template;
|
|
3004
3071
|
const name = Ctor.name || superDef.name;
|
|
3005
3072
|
// installing observed fields into the prototype.
|
|
@@ -3015,10 +3082,15 @@ function createComponentDef(Ctor) {
|
|
|
3015
3082
|
template,
|
|
3016
3083
|
renderMode,
|
|
3017
3084
|
shadowSupportMode,
|
|
3085
|
+
formAssociated,
|
|
3018
3086
|
connectedCallback,
|
|
3019
3087
|
disconnectedCallback,
|
|
3020
|
-
renderedCallback,
|
|
3021
3088
|
errorCallback,
|
|
3089
|
+
formAssociatedCallback,
|
|
3090
|
+
formDisabledCallback,
|
|
3091
|
+
formResetCallback,
|
|
3092
|
+
formStateRestoreCallback,
|
|
3093
|
+
renderedCallback,
|
|
3022
3094
|
render,
|
|
3023
3095
|
};
|
|
3024
3096
|
// This is a no-op unless Lightning DevTools are enabled.
|
|
@@ -3095,6 +3167,7 @@ const lightingElementDef = {
|
|
|
3095
3167
|
methods: EmptyObject,
|
|
3096
3168
|
renderMode: 1 /* RenderMode.Shadow */,
|
|
3097
3169
|
shadowSupportMode: "reset" /* ShadowSupportMode.Default */,
|
|
3170
|
+
formAssociated: undefined,
|
|
3098
3171
|
wire: EmptyObject,
|
|
3099
3172
|
bridge: BaseBridgeElement,
|
|
3100
3173
|
template: defaultEmptyTemplate,
|
|
@@ -3804,6 +3877,10 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3804
3877
|
};
|
|
3805
3878
|
let connectedCallback;
|
|
3806
3879
|
let disconnectedCallback;
|
|
3880
|
+
let formAssociatedCallback;
|
|
3881
|
+
let formDisabledCallback;
|
|
3882
|
+
let formResetCallback;
|
|
3883
|
+
let formStateRestoreCallback;
|
|
3807
3884
|
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3808
3885
|
connectedCallback = (elm) => {
|
|
3809
3886
|
connectRootElement(elm);
|
|
@@ -3811,13 +3888,25 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3811
3888
|
disconnectedCallback = (elm) => {
|
|
3812
3889
|
disconnectRootElement(elm);
|
|
3813
3890
|
};
|
|
3891
|
+
formAssociatedCallback = (elm) => {
|
|
3892
|
+
runFormAssociatedCallback(elm);
|
|
3893
|
+
};
|
|
3894
|
+
formDisabledCallback = (elm) => {
|
|
3895
|
+
runFormDisabledCallback(elm);
|
|
3896
|
+
};
|
|
3897
|
+
formResetCallback = (elm) => {
|
|
3898
|
+
runFormResetCallback(elm);
|
|
3899
|
+
};
|
|
3900
|
+
formStateRestoreCallback = (elm) => {
|
|
3901
|
+
runFormStateRestoreCallback(elm);
|
|
3902
|
+
};
|
|
3814
3903
|
}
|
|
3815
3904
|
// Should never get a tag with upper case letter at this point; the compiler
|
|
3816
3905
|
// should produce only tags with lowercase letters. However, the Java
|
|
3817
3906
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
3818
3907
|
// compatibility, we lower case the tagname here.
|
|
3819
3908
|
const normalizedTagname = sel.toLowerCase();
|
|
3820
|
-
const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
3909
|
+
const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback);
|
|
3821
3910
|
vnode.elm = elm;
|
|
3822
3911
|
vnode.vm = vm;
|
|
3823
3912
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -5945,6 +6034,48 @@ function forceRehydration(vm) {
|
|
|
5945
6034
|
scheduleRehydration(vm);
|
|
5946
6035
|
}
|
|
5947
6036
|
}
|
|
6037
|
+
function runFormAssociatedCustomElementCallback(vm, faceCb) {
|
|
6038
|
+
const { renderMode, shadowMode, def: { formAssociated }, } = vm;
|
|
6039
|
+
// Technically the UpgradableConstructor always sets `static formAssociated = true` but silently fail here to match browser behavior.
|
|
6040
|
+
if (shared.isUndefined(formAssociated) || shared.isFalse(formAssociated)) {
|
|
6041
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6042
|
+
logWarn(`Form associated lifecycle methods must have the 'static formAssociated' value set in the component's prototype chain.`);
|
|
6043
|
+
}
|
|
6044
|
+
return;
|
|
6045
|
+
}
|
|
6046
|
+
if (shadowMode === 1 /* ShadowMode.Synthetic */ && renderMode !== 0 /* RenderMode.Light */) {
|
|
6047
|
+
throw new Error('Form associated lifecycle methods are not available in synthetic shadow. Please use native shadow or light DOM.');
|
|
6048
|
+
}
|
|
6049
|
+
invokeComponentCallback(vm, faceCb);
|
|
6050
|
+
}
|
|
6051
|
+
function runFormAssociatedCallback(elm) {
|
|
6052
|
+
const vm = getAssociatedVM(elm);
|
|
6053
|
+
const { formAssociatedCallback } = vm.def;
|
|
6054
|
+
if (!shared.isUndefined(formAssociatedCallback)) {
|
|
6055
|
+
runFormAssociatedCustomElementCallback(vm, formAssociatedCallback);
|
|
6056
|
+
}
|
|
6057
|
+
}
|
|
6058
|
+
function runFormDisabledCallback(elm) {
|
|
6059
|
+
const vm = getAssociatedVM(elm);
|
|
6060
|
+
const { formDisabledCallback } = vm.def;
|
|
6061
|
+
if (!shared.isUndefined(formDisabledCallback)) {
|
|
6062
|
+
runFormAssociatedCustomElementCallback(vm, formDisabledCallback);
|
|
6063
|
+
}
|
|
6064
|
+
}
|
|
6065
|
+
function runFormResetCallback(elm) {
|
|
6066
|
+
const vm = getAssociatedVM(elm);
|
|
6067
|
+
const { formResetCallback } = vm.def;
|
|
6068
|
+
if (!shared.isUndefined(formResetCallback)) {
|
|
6069
|
+
runFormAssociatedCustomElementCallback(vm, formResetCallback);
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
function runFormStateRestoreCallback(elm) {
|
|
6073
|
+
const vm = getAssociatedVM(elm);
|
|
6074
|
+
const { formStateRestoreCallback } = vm.def;
|
|
6075
|
+
if (!shared.isUndefined(formStateRestoreCallback)) {
|
|
6076
|
+
runFormAssociatedCustomElementCallback(vm, formStateRestoreCallback);
|
|
6077
|
+
}
|
|
6078
|
+
}
|
|
5948
6079
|
|
|
5949
6080
|
/*
|
|
5950
6081
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6857,7 +6988,7 @@ function trackMutations(tmpl) {
|
|
|
6857
6988
|
}
|
|
6858
6989
|
function addLegacyStylesheetTokensShim(tmpl) {
|
|
6859
6990
|
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6860
|
-
// is accessing the old internal API (backwards compat). Details:
|
|
6991
|
+
// is accessing the old internal API (backwards compat). Details: W-14210169
|
|
6861
6992
|
shared.defineProperty(tmpl, 'stylesheetTokens', {
|
|
6862
6993
|
enumerable: true,
|
|
6863
6994
|
configurable: true,
|
|
@@ -6982,6 +7113,10 @@ exports.readonly = readonly;
|
|
|
6982
7113
|
exports.registerComponent = registerComponent;
|
|
6983
7114
|
exports.registerDecorators = registerDecorators;
|
|
6984
7115
|
exports.registerTemplate = registerTemplate;
|
|
7116
|
+
exports.runFormAssociatedCallback = runFormAssociatedCallback;
|
|
7117
|
+
exports.runFormDisabledCallback = runFormDisabledCallback;
|
|
7118
|
+
exports.runFormResetCallback = runFormResetCallback;
|
|
7119
|
+
exports.runFormStateRestoreCallback = runFormStateRestoreCallback;
|
|
6985
7120
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
6986
7121
|
exports.setHooks = setHooks;
|
|
6987
7122
|
exports.swapComponent = swapComponent;
|
|
@@ -6990,5 +7125,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
6990
7125
|
exports.track = track;
|
|
6991
7126
|
exports.unwrap = unwrap;
|
|
6992
7127
|
exports.wire = wire;
|
|
6993
|
-
/** version: 3.
|
|
7128
|
+
/** version: 3.5.0 */
|
|
6994
7129
|
//# sourceMappingURL=index.cjs.js.map
|