@memberjunction/react-runtime
Version:
Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.
52 lines • 2.32 kB
TypeScript
import { RuntimeContext } from '../types';
import { ComponentCompiler } from '../compiler';
import { ComponentRegistry } from '../registry';
import { ComponentSpec, ComponentStyles } from '@memberjunction/interactive-component-types';
import { UserInfo } from '@memberjunction/core';
import { ComponentLibraryEntity } from '@memberjunction/core-entities';
export interface HierarchyRegistrationResult {
success: boolean;
registeredComponents: string[];
errors: ComponentRegistrationError[];
warnings: string[];
resolvedSpec?: ComponentSpec;
}
export interface ComponentRegistrationError {
componentName: string;
error: string;
phase: 'compilation' | 'registration' | 'validation';
}
export interface HierarchyRegistrationOptions {
styles?: ComponentStyles;
namespace?: string;
version?: string;
continueOnError?: boolean;
allowOverride?: boolean;
allLibraries: ComponentLibraryEntity[];
debug?: boolean;
contextUser?: UserInfo;
}
export declare class ComponentHierarchyRegistrar {
private compiler;
private registry;
private runtimeContext;
constructor(compiler: ComponentCompiler, registry: ComponentRegistry, runtimeContext: RuntimeContext);
private fetchExternalComponent;
registerHierarchy(rootSpec: ComponentSpec, options: HierarchyRegistrationOptions): Promise<HierarchyRegistrationResult>;
registerSingleComponent(spec: ComponentSpec, options: {
styles?: ComponentStyles;
namespace?: string;
version?: string;
allowOverride?: boolean;
allLibraries: ComponentLibraryEntity[];
}): Promise<{
success: boolean;
error?: ComponentRegistrationError;
}>;
private registerChildComponents;
}
export declare function registerComponentHierarchy(rootSpec: ComponentSpec, compiler: ComponentCompiler, registry: ComponentRegistry, runtimeContext: RuntimeContext, options: HierarchyRegistrationOptions): Promise<HierarchyRegistrationResult>;
export declare function validateComponentSpec(spec: ComponentSpec): string[];
export declare function flattenComponentHierarchy(rootSpec: ComponentSpec): ComponentSpec[];
export declare function countComponentsInHierarchy(rootSpec: ComponentSpec, includeEmpty?: boolean): number;
//# sourceMappingURL=component-hierarchy.d.ts.map