@lcem/unified-view-generator
Advanced tools
Comparing version
@@ -1,24 +0,1 @@ | ||
export interface Slots<C> { | ||
[name: string]: (C & Indexable)[]; | ||
} | ||
export interface Indexable { | ||
key: string; | ||
} | ||
export interface MayContainOtherComponents<C> { | ||
slots?: Slots<C>; | ||
} | ||
export interface Properties { | ||
[name: string]: any; | ||
} | ||
export interface ComponentDefinition<C> { | ||
create(properties: Properties, slots?: Slots<C>): C; | ||
} | ||
export declare type ComponentInstances = Slots<LWCComponentInstance>; | ||
export interface LWCComponentInstance extends MayContainOtherComponents<LWCComponentInstance> { | ||
descriptor: string; | ||
properties: Properties; | ||
slots?: ComponentInstances; | ||
key?: string; | ||
} | ||
export declare type KeyedLWCComponentInstance = LWCComponentInstance & Indexable; | ||
export type JSONSchemaMetaSchema = Schema | boolean; | ||
@@ -104,2 +81,7 @@ export interface Schema { | ||
export type View = Component; | ||
export interface View2 { | ||
definition: string; | ||
attributes?: Record<string, JsonValue>; | ||
children?: View2[]; | ||
} | ||
export interface DataProviderInstance { | ||
@@ -111,9 +93,35 @@ getData(): JsonValue; | ||
} | ||
export interface Slots<C> { | ||
[name: string]: (C & Indexable)[]; | ||
} | ||
export interface Indexable { | ||
key: string; | ||
} | ||
export interface MayContainOtherComponents<C> { | ||
slots?: Slots<C>; | ||
} | ||
export interface Properties { | ||
[name: string]: any; | ||
} | ||
export interface ComponentDefinition<C> { | ||
create(properties: Properties, slots?: Slots<C>): C; | ||
} | ||
export declare type ComponentInstances = Slots<LWCComponentInstance>; | ||
export interface LWCComponentInstance extends MayContainOtherComponents<LWCComponentInstance> { | ||
descriptor: string; | ||
properties: Properties; | ||
slots?: ComponentInstances; | ||
key?: string; | ||
} | ||
export declare type KeyedLWCComponentInstance = LWCComponentInstance & Indexable; | ||
/** | ||
* Given a piece of UEM, asynchronously convert it to the generic shape C passed in. | ||
*/ | ||
export interface ComponentResolver<C extends MayContainOtherComponents<C>> { | ||
resolve(component: Component): Promise<ComponentDefinition<C> | null>; | ||
resolve(component: Component | View2): Promise<ComponentDefinition<C> | null>; | ||
} | ||
export declare class ComponentResolverChain<C> implements ComponentResolver<C> { | ||
export declare class ComponentResolverChain<C extends MayContainOtherComponents<C>> implements ComponentResolver<C> { | ||
private readonly resolvers; | ||
constructor(resolvers: ComponentResolver<C>[]); | ||
resolve(component: Component): Promise<ComponentDefinition<C> | null>; | ||
resolve(component: Component | View2): Promise<ComponentDefinition<C> | null>; | ||
} | ||
@@ -120,0 +128,0 @@ export interface UiGenerationResult<C extends MayContainOtherComponents<C>> { |
@@ -49,5 +49,2 @@ import { ViewReducer, isExpression, extract } from '@lcem/unified-view-model'; | ||
} | ||
getChildrenReducer() { | ||
return undefined; | ||
} | ||
async reduce(context, definition, properties, regions) { | ||
@@ -54,0 +51,0 @@ const componentDefinition = await this.resolver.resolve({ definition, properties }); |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"main": "dist/index.js", | ||
@@ -25,7 +25,9 @@ "types": "dist/index.d.ts", | ||
"test": "jest", | ||
"test:update": "jest --updateSnapshot", | ||
"test:coverage": "jest --coverage" | ||
}, | ||
"dependencies": { | ||
"@lcem/unified-view-model": "0.10.0" | ||
"@lcem/meta-schemas": "0.10.1", | ||
"@lcem/unified-view-model": "0.10.1" | ||
} | ||
} |
8627
3.42%242
2.11%2
100%+ Added
+ Added
+ Added
- Removed
- Removed