refactor: Cleanup git state - commit all staged changes
Major refactoring cleanup: - Add new controller architecture (class-controller-*.php) - Add new settings-v2 UI (views/settings-v2/) - Add new CSS architecture (agentic-sidebar.css, tokens) - Add esbuild build pipeline (scripts/build.js, package.json) - Add composer dependencies (vendor/) - Add frontend src directory (assets/js/src/index.jsx) - Add documentation files - Remove old/obsolete files (class-settings.php, old CSS) This commits all pending changes from previous refactoring efforts.
This commit is contained in:
19
vendor/twig/string-extra/LICENSE
vendored
Normal file
19
vendor/twig/string-extra/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2019-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.
|
||||
21
vendor/twig/string-extra/README.md
vendored
Normal file
21
vendor/twig/string-extra/README.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
String Extension
|
||||
================
|
||||
|
||||
This package is a Twig extension that provides integration with the Symfony
|
||||
String component. It provides the following filters:
|
||||
|
||||
* [`u`][1]: Wraps a text in a `UnicodeString` object to give access to
|
||||
[methods of the class][2].
|
||||
|
||||
* [`slug`][3]: Wraps the [`AsciiSlugger`][4]'s `slug` method.
|
||||
|
||||
* [`singular`][5] and [`plural`][6]: Wraps the [`Inflector`][7] `singularize`
|
||||
and `pluralize` methods.
|
||||
|
||||
[1]: https://twig.symfony.com/u
|
||||
[2]: https://symfony.com/doc/current/components/string.html
|
||||
[3]: https://twig.symfony.com/slug
|
||||
[4]: https://symfony.com/doc/current/components/string.html#slugger
|
||||
[5]: https://twig.symfony.com/singular
|
||||
[6]: https://twig.symfony.com/plural
|
||||
[7]: https://symfony.com/doc/current/components/string.html#inflector
|
||||
99
vendor/twig/string-extra/StringExtension.php
vendored
Normal file
99
vendor/twig/string-extra/StringExtension.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Twig.
|
||||
*
|
||||
* (c) Fabien Potencier
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Twig\Extra\String;
|
||||
|
||||
use Symfony\Component\String\AbstractUnicodeString;
|
||||
use Symfony\Component\String\Inflector\EnglishInflector;
|
||||
use Symfony\Component\String\Inflector\FrenchInflector;
|
||||
use Symfony\Component\String\Inflector\InflectorInterface;
|
||||
use Symfony\Component\String\Inflector\SpanishInflector;
|
||||
use Symfony\Component\String\Slugger\AsciiSlugger;
|
||||
use Symfony\Component\String\Slugger\SluggerInterface;
|
||||
use Symfony\Component\String\UnicodeString;
|
||||
use Twig\Error\RuntimeError;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
final class StringExtension extends AbstractExtension
|
||||
{
|
||||
private $slugger;
|
||||
private $englishInflector;
|
||||
private $spanishInflector;
|
||||
private $frenchInflector;
|
||||
|
||||
public function __construct(?SluggerInterface $slugger = null)
|
||||
{
|
||||
$this->slugger = $slugger ?: new AsciiSlugger();
|
||||
}
|
||||
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('u', [$this, 'createUnicodeString']),
|
||||
new TwigFilter('slug', [$this, 'createSlug']),
|
||||
new TwigFilter('plural', [$this, 'plural']),
|
||||
new TwigFilter('singular', [$this, 'singular']),
|
||||
];
|
||||
}
|
||||
|
||||
public function createUnicodeString(?string $text): UnicodeString
|
||||
{
|
||||
return new UnicodeString($text ?? '');
|
||||
}
|
||||
|
||||
public function createSlug(string $string, string $separator = '-', ?string $locale = null): AbstractUnicodeString
|
||||
{
|
||||
return $this->slugger->slug($string, $separator, $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string
|
||||
*/
|
||||
public function plural(string $value, string $locale = 'en', bool $all = false)
|
||||
{
|
||||
if ($all) {
|
||||
return $this->getInflector($locale)->pluralize($value);
|
||||
}
|
||||
|
||||
return $this->getInflector($locale)->pluralize($value)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string
|
||||
*/
|
||||
public function singular(string $value, string $locale = 'en', bool $all = false)
|
||||
{
|
||||
if ($all) {
|
||||
return $this->getInflector($locale)->singularize($value);
|
||||
}
|
||||
|
||||
return $this->getInflector($locale)->singularize($value)[0];
|
||||
}
|
||||
|
||||
private function getInflector(string $locale): InflectorInterface
|
||||
{
|
||||
switch ($locale) {
|
||||
case 'en':
|
||||
return $this->englishInflector ?? $this->englishInflector = new EnglishInflector();
|
||||
case 'es':
|
||||
if (!class_exists(SpanishInflector::class)) {
|
||||
throw new RuntimeError('SpanishInflector is not available.');
|
||||
}
|
||||
|
||||
return $this->spanishInflector ?? $this->spanishInflector = new SpanishInflector();
|
||||
case 'fr':
|
||||
return $this->frenchInflector ?? $this->frenchInflector = new FrenchInflector();
|
||||
default:
|
||||
throw new \InvalidArgumentException(\sprintf('Locale "%s" is not supported.', $locale));
|
||||
}
|
||||
}
|
||||
}
|
||||
32
vendor/twig/string-extra/composer.json
vendored
Normal file
32
vendor/twig/string-extra/composer.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "twig/string-extra",
|
||||
"type": "library",
|
||||
"description": "A Twig extension for Symfony String",
|
||||
"keywords": ["twig", "html", "string", "unicode"],
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"license": "MIT",
|
||||
"minimum-stability": "dev",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.1.0",
|
||||
"symfony/string": "^5.4|^6.4|^7.0|^8.0",
|
||||
"symfony/translation-contracts": "^1.1|^2|^3",
|
||||
"twig/twig": "^3.13|^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4" : { "Twig\\Extra\\String\\" : "" },
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user