forked from viktorstrate/react-mathquill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
82 lines (73 loc) · 2.48 KB
/
index.d.ts
File metadata and controls
82 lines (73 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
declare module '@synonym-bio/react-mathquill' {
import * as React from 'react'
export function addStyles(): void
export interface StaticMathFieldProps
extends React.HTMLAttributes<HTMLSpanElement> {
children?: string
mathquillDidMount?: (mathField: MathField) => void
}
export interface EditableMathFieldProps
extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onChange'> {
onChange?: (mathField: MathField) => void
latex?: string
config?: MathFieldConfig
mathquillDidMount?: (mathField: MathField) => void
}
export const EditableMathField: React.FunctionComponent<EditableMathFieldProps>
export const StaticMathField: React.FunctionComponent<StaticMathFieldProps>
export interface MathFieldConfig {
spaceBehavesLikeTab?: boolean
leftRightIntoCmdGoes?: 'up' | 'down'
restrictMismatchedBrackets?: boolean
sumStartsWithNEquals?: boolean
supSubsRequireOperand?: boolean
charsThatBreakOutOfSupSub?: string
autoSubscriptNumerals?: boolean
autoCommands?: string
autoOperatorNames?: string
substituteTextarea?: () => void
handlers?: {
deleteOutOf?: (direction: Direction, mathField: MathField) => void
moveOutOf?: (direction: Direction, mathField: MathField) => void
selectOutOf?: (direction: Direction, mathField: MathField) => void
downOutOf?: (mathField: MathField) => void
upOutOf?: (mathField: MathField) => void
edit?: (mathField: MathField) => void
enter?: (mathField: MathField) => void
}
maxDepth?: number
}
export enum Direction {
R,
L,
}
// Represents one character that belongs to an identifier.
export interface IdentifierToken {
id: string | number
text: string
type: 'letter' | 'number' | 'underscore' | 'period' | 'quote' | 'unknown'
belongsTo: 'object' | 'property' | 'period' | 'literal' | 'none'
element: Element | Text | undefined
setElement: (element: Element | Text | undefined) => void
}
export interface MathField {
revert(): void
reflow(): void
el(): HTMLElement
latex(): string
latex(latexString: string): void
text(): string
focus(): void
blur(): void
write(latex: string): void
cmd(latexString: string): void
select(): void
clearSelection(): void
moveToLeftEnd(): void
moveToRightEnd(): void
keystroke(keys: string): void
typedText(text: string): void
config(newConfig: MathFieldConfig): void
parseSemanticTypes(): IdentifierToken[][]
}
}