Repository: symfony/ux
Pull request #1865 (2024-05-23 12:43:40)

Use version instead of url in docs

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  |no <!-- please update src/**/CHANGELOG.md files -->
| Issues        | 
| License       | MIT

See symfony/symfony@1b79ae6


Patch:
diff --git a/src/Autocomplete/translations/AutocompleteBundle.sk.php b/src/Autocomplete/translations/AutocompleteBundle.sk.php
deleted file mode 100644
index 87f71bde..00000000
--- a/src/Autocomplete/translations/AutocompleteBundle.sk.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-return [
-    'Loading more results...' => 'Načítavajú sa ďalšie výsledky...',
-    'No results found' => 'Neboli nájdené žiadne výsledky',
-    'No more results' => 'Žiadne ďalšie výsledky',
-];
diff --git a/src/StimulusBundle/doc/index.rst b/src/StimulusBundle/doc/index.rst
index 40199dfa..5c54c90f 100644
--- a/src/StimulusBundle/doc/index.rst
+++ b/src/StimulusBundle/doc/index.rst
@@ -419,7 +419,7 @@ file::
             'path' => '@symfony/stimulus-bundle/loader.js',
         ],
         '@hotwired/stimulus' => [
-            'url' => 'https://ga.jspm.io/npm:@hotwired/stimulus@3.2.1/dist/stimulus.js',
+            'version' => '3.2.2',
         ],
     ];
 
diff --git a/ux.symfony.com/assets/images/ux_packages/icons.svg b/ux.symfony.com/assets/images/ux_packages/icons.svg
deleted file mode 100644
index 34b96100..00000000
--- a/ux.symfony.com/assets/images/ux_packages/icons.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-<svg width="59" height="58" viewBox="0 0 59 58" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M24.734 20.1523C25.5321 20.7908 25.6615 21.9554 25.023 22.7535L20.0258 29L25.023 35.2465C25.6615 36.0446 25.5321 37.2092 24.734 37.8477C23.9359 38.4862 22.7713 38.3568 22.1328 37.5587L16.2107 30.1561C15.67 29.4802 15.67 28.5198 16.2107 27.8439L22.1328 20.4413C22.7713 19.6432 23.9359 19.5138 24.734 20.1523Z" fill="white"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M34.266 20.1523C35.0641 19.5138 36.2287 19.6432 36.8672 20.4413L42.7893 27.8439C43.33 28.5198 43.33 29.4802 42.7893 30.1561L36.8672 37.5587C36.2287 38.3568 35.0641 38.4862 34.266 37.8477C33.4679 37.2092 33.3385 36.0446 33.977 35.2465L38.9742 29L33.977 22.7535C33.3385 21.9554 33.4679 20.7908 34.266 20.1523Z" fill="white"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M8.77273 4.2013C6.52414 4.2013 4.7013 6.02414 4.7013 8.27273V49.7273C4.7013 51.9759 6.52414 53.7987 8.77273 53.7987H50.2273C52.4759 53.7987 54.2987 51.9759 54.2987 49.7273V8.27273C54.2987 6.02414 52.4759 4.2013 50.2273 4.2013H8.77273ZM1 8.27273C1 3.97997 4.47997 0.5 8.77273 0.5H50.2273C54.52 0.5 58 3.97997 58 8.27273V49.7273C58 54.02 54.52 57.5 50.2273 57.5H8.77273C4.47997 57.5 1 54.02 1 49.7273V8.27273Z" fill="white"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M24.734 20.1523C25.5321 20.7908 25.6615 21.9554 25.023 22.7535L20.0258 29L25.023 35.2465C25.6615 36.0446 25.5321 37.2092 24.734 37.8477C23.9359 38.4862 22.7713 38.3568 22.1328 37.5587L16.2107 30.1561C15.67 29.4802 15.67 28.5198 16.2107 27.8439L22.1328 20.4413C22.7713 19.6432 23.9359 19.5138 24.734 20.1523Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M34.266 20.1523C35.0641 19.5138 36.2287 19.6432 36.8672 20.4413L42.7893 27.8439C43.33 28.5198 43.33 29.4802 42.7893 30.1561L36.8672 37.5587C36.2287 38.3568 35.0641 38.4862 34.266 37.8477C33.4679 37.2092 33.3385 36.0446 33.977 35.2465L38.9742 29L33.977 22.7535C33.3385 21.9554 33.4679 20.7908 34.266 20.1523Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M8.77273 4.2013C6.52414 4.2013 4.7013 6.02414 4.7013 8.27273V49.7273C4.7013 51.9759 6.52414 53.7987 8.77273 53.7987H50.2273C52.4759 53.7987 54.2987 51.9759 54.2987 49.7273V8.27273C54.2987 6.02414 52.4759 4.2013 50.2273 4.2013H8.77273ZM1 8.27273C1 3.97997 4.47997 0.5 8.77273 0.5H50.2273C54.52 0.5 58 3.97997 58 8.27273V49.7273C58 54.02 54.52 57.5 50.2273 57.5H8.77273C4.47997 57.5 1 54.02 1 49.7273V8.27273Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>
diff --git a/ux.symfony.com/assets/styles/components/_Terminal.scss b/ux.symfony.com/assets/styles/components/_Terminal.scss
index 60be7230..996a79a0 100644
--- a/ux.symfony.com/assets/styles/components/_Terminal.scss
+++ b/ux.symfony.com/assets/styles/components/_Terminal.scss
@@ -8,10 +8,6 @@
     font-size: 12px;
 }
 
