From 3e34e8dc6b8c482999a778a2ba08a2f67fc44852 Mon Sep 17 00:00:00 2001 From: "Azat S." Date: Fri, 15 Nov 2024 00:08:19 +0300 Subject: [PATCH] refactor: improve code quality --- data/themes.ts | 2 +- docs/adapters/netlify-edge/vite.config.ts | 2 +- docs/blocks/demo/index.tsx | 2 +- docs/blocks/head/index.tsx | 30 +-- docs/elements/code/index.tsx | 19 +- docs/elements/color-list/index.tsx | 20 +- docs/elements/icon-item/index.tsx | 2 +- docs/elements/icon/index.tsx | 16 +- docs/elements/theme-dropdown/index.tsx | 33 +-- docs/elements/theme-select/index.tsx | 14 +- docs/elements/theme/index.tsx | 17 +- docs/entry.dev.tsx | 5 +- docs/entry.ssr.tsx | 15 +- docs/hooks/use-click-outside.ts | 12 +- docs/mocks/vscode.ts | 4 +- docs/routes/layout.tsx | 2 +- docs/routes/service-worker.ts | 2 +- docs/typings/index.d.ts | 191 ++++++++++++++++++ docs/utils/create-highlighter.ts | 11 +- ...te-css-vars.ts => update-css-variables.ts} | 31 +-- extension/colorize/check-contrast.ts | 2 +- extension/colorize/color-pattern.ts | 6 +- extension/colorize/index.ts | 2 +- extension/colorize/override.ts | 5 +- extension/colorize/recolor-folder.ts | 7 +- extension/colorize/recolor.ts | 4 +- extension/colorize/to-rgb.ts | 2 +- extension/index.ts | 18 +- extension/utils/console.ts | 8 +- scripts/generate-preview.ts | 22 +- test/colorize/recolor.test.ts | 12 +- test/colorize/to-rgb.test.ts | 2 +- tsconfig.json | 2 +- ...ig.docs.ts => vite.config.documentation.ts | 0 vite.config.extension.ts | 63 +++--- 35 files changed, 417 insertions(+), 168 deletions(-) create mode 100644 docs/typings/index.d.ts rename docs/utils/{update-css-vars.ts => update-css-variables.ts} (71%) rename vite.config.docs.ts => vite.config.documentation.ts (100%) diff --git a/data/themes.ts b/data/themes.ts index 976c716..f362730 100644 --- a/data/themes.ts +++ b/data/themes.ts @@ -91,7 +91,7 @@ export let themes = [ }, ] -export let getThemeNameById = (id: string) => { +export let getThemeNameById = (id: string): string => { let theme = themes.find(themeValue => themeValue.id === id) return theme ? theme.name : '' } diff --git a/docs/adapters/netlify-edge/vite.config.ts b/docs/adapters/netlify-edge/vite.config.ts index 7002b3e..b6ec12f 100644 --- a/docs/adapters/netlify-edge/vite.config.ts +++ b/docs/adapters/netlify-edge/vite.config.ts @@ -2,7 +2,7 @@ import { netlifyEdgeAdapter } from '@builder.io/qwik-city/adapters/netlify-edge/ import { extendConfig } from '@builder.io/qwik-city/vite' import path from 'node:path' -import baseConfig from '../../../vite.config.docs' +import baseConfig from '../../../vite.config.documentation' export default extendConfig(baseConfig, () => ({ build: { diff --git a/docs/blocks/demo/index.tsx b/docs/blocks/demo/index.tsx index caa4ac4..2e08c5b 100644 --- a/docs/blocks/demo/index.tsx +++ b/docs/blocks/demo/index.tsx @@ -37,7 +37,7 @@ export let Demo = component$(() => ( {fileIcons.map(icon => ( - + ))} diff --git a/docs/blocks/head/index.tsx b/docs/blocks/head/index.tsx index 3871b52..8b47a25 100644 --- a/docs/blocks/head/index.tsx +++ b/docs/blocks/head/index.tsx @@ -1,7 +1,7 @@ import { useDocumentHead, useLocation } from '@builder.io/qwik-city' import { component$ } from '@builder.io/qwik' -export const Head = component$(() => { +export let Head = component$(() => { let head = useDocumentHead() let loc = useLocation() @@ -18,31 +18,31 @@ export const Head = component$(() => { - {head.meta.map(m => ( - + {head.meta.map(meta => ( + ))} - {head.links.map(l => ( - + {head.links.map(link => ( + ))} - {head.styles.map(s => ( + {head.styles.map(style => (