@oiij/emoji-picker 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -17
- package/dist/{index.d.cts → index.d.mts} +4 -4
- package/dist/{index.js → index.mjs} +8 -9
- package/package.json +8 -15
- package/dist/index.cjs +0 -94
- package/dist/index.d.ts +0 -55
package/LICENSE
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright © 2025 [OIIJ](https://github.com/oiij)
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
11
6
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
14
8
|
|
|
15
|
-
THE SOFTWARE IS PROVIDED
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as vue0 from "vue";
|
|
2
|
-
import { ComputedRef } from "vue";
|
|
3
1
|
import { Picker } from "emoji-mart";
|
|
2
|
+
import * as vue0 from "vue";
|
|
3
|
+
import { ComputedRef, TemplateRef } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
interface EmojiResult {
|
|
@@ -45,8 +45,8 @@ interface EmojiPickerOptions {
|
|
|
45
45
|
theme?: 'auto' | 'light' | 'dark';
|
|
46
46
|
getSpritesheetURL?: string;
|
|
47
47
|
}
|
|
48
|
-
declare function useEmojiPicker(darkMode?: ComputedRef<boolean>, language?: ComputedRef<'zh' | 'en'>, options?: EmojiPickerOptions): {
|
|
49
|
-
|
|
48
|
+
declare function useEmojiPicker(templateRef: TemplateRef<HTMLElement>, darkMode?: ComputedRef<boolean>, language?: ComputedRef<'zh' | 'en'>, options?: EmojiPickerOptions): {
|
|
49
|
+
templateRef: Readonly<vue0.ShallowRef<HTMLElement | null>>;
|
|
50
50
|
emojiPicker: vue0.ShallowRef<Picker | null, Picker | null>;
|
|
51
51
|
onRender: (fn: (editor: Picker) => void) => void;
|
|
52
52
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import data from "@emoji-mart/data";
|
|
2
2
|
import { Picker } from "emoji-mart";
|
|
3
|
-
import { onMounted, onUnmounted,
|
|
3
|
+
import { onMounted, onUnmounted, shallowRef, watch } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/index.ts
|
|
6
|
-
function useEmojiPicker(darkMode, language, options) {
|
|
6
|
+
function useEmojiPicker(templateRef, darkMode, language, options) {
|
|
7
7
|
const _options = {
|
|
8
8
|
data,
|
|
9
9
|
emojiButtonRadius: "6px",
|
|
@@ -19,24 +19,23 @@ function useEmojiPicker(darkMode, language, options) {
|
|
|
19
19
|
locale: language?.value,
|
|
20
20
|
...options
|
|
21
21
|
};
|
|
22
|
-
const domRef = ref();
|
|
23
22
|
const emojiPicker = shallowRef(null);
|
|
24
23
|
let onRender = null;
|
|
25
24
|
function render() {
|
|
26
|
-
if (
|
|
25
|
+
if (templateRef.value && !emojiPicker.value) {
|
|
27
26
|
emojiPicker.value = new Picker({
|
|
28
|
-
parent:
|
|
27
|
+
parent: templateRef.value,
|
|
29
28
|
..._options
|
|
30
29
|
});
|
|
31
30
|
if (typeof onRender === "function") onRender(emojiPicker.value);
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
function destroy() {
|
|
35
|
-
if (!
|
|
36
|
-
|
|
34
|
+
if (!templateRef.value) return;
|
|
35
|
+
templateRef.value.innerHTML = "";
|
|
37
36
|
emojiPicker.value = null;
|
|
38
37
|
}
|
|
39
|
-
watch(
|
|
38
|
+
watch(templateRef, () => {
|
|
40
39
|
render();
|
|
41
40
|
});
|
|
42
41
|
watch(() => darkMode?.value, (v) => {
|
|
@@ -56,7 +55,7 @@ function useEmojiPicker(darkMode, language, options) {
|
|
|
56
55
|
destroy();
|
|
57
56
|
});
|
|
58
57
|
return {
|
|
59
|
-
|
|
58
|
+
templateRef,
|
|
60
59
|
emojiPicker,
|
|
61
60
|
onRender: (fn) => {
|
|
62
61
|
onRender = fn;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oiij/emoji-picker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"description": "A Vue Composable for emoji-picker",
|
|
6
6
|
"author": "oiij",
|
|
7
7
|
"license": "MIT",
|
|
@@ -15,16 +15,9 @@
|
|
|
15
15
|
"@oiij/use"
|
|
16
16
|
],
|
|
17
17
|
"sideEffects": false,
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"import": "./dist/index.js",
|
|
22
|
-
"require": "./dist/index.cjs"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"main": "./dist/index.js",
|
|
26
|
-
"module": "./dist/index.js",
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
18
|
+
"main": "./dist/index.mjs",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
28
21
|
"files": [
|
|
29
22
|
"LICENSE",
|
|
30
23
|
"README.md",
|
|
@@ -33,15 +26,15 @@
|
|
|
33
26
|
],
|
|
34
27
|
"peerDependencies": {
|
|
35
28
|
"@emoji-mart/data": "^1.2.1",
|
|
36
|
-
"@vueuse/core": "^14.
|
|
29
|
+
"@vueuse/core": "^14.1.0",
|
|
37
30
|
"emoji-mart": "^5.6.0",
|
|
38
|
-
"vue": "^3.5.
|
|
31
|
+
"vue": "^3.5.25"
|
|
39
32
|
},
|
|
40
33
|
"devDependencies": {
|
|
41
34
|
"@emoji-mart/data": "^1.2.1",
|
|
42
|
-
"@vueuse/core": "^14.
|
|
35
|
+
"@vueuse/core": "^14.1.0",
|
|
43
36
|
"emoji-mart": "^5.6.0",
|
|
44
|
-
"vue": "^3.5.
|
|
37
|
+
"vue": "^3.5.25"
|
|
45
38
|
},
|
|
46
39
|
"publishConfig": {
|
|
47
40
|
"access": "public"
|
package/dist/index.cjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
let __emoji_mart_data = require("@emoji-mart/data");
|
|
25
|
-
__emoji_mart_data = __toESM(__emoji_mart_data);
|
|
26
|
-
let emoji_mart = require("emoji-mart");
|
|
27
|
-
emoji_mart = __toESM(emoji_mart);
|
|
28
|
-
let vue = require("vue");
|
|
29
|
-
vue = __toESM(vue);
|
|
30
|
-
|
|
31
|
-
//#region src/index.ts
|
|
32
|
-
function useEmojiPicker(darkMode, language, options) {
|
|
33
|
-
const _options = {
|
|
34
|
-
data: __emoji_mart_data.default,
|
|
35
|
-
emojiButtonRadius: "6px",
|
|
36
|
-
emojiButtonColors: [
|
|
37
|
-
"rgba(155,223,88,.7)",
|
|
38
|
-
"rgba(149,211,254,.7)",
|
|
39
|
-
"rgba(247,233,34,.7)",
|
|
40
|
-
"rgba(238,166,252,.7)",
|
|
41
|
-
"rgba(255,213,143,.7)",
|
|
42
|
-
"rgba(211,209,255,.7)"
|
|
43
|
-
],
|
|
44
|
-
theme: darkMode?.value ? "dark" : "light",
|
|
45
|
-
locale: language?.value,
|
|
46
|
-
...options
|
|
47
|
-
};
|
|
48
|
-
const domRef = (0, vue.ref)();
|
|
49
|
-
const emojiPicker = (0, vue.shallowRef)(null);
|
|
50
|
-
let onRender = null;
|
|
51
|
-
function render() {
|
|
52
|
-
if (domRef.value && !emojiPicker.value) {
|
|
53
|
-
emojiPicker.value = new emoji_mart.Picker({
|
|
54
|
-
parent: domRef.value,
|
|
55
|
-
..._options
|
|
56
|
-
});
|
|
57
|
-
if (typeof onRender === "function") onRender(emojiPicker.value);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function destroy() {
|
|
61
|
-
if (!domRef.value) return;
|
|
62
|
-
domRef.value.innerHTML = "";
|
|
63
|
-
emojiPicker.value = null;
|
|
64
|
-
}
|
|
65
|
-
(0, vue.watch)(domRef, () => {
|
|
66
|
-
render();
|
|
67
|
-
});
|
|
68
|
-
(0, vue.watch)(() => darkMode?.value, (v) => {
|
|
69
|
-
destroy();
|
|
70
|
-
_options.theme = v ? "dark" : "light";
|
|
71
|
-
render();
|
|
72
|
-
});
|
|
73
|
-
(0, vue.watch)(() => language?.value, (v) => {
|
|
74
|
-
destroy();
|
|
75
|
-
_options.locale = v ?? "zh";
|
|
76
|
-
render();
|
|
77
|
-
});
|
|
78
|
-
(0, vue.onMounted)(() => {
|
|
79
|
-
render();
|
|
80
|
-
});
|
|
81
|
-
(0, vue.onUnmounted)(() => {
|
|
82
|
-
destroy();
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
domRef,
|
|
86
|
-
emojiPicker,
|
|
87
|
-
onRender: (fn) => {
|
|
88
|
-
onRender = fn;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
exports.useEmojiPicker = useEmojiPicker;
|
package/dist/index.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Picker } from "emoji-mart";
|
|
2
|
-
import * as vue0 from "vue";
|
|
3
|
-
import { ComputedRef } from "vue";
|
|
4
|
-
|
|
5
|
-
//#region src/index.d.ts
|
|
6
|
-
interface EmojiResult {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
native: string;
|
|
10
|
-
unified: string;
|
|
11
|
-
keywords: string[];
|
|
12
|
-
shortcodes: string;
|
|
13
|
-
}
|
|
14
|
-
interface EmojiPickerOptions {
|
|
15
|
-
parent?: HTMLElement;
|
|
16
|
-
data?: object;
|
|
17
|
-
i18n?: object;
|
|
18
|
-
categories?: ('frequent' | 'people' | 'nature' | 'food' | 'activity' | 'places' | 'objects' | 'symbols' | 'flags')[];
|
|
19
|
-
custom?: [];
|
|
20
|
-
onEmojiSelect?: (emoji: EmojiResult) => void;
|
|
21
|
-
onClickOutside?: () => void;
|
|
22
|
-
onAddCustomEmoji?: (emoji: EmojiResult) => void;
|
|
23
|
-
autoFocus?: boolean;
|
|
24
|
-
categoryIcons?: object;
|
|
25
|
-
dynamicWidth?: boolean;
|
|
26
|
-
emojiButtonColors?: string[];
|
|
27
|
-
emojiButtonRadius?: string;
|
|
28
|
-
emojiButtonSize?: number;
|
|
29
|
-
emojiSize?: number;
|
|
30
|
-
emojiVersion?: 1 | 2 | 3 | 4 | 5 | 11 | 12 | 12.1 | 13 | 13.1 | 14 | 15;
|
|
31
|
-
exceptEmojis?: [];
|
|
32
|
-
icons?: 'aut' | 'outline' | 'solid';
|
|
33
|
-
locale?: 'en' | 'ar' | 'be' | 'cs' | 'de' | 'es' | 'fa' | 'fi' | 'fr' | 'hi' | 'it' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'ru' | 'sa' | 'tr' | 'uk' | 'vi' | 'zh';
|
|
34
|
-
maxFrequentRows?: number;
|
|
35
|
-
navPosition?: 'top' | 'bottom' | 'none';
|
|
36
|
-
noCountryFlags?: boolean;
|
|
37
|
-
noResultsEmoji?: string;
|
|
38
|
-
perLine?: number;
|
|
39
|
-
previewEmoji?: 'point_up' | 'point_down';
|
|
40
|
-
previewPosition?: 'top' | 'bottom' | 'none';
|
|
41
|
-
searchPosition?: 'sticky' | 'static' | 'none';
|
|
42
|
-
set?: 'native' | 'apple' | 'facebook' | 'google' | 'twitter';
|
|
43
|
-
skin?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
44
|
-
skinTonePosition?: 'preview' | 'search' | 'none';
|
|
45
|
-
theme?: 'auto' | 'light' | 'dark';
|
|
46
|
-
getSpritesheetURL?: string;
|
|
47
|
-
}
|
|
48
|
-
declare function useEmojiPicker(darkMode?: ComputedRef<boolean>, language?: ComputedRef<'zh' | 'en'>, options?: EmojiPickerOptions): {
|
|
49
|
-
domRef: vue0.Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
50
|
-
emojiPicker: vue0.ShallowRef<Picker | null, Picker | null>;
|
|
51
|
-
onRender: (fn: (editor: Picker) => void) => void;
|
|
52
|
-
};
|
|
53
|
-
type EmojiPickerReturns = ReturnType<typeof useEmojiPicker>;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { EmojiPickerOptions, EmojiPickerReturns, EmojiResult, useEmojiPicker };
|