Better icon intellisense (#4)
This commit is contained in:
parent
5d5240683c
commit
dd1ffdd0f2
5 changed files with 50 additions and 1 deletions
|
|
@ -2,3 +2,4 @@
|
|||
# See: https://prettier.io/docs/en/configuration.html#editorconfig
|
||||
|
||||
singleQuote: true
|
||||
endOfLine: auto
|
||||
|
|
|
|||
34
package-lock.json
generated
34
package-lock.json
generated
|
|
@ -18,6 +18,7 @@
|
|||
"devDependencies": {
|
||||
"@astrojs/react": "1.1.1",
|
||||
"@astrojs/tailwind": "1.0.0",
|
||||
"@iconify/json": "2.1.100",
|
||||
"@types/react": "18.0.18",
|
||||
"@types/react-dom": "18.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.36.1",
|
||||
|
|
@ -40,6 +41,7 @@
|
|||
"postcss": "8.4.16",
|
||||
"prettier": "2.7.1",
|
||||
"tailwindcss": "3.1.8",
|
||||
"type-fest": "2.19.0",
|
||||
"vite": "3.0.9",
|
||||
"vite-tsconfig-paths": "3.5.0"
|
||||
},
|
||||
|
|
@ -767,6 +769,16 @@
|
|||
"react": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/json": {
|
||||
"version": "2.1.100",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/json/-/json-2.1.100.tgz",
|
||||
"integrity": "sha512-ztPJgsoqJQ2T216O0Wl94YmK085kLWeu25SekkwZaaTVZ5XaByER/h84AWGaKz7sBnnvdWJ+8ExAGyBGdr44bg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@iconify/types": "*",
|
||||
"pathe": "^0.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@iconify/types": {
|
||||
"version": "2.0.0-beta.1",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0-beta.1.tgz",
|
||||
|
|
@ -7060,6 +7072,12 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/pathe": {
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/pathe/-/pathe-0.3.5.tgz",
|
||||
"integrity": "sha512-grU/QeYP0ChuE5kjU2/k8VtAeODzbernHlue0gTa27+ayGIu3wqYBIPGfP9r5xSqgCgDd4nWrjKXEfxMillByg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
|
|
@ -10054,6 +10072,16 @@
|
|||
"iconify-icon": "^1.0.0-beta.3"
|
||||
}
|
||||
},
|
||||
"@iconify/json": {
|
||||
"version": "2.1.100",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/json/-/json-2.1.100.tgz",
|
||||
"integrity": "sha512-ztPJgsoqJQ2T216O0Wl94YmK085kLWeu25SekkwZaaTVZ5XaByER/h84AWGaKz7sBnnvdWJ+8ExAGyBGdr44bg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@iconify/types": "*",
|
||||
"pathe": "^0.3.0"
|
||||
}
|
||||
},
|
||||
"@iconify/types": {
|
||||
"version": "2.0.0-beta.1",
|
||||
"resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0-beta.1.tgz",
|
||||
|
|
@ -14404,6 +14432,12 @@
|
|||
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
|
||||
"dev": true
|
||||
},
|
||||
"pathe": {
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/pathe/-/pathe-0.3.5.tgz",
|
||||
"integrity": "sha512-grU/QeYP0ChuE5kjU2/k8VtAeODzbernHlue0gTa27+ayGIu3wqYBIPGfP9r5xSqgCgDd4nWrjKXEfxMillByg==",
|
||||
"dev": true
|
||||
},
|
||||
"picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
"devDependencies": {
|
||||
"@astrojs/react": "1.1.1",
|
||||
"@astrojs/tailwind": "1.0.0",
|
||||
"@iconify/json": "2.1.100",
|
||||
"@types/react": "18.0.18",
|
||||
"@types/react-dom": "18.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.36.1",
|
||||
|
|
@ -50,6 +51,7 @@
|
|||
"postcss": "8.4.16",
|
||||
"prettier": "2.7.1",
|
||||
"tailwindcss": "3.1.8",
|
||||
"type-fest": "2.19.0",
|
||||
"vite": "3.0.9",
|
||||
"vite-tsconfig-paths": "3.5.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ImageMetadata } from '@astrojs/image';
|
||||
|
||||
export type Icon = string;
|
||||
import type { Icon } from './icon';
|
||||
|
||||
export type LocalImage = Promise<{ default: ImageMetadata }>;
|
||||
|
||||
|
|
|
|||
12
src/types/icon.ts
Normal file
12
src/types/icon.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import type { StringKeyOf, ValueOf } from 'type-fest';
|
||||
|
||||
type IconSets = {
|
||||
'fa6-brands': typeof import('@iconify/json/json/fa6-brands.json');
|
||||
'fa6-solid': typeof import('@iconify/json/json/fa6-solid.json');
|
||||
'simple-icons': typeof import('@iconify/json/json/simple-icons.json');
|
||||
'circle-flags': typeof import('@iconify/json/json/circle-flags.json');
|
||||
};
|
||||
|
||||
export type Icon = ValueOf<{
|
||||
[IconSet in keyof IconSets]: `${IconSet}:${StringKeyOf<IconSets[IconSet]['icons']>}`;
|
||||
}>;
|
||||
Loading…
Reference in a new issue