/** * @packageDocumentation * @module @hydrofoil/shaperone-wc/templates */ import { CSSResult, TemplateResult, CSSResultGroup } from 'lit'; import { FocusNodeState, PropertyObjectState, PropertyState } from '@hydrofoil/shaperone-core/models/forms'; import type { FocusNodeRenderer, FormRenderer, GroupRenderer, ObjectRenderer, PropertyRenderer } from '@hydrofoil/shaperone-core/renderer.js'; import type { NamedNode } from '@rdfjs/types'; export * from './renderer/decorator.js'; /** * Base template. Extend to create templates which can dynamically load dependencies or inject CSS styles */ export interface RenderTemplate { /** * All styles get combined and inserted into the form */ styles?: CSSResult | CSSResultGroup; /** * Gets called by the renderer when the form is initialised */ loadDependencies?(): Array>; } /** * Renders the form */ export interface FormTemplate extends RenderTemplate { (context: FormRenderer): TemplateResult; } /** * Renders a focus node */ export interface FocusNodeTemplate extends RenderTemplate { (context: FocusNodeRenderer, args: { focusNode: FocusNodeState; }): TemplateResult; } /** * Renders an object of a group of properties */ export interface GroupTemplate extends RenderTemplate { (context: GroupRenderer, args: { properties: PropertyState[]; }): TemplateResult; } /** * Renders an object of a property */ export interface PropertyTemplate extends RenderTemplate { (context: PropertyRenderer, args: { property: PropertyState; }): TemplateResult; } /** * Renders an object of a property */ export interface ObjectTemplate extends RenderTemplate { (context: ObjectRenderer, arg: { object: PropertyObjectState; }): TemplateResult; } /** * Templates related to editors */ export interface EditorTemplates { notFound(): TemplateResult; } /** * Templates related to rendering components */ export interface ComponentTemplates { notFound(this: PropertyRenderer, editor: NamedNode): TemplateResult; loading(): TemplateResult; loadingFailed(reason: string): TemplateResult; initializing(): TemplateResult; } /** * Default set of templates which can be called from the renderer to * build the final HTML output from reusable parts */ export interface RenderTemplates { /** * Rendered when the form is preparing */ initialising(): TemplateResult; form: FormTemplate; focusNode: FocusNodeTemplate; group: GroupTemplate; property: PropertyTemplate; object: ObjectTemplate; editor: EditorTemplates; component: ComponentTemplates; } /** * Default implementation of {@link RenderTemplates} which outputs native HTML elements */ export declare const templates: RenderTemplates; //# sourceMappingURL=templates.d.ts.map