aem-react-js
Version:
AEM components written in React.
55 lines (54 loc) • 2 kB
TypeScript
export interface SlingResourceOptions {
readonly depth?: number;
readonly skipData?: boolean;
readonly selectors: string[];
}
export interface EditDialogData {
readonly element: string;
readonly html?: string;
readonly attributes?: {
[name: string]: any;
};
readonly child?: EditDialogData;
}
export interface IncludeOptions {
readonly addSelectors?: string[];
readonly selectors?: string[];
readonly decorationTagName?: string;
}
declare const calculateSelectors: (selectors: string[], options?: IncludeOptions) => string[];
export { calculateSelectors };
/**
* interface that provides standard aem featres for the resource components.
*/
export interface Sling {
/**
* Request a resource.
* @param listener the component that needs the resource
* @param path resource path
* @param options options like level depth of resource tree
*/
load(listener: (resource: any) => void, path: string, options?: SlingResourceOptions): void;
/**
* get the aem wrapper element for the component
* of the given resourceType at the given resource path.
* @param path
* @param resourceType
*/
renderDialogScript(path: string, resourceType: string): EditDialogData;
/**
* Include a component's html.
* @param path
* @param resourceType
*/
includeResource(path: string, selectors: string[], resourceType: string, options: IncludeOptions): string;
getRequestPath(): string;
getContainingPagePath(): string;
}
export declare abstract class AbstractSling implements Sling {
abstract load(listener: (resource: any) => void, path: string, options?: SlingResourceOptions): void;
abstract renderDialogScript(path: string, resourceType: string): EditDialogData;
abstract includeResource(path: string, selectors: string[], resourceType: string, options: IncludeOptions): string;
abstract getRequestPath(): string;
getContainingPagePath(): string;
}