mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-14 13:58:21 +00:00
Format code
This commit is contained in:
@@ -34,7 +34,7 @@ export default eventHandler((event) => {
|
||||
const iconNode = iconNodes[backdropName];
|
||||
|
||||
const LucideIcon = createLucideIcon(backdropName, iconNode);
|
||||
const svg = renderToStaticMarkup(<LucideIcon/>);
|
||||
const svg = renderToStaticMarkup(<LucideIcon />);
|
||||
const backdropString = svg.replaceAll('\n', '').replace(/<svg[^>]*>|<\/svg>/g, '');
|
||||
|
||||
children.push(
|
||||
@@ -42,7 +42,7 @@ export default eventHandler((event) => {
|
||||
backdropString={backdropString}
|
||||
src={src.replace(/<svg[^>]*>|<\/svg>/g, '')}
|
||||
color="#777"
|
||||
/>
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,12 +52,11 @@ export default eventHandler((event) => {
|
||||
return renderToString(
|
||||
<SvgPreview
|
||||
src={src.replace(/<svg[^>]*>|<\/svg>/g, '')}
|
||||
|
||||
showGrid
|
||||
height={height}
|
||||
width={width}
|
||||
>
|
||||
{children}
|
||||
</SvgPreview>
|
||||
)
|
||||
</SvgPreview>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -26,10 +26,10 @@ export default eventHandler((event) => {
|
||||
|
||||
const children = [];
|
||||
|
||||
const Icon = createLucideIcon(name, iconNodes[name])
|
||||
const Icon = createLucideIcon(name, iconNodes[name]);
|
||||
|
||||
const oldSrc = iconNodes[name]
|
||||
? renderToStaticMarkup(<Icon/>)
|
||||
? renderToStaticMarkup(<Icon />)
|
||||
.replaceAll('\n', '')
|
||||
.replace(/<svg[^>]*>|<\/svg>/g, '')
|
||||
: '';
|
||||
@@ -46,6 +46,6 @@ export default eventHandler((event) => {
|
||||
width={width}
|
||||
>
|
||||
{children}
|
||||
</Diff>
|
||||
)
|
||||
</Diff>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ export default eventHandler((event) => {
|
||||
const src = Buffer.from(data, 'base64').toString('utf8');
|
||||
const iconNode = parseSync(src.includes('<svg') ? src : `<svg>${src}</svg>`).children.map(
|
||||
({ name, attributes }) => [name, attributes],
|
||||
) as IconNode
|
||||
) as IconNode;
|
||||
|
||||
defaultContentType(event, 'image/svg+xml');
|
||||
setResponseHeader(event, 'Cache-Control', 'public,max-age=31536000');
|
||||
@@ -25,13 +25,13 @@ export default eventHandler((event) => {
|
||||
strokeWidth={strokeWidth}
|
||||
>
|
||||
<style>
|
||||
{ `@media screen and (prefers-color-scheme: light) {
|
||||
{`@media screen and (prefers-color-scheme: light) {
|
||||
svg { fill: transparent !important; }
|
||||
}
|
||||
@media screen and (prefers-color-scheme: dark) {
|
||||
svg { stroke: #fff; fill: transparent !important; }
|
||||
}`}
|
||||
</style>
|
||||
</Icon>
|
||||
)
|
||||
</Icon>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -53,6 +53,6 @@ export default eventHandler((event) => {
|
||||
width={width}
|
||||
>
|
||||
{children}
|
||||
</Diff>
|
||||
)
|
||||
</Diff>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -397,7 +397,10 @@ interface SvgPreviewProps extends React.SVGProps<SVGSVGElement> {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
const SvgPreview = ({ src, children, height = 24, width = 24, showGrid = false, ...props }: SvgPreviewProps, ref) => {
|
||||
const SvgPreview = (
|
||||
{ src, children, height = 24, width = 24, showGrid = false, ...props }: SvgPreviewProps,
|
||||
ref,
|
||||
) => {
|
||||
const subGridSize =
|
||||
Math.max(height, width) % 3 === 0
|
||||
? Math.max(height, width) > 24
|
||||
|
||||
@@ -22,27 +22,23 @@ const iconAliasesRedirectRoutes = Object.entries(iconMetaData)
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
const vercelOutputJSON = path.resolve(currentDir, '.vercel/output/config.json');
|
||||
|
||||
const vercelConfig = await fs.promises.readFile(vercelOutputJSON, 'utf-8');
|
||||
|
||||
const vercelRouteConfig = JSON.parse(vercelConfig);
|
||||
|
||||
vercelRouteConfig.routes = [
|
||||
...iconAliasesRedirectRoutes,
|
||||
...vercelRouteConfig.routes,
|
||||
]
|
||||
vercelRouteConfig.routes = [...iconAliasesRedirectRoutes, ...vercelRouteConfig.routes];
|
||||
|
||||
// Adjust the existing catch-all route to only catch API routes, so that we can add a new catch-all route for 404s
|
||||
const allCatchRoute = '/(.*)';
|
||||
const fallBackIndex = vercelRouteConfig.routes.findIndex(route => route.src === allCatchRoute);
|
||||
const fallBackIndex = vercelRouteConfig.routes.findIndex((route) => route.src === allCatchRoute);
|
||||
|
||||
vercelRouteConfig.routes[fallBackIndex].src = '/api/(.*)'
|
||||
vercelRouteConfig.routes[fallBackIndex].src = '/api/(.*)';
|
||||
vercelRouteConfig.routes.push({
|
||||
src: allCatchRoute,
|
||||
dest: '/404.html',
|
||||
})
|
||||
});
|
||||
|
||||
const output = JSON.stringify(vercelRouteConfig, null, 2);
|
||||
|
||||
|
||||
+1
-3
@@ -8,9 +8,7 @@
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"~/.vitepress/*": [
|
||||
"./.vitepress/*"
|
||||
],
|
||||
"~/.vitepress/*": ["./.vitepress/*"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user