Swap emoji and unicode glyphs for Tabler components so icons inherit currentColor and font-size and render consistently across platforms. - add src/components/doc-icons.ts to resolve doc-entry frontmatter icon keys to components; frontmatter now stores semantic keys - replace the align-*.png assets with TbOutlineAlign* icons - render RevealManager action SVGs as components instead of injected innerHTML strings - carry completion icons via an optional CompletionItem.icon field
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
/**
|
|
* Icon registry for built-in doc entries.
|
|
*
|
|
* Doc-entry frontmatter `icon:` values are semantic keys (e.g. `dice`), not
|
|
* glyphs — YAML can't reference a component. This maps each key to a Tabler
|
|
* icon component; unknown keys fall back to a generic file icon.
|
|
*/
|
|
|
|
import type { IconTypes } from "solid-icons";
|
|
import {
|
|
TbOutlineCards,
|
|
TbOutlineDice5,
|
|
TbOutlineFile,
|
|
TbOutlineFileText,
|
|
TbOutlineGitBranch,
|
|
TbOutlineHash,
|
|
TbOutlineLink,
|
|
TbOutlineMapPin,
|
|
TbOutlinePhoto,
|
|
TbOutlineSparkles,
|
|
TbOutlineSquare,
|
|
TbOutlineTable,
|
|
TbOutlineTheater,
|
|
TbOutlineTypography,
|
|
} from "solid-icons/tb";
|
|
|
|
const DOC_ICONS: Record<string, IconTypes> = {
|
|
dice: TbOutlineDice5,
|
|
table: TbOutlineTable,
|
|
link: TbOutlineLink,
|
|
pins: TbOutlineMapPin,
|
|
font: TbOutlineTypography,
|
|
background: TbOutlinePhoto,
|
|
border: TbOutlineSquare,
|
|
embed: TbOutlineFileText,
|
|
deck: TbOutlineCards,
|
|
yarn: TbOutlineGitBranch,
|
|
gm: TbOutlineTheater,
|
|
player: TbOutlineDice5,
|
|
roll: TbOutlineDice5,
|
|
set: TbOutlineHash,
|
|
spark: TbOutlineSparkles,
|
|
};
|
|
|
|
/** Resolve a frontmatter icon key to a Tabler icon component. */
|
|
export function docIcon(key: string): IconTypes {
|
|
return DOC_ICONS[key] ?? TbOutlineFile;
|
|
}
|