UNPKG

@antv/t8

Version:

T8 is a text visualization solution for unstructured data within the AntV technology stack, and it is a declarative JSON Schema syntax that can be used to describe the content of data interpretation reports.

79 lines 2.46 kB
import { NarrativeTextSpec } from './schema'; import { SeedTokenOptions } from './theme'; import { PluginType } from './plugin'; import EE from '@antv/event-emitter'; import { T8ClarinetParseResult } from './utils/t8ClarinetParser'; /** * Text component for rendering narrative text visualizations. * * Usage: * ```javascript * const text = new Text('#container'); * text.schema(spec).theme(theme).render(); * ``` */ export declare class Text extends EE { /** * Container for the text visualization. */ container: HTMLElement; /** * Specification for the narrative text visualization. */ private spec; /** * Theme configuration for the text visualization. */ private themeSeedToken; /** * Plugin manager for the text visualization. */ private pluginManager; /** * The streaming parser for the NTV schema. */ private parser; constructor(container: string | HTMLElement); /** * Set the schema for the narrative text visualization. * @param spec - The specification object containing narrative text details. * @returns The Text instance for method chaining. */ schema(spec: NarrativeTextSpec): this; /** * Set the theme for the narrative text visualization. * @param theme - The theme configuration for the text visualization. * @returns The Text instance for method chaining. */ theme(theme: 'dark' | 'light', seedToken?: Partial<SeedTokenOptions>): this; /** * Register a plugin for the text visualization. * @param plugin - The plugin to register. * @returns The Text instance for method chaining. */ registerPlugin(plugin: PluginType): this; /** * Render the narrative text visualization. * @returns A function to unmount the component. */ render(): () => void; /** * Stream render the narrative text visualization. * @param newJSONFragment - The new JSON fragment to render. * @param options - The options for the stream render. * @returns The Text instance for method chaining. */ streamRender(newJSONFragment: string, options?: { onError?: (error: string) => void; onComplete?: (result: T8ClarinetParseResult) => void; }): void; /** * Clear the parser. */ clear(): void; /** * Unmount the component. */ unmount(): void; } //# sourceMappingURL=text.d.ts.map