prompt-mentions 0.0.2 → 0.0.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/package.json +6 -6
- package/dist/index.cjs +0 -38489
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -368
- package/dist/index.js +0 -38462
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
DELETED
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type MentionItemType = 'item' | 'divider' | 'title';
|
|
5
|
-
interface MentionOption {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
icon?: ReactNode;
|
|
9
|
-
type?: MentionItemType;
|
|
10
|
-
children?: MentionOption[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface SelectedMention {
|
|
14
|
-
id: string;
|
|
15
|
-
label: string;
|
|
16
|
-
/** The trigger character used for this mention (e.g., "@", "#") */
|
|
17
|
-
trigger: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Theme configuration for the Prompt component.
|
|
22
|
-
* All properties are optional - unspecified values will use CSS variable defaults.
|
|
23
|
-
*/
|
|
24
|
-
interface PromptTheme {
|
|
25
|
-
/** Background color of the prompt input */
|
|
26
|
-
backgroundColor?: string;
|
|
27
|
-
/** Text color of the prompt input */
|
|
28
|
-
color?: string;
|
|
29
|
-
/** Placeholder text color */
|
|
30
|
-
placeholderColor?: string;
|
|
31
|
-
/** Font size of the prompt (e.g., "14px", "0.875rem") */
|
|
32
|
-
fontSize?: string;
|
|
33
|
-
/** Font family of the prompt */
|
|
34
|
-
fontFamily?: string;
|
|
35
|
-
/** Border radius of the prompt input */
|
|
36
|
-
borderRadius?: string;
|
|
37
|
-
/** Border color of the prompt input */
|
|
38
|
-
borderColor?: string;
|
|
39
|
-
/** Padding inside the prompt input */
|
|
40
|
-
padding?: string;
|
|
41
|
-
/** Border color when the prompt is focused */
|
|
42
|
-
focusBorderColor?: string;
|
|
43
|
-
/** Box shadow when the prompt is focused (e.g., "0 0 0 2px rgba(99, 102, 241, 0.2)" or "none") */
|
|
44
|
-
focusBoxShadow?: string;
|
|
45
|
-
/** Mention menu configuration */
|
|
46
|
-
menu?: {
|
|
47
|
-
/** Background color of the menu */
|
|
48
|
-
backgroundColor?: string;
|
|
49
|
-
/** Border color of the menu */
|
|
50
|
-
borderColor?: string;
|
|
51
|
-
/** Text color in the menu */
|
|
52
|
-
color?: string;
|
|
53
|
-
/** Background color of hovered/selected menu items */
|
|
54
|
-
itemHoverColor?: string;
|
|
55
|
-
/** Color of the chevron icons */
|
|
56
|
-
chevronColor?: string;
|
|
57
|
-
/** Color of chevron icons when item is hovered */
|
|
58
|
-
chevronHoverColor?: string;
|
|
59
|
-
/** Minimum width of the menu (e.g., "180px", "240px") */
|
|
60
|
-
minWidth?: string;
|
|
61
|
-
/** Menu item configuration */
|
|
62
|
-
item?: {
|
|
63
|
-
/** Height of menu items (e.g., "auto", "20px") */
|
|
64
|
-
height?: string;
|
|
65
|
-
/** Padding inside menu items */
|
|
66
|
-
padding?: string;
|
|
67
|
-
/** Gap between icon and label */
|
|
68
|
-
gap?: string;
|
|
69
|
-
/** Font size of the label */
|
|
70
|
-
labelFontSize?: string;
|
|
71
|
-
/** Font weight of the label */
|
|
72
|
-
labelFontWeight?: string | number;
|
|
73
|
-
/** Height of the icon */
|
|
74
|
-
iconHeight?: string;
|
|
75
|
-
};
|
|
76
|
-
/** Menu title/header configuration */
|
|
77
|
-
title?: {
|
|
78
|
-
/** Padding of the title */
|
|
79
|
-
padding?: string;
|
|
80
|
-
/** Top padding of the title */
|
|
81
|
-
paddingTop?: string;
|
|
82
|
-
/** Height of the title row */
|
|
83
|
-
height?: string;
|
|
84
|
-
/** Font size of the title label */
|
|
85
|
-
labelFontSize?: string;
|
|
86
|
-
/** Font weight of the title label */
|
|
87
|
-
labelFontWeight?: string | number;
|
|
88
|
-
/** Color of the title label */
|
|
89
|
-
labelColor?: string;
|
|
90
|
-
/** Text transform (e.g., "uppercase", "none") */
|
|
91
|
-
labelTextTransform?: string;
|
|
92
|
-
/** Letter spacing */
|
|
93
|
-
labelLetterSpacing?: string;
|
|
94
|
-
/** Opacity of the title label */
|
|
95
|
-
labelOpacity?: string | number;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
/** Mention pill (tag) configuration */
|
|
99
|
-
pill?: {
|
|
100
|
-
/** Background of the pill (can be a gradient like "linear-gradient(...)") */
|
|
101
|
-
backgroundColor?: string;
|
|
102
|
-
/** Border radius of the pill */
|
|
103
|
-
borderRadius?: string;
|
|
104
|
-
/** Text color of the pill */
|
|
105
|
-
color?: string;
|
|
106
|
-
/** Padding inside the pill */
|
|
107
|
-
padding?: string;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Converts a PromptTheme object to CSS custom properties.
|
|
112
|
-
* Returns an object suitable for use as React inline styles.
|
|
113
|
-
*/
|
|
114
|
-
declare function themeToStyles(theme?: PromptTheme): React.CSSProperties;
|
|
115
|
-
/**
|
|
116
|
-
* Preset themes that can be used out of the box.
|
|
117
|
-
*/
|
|
118
|
-
declare const presetThemes: {
|
|
119
|
-
/** Light theme (default) */
|
|
120
|
-
readonly light: {
|
|
121
|
-
backgroundColor: string;
|
|
122
|
-
color: string;
|
|
123
|
-
placeholderColor: string;
|
|
124
|
-
fontSize: string;
|
|
125
|
-
fontFamily: string;
|
|
126
|
-
borderRadius: string;
|
|
127
|
-
borderColor: string;
|
|
128
|
-
padding: string;
|
|
129
|
-
focusBorderColor: string;
|
|
130
|
-
focusBoxShadow: string;
|
|
131
|
-
menu: {
|
|
132
|
-
backgroundColor: string;
|
|
133
|
-
borderColor: string;
|
|
134
|
-
color: string;
|
|
135
|
-
itemHoverColor: string;
|
|
136
|
-
chevronColor: string;
|
|
137
|
-
chevronHoverColor: string;
|
|
138
|
-
minWidth: string;
|
|
139
|
-
item: {
|
|
140
|
-
height: string;
|
|
141
|
-
padding: string;
|
|
142
|
-
gap: string;
|
|
143
|
-
labelFontSize: string;
|
|
144
|
-
labelFontWeight: number;
|
|
145
|
-
iconHeight: string;
|
|
146
|
-
};
|
|
147
|
-
title: {
|
|
148
|
-
padding: string;
|
|
149
|
-
paddingTop: string;
|
|
150
|
-
height: string;
|
|
151
|
-
labelFontSize: string;
|
|
152
|
-
labelFontWeight: number;
|
|
153
|
-
labelColor: string;
|
|
154
|
-
labelTextTransform: string;
|
|
155
|
-
labelLetterSpacing: string;
|
|
156
|
-
labelOpacity: number;
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
pill: {
|
|
160
|
-
backgroundColor: string;
|
|
161
|
-
borderRadius: string;
|
|
162
|
-
color: string;
|
|
163
|
-
padding: string;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
/** Dark theme similar to Cursor IDE */
|
|
167
|
-
readonly cursorDark: {
|
|
168
|
-
backgroundColor: string;
|
|
169
|
-
color: string;
|
|
170
|
-
placeholderColor: string;
|
|
171
|
-
fontSize: string;
|
|
172
|
-
fontFamily: string;
|
|
173
|
-
borderRadius: string;
|
|
174
|
-
borderColor: string;
|
|
175
|
-
padding: string;
|
|
176
|
-
focusBorderColor: string;
|
|
177
|
-
focusBoxShadow: string;
|
|
178
|
-
menu: {
|
|
179
|
-
backgroundColor: string;
|
|
180
|
-
borderColor: string;
|
|
181
|
-
color: string;
|
|
182
|
-
itemHoverColor: string;
|
|
183
|
-
chevronColor: string;
|
|
184
|
-
chevronHoverColor: string;
|
|
185
|
-
minWidth: string;
|
|
186
|
-
item: {
|
|
187
|
-
height: string;
|
|
188
|
-
padding: string;
|
|
189
|
-
gap: string;
|
|
190
|
-
labelFontSize: string;
|
|
191
|
-
labelFontWeight: number;
|
|
192
|
-
iconHeight: string;
|
|
193
|
-
};
|
|
194
|
-
title: {
|
|
195
|
-
padding: string;
|
|
196
|
-
paddingTop: string;
|
|
197
|
-
height: string;
|
|
198
|
-
labelFontSize: string;
|
|
199
|
-
labelFontWeight: number;
|
|
200
|
-
labelColor: string;
|
|
201
|
-
labelTextTransform: string;
|
|
202
|
-
labelLetterSpacing: string;
|
|
203
|
-
labelOpacity: number;
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
pill: {
|
|
207
|
-
backgroundColor: string;
|
|
208
|
-
borderRadius: string;
|
|
209
|
-
color: string;
|
|
210
|
-
padding: string;
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
/** GitHub-inspired dark theme */
|
|
214
|
-
readonly githubDark: {
|
|
215
|
-
backgroundColor: string;
|
|
216
|
-
color: string;
|
|
217
|
-
placeholderColor: string;
|
|
218
|
-
fontSize: string;
|
|
219
|
-
fontFamily: string;
|
|
220
|
-
borderRadius: string;
|
|
221
|
-
borderColor: string;
|
|
222
|
-
padding: string;
|
|
223
|
-
focusBorderColor: string;
|
|
224
|
-
focusBoxShadow: string;
|
|
225
|
-
menu: {
|
|
226
|
-
backgroundColor: string;
|
|
227
|
-
borderColor: string;
|
|
228
|
-
color: string;
|
|
229
|
-
itemHoverColor: string;
|
|
230
|
-
chevronColor: string;
|
|
231
|
-
chevronHoverColor: string;
|
|
232
|
-
minWidth: string;
|
|
233
|
-
item: {
|
|
234
|
-
height: string;
|
|
235
|
-
padding: string;
|
|
236
|
-
gap: string;
|
|
237
|
-
labelFontSize: string;
|
|
238
|
-
labelFontWeight: number;
|
|
239
|
-
iconHeight: string;
|
|
240
|
-
};
|
|
241
|
-
title: {
|
|
242
|
-
padding: string;
|
|
243
|
-
paddingTop: string;
|
|
244
|
-
height: string;
|
|
245
|
-
labelFontSize: string;
|
|
246
|
-
labelFontWeight: number;
|
|
247
|
-
labelColor: string;
|
|
248
|
-
labelTextTransform: string;
|
|
249
|
-
labelLetterSpacing: string;
|
|
250
|
-
labelOpacity: number;
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
pill: {
|
|
254
|
-
backgroundColor: string;
|
|
255
|
-
borderRadius: string;
|
|
256
|
-
color: string;
|
|
257
|
-
padding: string;
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
/** Minimal/clean theme */
|
|
261
|
-
readonly minimal: {
|
|
262
|
-
backgroundColor: string;
|
|
263
|
-
color: string;
|
|
264
|
-
placeholderColor: string;
|
|
265
|
-
fontSize: string;
|
|
266
|
-
fontFamily: string;
|
|
267
|
-
borderRadius: string;
|
|
268
|
-
borderColor: string;
|
|
269
|
-
padding: string;
|
|
270
|
-
focusBorderColor: string;
|
|
271
|
-
focusBoxShadow: string;
|
|
272
|
-
menu: {
|
|
273
|
-
backgroundColor: string;
|
|
274
|
-
borderColor: string;
|
|
275
|
-
color: string;
|
|
276
|
-
itemHoverColor: string;
|
|
277
|
-
chevronColor: string;
|
|
278
|
-
chevronHoverColor: string;
|
|
279
|
-
minWidth: string;
|
|
280
|
-
item: {
|
|
281
|
-
height: string;
|
|
282
|
-
padding: string;
|
|
283
|
-
gap: string;
|
|
284
|
-
labelFontSize: string;
|
|
285
|
-
labelFontWeight: number;
|
|
286
|
-
iconHeight: string;
|
|
287
|
-
};
|
|
288
|
-
title: {
|
|
289
|
-
padding: string;
|
|
290
|
-
paddingTop: string;
|
|
291
|
-
height: string;
|
|
292
|
-
labelFontSize: string;
|
|
293
|
-
labelFontWeight: number;
|
|
294
|
-
labelColor: string;
|
|
295
|
-
labelTextTransform: string;
|
|
296
|
-
labelLetterSpacing: string;
|
|
297
|
-
labelOpacity: number;
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
pill: {
|
|
301
|
-
backgroundColor: string;
|
|
302
|
-
borderRadius: string;
|
|
303
|
-
color: string;
|
|
304
|
-
padding: string;
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
type PresetThemeName = keyof typeof presetThemes;
|
|
309
|
-
|
|
310
|
-
type MentionMenuPosition = "above" | "below";
|
|
311
|
-
interface MentionConfig {
|
|
312
|
-
trigger: string;
|
|
313
|
-
options: MentionOption[];
|
|
314
|
-
menuPosition?: MentionMenuPosition;
|
|
315
|
-
showTrigger?: boolean;
|
|
316
|
-
}
|
|
317
|
-
interface PromptProps {
|
|
318
|
-
initialValue?: string;
|
|
319
|
-
onChange?: (value: string, mentions: SelectedMention[]) => void;
|
|
320
|
-
onEnter?: (value: string, mentions: SelectedMention[]) => void;
|
|
321
|
-
onMentionAdded?: (mention: SelectedMention) => void;
|
|
322
|
-
onMentionDeleted?: (mention: SelectedMention) => void;
|
|
323
|
-
onMentionClick?: (mention: SelectedMention) => void;
|
|
324
|
-
placeholder?: string;
|
|
325
|
-
mentionConfigs?: MentionConfig[];
|
|
326
|
-
theme?: PresetThemeName | PromptTheme;
|
|
327
|
-
className?: string;
|
|
328
|
-
style?: React.CSSProperties;
|
|
329
|
-
/**
|
|
330
|
-
* When true, automatically adds file extension icons to mention options.
|
|
331
|
-
* Icons are determined by the file extension in the option label.
|
|
332
|
-
* Only applies to options that don't already have an icon.
|
|
333
|
-
*/
|
|
334
|
-
extensionIcons?: boolean;
|
|
335
|
-
}
|
|
336
|
-
declare const Prompt: (props: PromptProps) => react_jsx_runtime.JSX.Element;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Extension to icon mapping
|
|
340
|
-
*
|
|
341
|
-
* Add more mappings here as needed.
|
|
342
|
-
* The key should be the file extension (without the dot).
|
|
343
|
-
* The value is a React component that renders an SVG icon.
|
|
344
|
-
*/
|
|
345
|
-
declare const extensionIconMap: Record<string, () => ReactNode>;
|
|
346
|
-
/**
|
|
347
|
-
* Special filename to icon mapping
|
|
348
|
-
* These are matched by full filename (case-insensitive)
|
|
349
|
-
*/
|
|
350
|
-
declare const filenameIconMap: Record<string, () => ReactNode>;
|
|
351
|
-
/**
|
|
352
|
-
* Get the icon component for a given filename or label
|
|
353
|
-
*
|
|
354
|
-
* @param label - The filename or label to get an icon for
|
|
355
|
-
* @returns The icon component, or undefined if no match found
|
|
356
|
-
*/
|
|
357
|
-
declare function getExtensionIcon(label: string): ReactNode | undefined;
|
|
358
|
-
/**
|
|
359
|
-
* Default file icon for items without a recognized extension
|
|
360
|
-
*/
|
|
361
|
-
declare const DefaultFileIcon: () => react_jsx_runtime.JSX.Element;
|
|
362
|
-
/**
|
|
363
|
-
* Default folder icon
|
|
364
|
-
*/
|
|
365
|
-
declare const DefaultFolderIcon: () => react_jsx_runtime.JSX.Element;
|
|
366
|
-
|
|
367
|
-
export { DefaultFileIcon, DefaultFolderIcon, Prompt, extensionIconMap, filenameIconMap, getExtensionIcon, presetThemes, themeToStyles };
|
|
368
|
-
export type { MentionConfig, MentionItemType, MentionMenuPosition, MentionOption, PresetThemeName, PromptProps, PromptTheme, SelectedMention };
|