@lwc/engine-core 7.3.0-alpha.1 → 7.3.0-alpha.2
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/decorators/api.d.ts +2 -1
- package/dist/framework/decorators/track.d.ts +3 -1
- package/dist/framework/decorators/wire.d.ts +3 -2
- package/dist/framework/wiring/index.d.ts +1 -1
- package/dist/framework/wiring/types.d.ts +11 -0
- package/dist/index.cjs.js +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { LightningElement } from '../base-lightning-element';
|
|
1
2
|
/**
|
|
2
3
|
* The `@api` decorator marks public fields and public methods in
|
|
3
4
|
* LWC Components. This function implements the internals of this
|
|
4
5
|
* decorator.
|
|
5
6
|
*/
|
|
6
|
-
export default function api(value: unknown, context:
|
|
7
|
+
export default function api<Class extends LightningElement>(value: unknown, context: ClassFieldDecoratorContext<Class, unknown> | ClassMethodDecoratorContext<Class, (this: Class, ...args: any) => any> | ClassGetterDecoratorContext<Class, unknown> | ClassSetterDecoratorContext<Class, unknown>): void;
|
|
7
8
|
export declare function createPublicPropertyDescriptor(key: string): PropertyDescriptor;
|
|
8
9
|
export declare function createPublicAccessorDescriptor(key: PropertyKey, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { LightningElement } from '../base-lightning-element';
|
|
1
2
|
/**
|
|
2
3
|
* The `@track` decorator function marks field values as reactive in
|
|
3
4
|
* LWC Components. This function can also be invoked directly
|
|
4
5
|
* with any value to obtain the trackable version of the value.
|
|
5
6
|
*/
|
|
6
|
-
export default function track(
|
|
7
|
+
export default function track<Class extends LightningElement>(target: undefined, context: ClassFieldDecoratorContext<Class>): void;
|
|
8
|
+
export default function track<T>(target: T, context?: never): T;
|
|
7
9
|
export declare function internalTrackDecorator(key: string): PropertyDescriptor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LightningElement } from '../base-lightning-element';
|
|
2
|
+
import type { ConfigValue, ContextValue, DataCallback, ReplaceReactiveValues, WireAdapterConstructor } from '../wiring';
|
|
2
3
|
/**
|
|
3
4
|
* Decorator factory to wire a property or method to a wire adapter data source.
|
|
4
5
|
* @param adapter the adapter used to provision data
|
|
@@ -10,5 +11,5 @@ import { WireAdapterConstructor } from '../wiring';
|
|
|
10
11
|
* \@wire(getBook, { id: '$bookId'}) book;
|
|
11
12
|
* }
|
|
12
13
|
*/
|
|
13
|
-
export default function wire(adapter: WireAdapterConstructor, config?:
|
|
14
|
+
export default function wire<ReactiveConfig extends ConfigValue = ConfigValue, Value = any, Context extends ContextValue = ContextValue, Class extends LightningElement = LightningElement>(adapter: WireAdapterConstructor<ReplaceReactiveValues<ReactiveConfig, Class>, Value, Context>, config?: ReactiveConfig): (target: unknown, context: ClassFieldDecoratorContext<Class, Value | undefined> | ClassMethodDecoratorContext<Class, DataCallback<Value>>) => void;
|
|
14
15
|
export declare function internalWireFieldDecorator(key: string): PropertyDescriptor;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createContextProviderWithRegister, createContextWatcher } from './context';
|
|
2
|
-
export { ConfigCallback, ConfigValue, ContextConsumer, ContextProvider, ContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './types';
|
|
2
|
+
export { ConfigCallback, ConfigValue, ContextConsumer, ContextProvider, ContextValue, DataCallback, ReplaceReactiveValues, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './types';
|
|
3
3
|
export { connectWireAdapters, disconnectWireAdapters, installWireAdapters, storeWiredFieldMeta, storeWiredMethodMeta, } from './wiring';
|
|
@@ -49,3 +49,14 @@ export interface ContextProviderOptions {
|
|
|
49
49
|
}
|
|
50
50
|
export type ContextProvider = (elmOrComponent: EventTarget, options: ContextProviderOptions) => void;
|
|
51
51
|
export type RegisterContextProviderFn = (element: HostElement, adapterContextToken: string, onContextSubscription: WireContextSubscriptionCallback) => void;
|
|
52
|
+
/** Resolves a property chain to the corresponding value on the target type. */
|
|
53
|
+
type ResolveReactiveValue<Target, Keys> = Keys extends keyof Target ? Target[Keys] : Keys extends `${infer K}.${infer Rest}` ? K extends keyof Target ? ResolveReactiveValue<Target[K], Rest> : undefined : undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Detects if the `Value` type is a property chain starting with "$". If so, it resolves the
|
|
56
|
+
* properties to the corresponding value on the target type.
|
|
57
|
+
*/
|
|
58
|
+
type ResolveValueIfReactive<Value, Target> = Value extends string ? string extends Value ? any : Value extends `$${infer Keys}` ? ResolveReactiveValue<Target, Keys> : Value : Value;
|
|
59
|
+
export type ReplaceReactiveValues<Config extends ConfigValue, Component extends LightningElement> = {
|
|
60
|
+
[K in keyof Config]: ResolveValueIfReactive<Config[K], Component>;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -2378,8 +2378,8 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
2378
2378
|
* SPDX-License-Identifier: MIT
|
|
2379
2379
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2380
2380
|
*/
|
|
2381
|
-
function track(target) {
|
|
2382
|
-
if (
|
|
2381
|
+
function track(target, context) {
|
|
2382
|
+
if (shared.isUndefined(context)) {
|
|
2383
2383
|
return getReactiveProxy(target);
|
|
2384
2384
|
}
|
|
2385
2385
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6551,6 +6551,8 @@ function computeShadowMode(def, owner, renderer, hydrated) {
|
|
|
6551
6551
|
// on, but components running in actual native shadow mode
|
|
6552
6552
|
(process.env.NODE_ENV === 'test-karma-lwc' &&
|
|
6553
6553
|
process.env.FORCE_NATIVE_SHADOW_MODE_FOR_TEST) ||
|
|
6554
|
+
// If synthetic shadow is explicitly disabled, use pure-native
|
|
6555
|
+
lwcRuntimeFlags.DISABLE_SYNTHETIC_SHADOW ||
|
|
6554
6556
|
// hydration only supports native shadow
|
|
6555
6557
|
shared.isTrue(hydrated)) {
|
|
6556
6558
|
return 0 /* ShadowMode.Native */;
|
|
@@ -8090,5 +8092,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8090
8092
|
exports.track = track;
|
|
8091
8093
|
exports.unwrap = unwrap;
|
|
8092
8094
|
exports.wire = wire;
|
|
8093
|
-
/** version: 7.
|
|
8095
|
+
/** version: 7.3.0-alpha.2 */
|
|
8094
8096
|
//# sourceMappingURL=index.cjs.js.map
|