@lwc/engine-core 7.3.0-alpha.0 → 7.3.0-alpha.1
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/wire.d.ts +2 -2
- package/dist/framework/stylesheet.d.ts +2 -2
- package/dist/framework/wiring/index.d.ts +1 -1
- package/dist/framework/wiring/types.d.ts +0 -28
- package/dist/index.cjs.js +16 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +16 -9
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { WireAdapterConstructor } from '../wiring';
|
|
2
2
|
/**
|
|
3
3
|
* Decorator factory to wire a property or method to a wire adapter data source.
|
|
4
4
|
* @param adapter the adapter used to provision data
|
|
@@ -10,5 +10,5 @@ import type { ConfigValue, ContextValue, ReplaceReactiveValues, WireAdapterConst
|
|
|
10
10
|
* \@wire(getBook, { id: '$bookId'}) book;
|
|
11
11
|
* }
|
|
12
12
|
*/
|
|
13
|
-
export default function wire
|
|
13
|
+
export default function wire(adapter: WireAdapterConstructor, config?: Record<string, any>): (value: unknown, context: ClassMemberDecoratorContext | string | symbol) => void;
|
|
14
14
|
export declare function internalWireFieldDecorator(key: string): PropertyDescriptor;
|
|
@@ -12,7 +12,7 @@ export type Stylesheet = (stylesheetToken: string | undefined, useActualHostSele
|
|
|
12
12
|
*/
|
|
13
13
|
export type Stylesheets = Array<Stylesheet | Stylesheets>;
|
|
14
14
|
export declare function updateStylesheetToken(vm: VM, template: Template, legacy: boolean): void;
|
|
15
|
-
export declare function getStylesheetsContent(vm: VM, template: Template): string
|
|
15
|
+
export declare function getStylesheetsContent(vm: VM, template: Template): ReadonlyArray<string>;
|
|
16
16
|
/**
|
|
17
17
|
* If the component that is currently being rendered uses scoped styles,
|
|
18
18
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
@@ -29,5 +29,5 @@ export declare function getScopeTokenClass(owner: VM, legacy: boolean): string |
|
|
|
29
29
|
* @param vnode
|
|
30
30
|
*/
|
|
31
31
|
export declare function getStylesheetTokenHost(vnode: VCustomElement): string | null;
|
|
32
|
-
export declare function createStylesheet(vm: VM, stylesheets: string
|
|
32
|
+
export declare function createStylesheet(vm: VM, stylesheets: ReadonlyArray<string>): VNode[] | null;
|
|
33
33
|
export declare function unrenderStylesheet(stylesheet: Stylesheet): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createContextProviderWithRegister, createContextWatcher } from './context';
|
|
2
|
-
export { ConfigCallback, ConfigValue, ContextConsumer, ContextProvider, ContextValue, DataCallback,
|
|
2
|
+
export { ConfigCallback, ConfigValue, ContextConsumer, ContextProvider, ContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './types';
|
|
3
3
|
export { connectWireAdapters, disconnectWireAdapters, installWireAdapters, storeWiredFieldMeta, storeWiredMethodMeta, } from './wiring';
|
|
@@ -16,26 +16,6 @@ export interface WireAdapterConstructor<Config extends ConfigValue = ConfigValue
|
|
|
16
16
|
configSchema?: Record<keyof Config, WireAdapterSchemaValue>;
|
|
17
17
|
contextSchema?: Record<keyof Context, WireAdapterSchemaValue>;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* The decorator returned by `@wire()`; not the `wire` factory function.
|
|
21
|
-
*
|
|
22
|
-
* If you're using `@wire(adapter) property` and getting an opaque type error, ensure that the
|
|
23
|
-
* property is explicitly typed and the type matches the value used by the adapter. Note that one
|
|
24
|
-
* of the following conditions must always be true:
|
|
25
|
-
* - The adapter uses `undefined` as a possible value
|
|
26
|
-
* - The property is marked as optional
|
|
27
|
-
* - The property is assigned a default value (not provided by the adapter)
|
|
28
|
-
*/
|
|
29
|
-
export interface WireDecorator<Value = any> {
|
|
30
|
-
/** Property decorator for `"experimentalDecorators": false`. */
|
|
31
|
-
<Class extends LightningElement>(target: undefined, ctx: ClassFieldDecoratorContext<Class, Value>): void;
|
|
32
|
-
/** Method decorator for `"experimentalDecorators": false`. */
|
|
33
|
-
<Class extends LightningElement>(target: DataCallback<Value>, ctx: ClassMethodDecoratorContext<Class, DataCallback<Value>>): void | DataCallback<Value>;
|
|
34
|
-
/** Property decorator for `"experimentalDecorators": true`. */
|
|
35
|
-
<K extends string | symbol>(target: Record<K, Value>, propertyKey: K): void;
|
|
36
|
-
/** Method decorator for `"experimentalDecorators": true`. */
|
|
37
|
-
<K extends string | symbol>(target: Record<K, DataCallback<Value>>, propertyKey: K, descriptor: TypedPropertyDescriptor<DataCallback<Value>>): void;
|
|
38
|
-
}
|
|
39
19
|
export interface WireDef {
|
|
40
20
|
method?: (data: any) => void;
|
|
41
21
|
adapter: WireAdapterConstructor;
|
|
@@ -69,11 +49,3 @@ export interface ContextProviderOptions {
|
|
|
69
49
|
}
|
|
70
50
|
export type ContextProvider = (elmOrComponent: EventTarget, options: ContextProviderOptions) => void;
|
|
71
51
|
export type RegisterContextProviderFn = (element: HostElement, adapterContextToken: string, onContextSubscription: WireContextSubscriptionCallback) => void;
|
|
72
|
-
/**
|
|
73
|
-
* String values starting with "$" are reactive; they get replaced by values from the component.
|
|
74
|
-
* We don't have access to the component, and we don't expect all reactive strings to be typed as
|
|
75
|
-
* literals, so we just replace all strings with `any`.
|
|
76
|
-
*/
|
|
77
|
-
export type ReplaceReactiveValues<T> = {
|
|
78
|
-
[K in keyof T]: T[K] extends string ? any : T[K];
|
|
79
|
-
};
|
package/dist/index.cjs.js
CHANGED
|
@@ -3133,15 +3133,22 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3133
3133
|
function getStylesheetsContent(vm, template) {
|
|
3134
3134
|
const { stylesheets, stylesheetToken } = template;
|
|
3135
3135
|
const { stylesheets: vmStylesheets } = vm;
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3136
|
+
const hasTemplateStyles = hasStyles(stylesheets);
|
|
3137
|
+
const hasVmStyles = hasStyles(vmStylesheets);
|
|
3138
|
+
if (hasTemplateStyles) {
|
|
3139
|
+
const content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3140
|
+
if (hasVmStyles) {
|
|
3141
|
+
// Slow path – merge the template styles and vm styles
|
|
3142
|
+
shared.ArrayPush.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
3143
|
+
}
|
|
3144
|
+
return content;
|
|
3145
|
+
}
|
|
3146
|
+
if (hasVmStyles) {
|
|
3147
|
+
// No template styles, so return vm styles directly
|
|
3148
|
+
return evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm);
|
|
3149
|
+
}
|
|
3150
|
+
// Fastest path - no styles, so return an empty array
|
|
3151
|
+
return EmptyArray;
|
|
3145
3152
|
}
|
|
3146
3153
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3147
3154
|
// perf testing has not shown it to be a huge improvement yet:
|