Skip to content

refactor(svg): move FONT_MAP out of generator.ts into a dedicated lib/svg/fonts.ts module #292

@JhaSourav07

Description

@JhaSourav07

🧩 Background

FONT_MAP in lib/svg/generator.ts maps shorthand keys to full CSS font stacks. As more fonts are added, keeping it in the generator inflates an already large file.

🎯 Objective

Move FONT_MAP and font-resolution logic into lib/svg/fonts.ts and re-export it from generator.ts.

📁 Files to touch

  • lib/svg/generator.ts
  • lib/svg/fonts.ts (new)

🛠️ Implementation steps

  • Create lib/svg/fonts.ts exporting FONT_MAP and a resolveFont(font?: string): string | null helper.
  • Import and use in generator.ts.
  • Add unit tests for resolveFont covering predefined, dynamic, and invalid inputs.

✅ Definition of done

  • generator.ts no longer contains the font map.
  • resolveFont is unit-tested.
  • All existing generator tests pass.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions