overtype 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -15
- package/dist/overtype.cjs +393 -40
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.d.ts +169 -0
- package/dist/overtype.esm.js +393 -40
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +398 -40
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +97 -74
- package/package.json +4 -2
- package/src/link-tooltip.js +16 -16
- package/src/overtype.d.ts +23 -1
- package/src/overtype.js +167 -13
- package/src/parser.js +276 -55
- package/src/styles.js +16 -8
- package/src/toolbar.js +63 -2
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Type definitions for OverType
|
|
2
|
+
// Project: https://github.com/panphora/overtype
|
|
3
|
+
// Definitions generated from JSDoc comments and implementation
|
|
4
|
+
|
|
5
|
+
export interface Theme {
|
|
6
|
+
name: string;
|
|
7
|
+
colors: {
|
|
8
|
+
bgPrimary?: string;
|
|
9
|
+
bgSecondary?: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
textSecondary?: string;
|
|
12
|
+
h1?: string;
|
|
13
|
+
h2?: string;
|
|
14
|
+
h3?: string;
|
|
15
|
+
strong?: string;
|
|
16
|
+
em?: string;
|
|
17
|
+
link?: string;
|
|
18
|
+
code?: string;
|
|
19
|
+
codeBg?: string;
|
|
20
|
+
blockquote?: string;
|
|
21
|
+
hr?: string;
|
|
22
|
+
syntaxMarker?: string;
|
|
23
|
+
listMarker?: string;
|
|
24
|
+
cursor?: string;
|
|
25
|
+
selection?: string;
|
|
26
|
+
rawLine?: string;
|
|
27
|
+
// Toolbar theme colors
|
|
28
|
+
toolbarBg?: string;
|
|
29
|
+
toolbarIcon?: string;
|
|
30
|
+
toolbarHover?: string;
|
|
31
|
+
toolbarActive?: string;
|
|
32
|
+
border?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Stats {
|
|
37
|
+
words: number;
|
|
38
|
+
chars: number;
|
|
39
|
+
lines: number;
|
|
40
|
+
line: number;
|
|
41
|
+
column: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface MobileOptions {
|
|
45
|
+
fontSize?: string;
|
|
46
|
+
padding?: string;
|
|
47
|
+
lineHeight?: string | number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Options {
|
|
51
|
+
// Typography
|
|
52
|
+
fontSize?: string;
|
|
53
|
+
lineHeight?: string | number;
|
|
54
|
+
fontFamily?: string;
|
|
55
|
+
padding?: string;
|
|
56
|
+
|
|
57
|
+
// Mobile responsive
|
|
58
|
+
mobile?: MobileOptions;
|
|
59
|
+
|
|
60
|
+
// Native textarea attributes (v1.1.2+)
|
|
61
|
+
textareaProps?: Record<string, any>;
|
|
62
|
+
|
|
63
|
+
// Behavior
|
|
64
|
+
autofocus?: boolean;
|
|
65
|
+
autoResize?: boolean; // v1.1.2+ Auto-expand height with content
|
|
66
|
+
minHeight?: string; // v1.1.2+ Minimum height for autoResize mode
|
|
67
|
+
maxHeight?: string | null; // v1.1.2+ Maximum height for autoResize mode
|
|
68
|
+
placeholder?: string;
|
|
69
|
+
value?: string;
|
|
70
|
+
|
|
71
|
+
// Features
|
|
72
|
+
showActiveLineRaw?: boolean;
|
|
73
|
+
showStats?: boolean;
|
|
74
|
+
toolbar?: boolean | {
|
|
75
|
+
buttons?: Array<{
|
|
76
|
+
name?: string;
|
|
77
|
+
icon?: string;
|
|
78
|
+
title?: string;
|
|
79
|
+
action?: string;
|
|
80
|
+
separator?: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
};
|
|
83
|
+
smartLists?: boolean; // v1.2.3+ Smart list continuation
|
|
84
|
+
statsFormatter?: (stats: Stats) => string;
|
|
85
|
+
|
|
86
|
+
// Theme (deprecated in favor of global theme)
|
|
87
|
+
theme?: string | Theme;
|
|
88
|
+
colors?: Partial<Theme['colors']>;
|
|
89
|
+
|
|
90
|
+
// Callbacks
|
|
91
|
+
onChange?: (value: string, instance: OverTypeInstance) => void;
|
|
92
|
+
onKeydown?: (event: KeyboardEvent, instance: OverTypeInstance) => void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Interface for constructor that returns array
|
|
96
|
+
export interface OverTypeConstructor {
|
|
97
|
+
new(target: string | Element | NodeList | Element[], options?: Options): OverTypeInstance[];
|
|
98
|
+
// Static members
|
|
99
|
+
instances: WeakMap<Element, OverTypeInstance>;
|
|
100
|
+
stylesInjected: boolean;
|
|
101
|
+
globalListenersInitialized: boolean;
|
|
102
|
+
instanceCount: number;
|
|
103
|
+
currentTheme: Theme;
|
|
104
|
+
themes: {
|
|
105
|
+
solar: Theme;
|
|
106
|
+
cave: Theme;
|
|
107
|
+
};
|
|
108
|
+
MarkdownParser: any;
|
|
109
|
+
ShortcutsManager: any;
|
|
110
|
+
init(target: string | Element | NodeList | Element[], options?: Options): OverTypeInstance[];
|
|
111
|
+
getInstance(element: Element): OverTypeInstance | null;
|
|
112
|
+
destroyAll(): void;
|
|
113
|
+
injectStyles(force?: boolean): void;
|
|
114
|
+
setTheme(theme: string | Theme, customColors?: Partial<Theme['colors']>): void;
|
|
115
|
+
initGlobalListeners(): void;
|
|
116
|
+
getTheme(name: string): Theme;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface RenderOptions {
|
|
120
|
+
cleanHTML?: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface OverTypeInstance {
|
|
124
|
+
// Public properties
|
|
125
|
+
container: HTMLElement;
|
|
126
|
+
wrapper: HTMLElement;
|
|
127
|
+
textarea: HTMLTextAreaElement;
|
|
128
|
+
preview: HTMLElement;
|
|
129
|
+
statsBar?: HTMLElement;
|
|
130
|
+
toolbar?: any; // Toolbar instance
|
|
131
|
+
shortcuts?: any; // ShortcutsManager instance
|
|
132
|
+
linkTooltip?: any; // LinkTooltip instance
|
|
133
|
+
options: Options;
|
|
134
|
+
initialized: boolean;
|
|
135
|
+
instanceId: number;
|
|
136
|
+
element: Element;
|
|
137
|
+
|
|
138
|
+
// Public methods
|
|
139
|
+
getValue(): string;
|
|
140
|
+
setValue(value: string): void;
|
|
141
|
+
getStats(): Stats;
|
|
142
|
+
getContainer(): HTMLElement;
|
|
143
|
+
focus(): void;
|
|
144
|
+
blur(): void;
|
|
145
|
+
destroy(): void;
|
|
146
|
+
isInitialized(): boolean;
|
|
147
|
+
reinit(options: Options): void;
|
|
148
|
+
showStats(show: boolean): void;
|
|
149
|
+
setTheme(theme: string | Theme): void;
|
|
150
|
+
updatePreview(): void;
|
|
151
|
+
|
|
152
|
+
// HTML output methods
|
|
153
|
+
getRenderedHTML(options?: RenderOptions): string;
|
|
154
|
+
getCleanHTML(): string;
|
|
155
|
+
getPreviewHTML(): string;
|
|
156
|
+
|
|
157
|
+
// View mode methods
|
|
158
|
+
showPlainTextarea(show: boolean): void;
|
|
159
|
+
showPreviewMode(show: boolean): void;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Declare the constructor as a constant with proper typing
|
|
163
|
+
declare const OverType: OverTypeConstructor;
|
|
164
|
+
|
|
165
|
+
// Export the instance type under a different name for clarity
|
|
166
|
+
export type OverType = OverTypeInstance;
|
|
167
|
+
|
|
168
|
+
// Module exports - default export is the constructor
|
|
169
|
+
export default OverType;
|