quikdown 1.0.4 → 1.1.0

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.
@@ -0,0 +1,195 @@
1
+ /**
2
+ * quikdown_edit - Quikdown Editor Component
3
+ * TypeScript definitions
4
+ */
5
+
6
+ declare module 'quikdown/edit' {
7
+ /**
8
+ * Options for configuring the QuikdownEditor
9
+ */
10
+ export interface QuikdownEditorOptions {
11
+ /**
12
+ * Initial view mode
13
+ * @default 'split'
14
+ */
15
+ mode?: 'source' | 'split' | 'preview';
16
+
17
+ /**
18
+ * Theme setting
19
+ * @default 'auto'
20
+ */
21
+ theme?: 'light' | 'dark' | 'auto';
22
+
23
+ /**
24
+ * Show/hide the toolbar
25
+ * @default true
26
+ */
27
+ showToolbar?: boolean;
28
+
29
+ /**
30
+ * Enable lazy linefeeds (single \n becomes <br>)
31
+ * @default false
32
+ */
33
+ lazy_linefeeds?: boolean;
34
+
35
+ /**
36
+ * Debounce delay for updates in milliseconds
37
+ * @default 100
38
+ */
39
+ debounceDelay?: number;
40
+
41
+ /**
42
+ * Placeholder text for empty editor
43
+ * @default 'Start typing markdown...'
44
+ */
45
+ placeholder?: string;
46
+
47
+ /**
48
+ * Initial markdown content
49
+ */
50
+ initialContent?: string;
51
+
52
+ /**
53
+ * Plugin configuration
54
+ */
55
+ plugins?: {
56
+ /** Enable Highlight.js for syntax highlighting */
57
+ highlightjs?: boolean;
58
+ /** Enable Mermaid for diagrams */
59
+ mermaid?: boolean;
60
+ };
61
+
62
+ /**
63
+ * Custom fence handlers
64
+ * Maps language identifiers to render functions
65
+ */
66
+ customFences?: {
67
+ [language: string]: (code: string, lang: string) => string;
68
+ };
69
+
70
+ /**
71
+ * Callback fired when content changes
72
+ * @param markdown - Current markdown content
73
+ * @param html - Rendered HTML
74
+ */
75
+ onChange?: (markdown: string, html: string) => void;
76
+
77
+ /**
78
+ * Callback fired when view mode changes
79
+ * @param mode - New view mode
80
+ */
81
+ onModeChange?: (mode: 'source' | 'split' | 'preview') => void;
82
+ }
83
+
84
+ /**
85
+ * QuikdownEditor class - Drop-in markdown editor control
86
+ */
87
+ export class QuikdownEditor {
88
+ /**
89
+ * Create a new QuikdownEditor instance
90
+ * @param container - DOM element or CSS selector for the container
91
+ * @param options - Editor configuration options
92
+ */
93
+ constructor(container: HTMLElement | string, options?: QuikdownEditorOptions);
94
+
95
+ /**
96
+ * Get current markdown content
97
+ */
98
+ get markdown(): string;
99
+
100
+ /**
101
+ * Set markdown content
102
+ */
103
+ set markdown(value: string);
104
+
105
+ /**
106
+ * Get rendered HTML (read-only)
107
+ */
108
+ get html(): string;
109
+
110
+ /**
111
+ * Get current view mode (read-only)
112
+ */
113
+ get mode(): 'source' | 'split' | 'preview';
114
+
115
+ /**
116
+ * Set markdown content
117
+ * @param markdown - Markdown text to set
118
+ */
119
+ setMarkdown(markdown: string): void;
120
+
121
+ /**
122
+ * Get current markdown content
123
+ * @returns Current markdown text
124
+ */
125
+ getMarkdown(): string;
126
+
127
+ /**
128
+ * Get rendered HTML
129
+ * @returns Rendered HTML
130
+ */
131
+ getHTML(): string;
132
+
133
+ /**
134
+ * Change view mode
135
+ * @param mode - New view mode
136
+ */
137
+ setMode(mode: 'source' | 'split' | 'preview'): void;
138
+
139
+ /**
140
+ * Enable/disable lazy linefeeds
141
+ * @param enabled - Whether to enable lazy linefeeds
142
+ */
143
+ setLazyLinefeeds(enabled: boolean): void;
144
+
145
+ /**
146
+ * Get lazy linefeeds setting
147
+ * @returns Current lazy linefeeds setting
148
+ */
149
+ getLazyLinefeeds(): boolean;
150
+
151
+ /**
152
+ * Destroy the editor and clean up
153
+ */
154
+ destroy(): void;
155
+ }
156
+
157
+ export default QuikdownEditor;
158
+ }
159
+
160
+ // For direct import
161
+ declare class QuikdownEditor {
162
+ constructor(container: HTMLElement | string, options?: QuikdownEditorOptions);
163
+ get markdown(): string;
164
+ set markdown(value: string);
165
+ get html(): string;
166
+ get mode(): 'source' | 'split' | 'preview';
167
+ setMarkdown(markdown: string): void;
168
+ getMarkdown(): string;
169
+ getHTML(): string;
170
+ setMode(mode: 'source' | 'split' | 'preview'): void;
171
+ setLazyLinefeeds(enabled: boolean): void;
172
+ getLazyLinefeeds(): boolean;
173
+ destroy(): void;
174
+ }
175
+
176
+ export interface QuikdownEditorOptions {
177
+ mode?: 'source' | 'split' | 'preview';
178
+ theme?: 'light' | 'dark' | 'auto';
179
+ showToolbar?: boolean;
180
+ lazy_linefeeds?: boolean;
181
+ debounceDelay?: number;
182
+ placeholder?: string;
183
+ initialContent?: string;
184
+ plugins?: {
185
+ highlightjs?: boolean;
186
+ mermaid?: boolean;
187
+ };
188
+ customFences?: {
189
+ [language: string]: (code: string, lang: string) => string;
190
+ };
191
+ onChange?: (markdown: string, html: string) => void;
192
+ onModeChange?: (mode: 'source' | 'split' | 'preview') => void;
193
+ }
194
+
195
+ export default QuikdownEditor;