Something went wrong. Try again.
Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
Something went wrong. Try again.
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245/* * Copyright (C) 2023-2025 Yomitan Authors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */
import type * as DictionaryData from './dictionary-data';
export type VerticalAlign = 'baseline' | 'sub' | 'super' | 'text-top' | 'text-bottom' | 'middle' | 'top' | 'bottom';
export type TextDecorationLine = 'underline' | 'overline' | 'line-through';
export type TextDecorationLineOrNone = 'none' | TextDecorationLine;
export type TextDecorationStyle = 'solid' | 'double' | 'dotted' | 'dashed' | 'wavy';
export type FontStyle = 'normal' | 'italic';
export type FontWeight = 'normal' | 'bold';
export type WordBreak = 'normal' | 'break-all' | 'keep-all';
export type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'justify-all' | 'match-parent';
export type SizeUnits = 'px' | 'em';
export type ImageRendering = 'auto' | 'pixelated' | 'crisp-edges';
export type ImageAppearance = 'auto' | 'monochrome';
export type Image = DictionaryData.TermImage & { verticalAlign: VerticalAlign; border: string; borderRadius: string; sizeUnits: SizeUnits;};
export type Data = { [key: string]: string;};
export type StructuredContentStyle = { fontStyle?: FontStyle; fontWeight?: FontWeight; fontSize?: string; color?: string; background?: string; backgroundColor?: string; textDecorationLine?: TextDecorationLineOrNone | TextDecorationLine[]; textDecorationStyle?: TextDecorationStyle; textDecorationColor?: string; borderColor?: string; borderStyle?: string; borderRadius?: string; borderWidth?: string; clipPath?: string; verticalAlign?: VerticalAlign; textAlign?: TextAlign; textEmphasis?: string; textShadow?: string; margin?: string; marginTop?: number | string; marginLeft?: number | string; marginRight?: number | string; marginBottom?: number | string; padding?: string; paddingTop?: string; paddingLeft?: string; paddingRight?: string; paddingBottom?: string; wordBreak?: WordBreak; whiteSpace?: string; cursor?: string; listStyleType?: string;};
export type LineBreak = { tag: 'br'; data?: Data; /** * This element doesn't support children. */ content?: undefined; /** * This element doesn't support language. */ lang?: undefined;};
export type UnstyledElement = { tag: 'ruby' | 'rt' | 'rp' | 'table' | 'thead' | 'tbody' | 'tfoot' | 'tr'; content?: Content; data?: Data; /** * Defines the language of an element in the format defined by RFC 5646. */ lang?: string;};
export type TableElement = { tag: 'td' | 'th'; content?: Content; data?: Data; colSpan?: number; rowSpan?: number; style?: StructuredContentStyle; /** * Defines the language of an element in the format defined by RFC 5646. */ lang?: string;};
export type StyledElement = { tag: 'span' | 'div' | 'ol' | 'ul' | 'li' | 'details' | 'summary'; content?: Content; data?: Data; style?: StructuredContentStyle; /** * Hover text for the element. */ title?: string; /** * Whether or not the details element is open by default. */ open?: boolean; /** * Defines the language of an element in the format defined by RFC 5646. */ lang?: string;};
export type ImageElementBase = { data?: Data; /** * Path to the image file in the archive. */ path: string; /** * Preferred width of the image. */ width?: number; /** * Preferred height of the image. */ height?: number; /** * Preferred width of the image. * This is only used in the internal database. */ preferredWidth?: number; /** * Preferred height of the image. * This is only used in the internal database. */ preferredHeight?: number; /** * Hover text for the image. */ title?: string; /** * Alt text for the image. */ alt?: string; /** * Description of the image. */ description?: string; /** * Whether or not the image should appear pixelated at sizes larger than the image's native resolution. */ pixelated?: boolean; /** * Controls how the image is rendered. The value of this field supersedes the pixelated field. */ imageRendering?: ImageRendering; /** * Controls the appearance of the image. The 'monochrome' value will mask the opaque parts of the image using the current text color. */ appearance?: ImageAppearance; /** * Whether or not a background color is displayed behind the image. */ background?: boolean; /** * Whether or not the image is collapsed by default. */ collapsed?: boolean; /** * Whether or not the image can be collapsed. */ collapsible?: boolean;};
export type ImageElement = ImageElementBase & { tag: 'img'; /** * This element doesn't support children. */ content?: undefined; /** * The vertical alignment of the image. */ verticalAlign?: VerticalAlign; /** * Shorthand for border width, style, and color. */ border?: string; /** * Roundness of the corners of the image's outer border edge. */ borderRadius?: string; /** * The units for the width and height. */ sizeUnits?: SizeUnits;};
export type LinkElement = { tag: 'a'; content?: Content; /** * The URL for the link. URLs starting with a ? are treated as internal links to other dictionary content. */ href: string; /** * Defines the language of an element in the format defined by RFC 5646. */ lang?: string;};
export type Element = LineBreak | UnstyledElement | TableElement | StyledElement | ImageElement | LinkElement;
export type Content = string | Element | Content[];