Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"pimple/pimple": "3.2.3",
"punic/punic": "^1.6",
"sabre/dav": "^3.2.0",
"scssphp/scssphp": "1.0.3",
"scssphp/scssphp": "1.0.8",
"stecman/symfony-console-completion": "^0.8.0",
"swiftmailer/swiftmailer": "^6.0",
"symfony/console": "4.4.4",
Expand Down
20 changes: 11 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,6 @@
'ScssPhp\\ScssPhp\\Parser' => $vendorDir . '/scssphp/scssphp/src/Parser.php',
'ScssPhp\\ScssPhp\\SourceMap\\Base64' => $vendorDir . '/scssphp/scssphp/src/SourceMap/Base64.php',
'ScssPhp\\ScssPhp\\SourceMap\\Base64VLQ' => $vendorDir . '/scssphp/scssphp/src/SourceMap/Base64VLQ.php',
'ScssPhp\\ScssPhp\\SourceMap\\Base64VLQEncoder' => $vendorDir . '/scssphp/scssphp/src/SourceMap/Base64VLQEncoder.php',
'ScssPhp\\ScssPhp\\SourceMap\\SourceMapGenerator' => $vendorDir . '/scssphp/scssphp/src/SourceMap/SourceMapGenerator.php',
'ScssPhp\\ScssPhp\\Type' => $vendorDir . '/scssphp/scssphp/src/Type.php',
'ScssPhp\\ScssPhp\\Util' => $vendorDir . '/scssphp/scssphp/src/Util.php',
Expand Down
1 change: 0 additions & 1 deletion composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,6 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
'ScssPhp\\ScssPhp\\Parser' => __DIR__ . '/..' . '/scssphp/scssphp/src/Parser.php',
'ScssPhp\\ScssPhp\\SourceMap\\Base64' => __DIR__ . '/..' . '/scssphp/scssphp/src/SourceMap/Base64.php',
'ScssPhp\\ScssPhp\\SourceMap\\Base64VLQ' => __DIR__ . '/..' . '/scssphp/scssphp/src/SourceMap/Base64VLQ.php',
'ScssPhp\\ScssPhp\\SourceMap\\Base64VLQEncoder' => __DIR__ . '/..' . '/scssphp/scssphp/src/SourceMap/Base64VLQEncoder.php',
'ScssPhp\\ScssPhp\\SourceMap\\SourceMapGenerator' => __DIR__ . '/..' . '/scssphp/scssphp/src/SourceMap/SourceMapGenerator.php',
'ScssPhp\\ScssPhp\\Type' => __DIR__ . '/..' . '/scssphp/scssphp/src/Type.php',
'ScssPhp\\ScssPhp\\Util' => __DIR__ . '/..' . '/scssphp/scssphp/src/Util.php',
Expand Down
18 changes: 10 additions & 8 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -3436,29 +3436,31 @@
},
{
"name": "scssphp/scssphp",
"version": "1.0.3",
"version_normalized": "1.0.3.0",
"version": "1.0.8",
"version_normalized": "1.0.8.0",
"source": {
"type": "git",
"url": "https://github.com/scssphp/scssphp.git",
"reference": "616c518333c656eaa23182ac6cfc01453f1e7c78"
"reference": "20d661952d19d4d75508180c453a594423b4f10b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/616c518333c656eaa23182ac6cfc01453f1e7c78",
"reference": "616c518333c656eaa23182ac6cfc01453f1e7c78",
"url": "https://api.github.com/repos/scssphp/scssphp/zipball/20d661952d19d4d75508180c453a594423b4f10b",
"reference": "20d661952d19d4d75508180c453a594423b4f10b",
"shasum": ""
},
"require": {
"php": "^5.6.0 || ^7"
"ext-ctype": "*",
"ext-json": "*",
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3",
"squizlabs/php_codesniffer": "~2.5",
"twbs/bootstrap": "~4.3",
"zurb/foundation": "~6.5"
},
"time": "2019-08-07T20:16:04+00:00",
"time": "2020-02-20T16:44:03+00:00",
"bin": [
"bin/pscss"
],
Expand Down
1 change: 0 additions & 1 deletion scssphp/scssphp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ There are several tests in the `tests/` directory:
* `InputTest.php` compiles every `.scss` file in the `tests/inputs` directory
then compares to the respective `.css` file in the `tests/outputs` directory.
* `ScssTest.php` extracts (ruby) `scss` tests from the `tests/scss_test.rb` file.
* `ServerTest.php` contains functional tests for the `Server` class.

When changing any of the tests in `tests/inputs`, the tests will most likely
fail because the output has changed. Once you verify that the output is correct
Expand Down
9 changes: 6 additions & 3 deletions scssphp/scssphp/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@
"psr-4": { "ScssPhp\\ScssPhp\\": "src/" }
},
"autoload-dev": {
"psr-4": { "ScssPhp\\ScssPhp\\Test\\": "tests/" }
"psr-4": { "ScssPhp\\ScssPhp\\Tests\\": "tests/" }
},
"require": {
"php": "^5.6.0 || ^7"
"php": ">=5.6.0",
"ext-json": "*",
"ext-ctype": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "~2.5",
"phpunit/phpunit": "~4.6",
"phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3",
"twbs/bootstrap": "~4.3",
"zurb/foundation": "~6.5"
},
"minimum-stability": "dev",
"bin": ["bin/pscss"],
"archive": {
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion scssphp/scssphp/src/Base/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* SCSSPHP
*
* @copyright 2015-2019 Leaf Corcoran
* @copyright 2015-2020 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
Expand Down
2 changes: 1 addition & 1 deletion scssphp/scssphp/src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* SCSSPHP
*
* @copyright 2012-2019 Leaf Corcoran
* @copyright 2012-2020 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
Expand Down
20 changes: 10 additions & 10 deletions scssphp/scssphp/src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* SCSSPHP
*
* @copyright 2012-2019 Leaf Corcoran
* @copyright 2012-2020 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
Expand Down Expand Up @@ -57,12 +57,12 @@ class Cache
public function __construct($options)
{
// check $cacheDir
if (isset($options['cache_dir'])) {
self::$cacheDir = $options['cache_dir'];
if (isset($options['cacheDir'])) {
self::$cacheDir = $options['cacheDir'];
}

if (empty(self::$cacheDir)) {
throw new Exception('cache_dir not set');
throw new Exception('cacheDir not set');
}

if (isset($options['prefix'])) {
Expand All @@ -74,7 +74,7 @@ public function __construct($options)
}

if (isset($options['forceRefresh'])) {
self::$forceRefresh = $options['force_refresh'];
self::$forceRefresh = $options['forceRefresh'];
}

self::checkCacheDir();
Expand All @@ -97,7 +97,7 @@ public function getCache($operation, $what, $options = [], $lastModified = null)
{
$fileCache = self::$cacheDir . self::cacheName($operation, $what, $options);

if ((! self::$forceRefresh || (self::$forceRefresh === 'once' &&
if (((self::$forceRefresh === false) || (self::$forceRefresh === 'once' &&
isset(self::$refreshed[$fileCache]))) && file_exists($fileCache)
) {
$cacheTime = filemtime($fileCache);
Expand Down Expand Up @@ -176,13 +176,13 @@ public static function checkCacheDir()
self::$cacheDir = str_replace('\\', '/', self::$cacheDir);
self::$cacheDir = rtrim(self::$cacheDir, '/') . '/';

if (! file_exists(self::$cacheDir)) {
if (! is_dir(self::$cacheDir)) {
if (! mkdir(self::$cacheDir)) {
throw new Exception('Cache directory couldn\'t be created: ' . self::$cacheDir);
}
} elseif (! is_dir(self::$cacheDir)) {
throw new Exception('Cache directory doesn\'t exist: ' . self::$cacheDir);
} elseif (! is_writable(self::$cacheDir)) {
}

if (! is_writable(self::$cacheDir)) {
throw new Exception('Cache directory isn\'t writable: ' . self::$cacheDir);
}
}
Expand Down
71 changes: 69 additions & 2 deletions scssphp/scssphp/src/Colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* SCSSPHP
*
* @copyright 2012-2019 Leaf Corcoran
* @copyright 2012-2020 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
Expand All @@ -25,7 +25,7 @@ class Colors
*
* @var array
*/
public static $cssColors = [
protected static $cssColors = [
'aliceblue' => '240,248,255',
'antiquewhite' => '250,235,215',
'aqua' => '0,255,255',
Expand Down Expand Up @@ -176,4 +176,71 @@ class Colors
'yellow' => '255,255,0',
'yellowgreen' => '154,205,50',
];

/**
* Convert named color in a [r,g,b[,a]] array
*
* @param string $colorName
*
* @return array|null
*/
public static function colorNameToRGBa($colorName)
{
if (is_string($colorName) && isset(static::$cssColors[$colorName])) {
$rgba = explode(',', static::$cssColors[$colorName]);

// only case with opacity is transparent, with opacity=0, so we can intval on opacity also
$rgba = array_map('intval', $rgba);

return $rgba;
}

return null;
}

/**
* Reverse conversion : from RGBA to a color name if possible
*
* @param integer $r
* @param integer $g
* @param integer $b
* @param integer $a
*
* @return string|null
*/
public static function RGBaToColorName($r, $g, $b, $a = 1)
{
static $reverseColorTable = null;

if (! is_numeric($r) || ! is_numeric($g) || ! is_numeric($b) || ! is_numeric($a)) {
return null;
}

if ($a < 1) {
# specific case we dont' revert according to spec
#if (! $a && ! $r && ! $g && ! $b) {
# return 'transparent';
#}

return null;
}

if (is_null($reverseColorTable)) {
$reverseColorTable = [];

foreach (static::$cssColors as $name => $rgb_str) {
$rgb_str = explode(',', $rgb_str);

if (count($rgb_str) == 3) {
$reverseColorTable[intval($rgb_str[0])][intval($rgb_str[1])][intval($rgb_str[2])] = $name;
}
}
}

if (isset($reverseColorTable[intval($r)][intval($g)][intval($b)])) {
return $reverseColorTable[intval($r)][intval($g)][intval($b)];
}

return null;
}
}
Loading