UNPKG

docxml

Version:

TypeScript (component) library for building and parsing a DOCX file

49 lines (48 loc) 2.02 kB
import './Break.js'; import './FieldRangeEnd.js'; import './FieldRangeInstruction.js'; import './FieldRangeSeparator.js'; import './FieldRangeStart.js'; import './Image.js'; import './NonBreakingHyphen.js'; import './Symbol.js'; import './Tab.js'; import { type ComponentAncestor, Component, ComponentContext } from '../classes/Component.js'; import { type TextProperties } from '../properties/text-properties.js'; import { type Break } from './Break.js'; import { type FieldRangeEnd } from './FieldRangeEnd.js'; import { type FieldRangeInstruction } from './FieldRangeInstruction.js'; import { type FieldRangeSeparator } from './FieldRangeSeparator.js'; import { type FieldRangeStart } from './FieldRangeStart.js'; import { type Image } from './Image.js'; import { type NonBreakingHyphen } from './NonBreakingHyphen.js'; import { type Symbol } from './Symbol.js'; import { type Tab } from './Tab.js'; /** * A type describing the components accepted as children of {@link Text}. */ export declare type TextChild = string | Break | FieldRangeEnd | FieldRangeInstruction | FieldRangeSeparator | FieldRangeStart | Image | NonBreakingHyphen | Symbol | Tab; /** * A type describing the props accepted by {@link Text}. */ export declare type TextProps = TextProperties; /** * A component that represents text. All inline formatting options, such as bold/italic/underline, * are in fact different props or styles on the `<Text>` component. */ export declare class Text extends Component<TextProps, TextChild> { static readonly children: string[]; static readonly mixed: boolean; /** * Creates an XML DOM node for this component instance. */ toNode(ancestry: ComponentAncestor[]): Promise<Node>; /** * Asserts whether or not a given XML node correlates with this component. */ static matchesNode(node: Node): boolean; /** * Instantiate this component from the XML in an existing DOCX file. */ static fromNode(node: Node, context: ComponentContext): Text; }