feat(icon): add ItIconRegistryService for custom SVG icons#685
Open
giulio-leone wants to merge 2 commits into
Open
feat(icon): add ItIconRegistryService for custom SVG icons#685giulio-leone wants to merge 2 commits into
giulio-leone wants to merge 2 commits into
Conversation
- Create ItIconRegistryService (providedIn: 'root') for registering custom SVG icons by name (inline SVG content or external sprite refs) - Modify ItIconComponent to check registry first, then fall back to built-in Bootstrap Italia sprite - Widen name input type to accept IconName | string for custom names - Support three registration methods: registerIcon (inline SVG), registerIcons (bulk), registerIconFromSprite (external sprite) - Custom icons take precedence over built-in sprites on name collision - Add 27 comprehensive tests covering: inline SVG rendering, sprite rendering, CSS class propagation, accessibility, collision handling, bulk registration, removal, and registry unit operations - Export ItIconRegistryService from public_api.ts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Show inline SVG registration, batch registration, and external sprite registration with ItIconRegistryService. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@giulio-leone is attempting to deploy a commit to the dip-trasformazione-digitale Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #563
What
Adds
ItIconRegistryService— a root-provided service that allows registering custom SVG icons by name, so they can be rendered using<it-icon name="my-custom">alongside built-in Bootstrap Italia sprite icons.How it works
Three registration methods:
Inline SVG —
registerIcon(name, svgContent)/registerIcons(record)External sprite —
registerIconFromSprite(name, url, fragmentId)Bulk —
registerIcons(icons)Resolution priority: Custom inline SVG → Custom sprite → Built-in BI sprite
Component changes:
ItIconComponentnow injectsItIconRegistryServiceand checks it before falling back to the built-in sprite@if (isCustomInlineSvg)to conditionally render<g [innerHTML]>for inline SVGs vs<use>for spritesnameinput type widened toIconName | stringto accept custom namesAPI surface
Test coverage
27 new tests covering:
<g>)<use>)<use>)136/136 tests passing, 0 lint errors (only pre-existing warnings).