@hokkiai/discord-emoji-selector 1.1.6 → 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 +497 -499
- package/dist/index.js +296 -568
- 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,203 +80,487 @@ 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 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)(() => {
|
|
111
|
+
window["emojipicker-" + pickerId].changeFooterEmoji(emoji);
|
|
112
|
+
window["emojipicker-" + pickerId].changeSearchbarPlaceholder(emoji.name);
|
|
113
|
+
onEmojiMouseEnter(emoji);
|
|
114
|
+
}, [pickerId, emoji, onEmojiMouseEnter]);
|
|
115
|
+
const handleMouseLeave = (0, import_react6.useCallback)(() => {
|
|
116
|
+
onEmojiMouseLeave(emoji);
|
|
117
|
+
}, [emoji, onEmojiMouseLeave]);
|
|
118
|
+
const handleClick = (0, import_react6.useCallback)(() => {
|
|
119
|
+
onEmojiSelect(emoji);
|
|
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
|
+
}) });
|
|
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
|
|
91
311
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
onEmojiMouseEnter,
|
|
96
|
-
onEmojiMouseLeave,
|
|
97
|
-
onEmojiSelect
|
|
98
|
-
}) {
|
|
99
|
-
const handleMouseEnter = (0, import_react2.useCallback)(() => {
|
|
100
|
-
window["emojipicker-" + pickerId].changeFooterEmoji(emoji);
|
|
101
|
-
window["emojipicker-" + pickerId].changeSearchbarPlaceholder(emoji.name);
|
|
102
|
-
onEmojiMouseEnter(emoji);
|
|
103
|
-
}, [pickerId, emoji, onEmojiMouseEnter]);
|
|
104
|
-
const handleMouseLeave = (0, import_react2.useCallback)(() => {
|
|
105
|
-
onEmojiMouseLeave(emoji);
|
|
106
|
-
}, [emoji, onEmojiMouseLeave]);
|
|
107
|
-
const handleClick = (0, import_react2.useCallback)(() => {
|
|
108
|
-
onEmojiSelect(emoji);
|
|
109
|
-
}, [emoji, onEmojiSelect]);
|
|
110
|
-
const html = (0, import_react2.useMemo)(() => render(emoji.char), [emoji.char]);
|
|
111
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
-
"div",
|
|
312
|
+
var MagniferLinear = (props) => {
|
|
313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
314
|
+
"svg",
|
|
113
315
|
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// src/searchbar.tsx
|
|
350
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
351
|
+
function SearchBar({
|
|
352
|
+
searchPlaceholder,
|
|
353
|
+
id
|
|
129
354
|
}) {
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
tone: [0],
|
|
141
|
-
char: emoji.char
|
|
142
|
-
},
|
|
143
|
-
...emoji.tones
|
|
144
|
-
]
|
|
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;
|
|
145
365
|
};
|
|
146
|
-
}, [
|
|
147
|
-
|
|
148
|
-
window["emojipicker-" + pickerId].changeFooterEmoji(fakeEmoji);
|
|
149
|
-
window["emojipicker-" + pickerId].changeSearchbarPlaceholder(emoji.name);
|
|
150
|
-
onEmojiMouseEnter(fakeEmoji);
|
|
151
|
-
}, [pickerId, fakeEmoji, emoji.name, onEmojiMouseEnter]);
|
|
152
|
-
const handleMouseLeave = (0, import_react2.useCallback)(() => {
|
|
153
|
-
onEmojiMouseLeave(fakeEmoji);
|
|
154
|
-
}, [fakeEmoji, onEmojiMouseLeave]);
|
|
155
|
-
const handleClick = (0, import_react2.useCallback)(() => {
|
|
156
|
-
onEmojiSelect(fakeEmoji);
|
|
157
|
-
}, [fakeEmoji, onEmojiSelect]);
|
|
158
|
-
const html = (0, import_react2.useMemo)(() => render(fakeEmoji.char), [fakeEmoji.char]);
|
|
159
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
366
|
+
}, []);
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
160
368
|
"div",
|
|
161
369
|
{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
+
]
|
|
168
386
|
}
|
|
169
387
|
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
388
|
+
}
|
|
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
|
|
179
397
|
}) {
|
|
180
|
-
const [
|
|
181
|
-
const searchValue = useSearchValue({ pickerId });
|
|
398
|
+
const [footerEmoji, setFooterEmoji] = (0, import_react2.useState)(firstEmoji);
|
|
182
399
|
(0, import_react2.useEffect)(() => {
|
|
183
|
-
|
|
184
|
-
(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const filteredEmojis = (0, import_react2.useMemo)(() => {
|
|
194
|
-
if (!searchLower) return null;
|
|
195
|
-
return category.emojis.filter(
|
|
196
|
-
(emoji) => emoji.name.toLowerCase().replace(/_/g, " ").includes(searchLower)
|
|
197
|
-
);
|
|
198
|
-
}, [category.emojis, searchLower]);
|
|
199
|
-
if (searchLower) {
|
|
200
|
-
if (category.name === "recentlyUsed")
|
|
201
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-1.5 w-full" });
|
|
202
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: filteredEmojis.map((emoji) => {
|
|
203
|
-
if (emoji.hasTone && !emoji.preRendered) {
|
|
204
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
|
-
SkinEmoji,
|
|
206
|
-
{
|
|
207
|
-
onEmojiSelect,
|
|
208
|
-
pickerId,
|
|
209
|
-
onEmojiMouseEnter,
|
|
210
|
-
onEmojiMouseLeave,
|
|
211
|
-
emoji
|
|
212
|
-
},
|
|
213
|
-
emoji.name
|
|
214
|
-
);
|
|
400
|
+
window["emojipicker-" + id].changeFooterEmoji = (emoji) => {
|
|
401
|
+
setFooterEmoji(emoji);
|
|
402
|
+
};
|
|
403
|
+
}, []);
|
|
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) }
|
|
215
410
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
|
226
438
|
);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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)(
|
|
231
517
|
"div",
|
|
232
518
|
{
|
|
233
|
-
className: "HOKKIEMOJIPICKER-
|
|
519
|
+
className: "HOKKIEMOJIPICKER-skinselector-trigger opacity-75 hover:opacity-100 cursor-pointer *:size-7 *:min-w-7",
|
|
234
520
|
onClick: () => {
|
|
235
|
-
|
|
236
|
-
setIsOpen(newOpen);
|
|
237
|
-
localStorage.setItem(
|
|
238
|
-
"hokkiemojipicker-category-" + category.name + "-open",
|
|
239
|
-
newOpen ? "true" : "false"
|
|
240
|
-
);
|
|
521
|
+
setOpen(!open);
|
|
241
522
|
},
|
|
242
|
-
|
|
243
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "*:size-4.5", children: categoryInfo.icon }),
|
|
244
|
-
" ",
|
|
245
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-md font-semibold font-gg", children: categoryInfo.name }),
|
|
246
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
|
-
import_lucide_react.ChevronDown,
|
|
248
|
-
{
|
|
249
|
-
strokeWidth: 2,
|
|
250
|
-
className: "transition-all size-5 data-[open=false]:-rotate-90",
|
|
251
|
-
"data-open": isOpen ? "true" : "false"
|
|
252
|
-
}
|
|
253
|
-
)
|
|
254
|
-
] })
|
|
523
|
+
dangerouslySetInnerHTML: { __html: render(skins[selectedTone]) }
|
|
255
524
|
}
|
|
256
525
|
),
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
526
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
style: {
|
|
530
|
+
opacity: open ? 1 : 0,
|
|
531
|
+
pointerEvents: open ? "all" : "none"
|
|
532
|
+
},
|
|
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",
|
|
537
|
+
{
|
|
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
|
+
}
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
})
|
|
270
550
|
}
|
|
271
|
-
|
|
272
|
-
Emoji,
|
|
273
|
-
{
|
|
274
|
-
onEmojiSelect,
|
|
275
|
-
pickerId,
|
|
276
|
-
onEmojiMouseEnter,
|
|
277
|
-
onEmojiMouseLeave,
|
|
278
|
-
emoji
|
|
279
|
-
},
|
|
280
|
-
emoji.name
|
|
281
|
-
);
|
|
282
|
-
}) })
|
|
551
|
+
)
|
|
283
552
|
] });
|
|
284
|
-
}
|
|
285
|
-
|
|
553
|
+
}
|
|
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
|
+
};
|
|
286
564
|
|
|
287
565
|
// src/emojilib.json
|
|
288
566
|
var emojilib_default = [
|
|
@@ -17014,260 +17292,9 @@ var emojilib_default = [
|
|
|
17014
17292
|
}
|
|
17015
17293
|
];
|
|
17016
17294
|
|
|
17017
|
-
// src/searchbar.tsx
|
|
17018
|
-
var import_react3 = require("react");
|
|
17019
|
-
|
|
17020
|
-
// src/icons.tsx
|
|
17021
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
17022
|
-
var MagniferLinear = (props) => {
|
|
17023
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
17024
|
-
"svg",
|
|
17025
|
-
{
|
|
17026
|
-
"aria-hidden": "true",
|
|
17027
|
-
fill: "none",
|
|
17028
|
-
focusable: "false",
|
|
17029
|
-
height: "1em",
|
|
17030
|
-
role: "presentation",
|
|
17031
|
-
viewBox: "0 0 24 24",
|
|
17032
|
-
width: "1em",
|
|
17033
|
-
...props,
|
|
17034
|
-
children: [
|
|
17035
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
17036
|
-
"circle",
|
|
17037
|
-
{
|
|
17038
|
-
cx: "11.5",
|
|
17039
|
-
cy: "11.5",
|
|
17040
|
-
r: "9.5",
|
|
17041
|
-
stroke: "currentColor",
|
|
17042
|
-
strokeWidth: "1.5"
|
|
17043
|
-
}
|
|
17044
|
-
),
|
|
17045
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
17046
|
-
"path",
|
|
17047
|
-
{
|
|
17048
|
-
d: "M18.5 18.5L22 22",
|
|
17049
|
-
stroke: "currentColor",
|
|
17050
|
-
strokeWidth: "1.5",
|
|
17051
|
-
strokeLinecap: "round"
|
|
17052
|
-
}
|
|
17053
|
-
)
|
|
17054
|
-
]
|
|
17055
|
-
}
|
|
17056
|
-
);
|
|
17057
|
-
};
|
|
17058
|
-
|
|
17059
|
-
// src/searchbar.tsx
|
|
17060
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
17061
|
-
function SearchBar({
|
|
17062
|
-
searchPlaceholder,
|
|
17063
|
-
id
|
|
17064
|
-
}) {
|
|
17065
|
-
const [isFocused, setIsFocused] = (0, import_react3.useState)(false);
|
|
17066
|
-
const inputRef = (0, import_react3.useRef)(null);
|
|
17067
|
-
const [inputPlaceholder, setInputPlaceholder] = (0, import_react3.useState)(searchPlaceholder);
|
|
17068
|
-
(0, import_react3.useEffect)(() => {
|
|
17069
|
-
window["emojipicker-" + id].changeSearchbarPlaceholder = (emoji) => {
|
|
17070
|
-
setInputPlaceholder(emoji);
|
|
17071
|
-
};
|
|
17072
|
-
window["emojipicker-" + id].setSearchValue = (value) => {
|
|
17073
|
-
inputRef.current.value = value;
|
|
17074
|
-
window["emojipicker-" + id].searchValue = value;
|
|
17075
|
-
};
|
|
17076
|
-
}, []);
|
|
17077
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
17078
|
-
"div",
|
|
17079
|
-
{
|
|
17080
|
-
"data-focused": isFocused ? "true" : "false",
|
|
17081
|
-
className: "bg-[#121214] items-center w-full border-1 border-[#323337] p-2 px-3 flex rounded-md data-[focused=true]:border-[#3687E9]",
|
|
17082
|
-
children: [
|
|
17083
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
17084
|
-
"input",
|
|
17085
|
-
{
|
|
17086
|
-
ref: inputRef,
|
|
17087
|
-
onChange: (e) => window["emojipicker-" + id].searchValue = e.target.value,
|
|
17088
|
-
className: "!outline-0 text-lg w-full",
|
|
17089
|
-
onFocus: () => setIsFocused(true),
|
|
17090
|
-
onBlur: () => setIsFocused(false),
|
|
17091
|
-
placeholder: inputPlaceholder
|
|
17092
|
-
}
|
|
17093
|
-
),
|
|
17094
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MagniferLinear, { className: "size-5 opacity-50" })
|
|
17095
|
-
]
|
|
17096
|
-
}
|
|
17097
|
-
);
|
|
17098
|
-
}
|
|
17099
|
-
|
|
17100
|
-
// src/footer.tsx
|
|
17101
|
-
var import_react4 = require("react");
|
|
17102
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
17103
|
-
function Footer({
|
|
17104
|
-
id,
|
|
17105
|
-
firstEmoji
|
|
17106
|
-
}) {
|
|
17107
|
-
const [footerEmoji, setFooterEmoji] = (0, import_react4.useState)(firstEmoji);
|
|
17108
|
-
(0, import_react4.useEffect)(() => {
|
|
17109
|
-
window["emojipicker-" + id].changeFooterEmoji = (emoji) => {
|
|
17110
|
-
setFooterEmoji(emoji);
|
|
17111
|
-
};
|
|
17112
|
-
}, []);
|
|
17113
|
-
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: [
|
|
17114
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
17115
|
-
"div",
|
|
17116
|
-
{
|
|
17117
|
-
className: "*:size-9 *:min-w-9 *:max-w-9",
|
|
17118
|
-
dangerouslySetInnerHTML: { __html: render(footerEmoji.char) }
|
|
17119
|
-
}
|
|
17120
|
-
),
|
|
17121
|
-
/* @__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(" ") })
|
|
17122
|
-
] });
|
|
17123
|
-
}
|
|
17124
|
-
|
|
17125
|
-
// src/sidebarCategory.tsx
|
|
17126
|
-
var import_react5 = require("react");
|
|
17127
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
17128
|
-
function SidebarCategory({
|
|
17129
|
-
categoryName,
|
|
17130
|
-
picker,
|
|
17131
|
-
icon,
|
|
17132
|
-
id
|
|
17133
|
-
}) {
|
|
17134
|
-
const searchValue = useSearchValue({ pickerId: id });
|
|
17135
|
-
const [isActive, setIsActive] = (0, import_react5.useState)(false);
|
|
17136
|
-
(0, import_react5.useEffect)(() => {
|
|
17137
|
-
if ((searchValue || "").length > 0) {
|
|
17138
|
-
setIsActive(false);
|
|
17139
|
-
return;
|
|
17140
|
-
}
|
|
17141
|
-
const elem = picker.current;
|
|
17142
|
-
const updateActive = () => {
|
|
17143
|
-
if (!elem) return;
|
|
17144
|
-
const header = elem.querySelector(
|
|
17145
|
-
".HOKKIEMOJIPICKER-categoryHeader." + categoryName
|
|
17146
|
-
);
|
|
17147
|
-
if (!header) return;
|
|
17148
|
-
const categoryContainer = header.parentElement;
|
|
17149
|
-
const scrollElem = elem.querySelector(
|
|
17150
|
-
".HOKKIEMOJIPICKER-emojidisplay"
|
|
17151
|
-
);
|
|
17152
|
-
if (!scrollElem) return;
|
|
17153
|
-
const containerRect = scrollElem.getBoundingClientRect();
|
|
17154
|
-
const categoryRect = categoryContainer.getBoundingClientRect();
|
|
17155
|
-
const headerHeight = header.offsetHeight;
|
|
17156
|
-
const categoryTop = categoryRect.top - containerRect.top + scrollElem.scrollTop;
|
|
17157
|
-
const categoryBottom = categoryTop + categoryContainer.offsetHeight;
|
|
17158
|
-
const sTop = scrollElem.scrollTop;
|
|
17159
|
-
const inView = sTop >= categoryTop - headerHeight && sTop < categoryBottom - headerHeight;
|
|
17160
|
-
setIsActive(inView);
|
|
17161
|
-
};
|
|
17162
|
-
elem.querySelector(".HOKKIEMOJIPICKER-emojidisplay").addEventListener("scroll", updateActive);
|
|
17163
|
-
updateActive();
|
|
17164
|
-
return () => {
|
|
17165
|
-
elem.querySelector(".HOKKIEMOJIPICKER-emojidisplay").removeEventListener("scroll", updateActive);
|
|
17166
|
-
};
|
|
17167
|
-
}, [picker, searchValue]);
|
|
17168
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
17169
|
-
"button",
|
|
17170
|
-
{
|
|
17171
|
-
onClick: () => {
|
|
17172
|
-
const elem = picker.current;
|
|
17173
|
-
if (!elem) return;
|
|
17174
|
-
const doScroll = () => {
|
|
17175
|
-
const header = elem.querySelector(
|
|
17176
|
-
".HOKKIEMOJIPICKER-categoryHeader." + categoryName
|
|
17177
|
-
);
|
|
17178
|
-
if (!header) return;
|
|
17179
|
-
const categoryContainer = header.parentElement;
|
|
17180
|
-
const scrollElem = elem.querySelector(
|
|
17181
|
-
".HOKKIEMOJIPICKER-emojidisplay"
|
|
17182
|
-
);
|
|
17183
|
-
if (!scrollElem) return;
|
|
17184
|
-
const containerRect = scrollElem.getBoundingClientRect();
|
|
17185
|
-
const categoryRect = categoryContainer.getBoundingClientRect();
|
|
17186
|
-
const headerHeight = header.offsetHeight;
|
|
17187
|
-
const targetTop = categoryRect.top - containerRect.top + scrollElem.scrollTop - headerHeight;
|
|
17188
|
-
scrollElem.scrollTo({
|
|
17189
|
-
top: Math.max(0, targetTop),
|
|
17190
|
-
behavior: "smooth"
|
|
17191
|
-
});
|
|
17192
|
-
};
|
|
17193
|
-
if ((searchValue || "").length > 0) {
|
|
17194
|
-
window["emojipicker-" + id].setSearchValue("");
|
|
17195
|
-
setTimeout(doScroll, 50);
|
|
17196
|
-
} else {
|
|
17197
|
-
doScroll();
|
|
17198
|
-
}
|
|
17199
|
-
},
|
|
17200
|
-
"data-active": isActive ? "true" : "false",
|
|
17201
|
-
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",
|
|
17202
|
-
children: icon
|
|
17203
|
-
}
|
|
17204
|
-
);
|
|
17205
|
-
}
|
|
17206
|
-
|
|
17207
|
-
// src/skinselector.tsx
|
|
17208
|
-
var import_react6 = require("react");
|
|
17209
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
17210
|
-
function SkinSelector({ id }) {
|
|
17211
|
-
const skins = ["\u{1F44F}", "\u{1F44F}\u{1F3FB}", "\u{1F44F}\u{1F3FC}", "\u{1F44F}\u{1F3FD}", "\u{1F44F}\u{1F3FE}", "\u{1F44F}\u{1F3FF}"];
|
|
17212
|
-
const [selectedTone, setSelectedTone] = (0, import_react6.useState)(0);
|
|
17213
|
-
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
17214
|
-
(0, import_react6.useEffect)(() => {
|
|
17215
|
-
setSelectedTone(
|
|
17216
|
-
parseInt(localStorage.getItem("hokkiemojipicker-skin") || "0")
|
|
17217
|
-
);
|
|
17218
|
-
}, []);
|
|
17219
|
-
(0, import_react6.useEffect)(() => {
|
|
17220
|
-
window["emojipicker-" + id].skin = selectedTone;
|
|
17221
|
-
}, [selectedTone]);
|
|
17222
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative mr-1", children: [
|
|
17223
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
17224
|
-
"div",
|
|
17225
|
-
{
|
|
17226
|
-
className: "HOKKIEMOJIPICKER-skinselector-trigger opacity-75 hover:opacity-100 cursor-pointer *:size-7 *:min-w-7",
|
|
17227
|
-
onClick: () => {
|
|
17228
|
-
setOpen(!open);
|
|
17229
|
-
},
|
|
17230
|
-
dangerouslySetInnerHTML: { __html: render(skins[selectedTone]) }
|
|
17231
|
-
}
|
|
17232
|
-
),
|
|
17233
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
17234
|
-
"div",
|
|
17235
|
-
{
|
|
17236
|
-
style: {
|
|
17237
|
-
opacity: open ? 1 : 0,
|
|
17238
|
-
pointerEvents: open ? "all" : "none"
|
|
17239
|
-
},
|
|
17240
|
-
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",
|
|
17241
|
-
children: skins.filter((a) => a !== skins[selectedTone]).map((skin, i) => {
|
|
17242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
17243
|
-
"div",
|
|
17244
|
-
{
|
|
17245
|
-
className: "HOKKIEMOJIPICKER-skinselector-skinoption *:size-7 *:min-w-7 hover:bg-white/5 p-2 transition-all",
|
|
17246
|
-
onClick: () => {
|
|
17247
|
-
setOpen(!open);
|
|
17248
|
-
setSelectedTone(i);
|
|
17249
|
-
localStorage.setItem("hokkiemojipicker-skin", i + "");
|
|
17250
|
-
},
|
|
17251
|
-
dangerouslySetInnerHTML: {
|
|
17252
|
-
__html: render(skin)
|
|
17253
|
-
}
|
|
17254
|
-
}
|
|
17255
|
-
);
|
|
17256
|
-
})
|
|
17257
|
-
}
|
|
17258
|
-
)
|
|
17259
|
-
] });
|
|
17260
|
-
}
|
|
17261
|
-
|
|
17262
|
-
// src/cn.ts
|
|
17263
|
-
var import_clsx = require("clsx");
|
|
17264
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
17265
|
-
var cn = (...inputs) => {
|
|
17266
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
17267
|
-
};
|
|
17268
|
-
|
|
17269
17295
|
// src/index.tsx
|
|
17270
17296
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
17297
|
+
var CategoryDisplay3 = (0, import_react7.lazy)(() => Promise.resolve().then(() => (init_categoryDisplay(), categoryDisplay_exports)));
|
|
17271
17298
|
function EmojiSelector({
|
|
17272
17299
|
categories = {},
|
|
17273
17300
|
customEmojis = {},
|
|
@@ -17286,10 +17313,13 @@ function EmojiSelector({
|
|
|
17286
17313
|
height = 500,
|
|
17287
17314
|
width = 520
|
|
17288
17315
|
}) {
|
|
17289
|
-
|
|
17290
|
-
(
|
|
17291
|
-
"
|
|
17292
|
-
|
|
17316
|
+
const recentlyUsed = (0, import_react7.useMemo)(
|
|
17317
|
+
() => JSON.parse(
|
|
17318
|
+
(localStorage || { getItem: (a) => "[]" }).getItem(
|
|
17319
|
+
"hokkiemojipicker-recentlyused"
|
|
17320
|
+
) || "[]"
|
|
17321
|
+
),
|
|
17322
|
+
[]
|
|
17293
17323
|
);
|
|
17294
17324
|
const categoryData = {
|
|
17295
17325
|
recentlyUsed: recentlyUsed.length > 0 ? {
|
|
@@ -17527,27 +17557,25 @@ function EmojiSelector({
|
|
|
17527
17557
|
...categories.flags
|
|
17528
17558
|
}
|
|
17529
17559
|
};
|
|
17530
|
-
const emojis =
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
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]);
|
|
17543
17575
|
const navHeight = showNav ? Math.floor(height / 7) : 0;
|
|
17544
|
-
const id = (0, import_react7.useMemo)(
|
|
17545
|
-
() => Math.random().toString(36).substring(2, 15),
|
|
17546
|
-
[]
|
|
17547
|
-
);
|
|
17576
|
+
const id = (0, import_react7.useMemo)(() => Math.random().toString(36).substring(2, 15), []);
|
|
17548
17577
|
const picker = (0, import_react7.useRef)(null);
|
|
17549
17578
|
const scrollRef = (0, import_react7.useRef)(null);
|
|
17550
|
-
const [focusIndex, setFocusIndex] = (0, import_react7.useState)(-1);
|
|
17551
17579
|
const handleWheel = (0, import_react7.useCallback)((e) => {
|
|
17552
17580
|
const el = scrollRef.current;
|
|
17553
17581
|
if (!el) return;
|
|
@@ -17562,34 +17590,6 @@ function EmojiSelector({
|
|
|
17562
17590
|
el.removeEventListener("wheel", handleWheel);
|
|
17563
17591
|
};
|
|
17564
17592
|
}, [handleWheel]);
|
|
17565
|
-
const handleKeyDown = (0, import_react7.useCallback)(
|
|
17566
|
-
(e) => {
|
|
17567
|
-
const el = scrollRef.current;
|
|
17568
|
-
if (!el) return;
|
|
17569
|
-
const emojiElements = el.querySelectorAll(
|
|
17570
|
-
".HOKKIEMOJIPICKER-emoji, .HOKKIEMOJIPICKER-skinemoji"
|
|
17571
|
-
);
|
|
17572
|
-
const count = emojiElements.length;
|
|
17573
|
-
if (count === 0) return;
|
|
17574
|
-
if (e.key === "Tab") {
|
|
17575
|
-
e.preventDefault();
|
|
17576
|
-
let next = focusIndex + (e.shiftKey ? -1 : 1);
|
|
17577
|
-
if (next < 0) next = count - 1;
|
|
17578
|
-
if (next >= count) next = 0;
|
|
17579
|
-
setFocusIndex(next);
|
|
17580
|
-
const target = emojiElements[next];
|
|
17581
|
-
if (target) {
|
|
17582
|
-
target.scrollIntoView({ block: "nearest" });
|
|
17583
|
-
target.focus();
|
|
17584
|
-
}
|
|
17585
|
-
} else if (e.key === "Enter" && focusIndex >= 0) {
|
|
17586
|
-
e.preventDefault();
|
|
17587
|
-
const target = emojiElements[focusIndex];
|
|
17588
|
-
if (target) target.click();
|
|
17589
|
-
}
|
|
17590
|
-
},
|
|
17591
|
-
[focusIndex]
|
|
17592
|
-
);
|
|
17593
17593
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "HOKKIEMOJIPICKER-emojiContainer", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
17594
17594
|
"div",
|
|
17595
17595
|
{
|
|
@@ -17658,17 +17658,15 @@ function EmojiSelector({
|
|
|
17658
17658
|
"div",
|
|
17659
17659
|
{
|
|
17660
17660
|
ref: scrollRef,
|
|
17661
|
-
tabIndex: 0,
|
|
17662
|
-
onKeyDown: handleKeyDown,
|
|
17663
17661
|
style: {
|
|
17664
17662
|
flexBasis: "fit-content"
|
|
17665
17663
|
},
|
|
17666
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",
|
|
17667
|
-
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) => {
|
|
17668
17666
|
if (!category) return;
|
|
17669
17667
|
const categoryInfo = categoryData[category.name];
|
|
17670
17668
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
17671
|
-
|
|
17669
|
+
CategoryDisplay3,
|
|
17672
17670
|
{
|
|
17673
17671
|
onEmojiMouseEnter,
|
|
17674
17672
|
onEmojiMouseLeave,
|
|
@@ -17695,7 +17693,7 @@ function EmojiSelector({
|
|
|
17695
17693
|
},
|
|
17696
17694
|
category.name
|
|
17697
17695
|
);
|
|
17698
|
-
})
|
|
17696
|
+
}) })
|
|
17699
17697
|
}
|
|
17700
17698
|
),
|
|
17701
17699
|
showFooter && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Footer, { id, firstEmoji: emojis[0].emojis[0] })
|