allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
29
vendor/sabberworm/php-css-parser/src/Property/AtRule.php
vendored
Normal file
29
vendor/sabberworm/php-css-parser/src/Property/AtRule.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\CSSList\CSSListItem;
|
||||
|
||||
/**
|
||||
* Note that `CSSListItem` extends both `Commentable` and `Renderable`,
|
||||
* so concrete classes implementing this interface must also implement those.
|
||||
*/
|
||||
interface AtRule extends CSSListItem
|
||||
{
|
||||
/**
|
||||
* Since there are more set rules than block rules,
|
||||
* we’re whitelisting the block rules and have anything else be treated as a set rule.
|
||||
*
|
||||
* @var non-empty-string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
public const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values';
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function atRuleName(): string;
|
||||
}
|
||||
97
vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php
vendored
Normal file
97
vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\CommentContainer;
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
use Sabberworm\CSS\Position\Position;
|
||||
use Sabberworm\CSS\Position\Positionable;
|
||||
use Sabberworm\CSS\Value\CSSString;
|
||||
use Sabberworm\CSS\Value\URL;
|
||||
|
||||
/**
|
||||
* `CSSNamespace` represents an `@namespace` rule.
|
||||
*/
|
||||
class CSSNamespace implements AtRule, Positionable
|
||||
{
|
||||
use CommentContainer;
|
||||
use Position;
|
||||
|
||||
/**
|
||||
* @var CSSString|URL
|
||||
*/
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $prefix;
|
||||
|
||||
/**
|
||||
* @param CSSString|URL $url
|
||||
* @param int<1, max>|null $lineNumber
|
||||
*/
|
||||
public function __construct($url, ?string $prefix = null, ?int $lineNumber = null)
|
||||
{
|
||||
$this->url = $url;
|
||||
$this->prefix = $prefix;
|
||||
$this->setPosition($lineNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function render(OutputFormat $outputFormat): string
|
||||
{
|
||||
return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ')
|
||||
. $this->url->render($outputFormat) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CSSString|URL
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getPrefix(): ?string
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CSSString|URL $url
|
||||
*/
|
||||
public function setUrl($url): void
|
||||
{
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function setPrefix(string $prefix): void
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function atRuleName(): string
|
||||
{
|
||||
return 'namespace';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{0: CSSString|URL|non-empty-string, 1?: CSSString|URL}
|
||||
*/
|
||||
public function atRuleArgs(): array
|
||||
{
|
||||
$result = [$this->url];
|
||||
if (\is_string($this->prefix) && $this->prefix !== '') {
|
||||
\array_unshift($result, $this->prefix);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
74
vendor/sabberworm/php-css-parser/src/Property/Charset.php
vendored
Normal file
74
vendor/sabberworm/php-css-parser/src/Property/Charset.php
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\CommentContainer;
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
use Sabberworm\CSS\Position\Position;
|
||||
use Sabberworm\CSS\Position\Positionable;
|
||||
use Sabberworm\CSS\Value\CSSString;
|
||||
|
||||
/**
|
||||
* Class representing an `@charset` rule.
|
||||
*
|
||||
* The following restrictions apply:
|
||||
* - May not be found in any CSSList other than the Document.
|
||||
* - May only appear at the very top of a Document’s contents.
|
||||
* - Must not appear more than once.
|
||||
*/
|
||||
class Charset implements AtRule, Positionable
|
||||
{
|
||||
use CommentContainer;
|
||||
use Position;
|
||||
|
||||
/**
|
||||
* @var CSSString
|
||||
*/
|
||||
private $charset;
|
||||
|
||||
/**
|
||||
* @param int<1, max>|null $lineNumber
|
||||
*/
|
||||
public function __construct(CSSString $charset, ?int $lineNumber = null)
|
||||
{
|
||||
$this->charset = $charset;
|
||||
$this->setPosition($lineNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|CSSString $charset
|
||||
*/
|
||||
public function setCharset($charset): void
|
||||
{
|
||||
$charset = $charset instanceof CSSString ? $charset : new CSSString($charset);
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
public function getCharset(): string
|
||||
{
|
||||
return $this->charset->getString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function render(OutputFormat $outputFormat): string
|
||||
{
|
||||
return "{$outputFormat->getFormatter()->comments($this)}@charset {$this->charset->render($outputFormat)};";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function atRuleName(): string
|
||||
{
|
||||
return 'charset';
|
||||
}
|
||||
|
||||
public function atRuleArgs(): CSSString
|
||||
{
|
||||
return $this->charset;
|
||||
}
|
||||
}
|
||||
85
vendor/sabberworm/php-css-parser/src/Property/Import.php
vendored
Normal file
85
vendor/sabberworm/php-css-parser/src/Property/Import.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\CommentContainer;
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
use Sabberworm\CSS\Position\Position;
|
||||
use Sabberworm\CSS\Position\Positionable;
|
||||
use Sabberworm\CSS\Value\URL;
|
||||
|
||||
/**
|
||||
* Class representing an `@import` rule.
|
||||
*/
|
||||
class Import implements AtRule, Positionable
|
||||
{
|
||||
use CommentContainer;
|
||||
use Position;
|
||||
|
||||
/**
|
||||
* @var URL
|
||||
*/
|
||||
private $location;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $mediaQuery;
|
||||
|
||||
/**
|
||||
* @param int<1, max>|null $lineNumber
|
||||
*/
|
||||
public function __construct(URL $location, ?string $mediaQuery, ?int $lineNumber = null)
|
||||
{
|
||||
$this->location = $location;
|
||||
$this->mediaQuery = $mediaQuery;
|
||||
$this->setPosition($lineNumber);
|
||||
}
|
||||
|
||||
public function setLocation(URL $location): void
|
||||
{
|
||||
$this->location = $location;
|
||||
}
|
||||
|
||||
public function getLocation(): URL
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function render(OutputFormat $outputFormat): string
|
||||
{
|
||||
return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat)
|
||||
. ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-empty-string
|
||||
*/
|
||||
public function atRuleName(): string
|
||||
{
|
||||
return 'import';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{0: URL, 1?: non-empty-string}
|
||||
*/
|
||||
public function atRuleArgs(): array
|
||||
{
|
||||
$result = [$this->location];
|
||||
if (\is_string($this->mediaQuery) && $this->mediaQuery !== '') {
|
||||
$result[] = $this->mediaQuery;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getMediaQuery(): ?string
|
||||
{
|
||||
return $this->mediaQuery;
|
||||
}
|
||||
}
|
||||
47
vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php
vendored
Normal file
47
vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
class KeyframeSelector extends Selector
|
||||
{
|
||||
/**
|
||||
* This differs from the parent class:
|
||||
* - comma is not allowed unless escaped or quoted;
|
||||
* - percentage value is allowed by itself.
|
||||
*
|
||||
* @var non-empty-string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
public const SELECTOR_VALIDATION_RX = '/
|
||||
^(
|
||||
(?:
|
||||
# any sequence of valid unescaped characters, except quotes
|
||||
[a-zA-Z0-9\\x{00A0}-\\x{FFFF}_^$|*=~\\[\\]()\\-\\s\\.:#+>]++
|
||||
|
|
||||
# one or more escaped characters
|
||||
(?:\\\\.)++
|
||||
|
|
||||
# quoted text, like in `[id="example"]`
|
||||
(?:
|
||||
# opening quote
|
||||
([\'"])
|
||||
(?:
|
||||
# sequence of characters except closing quote or backslash
|
||||
(?:(?!\\g{-1}|\\\\).)++
|
||||
|
|
||||
# one or more escaped characters
|
||||
(?:\\\\.)++
|
||||
)*+ # zero or more times
|
||||
# closing quote or end (unmatched quote is currently allowed)
|
||||
(?:\\g{-1}|$)
|
||||
)
|
||||
)*+ # zero or more times
|
||||
|
|
||||
# keyframe animation progress percentage (e.g. 50%), untrimmed
|
||||
\\s*+(\\d++%)\\s*+
|
||||
)$
|
||||
/ux';
|
||||
}
|
||||
94
vendor/sabberworm/php-css-parser/src/Property/Selector.php
vendored
Normal file
94
vendor/sabberworm/php-css-parser/src/Property/Selector.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
use Sabberworm\CSS\Property\Selector\SpecificityCalculator;
|
||||
use Sabberworm\CSS\Renderable;
|
||||
|
||||
use function Safe\preg_match;
|
||||
|
||||
/**
|
||||
* Class representing a single CSS selector. Selectors have to be split by the comma prior to being passed into this
|
||||
* class.
|
||||
*/
|
||||
class Selector implements Renderable
|
||||
{
|
||||
/**
|
||||
* @var non-empty-string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
public const SELECTOR_VALIDATION_RX = '/
|
||||
^(
|
||||
(?:
|
||||
# any sequence of valid unescaped characters, except quotes
|
||||
[a-zA-Z0-9\\x{00A0}-\\x{FFFF}_^$|*=~\\[\\]()\\-\\s\\.:#+>,]++
|
||||
|
|
||||
# one or more escaped characters
|
||||
(?:\\\\.)++
|
||||
|
|
||||
# quoted text, like in `[id="example"]`
|
||||
(?:
|
||||
# opening quote
|
||||
([\'"])
|
||||
(?:
|
||||
# sequence of characters except closing quote or backslash
|
||||
(?:(?!\\g{-1}|\\\\).)++
|
||||
|
|
||||
# one or more escaped characters
|
||||
(?:\\\\.)++
|
||||
)*+ # zero or more times
|
||||
# closing quote or end (unmatched quote is currently allowed)
|
||||
(?:\\g{-1}|$)
|
||||
)
|
||||
)*+ # zero or more times
|
||||
)$
|
||||
/ux';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $selector;
|
||||
|
||||
/**
|
||||
* @internal since V8.8.0
|
||||
*/
|
||||
public static function isValid(string $selector): bool
|
||||
{
|
||||
// Note: We need to use `static::` here as the constant is overridden in the `KeyframeSelector` class.
|
||||
$numberOfMatches = preg_match(static::SELECTOR_VALIDATION_RX, $selector);
|
||||
|
||||
return $numberOfMatches === 1;
|
||||
}
|
||||
|
||||
public function __construct(string $selector)
|
||||
{
|
||||
$this->setSelector($selector);
|
||||
}
|
||||
|
||||
public function getSelector(): string
|
||||
{
|
||||
return $this->selector;
|
||||
}
|
||||
|
||||
public function setSelector(string $selector): void
|
||||
{
|
||||
$this->selector = \trim($selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int<0, max>
|
||||
*/
|
||||
public function getSpecificity(): int
|
||||
{
|
||||
return SpecificityCalculator::calculate($this->selector);
|
||||
}
|
||||
|
||||
public function render(OutputFormat $outputFormat): string
|
||||
{
|
||||
return $this->getSelector();
|
||||
}
|
||||
}
|
||||
85
vendor/sabberworm/php-css-parser/src/Property/Selector/SpecificityCalculator.php
vendored
Normal file
85
vendor/sabberworm/php-css-parser/src/Property/Selector/SpecificityCalculator.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabberworm\CSS\Property\Selector;
|
||||
|
||||
/**
|
||||
* Utility class to calculate the specificity of a CSS selector.
|
||||
*
|
||||
* The results are cached to avoid recalculating the specificity of the same selector multiple times.
|
||||
*/
|
||||
final class SpecificityCalculator
|
||||
{
|
||||
/**
|
||||
* regexp for specificity calculations
|
||||
*
|
||||
* @var non-empty-string
|
||||
*/
|
||||
private const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/
|
||||
(\\.[\\w]+) # classes
|
||||
|
|
||||
\\[(\\w+) # attributes
|
||||
|
|
||||
(\\:( # pseudo classes
|
||||
link|visited|active
|
||||
|hover|focus
|
||||
|lang
|
||||
|target
|
||||
|enabled|disabled|checked|indeterminate
|
||||
|root
|
||||
|nth-child|nth-last-child|nth-of-type|nth-last-of-type
|
||||
|first-child|last-child|first-of-type|last-of-type
|
||||
|only-child|only-of-type
|
||||
|empty|contains
|
||||
))
|
||||
/ix';
|
||||
|
||||
/**
|
||||
* regexp for specificity calculations
|
||||
*
|
||||
* @var non-empty-string
|
||||
*/
|
||||
private const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/
|
||||
((^|[\\s\\+\\>\\~]+)[\\w]+ # elements
|
||||
|
|
||||
\\:{1,2}( # pseudo-elements
|
||||
after|before|first-letter|first-line|selection
|
||||
))
|
||||
/ix';
|
||||
|
||||
/**
|
||||
* @var array<string, int<0, max>>
|
||||
*/
|
||||
private static $cache = [];
|
||||
|
||||
/**
|
||||
* Calculates the specificity of the given CSS selector.
|
||||
*
|
||||
* @return int<0, max>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function calculate(string $selector): int
|
||||
{
|
||||
if (!isset(self::$cache[$selector])) {
|
||||
$a = 0;
|
||||
/// @todo should exclude \# as well as "#"
|
||||
$matches = null;
|
||||
$b = \substr_count($selector, '#');
|
||||
$c = \preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $selector, $matches);
|
||||
$d = \preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $selector, $matches);
|
||||
self::$cache[$selector] = ($a * 1000) + ($b * 100) + ($c * 10) + $d;
|
||||
}
|
||||
|
||||
return self::$cache[$selector];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cache in order to lower memory usage.
|
||||
*/
|
||||
public static function clearCache(): void
|
||||
{
|
||||
self::$cache = [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user