Compare commits
No commits in common. "gauntlet/release" and "main" have entirely different histories.
gauntlet/r
...
main
22 changed files with 6830 additions and 106 deletions
10
.envrc
Normal file
10
.envrc
Normal file
|
@ -0,0 +1,10 @@
|
|||
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
||||
fi
|
||||
|
||||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
if ! use flake . --no-pure-eval
|
||||
then
|
||||
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
|
||||
fi
|
28
.forgejo/workflows/actions.yaml
Normal file
28
.forgejo/workflows/actions.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: Actions
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- '!gauntlet/release'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Plugins
|
||||
runs-on: docker
|
||||
container: www.coastalcommits.com/cswimr/actions:yarn@sha256:3af293679759bde9009ada9849f59b5b8a4c4b085710d6fafa9f88a60d2cd6f5
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Build plugins
|
||||
run: yarn run build
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3
|
||||
with:
|
||||
name: plugins-build
|
||||
path: dist/
|
33
.forgejo/workflows/publish.yaml
Normal file
33
.forgejo/workflows/publish.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
name: Publish Plugins to Release Branch
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish plugins
|
||||
runs-on: docker
|
||||
container: www.coastalcommits.com/cswimr/actions:yarn@sha256:3af293679759bde9009ada9849f59b5b8a4c4b085710d6fafa9f88a60d2cd6f5
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- name: Set up SSH key
|
||||
uses: actions/ssh-agent@forgejo
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
|
||||
instance-urls: "www.coastalcommits.com"
|
||||
- name: Add instance URLs to known_hosts
|
||||
run: ssh-keyscan -H www.coastalcommits.com >> ~/.ssh/known_hosts
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'yarn'
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR}@noreply@coastalcommits.com"
|
||||
git remote set-url origin git@www.coastalcommits.com:${{ github.repository }}
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Publish plugins to Release branch
|
||||
run: yarn run publish
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.devenv/
|
||||
.direnv/
|
||||
dist
|
||||
node_modules
|
||||
.idea
|
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["dbaeumer.vscode-eslint"]
|
||||
}
|
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
||||
"eslint.format.enable": true,
|
||||
"eslint.codeActionsOnSave.mode": "problems",
|
||||
"eslint.options": {
|
||||
"overrideConfigFile": "eslint.config.mjs"
|
||||
}
|
||||
}
|
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
|
@ -0,0 +1 @@
|
|||
* @cswimr
|
9
LICENSE
Normal file
9
LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
|||
# The MIT License (MIT)
|
||||
|
||||
Copyright © 2024 cswimr
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
15
eslint.config.mjs
Normal file
15
eslint.config.mjs
Normal file
|
@ -0,0 +1,15 @@
|
|||
import pluginJs from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import pluginReact from "eslint-plugin-react";
|
||||
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
||||
|
||||
/** @type {import('eslint').Linter.Config[]} */
|
||||
export default [
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
|
||||
},
|
||||
pluginJs.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
pluginReact.configs.flat.recommended,
|
||||
pluginPrettierRecommended,
|
||||
];
|
265
flake.lock
generated
Normal file
265
flake.lock
generated
Normal file
|
@ -0,0 +1,265 @@
|
|||
{
|
||||
"nodes": {
|
||||
"cachix": {
|
||||
"inputs": {
|
||||
"devenv": [
|
||||
"devenv"
|
||||
],
|
||||
"flake-compat": [
|
||||
"devenv"
|
||||
],
|
||||
"git-hooks": [
|
||||
"devenv"
|
||||
],
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1728672398,
|
||||
"narHash": "sha256-KxuGSoVUFnQLB2ZcYODW7AVPAh9JqRlD5BrfsC/Q4qs=",
|
||||
"owner": "cachix",
|
||||
"repo": "cachix",
|
||||
"rev": "aac51f698309fd0f381149214b7eee213c66ef0a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "latest",
|
||||
"repo": "cachix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devenv": {
|
||||
"inputs": {
|
||||
"cachix": "cachix",
|
||||
"flake-compat": "flake-compat",
|
||||
"git-hooks": "git-hooks",
|
||||
"nix": "nix",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1734605856,
|
||||
"narHash": "sha256-RfNqLS5f9s3aiRZIOjSbM8Vz7x2dT/7zwJhyt9TLEmE=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "f81cf7dc4cbfa46de11618af94e5983c5e600d8c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"devenv",
|
||||
"nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"devenv"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": [
|
||||
"devenv"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730302582,
|
||||
"narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"libgit2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1697646580,
|
||||
"narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=",
|
||||
"owner": "libgit2",
|
||||
"repo": "libgit2",
|
||||
"rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "libgit2",
|
||||
"repo": "libgit2",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"devenv"
|
||||
],
|
||||
"flake-parts": "flake-parts",
|
||||
"libgit2": "libgit2",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-23-11": [
|
||||
"devenv"
|
||||
],
|
||||
"nixpkgs-regression": [
|
||||
"devenv"
|
||||
],
|
||||
"pre-commit-hooks": [
|
||||
"devenv"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727438425,
|
||||
"narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=",
|
||||
"owner": "domenkozar",
|
||||
"repo": "nix",
|
||||
"rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "domenkozar",
|
||||
"ref": "devenv-2.24",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1730531603,
|
||||
"narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1717432640,
|
||||
"narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "88269ab3044128b7c2f4c7d68448b2fb50456870",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "release-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1733477122,
|
||||
"narHash": "sha256-qamMCz5mNpQmgBwc8SB5tVMlD5sbwVIToVZtSxMph9s=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "rolling",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
55
flake.nix
Normal file
55
flake.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
|
||||
systems.url = "github:nix-systems/default";
|
||||
devenv.url = "github:cachix/devenv";
|
||||
devenv.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
|
||||
extra-substituters = "https://devenv.cachix.org";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
devenv,
|
||||
systems,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
forEachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||
in
|
||||
{
|
||||
packages = forEachSystem (system: {
|
||||
devenv-up = self.devShells.${system}.default.config.procfileScript;
|
||||
devenv-test = self.devShells.${system}.default.config.test;
|
||||
});
|
||||
|
||||
devShells = forEachSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
default = devenv.lib.mkShell {
|
||||
inherit inputs pkgs;
|
||||
modules = [
|
||||
{
|
||||
# https://devenv.sh/reference/options/
|
||||
languages.javascript = {
|
||||
enable = true;
|
||||
yarn = {
|
||||
enable = true;
|
||||
install.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
|
@ -7,18 +7,18 @@ Repository: https://www.coastalcommits.com/cswimr/gauntlet-emojipicker
|
|||
"""
|
||||
|
||||
[[entrypoint]]
|
||||
id = 'emojipicker'
|
||||
id = 'emojipicker-legacy'
|
||||
name = 'Emoji Picker'
|
||||
path = 'src/emojipicker.tsx'
|
||||
path = 'src/emojipicker/legacy.tsx'
|
||||
type = 'inline-view'
|
||||
description = """
|
||||
Copy emojis to your clipboard from Gauntlet!
|
||||
"""
|
||||
|
||||
[[entrypoint]]
|
||||
id = 'emojipicker-grid'
|
||||
name = 'Emoji Picker (Grid)'
|
||||
path = 'src/emojipicker-grid.tsx'
|
||||
id = 'emojipicker'
|
||||
name = 'Emoji Picker'
|
||||
path = 'src/emojipicker/index.tsx'
|
||||
type = 'view'
|
||||
description = """
|
||||
Copy emojis to your clipboard from Gauntlet!
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import 'react/jsx-runtime';
|
||||
import '@project-gauntlet/api/components';
|
||||
import 'react';
|
||||
import '@project-gauntlet/api/helpers';
|
||||
import './vendor.js';
|
||||
export { a as default } from './shared.js';
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXItZ3JpZC5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OyJ9
|
|
@ -1,7 +0,0 @@
|
|||
import 'react/jsx-runtime';
|
||||
import '@project-gauntlet/api/components';
|
||||
import '@project-gauntlet/api/helpers';
|
||||
import './vendor.js';
|
||||
export { E as default } from './shared.js';
|
||||
import 'react';
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXIuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OzsifQ==
|
55
js/shared.js
55
js/shared.js
|
@ -1,55 +0,0 @@
|
|||
import { jsxs, jsx } from 'react/jsx-runtime';
|
||||
import { Inline, ActionPanel, Action, Content, Icons, Grid } from '@project-gauntlet/api/components';
|
||||
import { Clipboard, showHud } from '@project-gauntlet/api/helpers';
|
||||
import { g as getEmojis, a as getEmojisGroupedBy } from './vendor.js';
|
||||
import { useState } from 'react';
|
||||
|
||||
// @ts-expect-error gauntlet uses deno and not node
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
Deno[Deno.internal].core;
|
||||
function EmojiPicker$1(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);
|
||||
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.Paragraph, { children: emoji.emoji }) })] }));
|
||||
}
|
||||
|
||||
// @ts-expect-error gauntlet uses deno and not node
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
Deno[Deno.internal].core;
|
||||
function EmojiPicker() {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
let emojiList;
|
||||
let isCategory = null;
|
||||
if (searchText) {
|
||||
emojiList = getEmojis().filter((emoji) => emoji.keywords.some((keyword) => keyword.includes(searchText)));
|
||||
isCategory = false;
|
||||
}
|
||||
else {
|
||||
emojiList = getEmojisGroupedBy("category");
|
||||
isCategory = true;
|
||||
}
|
||||
return (jsxs(Grid, { children: [jsx(Grid.SearchBar, { placeholder: "Search for an emoji", value: searchText, onChange: setSearchText }), isCategory
|
||||
? Object.entries(emojiList).map(([category, emojis]) => (jsx(Grid.Section, { title: category, children: emojis.map((emoji) => (jsx(Grid.Item, { title: emoji.emoji, subtitle: emoji.keywords.join(", "), onClick: async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
} }, emoji.emoji))) }, category)))
|
||||
: emojiList.map((emoji) => (jsx(Grid.Item, { title: emoji.emoji, subtitle: emoji.keywords.join(", "), onClick: async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
} }, emoji.emoji)))] }));
|
||||
}
|
||||
|
||||
export { EmojiPicker$1 as E, EmojiPicker as a };
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|
32
js/vendor.js
32
js/vendor.js
File diff suppressed because one or more lines are too long
32
package.json
Normal file
32
package.json
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "cswimr-gauntlet-plugins",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"publish": "gauntlet publish",
|
||||
"build": "gauntlet build",
|
||||
"dev": "gauntlet dev",
|
||||
"format": "eslint --fix ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@project-gauntlet/api": "0.12.0",
|
||||
"fuse": "^0.12.1",
|
||||
"unicode-emoji": "^2.6.0",
|
||||
"which": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "9.20.0",
|
||||
"@project-gauntlet/tools": "0.10.0",
|
||||
"@types/deno": "2.2.0",
|
||||
"@types/react": "19.0.10",
|
||||
"@types/which": "3.0.4",
|
||||
"@typescript-eslint/parser": "8.24.1",
|
||||
"eslint": "9.20.1",
|
||||
"eslint-config-prettier": "10.0.1",
|
||||
"eslint-plugin-prettier": "5.2.3",
|
||||
"eslint-plugin-react": "7.37.4",
|
||||
"globals": "16.0.0",
|
||||
"prettier": "3.5.1",
|
||||
"typescript": "5.7.3",
|
||||
"typescript-eslint": "8.24.1"
|
||||
}
|
||||
}
|
12
renovate.json
Normal file
12
renovate.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"local>cc/renovate-config"
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchUpdateTypes": ["minor", "patch", "digest"],
|
||||
"automerge": true
|
||||
}
|
||||
]
|
||||
}
|
89
src/emojipicker/index.tsx
Normal file
89
src/emojipicker/index.tsx
Normal file
|
@ -0,0 +1,89 @@
|
|||
import { Grid } from "@project-gauntlet/api/components";
|
||||
import React, { ReactNode, useState } from "react";
|
||||
import { Clipboard, showHud } from "@project-gauntlet/api/helpers";
|
||||
import {
|
||||
GroupedBy,
|
||||
BaseEmoji,
|
||||
getEmojis,
|
||||
getEmojisGroupedBy,
|
||||
} from "unicode-emoji";
|
||||
|
||||
// @ts-expect-error gauntlet uses deno and not node
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const denoCore: DenoCore = Deno[Deno.internal].core;
|
||||
|
||||
export default function EmojiPicker(): ReactNode | undefined {
|
||||
const [searchText, setSearchText] = useState<string | undefined>("");
|
||||
|
||||
let emojiList: BaseEmoji[] | Record<GroupedBy, BaseEmoji[]>;
|
||||
let isCategory = null;
|
||||
if (searchText) {
|
||||
emojiList = getEmojis().filter((emoji) =>
|
||||
emoji.keywords.some((keyword) => keyword.includes(searchText)),
|
||||
);
|
||||
isCategory = false;
|
||||
} else {
|
||||
emojiList = getEmojisGroupedBy("category");
|
||||
isCategory = true;
|
||||
}
|
||||
|
||||
let emojiListLength = 0;
|
||||
if (isCategory) {
|
||||
const typedList = emojiList as Record<GroupedBy, BaseEmoji[]>;
|
||||
for (const category in typedList) {
|
||||
emojiListLength += typedList[category as GroupedBy].length;
|
||||
}
|
||||
} else {
|
||||
emojiListLength = (emojiList as BaseEmoji[]).length;
|
||||
}
|
||||
console.log(emojiListLength);
|
||||
|
||||
return (
|
||||
<Grid>
|
||||
<Grid.SearchBar
|
||||
placeholder={"Search for an emoji"}
|
||||
value={searchText}
|
||||
onChange={setSearchText}
|
||||
/>
|
||||
{isCategory
|
||||
? Object.entries(emojiList).map(([category, emojis]) => (
|
||||
<Grid.Section key={category} title={category}>
|
||||
{emojis.map((emoji: BaseEmoji) => (
|
||||
<Grid.Item
|
||||
key={emoji.emoji}
|
||||
title={emoji.description}
|
||||
onClick={async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
}}
|
||||
>
|
||||
<Grid.Item.Content>
|
||||
<Grid.Item.Content.Paragraph>
|
||||
{emoji.emoji}
|
||||
</Grid.Item.Content.Paragraph>
|
||||
</Grid.Item.Content>
|
||||
</Grid.Item>
|
||||
))}
|
||||
</Grid.Section>
|
||||
))
|
||||
: (emojiList as BaseEmoji[]).map((emoji: BaseEmoji) => (
|
||||
<Grid.Item
|
||||
key={emoji.emoji}
|
||||
title={emoji.description}
|
||||
onClick={async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
}}
|
||||
>
|
||||
<Grid.Item.Content>
|
||||
<Grid.Item.Content.Paragraph>
|
||||
{emoji.emoji}
|
||||
</Grid.Item.Content.Paragraph>
|
||||
</Grid.Item.Content>
|
||||
</Grid.Item>
|
||||
))}
|
||||
</Grid>
|
||||
);
|
||||
}
|
56
src/emojipicker/legacy.tsx
Normal file
56
src/emojipicker/legacy.tsx
Normal file
|
@ -0,0 +1,56 @@
|
|||
import {
|
||||
Action,
|
||||
ActionPanel,
|
||||
Content,
|
||||
Icons,
|
||||
Inline,
|
||||
} from "@project-gauntlet/api/components";
|
||||
import React, { ReactNode } from "react";
|
||||
import { Clipboard, showHud } from "@project-gauntlet/api/helpers";
|
||||
import * as UnicodeEmoji from "unicode-emoji";
|
||||
|
||||
// @ts-expect-error gauntlet uses deno and not node
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const denoCore: DenoCore = Deno[Deno.internal].core;
|
||||
|
||||
export default function EmojiPicker(props: {
|
||||
text: string;
|
||||
}): ReactNode | undefined {
|
||||
const text = props.text.trim();
|
||||
|
||||
if (text.length < 3) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const emoji = UnicodeEmoji.getEmojis().find((emoji) =>
|
||||
emoji.keywords.includes(text),
|
||||
);
|
||||
if (!emoji) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
<Inline
|
||||
actions={
|
||||
<ActionPanel>
|
||||
<Action
|
||||
label={`Copy ${emoji.emoji} to clipboard`}
|
||||
onAction={async () => {
|
||||
console.log(emoji);
|
||||
await Clipboard.writeText(emoji.emoji);
|
||||
showHud(`${emoji.emoji} copied to clipboard`);
|
||||
}}
|
||||
/>
|
||||
</ActionPanel>
|
||||
}
|
||||
>
|
||||
<Inline.Left>
|
||||
<Content.H3>{text}</Content.H3>
|
||||
</Inline.Left>
|
||||
<Inline.Separator icon={Icons.ArrowRight} />
|
||||
<Inline.Right>
|
||||
<Content.Paragraph>{emoji.emoji}</Content.Paragraph>
|
||||
</Inline.Right>
|
||||
</Inline>
|
||||
);
|
||||
}
|
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"module": "ES2022",
|
||||
"esModuleInterop": true,
|
||||
"target": "ES2022",
|
||||
"moduleResolution": "bundler",
|
||||
"jsx": "react-jsx",
|
||||
},
|
||||
"lib": ["ES2020"]
|
||||
}
|
Loading…
Add table
Reference in a new issue