@lwc/engine-core 3.4.0 → 3.6.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-bridge-element.d.ts +1 -1
- 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 +7 -1
- package/dist/index.cjs.js +172 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +170 -34
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (C) 2023 salesforce.com, 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, globalThis as globalThis$1, forEach, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject,
|
|
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, globalThis as globalThis$1, forEach, AriaPropNameToAttrNameMap, getPropertyDescriptor, defineProperties, getPrototypeOf as getPrototypeOf$1, setPrototypeOf, assign, isObject, freeze, KEY__SYNTHETIC_MODE, 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, isString, StringSlice, isTrue, SVG_NAMESPACE, KEY__SHADOW_STATIC, KEY__SHADOW_RESOLVER, ArraySome, ArrayPop, isNumber, StringReplace, ArrayUnshift, 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, ArrayShift } from '@lwc/shared';
|
|
5
5
|
import { applyAriaReflection } from '@lwc/aria-reflection';
|
|
6
6
|
export { setFeatureFlag, setFeatureFlagForTest } from '@lwc/features';
|
|
7
7
|
|
|
@@ -519,8 +519,8 @@ function lockDomMutation() {
|
|
|
519
519
|
assertNotProd(); // this method should never leak to prod
|
|
520
520
|
isDomMutationAllowed = false;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
return
|
|
522
|
+
function logMissingPortalWarn(name, type) {
|
|
523
|
+
return logWarn(`The \`${name}\` ${type} is available only on elements that use the \`lwc:dom="manual"\` directive.`);
|
|
524
524
|
}
|
|
525
525
|
function patchElementWithRestrictions(elm, options) {
|
|
526
526
|
assertNotProd(); // this method should never leak to prod
|
|
@@ -545,14 +545,14 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
545
545
|
assign(descriptors, {
|
|
546
546
|
appendChild: generateDataDescriptor({
|
|
547
547
|
value(aChild) {
|
|
548
|
-
|
|
548
|
+
logMissingPortalWarn('appendChild', 'method');
|
|
549
549
|
return appendChild.call(this, aChild);
|
|
550
550
|
},
|
|
551
551
|
}),
|
|
552
552
|
insertBefore: generateDataDescriptor({
|
|
553
553
|
value(newNode, referenceNode) {
|
|
554
554
|
if (!isDomMutationAllowed) {
|
|
555
|
-
|
|
555
|
+
logMissingPortalWarn('insertBefore', 'method');
|
|
556
556
|
}
|
|
557
557
|
return insertBefore.call(this, newNode, referenceNode);
|
|
558
558
|
},
|
|
@@ -560,14 +560,14 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
560
560
|
removeChild: generateDataDescriptor({
|
|
561
561
|
value(aChild) {
|
|
562
562
|
if (!isDomMutationAllowed) {
|
|
563
|
-
|
|
563
|
+
logMissingPortalWarn('removeChild', 'method');
|
|
564
564
|
}
|
|
565
565
|
return removeChild.call(this, aChild);
|
|
566
566
|
},
|
|
567
567
|
}),
|
|
568
568
|
replaceChild: generateDataDescriptor({
|
|
569
569
|
value(newChild, oldChild) {
|
|
570
|
-
|
|
570
|
+
logMissingPortalWarn('replaceChild', 'method');
|
|
571
571
|
return replaceChild.call(this, newChild, oldChild);
|
|
572
572
|
},
|
|
573
573
|
}),
|
|
@@ -577,7 +577,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
577
577
|
},
|
|
578
578
|
set(value) {
|
|
579
579
|
if (!isDomMutationAllowed) {
|
|
580
|
-
|
|
580
|
+
logMissingPortalWarn('nodeValue', 'property');
|
|
581
581
|
}
|
|
582
582
|
originalNodeValueDescriptor.set.call(this, value);
|
|
583
583
|
},
|
|
@@ -587,7 +587,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
587
587
|
return originalTextContentDescriptor.get.call(this);
|
|
588
588
|
},
|
|
589
589
|
set(value) {
|
|
590
|
-
|
|
590
|
+
logMissingPortalWarn('textContent', 'property');
|
|
591
591
|
originalTextContentDescriptor.set.call(this, value);
|
|
592
592
|
},
|
|
593
593
|
}),
|
|
@@ -596,7 +596,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
596
596
|
return originalInnerHTMLDescriptor.get.call(this);
|
|
597
597
|
},
|
|
598
598
|
set(value) {
|
|
599
|
-
|
|
599
|
+
logMissingPortalWarn('innerHTML', 'property');
|
|
600
600
|
return originalInnerHTMLDescriptor.set.call(this, value);
|
|
601
601
|
},
|
|
602
602
|
}),
|
|
@@ -1454,7 +1454,51 @@ function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
|
1454
1454
|
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.`);
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
|
-
|
|
1457
|
+
// List of properties on ElementInternals that are formAssociated can be found in the spec:
|
|
1458
|
+
// https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-elements
|
|
1459
|
+
const formAssociatedProps = new Set([
|
|
1460
|
+
'setFormValue',
|
|
1461
|
+
'form',
|
|
1462
|
+
'setValidity',
|
|
1463
|
+
'willValidate',
|
|
1464
|
+
'validity',
|
|
1465
|
+
'validationMessage',
|
|
1466
|
+
'checkValidity',
|
|
1467
|
+
'reportValidity',
|
|
1468
|
+
'labels',
|
|
1469
|
+
]);
|
|
1470
|
+
// Verify that access to a form-associated property of the ElementInternals proxy has formAssociated set in the LWC.
|
|
1471
|
+
function assertFormAssociatedPropertySet(propertyKey, isFormAssociated) {
|
|
1472
|
+
if (formAssociatedProps.has(propertyKey) && !isFormAssociated) {
|
|
1473
|
+
//Note this error message mirrors Chrome and Firefox error messages, in Safari the error is slightly different.
|
|
1474
|
+
throw new DOMException(`Failed to execute '${propertyKey}' on 'ElementInternals': The target element is not a form-associated custom element.`);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
// Wrap all ElementInternal objects in a proxy to prevent form association when `formAssociated` is not set on an LWC.
|
|
1478
|
+
// This is needed because the 1UpgradeableConstructor1 always sets `formAssociated=true`, which means all
|
|
1479
|
+
// ElementInternal objects will have form-associated properties set when an LWC is placed in a form.
|
|
1480
|
+
// We are doing this to guard against customers taking a dependency on form elements being associated to ElementInternals
|
|
1481
|
+
// when 'formAssociated' has not been set on the LWC.
|
|
1482
|
+
function createElementInternalsProxy(elementInternals, isFormAssociated) {
|
|
1483
|
+
const elementInternalsProxy = new Proxy(elementInternals, {
|
|
1484
|
+
set(target, propertyKey, newValue) {
|
|
1485
|
+
// ElementInternals implementation uses strings as property keys exclusively in chrome, firefox, and safari
|
|
1486
|
+
assertFormAssociatedPropertySet(propertyKey, isFormAssociated);
|
|
1487
|
+
return Reflect.set(target, propertyKey, newValue);
|
|
1488
|
+
},
|
|
1489
|
+
get(target, propertyKey) {
|
|
1490
|
+
// ElementInternals implementation uses strings as property keys exclusively in chrome, firefox, and safari
|
|
1491
|
+
assertFormAssociatedPropertySet(propertyKey, isFormAssociated);
|
|
1492
|
+
const internalsPropertyValue = Reflect.get(target, propertyKey);
|
|
1493
|
+
// Bind the property value to the target so that function invocations are called with the
|
|
1494
|
+
// correct context ('this' value).
|
|
1495
|
+
return typeof internalsPropertyValue === 'function'
|
|
1496
|
+
? internalsPropertyValue.bind(target)
|
|
1497
|
+
: internalsPropertyValue;
|
|
1498
|
+
},
|
|
1499
|
+
});
|
|
1500
|
+
return elementInternalsProxy;
|
|
1501
|
+
}
|
|
1458
1502
|
// @ts-ignore
|
|
1459
1503
|
LightningElement.prototype = {
|
|
1460
1504
|
constructor: LightningElement,
|
|
@@ -1548,15 +1592,13 @@ LightningElement.prototype = {
|
|
|
1548
1592
|
},
|
|
1549
1593
|
attachInternals() {
|
|
1550
1594
|
const vm = getAssociatedVM(this);
|
|
1551
|
-
const { elm, renderer: { attachInternals }, } = vm;
|
|
1552
|
-
if (
|
|
1553
|
-
// Browsers that don't support attachInternals will need to be polyfilled before LWC is loaded.
|
|
1554
|
-
throw new Error('attachInternals API is not supported in this browser environment.');
|
|
1555
|
-
}
|
|
1556
|
-
if (vm.renderMode === 0 /* RenderMode.Light */ || vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
1595
|
+
const { elm, def: { formAssociated }, renderer: { attachInternals }, } = vm;
|
|
1596
|
+
if (vm.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
1557
1597
|
throw new Error('attachInternals API is not supported in light DOM or synthetic shadow.');
|
|
1558
1598
|
}
|
|
1559
|
-
|
|
1599
|
+
const internals = attachInternals(elm);
|
|
1600
|
+
// #TODO[2970]: remove proxy once `UpgradeableConstructor` has been removed
|
|
1601
|
+
return createElementInternalsProxy(internals, Boolean(formAssociated));
|
|
1560
1602
|
},
|
|
1561
1603
|
get isConnected() {
|
|
1562
1604
|
const vm = getAssociatedVM(this);
|
|
@@ -2578,7 +2620,7 @@ function createAccessorThatWarns(propName) {
|
|
|
2578
2620
|
configurable: true,
|
|
2579
2621
|
};
|
|
2580
2622
|
}
|
|
2581
|
-
function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto) {
|
|
2623
|
+
function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
|
|
2582
2624
|
const HTMLBridgeElement = class extends SuperClass {
|
|
2583
2625
|
};
|
|
2584
2626
|
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
|
@@ -2589,7 +2631,8 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2589
2631
|
const descriptors = create(null);
|
|
2590
2632
|
// present a hint message so that developers are aware that they have not decorated property with @api
|
|
2591
2633
|
if (process.env.NODE_ENV !== 'production') {
|
|
2592
|
-
|
|
2634
|
+
// TODO [#3761]: enable for components that don't extend from LightningElement
|
|
2635
|
+
if (!isUndefined$1(proto) && !isNull(proto) && !hasCustomSuperClass) {
|
|
2593
2636
|
const nonPublicPropertiesToWarnOn = new Set([
|
|
2594
2637
|
// getters, setters, and methods
|
|
2595
2638
|
...keys(getOwnPropertyDescriptors(proto)),
|
|
@@ -2637,9 +2680,26 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2637
2680
|
};
|
|
2638
2681
|
// To avoid leaking private component details, accessing internals from outside a component is not allowed.
|
|
2639
2682
|
descriptors.attachInternals = {
|
|
2683
|
+
set() {
|
|
2684
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2685
|
+
logWarn('attachInternals cannot be accessed outside of a component. Use this.attachInternals instead.');
|
|
2686
|
+
}
|
|
2687
|
+
},
|
|
2640
2688
|
get() {
|
|
2641
2689
|
if (process.env.NODE_ENV !== 'production') {
|
|
2642
|
-
|
|
2690
|
+
logWarn('attachInternals cannot be accessed outside of a component. Use this.attachInternals instead.');
|
|
2691
|
+
}
|
|
2692
|
+
},
|
|
2693
|
+
};
|
|
2694
|
+
descriptors.formAssociated = {
|
|
2695
|
+
set() {
|
|
2696
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2697
|
+
logWarn('formAssociated cannot be accessed outside of a component. Set the value within the component class.');
|
|
2698
|
+
}
|
|
2699
|
+
},
|
|
2700
|
+
get() {
|
|
2701
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2702
|
+
logWarn('formAssociated cannot be accessed outside of a component. Set the value within the component class.');
|
|
2643
2703
|
}
|
|
2644
2704
|
},
|
|
2645
2705
|
};
|
|
@@ -2653,7 +2713,7 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2653
2713
|
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2654
2714
|
return HTMLBridgeElement;
|
|
2655
2715
|
}
|
|
2656
|
-
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), [], [], null);
|
|
2716
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), [], [], null, false);
|
|
2657
2717
|
if (process.env.IS_BROWSER) {
|
|
2658
2718
|
// This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
|
|
2659
2719
|
// so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
|
|
@@ -2951,7 +3011,7 @@ function getCtorProto(Ctor) {
|
|
|
2951
3011
|
return proto;
|
|
2952
3012
|
}
|
|
2953
3013
|
function createComponentDef(Ctor) {
|
|
2954
|
-
const { shadowSupportMode: ctorShadowSupportMode, renderMode: ctorRenderMode } = Ctor;
|
|
3014
|
+
const { shadowSupportMode: ctorShadowSupportMode, renderMode: ctorRenderMode, formAssociated: ctorFormAssociated, } = Ctor;
|
|
2955
3015
|
if (process.env.NODE_ENV !== 'production') {
|
|
2956
3016
|
const ctorName = Ctor.name;
|
|
2957
3017
|
// Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
@@ -2963,7 +3023,8 @@ function createComponentDef(Ctor) {
|
|
|
2963
3023
|
}
|
|
2964
3024
|
if (!isUndefined$1(ctorShadowSupportMode) &&
|
|
2965
3025
|
ctorShadowSupportMode !== "any" /* ShadowSupportMode.Any */ &&
|
|
2966
|
-
ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */
|
|
3026
|
+
ctorShadowSupportMode !== "reset" /* ShadowSupportMode.Default */ &&
|
|
3027
|
+
ctorShadowSupportMode !== "native" /* ShadowSupportMode.Native */) {
|
|
2967
3028
|
logError(`Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);
|
|
2968
3029
|
}
|
|
2969
3030
|
if (!isUndefined$1(ctorRenderMode) &&
|
|
@@ -2975,10 +3036,11 @@ function createComponentDef(Ctor) {
|
|
|
2975
3036
|
const decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
2976
3037
|
const { apiFields, apiFieldsConfig, apiMethods, wiredFields, wiredMethods, observedFields } = decoratorsMeta;
|
|
2977
3038
|
const proto = Ctor.prototype;
|
|
2978
|
-
let { connectedCallback, disconnectedCallback, renderedCallback, errorCallback, render } = proto;
|
|
3039
|
+
let { connectedCallback, disconnectedCallback, renderedCallback, errorCallback, formAssociatedCallback, formResetCallback, formDisabledCallback, formStateRestoreCallback, render, } = proto;
|
|
2979
3040
|
const superProto = getCtorProto(Ctor);
|
|
2980
|
-
const
|
|
2981
|
-
const
|
|
3041
|
+
const hasCustomSuperClass = superProto !== LightningElement;
|
|
3042
|
+
const superDef = hasCustomSuperClass ? getComponentInternalDef(superProto) : lightingElementDef;
|
|
3043
|
+
const bridge = HTMLBridgeElementFactory(superDef.bridge, keys(apiFields), keys(apiMethods), keys(observedFields), proto, hasCustomSuperClass);
|
|
2982
3044
|
const props = assign(create(null), superDef.props, apiFields);
|
|
2983
3045
|
const propsConfig = assign(create(null), superDef.propsConfig, apiFieldsConfig);
|
|
2984
3046
|
const methods = assign(create(null), superDef.methods, apiMethods);
|
|
@@ -2987,6 +3049,10 @@ function createComponentDef(Ctor) {
|
|
|
2987
3049
|
disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
|
|
2988
3050
|
renderedCallback = renderedCallback || superDef.renderedCallback;
|
|
2989
3051
|
errorCallback = errorCallback || superDef.errorCallback;
|
|
3052
|
+
formAssociatedCallback = formAssociatedCallback || superDef.formAssociatedCallback;
|
|
3053
|
+
formResetCallback = formResetCallback || superDef.formResetCallback;
|
|
3054
|
+
formDisabledCallback = formDisabledCallback || superDef.formDisabledCallback;
|
|
3055
|
+
formStateRestoreCallback = formStateRestoreCallback || superDef.formStateRestoreCallback;
|
|
2990
3056
|
render = render || superDef.render;
|
|
2991
3057
|
let shadowSupportMode = superDef.shadowSupportMode;
|
|
2992
3058
|
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
@@ -2996,6 +3062,10 @@ function createComponentDef(Ctor) {
|
|
|
2996
3062
|
if (!isUndefined$1(ctorRenderMode)) {
|
|
2997
3063
|
renderMode = ctorRenderMode === 'light' ? 0 /* RenderMode.Light */ : 1 /* RenderMode.Shadow */;
|
|
2998
3064
|
}
|
|
3065
|
+
let formAssociated = superDef.formAssociated;
|
|
3066
|
+
if (!isUndefined$1(ctorFormAssociated)) {
|
|
3067
|
+
formAssociated = ctorFormAssociated;
|
|
3068
|
+
}
|
|
2999
3069
|
const template = getComponentRegisteredTemplate(Ctor) || superDef.template;
|
|
3000
3070
|
const name = Ctor.name || superDef.name;
|
|
3001
3071
|
// installing observed fields into the prototype.
|
|
@@ -3011,10 +3081,15 @@ function createComponentDef(Ctor) {
|
|
|
3011
3081
|
template,
|
|
3012
3082
|
renderMode,
|
|
3013
3083
|
shadowSupportMode,
|
|
3084
|
+
formAssociated,
|
|
3014
3085
|
connectedCallback,
|
|
3015
3086
|
disconnectedCallback,
|
|
3016
|
-
renderedCallback,
|
|
3017
3087
|
errorCallback,
|
|
3088
|
+
formAssociatedCallback,
|
|
3089
|
+
formDisabledCallback,
|
|
3090
|
+
formResetCallback,
|
|
3091
|
+
formStateRestoreCallback,
|
|
3092
|
+
renderedCallback,
|
|
3018
3093
|
render,
|
|
3019
3094
|
};
|
|
3020
3095
|
// This is a no-op unless Lightning DevTools are enabled.
|
|
@@ -3091,6 +3166,7 @@ const lightingElementDef = {
|
|
|
3091
3166
|
methods: EmptyObject,
|
|
3092
3167
|
renderMode: 1 /* RenderMode.Shadow */,
|
|
3093
3168
|
shadowSupportMode: "reset" /* ShadowSupportMode.Default */,
|
|
3169
|
+
formAssociated: undefined,
|
|
3094
3170
|
wire: EmptyObject,
|
|
3095
3171
|
bridge: BaseBridgeElement,
|
|
3096
3172
|
template: defaultEmptyTemplate,
|
|
@@ -3800,6 +3876,10 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3800
3876
|
};
|
|
3801
3877
|
let connectedCallback;
|
|
3802
3878
|
let disconnectedCallback;
|
|
3879
|
+
let formAssociatedCallback;
|
|
3880
|
+
let formDisabledCallback;
|
|
3881
|
+
let formResetCallback;
|
|
3882
|
+
let formStateRestoreCallback;
|
|
3803
3883
|
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3804
3884
|
connectedCallback = (elm) => {
|
|
3805
3885
|
connectRootElement(elm);
|
|
@@ -3807,13 +3887,25 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3807
3887
|
disconnectedCallback = (elm) => {
|
|
3808
3888
|
disconnectRootElement(elm);
|
|
3809
3889
|
};
|
|
3890
|
+
formAssociatedCallback = (elm) => {
|
|
3891
|
+
runFormAssociatedCallback(elm);
|
|
3892
|
+
};
|
|
3893
|
+
formDisabledCallback = (elm) => {
|
|
3894
|
+
runFormDisabledCallback(elm);
|
|
3895
|
+
};
|
|
3896
|
+
formResetCallback = (elm) => {
|
|
3897
|
+
runFormResetCallback(elm);
|
|
3898
|
+
};
|
|
3899
|
+
formStateRestoreCallback = (elm) => {
|
|
3900
|
+
runFormStateRestoreCallback(elm);
|
|
3901
|
+
};
|
|
3810
3902
|
}
|
|
3811
3903
|
// Should never get a tag with upper case letter at this point; the compiler
|
|
3812
3904
|
// should produce only tags with lowercase letters. However, the Java
|
|
3813
3905
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
3814
3906
|
// compatibility, we lower case the tagname here.
|
|
3815
3907
|
const normalizedTagname = sel.toLowerCase();
|
|
3816
|
-
const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
3908
|
+
const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback);
|
|
3817
3909
|
vnode.elm = elm;
|
|
3818
3910
|
vnode.vm = vm;
|
|
3819
3911
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -5631,8 +5723,10 @@ function computeShadowMode(def, owner, renderer) {
|
|
|
5631
5723
|
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
5632
5724
|
shadowMode = 0 /* ShadowMode.Native */;
|
|
5633
5725
|
}
|
|
5634
|
-
else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE
|
|
5635
|
-
|
|
5726
|
+
else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE ||
|
|
5727
|
+
def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
|
|
5728
|
+
if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */ ||
|
|
5729
|
+
def.shadowSupportMode === "native" /* ShadowSupportMode.Native */) {
|
|
5636
5730
|
shadowMode = 0 /* ShadowMode.Native */;
|
|
5637
5731
|
}
|
|
5638
5732
|
else {
|
|
@@ -5941,6 +6035,48 @@ function forceRehydration(vm) {
|
|
|
5941
6035
|
scheduleRehydration(vm);
|
|
5942
6036
|
}
|
|
5943
6037
|
}
|
|
6038
|
+
function runFormAssociatedCustomElementCallback(vm, faceCb) {
|
|
6039
|
+
const { renderMode, shadowMode, def: { formAssociated }, } = vm;
|
|
6040
|
+
// Technically the UpgradableConstructor always sets `static formAssociated = true` but silently fail here to match browser behavior.
|
|
6041
|
+
if (isUndefined$1(formAssociated) || isFalse(formAssociated)) {
|
|
6042
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6043
|
+
logWarn(`Form associated lifecycle methods must have the 'static formAssociated' value set in the component's prototype chain.`);
|
|
6044
|
+
}
|
|
6045
|
+
return;
|
|
6046
|
+
}
|
|
6047
|
+
if (shadowMode === 1 /* ShadowMode.Synthetic */ && renderMode !== 0 /* RenderMode.Light */) {
|
|
6048
|
+
throw new Error('Form associated lifecycle methods are not available in synthetic shadow. Please use native shadow or light DOM.');
|
|
6049
|
+
}
|
|
6050
|
+
invokeComponentCallback(vm, faceCb);
|
|
6051
|
+
}
|
|
6052
|
+
function runFormAssociatedCallback(elm) {
|
|
6053
|
+
const vm = getAssociatedVM(elm);
|
|
6054
|
+
const { formAssociatedCallback } = vm.def;
|
|
6055
|
+
if (!isUndefined$1(formAssociatedCallback)) {
|
|
6056
|
+
runFormAssociatedCustomElementCallback(vm, formAssociatedCallback);
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
function runFormDisabledCallback(elm) {
|
|
6060
|
+
const vm = getAssociatedVM(elm);
|
|
6061
|
+
const { formDisabledCallback } = vm.def;
|
|
6062
|
+
if (!isUndefined$1(formDisabledCallback)) {
|
|
6063
|
+
runFormAssociatedCustomElementCallback(vm, formDisabledCallback);
|
|
6064
|
+
}
|
|
6065
|
+
}
|
|
6066
|
+
function runFormResetCallback(elm) {
|
|
6067
|
+
const vm = getAssociatedVM(elm);
|
|
6068
|
+
const { formResetCallback } = vm.def;
|
|
6069
|
+
if (!isUndefined$1(formResetCallback)) {
|
|
6070
|
+
runFormAssociatedCustomElementCallback(vm, formResetCallback);
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
6073
|
+
function runFormStateRestoreCallback(elm) {
|
|
6074
|
+
const vm = getAssociatedVM(elm);
|
|
6075
|
+
const { formStateRestoreCallback } = vm.def;
|
|
6076
|
+
if (!isUndefined$1(formStateRestoreCallback)) {
|
|
6077
|
+
runFormAssociatedCustomElementCallback(vm, formStateRestoreCallback);
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
5944
6080
|
|
|
5945
6081
|
/*
|
|
5946
6082
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6853,7 +6989,7 @@ function trackMutations(tmpl) {
|
|
|
6853
6989
|
}
|
|
6854
6990
|
function addLegacyStylesheetTokensShim(tmpl) {
|
|
6855
6991
|
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6856
|
-
// is accessing the old internal API (backwards compat). Details:
|
|
6992
|
+
// is accessing the old internal API (backwards compat). Details: W-14210169
|
|
6857
6993
|
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6858
6994
|
enumerable: true,
|
|
6859
6995
|
configurable: true,
|
|
@@ -6947,6 +7083,6 @@ function readonly(obj) {
|
|
|
6947
7083
|
return getReadOnlyProxy(obj);
|
|
6948
7084
|
}
|
|
6949
7085
|
|
|
6950
|
-
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, sanitizeAttribute, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
6951
|
-
/** version: 3.
|
|
7086
|
+
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 };
|
|
7087
|
+
/** version: 3.6.0 */
|
|
6952
7088
|
//# sourceMappingURL=index.js.map
|