-
-
Notifications
You must be signed in to change notification settings - Fork 364
[Icons] Introduce symfony/ux-icons
#1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.symfony.bundle.yaml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor | ||
/composer.lock | ||
/var | ||
/.phpunit.result.cache |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
branches: ["2.x"] | ||
maintained_branches: ["2.x"] | ||
doc_dir: "doc" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2024-present Fabien Potencier | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# UX Icons | ||
|
||
Renders local and remote SVG icons in your Twig templates. | ||
|
||
```twig | ||
{{ ux_icon('mdi:symfony', {class: 'w-4 h-4'}) }} | ||
{# or #} | ||
<twig:UX:Icon name="mdi:check" class="w-4 h-4" /> | ||
|
||
{# renders as: #} | ||
<svg viewBox="0 0 24 24" fill="currentColor" class="w-4 h-4"><path fill="currentColor" d="M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z"/></svg> | ||
``` | ||
|
||
Want a demo? Check out https://ux.symfony.com/ux-icons. | ||
|
||
**This repository is a READ-ONLY sub-tree split**. See | ||
https://github.com/symfony/ux to create issues or submit pull requests. | ||
|
||
## Sponsor | ||
|
||
The Symfony UX packages are [backed][1] by [Mercure.rocks][2]. | ||
|
||
Create real-time experiences in minutes! Mercure.rocks provides a realtime API service | ||
that is tightly integrated with Symfony: create UIs that update in live with UX Turbo, | ||
send notifications with the Notifier component, expose async APIs with API Platform and | ||
create low level stuffs with the Mercure component. We maintain and scale the complex | ||
infrastructure for you! | ||
|
||
Help Symfony by [sponsoring][3] its development! | ||
|
||
## Resources | ||
|
||
- [Documentation](https://symfony.com/bundles/ux-icons/current/index.html) | ||
- [Report issues](https://github.com/symfony/ux/issues) and | ||
[send Pull Requests](https://github.com/symfony/ux/pulls) | ||
in the [main Symfony UX repository](https://github.com/symfony/ux) | ||
|
||
[1]: https://symfony.com/backers | ||
[2]: https://mercure.rocks | ||
[3]: https://symfony.com/sponsor |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "symfony/ux-icons", | ||
"type": "symfony-bundle", | ||
"description": "Renders local and remote SVG icons in your Twig templates.", | ||
"keywords": [ | ||
"symfony-ux", | ||
"twig", | ||
"icons", | ||
"svg" | ||
], | ||
"homepage": "https://symfony.com", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Symfony Community", | ||
"homepage": "https://symfony.com/contributors" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Symfony\\UX\\Icons\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Symfony\\UX\\Icons\\Tests\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=8.1", | ||
"symfony/framework-bundle": "^6.4|^7.0", | ||
"symfony/twig-bundle": "^6.4|^7.0" | ||
}, | ||
"require-dev": { | ||
"symfony/asset-mapper": "^6.4|^7.0", | ||
"symfony/console": "^6.4|^7.0", | ||
"symfony/http-client": "6.4|^7.0", | ||
"symfony/phpunit-bridge": "^6.3|^7.0", | ||
kbond marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"symfony/ux-twig-component": "^2.14", | ||
"zenstruck/console-test": "^1.5" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"conflict": { | ||
"symfony/flex": "<1.13" | ||
}, | ||
"extra": { | ||
"thanks": { | ||
"name": "symfony/ux", | ||
"url": "https://github.com/symfony/ux" | ||
} | ||
}, | ||
"minimum-stability": "dev" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\Component\AssetMapper\Event\PreAssetsCompileEvent; | ||
use Symfony\UX\Icons\EventListener\WarmIconCacheOnAssetCompileListener; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
->set('.ux_icons.event_listener.warm_icon_cache_on_asset_compile', WarmIconCacheOnAssetCompileListener::class) | ||
->args([ | ||
service('.ux_icons.cache_warmer'), | ||
]) | ||
->tag('kernel.event_listener', [ | ||
'event' => PreAssetsCompileEvent::class, | ||
'method' => '__invoke', | ||
]) | ||
; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\UX\Icons\Command\ImportIconCommand; | ||
use Symfony\UX\Icons\Iconify; | ||
use Symfony\UX\Icons\Registry\IconifyOnDemandRegistry; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
->set('.ux_icons.iconify_on_demand_registry', IconifyOnDemandRegistry::class) | ||
->args([ | ||
service('.ux_icons.iconify'), | ||
]) | ||
->tag('ux_icons.registry') | ||
|
||
->set('.ux_icons.iconify', Iconify::class) | ||
->args([ | ||
abstract_arg('endpoint'), | ||
service('http_client')->nullOnInvalid(), | ||
]) | ||
|
||
->set('.ux_icons.command.import', ImportIconCommand::class) | ||
->args([ | ||
service('.ux_icons.iconify'), | ||
service('.ux_icons.local_svg_icon_registry'), | ||
]) | ||
->tag('console.command') | ||
; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\UX\Icons\Command\WarmCacheCommand; | ||
use Symfony\UX\Icons\IconCacheWarmer; | ||
use Symfony\UX\Icons\IconRenderer; | ||
use Symfony\UX\Icons\Registry\CacheIconRegistry; | ||
use Symfony\UX\Icons\Registry\ChainIconRegistry; | ||
use Symfony\UX\Icons\Registry\LocalSvgIconRegistry; | ||
use Symfony\UX\Icons\Twig\IconFinder; | ||
use Symfony\UX\Icons\Twig\UXIconExtension; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
->set('.ux_icons.cache_icon_registry', CacheIconRegistry::class) | ||
->args([ | ||
service('.ux_icons.chain_registry'), | ||
service('cache.system'), | ||
]) | ||
|
||
->set('.ux_icons.local_svg_icon_registry', LocalSvgIconRegistry::class) | ||
->args([ | ||
abstract_arg('icon_dir'), | ||
]) | ||
->tag('ux_icons.registry', ['priority' => 10]) | ||
|
||
->set('.ux_icons.chain_registry', ChainIconRegistry::class) | ||
->args([ | ||
tagged_iterator('ux_icons.registry'), | ||
]) | ||
|
||
->alias('.ux_icons.icon_registry', '.ux_icons.cache_icon_registry') | ||
|
||
->set('.ux_icons.twig_icon_extension', UXIconExtension::class) | ||
->tag('twig.extension') | ||
|
||
->set('.ux_icons.icon_renderer', IconRenderer::class) | ||
->args([ | ||
service('.ux_icons.icon_registry'), | ||
]) | ||
->tag('twig.runtime') | ||
|
||
->set('.ux_icons.twig_icon_finder', IconFinder::class) | ||
->args([ | ||
service('twig'), | ||
]) | ||
|
||
->set('.ux_icons.cache_warmer', IconCacheWarmer::class) | ||
->args([ | ||
service('.ux_icons.cache_icon_registry'), | ||
service('.ux_icons.twig_icon_finder'), | ||
]) | ||
|
||
->set('.ux_icons.command.warm_cache', WarmCacheCommand::class) | ||
->args([ | ||
service('.ux_icons.cache_warmer'), | ||
]) | ||
->tag('console.command') | ||
; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\UX\Icons\Twig\UXIconComponent; | ||
use Symfony\UX\Icons\Twig\UXIconComponentListener; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
->set('.ux_icons.twig_component_listener', UXIconComponentListener::class) | ||
->args([ | ||
service('.ux_icons.icon_renderer'), | ||
]) | ||
->tag('kernel.event_listener', [ | ||
'event' => 'Symfony\UX\TwigComponent\Event\PreCreateForRenderEvent', | ||
'method' => 'onPreCreateForRender', | ||
]) | ||
|
||
->set('.ux_icons.twig_component.icon', UXIconComponent::class) | ||
->tag('twig.component', ['key' => 'UX:Icon']) | ||
; | ||
}; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.