Benötigte Pakete installiert
This commit is contained in:
38
vendor/sabberworm/php-css-parser/src/Property/AtRule.php
vendored
Normal file
38
vendor/sabberworm/php-css-parser/src/Property/AtRule.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\Commentable;
|
||||
use Sabberworm\CSS\Renderable;
|
||||
|
||||
interface AtRule extends Renderable, Commentable
|
||||
{
|
||||
/**
|
||||
* 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 string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values';
|
||||
|
||||
/**
|
||||
* … and more font-specific ones (to be used inside font-feature-values)
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation';
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function atRuleName();
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function atRuleArgs();
|
||||
}
|
||||
156
vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php
vendored
Normal file
156
vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\Comment;
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
use Sabberworm\CSS\Position\Position;
|
||||
use Sabberworm\CSS\Position\Positionable;
|
||||
|
||||
/**
|
||||
* `CSSNamespace` represents an `@namespace` rule.
|
||||
*/
|
||||
class CSSNamespace implements AtRule, Positionable
|
||||
{
|
||||
use Position;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $mUrl;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sPrefix;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $iLineNo;
|
||||
|
||||
/**
|
||||
* @var array<array-key, Comment>
|
||||
*
|
||||
* @internal since 8.8.0
|
||||
*/
|
||||
protected $aComments;
|
||||
|
||||
/**
|
||||
* @param string $mUrl
|
||||
* @param string|null $sPrefix
|
||||
* @param int $iLineNo
|
||||
*/
|
||||
public function __construct($mUrl, $sPrefix = null, $iLineNo = 0)
|
||||
{
|
||||
$this->mUrl = $mUrl;
|
||||
$this->sPrefix = $sPrefix;
|
||||
$this->setPosition($iLineNo);
|
||||
$this->aComments = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render(new OutputFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputFormat|null $oOutputFormat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render($oOutputFormat)
|
||||
{
|
||||
return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
|
||||
. $this->mUrl->render($oOutputFormat) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->mUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPrefix()
|
||||
{
|
||||
return $this->sPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mUrl
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUrl($mUrl)
|
||||
{
|
||||
$this->mUrl = $mUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPrefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrefix($sPrefix)
|
||||
{
|
||||
$this->sPrefix = $sPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function atRuleName()
|
||||
{
|
||||
return 'namespace';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function atRuleArgs()
|
||||
{
|
||||
$aResult = [$this->mUrl];
|
||||
if ($this->sPrefix) {
|
||||
array_unshift($aResult, $this->sPrefix);
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array-key, Comment> $aComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addComments(array $aComments)
|
||||
{
|
||||
$this->aComments = array_merge($this->aComments, $aComments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array-key, Comment>
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
return $this->aComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array-key, Comment> $aComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setComments(array $aComments)
|
||||
{
|
||||
$this->aComments = $aComments;
|
||||
}
|
||||
}
|
||||
135
vendor/sabberworm/php-css-parser/src/Property/Charset.php
vendored
Normal file
135
vendor/sabberworm/php-css-parser/src/Property/Charset.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\Comment;
|
||||
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 Position;
|
||||
|
||||
/**
|
||||
* @var CSSString
|
||||
*/
|
||||
private $oCharset;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @internal since 8.8.0
|
||||
*/
|
||||
protected $iLineNo;
|
||||
|
||||
/**
|
||||
* @var array<array-key, Comment>
|
||||
*
|
||||
* @internal since 8.8.0
|
||||
*/
|
||||
protected $aComments;
|
||||
|
||||
/**
|
||||
* @param CSSString $oCharset
|
||||
* @param int $iLineNo
|
||||
*/
|
||||
public function __construct(CSSString $oCharset, $iLineNo = 0)
|
||||
{
|
||||
$this->oCharset = $oCharset;
|
||||
$this->setPosition($iLineNo);
|
||||
$this->aComments = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|CSSString $oCharset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCharset($sCharset)
|
||||
{
|
||||
$sCharset = $sCharset instanceof CSSString ? $sCharset : new CSSString($sCharset);
|
||||
$this->oCharset = $sCharset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCharset()
|
||||
{
|
||||
return $this->oCharset->getString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render(new OutputFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputFormat|null $oOutputFormat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render($oOutputFormat)
|
||||
{
|
||||
return "{$oOutputFormat->comments($this)}@charset {$this->oCharset->render($oOutputFormat)};";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function atRuleName()
|
||||
{
|
||||
return 'charset';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function atRuleArgs()
|
||||
{
|
||||
return $this->oCharset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array-key, Comment> $aComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addComments(array $aComments)
|
||||
{
|
||||
$this->aComments = array_merge($this->aComments, $aComments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array-key, Comment>
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
return $this->aComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array-key, Comment> $aComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setComments(array $aComments)
|
||||
{
|
||||
$this->aComments = $aComments;
|
||||
}
|
||||
}
|
||||
142
vendor/sabberworm/php-css-parser/src/Property/Import.php
vendored
Normal file
142
vendor/sabberworm/php-css-parser/src/Property/Import.php
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
use Sabberworm\CSS\Comment\Comment;
|
||||
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 Position;
|
||||
|
||||
/**
|
||||
* @var URL
|
||||
*/
|
||||
private $oLocation;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sMediaQuery;
|
||||
|
||||
/**
|
||||
* @var array<array-key, Comment>
|
||||
*
|
||||
* @internal since 8.8.0
|
||||
*/
|
||||
protected $aComments;
|
||||
|
||||
/**
|
||||
* @param URL $oLocation
|
||||
* @param string $sMediaQuery
|
||||
* @param int $iLineNo
|
||||
*/
|
||||
public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0)
|
||||
{
|
||||
$this->oLocation = $oLocation;
|
||||
$this->sMediaQuery = $sMediaQuery;
|
||||
$this->setPosition($iLineNo);
|
||||
$this->aComments = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param URL $oLocation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLocation($oLocation)
|
||||
{
|
||||
$this->oLocation = $oLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return URL
|
||||
*/
|
||||
public function getLocation()
|
||||
{
|
||||
return $this->oLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render(new OutputFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputFormat|null $oOutputFormat
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render($oOutputFormat)
|
||||
{
|
||||
return $oOutputFormat->comments($this) . "@import " . $this->oLocation->render($oOutputFormat)
|
||||
. ($this->sMediaQuery === null ? '' : ' ' . $this->sMediaQuery) . ';';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function atRuleName()
|
||||
{
|
||||
return 'import';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, URL|string>
|
||||
*/
|
||||
public function atRuleArgs()
|
||||
{
|
||||
$aResult = [$this->oLocation];
|
||||
if ($this->sMediaQuery) {
|
||||
array_push($aResult, $this->sMediaQuery);
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array-key, Comment> $aComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addComments(array $aComments)
|
||||
{
|
||||
$this->aComments = array_merge($this->aComments, $aComments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array-key, Comment>
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
return $this->aComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<array-key, Comment> $aComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setComments(array $aComments)
|
||||
{
|
||||
$this->aComments = $aComments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMediaQuery()
|
||||
{
|
||||
return $this->sMediaQuery;
|
||||
}
|
||||
}
|
||||
25
vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php
vendored
Normal file
25
vendor/sabberworm/php-css-parser/src/Property/KeyframeSelector.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
class KeyframeSelector extends Selector
|
||||
{
|
||||
/**
|
||||
* regexp for specificity calculations
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
const SELECTOR_VALIDATION_RX = '/
|
||||
^(
|
||||
(?:
|
||||
[a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters
|
||||
(?:\\\\.)? # a single escaped character
|
||||
(?:([\'"]).*?(?<!\\\\)\2)? # a quoted text like [id="example"]
|
||||
)*
|
||||
)|
|
||||
(\d+%) # keyframe animation progress percentage (e.g. 50%)
|
||||
$
|
||||
/ux';
|
||||
}
|
||||
148
vendor/sabberworm/php-css-parser/src/Property/Selector.php
vendored
Normal file
148
vendor/sabberworm/php-css-parser/src/Property/Selector.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\Property;
|
||||
|
||||
/**
|
||||
* Class representing a single CSS selector. Selectors have to be split by the comma prior to being passed into this
|
||||
* class.
|
||||
*/
|
||||
class Selector
|
||||
{
|
||||
/**
|
||||
* regexp for specificity calculations
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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 string
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/
|
||||
((^|[\s\+\>\~]+)[\w]+ # elements
|
||||
|
|
||||
\:{1,2}( # pseudo-elements
|
||||
after|before|first-letter|first-line|selection
|
||||
))
|
||||
/ix';
|
||||
|
||||
/**
|
||||
* regexp for specificity calculations
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @internal since 8.5.2
|
||||
*/
|
||||
const SELECTOR_VALIDATION_RX = '/
|
||||
^(
|
||||
(?:
|
||||
[a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters
|
||||
(?:\\\\.)? # a single escaped character
|
||||
(?:([\'"]).*?(?<!\\\\)\2)? # a quoted text like [id="example"]
|
||||
)*
|
||||
)$
|
||||
/ux';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sSelector;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $iSpecificity;
|
||||
|
||||
/**
|
||||
* @param string $sSelector
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @internal since V8.8.0
|
||||
*/
|
||||
public static function isValid($sSelector)
|
||||
{
|
||||
return preg_match(static::SELECTOR_VALIDATION_RX, $sSelector);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSelector
|
||||
* @param bool $bCalculateSpecificity @deprecated since V8.8.0, will be removed in V9.0.0
|
||||
*/
|
||||
public function __construct($sSelector, $bCalculateSpecificity = false)
|
||||
{
|
||||
$this->setSelector($sSelector);
|
||||
if ($bCalculateSpecificity) {
|
||||
$this->getSpecificity();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSelector()
|
||||
{
|
||||
return $this->sSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSelector
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSelector($sSelector)
|
||||
{
|
||||
$this->sSelector = trim($sSelector);
|
||||
$this->iSpecificity = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getSelector();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSpecificity()
|
||||
{
|
||||
if ($this->iSpecificity === null) {
|
||||
$a = 0;
|
||||
/// @todo should exclude \# as well as "#"
|
||||
$aMatches = null;
|
||||
$b = substr_count($this->sSelector, '#');
|
||||
$c = preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $this->sSelector, $aMatches);
|
||||
$d = preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $this->sSelector, $aMatches);
|
||||
$this->iSpecificity = ($a * 1000) + ($b * 100) + ($c * 10) + $d;
|
||||
}
|
||||
return $this->iSpecificity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user