-.Terminal_light {
-    --header-opacity: .25;
-}
-
 .Terminal_header {
     display: flex;
     background-color: var(--bg-header, #0D0D0DBA);
@@ -25,7 +21,6 @@
 
     .Terminal:hover & {
         opacity: 1;
-         transition: all 350ms ease-out;
     }
 
     .nav-tabs {
@@ -63,11 +58,6 @@
     code {
         font-size: inherit;
         opacity: .8;
-
-        em {
-            font-style: normal;
-            color: #77d1e0 !important;
-        }
     }
 }
 
@@ -207,17 +197,3 @@
     color: #fff !important;
     opacity: 1;
 }
-
-.Terminal .hl-gutter  {
-    display: inline-flex;
-  font-size: 0.8em;
-  color: #474747;
-  padding: 0 1ch 0 0;
-  user-select: none;
-  margin-inline-start: -1ch;
-    opacity: 0;
-    transition: all 250ms;
-}
-.Terminal:hover .hl-gutter  {
-    opacity: 1;
-}
diff --git a/ux.symfony.com/composer.json b/ux.symfony.com/composer.json
index 3fcced82..d517c371 100644
--- a/ux.symfony.com/composer.json
+++ b/ux.symfony.com/composer.json
@@ -38,7 +38,6 @@
         "symfony/ux-chartjs": "2.x-dev",
         "symfony/ux-cropperjs": "2.x-dev",
         "symfony/ux-dropzone": "2.x-dev",
-        "symfony/ux-icons": "^2.17",
         "symfony/ux-lazy-image": "2.x-dev",
         "symfony/ux-live-component": "2.x-dev",
         "symfony/ux-notify": "2.x-dev",
diff --git a/ux.symfony.com/composer.lock b/ux.symfony.com/composer.lock
index 063cc0fb..b6fdea60 100644
--- a/ux.symfony.com/composer.lock
+++ b/ux.symfony.com/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "b5a46dff5faff169aa3a5675b204b52d",
+    "content-hash": "ce93314ac13280e8477e9cd3435cf0a5",
     "packages": [
         {
             "name": "composer/semver",
@@ -7346,85 +7346,6 @@
             ],
             "time": "2024-04-19T06:36:45+00:00"
         },
-        {
-            "name": "symfony/ux-icons",
-            "version": "v2.17.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/ux-icons.git",
-                "reference": "46a1180d4a55e1768f9f8ab5dd376828cb247de0"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/ux-icons/zipball/46a1180d4a55e1768f9f8ab5dd376828cb247de0",
-                "reference": "46a1180d4a55e1768f9f8ab5dd376828cb247de0",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=8.1",
-                "symfony/framework-bundle": "^6.4|^7.0",
-                "symfony/twig-bundle": "^6.4|^7.0"
-            },
-            "conflict": {
-                "symfony/flex": "<1.13"
-            },
-            "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",
-                "symfony/ux-twig-component": "^2.14",
-                "zenstruck/console-test": "^1.5"
-            },
-            "type": "symfony-bundle",
-            "extra": {
-                "thanks": {
-                    "name": "symfony/ux",
-                    "url": "https://github.com/symfony/ux"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Symfony\\UX\\Icons\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Renders local and remote SVG icons in your Twig templates.",
-            "homepage": "https://symfony.com",
-            "keywords": [
-                "icons",
-                "svg",
-                "symfony-ux",
-                "twig"
-            ],
-            "support": {
-                "source": "https://github.com/symfony/ux-icons/tree/v2.17.0"
-            },
-            "funding": [
-                {
-                    "url": "https://symfony.com/sponsor",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://github.com/fabpot",
-                    "type": "github"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
-                    "type": "tidelift"
-                }
-            ],
-            "time": "2024-04-19T06:36:45+00:00"
-        },
         {
             "name": "symfony/ux-lazy-image",
             "version": "2.x-dev",
diff --git a/ux.symfony.com/config/bundles.php b/ux.symfony.com/config/bundles.php
index b45fdc6f..ca9ec106 100644
--- a/ux.symfony.com/config/bundles.php
+++ b/ux.symfony.com/config/bundles.php
@@ -30,5 +30,4 @@ return [
     Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],
     Symfony\UX\TogglePassword\TogglePasswordBundle::class => ['all' => true],
     Symfonycasts\SassBundle\SymfonycastsSassBundle::class => ['all' => true],
-    Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
 ];
diff --git a/ux.symfony.com/src/Service/UxPackageRepository.php b/ux.symfony.com/src/Service/UxPackageRepository.php
index 3743110b..2076d3f3 100644
--- a/ux.symfony.com/src/Service/UxPackageRepository.php
+++ b/ux.symfony.com/src/Service/UxPackageRepository.php
@@ -53,17 +53,6 @@ class UxPackageRepository
                 'I need an Ajax-autocomplete select field'
             ),
 
