diff --git a/extensions/simple-icons/CHANGELOG.md b/extensions/simple-icons/CHANGELOG.md index 334125cae58..3a2d5b88a13 100644 --- a/extensions/simple-icons/CHANGELOG.md +++ b/extensions/simple-icons/CHANGELOG.md @@ -1,6 +1,11 @@ # Brand Icons Changelog -## [Maintenance] - {PR_MERGE_DATE} +## [Enhancements & Fixes] - 2024-10-28 + +- Fix incorrect file path +- Add support for copying font entities + +## [Maintenance] - 2024-10-27 - Get ready for the v14 new data structure - Add support for copying icon title diff --git a/extensions/simple-icons/package.json b/extensions/simple-icons/package.json index 26794c39afd..5c806478da5 100644 --- a/extensions/simple-icons/package.json +++ b/extensions/simple-icons/package.json @@ -89,6 +89,15 @@ "required": false, "type": "checkbox", "default": true + }, + { + "name": "displaySimpleIconsFontFeatures", + "title": "Display Simple Icons Font Features", + "label": "Enabled", + "description": "Display Simple Icons Font Features, such as font Copy Character, Copy HTML Code, and Copy UTF Code", + "required": false, + "type": "checkbox", + "default": true } ], "dependencies": { diff --git a/extensions/simple-icons/src/actions.tsx b/extensions/simple-icons/src/actions.tsx index 722e828bad3..9432642283d 100644 --- a/extensions/simple-icons/src/actions.tsx +++ b/extensions/simple-icons/src/actions.tsx @@ -47,6 +47,14 @@ export const CopyUnpkg = ({ icon, version }: ActionProps) => { return ; }; +export const CopyFontEntities = ({ icon }: ActionProps) => ( + <> + + + + +); + export const Supports = () => ( <> )} + {displaySimpleIconsFontFeatures && ( + + + + )} diff --git a/extensions/simple-icons/src/types.ts b/extensions/simple-icons/src/types.ts index dff22509300..a03c250032c 100644 --- a/extensions/simple-icons/src/types.ts +++ b/extensions/simple-icons/src/types.ts @@ -18,6 +18,7 @@ export type Aliases = { }; export type IconData = { + code: number; title: string; hex: string; source: string; diff --git a/extensions/simple-icons/src/utils.ts b/extensions/simple-icons/src/utils.ts index 6096721c953..764025b2f08 100644 --- a/extensions/simple-icons/src/utils.ts +++ b/extensions/simple-icons/src/utils.ts @@ -25,9 +25,12 @@ import { JsDelivrNpmResponse, IconData, LaunchContext } from "./types.js"; const cache = new Cache(); +export const fontUnicodeStart = 0xea01; + export const { defaultDetailAction = "OpenWith", defaultLoadSvgAction = "WithBrandColor", + displaySimpleIconsFontFeatures, enableAiSearch, } = getPreferenceValues(); @@ -88,16 +91,11 @@ export const cacheAssetPack = async (version: string) => { export const loadCachedJson = async (version: string) => { const [major] = version.split("."); const isNewFormat = Number(major) >= 14; - const jsonPath = join( - environment.assetsPath, - "pack", - `simple-icons-${version}`, - isNewFormat ? "data" : "_data", - "simple-icons.json", - ); + const jsonPath = join(environment.assetsPath, "pack", `simple-icons-${version}`, "_data", "simple-icons.json"); const jsonFile = await readFile(jsonPath, "utf8"); const json = JSON.parse(jsonFile); - return isNewFormat ? (json as IconData[]) : (json.icons as IconData[]); + const icons = isNewFormat ? (json as IconData[]) : (json.icons as IconData[]); + return icons.map((icon, i) => ({ ...icon, code: fontUnicodeStart + i })); }; export const loadCachedVersion = () => {