From 21e3c0fbb556d89d3ee977b070801bd4e2c699e5 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Wed, 3 May 2023 22:11:49 +0200 Subject: [PATCH] A lot off fixes! --- .gitignore | 9 + docs/.gitignore | 8 - docs/.vitepress/api/icon-nodes/index.get.ts | 2 +- docs/.vitepress/api/icons/[iconName].get.ts | 2 +- docs/.vitepress/api/tags/index.get.ts | 5 +- docs/.vitepress/config.ts | 135 +------------ .../.vitepress}/data/packageData.json | 0 .../data/packageData.thirdParty.json | 0 docs/.vitepress/lib/categories.ts | 13 +- docs/.vitepress/lib/createCodeExamples.ts | 63 +++--- docs/.vitepress/lib/fetchAllContributors.ts | 2 +- docs/.vitepress/lib/fetchIconNodes.tsx | 23 --- docs/.vitepress/lib/fetchPackages.ts | 2 +- docs/.vitepress/lib/getFallbackZip.tsx | 7 +- docs/.vitepress/lib/icons.ts | 2 +- docs/.vitepress/lib/key.js | 36 ---- docs/.vitepress/sidebar.ts | 117 +++++++++++ .../{ => theme}/components/PageContainer.vue | 0 .../components/base}/Badge.vue | 6 +- .../components/base}/ButtonMenu.vue | 42 +++- .../components/base}/CodeGroup.vue | 0 .../components/base}/ColorPicker.vue | 0 .../components/base}/EndOfPage.vue | 0 .../components/base}/FakeInput.vue | 3 +- .../components/base}/IconButton.vue | 0 .../components/base}/Input.vue | 0 .../components/base}/InputField.vue | 0 .../components/base}/InputSearch.vue | 2 +- .../components/base}/LucideIcon.vue | 1 - .../components/base}/RangeSlider.vue | 0 .../components/home}/HomeContainer.vue | 0 .../home}/HomeHeroIconsCard.data.ts | 2 +- .../components/home}/HomeHeroIconsCard.vue | 6 +- .../components/home}/HomeIconCustomizer.vue | 27 ++- .../home}/HomeIconCustomizerIcons.vue | 5 +- .../home}/HomePackagesSection.data.ts | 0 .../components/home}/HomePackagesSection.vue | 0 .../components/icons}/CategoryList.data.ts | 2 +- .../components/icons}/CategoryList.vue | 7 +- .../components/icons}/CategoryListItem.vue | 3 +- .../theme/components/icons/CopyCodeButton.vue | 182 +++++++++++++++++ .../theme/components/icons/CopySVGButton.vue | 186 ++++++++++++++++++ .../components/icons}/IconDetail.vue | 2 - .../components/icons}/IconDetailName.vue | 0 .../components/icons}/IconDetailOverlay.vue | 56 +----- .../components/icons}/IconGrid.vue | 2 +- .../theme/components/icons/IconInfo.vue | 60 ++++++ .../components/icons}/IconItem.vue | 11 +- .../components/icons}/IconPreview.vue | 17 +- .../icons}/IconsCategoryOverview.vue | 12 +- .../components/icons}/IconsOverview.vue | 15 +- .../icons}/SidebarIconCustomizer.vue | 12 +- .../composables/useActiveAnchor.ts | 0 .../composables/useCategoryView.ts | 2 - .../composables/useIconCodeExample.ts | 28 +-- .../{ => theme}/composables/useIconStyle.ts | 0 .../{ => theme}/composables/useSearch.ts | 4 +- .../{ => theme}/composables/useSearchInput.ts | 0 docs/.vitepress/theme/index.ts | 6 +- .../theme/layouts/IconsSidebarNavAfter.vue | 4 +- docs/.vitepress/{ => theme}/types.ts | 0 docs/.vitepress/vue-shim.d.ts | 6 + docs/{ => guide}/comparison.md | 0 docs/icons/[name].md | 32 +-- docs/icons/[name].paths.ts | 24 +-- docs/icons/categories.md | 4 +- docs/icons/codeExamples.data.ts | 13 ++ docs/icons/index.data.ts | 15 +- docs/icons/index.md | 4 +- docs/index.md | 4 +- docs/package.json | 2 +- docs/tsconfig.json | 4 +- docs/vercel.json | 5 +- pnpm-lock.yaml | 137 +++++++------ scripts/writeIconMetaIndex.mjs | 10 +- scripts/writeIconNodes.mjs | 4 +- 76 files changed, 872 insertions(+), 523 deletions(-) delete mode 100644 docs/.gitignore rename {site/src => docs/.vitepress}/data/packageData.json (100%) rename {site/src => docs/.vitepress}/data/packageData.thirdParty.json (100%) delete mode 100644 docs/.vitepress/lib/fetchIconNodes.tsx delete mode 100644 docs/.vitepress/lib/key.js create mode 100644 docs/.vitepress/sidebar.ts rename docs/.vitepress/{ => theme}/components/PageContainer.vue (100%) rename docs/.vitepress/{components => theme/components/base}/Badge.vue (92%) rename docs/.vitepress/{components => theme/components/base}/ButtonMenu.vue (76%) rename docs/.vitepress/{components => theme/components/base}/CodeGroup.vue (100%) rename docs/.vitepress/{components => theme/components/base}/ColorPicker.vue (100%) rename docs/.vitepress/{components => theme/components/base}/EndOfPage.vue (100%) rename docs/.vitepress/{components => theme/components/base}/FakeInput.vue (90%) rename docs/.vitepress/{components => theme/components/base}/IconButton.vue (100%) rename docs/.vitepress/{components => theme/components/base}/Input.vue (100%) rename docs/.vitepress/{components => theme/components/base}/InputField.vue (100%) rename docs/.vitepress/{components => theme/components/base}/InputSearch.vue (96%) rename docs/.vitepress/{components => theme/components/base}/LucideIcon.vue (91%) rename docs/.vitepress/{components => theme/components/base}/RangeSlider.vue (100%) rename docs/.vitepress/{components => theme/components/home}/HomeContainer.vue (100%) rename docs/.vitepress/{components => theme/components/home}/HomeHeroIconsCard.data.ts (86%) rename docs/.vitepress/{components => theme/components/home}/HomeHeroIconsCard.vue (96%) rename docs/.vitepress/{components => theme/components/home}/HomeIconCustomizer.vue (88%) rename docs/.vitepress/{components => theme/components/home}/HomeIconCustomizerIcons.vue (91%) rename docs/.vitepress/{components => theme/components/home}/HomePackagesSection.data.ts (100%) rename docs/.vitepress/{components => theme/components/home}/HomePackagesSection.vue (100%) rename docs/.vitepress/{components => theme/components/icons}/CategoryList.data.ts (94%) rename docs/.vitepress/{components => theme/components/icons}/CategoryList.vue (90%) rename docs/.vitepress/{components => theme/components/icons}/CategoryListItem.vue (95%) create mode 100644 docs/.vitepress/theme/components/icons/CopyCodeButton.vue create mode 100644 docs/.vitepress/theme/components/icons/CopySVGButton.vue rename docs/.vitepress/{components => theme/components/icons}/IconDetail.vue (91%) rename docs/.vitepress/{components => theme/components/icons}/IconDetailName.vue (100%) rename docs/.vitepress/{components => theme/components/icons}/IconDetailOverlay.vue (64%) rename docs/.vitepress/{components => theme/components/icons}/IconGrid.vue (94%) create mode 100644 docs/.vitepress/theme/components/icons/IconInfo.vue rename docs/.vitepress/{components => theme/components/icons}/IconItem.vue (89%) rename docs/.vitepress/{components => theme/components/icons}/IconPreview.vue (83%) rename docs/.vitepress/{components => theme/components/icons}/IconsCategoryOverview.vue (87%) rename docs/.vitepress/{components => theme/components/icons}/IconsOverview.vue (82%) rename docs/.vitepress/{components => theme/components/icons}/SidebarIconCustomizer.vue (90%) rename docs/.vitepress/{ => theme}/composables/useActiveAnchor.ts (100%) rename docs/.vitepress/{ => theme}/composables/useCategoryView.ts (94%) rename docs/.vitepress/{ => theme}/composables/useIconCodeExample.ts (87%) rename docs/.vitepress/{ => theme}/composables/useIconStyle.ts (100%) rename docs/.vitepress/{ => theme}/composables/useSearch.ts (93%) rename docs/.vitepress/{ => theme}/composables/useSearchInput.ts (100%) rename docs/.vitepress/{ => theme}/types.ts (100%) rename docs/{ => guide}/comparison.md (100%) create mode 100644 docs/icons/codeExamples.data.ts diff --git a/.gitignore b/.gitignore index d0be9ce93..7cff21c8d 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,12 @@ packages/**/LICENSE categories.json tags.json .vercel + +# docs +docs/.vitepress/cache +docs/.vitepress/dist +docs/.vitepress/.temp +docs/.vitepress/data/iconNodes +docs/.vitepress/data/iconMetaData.ts +docs/.vercel +docs/.nitro diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index 8a34403c0..000000000 --- a/docs/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -node_modules -.vitepress/cache -.vitepress/dist -.vitepress/.temp -.vercel -.nitro -iconNodes -iconMetaData.ts diff --git a/docs/.vitepress/api/icon-nodes/index.get.ts b/docs/.vitepress/api/icon-nodes/index.get.ts index ca4ad1c82..5b0eda795 100644 --- a/docs/.vitepress/api/icon-nodes/index.get.ts +++ b/docs/.vitepress/api/icon-nodes/index.get.ts @@ -1,5 +1,5 @@ import { eventHandler, getQuery, setResponseHeader } from 'h3' -import * as iconNodes from '../../../iconNodes' +import * as iconNodes from '../../data/iconNodes' import { kebabCase } from 'lodash-es' export default eventHandler((event) => { diff --git a/docs/.vitepress/api/icons/[iconName].get.ts b/docs/.vitepress/api/icons/[iconName].get.ts index ba588436e..576717021 100644 --- a/docs/.vitepress/api/icons/[iconName].get.ts +++ b/docs/.vitepress/api/icons/[iconName].get.ts @@ -1,5 +1,5 @@ import { eventHandler, getQuery, setResponseHeader, createError } from 'h3' -import * as iconNodes from '../../../iconNodes' +import * as iconNodes from '../../data/iconNodes' import { camelCase } from 'lodash-es' import createLucideIcon from 'lucide-react/src/createLucideIcon' import { renderToString } from 'react-dom/server' diff --git a/docs/.vitepress/api/tags/index.get.ts b/docs/.vitepress/api/tags/index.get.ts index 91a911e26..8984c7e02 100644 --- a/docs/.vitepress/api/tags/index.get.ts +++ b/docs/.vitepress/api/tags/index.get.ts @@ -1,8 +1,7 @@ -import { eventHandler, getQuery, setResponseHeader } from 'h3' -import * as iconMetaData from '../../../iconMetaData' +import { eventHandler, setResponseHeader } from 'h3' +import * as iconMetaData from '../../data/iconMetaData' import { kebabCase } from 'lodash-es' - export default eventHandler((event) => { setResponseHeader(event, 'Cache-Control', 'public, max-age=86400') diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 4be16dd4a..b85c4d725 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,13 +1,6 @@ -import fs from 'fs' -import path from 'path' +import path from 'path'; import { defineConfig } from 'vitepress' - -export function getAllCategoryFiles() { - const fileNames = fs.readdirSync(path.join('../lucide/categories')).filter((file) => path.extname(file) === '.json'); - - return fileNames - .map((fileName) => path.basename(fileName, '.json')); -} +import sidebar from './sidebar'; // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -15,138 +8,22 @@ export default defineConfig({ title: "Lucide", description: "Beautiful & consistent icon toolkit made by the community.", outDir: '.vercel/output/static', - vite: { - plugins: [] - }, themeConfig: { + // https://vitepress.dev/reference/default-theme-config logo: { light: '/logo.light.svg', dark: '/logo.dark.svg' }, - // https://vitepress.dev/reference/default-theme-config nav: [ { text: 'Icons', link: '/icons/index.md' }, { text: 'Guide', link: '/guide/' }, { text: 'Packages', link: '/packages' }, { text: 'License', link: '/license' }, ], - - sidebar: { - 'guide':[ - { - text: 'Introduction', - items: [ - { text: 'What is lucide?', link: '/guide/' }, - { text: 'Installation', link: '/guide/installation' } - ] - }, - // { - // test: 'Using Icons', - // items: [ - // { - // text: 'How to use icons', - // link: 'how-to-use-icons' - // }, - // { - // text: 'Styling icons', - // link: 'styling-icons' - // }, - // { - // text: 'Accessibility', - // link: 'accessibility' - // }, - // { - // text: 'What should I use', - // link: 'what-should-i-use' - // }, - - // ] - // }, - { - text: 'Packages', - items: [ - { - text: 'Lucide', - link: '/guide/packages/lucide' - }, - { - text: 'Lucide React', - link: '/guide/packages/lucide-react' - }, - { - text: 'Lucide React Native', - link: '/guide/packages/lucide-react-native' - }, - { - text: 'Lucide Vue', - link: '/guide/packages/lucide-vue' - }, - { - text: 'Lucide Vue Next (Vue 3)', - link: '/guide/packages/lucide-vue-next' - }, - { - text: 'Lucide Svelte', - link: '/guide/packages/lucide-svelte' - }, - { - text: 'Lucide Solid', - link: '/guide/packages/lucide-solid' - }, - { - text: 'Lucide Preact', - link: '/guide/packages/lucide-preact' - }, - { - text: 'Lucide Angular', - link: '/guide/packages/lucide-angular' - }, - { - text: 'Lucide Static', - link: '/guide/packages/lucide-static' - }, - { - text: 'Lucide Flutter', - link: '/guide/packages/lucide-flutter' - }, - ] - }, - { - text: 'Contributing', - items: [ - { - text: 'Icon Design Principles', - link: '/guide/design/icon-design-guide' - }, - { - text: 'Designing in Illustrator', - link: '/guide/design/illustrator-guide' - }, - { - text: 'Designing in InkScape', - link: '/guide/design/inkscape-guide' - }, - { - text: 'Designing in Figma', - link: '/guide/design/figma-guide' - }, - ] - }, - ], - 'icons': [ - { text: '', link: '/' }, - // { text: 'Categorized', link: '/icons/categorized' }, - // { - // text: 'Categories', - // items: [ - // ...(getAllCategoryFiles().map((category) => ({ text: category, link: `/icons/category/${category}` }))) - // ] - // } - ], - }, - + sidebar, socialLinks: [ - { icon: 'github', link: 'https://github.com/vuejs/vitepress' } + { icon: 'github', link: 'https://github.com/lucide-icons/lucide' }, + { icon: 'discord', link: 'https://discord.gg/EH6nSts' } ] } }) diff --git a/site/src/data/packageData.json b/docs/.vitepress/data/packageData.json similarity index 100% rename from site/src/data/packageData.json rename to docs/.vitepress/data/packageData.json diff --git a/site/src/data/packageData.thirdParty.json b/docs/.vitepress/data/packageData.thirdParty.json similarity index 100% rename from site/src/data/packageData.thirdParty.json rename to docs/.vitepress/data/packageData.thirdParty.json diff --git a/docs/.vitepress/lib/categories.ts b/docs/.vitepress/lib/categories.ts index 8466b7ea1..55b95104f 100644 --- a/docs/.vitepress/lib/categories.ts +++ b/docs/.vitepress/lib/categories.ts @@ -1,6 +1,6 @@ import fs from "fs"; import path from "path"; -import {Category, IconEntity} from "../types"; +import {Category, IconEntity} from "../theme/types"; import {getAllData} from "./icons"; const directory = path.join(process.cwd(), "../categories"); @@ -8,8 +8,15 @@ const directory = path.join(process.cwd(), "../categories"); export function getAllCategoryFiles() { const fileNames = fs.readdirSync(directory).filter((file) => path.extname(file) === '.json'); - return fileNames - .map((fileName) => path.basename(fileName, '.json')); + return fileNames.map((fileName) => { + const name = path.basename(fileName, '.json') + const fileContent = fs.readFileSync(path.join(directory, fileName), 'utf8') + + return { + name, + ...JSON.parse(fileContent) + } + }); } export async function getData(name: string, icons: IconEntity[]): Promise { diff --git a/docs/.vitepress/lib/createCodeExamples.ts b/docs/.vitepress/lib/createCodeExamples.ts index c52b4f068..6f3104ed4 100644 --- a/docs/.vitepress/lib/createCodeExamples.ts +++ b/docs/.vitepress/lib/createCodeExamples.ts @@ -17,9 +17,7 @@ type CodeExampleType = { }[], }[] -const getIconCodes = (name: string): CodeExampleType => { - const pascalCase = startCase(camelCase(name)).replace(/\s/g, '') - +const getIconCodes = (): CodeExampleType => { return [ { lang: 'html', @@ -27,7 +25,7 @@ const getIconCodes = (name: string): CodeExampleType => { codes: [ { language: 'html', - code: ` + code: ` `, }, ], @@ -38,17 +36,17 @@ const getIconCodes = (name: string): CodeExampleType => { codes: [ { language: 'tsx', - code: `import { ${pascalCase} } from 'lucide-react'; + code: `import { PascalCase } from 'lucide-react'; const App = () => { return ( - <${pascalCase}/> + ); }; export default App; `, - metastring: '{1,4}', + }, ], }, @@ -58,15 +56,15 @@ export default App; codes: [ { language: 'vue', - code: ` - - + + `, - metastring: '{2,6}', + }, ], }, @@ -75,14 +73,14 @@ import { ${pascalCase} } from 'lucide-vue-next'; title: 'Svelte', codes: [ { - language: 'vue', + language: 'svelte', code: ` -<${pascalCase}/> + `, - metastring: '{2,5}', + }, ], }, @@ -92,17 +90,17 @@ import { ${pascalCase} } from 'lucide-svelte'; codes: [ { language: 'tsx', - code: `import { ${pascalCase} } from 'lucide-preact'; + code: `import { PascalCase } from 'lucide-preact'; const App = () => { return ( - <${pascalCase}/> + ); }; export default App; `, - metastring: '{1,4}', + }, ], }, @@ -112,17 +110,17 @@ export default App; codes: [ { language: 'tsx', - code: `import { ${pascalCase} } from 'lucide-solid'; + code: `import { PascalCase } from 'lucide-solid'; const App = () => { return ( - <${pascalCase}/> + ); }; export default App; `, - metastring: '{1,4}', + }, ], }, @@ -133,15 +131,16 @@ export default App; { language: 'tsx', code: `// app.module.ts -import { LucideAngularModule, ${pascalCase} } from 'lucide-angular';\r +import { LucideAngularModule, PascalCase } from 'lucide-angular'; + @NgModule({ imports: [ - LucideAngularModule.pick({ ${pascalCase} }) + LucideAngularModule.pick({ PascalCase }) ], }) // app.component.html - + `, }, ], @@ -153,10 +152,10 @@ import { LucideAngularModule, ${pascalCase} } from 'lucide-angular';\r { language: 'html', code: ` -
+
`, }, ], @@ -167,7 +166,7 @@ import { LucideAngularModule, ${pascalCase} } from 'lucide-angular';\r codes: [ { language: 'dart', - code: `Icon(LucideIcons.${name}); + code: `Icon(LucideIcons.Name); `, }, ], @@ -200,8 +199,8 @@ const highLightCode = async (code: string, lang: string, active?: boolean) => { } -export default async function createCodeExamples(name: string) { - const codes = getIconCodes(name); +export default async function createCodeExamples() { + const codes = getIconCodes(); const codeExamplePromises = codes.map(async (codeTemplate, index) => { const { title, lang, codes } = codeTemplate; diff --git a/docs/.vitepress/lib/fetchAllContributors.ts b/docs/.vitepress/lib/fetchAllContributors.ts index 0d67c21de..e9518e030 100644 --- a/docs/.vitepress/lib/fetchAllContributors.ts +++ b/docs/.vitepress/lib/fetchAllContributors.ts @@ -1,7 +1,7 @@ import crypto from 'crypto'; import fs from 'fs'; import path from 'path'; -import { Contributor } from '../types'; +import { Contributor } from '../theme/types'; import fetch, { Headers } from 'node-fetch' const IGNORE_COMMIT_MESSAGES = ['fork', 'optimize']; diff --git a/docs/.vitepress/lib/fetchIconNodes.tsx b/docs/.vitepress/lib/fetchIconNodes.tsx deleted file mode 100644 index 43b49ab7b..000000000 --- a/docs/.vitepress/lib/fetchIconNodes.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import NextCache from './nextCache'; -import {getAllData, GetDataOptions} from './icons'; - -export type IconNode = [string, object, IconNode[]]; -export type IconNodes = {[iconName: string]: IconNode}; - -export function fetchIconNodes(writeCache = true, options?: GetDataOptions): Promise { - if (options?.withChildKeys) { - return NextCache.resolve('api-icon-nodes-with-keys', async () => { - return (await getAllData({ withChildKeys : true})).reduce((acc, icon) => { - acc[icon.name] = icon.iconNode - return acc; - }, {}); - }, writeCache); - } - - return NextCache.resolve('api-icon-nodes', async () => { - return (await getAllData()).reduce((acc, icon) => { - acc[icon.name] = icon.iconNode - return acc; - }, {}); - }, writeCache); -} diff --git a/docs/.vitepress/lib/fetchPackages.ts b/docs/.vitepress/lib/fetchPackages.ts index 5333ca033..0bf1a7e65 100644 --- a/docs/.vitepress/lib/fetchPackages.ts +++ b/docs/.vitepress/lib/fetchPackages.ts @@ -1,7 +1,7 @@ import { promises as fs, constants } from 'fs'; import path from 'path'; import yaml from 'js-yaml' -import { PackageItem } from '../types'; +import { PackageItem } from '../theme/types'; const fileExist = (filePath) => fs.access(filePath, constants.F_OK).then(() => true).catch(() => false) diff --git a/docs/.vitepress/lib/getFallbackZip.tsx b/docs/.vitepress/lib/getFallbackZip.tsx index f74d55ae5..82f3bbdaf 100644 --- a/docs/.vitepress/lib/getFallbackZip.tsx +++ b/docs/.vitepress/lib/getFallbackZip.tsx @@ -1,12 +1,13 @@ -import { createLucideIcon, LucideProps } from "lucide-react" -import { IconEntity } from "src/types" +import { createLucideIcon } from "lucide-react/src/lucide-react" +import { type LucideProps, type IconNode } from "lucide-react/src/createLucideIcon" +import { IconEntity } from "../theme/types" import { renderToStaticMarkup } from 'react-dom/server'; import { IconContent } from "./generateZip"; const getFallbackZip = (icons: IconEntity[], params: LucideProps) => { return icons .map((icon) => { - const Icon = createLucideIcon(icon.name, icon.iconNode) + const Icon = createLucideIcon(icon.name, icon.iconNode as IconNode) const src = renderToStaticMarkup() return [icon.name, src] }) diff --git a/docs/.vitepress/lib/icons.ts b/docs/.vitepress/lib/icons.ts index 4e35609b1..b0a4bff3e 100644 --- a/docs/.vitepress/lib/icons.ts +++ b/docs/.vitepress/lib/icons.ts @@ -2,7 +2,7 @@ import fs from "fs"; import path from "path"; import { parseSync } from "svgson"; import { IconNode } from "../../../packages/lucide-react/src/createLucideIcon"; -import { IconEntity } from "../types"; +import { IconEntity } from "../theme/types"; import { getContributors } from "./fetchAllContributors"; import { generateHashedKey } from "./helpers"; diff --git a/docs/.vitepress/lib/key.js b/docs/.vitepress/lib/key.js deleted file mode 100644 index bbaecee71..000000000 --- a/docs/.vitepress/lib/key.js +++ /dev/null @@ -1,36 +0,0 @@ -import { useEffect, useState } from "react"; - -const isCtrl = (e) => e.metaKey || e.ctrlKey; - -// https://keycode.info -export const useKeyBindings = ( - initialKeyBindings = {}, - eventListener = "keydown" -) => { - const [keyBindings] = useState(initialKeyBindings); - - useEffect(() => { - // eslint-disable-next-line no-undef - document.addEventListener( - eventListener, - (event) => { - const { code } = event; - const keyBinding = keyBindings[code]; - if (keyBinding === undefined) return; - const condition = keyBinding.ctrl ? isCtrl(event) : true; - if (!condition) return; - if (event.target.type != "text" || code == "Escape") { - event.preventDefault(); - keyBinding.fn(event); - } - }, - false - ); - - return () => - Object.keys(keyBindings).forEach((keyBinding) => - // eslint-disable-next-line no-undef - document.removeEventListener(eventListener, keyBindings[keyBinding]) - ); - }, []); -}; diff --git a/docs/.vitepress/sidebar.ts b/docs/.vitepress/sidebar.ts new file mode 100644 index 000000000..97db4615f --- /dev/null +++ b/docs/.vitepress/sidebar.ts @@ -0,0 +1,117 @@ +import { DefaultTheme, UserConfig } from "vitepress" + +const sidebar: UserConfig['themeConfig']['sidebar'] = { + 'guide':[ + { + text: 'Introduction', + items: [ + { text: 'What is lucide?', link: '/guide/' }, + { text: 'Installation', link: '/guide/installation' } + ] + }, + // { + // text: 'Using Icons', + // items: [ + // { + // text: 'How to use icons', + // link: 'how-to-use-icons' + // }, + // { + // text: 'Styling icons', + // link: 'styling-icons' + // }, + // { + // text: 'Accessibility', + // link: 'accessibility' + // }, + // { + // text: 'What should I use', + // link: 'what-should-i-use' + // }, + + // ] + // }, + { + text: 'Packages', + items: [ + { + text: 'Lucide', + link: '/guide/packages/lucide' + }, + { + text: 'Lucide React', + link: '/guide/packages/lucide-react' + }, + { + text: 'Lucide React Native', + link: '/guide/packages/lucide-react-native' + }, + { + text: 'Lucide Vue', + link: '/guide/packages/lucide-vue' + }, + { + text: 'Lucide Vue Next (Vue 3)', + link: '/guide/packages/lucide-vue-next' + }, + { + text: 'Lucide Svelte', + link: '/guide/packages/lucide-svelte' + }, + { + text: 'Lucide Solid', + link: '/guide/packages/lucide-solid' + }, + { + text: 'Lucide Preact', + link: '/guide/packages/lucide-preact' + }, + { + text: 'Lucide Angular', + link: '/guide/packages/lucide-angular' + }, + { + text: 'Lucide Static', + link: '/guide/packages/lucide-static' + }, + { + text: 'Lucide Flutter', + link: '/guide/packages/lucide-flutter' + }, + ] + }, + { + text: 'Contributing', + items: [ + { + text: 'Icon Design Principles', + link: '/guide/design/icon-design-guide' + }, + { + text: 'Designing in Illustrator', + link: '/guide/design/illustrator-guide' + }, + { + text: 'Designing in InkScape', + link: '/guide/design/inkscape-guide' + }, + { + text: 'Designing in Figma', + link: '/guide/design/figma-guide' + }, + ] + }, + ], + 'icons': [ + { text: '', link: '/' }, + // { text: 'Categorized', link: '/icons/categorized' }, + // { + // text: 'Categories', + // items: [ + // ...(getAllCategoryFiles().map((category) => ({ text: category, link: `/icons/category/${category}` }))) + // ] + // } + ], +} + +export default sidebar diff --git a/docs/.vitepress/components/PageContainer.vue b/docs/.vitepress/theme/components/PageContainer.vue similarity index 100% rename from docs/.vitepress/components/PageContainer.vue rename to docs/.vitepress/theme/components/PageContainer.vue diff --git a/docs/.vitepress/components/Badge.vue b/docs/.vitepress/theme/components/base/Badge.vue similarity index 92% rename from docs/.vitepress/components/Badge.vue rename to docs/.vitepress/theme/components/base/Badge.vue index 640c043a1..3ff46072c 100644 --- a/docs/.vitepress/components/Badge.vue +++ b/docs/.vitepress/theme/components/base/Badge.vue @@ -25,7 +25,7 @@ const component = computed(() => props.href ? 'a' : 'div') diff --git a/docs/.vitepress/components/CodeGroup.vue b/docs/.vitepress/theme/components/base/CodeGroup.vue similarity index 100% rename from docs/.vitepress/components/CodeGroup.vue rename to docs/.vitepress/theme/components/base/CodeGroup.vue diff --git a/docs/.vitepress/components/ColorPicker.vue b/docs/.vitepress/theme/components/base/ColorPicker.vue similarity index 100% rename from docs/.vitepress/components/ColorPicker.vue rename to docs/.vitepress/theme/components/base/ColorPicker.vue diff --git a/docs/.vitepress/components/EndOfPage.vue b/docs/.vitepress/theme/components/base/EndOfPage.vue similarity index 100% rename from docs/.vitepress/components/EndOfPage.vue rename to docs/.vitepress/theme/components/base/EndOfPage.vue diff --git a/docs/.vitepress/components/FakeInput.vue b/docs/.vitepress/theme/components/base/FakeInput.vue similarity index 90% rename from docs/.vitepress/components/FakeInput.vue rename to docs/.vitepress/theme/components/base/FakeInput.vue index 078cdd21e..8e26c828a 100644 --- a/docs/.vitepress/components/FakeInput.vue +++ b/docs/.vitepress/theme/components/base/FakeInput.vue @@ -1,7 +1,6 @@ diff --git a/docs/.vitepress/components/IconButton.vue b/docs/.vitepress/theme/components/base/IconButton.vue similarity index 100% rename from docs/.vitepress/components/IconButton.vue rename to docs/.vitepress/theme/components/base/IconButton.vue diff --git a/docs/.vitepress/components/Input.vue b/docs/.vitepress/theme/components/base/Input.vue similarity index 100% rename from docs/.vitepress/components/Input.vue rename to docs/.vitepress/theme/components/base/Input.vue diff --git a/docs/.vitepress/components/InputField.vue b/docs/.vitepress/theme/components/base/InputField.vue similarity index 100% rename from docs/.vitepress/components/InputField.vue rename to docs/.vitepress/theme/components/base/InputField.vue diff --git a/docs/.vitepress/components/InputSearch.vue b/docs/.vitepress/theme/components/base/InputSearch.vue similarity index 96% rename from docs/.vitepress/components/InputSearch.vue rename to docs/.vitepress/theme/components/base/InputSearch.vue index e18794f1b..534210ed7 100644 --- a/docs/.vitepress/components/InputSearch.vue +++ b/docs/.vitepress/theme/components/base/InputSearch.vue @@ -8,7 +8,7 @@ export default { import { computed, ref } from 'vue' import Input from './Input.vue' import createLucideIcon from 'lucide-vue-next/src/createLucideIcon' -import { search } from '../../iconNodes' +import { search } from '../../../data/iconNodes' const SearchIcon = createLucideIcon('search', search) diff --git a/docs/.vitepress/components/LucideIcon.vue b/docs/.vitepress/theme/components/base/LucideIcon.vue similarity index 91% rename from docs/.vitepress/components/LucideIcon.vue rename to docs/.vitepress/theme/components/base/LucideIcon.vue index 873ab6ef8..c16fe061d 100644 --- a/docs/.vitepress/components/LucideIcon.vue +++ b/docs/.vitepress/theme/components/base/LucideIcon.vue @@ -1,5 +1,4 @@