@ohos-ports/emoji-picker-element 1.29.1-beta.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.
- package/LICENSE +202 -0
- package/README.md +1025 -0
- package/custom-elements.json +257 -0
- package/database.d.ts +108 -0
- package/database.js +1004 -0
- package/database.js.map +1 -0
- package/i18n/ar.d.ts +3 -0
- package/i18n/ar.js +34 -0
- package/i18n/de.d.ts +3 -0
- package/i18n/de.js +34 -0
- package/i18n/en.d.ts +3 -0
- package/i18n/en.js +34 -0
- package/i18n/es.d.ts +3 -0
- package/i18n/es.js +34 -0
- package/i18n/fa.d.ts +3 -0
- package/i18n/fa.js +34 -0
- package/i18n/fr.d.ts +3 -0
- package/i18n/fr.js +34 -0
- package/i18n/hi.d.ts +3 -0
- package/i18n/hi.js +34 -0
- package/i18n/hu.d.ts +3 -0
- package/i18n/hu.js +34 -0
- package/i18n/id.d.ts +3 -0
- package/i18n/id.js +34 -0
- package/i18n/it.d.ts +3 -0
- package/i18n/it.js +34 -0
- package/i18n/ja.d.ts +3 -0
- package/i18n/ja.js +34 -0
- package/i18n/ms_MY.d.ts +3 -0
- package/i18n/ms_MY.js +34 -0
- package/i18n/nl.d.ts +3 -0
- package/i18n/nl.js +34 -0
- package/i18n/pl.d.ts +3 -0
- package/i18n/pl.js +34 -0
- package/i18n/pt_BR.d.ts +3 -0
- package/i18n/pt_BR.js +34 -0
- package/i18n/pt_PT.d.ts +3 -0
- package/i18n/pt_PT.js +34 -0
- package/i18n/ru_RU.d.ts +3 -0
- package/i18n/ru_RU.js +34 -0
- package/i18n/tr.d.ts +3 -0
- package/i18n/tr.js +34 -0
- package/i18n/vi.d.ts +3 -0
- package/i18n/vi.js +34 -0
- package/i18n/zh_CN.d.ts +3 -0
- package/i18n/zh_CN.js +27 -0
- package/index.d.ts +7 -0
- package/index.js +6 -0
- package/package.json +196 -0
- package/picker.d.ts +30 -0
- package/picker.js +1836 -0
- package/picker.js.map +1 -0
- package/polyfill.js +62 -0
- package/shared.d.ts +99 -0
- package/svelte.js +4 -0
- package/trimEmojiData.cjs +54 -0
- package/trimEmojiData.cjs.map +1 -0
- package/trimEmojiData.d.ts +8 -0
- package/trimEmojiData.js +52 -0
- package/trimEmojiData.js.map +1 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "picker.js",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "Lightweight emoji picker distributed as a web component",
|
|
12
|
+
"name": "Picker",
|
|
13
|
+
"superclass": {
|
|
14
|
+
"name": "HTMLElement"
|
|
15
|
+
},
|
|
16
|
+
"tagName": "emoji-picker",
|
|
17
|
+
"customElement": true,
|
|
18
|
+
"attributes": [
|
|
19
|
+
{
|
|
20
|
+
"name": "locale",
|
|
21
|
+
"description": "Locale string",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "\"en\""
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "data-source",
|
|
27
|
+
"description": "URL to fetch the emoji data from",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"default": "\"https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json\""
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "skin-tone-emoji",
|
|
33
|
+
"description": "The emoji to use for the skin tone picker",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"default": "\"🖐\""
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "emoji-version",
|
|
39
|
+
"description": "Maximum supported emoji version as a number (e.g. `14.0` or `13.1`). Setting this disables the default emoji support detection.",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": null
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"members": [
|
|
45
|
+
{
|
|
46
|
+
"name": "locale",
|
|
47
|
+
"description": "Locale string",
|
|
48
|
+
"kind": "field",
|
|
49
|
+
"default": "\"en\""
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "dataSource",
|
|
53
|
+
"description": "URL to fetch the emoji data from",
|
|
54
|
+
"kind": "field",
|
|
55
|
+
"default": "\"https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json\""
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "skinToneEmoji",
|
|
59
|
+
"description": "The emoji to use for the skin tone picker",
|
|
60
|
+
"kind": "field",
|
|
61
|
+
"default": "\"🖐\""
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "i18n",
|
|
65
|
+
"description": "i18n object",
|
|
66
|
+
"kind": "field"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "customEmoji",
|
|
70
|
+
"description": "Array of custom emoji",
|
|
71
|
+
"kind": "field"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "customCategorySorting",
|
|
75
|
+
"description": "Function to sort custom category strings (sorted alphabetically by default)",
|
|
76
|
+
"kind": "field"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "emojiVersion",
|
|
80
|
+
"description": "Maximum supported emoji version as a number (e.g. `14.0` or `13.1`). Setting this disables the default emoji support detection.",
|
|
81
|
+
"kind": "field"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"events": [
|
|
85
|
+
{
|
|
86
|
+
"name": "skin-tone-change",
|
|
87
|
+
"description": "This event is fired whenever the user selects a new skin tone."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "emoji-click",
|
|
91
|
+
"description": "The `emoji-click` event is fired when an emoji is selected by the user."
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "emoji-click-sync",
|
|
95
|
+
"description": "The `emoji-click-sync` event is fired synchronously when an emoji is selected by the user. Use this when copying data to the clipboard using the Clipboard API to work around a Safari bug."
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"cssProperties": [
|
|
99
|
+
{
|
|
100
|
+
"name": "--background",
|
|
101
|
+
"description": "Background of the entire `<emoji-picker>` (default: `#fff`, dark default: `#222`)",
|
|
102
|
+
"default": "\"#fff\""
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "--border-color",
|
|
106
|
+
"description": "(default: `#e0e0e0`, dark default: `#444`)",
|
|
107
|
+
"default": "\"#e0e0e0\""
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "--border-radius",
|
|
111
|
+
"description": "Border radius of the entire picker (default: `0`)",
|
|
112
|
+
"default": "\"0\""
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "--border-size",
|
|
116
|
+
"description": "Width of border used in most of the picker (default: `1px`)",
|
|
117
|
+
"default": "\"1px\""
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "--button-active-background",
|
|
121
|
+
"description": "Background of an active button (default: `#e6e6e6`, dark default: `#555555`)",
|
|
122
|
+
"default": "\"#e6e6e6\""
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "--button-hover-background",
|
|
126
|
+
"description": "Background of a hovered button (default: `#d9d9d9`, dark default: `#484848`)",
|
|
127
|
+
"default": "\"#d9d9d9\""
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "--category-emoji-padding",
|
|
131
|
+
"description": "Vertical/horizontal padding on category emoji, if you want it to be different from `--emoji-padding` (default: `var(--emoji-padding)`)",
|
|
132
|
+
"default": "\"var(--emoji-padding)\""
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "--category-emoji-size",
|
|
136
|
+
"description": "Width/height of category emoji, if you want it to be different from `--emoji-size` (default: `var(--emoji-size)`)",
|
|
137
|
+
"default": "\"var(--emoji-size)\""
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "--category-font-color",
|
|
141
|
+
"description": "Font color of custom emoji category headings (default: `#111`, dark default: `#efefef`)",
|
|
142
|
+
"default": "\"#111\""
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "--category-font-size",
|
|
146
|
+
"description": "Font size of custom emoji category headings (default: `1rem`)",
|
|
147
|
+
"default": "\"1rem\""
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "--emoji-font-family",
|
|
151
|
+
"description": "Font family for a custom emoji font (as opposed to native emoji) (default: `\"Twemoji Mozilla\",\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\",\"EmojiOne Color\",\"Android Emoji\",sans-serif`)",
|
|
152
|
+
"default": "\"\\\"Twemoji Mozilla\\\",\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\",\\\"Noto Color Emoji\\\",\\\"EmojiOne Color\\\",\\\"Android Emoji\\\",sans-serif\""
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "--emoji-padding",
|
|
156
|
+
"description": "Vertical and horizontal padding on emoji (default: `0.5rem`)",
|
|
157
|
+
"default": "\"0.5rem\""
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "--emoji-size",
|
|
161
|
+
"description": "Width and height of all emoji (default: `1.375rem`)",
|
|
162
|
+
"default": "\"1.375rem\""
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "--indicator-color",
|
|
166
|
+
"description": "Color of the nav indicator (default: `#385ac1`, dark default: `#5373ec`)",
|
|
167
|
+
"default": "\"#385ac1\""
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "--indicator-height",
|
|
171
|
+
"description": "Height of the nav indicator (default: `3px`)",
|
|
172
|
+
"default": "\"3px\""
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "--input-border-color",
|
|
176
|
+
"description": "(default: `#999`, dark default: `#ccc`)",
|
|
177
|
+
"default": "\"#999\""
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "--input-border-radius",
|
|
181
|
+
"description": "(default: `0.5rem`)",
|
|
182
|
+
"default": "\"0.5rem\""
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "--input-border-size",
|
|
186
|
+
"description": "(default: `1px`)",
|
|
187
|
+
"default": "\"1px\""
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "--input-font-color",
|
|
191
|
+
"description": "(default: `#111`, dark default: `#efefef`)",
|
|
192
|
+
"default": "\"#111\""
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "--input-font-size",
|
|
196
|
+
"description": "(default: `1rem`)",
|
|
197
|
+
"default": "\"1rem\""
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"name": "--input-line-height",
|
|
201
|
+
"description": "(default: `1.5`)",
|
|
202
|
+
"default": "\"1.5\""
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "--input-padding",
|
|
206
|
+
"description": "(default: `0.25rem`)",
|
|
207
|
+
"default": "\"0.25rem\""
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "--input-placeholder-color",
|
|
211
|
+
"description": "(default: `#999`, dark default: `#ccc`)",
|
|
212
|
+
"default": "\"#999\""
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"name": "--num-columns",
|
|
216
|
+
"description": "How many columns to display in the emoji grid (default: `8`)",
|
|
217
|
+
"default": "\"8\""
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "--outline-color",
|
|
221
|
+
"description": "Focus outline color (default: `#999`, dark default: `#fff`)",
|
|
222
|
+
"default": "\"#999\""
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "--outline-size",
|
|
226
|
+
"description": "Focus outline width (default: `2px`)",
|
|
227
|
+
"default": "\"2px\""
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "--skintone-border-radius",
|
|
231
|
+
"description": "Border radius of the skintone dropdown (default: `1rem`)",
|
|
232
|
+
"default": "\"1rem\""
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"exports": [
|
|
238
|
+
{
|
|
239
|
+
"kind": "custom-element-definition",
|
|
240
|
+
"name": "emoji-picker",
|
|
241
|
+
"declaration": {
|
|
242
|
+
"name": "Picker",
|
|
243
|
+
"module": "picker.js"
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"kind": "js",
|
|
248
|
+
"name": "default",
|
|
249
|
+
"declaration": {
|
|
250
|
+
"name": "Picker",
|
|
251
|
+
"module": "picker.js"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
}
|
package/database.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Emoji, DatabaseConstructorOptions, SkinTone, CustomEmoji, NativeEmoji } from "./shared.js";
|
|
2
|
+
export default class Database {
|
|
3
|
+
/**
|
|
4
|
+
* Create a new Database.
|
|
5
|
+
*
|
|
6
|
+
* Note that multiple Databases pointing to the same locale will share the
|
|
7
|
+
* same underlying IndexedDB connection and database.
|
|
8
|
+
*
|
|
9
|
+
* @param dataSource - URL to fetch the emoji data from
|
|
10
|
+
* @param locale - Locale string
|
|
11
|
+
* @param customEmoji - Array of custom emoji
|
|
12
|
+
*/
|
|
13
|
+
constructor({ dataSource, locale, customEmoji }?: DatabaseConstructorOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Resolves when the Database is ready, or throws an error if
|
|
16
|
+
* the Database could not initialize.
|
|
17
|
+
*
|
|
18
|
+
* Note that you don't need to do this before calling other APIs – they will
|
|
19
|
+
* all wait for this promise to resolve before doing anything.
|
|
20
|
+
*/
|
|
21
|
+
ready(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns all emoji belonging to a group, ordered by `order`. Only returns native emoji;
|
|
24
|
+
* custom emoji don't belong to a group.
|
|
25
|
+
*
|
|
26
|
+
* Non-numbers throw an error.
|
|
27
|
+
* @param group - the group number
|
|
28
|
+
*/
|
|
29
|
+
getEmojiByGroup(group: number): Promise<NativeEmoji[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns all emoji matching the given search query, ordered by `order`.
|
|
32
|
+
*
|
|
33
|
+
* Empty/null strings throw an error.
|
|
34
|
+
*
|
|
35
|
+
* @param query - search query string
|
|
36
|
+
*/
|
|
37
|
+
getEmojiBySearchQuery(query: string): Promise<Emoji[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Return a single emoji matching the shortcode, or null if not found.
|
|
40
|
+
*
|
|
41
|
+
* The colons around the shortcode should not be included when querying, e.g.
|
|
42
|
+
* use "slight_smile", not ":slight_smile:". Uppercase versus lowercase
|
|
43
|
+
* does not matter. Empty/null strings throw an error.
|
|
44
|
+
* @param shortcode
|
|
45
|
+
*/
|
|
46
|
+
getEmojiByShortcode(shortcode: string): Promise<Emoji | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Return a single native emoji matching the unicode string, or
|
|
49
|
+
* a custom emoji matching the name, or null if not found.
|
|
50
|
+
*
|
|
51
|
+
* In the case of native emoji, the unicode string can be either the
|
|
52
|
+
* main unicode string, or the unicode of one of the skin tone variants.
|
|
53
|
+
*
|
|
54
|
+
* Empty/null strings throw an error.
|
|
55
|
+
* @param unicodeOrName - unicode (native emoji) or name (custom emoji)
|
|
56
|
+
*/
|
|
57
|
+
getEmojiByUnicodeOrName(unicodeOrName: string): Promise<Emoji | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Get the user's preferred skin tone. Returns 0 if not found.
|
|
60
|
+
*/
|
|
61
|
+
getPreferredSkinTone(): Promise<SkinTone>;
|
|
62
|
+
/**
|
|
63
|
+
* Set the user's preferred skin tone. Non-numbers throw an error.
|
|
64
|
+
*
|
|
65
|
+
* @param skinTone - preferred skin tone
|
|
66
|
+
*/
|
|
67
|
+
setPreferredSkinTone(skinTone: SkinTone): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Increment the favorite count for an emoji by one. The unicode string must be non-empty. It should
|
|
70
|
+
* correspond to the base (non-skin-tone) unicode string from the emoji object, or in the case of
|
|
71
|
+
* custom emoji, it should be the name.
|
|
72
|
+
*
|
|
73
|
+
* @param unicodeOrName - unicode of a native emoji, or name of a custom emoji
|
|
74
|
+
*/
|
|
75
|
+
incrementFavoriteEmojiCount(unicodeOrName: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Get the top favorite emoji in descending order. If there are no favorite emoji yet, returns an empty array.
|
|
78
|
+
* @param limit - maximum number of results to return
|
|
79
|
+
*/
|
|
80
|
+
getTopFavoriteEmoji(limit: number): Promise<Emoji[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Set the custom emoji for this database. Throws an error if custom emoji are not in the correct format.
|
|
83
|
+
*
|
|
84
|
+
*
|
|
85
|
+
* @param customEmoji
|
|
86
|
+
*/
|
|
87
|
+
set customEmoji(customEmoji: CustomEmoji[]);
|
|
88
|
+
/**
|
|
89
|
+
* Return the custom emoji associated with this Database, or the empty array if none.
|
|
90
|
+
*/
|
|
91
|
+
get customEmoji(): CustomEmoji[];
|
|
92
|
+
/**
|
|
93
|
+
* Closes the underlying IndexedDB connection. The Database is not usable after that (or any other Databases
|
|
94
|
+
* with the same locale).
|
|
95
|
+
*
|
|
96
|
+
* Note that as soon as any other non-close/delete method is called, the database will automatically reopen.
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
close(): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Deletes the underlying IndexedDB database. The Database is not usable after that (or any other Databases
|
|
102
|
+
* with the same locale).
|
|
103
|
+
*
|
|
104
|
+
* Note that as soon as any other non-close/delete method is called, the database will be recreated.
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
delete(): Promise<void>;
|
|
108
|
+
}
|