Files
lucide/docs/.vitepress/lib/SvgPreview/utils.ts

301 lines
8.3 KiB
TypeScript
Raw Normal View History

Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
import { INode, parseSync } from 'svgson';
import toPath from 'element-to-path';
import { SVGPathData, encodeSVGPath } from 'svg-pathdata';
import { Path, Point } from './types';
function assertNever(x: never): never {
throw new Error('Unknown type: ' + x['type']);
}
export function assert(value: unknown): asserts value {
if (value === undefined) {
throw new Error('value must be defined');
}
}
const convertToPathNode = (node: INode): { d: string; name: typeof node.name } => {
if (node.name === 'path') {
return { d: node.attributes.d, name: node.name };
}
if (node.name === 'circle') {
const cx = parseFloat(node.attributes.cx);
const cy = parseFloat(node.attributes.cy);
const r = parseFloat(node.attributes.r);
return {
d: [
`M ${cx} ${cy - r}`,
`a ${r} ${r} 0 0 1 ${r} ${r}`,
`a ${r} ${r} 0 0 1 ${0 - r} ${r}`,
`a ${r} ${r} 0 0 1 ${0 - r} ${0 - r}`,
`a ${r} ${r} 0 0 1 ${r} ${0 - r}`,
].join(''),
name: node.name,
};
}
return { d: toPath(node).replace(/z$/i, ''), name: node.name };
};
const extractNodes = (node: INode): INode[] => {
if (['rect', 'circle', 'ellipse', 'polygon', 'polyline', 'line', 'path'].includes(node.name)) {
return [node];
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
} else if (node.children && Array.isArray(node.children)) {
return node.children.flatMap(extractNodes);
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
}
return [];
};
export const getNodes = (src: string) =>
extractNodes(parseSync(src.includes('<svg') ? src : `<svg>${src}</svg>`));
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
export const getCommands = (src: string) =>
getNodes(src)
.map(convertToPathNode)
.flatMap(({ d, name }, idx) =>
new SVGPathData(d).toAbs().commands.map((c, cIdx) => ({ ...c, id: idx, idx: cIdx, name })),
);
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
export const getPaths = (src: string) => {
const commands = getCommands(src.includes('<svg') ? src : `<svg>${src}</svg>`);
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
const paths: Path[] = [];
let prev: Point | undefined = undefined;
let start: Point | undefined = undefined;
const addPath = (
c: (typeof commands)[number],
next: Point,
d?: string,
extras?: { circle?: Path['circle']; cp1?: Path['cp1']; cp2?: Path['cp2'] },
) => {
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
assert(prev);
paths.push({
c,
d: d || `M ${prev.x} ${prev.y} L ${next.x} ${next.y}`,
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
prev,
next,
...extras,
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
isStart: start === prev,
});
prev = next;
};
let prevCP: Point | undefined = undefined;
for (let i = 0; i < commands.length; i++) {
const previousCommand = commands[i - 1];
const c = commands[i];
switch (c.type) {
case SVGPathData.MOVE_TO: {
prev = c;
start = c;
break;
}
case SVGPathData.LINE_TO: {
assert(prev);
addPath(c, c);
break;
}
case SVGPathData.HORIZ_LINE_TO: {
assert(prev);
addPath(c, { x: c.x, y: prev.y });
break;
}
case SVGPathData.VERT_LINE_TO: {
assert(prev);
addPath(c, { x: prev.x, y: c.y });
break;
}
case SVGPathData.CLOSE_PATH: {
assert(prev);
assert(start);
addPath(c, start);
start = undefined;
break;
}
case SVGPathData.CURVE_TO: {
assert(prev);
addPath(c, c, `M ${prev.x} ${prev.y} ${encodeSVGPath(c)}`, {
cp1: { x: c.x1, y: c.y1 },
cp2: { x: c.x2, y: c.y2 },
});
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
break;
}
case SVGPathData.SMOOTH_CURVE_TO: {
assert(prev);
assert(previousCommand);
const reflectedCp1 = {
x:
previousCommand &&
(previousCommand.type === SVGPathData.SMOOTH_CURVE_TO ||
previousCommand.type === SVGPathData.CURVE_TO)
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
? previousCommand.relative
? previousCommand.x2 - previousCommand.x
: previousCommand.x2 - prev.x
: 0,
y:
previousCommand &&
(previousCommand.type === SVGPathData.SMOOTH_CURVE_TO ||
previousCommand.type === SVGPathData.CURVE_TO)
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
? previousCommand.relative
? previousCommand.y2 - previousCommand.y
: previousCommand.y2 - prev.y
: 0,
};
addPath(
c,
c,
`M ${prev.x} ${prev.y} ${encodeSVGPath({
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
type: SVGPathData.CURVE_TO,
relative: false,
x: c.x,
y: c.y,
x1: prev.x - reflectedCp1.x,
y1: prev.y - reflectedCp1.y,
x2: c.x2,
y2: c.y2,
})}`,
{
cp1: { x: prev.x - reflectedCp1.x, y: prev.y - reflectedCp1.y },
cp2: { x: c.x2, y: c.y2 },
},
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
);
break;
}
case SVGPathData.QUAD_TO: {
assert(prev);
addPath(c, c, `M ${prev.x} ${prev.y} ${encodeSVGPath(c)}`, {
cp1: { x: c.x1, y: c.y1 },
cp2: { x: c.x1, y: c.y1 },
});
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
break;
}
case SVGPathData.SMOOTH_QUAD_TO: {
assert(prev);
const backTrackCP = (
index: number,
currentPoint: { x: number; y: number },
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
): { x: number; y: number } => {
const previousCommand = commands[index - 1];
if (!previousCommand) {
return currentPoint;
}
if (previousCommand.type === SVGPathData.QUAD_TO) {
return {
x: previousCommand.relative
? currentPoint.x - (previousCommand.x1 - previousCommand.x)
: currentPoint.x - (previousCommand.x1 - currentPoint.x),
y: previousCommand.relative
? currentPoint.y - (previousCommand.y1 - previousCommand.y)
: currentPoint.y - (previousCommand.y1 - currentPoint.y),
};
}
if (previousCommand.type === SVGPathData.SMOOTH_QUAD_TO) {
if (!prevCP) {
return currentPoint;
}
return {
x: currentPoint.x - (prevCP.x - currentPoint.x),
y: currentPoint.y - (prevCP.y - currentPoint.y),
};
}
return currentPoint;
};
prevCP = backTrackCP(i, prev);
addPath(
c,
c,
`M ${prev.x} ${prev.y} ${encodeSVGPath({
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
type: SVGPathData.QUAD_TO,
relative: false,
x: c.x,
y: c.y,
x1: prevCP.x,
y1: prevCP.y,
})}`,
{
cp1: { x: prevCP.x, y: prevCP.y },
cp2: { x: prevCP.x, y: prevCP.y },
},
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
);
break;
}
case SVGPathData.ARC: {
assert(prev);
const center = arcEllipseCenter(
prev.x,
prev.y,
c.rX,
c.rY,
c.xRot,
c.lArcFlag,
c.sweepFlag,
c.x,
c.y,
);
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
addPath(
c,
c,
`M ${prev.x} ${prev.y} A${c.rX} ${c.rY} ${c.xRot} ${c.lArcFlag} ${c.sweepFlag} ${c.x} ${c.y}`,
{ circle: c.rX === c.rY ? { ...center, r: c.rX } : undefined },
Added github comment icon workflow (#946) * feat: added github comment icon workflow * feat: improved segment node styling * feat: improved segment node styling * fix: fixed grid alignment issue * chore: cleanup * fix: added ref forwarding to SvgPreview component * chore: removed svg preview from icon detail overlay * chore: updated tj-actions/changed-files * chore: switched to pull_request_target * chore: simplified path segment highlighting logic * Fixes incorrect relative links in documentation pages (#973) * Fixes incorrect relative links in documentation pages * Unifies documentation page names to avoid 404 links --------- Co-authored-by: Karsa <karsa@karsa.org> * Add forklift icon (#943) * Fix vercel build * Add forklift icon Co-Authored-By: willythewizard <119956499+willythewizard@users.noreply.github.com> --------- Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> * adds utility-pole icon (#971) Co-authored-by: Karsa <karsa@karsa.org> * :package: Bump lucide package versions to 0.123.0 * Adds `nfc` icons (#960) * added nfc icons * fixes smartphone-nfc * Update icons/nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> * Update icons/smartphone-nfc.svg Co-authored-by: Jakob Guddas <github@jguddas.de> --------- Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Jakob Guddas <github@jguddas.de> * :package: Bump lucide package versions to 0.124.0 * fix: updated pnpm-lock.yaml * fix: added missing api endpoint file * chore: fixed nextjs path name parsing in production * chore: only run workflow when path includes icons/*.svg * chore: added Cache-Control header to gh-icon api route response * feat: added dark mode support to gh-icon * feat: switched to using picture tag for gh-icon * feat: added space between gh-icons in pr comment * fix: changed icon size base back to 24x24 * feat: added title to gh-icon comment image * fix: changed gh-icon url * chore: added groups with class names * feat: improved shadow masking * Removes need for building duplicate icons by supporting CSS based dark mode * chore: resolved type issues * feat: changed image width from 48% to 400px --------- Co-authored-by: Karsa <contact@karsa.org> Co-authored-by: Karsa <karsa@karsa.org> Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: willythewizard <119956499+willythewizard@users.noreply.github.com> Co-authored-by: Lucide Bot <lucide-bot@users.noreply.github.com>
2023-04-03 21:05:59 +02:00
);
break;
}
default: {
assertNever(c);
}
}
}
return paths;
};
export const arcEllipseCenter = (
x1: number,
y1: number,
rx: number,
ry: number,
a: number,
fa: number,
fs: number,
x2: number,
y2: number,
) => {
const phi = (a * Math.PI) / 180;
const M = [
[Math.cos(phi), Math.sin(phi)],
[-Math.sin(phi), Math.cos(phi)],
];
const V = [(x1 - x2) / 2, (y1 - y2) / 2];
const [x1p, y1p] = [M[0][0] * V[0] + M[0][1] * V[1], M[1][0] * V[0] + M[1][1] * V[1]];
rx = Math.abs(rx);
ry = Math.abs(ry);
const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);
if (lambda > 1) {
rx = Math.sqrt(lambda) * rx;
ry = Math.sqrt(lambda) * ry;
}
const sign = fa === fs ? -1 : 1;
const co =
sign *
Math.sqrt(
Math.max(rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p, 0) /
(rx * rx * y1p * y1p + ry * ry * x1p * x1p),
);
const V2 = [(rx * y1p) / ry, (-ry * x1p) / rx];
const Cp = [V2[0] * co, V2[1] * co];
const M2 = [
[Math.cos(phi), -Math.sin(phi)],
[Math.sin(phi), Math.cos(phi)],
];
const V3 = [(x1 + x2) / 2, (y1 + y2) / 2];
const C = [
M2[0][0] * Cp[0] + M2[0][1] * Cp[1] + V3[0],
M2[1][0] * Cp[0] + M2[1][1] * Cp[1] + V3[1],
];
return { x: C[0], y: C[1] };
};