import type { Show } from 'fp-ts/Show' import { Endomorphism } from 'fp-ts/function' /** * @category model * @since 0.0.1 */ export declare type Token = TagOpen | TagClose | Text | Comment /** * @category model * @since 0.0.1 */ export interface TagOpen { readonly _tag: 'TagOpen' readonly name: string readonly attributes: ReadonlyArray } /** * @category model * @since 0.0.1 */ export interface TagClose { readonly _tag: 'TagClose' readonly name: string } /** * @category model * @since 0.0.1 */ export interface Text { readonly _tag: 'Text' readonly text: string } /** * @category model * @since 0.0.1 */ export interface Comment { readonly _tag: 'Comment' readonly comment: string } /** * @category model * @since 0.0.1 */ export interface Attribute { readonly key: string readonly value: string } /** * @category constructors * @since 0.0.1 */ export declare const TagOpen: (name: string, attributes: ReadonlyArray) => Token /** * @category constructors * @since 0.0.1 */ export declare const TagClose: (name: string) => Token /** * @category constructors * @since 0.0.1 */ export declare const Text: (text: string) => Token /** * @category constructors * @since 0.0.1 */ export declare const Comment: (comment: string) => Token /** * @category constructors * @since 0.0.1 */ export declare const Attribute: (key: string, value: string) => Attribute /** * @category destructors * @since 0.0.1 */ export declare const fold: (patterns: { readonly TagOpen: (name: string, attributes: ReadonlyArray) => R readonly TagClose: (name: string) => R readonly Text: (text: string) => R readonly Comment: (comment: string) => R }) => (token: Token) => R /** * Reduces the complexity of a tokenized HTML document by dropping empty `Text` tokens. * * @category combinators * @since 0.0.1 */ export declare const canonicalizeTokens: Endomorphism> /** * @category parsers * @since 0.0.1 */ export declare const parse: (source: string) => ReadonlyArray /** * @category instances * @since 0.0.1 */ export declare const showToken: Show