-            new UxPackage(
-                'icons',
-                'UX Icons',
-                'app_icons',
-                '#3737FF',
-                'linear-gradient(to bottom right, cyan, purple)',
-                'Render SVG icons seamlessly from your Twig templates.',
-                'I need to render SVG icons.',
-                'icons.svg',
-            ),
-
             (new UxPackage(
                 'chartjs',
                 'Chart.js',
diff --git a/ux.symfony.com/src/Twig/Components/Code/CodeBlock.php b/ux.symfony.com/src/Twig/Components/Code/CodeBlock.php
index 9938e930..6518e28f 100644
--- a/ux.symfony.com/src/Twig/Components/Code/CodeBlock.php
+++ b/ux.symfony.com/src/Twig/Components/Code/CodeBlock.php
@@ -38,39 +38,11 @@ class CodeBlock
      */
     public bool $stripExcessHtml = false;
 
-    public ?int $lineStart = null;
-    public ?int $lineEnd = null;
-
     public function __construct(
         #[Autowire('%kernel.project_dir%')] private string $rootDir,
     ) {
     }
 
-    public function mount(string $filename): void
-    {
-        if (str_contains($filename, '#')) {
-            [$filename, $lines] = explode('#', $filename, 2);
-            if (str_contains($lines, '#')) {
-                throw new \InvalidArgumentException(sprintf('Invalid filename "%s": only one "#" is allowed.', $filename));
-            }
-
-            if (!preg_match('/^L(\d+)(?:-L(\d+))?$/', $lines, $matches)) {
-                throw new \InvalidArgumentException(sprintf('Invalid filename "%s": the line range is not valid.', $filename));
-            }
-
-            $lineStart = (int) $matches[1];
-            $lineEnd = (int) ($matches[2] ?? $matches[1]);
-            if ($lineStart > $lineEnd) {
-                throw new \InvalidArgumentException(sprintf('Invalid filename "%s": the line range is not valid.', $filename));
-            }
-
-            $this->lineStart = $lineStart;
-            $this->lineEnd = $lineEnd;
-        }
-
-        $this->filename = $filename;
-    }
-
     /**
      * Returns a list of source code pieces, extracted from the filename
      * argument, ready to be renderer in the template.
@@ -102,8 +74,6 @@ class CodeBlock
 
         if ($this->targetTwigBlock) {
             $content = SourceCleaner::extractTwigBlock($content, $this->targetTwigBlock, $this->showTwigExtends);
-        } elseif (null !== $this->getLineAnchor()) {
-            $content = $this->extractLines($content, $this->lineStart, $this->lineEnd);
         }
 
         if ($this->stripExcessHtml) {
@@ -113,35 +83,9 @@ class CodeBlock
         return $content;
     }
 
-    private function extractLines(string $content, int $lineStart, int $lineEnd): string
-    {
-        $lines = explode("\n", $content);
-        $lines = \array_slice($lines, $lineStart - 1, $lineEnd - $lineStart + 1);
-
-        return implode("\n", $lines);
-    }
-
-    public function getLineAnchor(): ?string
-    {
-        if (null === $this->lineStart) {
-            return null;
-        }
-
-        $anchor = sprintf('L%d', $this->lineStart);
-        if (null === $this->lineEnd) {
-            return $anchor;
-        }
-
-        if ($this->lineStart !== $this->lineEnd) {
-            $anchor .= sprintf('-L%d', $this->lineEnd);
-        }
-
-        return $anchor;
-    }
-
     public function getClassString(): string
     {
-        return 'terminal-code';
+        return 'terminal-code'.($this->showFilename ? '' : ' terminal-code-no-filename');
     }
 
     public function getGithubLink(): string
diff --git a/ux.symfony.com/src/Twig/Extension/HighlightExtension.php b/ux.symfony.com/src/Twig/Extension/HighlightExtension.php
index 3e80ff0c..33b949e0 100644
--- a/ux.symfony.com/src/Twig/Extension/HighlightExtension.php
+++ b/ux.symfony.com/src/Twig/Extension/HighlightExtension.php
@@ -20,24 +20,10 @@ use Twig\TwigFilter;
  */
 final class HighlightExtension extends AbstractExtension
 {
-    public function __construct(
-        private readonly Highlighter $highlighter,
-    ) {
-    }
-
     public function getFilters(): array
     {
         return [
-            new TwigFilter('highlight', $this->highlight(...), ['is_safe' => ['html']]),
+            new TwigFilter('highlight', [Highlighter::class, 'parse'], ['is_safe' => ['html']]),
         ];
     }
-
-    public function highlight(string $code, string $language, ?int $startAt = null): string
-    {
-        if (null !== $startAt) {
-            return $this->highlighter->withGutter($startAt)->parse($code, $language);
-        }
-
-        return $this->highlighter->parse($code, $language);
-    }
 }
diff --git a/ux.symfony.com/symfony.lock b/ux.symfony.com/symfony.lock
index b0ebbfe1..6b7bcfa9 100644
--- a/ux.symfony.com/symfony.lock
+++ b/ux.symfony.com/symfony.lock
@@ -548,18 +548,6 @@
     "symfony/ux-dropzone": {
         "version": "v2.1.1"
     },
-    "symfony/ux-icons": {
-        "version": "2.17",
-        "recipe": {
-            "repo": "github.com/symfony/recipes",
-            "branch": "main",
-            "version": "2.17",
-            "ref": "803a3bbd5893f9584969ab8670290cdfb6a0a5b5"
-        },
-        "files": [
-            "assets/icons/symfony.svg"
-        ]
-    },
     "symfony/ux-lazy-image": {
         "version": "v2.1.1"
     },
diff --git a/ux.symfony.com/templates/components/Code/CodeBlock.html.twig b/ux.symfony.com/templates/components/Code/CodeBlock.html.twig
index 2c081698..c15d2f18 100644
--- a/ux.symfony.com/templates/components/Code/CodeBlock.html.twig
+++ b/ux.symfony.com/templates/components/Code/CodeBlock.html.twig
@@ -4,9 +4,7 @@
 
     {% if showFilename %}
         <div class="Terminal_header py-2 px-3 mb-0 d-flex justify-content-between align-items-center">
-            <a id="{{ this.elementId }}" href="#{{ this.elementId }}" class="Terminal_title">
-                <code>{{ filename }}{% if this.lineStart %}<em>{{ '#%s'|format(this.lineAnchor) }}</em>{% endif %}</code>
-            </a>
+            <a id="{{ this.elementId }}" href="#{{ this.elementId }}" class="Terminal_title"><code>{{ filename }}</code></a>
             <div class="Terminal_actions">
                 <twig:Code:CodeBlockButtons source="{{ this.rawSource }}" link="{{ this.githubLink }}"/>
             </div>
@@ -25,7 +23,7 @@
             {% for piece in this.prepareSource %}
                 {% if piece.highlight ?? true %}
                     <pre><code class="language-{{ this.language }}">
-                        {{- piece.content|highlight(this.language, this.lineStart) -}}
+                        {{- piece.content|highlight(this.language) -}}
                     </code></pre>
                 {% else %}
                     {{- piece.content|raw -}}
diff --git a/ux.symfony.com/templates/icons/index.html.twig b/ux.symfony.com/templates/icons/index.html.twig
index f4ebba15..f0c605f6 100644
--- a/ux.symfony.com/templates/icons/index.html.twig
+++ b/ux.symfony.com/templates/icons/index.html.twig
@@ -7,7 +7,7 @@
 
 {% set meta = {
     title: 'UX Icons - SVG icons made easy',
-    description: 'Render SVG icons seamlessly from your Twig templates. Find the perfect icon among 200,000 choices from the most popular icon sets.',
+    description: 'Search for icons on iconify.design.',
     canonical: url('app_icons'),
 } %}
 


Test patch:
diff --git a/ux.symfony.com/tests/Functional/UxPackagesTest.php b/ux.symfony.com/tests/Functional/UxPackagesTest.php
index 439cc914..6dbb5385 100644
--- a/ux.symfony.com/tests/Functional/UxPackagesTest.php
+++ b/ux.symfony.com/tests/Functional/UxPackagesTest.php
@@ -52,13 +52,8 @@ class UxPackagesTest extends KernelTestCase
                 yield $package->getName() => [$package, 'Read full Documentation'];
                 continue;
             }
-            if ('icons' === $package->getName()) {
-                // Icons has a different bottom section
-                yield $package->getName() => [$package, 'Documentation'];
-                continue;
-            }
 
-            yield $package->getName() => [$package, sprintf('%s Docs', $package->getHumanName())];
+            yield $package->getName() => [$package, sprintf('Symfony UX %s Docs', $package->getHumanName())];
         }
     }
 }