@lwc/engine-core 7.3.0-alpha.2 → 7.3.0-alpha.3
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 +1 -2
- package/dist/framework/decorators/track.d.ts +1 -2
- package/dist/framework/decorators/wire.d.ts +16 -2
- package/dist/framework/wiring/types.d.ts +6 -2
- 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,9 +1,8 @@
|
|
|
1
|
-
import { LightningElement } from '../base-lightning-element';
|
|
2
1
|
/**
|
|
3
2
|
* The `@api` decorator marks public fields and public methods in
|
|
4
3
|
* LWC Components. This function implements the internals of this
|
|
5
4
|
* decorator.
|
|
6
5
|
*/
|
|
7
|
-
export default function api
|
|
6
|
+
export default function api(value: unknown, context: ClassMemberDecoratorContext): void;
|
|
8
7
|
export declare function createPublicPropertyDescriptor(key: string): PropertyDescriptor;
|
|
9
8
|
export declare function createPublicAccessorDescriptor(key: PropertyKey, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { LightningElement } from '../base-lightning-element';
|
|
2
1
|
/**
|
|
3
2
|
* The `@track` decorator function marks field values as reactive in
|
|
4
3
|
* LWC Components. This function can also be invoked directly
|
|
5
4
|
* with any value to obtain the trackable version of the value.
|
|
6
5
|
*/
|
|
7
|
-
export default function track
|
|
6
|
+
export default function track(target: undefined, context: ClassFieldDecoratorContext): void;
|
|
8
7
|
export default function track<T>(target: T, context?: never): T;
|
|
9
8
|
export declare function internalTrackDecorator(key: string): PropertyDescriptor;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { LightningElement } from '../base-lightning-element';
|
|
2
|
-
import type { ConfigValue, ContextValue,
|
|
2
|
+
import type { ConfigValue, ContextValue, ReplaceReactiveValues, WireAdapterConstructor } from '../wiring';
|
|
3
|
+
/**
|
|
4
|
+
* The decorator returned by `@wire()`; not the `wire` function.
|
|
5
|
+
*
|
|
6
|
+
* For TypeScript users:
|
|
7
|
+
* - If you are seeing an unclear error message, ensure that both the type of the decorated prop and
|
|
8
|
+
* the config used match the types expected by the wire adapter.
|
|
9
|
+
* - String literal types in the config are resolved to the corresponding prop on the component.
|
|
10
|
+
* For example, a component with `id = 555` and `@wire(getBook, {id: "$id"} as const) book` will
|
|
11
|
+
* have `"$id"` resolve to type `number`.
|
|
12
|
+
*/
|
|
13
|
+
interface WireDecorator<Value, Class> {
|
|
14
|
+
(target: unknown, context: ClassFieldDecoratorContext<Class, Value | undefined> | ClassMethodDecoratorContext<Class, Value extends (value: any) => any ? Value : (this: Class, value: Value) => void> | ClassGetterDecoratorContext<Class, Value | undefined> | ClassSetterDecoratorContext<Class, Value>): void;
|
|
15
|
+
}
|
|
3
16
|
/**
|
|
4
17
|
* Decorator factory to wire a property or method to a wire adapter data source.
|
|
5
18
|
* @param adapter the adapter used to provision data
|
|
@@ -11,5 +24,6 @@ import type { ConfigValue, ContextValue, DataCallback, ReplaceReactiveValues, Wi
|
|
|
11
24
|
* \@wire(getBook, { id: '$bookId'}) book;
|
|
12
25
|
* }
|
|
13
26
|
*/
|
|
14
|
-
export default function wire<ReactiveConfig extends ConfigValue = ConfigValue, Value = any, Context extends ContextValue = ContextValue, Class
|
|
27
|
+
export default function wire<ReactiveConfig extends ConfigValue = ConfigValue, Value = any, Context extends ContextValue = ContextValue, Class = LightningElement>(adapter: WireAdapterConstructor<ReplaceReactiveValues<ReactiveConfig, Class>, Value, Context>, config?: ReactiveConfig): WireDecorator<Value, Class>;
|
|
15
28
|
export declare function internalWireFieldDecorator(key: string): PropertyDescriptor;
|
|
29
|
+
export {};
|
|
@@ -50,13 +50,17 @@ export interface ContextProviderOptions {
|
|
|
50
50
|
export type ContextProvider = (elmOrComponent: EventTarget, options: ContextProviderOptions) => void;
|
|
51
51
|
export type RegisterContextProviderFn = (element: HostElement, adapterContextToken: string, onContextSubscription: WireContextSubscriptionCallback) => void;
|
|
52
52
|
/** Resolves a property chain to the corresponding value on the target type. */
|
|
53
|
-
type ResolveReactiveValue<
|
|
53
|
+
type ResolveReactiveValue<
|
|
54
|
+
/** The object to search for properties; initially the component. */
|
|
55
|
+
Target,
|
|
56
|
+
/** A string representing a chain of of property keys, e.g. "data.user.name". */
|
|
57
|
+
Keys extends string> = Keys extends `${infer FirstKey}.${infer Rest}` ? FirstKey extends keyof Target ? ResolveReactiveValue<Target[FirstKey], Rest> : undefined : Keys extends keyof Target ? Target[Keys] : undefined;
|
|
54
58
|
/**
|
|
55
59
|
* Detects if the `Value` type is a property chain starting with "$". If so, it resolves the
|
|
56
60
|
* properties to the corresponding value on the target type.
|
|
57
61
|
*/
|
|
58
62
|
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
|
|
63
|
+
export type ReplaceReactiveValues<Config extends ConfigValue, Component> = {
|
|
60
64
|
[K in keyof Config]: ResolveValueIfReactive<Config[K], Component>;
|
|
61
65
|
};
|
|
62
66
|
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -2378,8 +2378,10 @@ 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
|
-
|
|
2381
|
+
function track(target,
|
|
2382
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2383
|
+
context) {
|
|
2384
|
+
if (arguments.length === 1) {
|
|
2383
2385
|
return getReactiveProxy(target);
|
|
2384
2386
|
}
|
|
2385
2387
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -8092,5 +8094,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
8092
8094
|
exports.track = track;
|
|
8093
8095
|
exports.unwrap = unwrap;
|
|
8094
8096
|
exports.wire = wire;
|
|
8095
|
-
/** version: 7.
|
|
8097
|
+
/** version: 7.2.0 */
|
|
8096
8098
|
//# sourceMappingURL=index.cjs.js.map
|