@hokkiai/discord-emoji-selector 1.1.5 → 1.1.7
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/dist/categoryDisplay-BV7OPJVG.js +205 -0
- package/dist/categoryDisplay-EAVZYFPJ.js +205 -0
- package/dist/chunk-DMO3WEXH.js +53 -0
- package/dist/chunk-LP6LBWNJ.js +59 -0
- package/dist/index.cjs +508 -446
- package/dist/index.js +305 -513
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4,6 +4,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
7
10
|
var __export = (target, all) => {
|
|
8
11
|
for (var name in all)
|
|
9
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -26,21 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
29
|
));
|
|
27
30
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
31
|
|
|
29
|
-
// src/index.tsx
|
|
30
|
-
var index_exports = {};
|
|
31
|
-
__export(index_exports, {
|
|
32
|
-
default: () => EmojiSelector,
|
|
33
|
-
render: () => render
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
var import_react7 = require("react");
|
|
37
|
-
|
|
38
|
-
// src/categoryDisplay.tsx
|
|
39
|
-
var import_lucide_react = require("lucide-react");
|
|
40
|
-
var import_react2 = require("react");
|
|
41
|
-
|
|
42
32
|
// src/render.tsx
|
|
43
|
-
var import_api = __toESM(require("@twemoji/api"), 1);
|
|
44
33
|
function render(txt) {
|
|
45
34
|
let twemojiparsed = import_api.default.parse(txt).replaceAll("<img", '<img style="object-fit: cover;" loading="lazy"');
|
|
46
35
|
if (txt.startsWith("<:") || txt.startsWith("<a:")) {
|
|
@@ -51,12 +40,17 @@ function render(txt) {
|
|
|
51
40
|
}
|
|
52
41
|
return twemojiparsed;
|
|
53
42
|
}
|
|
43
|
+
var import_api;
|
|
44
|
+
var init_render = __esm({
|
|
45
|
+
"src/render.tsx"() {
|
|
46
|
+
import_api = __toESM(require("@twemoji/api"), 1);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
54
49
|
|
|
55
50
|
// src/hooks.tsx
|
|
56
|
-
var import_react = require("react");
|
|
57
51
|
function useSkin({ pickerId }) {
|
|
58
|
-
const [skin, setSkin] = (0,
|
|
59
|
-
(0,
|
|
52
|
+
const [skin, setSkin] = (0, import_react3.useState)(0);
|
|
53
|
+
(0, import_react3.useEffect)(() => {
|
|
60
54
|
let raf;
|
|
61
55
|
const loop = () => {
|
|
62
56
|
const newSkin = window["emojipicker-" + pickerId]?.skin;
|
|
@@ -71,8 +65,8 @@ function useSkin({ pickerId }) {
|
|
|
71
65
|
return skin;
|
|
72
66
|
}
|
|
73
67
|
function useSearchValue({ pickerId }) {
|
|
74
|
-
const [searchValue, setSearchValue] = (0,
|
|
75
|
-
(0,
|
|
68
|
+
const [searchValue, setSearchValue] = (0, import_react3.useState)("");
|
|
69
|
+
(0, import_react3.useEffect)(() => {
|
|
76
70
|
let raf;
|
|
77
71
|
const loop = () => {
|
|
78
72
|
const newSearchValue = window["emojipicker-" + pickerId]?.searchValue || "";
|
|
@@ -86,193 +80,488 @@ function useSearchValue({ pickerId }) {
|
|
|
86
80
|
}, [pickerId]);
|
|
87
81
|
return searchValue;
|
|
88
82
|
}
|
|
83
|
+
var import_react3;
|
|
84
|
+
var init_hooks = __esm({
|
|
85
|
+
"src/hooks.tsx"() {
|
|
86
|
+
import_react3 = require("react");
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
89
|
|
|
90
90
|
// src/categoryDisplay.tsx
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
var categoryDisplay_exports = {};
|
|
92
|
+
__export(categoryDisplay_exports, {
|
|
93
|
+
default: () => categoryDisplay_default
|
|
94
|
+
});
|
|
95
|
+
var import_lucide_react, import_react6, import_jsx_runtime6, Emoji, SkinEmoji, CategoryDisplay, categoryDisplay_default;
|
|
96
|
+
var init_categoryDisplay = __esm({
|
|
97
|
+
"src/categoryDisplay.tsx"() {
|
|
98
|
+
import_lucide_react = require("lucide-react");
|
|
99
|
+
import_react6 = require("react");
|
|
100
|
+
init_render();
|
|
101
|
+
init_hooks();
|
|
102
|
+
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
103
|
+
Emoji = (0, import_react6.memo)(function Emoji2({
|
|
104
|
+
pickerId,
|
|
105
|
+
emoji,
|
|
106
|
+
onEmojiMouseEnter,
|
|
107
|
+
onEmojiMouseLeave,
|
|
108
|
+
onEmojiSelect
|
|
109
|
+
}) {
|
|
110
|
+
const handleMouseEnter = (0, import_react6.useCallback)(() => {
|
|
104
111
|
window["emojipicker-" + pickerId].changeFooterEmoji(emoji);
|
|
105
|
-
window["emojipicker-" + pickerId].changeSearchbarPlaceholder(
|
|
106
|
-
emoji.name
|
|
107
|
-
);
|
|
112
|
+
window["emojipicker-" + pickerId].changeSearchbarPlaceholder(emoji.name);
|
|
108
113
|
onEmojiMouseEnter(emoji);
|
|
109
|
-
},
|
|
110
|
-
|
|
114
|
+
}, [pickerId, emoji, onEmojiMouseEnter]);
|
|
115
|
+
const handleMouseLeave = (0, import_react6.useCallback)(() => {
|
|
111
116
|
onEmojiMouseLeave(emoji);
|
|
112
|
-
},
|
|
113
|
-
|
|
117
|
+
}, [emoji, onEmojiMouseLeave]);
|
|
118
|
+
const handleClick = (0, import_react6.useCallback)(() => {
|
|
114
119
|
onEmojiSelect(emoji);
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
}, [emoji, onEmojiSelect]);
|
|
121
|
+
const html = (0, import_react6.useMemo)(() => render(emoji.char), [emoji.char]);
|
|
122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
onMouseEnter: handleMouseEnter,
|
|
126
|
+
onMouseLeave: handleMouseLeave,
|
|
127
|
+
onClick: handleClick,
|
|
128
|
+
className: "HOKKIEMOJIPICKER-emoji text-4xl p-1 cursor-pointer hover:bg-white/15 rounded-sm size-12.5 flex items-center justify-center overflow-hidden",
|
|
129
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
SkinEmoji = (0, import_react6.memo)(function SkinEmoji2({
|
|
134
|
+
pickerId,
|
|
135
|
+
emoji,
|
|
136
|
+
onEmojiSelect,
|
|
137
|
+
onEmojiMouseEnter,
|
|
138
|
+
onEmojiMouseLeave
|
|
139
|
+
}) {
|
|
140
|
+
const skin = useSkin({ pickerId });
|
|
141
|
+
const fakeEmoji = (0, import_react6.useMemo)(() => {
|
|
142
|
+
const charForSkin = [1, 2, 3, 4, 5].includes(skin) ? emoji.tones.find((a) => a.tone.find((b) => b === skin) === skin)?.char : emoji.char;
|
|
143
|
+
return {
|
|
144
|
+
...emoji,
|
|
145
|
+
char: charForSkin,
|
|
146
|
+
preRendered: true,
|
|
147
|
+
tones: [
|
|
148
|
+
{
|
|
149
|
+
name: emoji.tones[0].name.replaceAll("1", "0"),
|
|
150
|
+
tone: [0],
|
|
151
|
+
char: emoji.char
|
|
152
|
+
},
|
|
153
|
+
...emoji.tones
|
|
154
|
+
]
|
|
155
|
+
};
|
|
156
|
+
}, [emoji, skin]);
|
|
157
|
+
const handleMouseEnter = (0, import_react6.useCallback)(() => {
|
|
158
|
+
window["emojipicker-" + pickerId].changeFooterEmoji(fakeEmoji);
|
|
159
|
+
window["emojipicker-" + pickerId].changeSearchbarPlaceholder(emoji.name);
|
|
160
|
+
onEmojiMouseEnter(fakeEmoji);
|
|
161
|
+
}, [pickerId, fakeEmoji, emoji.name, onEmojiMouseEnter]);
|
|
162
|
+
const handleMouseLeave = (0, import_react6.useCallback)(() => {
|
|
163
|
+
onEmojiMouseLeave(fakeEmoji);
|
|
164
|
+
}, [fakeEmoji, onEmojiMouseLeave]);
|
|
165
|
+
const handleClick = (0, import_react6.useCallback)(() => {
|
|
166
|
+
onEmojiSelect(fakeEmoji);
|
|
167
|
+
}, [fakeEmoji, onEmojiSelect]);
|
|
168
|
+
const html = (0, import_react6.useMemo)(() => render(fakeEmoji.char), [fakeEmoji.char]);
|
|
169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
onMouseEnter: handleMouseEnter,
|
|
173
|
+
onMouseLeave: handleMouseLeave,
|
|
174
|
+
onClick: handleClick,
|
|
175
|
+
className: "HOKKIEMOJIPICKER-skinemoji text-4xl p-1 cursor-pointer hover:bg-white/15 rounded-sm size-12.5 flex items-center justify-center overflow-hidden",
|
|
176
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
CategoryDisplay = (0, import_react6.memo)(function CategoryDisplay2({
|
|
181
|
+
category,
|
|
182
|
+
categoryInfo,
|
|
183
|
+
isToneSelectorEnabled,
|
|
184
|
+
onEmojiSelect,
|
|
185
|
+
onEmojiMouseEnter,
|
|
186
|
+
onEmojiMouseLeave,
|
|
187
|
+
pickerId
|
|
188
|
+
}) {
|
|
189
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(true);
|
|
190
|
+
const searchValue = useSearchValue({ pickerId });
|
|
191
|
+
(0, import_react6.useEffect)(() => {
|
|
192
|
+
setIsOpen(
|
|
193
|
+
(localStorage.getItem(
|
|
194
|
+
"hokkiemojipicker-category-" + category.name + "-open"
|
|
195
|
+
) || "true") === "true"
|
|
196
|
+
);
|
|
197
|
+
}, [category.name]);
|
|
198
|
+
const searchLower = (0, import_react6.useMemo)(
|
|
199
|
+
() => (searchValue || "").toLowerCase().replace(/_/g, " "),
|
|
200
|
+
[searchValue]
|
|
201
|
+
);
|
|
202
|
+
const filteredEmojis = (0, import_react6.useMemo)(() => {
|
|
203
|
+
if (!searchLower) return null;
|
|
204
|
+
return category.emojis.filter(
|
|
205
|
+
(emoji) => emoji.name.toLowerCase().replace(/_/g, " ").includes(searchLower)
|
|
206
|
+
);
|
|
207
|
+
}, [category.emojis, searchLower]);
|
|
208
|
+
if (searchLower) {
|
|
209
|
+
if (category.name === "recentlyUsed")
|
|
210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "h-1.5 w-full" });
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: filteredEmojis.map((emoji) => {
|
|
212
|
+
if (emoji.hasTone && !emoji.preRendered) {
|
|
213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
214
|
+
SkinEmoji,
|
|
215
|
+
{
|
|
216
|
+
onEmojiSelect,
|
|
217
|
+
pickerId,
|
|
218
|
+
onEmojiMouseEnter,
|
|
219
|
+
onEmojiMouseLeave,
|
|
220
|
+
emoji
|
|
221
|
+
},
|
|
222
|
+
emoji.name
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
226
|
+
Emoji,
|
|
227
|
+
{
|
|
228
|
+
onEmojiSelect,
|
|
229
|
+
pickerId,
|
|
230
|
+
emoji,
|
|
231
|
+
onEmojiMouseEnter,
|
|
232
|
+
onEmojiMouseLeave
|
|
233
|
+
},
|
|
234
|
+
emoji.name
|
|
235
|
+
);
|
|
236
|
+
}) });
|
|
119
237
|
}
|
|
238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "HOKKIEMOJIPICKER-categorydisplay flex flex-col relative w-full pt-2", children: [
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
240
|
+
"div",
|
|
241
|
+
{
|
|
242
|
+
className: "HOKKIEMOJIPICKER-categoryHeader sticky top-0 pt-2 cursor-pointer text-white px-2 flex bg-[#131416] p-1 pb-2 " + category.name,
|
|
243
|
+
onClick: () => {
|
|
244
|
+
const newOpen = !isOpen;
|
|
245
|
+
setIsOpen(newOpen);
|
|
246
|
+
localStorage.setItem(
|
|
247
|
+
"hokkiemojipicker-category-" + category.name + "-open",
|
|
248
|
+
newOpen ? "true" : "false"
|
|
249
|
+
);
|
|
250
|
+
},
|
|
251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex gap-1.5 items-center opacity-75 hover:opacity-100", children: [
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "*:size-4.5", children: categoryInfo.icon }),
|
|
253
|
+
" ",
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-md font-semibold font-gg", children: categoryInfo.name }),
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
256
|
+
import_lucide_react.ChevronDown,
|
|
257
|
+
{
|
|
258
|
+
strokeWidth: 2,
|
|
259
|
+
className: "transition-all size-5 data-[open=false]:-rotate-90",
|
|
260
|
+
"data-open": isOpen ? "true" : "false"
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
] })
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex flex-wrap gap-y-0.5", children: category.emojis.map((emoji) => {
|
|
267
|
+
if (emoji.hasTone && !emoji.preRendered && isToneSelectorEnabled) {
|
|
268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
269
|
+
SkinEmoji,
|
|
270
|
+
{
|
|
271
|
+
onEmojiSelect,
|
|
272
|
+
pickerId,
|
|
273
|
+
emoji,
|
|
274
|
+
onEmojiMouseEnter,
|
|
275
|
+
onEmojiMouseLeave
|
|
276
|
+
},
|
|
277
|
+
emoji.name
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
281
|
+
Emoji,
|
|
282
|
+
{
|
|
283
|
+
onEmojiSelect,
|
|
284
|
+
pickerId,
|
|
285
|
+
onEmojiMouseEnter,
|
|
286
|
+
onEmojiMouseLeave,
|
|
287
|
+
emoji
|
|
288
|
+
},
|
|
289
|
+
emoji.name
|
|
290
|
+
);
|
|
291
|
+
}) })
|
|
292
|
+
] });
|
|
293
|
+
});
|
|
294
|
+
categoryDisplay_default = CategoryDisplay;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// src/index.tsx
|
|
299
|
+
var index_exports = {};
|
|
300
|
+
__export(index_exports, {
|
|
301
|
+
default: () => EmojiSelector,
|
|
302
|
+
render: () => render
|
|
303
|
+
});
|
|
304
|
+
module.exports = __toCommonJS(index_exports);
|
|
305
|
+
var import_react7 = require("react");
|
|
306
|
+
|
|
307
|
+
// src/searchbar.tsx
|
|
308
|
+
var import_react = require("react");
|
|
309
|
+
|
|
310
|
+
// src/icons.tsx
|
|
311
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
312
|
+
var MagniferLinear = (props) => {
|
|
313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
314
|
+
"svg",
|
|
315
|
+
{
|
|
316
|
+
"aria-hidden": "true",
|
|
317
|
+
fill: "none",
|
|
318
|
+
focusable: "false",
|
|
319
|
+
height: "1em",
|
|
320
|
+
role: "presentation",
|
|
321
|
+
viewBox: "0 0 24 24",
|
|
322
|
+
width: "1em",
|
|
323
|
+
...props,
|
|
324
|
+
children: [
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
326
|
+
"circle",
|
|
327
|
+
{
|
|
328
|
+
cx: "11.5",
|
|
329
|
+
cy: "11.5",
|
|
330
|
+
r: "9.5",
|
|
331
|
+
stroke: "currentColor",
|
|
332
|
+
strokeWidth: "1.5"
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
336
|
+
"path",
|
|
337
|
+
{
|
|
338
|
+
d: "M18.5 18.5L22 22",
|
|
339
|
+
stroke: "currentColor",
|
|
340
|
+
strokeWidth: "1.5",
|
|
341
|
+
strokeLinecap: "round"
|
|
342
|
+
}
|
|
343
|
+
)
|
|
344
|
+
]
|
|
120
345
|
}
|
|
121
346
|
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
key
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// src/searchbar.tsx
|
|
350
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
351
|
+
function SearchBar({
|
|
352
|
+
searchPlaceholder,
|
|
353
|
+
id
|
|
130
354
|
}) {
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
]
|
|
145
|
-
};
|
|
146
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
355
|
+
const [isFocused, setIsFocused] = (0, import_react.useState)(false);
|
|
356
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
357
|
+
const [inputPlaceholder, setInputPlaceholder] = (0, import_react.useState)(searchPlaceholder);
|
|
358
|
+
(0, import_react.useEffect)(() => {
|
|
359
|
+
window["emojipicker-" + id].changeSearchbarPlaceholder = (emoji) => {
|
|
360
|
+
setInputPlaceholder(emoji);
|
|
361
|
+
};
|
|
362
|
+
window["emojipicker-" + id].setSearchValue = (value) => {
|
|
363
|
+
inputRef.current.value = value;
|
|
364
|
+
window["emojipicker-" + id].searchValue = value;
|
|
365
|
+
};
|
|
366
|
+
}, []);
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
147
368
|
"div",
|
|
148
369
|
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
370
|
+
"data-focused": isFocused ? "true" : "false",
|
|
371
|
+
className: "bg-[#121214] items-center w-full border-1 border-[#323337] p-2 px-3 flex rounded-md data-[focused=true]:border-[#3687E9]",
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
374
|
+
"input",
|
|
375
|
+
{
|
|
376
|
+
ref: inputRef,
|
|
377
|
+
onChange: (e) => window["emojipicker-" + id].searchValue = e.target.value,
|
|
378
|
+
className: "!outline-0 text-lg w-full",
|
|
379
|
+
onFocus: () => setIsFocused(true),
|
|
380
|
+
onBlur: () => setIsFocused(false),
|
|
381
|
+
placeholder: inputPlaceholder
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MagniferLinear, { className: "size-5 opacity-50" })
|
|
385
|
+
]
|
|
166
386
|
}
|
|
167
387
|
);
|
|
168
388
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
389
|
+
|
|
390
|
+
// src/footer.tsx
|
|
391
|
+
var import_react2 = require("react");
|
|
392
|
+
init_render();
|
|
393
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
394
|
+
function Footer({
|
|
395
|
+
id,
|
|
396
|
+
firstEmoji
|
|
177
397
|
}) {
|
|
178
|
-
const [
|
|
179
|
-
const searchValue = useSearchValue({ pickerId });
|
|
398
|
+
const [footerEmoji, setFooterEmoji] = (0, import_react2.useState)(firstEmoji);
|
|
180
399
|
(0, import_react2.useEffect)(() => {
|
|
181
|
-
|
|
182
|
-
(
|
|
183
|
-
|
|
184
|
-
) || "true") === "true"
|
|
185
|
-
);
|
|
400
|
+
window["emojipicker-" + id].changeFooterEmoji = (emoji) => {
|
|
401
|
+
setFooterEmoji(emoji);
|
|
402
|
+
};
|
|
186
403
|
}, []);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (emoji.hasTone && !emoji.preRendered) {
|
|
194
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
-
SkinEmoji,
|
|
196
|
-
{
|
|
197
|
-
onEmojiSelect,
|
|
198
|
-
pickerId,
|
|
199
|
-
onEmojiMouseEnter,
|
|
200
|
-
onEmojiMouseLeave,
|
|
201
|
-
emoji
|
|
202
|
-
},
|
|
203
|
-
emoji.name
|
|
204
|
-
);
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "HOKKIEMOJIPICKER-footer mt-auto flex gap-2 items-center border-t-1 px-4 py-3 border-[#363639] bg-[#070709]", children: [
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
406
|
+
"div",
|
|
407
|
+
{
|
|
408
|
+
className: "*:size-9 *:min-w-9 *:max-w-9",
|
|
409
|
+
dangerouslySetInnerHTML: { __html: render(footerEmoji.char) }
|
|
205
410
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
411
|
+
),
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "text-lg whitespace-nowrap overflow-hidden text-ellipsis font-gg font-semibold", children: (footerEmoji.name || "").split(" ").map((e) => `:${e || ""}:`).join(" ") })
|
|
413
|
+
] });
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// src/sidebarCategory.tsx
|
|
417
|
+
var import_react4 = require("react");
|
|
418
|
+
init_hooks();
|
|
419
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
420
|
+
function SidebarCategory({
|
|
421
|
+
categoryName,
|
|
422
|
+
picker,
|
|
423
|
+
icon,
|
|
424
|
+
id
|
|
425
|
+
}) {
|
|
426
|
+
const searchValue = useSearchValue({ pickerId: id });
|
|
427
|
+
const [isActive, setIsActive] = (0, import_react4.useState)(false);
|
|
428
|
+
(0, import_react4.useEffect)(() => {
|
|
429
|
+
if ((searchValue || "").length > 0) {
|
|
430
|
+
setIsActive(false);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const elem = picker.current;
|
|
434
|
+
const updateActive = () => {
|
|
435
|
+
if (!elem) return;
|
|
436
|
+
const header = elem.querySelector(
|
|
437
|
+
".HOKKIEMOJIPICKER-categoryHeader." + categoryName
|
|
216
438
|
);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
439
|
+
if (!header) return;
|
|
440
|
+
const categoryContainer = header.parentElement;
|
|
441
|
+
const scrollElem = elem.querySelector(
|
|
442
|
+
".HOKKIEMOJIPICKER-emojidisplay"
|
|
443
|
+
);
|
|
444
|
+
if (!scrollElem) return;
|
|
445
|
+
const containerRect = scrollElem.getBoundingClientRect();
|
|
446
|
+
const categoryRect = categoryContainer.getBoundingClientRect();
|
|
447
|
+
const headerHeight = header.offsetHeight;
|
|
448
|
+
const categoryTop = categoryRect.top - containerRect.top + scrollElem.scrollTop;
|
|
449
|
+
const categoryBottom = categoryTop + categoryContainer.offsetHeight;
|
|
450
|
+
const sTop = scrollElem.scrollTop;
|
|
451
|
+
const inView = sTop >= categoryTop - headerHeight && sTop < categoryBottom - headerHeight;
|
|
452
|
+
setIsActive(inView);
|
|
453
|
+
};
|
|
454
|
+
elem.querySelector(".HOKKIEMOJIPICKER-emojidisplay").addEventListener("scroll", updateActive);
|
|
455
|
+
updateActive();
|
|
456
|
+
return () => {
|
|
457
|
+
elem.querySelector(".HOKKIEMOJIPICKER-emojidisplay").removeEventListener("scroll", updateActive);
|
|
458
|
+
};
|
|
459
|
+
}, [picker, searchValue]);
|
|
460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
461
|
+
"button",
|
|
462
|
+
{
|
|
463
|
+
onClick: () => {
|
|
464
|
+
const elem = picker.current;
|
|
465
|
+
if (!elem) return;
|
|
466
|
+
const doScroll = () => {
|
|
467
|
+
const header = elem.querySelector(
|
|
468
|
+
".HOKKIEMOJIPICKER-categoryHeader." + categoryName
|
|
469
|
+
);
|
|
470
|
+
if (!header) return;
|
|
471
|
+
const categoryContainer = header.parentElement;
|
|
472
|
+
const scrollElem = elem.querySelector(
|
|
473
|
+
".HOKKIEMOJIPICKER-emojidisplay"
|
|
474
|
+
);
|
|
475
|
+
if (!scrollElem) return;
|
|
476
|
+
const containerRect = scrollElem.getBoundingClientRect();
|
|
477
|
+
const categoryRect = categoryContainer.getBoundingClientRect();
|
|
478
|
+
const headerHeight = header.offsetHeight;
|
|
479
|
+
const targetTop = categoryRect.top - containerRect.top + scrollElem.scrollTop - headerHeight;
|
|
480
|
+
scrollElem.scrollTo({
|
|
481
|
+
top: Math.max(0, targetTop),
|
|
482
|
+
behavior: "smooth"
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
if ((searchValue || "").length > 0) {
|
|
486
|
+
window["emojipicker-" + id].setSearchValue("");
|
|
487
|
+
setTimeout(doScroll, 50);
|
|
488
|
+
} else {
|
|
489
|
+
doScroll();
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"data-active": isActive ? "true" : "false",
|
|
493
|
+
className: "!outline-0 HOKKIEMOJIPICKER-sidebarButton cursor-pointer size-8 data-[active=true]:bg-white/5 hover:bg-white/10 overflow-hidden *:!size-6.5 transition-all hover:*:!opacity-85 data-[active=true]:*:!opacity-100 flex items-center justify-center rounded-sm *:opacity-50",
|
|
494
|
+
children: icon
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// src/skinselector.tsx
|
|
500
|
+
var import_react5 = require("react");
|
|
501
|
+
init_render();
|
|
502
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
503
|
+
function SkinSelector({ id }) {
|
|
504
|
+
const skins = ["\u{1F44F}", "\u{1F44F}\u{1F3FB}", "\u{1F44F}\u{1F3FC}", "\u{1F44F}\u{1F3FD}", "\u{1F44F}\u{1F3FE}", "\u{1F44F}\u{1F3FF}"];
|
|
505
|
+
const [selectedTone, setSelectedTone] = (0, import_react5.useState)(0);
|
|
506
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
507
|
+
(0, import_react5.useEffect)(() => {
|
|
508
|
+
setSelectedTone(
|
|
509
|
+
parseInt(localStorage.getItem("hokkiemojipicker-skin") || "0")
|
|
510
|
+
);
|
|
511
|
+
}, []);
|
|
512
|
+
(0, import_react5.useEffect)(() => {
|
|
513
|
+
window["emojipicker-" + id].skin = selectedTone;
|
|
514
|
+
}, [selectedTone]);
|
|
515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative mr-1", children: [
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
221
517
|
"div",
|
|
222
518
|
{
|
|
223
|
-
className: "HOKKIEMOJIPICKER-
|
|
519
|
+
className: "HOKKIEMOJIPICKER-skinselector-trigger opacity-75 hover:opacity-100 cursor-pointer *:size-7 *:min-w-7",
|
|
224
520
|
onClick: () => {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
521
|
+
setOpen(!open);
|
|
522
|
+
},
|
|
523
|
+
dangerouslySetInnerHTML: { __html: render(skins[selectedTone]) }
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
style: {
|
|
530
|
+
opacity: open ? 1 : 0,
|
|
531
|
+
pointerEvents: open ? "all" : "none"
|
|
231
532
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
237
|
-
import_lucide_react.ChevronDown,
|
|
533
|
+
className: "absolute flex transition-all flex-col cursor-pointer top-full translate-y-2 overflow-hidden -left-2 rounded-sm border-1 bg-neutral-900",
|
|
534
|
+
children: skins.filter((a) => a !== skins[selectedTone]).map((skin, i) => {
|
|
535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
536
|
+
"div",
|
|
238
537
|
{
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
538
|
+
className: "HOKKIEMOJIPICKER-skinselector-skinoption *:size-7 *:min-w-7 hover:bg-white/5 p-2 transition-all",
|
|
539
|
+
onClick: () => {
|
|
540
|
+
setOpen(!open);
|
|
541
|
+
setSelectedTone(i);
|
|
542
|
+
localStorage.setItem("hokkiemojipicker-skin", i + "");
|
|
543
|
+
},
|
|
544
|
+
dangerouslySetInnerHTML: {
|
|
545
|
+
__html: render(skin)
|
|
546
|
+
}
|
|
242
547
|
}
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap gap-y-0.5", children: category.emojis.map((emoji) => {
|
|
248
|
-
if (emoji.hasTone && !emoji.preRendered && isToneSelectorEnabled) {
|
|
249
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
250
|
-
SkinEmoji,
|
|
251
|
-
{
|
|
252
|
-
onEmojiSelect,
|
|
253
|
-
pickerId,
|
|
254
|
-
emoji,
|
|
255
|
-
onEmojiMouseEnter,
|
|
256
|
-
onEmojiMouseLeave
|
|
257
|
-
},
|
|
258
|
-
emoji.name
|
|
259
|
-
);
|
|
548
|
+
);
|
|
549
|
+
})
|
|
260
550
|
}
|
|
261
|
-
|
|
262
|
-
Emoji,
|
|
263
|
-
{
|
|
264
|
-
onEmojiSelect,
|
|
265
|
-
pickerId,
|
|
266
|
-
onEmojiMouseEnter,
|
|
267
|
-
onEmojiMouseLeave,
|
|
268
|
-
emoji
|
|
269
|
-
},
|
|
270
|
-
emoji.name
|
|
271
|
-
);
|
|
272
|
-
}) })
|
|
551
|
+
)
|
|
273
552
|
] });
|
|
274
553
|
}
|
|
275
554
|
|
|
555
|
+
// src/index.tsx
|
|
556
|
+
init_render();
|
|
557
|
+
|
|
558
|
+
// src/cn.ts
|
|
559
|
+
var import_clsx = require("clsx");
|
|
560
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
561
|
+
var cn = (...inputs) => {
|
|
562
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
563
|
+
};
|
|
564
|
+
|
|
276
565
|
// src/emojilib.json
|
|
277
566
|
var emojilib_default = [
|
|
278
567
|
{
|
|
@@ -17003,257 +17292,9 @@ var emojilib_default = [
|
|
|
17003
17292
|
}
|
|
17004
17293
|
];
|
|
17005
17294
|
|
|
17006
|
-
// src/searchbar.tsx
|
|
17007
|
-
var import_react3 = require("react");
|
|
17008
|
-
|
|
17009
|
-
// src/icons.tsx
|
|
17010
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
17011
|
-
var MagniferLinear = (props) => {
|
|
17012
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
17013
|
-
"svg",
|
|
17014
|
-
{
|
|
17015
|
-
"aria-hidden": "true",
|
|
17016
|
-
fill: "none",
|
|
17017
|
-
focusable: "false",
|
|
17018
|
-
height: "1em",
|
|
17019
|
-
role: "presentation",
|
|
17020
|
-
viewBox: "0 0 24 24",
|
|
17021
|
-
width: "1em",
|
|
17022
|
-
...props,
|
|
17023
|
-
children: [
|
|
17024
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
17025
|
-
"circle",
|
|
17026
|
-
{
|
|
17027
|
-
cx: "11.5",
|
|
17028
|
-
cy: "11.5",
|
|
17029
|
-
r: "9.5",
|
|
17030
|
-
stroke: "currentColor",
|
|
17031
|
-
strokeWidth: "1.5"
|
|
17032
|
-
}
|
|
17033
|
-
),
|
|
17034
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
17035
|
-
"path",
|
|
17036
|
-
{
|
|
17037
|
-
d: "M18.5 18.5L22 22",
|
|
17038
|
-
stroke: "currentColor",
|
|
17039
|
-
strokeWidth: "1.5",
|
|
17040
|
-
strokeLinecap: "round"
|
|
17041
|
-
}
|
|
17042
|
-
)
|
|
17043
|
-
]
|
|
17044
|
-
}
|
|
17045
|
-
);
|
|
17046
|
-
};
|
|
17047
|
-
|
|
17048
|
-
// src/searchbar.tsx
|
|
17049
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
17050
|
-
function SearchBar({
|
|
17051
|
-
searchPlaceholder,
|
|
17052
|
-
id
|
|
17053
|
-
}) {
|
|
17054
|
-
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
17055
|
-
const inputRef = (0, import_react3.useRef)(null);
|
|
17056
|
-
const [inputPlaceholder, setInputPlaceholder] = (0, import_react3.useState)(searchPlaceholder);
|
|
17057
|
-
(0, import_react3.useEffect)(() => {
|
|
17058
|
-
window["emojipicker-" + id].changeSearchbarPlaceholder = (emoji) => {
|
|
17059
|
-
setInputPlaceholder(emoji);
|
|
17060
|
-
};
|
|
17061
|
-
window["emojipicker-" + id].setSearchValue = (value) => {
|
|
17062
|
-
inputRef.current.value = value;
|
|
17063
|
-
window["emojipicker-" + id].searchValue = value;
|
|
17064
|
-
};
|
|
17065
|
-
}, []);
|
|
17066
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
17067
|
-
"div",
|
|
17068
|
-
{
|
|
17069
|
-
"data-focused": isFocused ? "true" : "false",
|
|
17070
|
-
className: "bg-[#121214] items-center w-full border-1 border-[#323337] p-2 px-3 flex rounded-md data-[focused=true]:border-[#3687E9]",
|
|
17071
|
-
children: [
|
|
17072
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
17073
|
-
"input",
|
|
17074
|
-
{
|
|
17075
|
-
ref: inputRef,
|
|
17076
|
-
onChange: (e) => window["emojipicker-" + id].searchValue = e.target.value,
|
|
17077
|
-
className: "!outline-0 text-lg w-full",
|
|
17078
|
-
onFocus: () => setIsFocused(true),
|
|
17079
|
-
onBlur: () => setIsFocused(false),
|
|
17080
|
-
placeholder: inputPlaceholder
|
|
17081
|
-
}
|
|
17082
|
-
),
|
|
17083
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MagniferLinear, { className: "size-5 opacity-50" })
|
|
17084
|
-
]
|
|
17085
|
-
}
|
|
17086
|
-
);
|
|
17087
|
-
}
|
|
17088
|
-
|
|
17089
|
-
// src/footer.tsx
|
|
17090
|
-
var import_react4 = require("react");
|
|
17091
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
17092
|
-
function Footer({
|
|
17093
|
-
id,
|
|
17094
|
-
firstEmoji
|
|
17095
|
-
}) {
|
|
17096
|
-
const [footerEmoji, setFooterEmoji] = (0, import_react4.useState)(firstEmoji);
|
|
17097
|
-
(0, import_react4.useEffect)(() => {
|
|
17098
|
-
window["emojipicker-" + id].changeFooterEmoji = (emoji) => {
|
|
17099
|
-
setFooterEmoji(emoji);
|
|
17100
|
-
};
|
|
17101
|
-
}, []);
|
|
17102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "HOKKIEMOJIPICKER-footer mt-auto flex gap-2 items-center border-t-1 px-4 py-3 border-[#363639] bg-[#070709]", children: [
|
|
17103
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
17104
|
-
"div",
|
|
17105
|
-
{
|
|
17106
|
-
className: "*:size-9 *:min-w-9 *:max-w-9",
|
|
17107
|
-
dangerouslySetInnerHTML: { __html: render(footerEmoji.char) }
|
|
17108
|
-
}
|
|
17109
|
-
),
|
|
17110
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-lg whitespace-nowrap overflow-hidden text-ellipsis font-gg font-semibold", children: (footerEmoji.name || "").split(" ").map((e) => `:${e || ""}:`).join(" ") })
|
|
17111
|
-
] });
|
|
17112
|
-
}
|
|
17113
|
-
|
|
17114
|
-
// src/sidebarCategory.tsx
|
|
17115
|
-
var import_react5 = require("react");
|
|
17116
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
17117
|
-
function SidebarCategory({
|
|
17118
|
-
categoryName,
|
|
17119
|
-
picker,
|
|
17120
|
-
icon,
|
|
17121
|
-
id
|
|
17122
|
-
}) {
|
|
17123
|
-
const searchValue = useSearchValue({ pickerId: id });
|
|
17124
|
-
const [isActive, setIsActive] = (0, import_react5.useState)(false);
|
|
17125
|
-
(0, import_react5.useEffect)(() => {
|
|
17126
|
-
if ((searchValue || "").length > 0) {
|
|
17127
|
-
setIsActive(false);
|
|
17128
|
-
return;
|
|
17129
|
-
}
|
|
17130
|
-
const elem = picker.current;
|
|
17131
|
-
const updateActive = () => {
|
|
17132
|
-
if (!elem) return;
|
|
17133
|
-
const header = elem.querySelector(
|
|
17134
|
-
".HOKKIEMOJIPICKER-categoryHeader." + categoryName
|
|
17135
|
-
);
|
|
17136
|
-
if (!header) return;
|
|
17137
|
-
const categoryContainer = header.parentElement;
|
|
17138
|
-
const scrollElem = elem.querySelector(
|
|
17139
|
-
".HOKKIEMOJIPICKER-emojidisplay"
|
|
17140
|
-
);
|
|
17141
|
-
if (!scrollElem) return;
|
|
17142
|
-
const containerRect = scrollElem.getBoundingClientRect();
|
|
17143
|
-
const categoryRect = categoryContainer.getBoundingClientRect();
|
|
17144
|
-
const headerHeight = header.offsetHeight;
|
|
17145
|
-
const categoryTop = categoryRect.top - containerRect.top + scrollElem.scrollTop;
|
|
17146
|
-
const categoryBottom = categoryTop + categoryContainer.offsetHeight;
|
|
17147
|
-
const sTop = scrollElem.scrollTop;
|
|
17148
|
-
const inView = sTop >= categoryTop - headerHeight && sTop < categoryBottom - headerHeight;
|
|
17149
|
-
setIsActive(inView);
|
|
17150
|
-
};
|
|
17151
|
-
elem.querySelector(".HOKKIEMOJIPICKER-emojidisplay").addEventListener("scroll", updateActive);
|
|
17152
|
-
updateActive();
|
|
17153
|
-
return () => {
|
|
17154
|
-
elem.querySelector(".HOKKIEMOJIPICKER-emojidisplay").removeEventListener("scroll", updateActive);
|
|
17155
|
-
};
|
|
17156
|
-
}, [picker, searchValue]);
|
|
17157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
17158
|
-
"button",
|
|
17159
|
-
{
|
|
17160
|
-
onClick: () => {
|
|
17161
|
-
const elem = picker.current;
|
|
17162
|
-
if (!elem) return;
|
|
17163
|
-
const doScroll = () => {
|
|
17164
|
-
const header = elem.querySelector(
|
|
17165
|
-
".HOKKIEMOJIPICKER-categoryHeader." + categoryName
|
|
17166
|
-
);
|
|
17167
|
-
if (!header) return;
|
|
17168
|
-
const categoryContainer = header.parentElement;
|
|
17169
|
-
const scrollElem = elem.querySelector(
|
|
17170
|
-
".HOKKIEMOJIPICKER-emojidisplay"
|
|
17171
|
-
);
|
|
17172
|
-
if (!scrollElem) return;
|
|
17173
|
-
const containerRect = scrollElem.getBoundingClientRect();
|
|
17174
|
-
const categoryRect = categoryContainer.getBoundingClientRect();
|
|
17175
|
-
const headerHeight = header.offsetHeight;
|
|
17176
|
-
const targetTop = categoryRect.top - containerRect.top + scrollElem.scrollTop - headerHeight;
|
|
17177
|
-
scrollElem.scrollTo({ top: Math.max(0, targetTop), behavior: "smooth" });
|
|
17178
|
-
};
|
|
17179
|
-
if ((searchValue || "").length > 0) {
|
|
17180
|
-
window["emojipicker-" + id].setSearchValue("");
|
|
17181
|
-
setTimeout(doScroll, 50);
|
|
17182
|
-
} else {
|
|
17183
|
-
doScroll();
|
|
17184
|
-
}
|
|
17185
|
-
},
|
|
17186
|
-
"data-active": isActive ? "true" : "false",
|
|
17187
|
-
className: "!outline-0 HOKKIEMOJIPICKER-sidebarButton cursor-pointer size-8 data-[active=true]:bg-white/5 hover:bg-white/10 overflow-hidden *:!size-6.5 transition-all hover:*:!opacity-85 data-[active=true]:*:!opacity-100 flex items-center justify-center rounded-sm *:opacity-50",
|
|
17188
|
-
children: icon
|
|
17189
|
-
}
|
|
17190
|
-
);
|
|
17191
|
-
}
|
|
17192
|
-
|
|
17193
|
-
// src/skinselector.tsx
|
|
17194
|
-
var import_react6 = require("react");
|
|
17195
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
17196
|
-
function SkinSelector({ id }) {
|
|
17197
|
-
const skins = ["\u{1F44F}", "\u{1F44F}\u{1F3FB}", "\u{1F44F}\u{1F3FC}", "\u{1F44F}\u{1F3FD}", "\u{1F44F}\u{1F3FE}", "\u{1F44F}\u{1F3FF}"];
|
|
17198
|
-
const [selectedTone, setSelectedTone] = (0, import_react6.useState)(0);
|
|
17199
|
-
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
17200
|
-
(0, import_react6.useEffect)(() => {
|
|
17201
|
-
setSelectedTone(
|
|
17202
|
-
parseInt(localStorage.getItem("hokkiemojipicker-skin") || "0")
|
|
17203
|
-
);
|
|
17204
|
-
}, []);
|
|
17205
|
-
(0, import_react6.useEffect)(() => {
|
|
17206
|
-
window["emojipicker-" + id].skin = selectedTone;
|
|
17207
|
-
}, [selectedTone]);
|
|
17208
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative mr-1", children: [
|
|
17209
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
17210
|
-
"div",
|
|
17211
|
-
{
|
|
17212
|
-
className: "HOKKIEMOJIPICKER-skinselector-trigger opacity-75 hover:opacity-100 cursor-pointer *:size-7 *:min-w-7",
|
|
17213
|
-
onClick: () => {
|
|
17214
|
-
setOpen(!open);
|
|
17215
|
-
},
|
|
17216
|
-
dangerouslySetInnerHTML: { __html: render(skins[selectedTone]) }
|
|
17217
|
-
}
|
|
17218
|
-
),
|
|
17219
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
17220
|
-
"div",
|
|
17221
|
-
{
|
|
17222
|
-
style: {
|
|
17223
|
-
opacity: open ? 1 : 0,
|
|
17224
|
-
pointerEvents: open ? "all" : "none"
|
|
17225
|
-
},
|
|
17226
|
-
className: "absolute flex transition-all flex-col cursor-pointer top-full translate-y-2 overflow-hidden -left-2 rounded-sm border-1 bg-neutral-900",
|
|
17227
|
-
children: skins.filter((a) => a !== skins[selectedTone]).map((skin, i) => {
|
|
17228
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
17229
|
-
"div",
|
|
17230
|
-
{
|
|
17231
|
-
className: "HOKKIEMOJIPICKER-skinselector-skinoption *:size-7 *:min-w-7 hover:bg-white/5 p-2 transition-all",
|
|
17232
|
-
onClick: () => {
|
|
17233
|
-
setOpen(!open);
|
|
17234
|
-
setSelectedTone(i);
|
|
17235
|
-
localStorage.setItem("hokkiemojipicker-skin", i + "");
|
|
17236
|
-
},
|
|
17237
|
-
dangerouslySetInnerHTML: {
|
|
17238
|
-
__html: render(skin)
|
|
17239
|
-
}
|
|
17240
|
-
}
|
|
17241
|
-
);
|
|
17242
|
-
})
|
|
17243
|
-
}
|
|
17244
|
-
)
|
|
17245
|
-
] });
|
|
17246
|
-
}
|
|
17247
|
-
|
|
17248
|
-
// src/cn.ts
|
|
17249
|
-
var import_clsx = require("clsx");
|
|
17250
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
17251
|
-
var cn = (...inputs) => {
|
|
17252
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
17253
|
-
};
|
|
17254
|
-
|
|
17255
17295
|
// src/index.tsx
|
|
17256
17296
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
17297
|
+
var CategoryDisplay3 = (0, import_react7.lazy)(() => Promise.resolve().then(() => (init_categoryDisplay(), categoryDisplay_exports)));
|
|
17257
17298
|
function EmojiSelector({
|
|
17258
17299
|
categories = {},
|
|
17259
17300
|
customEmojis = {},
|
|
@@ -17272,10 +17313,13 @@ function EmojiSelector({
|
|
|
17272
17313
|
height = 500,
|
|
17273
17314
|
width = 520
|
|
17274
17315
|
}) {
|
|
17275
|
-
|
|
17276
|
-
(
|
|
17277
|
-
"
|
|
17278
|
-
|
|
17316
|
+
const recentlyUsed = (0, import_react7.useMemo)(
|
|
17317
|
+
() => JSON.parse(
|
|
17318
|
+
(localStorage || { getItem: (a) => "[]" }).getItem(
|
|
17319
|
+
"hokkiemojipicker-recentlyused"
|
|
17320
|
+
) || "[]"
|
|
17321
|
+
),
|
|
17322
|
+
[]
|
|
17279
17323
|
);
|
|
17280
17324
|
const categoryData = {
|
|
17281
17325
|
recentlyUsed: recentlyUsed.length > 0 ? {
|
|
@@ -17513,22 +17557,39 @@ function EmojiSelector({
|
|
|
17513
17557
|
...categories.flags
|
|
17514
17558
|
}
|
|
17515
17559
|
};
|
|
17516
|
-
const emojis =
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17560
|
+
const emojis = (0, import_react7.useMemo)(() => {
|
|
17561
|
+
return [
|
|
17562
|
+
recentlyUsed.length > 0 ? {
|
|
17563
|
+
name: "recentlyUsed",
|
|
17564
|
+
emojis: recentlyUsed
|
|
17565
|
+
} : void 0,
|
|
17566
|
+
(customEmojis?.emojis || []).length > 0 ? {
|
|
17567
|
+
name: "customServerIcons",
|
|
17568
|
+
emojis: customEmojis.emojis.map((a) => {
|
|
17569
|
+
return { name: a.split(":")[1].split(":")[0], char: a };
|
|
17570
|
+
})
|
|
17571
|
+
} : void 0,
|
|
17572
|
+
...emojilib_default
|
|
17573
|
+
].filter((a) => a !== void 0);
|
|
17574
|
+
}, [recentlyUsed, customEmojis]);
|
|
17529
17575
|
const navHeight = showNav ? Math.floor(height / 7) : 0;
|
|
17530
|
-
const id = Math.random().toString(36).substring(2, 15);
|
|
17576
|
+
const id = (0, import_react7.useMemo)(() => Math.random().toString(36).substring(2, 15), []);
|
|
17531
17577
|
const picker = (0, import_react7.useRef)(null);
|
|
17578
|
+
const scrollRef = (0, import_react7.useRef)(null);
|
|
17579
|
+
const handleWheel = (0, import_react7.useCallback)((e) => {
|
|
17580
|
+
const el = scrollRef.current;
|
|
17581
|
+
if (!el) return;
|
|
17582
|
+
e.preventDefault();
|
|
17583
|
+
el.scrollTop += e.deltaY;
|
|
17584
|
+
}, []);
|
|
17585
|
+
(0, import_react7.useEffect)(() => {
|
|
17586
|
+
const el = scrollRef.current;
|
|
17587
|
+
if (!el) return;
|
|
17588
|
+
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
17589
|
+
return () => {
|
|
17590
|
+
el.removeEventListener("wheel", handleWheel);
|
|
17591
|
+
};
|
|
17592
|
+
}, [handleWheel]);
|
|
17532
17593
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "HOKKIEMOJIPICKER-emojiContainer", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
17533
17594
|
"div",
|
|
17534
17595
|
{
|
|
@@ -17596,15 +17657,16 @@ function EmojiSelector({
|
|
|
17596
17657
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
17597
17658
|
"div",
|
|
17598
17659
|
{
|
|
17660
|
+
ref: scrollRef,
|
|
17599
17661
|
style: {
|
|
17600
17662
|
flexBasis: "fit-content"
|
|
17601
17663
|
},
|
|
17602
17664
|
className: "HOKKIEMOJIPICKER-emojidisplay overflow-y-scroll bg-[#131416] h-full w-full flex flex-wrap px-2 items-start justfy-start justify-self-start gap-y-0.5",
|
|
17603
|
-
children: emojis.map((category) => {
|
|
17665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react7.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {}), children: emojis.map((category) => {
|
|
17604
17666
|
if (!category) return;
|
|
17605
17667
|
const categoryInfo = categoryData[category.name];
|
|
17606
17668
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
17607
|
-
|
|
17669
|
+
CategoryDisplay3,
|
|
17608
17670
|
{
|
|
17609
17671
|
onEmojiMouseEnter,
|
|
17610
17672
|
onEmojiMouseLeave,
|
|
@@ -17631,7 +17693,7 @@ function EmojiSelector({
|
|
|
17631
17693
|
},
|
|
17632
17694
|
category.name
|
|
17633
17695
|
);
|
|
17634
|
-
})
|
|
17696
|
+
}) })
|
|
17635
17697
|
}
|
|
17636
17698
|
),
|
|
17637
17699
|
showFooter && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Footer, { id, firstEmoji: emojis[0].emojis[0] })
|