emoji-picker-react 5.0.0 → 5.0.2
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/DomUtils/classNames.d.ts +0 -1
- package/dist/DomUtils/keyboardNavigation.d.ts +10 -2
- package/dist/DomUtils/selectors.d.ts +2 -2
- package/dist/data/index.js +1 -1
- package/dist/data/skinToneVariations.js +2 -2
- package/dist/data/skinToneVariations.ts +8 -7
- package/dist/data-core/prepare.d.ts +6 -0
- package/dist/esm/chunks/chunk-56D5WCOZ.mjs +6729 -0
- package/dist/esm/chunks/chunk-7ZGTUZFB.mjs +8021 -12
- package/dist/esm/chunks/chunk-IODYR4CR.mjs +14 -0
- package/dist/esm/chunks/chunk-LO4TPPLH.mjs +32 -42
- package/dist/esm/chunks/chunk-RU7G34WK.mjs +156 -0
- package/dist/esm/chunks/emojis-6L3GRBAP.mjs +5 -7
- package/dist/esm/data.mjs +9 -16
- package/dist/esm/index.mjs +230 -340
- package/dist/esm/primitives/index.mjs +6 -65
- package/dist/hooks/preloadEmoji.d.ts +1 -5
- package/dist/hooks/useCategoryHeight.d.ts +2 -1
- package/dist/hooks/useEmojiVirtualization.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/primitives/index.js +1 -1
- package/dist/virtualization/virtualizationHelpers.d.ts +2 -0
- package/llms-full.txt +9 -3
- package/package.json +2 -2
- package/src/DomUtils/classNames.ts +0 -4
- package/src/DomUtils/elementPositionInRow.ts +2 -2
- package/src/DomUtils/keyboardNavigation.ts +74 -10
- package/src/DomUtils/scrollTo.ts +2 -2
- package/src/DomUtils/selectors.ts +10 -16
- package/src/components/body/EmojiCategory.tsx +1 -1
- package/src/components/body/EmojiList.tsx +54 -23
- package/src/components/context/PickerDataContext.tsx +7 -2
- package/src/components/header/Search/Search.tsx +4 -2
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +7 -6
- package/src/components/main/defaultAppearance.tsx +2 -1
- package/src/config/config.ts +6 -3
- package/src/data/skinToneVariations.ts +8 -7
- package/src/data-core/pickerData.ts +8 -12
- package/src/data-core/prepare.ts +32 -39
- package/src/data-core/search.ts +10 -2
- package/src/dataUtils/emojiSelectors.ts +2 -1
- package/src/dataUtils/parseNativeEmoji.ts +3 -4
- package/src/dataUtils/suggestedEmojis.ts +25 -39
- package/src/hooks/preloadEmoji.ts +13 -52
- package/src/hooks/useActiveCategoryScrollDetection.ts +22 -19
- package/src/hooks/useCategoryHeight.ts +38 -6
- package/src/hooks/useDisallowedEmojis.ts +23 -13
- package/src/hooks/useEmojiVirtualization.tsx +102 -66
- package/src/hooks/useFilter.ts +10 -8
- package/src/hooks/useIsEmojiHidden.ts +16 -12
- package/src/hooks/useKeyboardNavigation.ts +104 -17
- package/src/primitives/structuralStyles.tsx +3 -0
- package/src/primitives/tokens.ts +1 -0
- package/src/virtualization/virtualizationHelpers.ts +9 -2
- package/dist/esm/chunks/chunk-46BUDQLE.mjs +0 -228
- package/dist/esm/chunks/chunk-FQIJ4HBW.mjs +0 -25
- package/dist/esm/chunks/chunk-KQPOIRSC.mjs +0 -9305
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { init_defaultEmojiData, registerDefaultEmojiData } from "./chunk-RU7G34WK.mjs";
|
|
2
|
+
|
|
3
|
+
import { emojis_default, init_emojis } from "./chunk-7ZGTUZFB.mjs";
|
|
4
|
+
|
|
5
|
+
import { __commonJS } from "./chunk-LO4TPPLH.mjs";
|
|
6
|
+
|
|
7
|
+
// src/data/registerDefaultEmojiData.ts
|
|
8
|
+
var require_registerDefaultEmojiData = __commonJS({
|
|
9
|
+
"src/data/registerDefaultEmojiData.ts"() {
|
|
10
|
+
init_defaultEmojiData(), init_emojis(), registerDefaultEmojiData(emojis_default);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { require_registerDefaultEmojiData };
|
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
var __create = Object.create
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
-
mod
|
|
37
|
-
));
|
|
1
|
+
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __esm = (fn, res, err) => function __init() {
|
|
2
|
+
if (err) throw err[0];
|
|
3
|
+
try {
|
|
4
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
+
} catch (e) {
|
|
6
|
+
throw err = [ e ], e;
|
|
7
|
+
}
|
|
8
|
+
}, __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
try {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
|
|
11
|
+
exports: {}
|
|
12
|
+
}).exports, mod), mod.exports;
|
|
13
|
+
} catch (e) {
|
|
14
|
+
throw mod = 0, e;
|
|
15
|
+
}
|
|
16
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && "object" == typeof from || "function" == typeof from) for (let key of __getOwnPropNames(from)) __hasOwnProp.call(to, key) || key === except || __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
return to;
|
|
22
|
+
}, __toESM = (mod, isNodeMode, target) => (target = null != mod ? __create(__getProtoOf(mod)) : {},
|
|
23
|
+
__copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
!isNodeMode && mod && mod.__esModule ? target : __defProp(target, "default", {
|
|
29
|
+
value: mod,
|
|
30
|
+
enumerable: !0
|
|
31
|
+
}), mod));
|
|
38
32
|
|
|
39
|
-
export {
|
|
40
|
-
__esm,
|
|
41
|
-
__commonJS,
|
|
42
|
-
__toESM
|
|
43
|
-
};
|
|
33
|
+
export { __esm, __commonJS, __toESM };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { __esm } from "./chunk-LO4TPPLH.mjs";
|
|
2
|
+
|
|
3
|
+
// src/data/defaultEmojiData.ts
|
|
4
|
+
function registerDefaultEmojiData(data) {
|
|
5
|
+
registered = data;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function getRegisteredDefaultEmojiData() {
|
|
9
|
+
return registered;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function defaultEmojiDataOrEmpty() {
|
|
13
|
+
return registered ?? EMPTY_EMOJI_DATA;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function loadDefaultEmojiData() {
|
|
17
|
+
return registered ? Promise.resolve(registered) : (pending || (pending = import("./emojis-6L3GRBAP.mjs").then((module => {
|
|
18
|
+
const data = module.default ?? module;
|
|
19
|
+
return registered = registered ?? data;
|
|
20
|
+
})).catch((error => {
|
|
21
|
+
throw pending = null, error;
|
|
22
|
+
}))), pending);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var registered, EMPTY_EMOJI_DATA, pending, init_defaultEmojiData = __esm({
|
|
26
|
+
"src/data/defaultEmojiData.ts"() {
|
|
27
|
+
registered = null, EMPTY_EMOJI_DATA = Object.freeze({
|
|
28
|
+
categories: {},
|
|
29
|
+
emojis: {}
|
|
30
|
+
}), pending = null;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// src/dataUtils/parseNativeEmoji.ts
|
|
35
|
+
function parseNativeEmoji(unified) {
|
|
36
|
+
return String.fromCodePoint(...unified.split("-").map((hex => parseInt(hex, 16))));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/data-core/prepare.ts
|
|
40
|
+
// src/data-core/prepare.ts
|
|
41
|
+
init_defaultEmojiData();
|
|
42
|
+
|
|
43
|
+
var coreCache = /* @__PURE__ */ new WeakMap, prepareCount = 0;
|
|
44
|
+
|
|
45
|
+
function normalizeUnified(input) {
|
|
46
|
+
return input.trim().toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function withoutFe0f(unified) {
|
|
50
|
+
return unified.replace(/-fe0f/g, "");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function normalizeQuery(input) {
|
|
54
|
+
return input && "string" == typeof input ? input.trim().toLowerCase() : "";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function readStringArray(raw) {
|
|
58
|
+
return Array.isArray(raw) ? raw.filter((value => "string" == typeof value)).map((value => value.toLowerCase())) : [];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function appendEntry(byUnified, byCharMutable, records, entry) {
|
|
62
|
+
const rawUnified = entry.u;
|
|
63
|
+
if ("string" != typeof rawUnified || 0 === rawUnified.length) return;
|
|
64
|
+
const unified = rawUnified.toLowerCase();
|
|
65
|
+
if (byUnified.has(unified)) return;
|
|
66
|
+
const names = readStringArray(entry.n), variations = readStringArray(entry.v), addedIn = String(entry.a ?? ""), info = Object.freeze({
|
|
67
|
+
unified,
|
|
68
|
+
emoji: parseNativeEmoji(unified),
|
|
69
|
+
name: names[names.length - 1] || "",
|
|
70
|
+
names: Object.freeze(names),
|
|
71
|
+
variations: Object.freeze(variations),
|
|
72
|
+
addedIn
|
|
73
|
+
});
|
|
74
|
+
records.push(info), byUnified.set(unified, info);
|
|
75
|
+
for (const id of [ unified, ...info.variations ]) byUnified.has(id) || byUnified.set(id, info),
|
|
76
|
+
byUnified.has(withoutFe0f(id)) || byUnified.set(withoutFe0f(id), info);
|
|
77
|
+
indexCharBucket(byCharMutable, names, info);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function indexCharBucket(byCharMutable, names, info) {
|
|
81
|
+
for (const char of names.join("")) {
|
|
82
|
+
const bucket = byCharMutable.get(char);
|
|
83
|
+
bucket ? bucket[bucket.length - 1] !== info && bucket.push(info) : byCharMutable.set(char, [ info ]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getPreparedCore(emojiData) {
|
|
88
|
+
const source = emojiData ?? defaultEmojiDataOrEmpty(), cached = coreCache.get(source);
|
|
89
|
+
if (cached) return cached;
|
|
90
|
+
prepareCount += 1;
|
|
91
|
+
const byUnified = /* @__PURE__ */ new Map, byCharMutable = /* @__PURE__ */ new Map, records = [], groups = source.emojis ?? {};
|
|
92
|
+
for (const key of Object.keys(groups)) {
|
|
93
|
+
const list = groups[key] ?? [];
|
|
94
|
+
for (const entry of list) appendEntry(byUnified, byCharMutable, records, entry);
|
|
95
|
+
}
|
|
96
|
+
byCharMutable.forEach(Object.freeze);
|
|
97
|
+
const core = {
|
|
98
|
+
records,
|
|
99
|
+
byUnified,
|
|
100
|
+
byChar: byCharMutable,
|
|
101
|
+
queryMemo: /* @__PURE__ */ new Map
|
|
102
|
+
};
|
|
103
|
+
return coreCache.set(source, core), core;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/data-core/search.ts
|
|
107
|
+
var EMPTY_RESULTS = Object.freeze([]), MAX_QUERY_MEMO_SIZE = 500;
|
|
108
|
+
|
|
109
|
+
function memoizeQuery(core, normalized, results) {
|
|
110
|
+
const memo = core.queryMemo;
|
|
111
|
+
if (memo.has(normalized)) memo.delete(normalized); else if (memo.size >= MAX_QUERY_MEMO_SIZE) {
|
|
112
|
+
const oldest = memo.keys().next();
|
|
113
|
+
oldest.done || memo.delete(oldest.value);
|
|
114
|
+
}
|
|
115
|
+
memo.set(normalized, results);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function smallestCandidateBucket(core, normalized) {
|
|
119
|
+
let smallest = core.records;
|
|
120
|
+
for (const char of Array.from(normalized)) {
|
|
121
|
+
const bucket = core.byChar.get(char);
|
|
122
|
+
if (!bucket) return EMPTY_RESULTS;
|
|
123
|
+
bucket.length < smallest.length && (smallest = bucket);
|
|
124
|
+
}
|
|
125
|
+
return smallest;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function getEmojiByUnified(unified, options) {
|
|
129
|
+
if (!unified || "string" != typeof unified) return;
|
|
130
|
+
const normalized = normalizeUnified(unified);
|
|
131
|
+
if (!normalized) return;
|
|
132
|
+
const core = getPreparedCore(options?.emojiData);
|
|
133
|
+
return core.byUnified.get(normalized) ?? core.byUnified.get(withoutFe0f(normalized));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function searchEmojis(query, options) {
|
|
137
|
+
const normalized = normalizeQuery(query);
|
|
138
|
+
if (!normalized) return EMPTY_RESULTS;
|
|
139
|
+
const core = getPreparedCore(options?.emojiData), memoized = core.queryMemo.get(normalized);
|
|
140
|
+
if (memoized) return memoizeQuery(core, normalized, memoized), Object.freeze([ ...memoized ]);
|
|
141
|
+
if (1 === normalized.length) {
|
|
142
|
+
const bucket = core.byChar.get(normalized) ?? EMPTY_RESULTS;
|
|
143
|
+
return memoizeQuery(core, normalized, bucket), Object.freeze([ ...bucket ]);
|
|
144
|
+
}
|
|
145
|
+
const matches = [];
|
|
146
|
+
for (const record of smallestCandidateBucket(core, normalized)) {
|
|
147
|
+
const names = record.names;
|
|
148
|
+
for (let i = 0; i < names.length; i += 1) if (names[i].includes(normalized)) {
|
|
149
|
+
matches.push(record);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return memoizeQuery(core, normalized, matches), Object.freeze([ ...matches ]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { registerDefaultEmojiData, getRegisteredDefaultEmojiData, EMPTY_EMOJI_DATA, defaultEmojiDataOrEmpty, loadDefaultEmojiData, init_defaultEmojiData, parseNativeEmoji, withoutFe0f, normalizeQuery, getPreparedCore, getEmojiByUnified, searchEmojis };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
init_emojis
|
|
4
|
-
} from "./chunk-7ZGTUZFB.mjs";
|
|
1
|
+
import { emojis_default, init_emojis } from "./chunk-7ZGTUZFB.mjs";
|
|
2
|
+
|
|
5
3
|
import "./chunk-LO4TPPLH.mjs";
|
|
4
|
+
|
|
6
5
|
init_emojis();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
6
|
+
|
|
7
|
+
export { emojis_default as default };
|
package/dist/esm/data.mjs
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunks/chunk-
|
|
4
|
-
|
|
5
|
-
getEmojiByUnified,
|
|
6
|
-
searchEmojis
|
|
7
|
-
} from "./chunks/chunk-46BUDQLE.mjs";
|
|
1
|
+
import { require_registerDefaultEmojiData } from "./chunks/chunk-IODYR4CR.mjs";
|
|
2
|
+
|
|
3
|
+
import { getEmojiByUnified, searchEmojis } from "./chunks/chunk-RU7G34WK.mjs";
|
|
4
|
+
|
|
8
5
|
import "./chunks/chunk-7ZGTUZFB.mjs";
|
|
9
|
-
import {
|
|
10
|
-
__toESM
|
|
11
|
-
} from "./chunks/chunk-LO4TPPLH.mjs";
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
7
|
+
import { __toESM } from "./chunks/chunk-LO4TPPLH.mjs";
|
|
8
|
+
|
|
9
|
+
__toESM(require_registerDefaultEmojiData());
|
|
10
|
+
|
|
11
|
+
export { getEmojiByUnified, searchEmojis };
|