Refactor SVG inlining from md-icon into cdk-svg
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
The SVG inlining features of md-icon are more generally useful than for just displaying icons. We should refactor the code such that:
* The SVG portions of `MdIconRegistry` are moved to `IconRegistry` in the cdk, with `MdIconRegistry` then extending `IconRegistry`
* The SVG inlining code in `md-icon` is moved into `cdk-svg` with `md-icon` then consuming `cdk-svg`.
This will enable us to add additional APIs to `cdk-svg` around customizing `viewBox` and `preserveAspectRatio` (see https://css-tricks.com/scale-svg)
Notes:
* Part of this should be moving SVG parsing (i.e. `string` -> `SVGElement`) into its own utility that can be mocked. This will be useful when ensuring that parsing only happens when expected (since it can have performance impacts if overdone).
Contributor guide
Research direction
Locate the current SVG portions of MdIconRegistry and the SVG inlining code used by md-icon, then compare them with the cdk IconRegistry and cdk-svg entry points. The refactor is done when SVG registry behavior and inlining are provided by the CDK, MdIconRegistry extends IconRegistry, md-icon consumes cdk-svg, and SVG parsing is isolated in a mockable utility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100