@portabletext/plugin-emoji-picker 3.0.23 → 3.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/plugin-emoji-picker",
3
- "version": "3.0.23",
3
+ "version": "3.0.24",
4
4
  "description": "Easily configure an Emoji Picker for the Portable Text Editor",
5
5
  "keywords": [
6
6
  "portabletext",
@@ -30,15 +30,14 @@
30
30
  "main": "./dist/index.js",
31
31
  "types": "./dist/index.d.ts",
32
32
  "files": [
33
- "dist",
34
- "src"
33
+ "dist"
35
34
  ],
36
35
  "dependencies": {
37
36
  "@xstate/react": "^6.0.0",
38
37
  "react-compiler-runtime": "^1.0.0",
39
38
  "xstate": "^5.24.0",
40
- "@portabletext/keyboard-shortcuts": "^2.1.0",
41
- "@portabletext/plugin-input-rule": "^1.0.23"
39
+ "@portabletext/keyboard-shortcuts": "^2.1.1",
40
+ "@portabletext/plugin-input-rule": "^1.0.24"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@sanity/pkg-utils": "^10.1.1",
@@ -55,12 +54,12 @@
55
54
  "typescript": "5.9.3",
56
55
  "typescript-eslint": "^8.48.0",
57
56
  "vitest": "^4.0.14",
58
- "@portabletext/editor": "3.3.3",
59
- "@portabletext/schema": "2.0.0",
60
- "racejar": "2.0.0"
57
+ "@portabletext/editor": "3.3.4",
58
+ "@portabletext/schema": "2.0.1",
59
+ "racejar": "2.0.1"
61
60
  },
62
61
  "peerDependencies": {
63
- "@portabletext/editor": "^3.3.3",
62
+ "@portabletext/editor": "^3.3.4",
64
63
  "react": "^18.3 || ^19"
65
64
  },
66
65
  "engines": {
@@ -1,105 +0,0 @@
1
- import type {MatchEmojis} from './match-emojis'
2
-
3
- /**
4
- * Proposed, but not required type, to represent an emoji match.
5
- *
6
- * @example
7
- * ```tsx
8
- * {
9
- * type: 'exact',
10
- * key: '😂-joy',
11
- * emoji: '😂',
12
- * keyword: 'joy',
13
- * }
14
- * ```
15
- * @example
16
- * ```tsx
17
- * {
18
- * type: 'partial',
19
- * key: '😹-joy-_cat',
20
- * emoji: '😹',
21
- * keyword: 'joy',
22
- * startSlice: '',
23
- * endSlice: '_cat',
24
- * }
25
- * ```
26
- *
27
- * @beta
28
- */
29
- export type EmojiMatch =
30
- | {
31
- type: 'exact'
32
- key: string
33
- emoji: string
34
- keyword: string
35
- }
36
- | {
37
- type: 'partial'
38
- key: string
39
- emoji: string
40
- keyword: string
41
- startSlice: string
42
- endSlice: string
43
- }
44
-
45
- /**
46
- * Proposed, but not required, function to create a `MatchEmojis` function.
47
- *
48
- * @example
49
- * ```ts
50
- * const matchEmojis = createMatchEmojis({
51
- * emojis: {
52
- * '😂': ['joy'],
53
- * '😹': ['joy_cat'],
54
- * },
55
- * })
56
- * ```
57
- *
58
- * @beta
59
- */
60
- export function createMatchEmojis(config: {
61
- emojis: Record<string, ReadonlyArray<string>>
62
- }): MatchEmojis<EmojiMatch> {
63
- return ({keyword}: {keyword: string}) => {
64
- const foundEmojis: Array<EmojiMatch> = []
65
-
66
- if (keyword.length < 1) {
67
- return foundEmojis
68
- }
69
-
70
- for (const emoji in config.emojis) {
71
- const emojiKeywords = config.emojis[emoji] ?? []
72
-
73
- for (const emojiKeyword of emojiKeywords) {
74
- const keywordIndex = emojiKeyword.indexOf(keyword)
75
-
76
- if (keywordIndex === -1) {
77
- continue
78
- }
79
-
80
- if (emojiKeyword === keyword) {
81
- foundEmojis.push({
82
- type: 'exact',
83
- key: `${emoji}-${keyword}`,
84
- emoji,
85
- keyword,
86
- })
87
- } else {
88
- const start = emojiKeyword.slice(0, keywordIndex)
89
- const end = emojiKeyword.slice(keywordIndex + keyword.length)
90
-
91
- foundEmojis.push({
92
- type: 'partial',
93
- key: `${emoji}-${start}${keyword}${end}`,
94
- emoji,
95
- keyword,
96
- startSlice: start,
97
- endSlice: end,
98
- })
99
- }
100
- }
101
- }
102
-
103
- return foundEmojis
104
- }
105
- }