From 526aacb19246e7448f89510581a90e7933ac0a93 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Thu, 26 Feb 2026 17:08:02 +0100 Subject: [PATCH] Fix types --- docs/.vitepress/lib/SvgPreview/Backdrop.tsx | 2 +- docs/.vitepress/lib/SvgPreview/index.tsx | 2 +- docs/.vitepress/lib/SvgPreview/types.ts | 2 +- .../lib/codeExamples/createCodeExamples.ts | 12 +++---- .../lib/codeExamples/createLabCodeExamples.ts | 31 +------------------ docs/tsconfig.json | 1 + 6 files changed, 11 insertions(+), 39 deletions(-) diff --git a/docs/.vitepress/lib/SvgPreview/Backdrop.tsx b/docs/.vitepress/lib/SvgPreview/Backdrop.tsx index 05d43f68d..ec7121cef 100644 --- a/docs/.vitepress/lib/SvgPreview/Backdrop.tsx +++ b/docs/.vitepress/lib/SvgPreview/Backdrop.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { Fragment } from 'react'; interface BackdropProps { src: string; diff --git a/docs/.vitepress/lib/SvgPreview/index.tsx b/docs/.vitepress/lib/SvgPreview/index.tsx index 27d6f790b..b0a855272 100644 --- a/docs/.vitepress/lib/SvgPreview/index.tsx +++ b/docs/.vitepress/lib/SvgPreview/index.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { Fragment } from 'react'; import { PathProps, Path } from './types'; import getPaths, { assert } from './utils'; import { GapViolationHighlight } from './GapViolationHighlight.tsx'; diff --git a/docs/.vitepress/lib/SvgPreview/types.ts b/docs/.vitepress/lib/SvgPreview/types.ts index 8c1b8f4ed..ecfe201db 100644 --- a/docs/.vitepress/lib/SvgPreview/types.ts +++ b/docs/.vitepress/lib/SvgPreview/types.ts @@ -8,7 +8,7 @@ export type Path = { prev: Point; next: Point; isStart: boolean; - circle?: { x: number; y: number; r: number }; + circle?: { x: number; y: number; r: number; tangentIntersection?: Point }; cp1?: Point; cp2?: Point; c: ReturnType[number]; diff --git a/docs/.vitepress/lib/codeExamples/createCodeExamples.ts b/docs/.vitepress/lib/codeExamples/createCodeExamples.ts index eb6313431..e3208c51f 100644 --- a/docs/.vitepress/lib/codeExamples/createCodeExamples.ts +++ b/docs/.vitepress/lib/codeExamples/createCodeExamples.ts @@ -113,16 +113,16 @@ import { LucideAngularModule, $PascalCase } from 'lucide-angular'; ]; }; +const highlighter = await createHighlighter({ + themes: ['github-light', 'github-dark'], + langs: Object.keys(bundledLanguages), +}); + export type ThemeOptions = | ThemeRegistration | { light: ThemeRegistration; dark: ThemeRegistration }; -const highLightCode = async (code: string, lang: string, active?: boolean) => { - const highlighter = await createHighlighter({ - themes: ['github-light', 'github-dark'], - langs: Object.keys(bundledLanguages), - }); - +export const highLightCode = async (code: string, lang: string, active?: boolean) => { const highlightedCode = highlighter .codeToHtml(code, { lang, diff --git a/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts b/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts index a38772523..24d1a41d8 100644 --- a/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts +++ b/docs/.vitepress/lib/codeExamples/createLabCodeExamples.ts @@ -1,5 +1,4 @@ -import { bundledLanguages, type ThemeRegistration } from 'shiki'; -import { createHighlighter } from 'shiki'; +import { highLightCode } from './createCodeExamples'; type CodeExampleType = { title: string; @@ -116,34 +115,6 @@ import { $CamelCase } from '@lucide/lab'; ]; }; -export type ThemeOptions = - | ThemeRegistration - | { light: ThemeRegistration; dark: ThemeRegistration }; - -const highLightCode = async (code: string, lang: string, active?: boolean) => { - const highlighter = await createHighlighter({ - themes: ['github-light', 'github-dark'], - langs: Object.keys(bundledLanguages), - }); - - const highlightedCode = highlighter - .codeToHtml(code, { - lang, - themes: { - light: 'github-light', - dark: 'github-dark', - }, - defaultColor: false, - }) - .replace('shiki-themes', 'shiki-themes vp-code'); - - return `
- - ${lang} - ${highlightedCode} -
`; -}; - export default async function createCodeExamples() { const codes = getIconCodes(); diff --git a/docs/tsconfig.json b/docs/tsconfig.json index 2503722e4..186a4ca35 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "jsx": "react", "jsxFactory": "React.createElement", + "jsxFragmentFactory": "React.Fragment", "allowImportingTsExtensions": true, "allowSyntheticDefaultImports": true, "noEmit": true,