Skip to content
Merged
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 3rdparty
Submodule 3rdparty updated 44 files
+1 −1 composer.json
+16 −9 composer.lock
+7 −0 composer/autoload_classmap.php
+7 −0 composer/autoload_static.php
+16 −9 composer/installed.json
+5 −5 composer/installed.php
+2 −2 composer/package-versions-deprecated/src/PackageVersions/Versions.php
+24 −0 scssphp/scssphp/README.md
+49 −6 scssphp/scssphp/composer.json
+14 −32 scssphp/scssphp/scss.inc.php
+9 −0 scssphp/scssphp/src/Base/Range.php
+3 −1 scssphp/scssphp/src/Block.php
+39 −9 scssphp/scssphp/src/Cache.php
+7 −5 scssphp/scssphp/src/Colors.php
+69 −0 scssphp/scssphp/src/CompilationResult.php
+1,827 −710 scssphp/scssphp/src/Compiler.php
+77 −0 scssphp/scssphp/src/Compiler/CachedResult.php
+4 −2 scssphp/scssphp/src/Compiler/Environment.php
+2 −0 scssphp/scssphp/src/Exception/CompilerException.php
+2 −0 scssphp/scssphp/src/Exception/ParserException.php
+2 −0 scssphp/scssphp/src/Exception/RangeException.php
+4 −0 scssphp/scssphp/src/Exception/ServerException.php
+15 −1 scssphp/scssphp/src/Formatter.php
+2 −0 scssphp/scssphp/src/Formatter/Compact.php
+4 −0 scssphp/scssphp/src/Formatter/Compressed.php
+4 −0 scssphp/scssphp/src/Formatter/Crunched.php
+2 −0 scssphp/scssphp/src/Formatter/Debug.php
+2 −0 scssphp/scssphp/src/Formatter/Expanded.php
+2 −0 scssphp/scssphp/src/Formatter/Nested.php
+8 −6 scssphp/scssphp/src/Formatter/OutputBlock.php
+48 −0 scssphp/scssphp/src/Logger/LoggerInterface.php
+27 −0 scssphp/scssphp/src/Logger/QuietLogger.php
+60 −0 scssphp/scssphp/src/Logger/StreamLogger.php
+4 −2 scssphp/scssphp/src/Node.php
+68 −1 scssphp/scssphp/src/Node/Number.php
+58 −27 scssphp/scssphp/src/Parser.php
+4 −2 scssphp/scssphp/src/SourceMap/Base64.php
+2 −0 scssphp/scssphp/src/SourceMap/Base64VLQ.php
+17 −2 scssphp/scssphp/src/SourceMap/SourceMapGenerator.php
+1 −0 scssphp/scssphp/src/Type.php
+12 −9 scssphp/scssphp/src/Util.php
+95 −0 scssphp/scssphp/src/ValueConverter.php
+1 −1 scssphp/scssphp/src/Version.php
+84 −0 scssphp/scssphp/src/Warn.php
44 changes: 40 additions & 4 deletions apps/theming/lib/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use ScssPhp\ScssPhp\Compiler;

class Util {

Expand Down Expand Up @@ -96,15 +95,52 @@ public function elementColor($color, bool $brightBackground = true) {
return $color;
}

/**
* Convert RGB to HSL
*
* Copied from cssphp, copyright Leaf Corcoran, licensed under MIT
*
* @param integer $red
* @param integer $green
* @param integer $blue
*
* @return array
*/
public function toHSL($red, $green, $blue) {
$min = min($red, $green, $blue);
$max = max($red, $green, $blue);
$l = $min + $max;
$d = $max - $min;

if ((int) $d === 0) {
$h = $s = 0;
} else {
if ($l < 255) {
$s = $d / $l;
} else {
$s = $d / (510 - $l);
}

if ($red == $max) {
$h = 60 * ($green - $blue) / $d;
} elseif ($green == $max) {
$h = 60 * ($blue - $red) / $d + 120;
} else {
$h = 60 * ($red - $green) / $d + 240;
}
}

return [fmod($h, 360), $s * 100, $l / 5.1];
}

/**
* @param string $color rgb color value
* @return float
*/
public function calculateLuminance($color) {
[$red, $green, $blue] = $this->hexToRGB($color);
$compiler = new Compiler();
$hsl = $compiler->toHSL($red, $green, $blue);
return $hsl[3] / 100;
$hsl = $this->toHSL($red, $green, $blue);
return $hsl[2] / 100;
}

/**
Expand Down
3 changes: 0 additions & 3 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@
</UndefinedPropertyFetch>
</file>
<file src="apps/dav/lib/CalDAV/ResourceBooking/AbstractPrincipalBackend.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|string</code>
</ImplementedReturnTypeMismatch>
<InvalidNullableReturnType occurrences="1">
<code>array</code>
</InvalidNullableReturnType>
Expand Down
5 changes: 2 additions & 3 deletions lib/private/Template/SCSSCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
use OCP\IMemcache;
use OCP\IURLGenerator;
use ScssPhp\ScssPhp\Compiler;
use ScssPhp\ScssPhp\Exception\ParserException;
use ScssPhp\ScssPhp\OutputStyle;

class SCSSCacher {
Expand Down Expand Up @@ -340,7 +339,7 @@ private function cache(string $path, string $fileNameCSS, string $fileNameSCSS,
'@import "variables.scss";' .
'@import "functions.scss";' .
'@import "' . $fileNameSCSS . '";');
} catch (ParserException $e) {
} catch (\Exception $e) {
$this->logger->logException($e, ['app' => 'scss_cacher']);

return false;
Expand Down Expand Up @@ -431,7 +430,7 @@ private function getInjectedVariables(string $cache = ''): string {
$scss = new Compiler();
$scss->compile($variables);
$this->injectedVariables = $variables;
} catch (ParserException $e) {
} catch (\Exception $e) {
$this->logger->logException($e, ['app' => 'scss_cacher']);
}

Expand Down