This commit is contained in:
Seaswimmer 2024-10-20 18:22:14 +00:00
commit 2ec19c365d
3 changed files with 53 additions and 0 deletions

20
gauntlet.toml Normal file
View file

@ -0,0 +1,20 @@
[gauntlet]
name = "cswimr's Gauntlet Plugins"
description = """
Collection of Gauntlet plugins by cswimr
Repository: https://www.coastalcommits.com/cswimr/gauntlet-emojipicker
"""
[[entrypoint]]
id = 'emojipicker'
name = 'Emoji Picker'
path = 'src/emojipicker.tsx'
type = 'inline-view'
description = """
Copy emojis to your clipboard from Gauntlet!
"""
[permissions]
main_search_bar = ["read"]
clipboard = ["write"]

25
js/emojipicker.js Normal file
View file

@ -0,0 +1,25 @@
import { jsxs, jsx } from 'react/jsx-runtime';
import { Inline, ActionPanel, Action, Content, Icons } from '@project-gauntlet/api/components';
import { Clipboard, showHud } from '@project-gauntlet/api/helpers';
import { g as getEmojis } from './vendor.js';
// @ts-expect-error
Deno[Deno.internal].core;
function EmojiPicker(props) {
const text = props.text.trim();
if (text.length < 3) {
return undefined;
}
const emoji = getEmojis().find(emoji => emoji.keywords.includes(text));
if (!emoji) {
return undefined;
}
return (jsxs(Inline, { actions: jsx(ActionPanel, { children: jsx(Action, { label: `Copy ${emoji.emoji} to clipboard`, onAction: async () => {
console.log(emoji.emoji);
await Clipboard.writeText(emoji.emoji);
showHud(`${emoji.emoji} copied to clipboard`);
} }) }), children: [jsx(Inline.Left, { children: jsx(Content.H3, { children: text }) }), jsx(Inline.Separator, { icon: Icons.ArrowRight }), jsx(Inline.Right, { children: jsx(Content.H3, { children: emoji.emoji }) })] }));
}
export { EmojiPicker as default };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXIuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9

8
js/vendor.js Normal file

File diff suppressed because one or more lines are too long