forked from NodeBB/nodebb-plugin-emoji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
196 lines (175 loc) · 3.99 KB
/
types.d.ts
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/**
* Schema for defining an emoji
*/
declare interface Emoji {
/** alternative names for this emoji */
aliases?: string[],
/** keywords to match when searching for emoji */
keywords?: string[],
/** common ascii representations for this emoji */
ascii?: string[],
/**
* **`images` mode** image file name [`grinning-face.png`]
*/
image?: string,
/**
* **`sprite` mode** CSS `background-position`
*/
backgroundPosition?: string,
/** unicode text character */
character: string,
/**
* categories this emoji fits in (default: `['other']`)
*
* known categories:
* `'people'`,
* `'nature'`,
* `'food'`,
* `'activity'`,
* `'travel'`,
* `'objects'`,
* `'symbols'`,
* `'flags'`,
* `'regional'`,
* `'modifier'`,
* `'other'`
*
* if adding other categories, add translations for them like
* `"categories.people": "People"` under `emoji.json`
*/
categories?: string[],
}
declare interface EmojiDefinition {
/**
* human-friendly name of this emoji pack
*/
name: string;
/**
* The ID of this emoji pack.
* Used in the CSS classname, etc
*/
id: string;
/**
* The absolute base path of the emoji pack. Other paths are relative to this one
* Usually `__dirname` works well for this
*/
path: string;
/**
* Legal attribution for using these emoji, if applicable
*/
attribution?: string;
/**
* License for these emoji
*/
license?: string;
/**
* The mode of this emoji pack.
* `images` for individual image files.
* `sprite` for a single image sprite file.
* `font` for an emoji font.
*/
mode: 'images' | 'sprite' | 'font';
/**
* **`images` mode** options
*/
images?: {
/** Path to the directory where the image files are located */
directory: string;
};
/**
* **`sprite` mode** options
*/
sprite?: {
/** Path to the sprite image file */
file: string;
/** CSS `background-size` */
backgroundSize: string;
};
/**
* **`font` mode** options
*/
font?: {
/** Path to the emoji font `.eot` file (for old IE support) */
eot?: string;
/** Path to the emoji font `.ttf` file */
ttf?: string;
/** Path to the emoji font `.woff` file */
woff?: string;
/** Path to the emoji font `.woff2` file */
woff2?: string;
/** Path to the emoji font `.svg` file
* (for Apple support, end this with the `#fontname` convention) */
svg?: string;
/** CSS `font-family` name */
family: string;
};
/**
* A map of emoji names to one of the following
*/
dictionary: {
[name: string]: Emoji;
};
}
declare type NodeBack<T = any> = (err?: Error, ...args: T[]) => void;
declare interface StoredEmoji {
name: string;
character: string;
image: string;
pack: string;
aliases: string[],
keywords: string[],
}
declare namespace MetaData {
/** table of all emoji */
type table = {
[name: string]: StoredEmoji,
};
/** map of all aliases to the base name */
type aliases = {
[alias: string]: string,
};
/** map of ascii to base names */
type ascii = {
[str: string]: string,
};
/** list of emoji names in each category */
type categories = {
[category: string]: string[],
};
/** map of characters to emoji names */
type characters = {
[character: string]: string,
};
/** storing pack information for dialog */
type packs = {
name: string,
id: string,
attribution: string,
license: string,
}[];
}
declare module NodeJS {
export interface Global {
env: 'development' | 'production'
}
}
interface CustomEmoji {
/** name of custom emoji */
name: string;
/** custom image for emoji */
image: string;
aliases: string[];
ascii: string[];
}
interface CustomAdjunct {
/** Name of original emoji */
name: string;
/** Additional aliases for the emoji */
aliases: string[];
/** Additional ascii patterns for this emoji */
ascii: string[];
}
interface Customizations {
emojis: CustomEmoji[];
adjuncts: CustomAdjunct[];
}