diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-07-19 23:54:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 23:54:29 +0200 |
commit | 4751f1e7f766419fd013e5d6ddac4988e9158f5c (patch) | |
tree | aece73c6e050c5adfd8a68f29f3c2eb02d51d961 | |
parent | 8032e362ec27111f5813f70b9604e7d07c6bf2ab (diff) | |
parent | 9d94cc16976970c84d5a88e090ea55be273be712 (diff) | |
download | nextcloud-server-4751f1e7f766419fd013e5d6ddac4988e9158f5c.tar.gz nextcloud-server-4751f1e7f766419fd013e5d6ddac4988e9158f5c.zip |
Merge pull request #9984 from nextcloud/inverted-svg-api
Svg color api
65 files changed, 931 insertions, 323 deletions
diff --git a/apps/accessibility/css/themedark.scss b/apps/accessibility/css/themedark.scss index c0935165c7d..fc33b333ce9 100644 --- a/apps/accessibility/css/themedark.scss +++ b/apps/accessibility/css/themedark.scss @@ -37,12 +37,16 @@ $color-border-dark: lighten($color-main-background, 14%); } } } -.federation-menu .icon-federation-menu { - filter: invert(100%); -} .bubble, .app-navigation-entry-menu, .popovermenu, #header .menu { border: 1px solid var(--color-border); } + +// since svg icons are inverted, revert to white for the header +.header-right > * { + [class^='icon-'], [class*=' icon-'] { + filter: invert(100%); + } +} diff --git a/apps/accessibility/lib/Controller/AccessibilityController.php b/apps/accessibility/lib/Controller/AccessibilityController.php index ea4de77d7a0..4ee88b90a7a 100644 --- a/apps/accessibility/lib/Controller/AccessibilityController.php +++ b/apps/accessibility/lib/Controller/AccessibilityController.php @@ -36,6 +36,7 @@ use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; +use OC\Template\IconsCacher; class AccessibilityController extends Controller { @@ -66,6 +67,9 @@ class AccessibilityController extends Controller { /** @var IAppManager */ private $appManager; + /** @var IconsCacher */ + protected $iconsCacher; + /** * Account constructor. * @@ -87,7 +91,8 @@ class AccessibilityController extends Controller { IURLGenerator $urlGenerator, ITimeFactory $timeFactory, IUserSession $userSession, - IAppManager $appManager) { + IAppManager $appManager, + IconsCacher $iconsCacher) { parent::__construct($appName, $request); $this->appName = $appName; $this->config = $config; @@ -97,6 +102,7 @@ class AccessibilityController extends Controller { $this->timeFactory = $timeFactory; $this->userSession = $userSession; $this->appManager = $appManager; + $this->iconsCacher = $iconsCacher; $this->serverRoot = \OC::$SERVERROOT; $this->appRoot = $this->appManager->getAppPath($this->appName); @@ -147,7 +153,12 @@ class AccessibilityController extends Controller { // Rebase all urls $appWebRoot = substr($this->appRoot, strlen($this->serverRoot) - strlen(\OC::$WEBROOT)); - $css = $this->rebaseUrls($css, $appWebRoot . '/css'); + $css = $this->rebaseUrls($css, $appWebRoot . '/css'); + + if (in_array('themedark', $userValues) && $this->iconsCacher->getCachedCSS() && $this->iconsCacher->getCachedCSS()->getSize() > 0) { + $iconsCss = $this->invertSvgIconsColor($this->iconsCacher->getCachedCSS()->getContent()); + $css = $css . $iconsCss; + } $response = new DataDisplayResponse($css, Http::STATUS_OK, ['Content-Type' => 'text/css']); @@ -199,4 +210,14 @@ class AccessibilityController extends Controller { return preg_replace($re, $subst, $css); } + + /** + * Remove all matches from the $rule regex + * + * @param string $css string to parse + * @return string + */ + private function invertSvgIconsColor(string $css) { + return str_replace(['/000', '/fff', '/***'], ['/***', '/000', '/fff'], $css); + } } diff --git a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php index 7456074915b..f85ca1a7769 100644 --- a/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Filter/Calendar.php @@ -72,7 +72,7 @@ class Calendar implements IFilter { * @since 11.0.0 */ public function getIcon() { - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')); + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg')); } /** diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php index 0fdd50b54c4..1c31508255a 100644 --- a/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/CalendarTest.php @@ -55,7 +55,7 @@ class CalendarTest extends TestCase { public function testGetIcon() { $this->url->expects($this->once()) ->method('imagePath') - ->with('core', 'places/calendar-dark.svg') + ->with('core', 'places/calendar.svg') ->willReturn('path-to-icon'); $this->url->expects($this->once()) diff --git a/apps/encryption/css/settings-personal.css b/apps/encryption/css/settings-personal.scss index 4bab1a8d46b..d9846cc77f6 100644 --- a/apps/encryption/css/settings-personal.css +++ b/apps/encryption/css/settings-personal.scss @@ -11,5 +11,5 @@ /* icons for sidebar */ .nav-icon-basic-encryption-module { - background-image: url('../img/app.svg?v=1'); + @include icon-color('app', 'encryption', $color-black); }
\ No newline at end of file diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 79dc2a26ebd..85c59294803 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -84,30 +84,29 @@ /* icons for sidebar */ .nav-icon-files { - background-image: url('../img/folder.svg?v=1'); + @include icon-color('folder', 'files', $color-black); } .nav-icon-recent { - background-image: url('../img/recent.svg?v=1'); + @include icon-color('recent', 'files', $color-black); } .nav-icon-favorites { - background-image: url('../img/star.svg?v=1'); + @include icon-color('star-dark', 'files', $color-black, 2, true); } .nav-icon-sharingin, -.nav-icon-sharingout, -.nav-icon-shareoverview { - background-image: url('../img/share.svg?v=1'); +.nav-icon-sharingout { + @include icon-color('share', 'files', $color-black); } .nav-icon-sharinglinks { - background-image: url('../img/public.svg?v=1'); + @include icon-color('public', 'files', $color-black); } .nav-icon-extstoragemounts { - background-image: url('../img/external.svg?v=1'); + @include icon-color('external', 'files', $color-black); } .nav-icon-trashbin { - background-image: url('../img/delete.svg?v=1'); + @include icon-color('delete', 'files', $color-black); } .nav-icon-deletedshares { - background-image: url('../img/unshare.svg?v=1'); + @include icon-color('unshare', 'files', $color-black); } #app-navigation .nav-files a.nav-icon-files { @@ -668,7 +667,7 @@ table.dragshadow td.size { background-image: none; } & .icon-starred { - background-image: url('../../../core/img/actions/starred.svg?v=1'); + @include icon-color('star-dark', 'actions', 'FC0', 1, true); } } diff --git a/apps/files/lib/Activity/Filter/FileChanges.php b/apps/files/lib/Activity/Filter/FileChanges.php index 122dc4250f9..c828755a659 100644 --- a/apps/files/lib/Activity/Filter/FileChanges.php +++ b/apps/files/lib/Activity/Filter/FileChanges.php @@ -74,7 +74,7 @@ class FileChanges implements IFilter { * @since 11.0.0 */ public function getIcon() { - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files-dark.svg')); + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/files.svg')); } /** diff --git a/apps/files_external/css/settings.scss b/apps/files_external/css/settings.scss index bd45b57f6d5..04ecfc41620 100644 --- a/apps/files_external/css/settings.scss +++ b/apps/files_external/css/settings.scss @@ -122,5 +122,5 @@ td.mountPoint, td.backend { width:160px; } } .nav-icon-external-storage { - background-image: url('../img/app-dark.svg?v=1'); + @include icon-color('app-dark', 'files_external', $color-black); } diff --git a/apps/systemtags/css/systemtagsfilelist.css b/apps/systemtags/css/systemtagsfilelist.scss index ad711f74733..3c188e76449 100644 --- a/apps/systemtags/css/systemtagsfilelist.css +++ b/apps/systemtags/css/systemtagsfilelist.scss @@ -13,7 +13,7 @@ } .nav-icon-systemtagsfilter { - background-image: url('../img/tag.svg'); + @include icon-color('tag', 'systemtags', $color-black); } #app-sidebar .mainFileInfoView .tag-label { diff --git a/autotest-js.sh b/autotest-js.sh index 5f03132ee42..b5bb9965553 100755 --- a/autotest-js.sh +++ b/autotest-js.sh @@ -28,7 +28,7 @@ for SCSSFILE in core/css/*.scss do FILE=$(basename $SCSSFILE) FILENAME="${FILE%.*}" - printf "@import 'variables.scss'; @import '${FILE}';" | ./build/bin/node-sass --include-path core/css/ > tests/css/${FILE}.css + printf "\$webroot:''; @import 'functions.scss'; @import 'variables.scss'; @import '${FILE}';" | ./build/bin/node-sass --include-path core/css/ > tests/css/${FILE}.css done KARMA="$PREFIX/node_modules/karma/bin/karma" diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index 3fc48e9a380..f91fe8f75d5 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -57,8 +57,8 @@ class JsController extends Controller { * @PublicPage * @NoCSRFRequired * - * @param string $fileName css filename with extension - * @param string $appName css folder name + * @param string $fileName js filename with extension + * @param string $appName js folder name * @return FileDisplayResponse|NotFoundResponse */ public function getJs(string $fileName, string $appName): Response { diff --git a/core/Controller/SvgController.php b/core/Controller/SvgController.php new file mode 100644 index 00000000000..3d1c55d0143 --- /dev/null +++ b/core/Controller/SvgController.php @@ -0,0 +1,144 @@ +<?php +declare (strict_types = 1); +/** + * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) + * + * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Core\Controller; + +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\DataDisplayResponse; +use OCP\AppFramework\Http\NotFoundResponse; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\Files\NotFoundException; +use OCP\App\IAppManager; +use OCP\IRequest; + +class SvgController extends Controller { + + /** @var string */ + protected $serverRoot; + + /** @var ITimeFactory */ + protected $timeFactory; + + /** @var IAppManager */ + protected $appManager; + + public function __construct(string $appName, + IRequest $request, + ITimeFactory $timeFactory, + IAppManager $appManager) { + parent::__construct($appName, $request); + + $this->serverRoot = \OC::$SERVERROOT; + $this->timeFactory = $timeFactory; + $this->appManager = $appManager; + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + * + * Generate svg from filename with the requested color + * + * @param string $folder + * @param string $fileName + * @param string $color + * @return DataDisplayResponse|NotFoundResponse + */ + public function getSvgFromCore(string $folder, string $fileName, string $color = 'ffffff') { + $path = $this->serverRoot . "/core/img/$folder/$fileName.svg"; + return $this->getSvg($path, $color, $fileName); + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + * + * Generate svg from filename with the requested color + * + * @param string $app + * @param string $fileName + * @param string $color + * @return DataDisplayResponse|NotFoundResponse + */ + public function getSvgFromApp(string $app, string $fileName, string $color = 'ffffff') { + + if ($app === 'settings') { + $path = $this->serverRoot . "/settings/img/$fileName.svg"; + return $this->getSvg($path, $color, $fileName); + } + + $appRootPath = $this->appManager->getAppPath($app); + $appPath = substr($appRootPath, strlen($this->serverRoot)); + + if (!$appPath) { + return new NotFoundResponse(); + } + $path = $this->serverRoot . $appPath ."/img/$fileName.svg"; + return $this->getSvg($path, $color, $fileName); + } + + + /** + * Generate svg from filename with the requested color + * + * @param string $path + * @param string $color + * @return DataDisplayResponse|NotFoundResponse + */ + private function getSvg(string $path, string $color, string $fileName) { + if (!file_exists($path)) { + return new NotFoundResponse(); + } + + $svg = file_get_contents($path); + + if (is_null($svg)) { + return new NotFoundResponse(); + } + + // add fill (fill is not present on black elements) + $fillRe = '/<((circle|rect|path)((?!fill)[a-z0-9 =".\-#():;])+)\/>/mi'; + + $svg = preg_replace($fillRe, '<$1 fill="#' . $color . '"/>', $svg); + + // replace any fill or stroke colors + $svg = preg_replace('/stroke="#([a-z0-9]{3,6})"/mi', 'stroke="#' . $color . '"', $svg); + $svg = preg_replace('/fill="#([a-z0-9]{3,6})"/mi', 'fill="#' . $color . '"', $svg); + + $response = new DataDisplayResponse($svg, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']); + + // Set cache control + $ttl = 31536000; + $response->cacheFor($ttl); + $response->addHeader('Content-Disposition', 'inline; filename="' . $fileName . '.svg"'); + $expires = new \DateTime(); + $expires->setTimestamp($this->timeFactory->getTime()); + $expires->add(new \DateInterval('PT' . $ttl . 'S')); + $response->addHeader('Expires', $expires->format(\DateTime::RFC1123)); + $response->addHeader('Pragma', 'cache'); + + return $response; + } +}
\ No newline at end of file diff --git a/core/css/apps.scss b/core/css/apps.scss index 6645b6868d5..a7898948f74 100644 --- a/core/css/apps.scss +++ b/core/css/apps.scss @@ -693,7 +693,7 @@ kbd { padding: 0; margin: 0; background-color: var(--color-main-background); - background-image: url('../img/actions/settings-dark.svg?v=1'); + @include icon-color('settings-dark', 'actions', $color-black, 1, true); background-position: 14px center; background-repeat: no-repeat; box-shadow: none; diff --git a/core/css/functions.scss b/core/css/functions.scss new file mode 100644 index 00000000000..2875230b512 --- /dev/null +++ b/core/css/functions.scss @@ -0,0 +1,48 @@ +/** + * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) + * + * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * SVG COLOR API + * + * @param string $icon the icon filename + * @param string $dir the icon folder within /core/img if $core or app name + * @param string $color the desired color in hexadecimal + * @param int $version the version of the file + * @param bool [$core] search icon in core + * + * @returns string the url to the svg api endpoint + */ +@mixin icon-color($icon, $dir, $color, $version: 1, $core: false) { + // remove # from color + // inspect cast int to string + $index: str-index(inspect($color), '#'); + @if $index { + $color: str-slice(inspect($color), 2); + } + $varName: "--icon-#{$icon}-#{$color}"; + @if $core { + #{$varName}: url('#{$webroot}/svg/core/#{$dir}/#{$icon}/#{$color}?v=#{$version}'); + } @else { + #{$varName}: url('#{$webroot}/svg/#{$dir}/#{$icon}/#{$color}?v=#{$version}'); + } + background-image: var(#{$varName}); +}
\ No newline at end of file diff --git a/core/css/header.scss b/core/css/header.scss index e218f86fa9b..a3566f9a21e 100644 --- a/core/css/header.scss +++ b/core/css/header.scss @@ -322,7 +322,6 @@ nav[role='navigation'] { } /* Apps management */ - #apps { max-height: calc(100vh - 100px); overflow: auto; @@ -336,7 +335,6 @@ nav[role='navigation'] { } /* USER MENU -----------------------------------------------------------------*/ - #settings { display: inline-block; height: 100%; @@ -405,6 +403,7 @@ nav[role='navigation'] { } } +/* Settings menu */ #expanddiv { &.menu { right: 17px; @@ -438,6 +437,7 @@ nav[role='navigation'] { } } +/* Apps menu */ #appmenu { display: inline-block; width: auto; @@ -585,3 +585,57 @@ nav[role='navigation'] { top: 50px; } } + +/* SEARCHBOX --------------------------------------------------------------- */ +.searchbox { + position: relative; + display: flex; + align-items: center; + input[type='search'] { + position: relative; + font-size: 1.2em; + padding: 3px; + padding-left: 25px; + padding-right: 20px; + background-color: transparent; + color: var(--color-primary-text); + border: 0; + border-radius: var(--border-radius); + height: 34px; + width: 0; + cursor: pointer; + -webkit-transition: all 100ms; + transition: all 100ms; + opacity: .6; + &:focus, &:active, &:valid { + background-position-x: 6px; + color: var(--color-primary-text); + width: 155px; + cursor: text; + background-color: var(--color-primary) !important; + border: 1px solid var(--color-primary-text-dark) !important; + } + &:hover, &:focus, &:active { + opacity: 1; + } + & ~ .icon-close-white { + display: inline; + position: absolute; + width: 30px; + height: 100%; + right: 0; + top: 0; + margin: 0; + &, &:focus, &:active, &:hover { + border: none; + background-color: transparent; + } + } + &:not(:valid) ~ .icon-close-white { + display: none; + } + &::-webkit-search-cancel-button { + -webkit-appearance: none; + } + } +}
\ No newline at end of file diff --git a/core/css/icons.scss b/core/css/icons.scss index 91a90abe27e..27863f017f4 100644 --- a/core/css/icons.scss +++ b/core/css/icons.scss @@ -1,15 +1,30 @@ /** - * @copyright Copyright (c) 2016, John Molakvoæ <skjnldsv@protonmail.com> - * @copyright Copyright (c) 2016, Joas Schilling <coding@schilljs.com> - * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch> - * @copyright Copyright (c) 2016, Roeland Jago Douma <roeland@famdouma.nl> - * @copyright Copyright (c) 2016, Vincent Chan <plus.vincchan@gmail.com> - * @copyright Copyright (c) 2015, Thomas Müller <thomas.mueller@tmit.eu> - * @copyright Copyright (c) 2015, Hendrik Leppelsack <hendrik@leppelsack.de> - * @copyright Copyright (c) 2015, Jan-Christoph Borchardt <hey@jancborchardt.net> + * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) + * + * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * @author Joas Schilling <coding@schilljs.com> + * @author Lukas Reschke <lukas@statuscode.ch> + * @author Roeland Jago Douma <roeland@famdouma.nl> + * @author Vincent Chan <plus.vincchan@gmail.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Hendrik Leppelsack <hendrik@leppelsack.de> + * @author Jan-Christoph Borchardt <hey@jancborchardt.net> * * @license GNU AGPL version 3 or any later version * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * */ /* GLOBAL ------------------------------------------------------------------- */ @@ -101,545 +116,545 @@ img, object, video, button, textarea, input, select, div[contenteditable='true'] } } -/* ICONS -------------------------------------------------------------------- */ +/* ICONS ------------------------------------------------------------------- */ .icon-add { - background-image: url('../img/actions/add.svg?v=1'); + @include icon-color('add', 'actions', $color-black, 1, true); } .icon-address { - background-image: url('../img/actions/address.svg?v=1'); + @include icon-color('address', 'actions', $color-black, 1, true); +} +.icon-address-white { + @include icon-color('address', 'actions', $color-white, 1, true); } .icon-audio { - background-image: url('../img/actions/audio.svg?v=1'); + @include icon-color('audio', 'actions', $color-black, 2, true); } -/* TODO: to be deprecated; use .icon-audio.icon-white.icon-shadow */ .icon-audio-white { - background-image: url('../img/actions/audio.svg?v=2'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('audio', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } .icon-audio-off { - background-image: url('../img/actions/audio-off.svg?v=1'); + @include icon-color('audio-off', 'actions', $color-black, 1, true); } -/* TODO: to be deprecated; use .icon-audio-off.icon-white.icon-shadow */ .icon-audio-off-white { - background-image: url('../img/actions/audio-off.svg?v=1'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('audio-off', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } +.icon-caret-white, .icon-caret { - background-image: url('../img/actions/caret.svg?v=1'); + @include icon-color('caret', 'actions', $color-white, 1, true); } .icon-caret-dark { - background-image: url('../img/actions/caret-dark.svg?v=1'); + @include icon-color('caret', 'actions', $color-black, 1, true); } .icon-checkmark { - background-image: url('../img/actions/checkmark.svg?v=1'); + @include icon-color('checkmark', 'actions', $color-black, 1, true); + } .icon-checkmark-white { - background-image: url('../img/actions/checkmark-white.svg?v=1'); + @include icon-color('checkmark', 'actions', $color-white, 1, true); } .icon-checkmark-color { - background-image: url('../img/actions/checkmark-color.svg?v=1'); + @include icon-color('checkmark', 'actions', $color-success, 1, true); } .icon-clippy { - background-image: url('../img/actions/clippy.svg?v=2'); + @include icon-color('clippy', 'actions', $color-black, 2, true); } .icon-close { - background-image: url('../img/actions/close.svg?v=1'); + @include icon-color('close', 'actions', $color-black, 1, true); } .icon-close-white { - background-image: url('../img/actions/close-white.svg?v=1'); + @include icon-color('close', 'actions', $color-white, 1, true); } .icon-comment { - background-image: url('../img/actions/comment.svg?v=1'); + @include icon-color('comment', 'actions', $color-black, 1, true); } .icon-confirm { - background-image: url('../img/actions/confirm.svg?v=2'); + @include icon-color('confirm', 'actions', $color-black, 2, true); } .icon-confirm-fade { - background-image: url('../img/actions/confirm-fade.svg?v=2'); + @include icon-color('confirm-fade', 'actions', $color-black, 2, true); } .icon-confirm-white { - background-image: url('../img/actions/confirm-white.svg?v=2'); + @include icon-color('confirm', 'actions', $color-white, 2, true); } .icon-delete { - background-image: url('../img/actions/delete.svg?v=1'); + @include icon-color('delete', 'actions', $color-black, 1, true); &.no-permission { &:hover, &:focus { - background-image: url('../img/actions/delete.svg?v=1'); + @include icon-color('delete', 'actions', $color-black, 1, true); } } &:hover, &:focus { - background-image: url('../img/actions/delete-hover.svg?v=1'); + @include icon-color('delete', 'actions', $color-error, 1, true); filter: initial; } } .icon-delete-white { - background-image: url('../img/actions/delete-white.svg?v=1'); + @include icon-color('delete', 'actions', $color-white, 1, true); &.no-permission { &:hover, &:focus { - background-image: url('../img/actions/delete-white.svg?v=1'); + @include icon-color('delete', 'actions', $color-white, 1, true); } } &:hover, &:focus { - background-image: url('../img/actions/delete-hover.svg?v=1'); + @include icon-color('delete', 'actions', $color-error, 1, true); } } .icon-details { - background-image: url('../img/actions/details.svg?v=1'); + @include icon-color('details', 'actions', $color-black, 1, true); } .icon-download { - background-image: url('../img/actions/download.svg?v=1'); + @include icon-color('download', 'actions', $color-black, 1, true); } .icon-download-white { - background-image: url('../img/actions/download-white.svg?v=1'); + @include icon-color('download', 'actions', $color-white, 1, true); } .icon-edit { - background-image: url('../img/actions/edit.svg?v=1'); + @include icon-color('edit', 'actions', $color-black, 1, true); } .icon-error { - background-image: url('../img/actions/error.svg?v=1'); + @include icon-color('error', 'actions', $color-black, 1, true); } .icon-error-white { - background-image: url('../img/actions/error-white.svg?v=1'); + @include icon-color('error', 'actions', $color-white, 1, true); } .icon-error-color { - background-image: url('../img/actions/error-color.svg?v=1'); + @include icon-color('error', 'actions', $color-error, 1, true); } .icon-external { - background-image: url('../img/actions/external.svg?v=1'); + @include icon-color('external', 'actions', $color-black, 1, true); } .icon-fullscreen { - background-image: url('../img/actions/fullscreen.svg?v=1'); + @include icon-color('fullscreen', 'actions', $color-black, 1, true); } -/* TODO: to be deprecated; use .icon-fullscreen.icon-white.icon-shadow */ .icon-fullscreen-white { - background-image: url('../img/actions/fullscreen.svg?v=1'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('fullscreen', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } .icon-history { - background-image: url('../img/actions/history.svg?v=1'); + @include icon-color('history', 'actions', $color-black, 1, true); } .icon-info { - background-image: url('../img/actions/info.svg?v=1'); + @include icon-color('info', 'actions', $color-black, 1, true); } .icon-info-white { - background-image: url('../img/actions/info-white.svg?v=1'); + @include icon-color('info', 'actions', $color-white, 1, true); } .icon-logout { - background-image: url('../img/actions/logout.svg?v=1'); + @include icon-color('logout', 'actions', $color-black, 1, true); } .icon-mail { - background-image: url('../img/actions/mail.svg?v=1'); + @include icon-color('mail', 'actions', $color-black, 1, true); } .icon-menu { - background-image: url('../img/actions/menu.svg?v=1'); + @include icon-color('menu', 'actions', $color-black, 1, true); } .icon-more { - background-image: url('../img/actions/more.svg?v=1'); + @include icon-color('more', 'actions', $color-black, 1, true); } .icon-more-white { - background-image: url('../img/actions/more-white.svg?v=1'); + @include icon-color('more', 'actions', $color-white, 1, true); } .icon-password { - background-image: url('../img/actions/password.svg?v=1'); + @include icon-color('password', 'actions', $color-black, 1, true); } .icon-pause { - background-image: url('../img/actions/pause.svg?v=1'); + @include icon-color('pause', 'actions', $color-black, 1, true); } .icon-play { - background-image: url('../img/actions/play.svg?v=1'); + @include icon-color('play', 'actions', $color-black, 1, true); } .icon-play-add { - background-image: url('../img/actions/play-add.svg?v=1'); + @include icon-color('play-add', 'actions', $color-black, 1, true); } .icon-play-next { - background-image: url('../img/actions/play-next.svg?v=1'); + @include icon-color('play-next', 'actions', $color-black, 1, true); } .icon-play-previous { - background-image: url('../img/actions/play-previous.svg?v=1'); + @include icon-color('play-previous', 'actions', $color-black, 1, true); } .icon-public { - background-image: url('../img/actions/public.svg?v=1'); + @include icon-color('public', 'actions', $color-black, 1, true); } .icon-quota { - background-image: url('../img/actions/quota.svg?v=1'); + @include icon-color('quota', 'actions', $color-black, 1, true); } .icon-rename { - background-image: url('../img/actions/rename.svg?v=1'); + @include icon-color('rename', 'actions', $color-black, 1, true); } .icon-screen { - background-image: url('../img/actions/screen.svg?v=1'); + @include icon-color('screen', 'actions', $color-black, 1, true); } -/* TODO: to be deprecated; use .icon-screen.icon-white.icon-shadow */ .icon-screen-white { - background-image: url('../img/actions/screen.svg?v=1'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('screen', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } .icon-screen-off { - background-image: url('../img/actions/screen-off.svg?v=1'); + @include icon-color('screen-off', 'actions', $color-black, 1, true); } -/* TODO: to be deprecated; use .icon-screen-off.icon-white.icon-shadow */ .icon-screen-off-white { - background-image: url('../img/actions/screen-off.svg?v=1'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('screen-off', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } .icon-search { - background-image: url('../img/actions/search.svg?v=1'); + @include icon-color('search', 'actions', $color-black, 1, true); } .icon-search-white { - background-image: url('../img/actions/search-white.svg?v=1'); + @include icon-color('search', 'actions', $color-white, 1, true); } +/* default icon have a .5 opacity */ .icon-settings { - background-image: url('../img/actions/settings.svg?v=1'); + @include icon-color('settings', 'actions', $color-black, 1, true); } .icon-settings-dark { - background-image: url('../img/actions/settings-dark.svg?v=1'); + @include icon-color('settings-dark', 'actions', $color-black, 1, true); } .icon-settings-white { - background-image: url('../img/actions/settings-white.svg?v=1'); + @include icon-color('settings-dark', 'actions', $color-white, 1, true); } /* always use icon-shared, AdBlock blocks icon-share */ .icon-shared, .icon-share { - background-image: url('../img/actions/share.svg?v=1'); + @include icon-color('share', 'actions', $color-black, 1, true); } .icon-sound { - background-image: url('../img/actions/sound.svg?v=1'); + @include icon-color('sound', 'actions', $color-black, 1, true); } .icon-sound-off { - background-image: url('../img/actions/sound-off.svg?v=1'); + @include icon-color('sound-off', 'actions', $color-black, 1, true); } .icon-favorite { - background-image: url('../img/actions/star-dark.svg?v=1'); + @include icon-color('star-dark', 'actions', $color-black, 1, true); } .icon-star { - background-image: url('../img/actions/star.svg?v=1'); + @include icon-color('star', 'actions', $color-black, 1, true); } .icon-star-dark { - background-image: url('../img/actions/star-dark.svg?v=1'); + @include icon-color('star', 'actions', $color-black, 1, true); } .icon-starred { &:hover, &:focus { - background-image: url('../img/actions/star.svg?v=1'); + @include icon-color('star', 'actions', $color-black, 1, true); } - background-image: url('../img/actions/starred.svg?v=1'); + @include icon-color('star-dark', 'actions', 'FC0', 1, true); } .icon-star { &:hover, &:focus { - background-image: url('../img/actions/starred.svg?v=1'); + @include icon-color('star-dark', 'actions', 'FC0', 1, true); } } .icon-tag { - background-image: url('../img/actions/tag.svg?v=1'); + @include icon-color('tag', 'actions', $color-black, 1, true); } .icon-timezone { - background-image: url('../img/actions/timezone.svg?v=1'); + @include icon-color('timezone', 'actions', $color-black, 1, true); } .icon-toggle { - background-image: url('../img/actions/toggle.svg?v=1'); + @include icon-color('toggle', 'actions', $color-black, 1, true); } .icon-toggle-background { - background-image: url('../img/actions/toggle-background.svg?v=1'); + @include icon-color('toggle-background', 'actions', $color-black, 1, true); } .icon-toggle-pictures { - background-image: url('../img/actions/toggle-pictures.svg?v=1'); + @include icon-color('toggle-pictures', 'actions', $color-black, 1, true); } .icon-triangle-e { - background-image: url('../img/actions/triangle-e.svg?v=1'); + @include icon-color('triangle-e', 'actions', $color-black, 1, true); } .icon-triangle-n { - background-image: url('../img/actions/triangle-n.svg?v=1'); + @include icon-color('triangle-n', 'actions', $color-black, 1, true); } .icon-triangle-s { - background-image: url('../img/actions/triangle-s.svg?v=1'); + @include icon-color('triangle-s', 'actions', $color-black, 1, true); } .icon-upload { - background-image: url('../img/actions/upload.svg?v=1'); + @include icon-color('upload', 'actions', $color-black, 1, true); } .icon-upload-white { - background-image: url('../img/actions/upload-white.svg?v=1'); + @include icon-color('upload', 'actions', $color-white, 1, true); } .icon-user { - background-image: url('../img/actions/user.svg?v=1'); + @include icon-color('user', 'actions', $color-black, 1, true); } .icon-video { - background-image: url('../img/actions/video.svg?v=1'); + @include icon-color('video', 'actions', $color-black, 2, true); } -/* TODO: to be deprecated; use .icon-video-off.icon-white.icon-shadow */ .icon-video-white { - background-image: url('../img/actions/video.svg?v=2'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('video', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } .icon-video-off { - background-image: url('../img/actions/video-off.svg?v=1'); + @include icon-color('video-off', 'actions', $color-black, 1, true); } -/* TODO: to be deprecated; use .icon-video-off.icon-white.icon-shadow */ .icon-video-off-white { - background-image: url('../img/actions/video-off.svg?v=1'); - filter: invert(100%) drop-shadow(1px 1px 4px var(--color-box-shadow)); + @include icon-color('video-off', 'actions', $color-white, 1, true); + filter: drop-shadow(1px 1px 4px var(--color-box-shadow)); } .icon-video-switch { - background-image: url('../img/actions/video-switch.svg?v=1'); + @include icon-color('video-switch', 'actions', $color-black, 1, true); } .icon-view-close { - background-image: url('../img/actions/view-close.svg?v=1'); + @include icon-color('view-close', 'actions', $color-black, 1, true); } .icon-view-download { - background-image: url('../img/actions/view-download.svg?v=1'); + @include icon-color('view-download', 'actions', $color-black, 1, true); } .icon-view-next { - background-image: url('../img/actions/arrow-right.svg?v=1'); + @include icon-color('arrow-right', 'actions', $color-black, 1, true); } .icon-view-pause { - background-image: url('../img/actions/view-pause.svg?v=1'); + @include icon-color('view-pause', 'actions', $color-black, 1, true); } .icon-view-play { - background-image: url('../img/actions/view-play.svg?v=1'); + @include icon-color('view-play', 'actions', $color-black, 1, true); } .icon-view-previous { - background-image: url('../img/actions/arrow-left.svg?v=1'); + @include icon-color('arrow-left', 'actions', $color-black, 1, true); } .icon-disabled-user { - background-image: url('../img/actions/disabled-user.svg?v=1'); + @include icon-color('disabled-user', 'actions', $color-black, 1, true); } .icon-disabled-users { - background-image: url('../img/actions/disabled-users.svg?v=1'); + @include icon-color('disabled-users', 'actions', $color-black, 1, true); } .icon-user-admin { - background-image: url('../img/actions/user-admin.svg?v=1'); + @include icon-color('user-admin', 'actions', $color-black, 1, true); } /* PLACES ------------------------------------------------------------------- */ .icon-calendar { - background-image: url('../img/places/calendar.svg?v=1'); + @include icon-color('calendar', 'places', $color-white, 1, true); } .icon-calendar-dark { - background-image: url('../img/places/calendar-dark.svg?v=1'); + @include icon-color('calendar', 'places', $color-black, 1, true); } .icon-contacts { - background-image: url('../img/places/contacts.svg?v=1'); + @include icon-color('contacts', 'places', $color-white, 1, true); } .icon-contacts-dark { - background-image: url('../img/places/contacts-dark.svg?v=1'); + @include icon-color('contacts', 'places', $color-black, 1, true); } .icon-files { - background-image: url('../img/places/files.svg?v=1'); + @include icon-color('files', 'places', $color-white, 1, true); } .icon-files-dark { - background-image: url('../img/places/files-dark.svg?v=1'); + @include icon-color('files', 'places', $color-black, 1, true); } .icon-file, .icon-filetype-text { - background-image: url('../img/filetypes/text.svg?v=1'); + @include icon-color('text', 'filetypes', $color-black, 1, true); } .icon-folder, .icon-filetype-folder { - background-image: url('../img/filetypes/folder.svg?v=1'); + @include icon-color('folder', 'filetypes', $color-black, 1, true); } .icon-filetype-folder-drag-accept { - background-image: url('../img/filetypes/folder-drag-accept.svg?v=1') !important; + @include icon-color('folder-drag-accept', 'filetypes', $color-black, 1, true); } .icon-home { - background-image: url('../img/places/home.svg?v=1'); + @include icon-color('home', 'places', $color-black, 1, true); } .icon-link { - background-image: url('../img/places/link.svg?v=1'); + @include icon-color('link', 'places', $color-black, 1, true); } .icon-music { - background-image: url('../img/places/music.svg?v=1'); + @include icon-color('music', 'places', $color-black, 1, true); } .icon-picture { - background-image: url('../img/places/picture.svg?v=1'); + @include icon-color('picture', 'places', $color-black, 1, true); } /* CLIENTS ------------------------------------------------------------------- */ .icon-desktop { - background-image: url('../img/clients/desktop.svg?v=1'); + @include icon-color('desktop', 'clients', $color-black, 1, true); } .icon-phone { - background-image: url('../img/clients/phone.svg?v=1'); + @include icon-color('phone', 'clients', $color-black, 1, true); } .icon-tablet { - background-image: url('../img/clients/tablet.svg?v=1'); + @include icon-color('tablet', 'clients', $color-black, 1, true); } /* APP CATEGORIES ------------------------------------------------------------------- */ .icon-category-installed { - background-image: url('../img/actions/user.svg?v=1'); + @include icon-color('user', 'actions', $color-black, 1, true); } .icon-category-enabled { - background-image: url('../img/actions/checkmark.svg?v=1'); + @include icon-color('checkmark', 'actions', $color-black, 1, true); } .icon-category-disabled { - background-image: url('../img/actions/close.svg?v=1'); + @include icon-color('close', 'actions', $color-black, 1, true); } .icon-category-app-bundles { - background-image: url('../img/categories/bundles.svg?v=1'); + @include icon-color('bundles', 'categories', $color-black, 1, true); } .icon-category-updates { - background-image: url('../img/actions/download.svg?v=1'); + @include icon-color('download', 'actions', $color-black, 1, true); } .icon-category-files { - background-image: url('../img/categories/files.svg?v=1'); + @include icon-color('files', 'categories', $color-black, 1, true); } .icon-category-social { - background-image: url('../img/categories/social.svg?v=1'); + @include icon-color('social', 'categories', $color-black, 1, true); } .icon-category-office { - background-image: url('../img/categories/office.svg?v=1'); + @include icon-color('office', 'categories', $color-black, 1, true); } .icon-category-auth { - background-image: url('../img/categories/auth.svg?v=1'); + @include icon-color('auth', 'categories', $color-black, 1, true); } .icon-category-monitoring { - background-image: url('../img/categories/monitoring.svg?v=1'); + @include icon-color('monitoring', 'categories', $color-black, 1, true); } .icon-category-multimedia { - background-image: url('../img/categories/multimedia.svg?v=1'); + @include icon-color('multimedia', 'categories', $color-black, 1, true); } .icon-category-organization { - background-image: url('../img/categories/organization.svg?v=1'); + @include icon-color('organization', 'categories', $color-black, 1, true); } .icon-category-customization { - background-image: url('../img/categories/customization.svg?v=1'); + @include icon-color('customization', 'categories', $color-black, 1, true); } .icon-category-integration { - background-image: url('../img/categories/integration.svg?v=1'); + @include icon-color('integration', 'categories', $color-black, 1, true); } .icon-category-tools { - background-image: url('../img/actions/settings-dark.svg?v=1'); + @include icon-color('settings-dark', 'actions', $color-black, 1, true); } .icon-category-games { - background-image: url('../img/categories/games.svg?v=1'); + @include icon-color('games', 'categories', $color-black, 1, true); } .icon-category-security { - background-image: url('../img/actions/password.svg?v=1'); + @include icon-color('password', 'actions', $color-black, 1, true); } .icon-category-search { - background-image: url('../img/actions/search.svg?v=1'); + @include icon-color('search', 'actions', $color-black, 1, true); } + diff --git a/core/css/inputs.scss b/core/css/inputs.scss index a3ff713d813..925069917e0 100644 --- a/core/css/inputs.scss +++ b/core/css/inputs.scss @@ -242,7 +242,7 @@ input { cursor: pointer; &:disabled { cursor: default; - background-image: url('../img/actions/confirm-fade.svg?v=2') !important; + @include icon-color('confirm-fade', 'actions', $color-black, 2, true); } } diff --git a/core/css/styles.scss b/core/css/styles.scss index 6ff8d30a590..eac6af307a2 100644 --- a/core/css/styles.scss +++ b/core/css/styles.scss @@ -160,59 +160,6 @@ body { border-radius: var(--border-radius); } -/* Searchbox */ - -.searchbox { - position: relative; - input[type='search'] { - position: relative; - font-size: 1.2em; - padding: 3px; - padding-left: 25px; - padding-right: 20px; - background: transparent url('../img/actions/search-white.svg?v=1') no-repeat center center; - color: var(--color-primary-text); - border: 0; - border-radius: var(--border-radius); - margin-top: 9px; - width: 0; - cursor: pointer; - -webkit-transition: all 100ms; - transition: all 100ms; - opacity: .6; - &:focus, &:active, &:valid { - background-position-x: 6px; - color: var(--color-primary-text); - width: 155px; - cursor: text; - background-color: var(--color-primary) !important; - border: 1px solid var(--color-primary-text-dark) !important; - } - &:hover, &:focus, &:active { - opacity: 1; - } - & ~ .icon-close-white { - display: inline; - position: absolute; - width: 30px; - height: 100%; - right: 0; - top: 0; - margin: 0; - &, &:focus, &:active, &:hover { - border: none; - background-color: transparent; - } - } - &:not(:valid) ~ .icon-close-white { - display: none; - } - &::-webkit-search-cancel-button { - -webkit-appearance: none; - } - } -} - /* CONTENT ------------------------------------------------------------------ */ #controls { diff --git a/core/css/variables.scss b/core/css/variables.scss index 43e3c6b97bb..3cf77849395 100644 --- a/core/css/variables.scss +++ b/core/css/variables.scss @@ -1,4 +1,26 @@ -// SCSS darken/lighten function override +/** + * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) + * + * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + // SCSS darken/lighten function override @function nc-darken($color, $value) { @return darken($color, $value); } @@ -27,6 +49,9 @@ $color-primary-element-light: lighten($color-primary-element, 15%) !default; $color-error: #e9322d; $color-warning: #eca700; $color-success: #46ba61; +// used for svg +$color-white: #fff; +$color-black: #000; // rgb(118, 118, 118) / #767676 // min. color contrast for normal text on white background according to WCAG AA diff --git a/core/img/actions/audio-off-white.svg b/core/img/actions/audio-off-white.svg deleted file mode 100644 index d0699a959d0..00000000000 --- a/core/img/actions/audio-off-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path fill="#fff" d="m5 3v3.5c0 0.21626 0.0337 0.40866 0.082028 0.58984l3.9178-3.9179v-0.1719c0-2.673-4-2.6707-4 0zm5.2832 0.3027-7.9803 7.9803c-0.91785 0.91785 0.50035 2.3441 1.414 1.4141l7.9803-7.9802c0.916-0.9163-0.493-2.3349-1.414-1.4141zm-8.283 2.6973c0 1.2904 0.3648 2.371 0.9374 3.2344l1.4492-1.4492c-0.2349-0.4922-0.3867-1.0781-0.3867-1.7852 0-1.3274-2-1.326-2 0zm9.9721-0.14453-5.9723 5.9727v1.1719h-1.1718l-0.40427 0.4043c-0.12553 0.13-0.2681 0.24231-0.42381 0.334v1.2617h6v-2h-2v-1.625c2.1244-0.466 4-2.3973 4-5.375 0-0.055-0-0.0941-0.028-0.1445z"/></svg> diff --git a/core/img/actions/audio-white.svg b/core/img/actions/audio-white.svg deleted file mode 100644 index 209177deb3f..00000000000 --- a/core/img/actions/audio-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path fill="#fff" d="m6 3v3.5c0 2.6667 4 2.6667 4 0v-3.5c0-2.6661-4-2.6669-4 0zm-3 3c0 2.9759 1.8757 4.907 4 5.375v1.625h-2v2h6v-2h-2v-1.625c2.124-0.466 4-2.3973 4-5.375 0-1.3333-2-1.3333-2 0 0 4.6515-6 4.654-6 0 0-1.3277-2-1.3437-2 0z"/></svg> diff --git a/core/img/actions/caret-dark.svg b/core/img/actions/caret-dark.svg deleted file mode 100644 index 89ce37bc3e7..00000000000 --- a/core/img/actions/caret-dark.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16"><path d="M4 6l4 4 4-3.994z"/></svg> diff --git a/core/img/actions/caret.svg b/core/img/actions/caret.svg index a7c34f699c7..89ce37bc3e7 100644 --- a/core/img/actions/caret.svg +++ b/core/img/actions/caret.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16"><path d="M4 6l4 4 4-3.994z" fill="#fff" /></svg> +<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16"><path d="M4 6l4 4 4-3.994z"/></svg> diff --git a/core/img/actions/checkmark-color.svg b/core/img/actions/checkmark-color.svg deleted file mode 100644 index 89f6960834d..00000000000 --- a/core/img/actions/checkmark-color.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path d="m2.35 7.3 4 4l7.3-7.3" stroke="#46ba61" stroke-width="2" fill="none"/></svg> diff --git a/core/img/actions/checkmark-white.svg b/core/img/actions/checkmark-white.svg deleted file mode 100644 index 6190902ea2d..00000000000 --- a/core/img/actions/checkmark-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path d="m2.35 7.3 4 4l7.3-7.3" stroke="white" stroke-width="2" fill="none"/></svg> diff --git a/core/img/actions/close-white.svg b/core/img/actions/close-white.svg deleted file mode 100644 index f24a6914b0f..00000000000 --- a/core/img/actions/close-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16"><path fill="#fff" d="m14 12.3-1.7 1.7-4.3-4.3-4.3 4.3-1.7-1.7 4.3-4.3-4.3-4.3 1.7-1.7 4.3 4.3 4.3-4.3 1.7 1.7-4.3 4.3z"/></svg> diff --git a/core/img/actions/confirm-white.svg b/core/img/actions/confirm-white.svg deleted file mode 100644 index 98a41adefe5..00000000000 --- a/core/img/actions/confirm-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path fill="#fff" d="m8.5 0.5c-0.8974 0-1.3404 1.0909-0.6973 1.7168l4.7837 4.7832h-11.573c-1.3523-0.019125-1.3523 2.0191 0 2h11.572l-4.7832 4.7832c-0.98163 0.94251 0.47155 2.3957 1.4141 1.4141l6.4911-6.49c0.387-0.3878 0.391-1.0228 0-1.414l-6.4906-6.4903c-0.1883-0.1935-0.4468-0.30268-0.7168-0.3027z"/></svg> diff --git a/core/img/actions/delete-hover.svg b/core/img/actions/delete-hover.svg deleted file mode 100644 index 286f060d462..00000000000 --- a/core/img/actions/delete-hover.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path fill="#d40000" d="M6.5 1L6 2H3c-.554 0-1 .446-1 1v1h12V3c0-.554-.446-1-1-1h-3l-.5-1zM3 5l.875 9c.06.55.573 1 1.125 1h6c.552 0 1.064-.45 1.125-1L13 5z" fill-rule="evenodd"/></svg> diff --git a/core/img/actions/delete-white.svg b/core/img/actions/delete-white.svg deleted file mode 100644 index 15a364c1006..00000000000 --- a/core/img/actions/delete-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path d="M6.5 1L6 2H3c-.554 0-1 .446-1 1v1h12V3c0-.554-.446-1-1-1h-3l-.5-1zM3 5l.875 9c.06.55.573 1 1.125 1h6c.552 0 1.064-.45 1.125-1L13 5z" fill="#fff"/></svg> diff --git a/core/img/actions/download-white.svg b/core/img/actions/download-white.svg deleted file mode 100644 index b6de7996024..00000000000 --- a/core/img/actions/download-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path fill="#fff" d="M6 1h4v7h5l-7 7-7-7h5z"/></svg> diff --git a/core/img/actions/error-color.svg b/core/img/actions/error-color.svg deleted file mode 100644 index 19957ad7c73..00000000000 --- a/core/img/actions/error-color.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path d="M5.516 2L2 5.516v4.968L5.516 14h4.968L14 10.484V5.516L10.484 2H5.516zM7 4h2v5H7V4zm0 6h2v2H7v-2z" fill="#d40000"/></svg> diff --git a/core/img/actions/error-white.svg b/core/img/actions/error-white.svg deleted file mode 100644 index 9558c998c30..00000000000 --- a/core/img/actions/error-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path d="M5.516 2L2 5.516v4.968L5.516 14h4.968L14 10.484V5.516L10.484 2H5.516zM7 4h2v5H7V4zm0 6h2v2H7v-2z" fill="#fff"/></svg> diff --git a/core/img/actions/fullscreen-white.svg b/core/img/actions/fullscreen-white.svg deleted file mode 100644 index c920885bf6b..00000000000 --- a/core/img/actions/fullscreen-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16"><defs><filter id="a" height="21"><feGaussianBlur stdDeviation="1" in="SourceAlpha"/><feComponentTransfer><feFuncA slope="0.5" type="linear"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><path filter="url(#a)" d="m8 1c-0.554 0-1 0.446-1 1s0.446 1 1 1h5v5c0 0.554 0.446 1 1 1s1-0.446 1-1v-6c0-0.554-0.446-1-1-1h-6zm-6 6c-0.554 0-1 0.446-1 1v6c0 0.554 0.446 1 1 1h6c0.554 0 1-0.446 1-1s-0.446-1-1-1h-5v-5c0-0.554-0.446-1-1-1z" fill="#fff"/></svg> diff --git a/core/img/actions/info-white.svg b/core/img/actions/info-white.svg deleted file mode 100644 index 92f6e44add2..00000000000 --- a/core/img/actions/info-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path d="M5 7.474c.155.382.325.69.644.246.407-.268 1.76-1.427 1.662-.342-.368 2.017-.834 4.017-1.17 6.04-.393 1.114.634 2.067 1.637 1.31 1.078-.502 1.99-1.287 2.927-2.01-.144-.323-.25-.79-.596-.347-.468.24-1.47 1.318-1.696.472.315-2.18.975-4.295 1.365-6.462.397-1.005-.364-2.223-1.4-1.363C7.117 5.634 6.083 6.6 5 7.474zM9.46.005C8.15-.017 7.553 2.147 8.815 2.68c1.023.378 2.077-.714 1.79-1.75-.098-.542-.598-.97-1.147-.93z" fill="#fff"/></svg> diff --git a/core/img/actions/screen-off-white.svg b/core/img/actions/screen-off-white.svg deleted file mode 100644 index a022b933808..00000000000 --- a/core/img/actions/screen-off-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><defs><filter id="a" height="21"><feGaussianBlur stdDeviation="1" in="SourceAlpha"/><feComponentTransfer><feFuncA slope="0.5" type="linear"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><path filter="url(#a)" fill="#fff" d="m12.986 1.0117v0.00195c-0.255 0-0.51103 0.095216-0.70703 0.29102l-9.986 9.9844c-0.3918 0.392-0.3918 1.024 0 1.416 0.3917 0.392 1.0242 0.392 1.416 0l9.984-9.9862c0.392-0.392 0.392-1.0223 0-1.4141-0.196-0.1958-0.45103-0.29297-0.70703-0.29297zm-10.986 0.9883c-0.554 0-1 0.446-1 1v8c0 0.15223 0.03927 0.29296 0.09961 0.42188 0.09087-0.30747 0.24693-0.59837 0.48633-0.83789v-0.002l1.4141-1.414v-5.168h5.1699l2-2h-8.17zm12.893 0.56641c-0.08943 0.31553-0.24744 0.61463-0.49219 0.85938l-1.401 1.4004v5.1738h-5.1719l-2 2h1.1719v1h-2v2h6v-2h-2v-1h5c0.554 0 1-0.446 1-1v-8c0-0.1573-0.043-0.3014-0.107-0.4336z"/></svg> diff --git a/core/img/actions/screen-white.svg b/core/img/actions/screen-white.svg deleted file mode 100644 index e279dc48270..00000000000 --- a/core/img/actions/screen-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><defs><filter id="a" height="21"><feGaussianBlur stdDeviation="1" in="SourceAlpha"/><feComponentTransfer><feFuncA slope="0.5" type="linear"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><path filter="url(#a)" fill="#fff" d="m2 2c-0.554 0-1 0.446-1 1v8c0 0.554 0.446 1 1 1h5v1h-2v2h6v-2h-2v-1h5c0.554 0 1-0.446 1-1v-8c0-0.554-0.446-1-1-1zm1 2h10v6h-10z"/></svg> diff --git a/core/img/actions/search-white.svg b/core/img/actions/search-white.svg deleted file mode 100644 index 73aa5d3fa2f..00000000000 --- a/core/img/actions/search-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" height="16" width="16"><g stroke="#fff" stroke-width="2" fill="none"><ellipse rx="4" ry="4" cy="6" cx="6"/><path d="m14.3 14.25-5.65-5.65"/></g></svg> diff --git a/core/img/actions/settings-white.svg b/core/img/actions/settings-white.svg deleted file mode 100644 index ba8d925d8a4..00000000000 --- a/core/img/actions/settings-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 0 16 16" width="16" version="1.1"><path fill="#fff" d="m6.94 0.5c-0.24 0-0.44 0.2-0.44 0.44v1.26c-0.5 0.14-1.05 0.35-1.53 0.65l-0.91-0.91c-0.16-0.18-0.46-0.19-0.62 0l-1.5 1.5c-0.18 0.17-0.18 0.46 0 0.62l0.91 0.91c-0.284 0.48-0.5 1-0.65 1.53h-1.26c-0.24 0-0.44 0.2-0.44 0.44v2.12c0 0.25 0.19 0.44 0.44 0.44h1.26c0.14 0.54 0.36 1.05 0.65 1.53l-0.91 0.91c-0.18 0.17-0.18 0.45 0 0.62l1.5 1.5c0.18 0.18 0.46 0.18 0.62 0l0.91-0.91c0.48 0.285 1 0.5 1.53 0.65v1.26c0 0.25 0.2 0.44 0.44 0.44h2.12c0.24 0 0.45-0.2 0.44-0.44v-1.26c0.54-0.14 1.05-0.36 1.53-0.65l0.91 0.91c0.17 0.18 0.45 0.18 0.62 0l1.5-1.5c0.18-0.17 0.18-0.45 0-0.62l-0.91-0.91c0.29-0.48 0.5-1 0.65-1.53h1.26c0.24 0 0.45-0.2 0.44-0.44v-2.12c0-0.24-0.2-0.44-0.44-0.44h-1.26c-0.14-0.54-0.36-1.05-0.65-1.53l0.91-0.91c0.18-0.17 0.18-0.45 0-0.62l-1.5-1.5c-0.17-0.18-0.45-0.18-0.62 0l-0.91 0.91c-0.48-0.29-1-0.5-1.53-0.65v-1.26c0-0.24-0.2-0.44-0.44-0.44h-2.12zm1.06 4a3.5 3.5 0 0 1 3.5 3.5 3.5 3.5 0 0 1 -3.5 3.5 3.5 3.5 0 0 1 -3.5 -3.5 3.5 3.5 0 0 1 3.5 -3.5z"/></svg> diff --git a/core/img/actions/starred.svg b/core/img/actions/starred.svg deleted file mode 100644 index 5635ea94e85..00000000000 --- a/core/img/actions/starred.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 16" width="16" height="16"><path fill="#FC0" d="m8 0.5 2.2 5.3 5.8 0.45-4.5 3.75 1.5 5.5-5-3.1-5 3.1 1.5-5.5-4.5-3.75 5.8-0.45z"/></svg> diff --git a/core/img/actions/upload-white.svg b/core/img/actions/upload-white.svg deleted file mode 100644 index 3bd04bb8de6..00000000000 --- a/core/img/actions/upload-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><path fill="#fff" d="M8 1L2 7h4v4h4V7h4zM2 13v2h12v-2z"/></svg> diff --git a/core/img/actions/video-off-white.svg b/core/img/actions/video-off-white.svg deleted file mode 100644 index 95e39de06d4..00000000000 --- a/core/img/actions/video-off-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><defs><filter id="a" height="21"><feGaussianBlur stdDeviation="1" in="SourceAlpha"/><feComponentTransfer><feFuncA slope="0.5" type="linear"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><path fill="#fff" filter="url(#a)" d="m13.486 1.5137c-0.255 0-0.511 0.0971-0.707 0.2929l-10.486 10.484c-0.3918 0.392-0.3918 1.024 0 1.416 0.3917 0.392 1.0242 0.392 1.416 0l10.484-10.486c0.392-0.392 0.392-1.0226 0-1.4144-0.196-0.1958-0.451-0.2929-0.707-0.2929zm-10.486 1.4863c-1.108 0-2 0.892-2 2v6c0 0.368 0.1054 0.706 0.2773 1.002 0.0849-0.149 0.1825-0.292 0.3086-0.418l8.3457-8.3457c-0.2792-0.1477-0.5926-0.2383-0.9316-0.2383h-6zm12 0.8066c-0.034 0.0401-0.062 0.0835-0.1 0.1211l-9.0699 9.0723h3.1699c1.108 0 2-0.892 2-2v-1.334l4 3.334v-9.1934z"/></svg> diff --git a/core/img/actions/video-white.svg b/core/img/actions/video-white.svg deleted file mode 100644 index f24bb373add..00000000000 --- a/core/img/actions/video-white.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16" width="16" height="16"><defs><filter id="a" height="21"><feGaussianBlur stdDeviation="1" in="SourceAlpha"/><feComponentTransfer><feFuncA slope="0.5" type="linear"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs><path fill="#fff" filter="url(#a)" d="M3 3c-1.108 0-2 .892-2 2v6c0 1.108.892 2 2 2h6c1.108 0 2-.892 2-2V9.666L15 13V3l-4 3.334V5c0-1.108-.892-2-2-2z"/></svg> diff --git a/core/img/places/calendar-dark.svg b/core/img/places/calendar-dark.svg deleted file mode 100644 index 020ae8fe6ca..00000000000 --- a/core/img/places/calendar-dark.svg +++ /dev/null @@ -1 +0,0 @@ -<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16"><path d="m4 1c-0.5 0-1 0.5-1 1v2c0 0.5 0.5 1 1 1s1-0.5 1-1v-2c0-0.5-0.5-1-1-1zm8 0c-0.5 0-1 0.5-1 1v2c0 0.5 0.5 1 1 1s1-0.5 1-1v-2c0-0.5-0.5-1-1-1zm-6.5 2v1c0 0.831-0.5 1.5-1.5 1.5s-1.5-0.5-1.5-1.5v-0.9375c-0.8841 0.227-1.5 1.0247-1.5 1.9375v8c0 1.108 0.892 2 2 2h10c1.108 0 2-0.892 2-2v-8c0-0.9128-0.61588-1.7105-1.5-1.9375v0.9375c0 0.831-0.5 1.5-1.5 1.5s-1.5-0.5-1.5-1.5v-1zm7.5 5v5h-10v-5z"/></svg> diff --git a/core/img/places/calendar.svg b/core/img/places/calendar.svg index 0d6e85a3ac0..020ae8fe6ca 100644 --- a/core/img/places/calendar.svg +++ b/core/img/places/calendar.svg @@ -1 +1 @@ -<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16"><path fill="#fff" d="m4 1c-0.5 0-1 0.5-1 1v2c0 0.5 0.5 1 1 1s1-0.5 1-1v-2c0-0.5-0.5-1-1-1zm8 0c-0.5 0-1 0.5-1 1v2c0 0.5 0.5 1 1 1s1-0.5 1-1v-2c0-0.5-0.5-1-1-1zm-6.5 2v1c0 0.831-0.5 1.5-1.5 1.5s-1.5-0.5-1.5-1.5v-0.9375c-0.8841 0.227-1.5 1.0247-1.5 1.9375v8c0 1.108 0.892 2 2 2h10c1.108 0 2-0.892 2-2v-8c0-0.9128-0.61588-1.7105-1.5-1.9375v0.9375c0 0.831-0.5 1.5-1.5 1.5s-1.5-0.5-1.5-1.5v-1zm7.5 5v5h-10v-5z"/></svg> +<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 16 16"><path d="m4 1c-0.5 0-1 0.5-1 1v2c0 0.5 0.5 1 1 1s1-0.5 1-1v-2c0-0.5-0.5-1-1-1zm8 0c-0.5 0-1 0.5-1 1v2c0 0.5 0.5 1 1 1s1-0.5 1-1v-2c0-0.5-0.5-1-1-1zm-6.5 2v1c0 0.831-0.5 1.5-1.5 1.5s-1.5-0.5-1.5-1.5v-0.9375c-0.8841 0.227-1.5 1.0247-1.5 1.9375v8c0 1.108 0.892 2 2 2h10c1.108 0 2-0.892 2-2v-8c0-0.9128-0.61588-1.7105-1.5-1.9375v0.9375c0 0.831-0.5 1.5-1.5 1.5s-1.5-0.5-1.5-1.5v-1zm7.5 5v5h-10v-5z"/></svg> diff --git a/core/img/places/contacts-dark.svg b/core/img/places/contacts-dark.svg deleted file mode 100644 index 5bc91dc59ab..00000000000 --- a/core/img/places/contacts-dark.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" height="16" width="16" version="1.1"><path d="m9 1c-1.746 0-3 1.43-3 2.8 0 1.4 0.1 2.4 0.8 3.5 0.224 0.29 0.485 0.35 0.7 0.6 0.135 0.5 0.24 1 0.1 1.5-0.436 0.153-0.85 0.332-1.27 0.5-0.51-0.273-1.1-0.5-1.61-0.7-0.07-0.28-0.02-0.487 0.05-0.75 0.12-0.125 0.23-0.18 0.36-0.3 0.37-0.45 0.39-1.21 0.39-1.75 0-0.8-0.72-1.4-1.5-1.4-0.87 0-1.5 0.72-1.5 1.4h-0.02c0 0.7 0.05 1.2 0.4 1.75 0.1 0.15 0.242 0.175 0.35 0.3 0.0674 0.25 0.121 0.5 0.05 0.75-0.64 0.223-1.244 0.5-1.8 0.8-0.42 0.3-0.233 0.182-0.5 1.15-0.124 0.5 1.3 0.73 2.32 0.81-0.05 0.275-0.12 0.64-0.32 1.34-0.32 1.25 4.353 1.7 6 1.7 2.43 0 6.313-0.456 5.98-1.7-0.52-1.94-0.208-1.71-0.98-2.3-1.09-0.654-2.452-1.167-3.6-1.6-0.15-0.557-0.04-0.97 0.1-1.5 0.235-0.25 0.5-0.36 0.72-0.6 0.69-0.884 0.78-2.424 0.78-3.5 0-1.586-1.43-2.8-3-2.8z"/></svg> diff --git a/core/img/places/contacts.svg b/core/img/places/contacts.svg index 205224878e7..5bc91dc59ab 100644 --- a/core/img/places/contacts.svg +++ b/core/img/places/contacts.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" height="16" width="16" version="1.1"><path fill="#fff" d="m9 1c-1.746 0-3 1.43-3 2.8 0 1.4 0.1 2.4 0.8 3.5 0.224 0.29 0.485 0.35 0.7 0.6 0.135 0.5 0.24 1 0.1 1.5-0.436 0.153-0.85 0.332-1.27 0.5-0.51-0.273-1.1-0.5-1.61-0.7-0.07-0.28-0.02-0.487 0.05-0.75 0.12-0.125 0.23-0.18 0.36-0.3 0.37-0.45 0.39-1.21 0.39-1.75 0-0.8-0.72-1.4-1.5-1.4-0.87 0-1.5 0.72-1.5 1.4h-0.02c0 0.7 0.05 1.2 0.4 1.75 0.1 0.15 0.242 0.175 0.35 0.3 0.0674 0.25 0.121 0.5 0.05 0.75-0.64 0.223-1.244 0.5-1.8 0.8-0.42 0.3-0.233 0.182-0.5 1.15-0.124 0.5 1.3 0.73 2.32 0.81-0.05 0.275-0.12 0.64-0.32 1.34-0.32 1.25 4.353 1.7 6 1.7 2.43 0 6.313-0.456 5.98-1.7-0.52-1.94-0.208-1.71-0.98-2.3-1.09-0.654-2.452-1.167-3.6-1.6-0.15-0.557-0.04-0.97 0.1-1.5 0.235-0.25 0.5-0.36 0.72-0.6 0.69-0.884 0.78-2.424 0.78-3.5 0-1.586-1.43-2.8-3-2.8z"/></svg> +<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" height="16" width="16" version="1.1"><path d="m9 1c-1.746 0-3 1.43-3 2.8 0 1.4 0.1 2.4 0.8 3.5 0.224 0.29 0.485 0.35 0.7 0.6 0.135 0.5 0.24 1 0.1 1.5-0.436 0.153-0.85 0.332-1.27 0.5-0.51-0.273-1.1-0.5-1.61-0.7-0.07-0.28-0.02-0.487 0.05-0.75 0.12-0.125 0.23-0.18 0.36-0.3 0.37-0.45 0.39-1.21 0.39-1.75 0-0.8-0.72-1.4-1.5-1.4-0.87 0-1.5 0.72-1.5 1.4h-0.02c0 0.7 0.05 1.2 0.4 1.75 0.1 0.15 0.242 0.175 0.35 0.3 0.0674 0.25 0.121 0.5 0.05 0.75-0.64 0.223-1.244 0.5-1.8 0.8-0.42 0.3-0.233 0.182-0.5 1.15-0.124 0.5 1.3 0.73 2.32 0.81-0.05 0.275-0.12 0.64-0.32 1.34-0.32 1.25 4.353 1.7 6 1.7 2.43 0 6.313-0.456 5.98-1.7-0.52-1.94-0.208-1.71-0.98-2.3-1.09-0.654-2.452-1.167-3.6-1.6-0.15-0.557-0.04-0.97 0.1-1.5 0.235-0.25 0.5-0.36 0.72-0.6 0.69-0.884 0.78-2.424 0.78-3.5 0-1.586-1.43-2.8-3-2.8z"/></svg> diff --git a/core/img/places/default-app-icon.svg b/core/img/places/default-app-icon.svg index ba8d925d8a4..0db6804a923 100644 --- a/core/img/places/default-app-icon.svg +++ b/core/img/places/default-app-icon.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 0 16 16" width="16" version="1.1"><path fill="#fff" d="m6.94 0.5c-0.24 0-0.44 0.2-0.44 0.44v1.26c-0.5 0.14-1.05 0.35-1.53 0.65l-0.91-0.91c-0.16-0.18-0.46-0.19-0.62 0l-1.5 1.5c-0.18 0.17-0.18 0.46 0 0.62l0.91 0.91c-0.284 0.48-0.5 1-0.65 1.53h-1.26c-0.24 0-0.44 0.2-0.44 0.44v2.12c0 0.25 0.19 0.44 0.44 0.44h1.26c0.14 0.54 0.36 1.05 0.65 1.53l-0.91 0.91c-0.18 0.17-0.18 0.45 0 0.62l1.5 1.5c0.18 0.18 0.46 0.18 0.62 0l0.91-0.91c0.48 0.285 1 0.5 1.53 0.65v1.26c0 0.25 0.2 0.44 0.44 0.44h2.12c0.24 0 0.45-0.2 0.44-0.44v-1.26c0.54-0.14 1.05-0.36 1.53-0.65l0.91 0.91c0.17 0.18 0.45 0.18 0.62 0l1.5-1.5c0.18-0.17 0.18-0.45 0-0.62l-0.91-0.91c0.29-0.48 0.5-1 0.65-1.53h1.26c0.24 0 0.45-0.2 0.44-0.44v-2.12c0-0.24-0.2-0.44-0.44-0.44h-1.26c-0.14-0.54-0.36-1.05-0.65-1.53l0.91-0.91c0.18-0.17 0.18-0.45 0-0.62l-1.5-1.5c-0.17-0.18-0.45-0.18-0.62 0l-0.91 0.91c-0.48-0.29-1-0.5-1.53-0.65v-1.26c0-0.24-0.2-0.44-0.44-0.44h-2.12zm1.06 4a3.5 3.5 0 0 1 3.5 3.5 3.5 3.5 0 0 1 -3.5 3.5 3.5 3.5 0 0 1 -3.5 -3.5 3.5 3.5 0 0 1 3.5 -3.5z"/></svg> +<svg xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 0 16 16" width="16" version="1.1"><path d="m6.94 0.5c-0.24 0-0.44 0.2-0.44 0.44v1.26c-0.5 0.14-1.05 0.35-1.53 0.65l-0.91-0.91c-0.16-0.18-0.46-0.19-0.62 0l-1.5 1.5c-0.18 0.17-0.18 0.46 0 0.62l0.91 0.91c-0.284 0.48-0.5 1-0.65 1.53h-1.26c-0.24 0-0.44 0.2-0.44 0.44v2.12c0 0.25 0.19 0.44 0.44 0.44h1.26c0.14 0.54 0.36 1.05 0.65 1.53l-0.91 0.91c-0.18 0.17-0.18 0.45 0 0.62l1.5 1.5c0.18 0.18 0.46 0.18 0.62 0l0.91-0.91c0.48 0.285 1 0.5 1.53 0.65v1.26c0 0.25 0.2 0.44 0.44 0.44h2.12c0.24 0 0.45-0.2 0.44-0.44v-1.26c0.54-0.14 1.05-0.36 1.53-0.65l0.91 0.91c0.17 0.18 0.45 0.18 0.62 0l1.5-1.5c0.18-0.17 0.18-0.45 0-0.62l-0.91-0.91c0.29-0.48 0.5-1 0.65-1.53h1.26c0.24 0 0.45-0.2 0.44-0.44v-2.12c0-0.24-0.2-0.44-0.44-0.44h-1.26c-0.14-0.54-0.36-1.05-0.65-1.53l0.91-0.91c0.18-0.17 0.18-0.45 0-0.62l-1.5-1.5c-0.17-0.18-0.45-0.18-0.62 0l-0.91 0.91c-0.48-0.29-1-0.5-1.53-0.65v-1.26c0-0.24-0.2-0.44-0.44-0.44h-2.12zm1.06 4a3.5 3.5 0 0 1 3.5 3.5 3.5 3.5 0 0 1 -3.5 3.5 3.5 3.5 0 0 1 -3.5 -3.5 3.5 3.5 0 0 1 3.5 -3.5z"/></svg> diff --git a/core/img/places/files-dark.svg b/core/img/places/files-dark.svg deleted file mode 100644 index 15365027902..00000000000 --- a/core/img/places/files-dark.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" version="1.1" height="16"><path d="m1.5 2c-0.25 0-0.5 0.25-0.5 0.5v11c0 0.26 0.24 0.5 0.5 0.5h13c0.26 0 0.5-0.241 0.5-0.5v-9c0-0.25-0.25-0.5-0.5-0.5h-6.5l-2-2z"/></svg> diff --git a/core/img/places/files.svg b/core/img/places/files.svg index 003e8b3fb80..15365027902 100644 --- a/core/img/places/files.svg +++ b/core/img/places/files.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" version="1.1" height="16"><path fill="#fff" d="m1.5 2c-0.25 0-0.5 0.25-0.5 0.5v11c0 0.26 0.24 0.5 0.5 0.5h13c0.26 0 0.5-0.241 0.5-0.5v-9c0-0.25-0.25-0.5-0.5-0.5h-6.5l-2-2z"/></svg> +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" version="1.1" height="16"><path d="m1.5 2c-0.25 0-0.5 0.25-0.5 0.5v11c0 0.26 0.24 0.5 0.5 0.5h13c0.26 0 0.5-0.241 0.5-0.5v-9c0-0.25-0.25-0.5-0.5-0.5h-6.5l-2-2z"/></svg> diff --git a/core/img/places/music.svg b/core/img/places/music.svg index 26fe2017f18..5746247ea78 100644 --- a/core/img/places/music.svg +++ b/core/img/places/music.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path fill="#fff" d="m12.97 0.5c-0.26 0-4.795 1-7.17 1.5-0.47 0.1-0.8 0.53-0.8 1v8c-0.56-0.06-1.144 0.0625-1.65 0.34-1.226 0.67-1.7 2.06-1.066 3.11 0.64 1.05 2.15 1.35 3.37 0.68 0.846-0.45 1.346-1.28 1.346-2.13v-8l5-1v6.016c-0.56-0.058-1.144 0.0625-1.65 0.34-1.226 0.67-1.7 2.06-1.066 3.11 0.64 1.046 2.15 1.35 3.37 0.68 0.846-0.466 1.346-1.296 1.346-2.146v-10.525c0-0.565-0.466-0.975-1.03-0.975z"/></svg> +<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path d="m12.97 0.5c-0.26 0-4.795 1-7.17 1.5-0.47 0.1-0.8 0.53-0.8 1v8c-0.56-0.06-1.144 0.0625-1.65 0.34-1.226 0.67-1.7 2.06-1.066 3.11 0.64 1.05 2.15 1.35 3.37 0.68 0.846-0.45 1.346-1.28 1.346-2.13v-8l5-1v6.016c-0.56-0.058-1.144 0.0625-1.65 0.34-1.226 0.67-1.7 2.06-1.066 3.11 0.64 1.046 2.15 1.35 3.37 0.68 0.846-0.466 1.346-1.296 1.346-2.146v-10.525c0-0.565-0.466-0.975-1.03-0.975z"/></svg> diff --git a/core/img/places/picture.svg b/core/img/places/picture.svg index 738f1b3b505..ffb0840ac0e 100644 --- a/core/img/places/picture.svg +++ b/core/img/places/picture.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path fill="#fff" d="m1.5 2c-0.2 0-0.5 0.3-0.5 0.5v11c0 0.2 0.3 0.5 0.5 0.5h13c0.2 0 0.5-0.3 0.5-0.5v-11c0-0.2-0.3-0.5-0.5-0.5zm0.5 1h12v5l-1-1-3 4-3-3-4 4h-1zm2.5 1c-0.83 0-1.5 0.67-1.5 1.5s0.67 1.5 1.5 1.5 1.5-0.67 1.5-1.5-0.67-1.5-1.5-1.5z"/></svg> +<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 16 16" width="16" version="1.1" height="16"><path d="m1.5 2c-0.2 0-0.5 0.3-0.5 0.5v11c0 0.2 0.3 0.5 0.5 0.5h13c0.2 0 0.5-0.3 0.5-0.5v-11c0-0.2-0.3-0.5-0.5-0.5zm0.5 1h12v5l-1-1-3 4-3-3-4 4h-1zm2.5 1c-0.83 0-1.5 0.67-1.5 1.5s0.67 1.5 1.5 1.5 1.5-0.67 1.5-1.5-0.67-1.5-1.5-1.5z"/></svg> diff --git a/core/routes.php b/core/routes.php index c5df3a362f5..4ac51dc2364 100644 --- a/core/routes.php +++ b/core/routes.php @@ -61,6 +61,9 @@ $application->registerRoutes($this, [ ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], + ['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}/{color}', 'verb' => 'GET'], + ['name' => 'Svg#getSvgFromSettings', 'url' => '/svg/settings/{folder}/{fileName}/{color}', 'verb' => 'GET'], + ['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}/{color}', 'verb' => 'GET'], ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 3cac14b4ab3..b9eab8f4149 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -105,7 +105,7 @@ <?php p($l->t('Search'));?> </label> <input id="searchbox" type="search" name="query" - value="" required class="hidden" + value="" required class="hidden icon-search-white" autocomplete="off"> <button class="icon-close-white" type="reset"><span class="hidden-visually"><?php p($l->t('Reset search'));?></span></button> </form> diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 1c67fb9327f..234aa418f56 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -594,6 +594,7 @@ return array( 'OC\\Core\\Controller\\PreviewController' => $baseDir . '/core/Controller/PreviewController.php', 'OC\\Core\\Controller\\SearchController' => $baseDir . '/core/Controller/SearchController.php', 'OC\\Core\\Controller\\SetupController' => $baseDir . '/core/Controller/SetupController.php', + 'OC\\Core\\Controller\\SvgController' => $baseDir . '/core/Controller/SvgController.php', 'OC\\Core\\Controller\\TwoFactorChallengeController' => $baseDir . '/core/Controller/TwoFactorChallengeController.php', 'OC\\Core\\Controller\\UserController' => $baseDir . '/core/Controller/UserController.php', 'OC\\Core\\Controller\\WalledGardenController' => $baseDir . '/core/Controller/WalledGardenController.php', @@ -1016,6 +1017,7 @@ return array( 'OC\\TemplateLayout' => $baseDir . '/lib/private/TemplateLayout.php', 'OC\\Template\\Base' => $baseDir . '/lib/private/Template/Base.php', 'OC\\Template\\CSSResourceLocator' => $baseDir . '/lib/private/Template/CSSResourceLocator.php', + 'OC\\Template\\IconsCacher' => $baseDir . '/lib/private/Template/IconsCacher.php', 'OC\\Template\\JSCombiner' => $baseDir . '/lib/private/Template/JSCombiner.php', 'OC\\Template\\JSConfigHelper' => $baseDir . '/lib/private/Template/JSConfigHelper.php', 'OC\\Template\\JSResourceLocator' => $baseDir . '/lib/private/Template/JSResourceLocator.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index e40a5ea75db..c54120586f9 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -624,6 +624,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Core\\Controller\\PreviewController' => __DIR__ . '/../../..' . '/core/Controller/PreviewController.php', 'OC\\Core\\Controller\\SearchController' => __DIR__ . '/../../..' . '/core/Controller/SearchController.php', 'OC\\Core\\Controller\\SetupController' => __DIR__ . '/../../..' . '/core/Controller/SetupController.php', + 'OC\\Core\\Controller\\SvgController' => __DIR__ . '/../../..' . '/core/Controller/SvgController.php', 'OC\\Core\\Controller\\TwoFactorChallengeController' => __DIR__ . '/../../..' . '/core/Controller/TwoFactorChallengeController.php', 'OC\\Core\\Controller\\UserController' => __DIR__ . '/../../..' . '/core/Controller/UserController.php', 'OC\\Core\\Controller\\WalledGardenController' => __DIR__ . '/../../..' . '/core/Controller/WalledGardenController.php', @@ -1046,6 +1047,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\TemplateLayout' => __DIR__ . '/../../..' . '/lib/private/TemplateLayout.php', 'OC\\Template\\Base' => __DIR__ . '/../../..' . '/lib/private/Template/Base.php', 'OC\\Template\\CSSResourceLocator' => __DIR__ . '/../../..' . '/lib/private/Template/CSSResourceLocator.php', + 'OC\\Template\\IconsCacher' => __DIR__ . '/../../..' . '/lib/private/Template/IconsCacher.php', 'OC\\Template\\JSCombiner' => __DIR__ . '/../../..' . '/lib/private/Template/JSCombiner.php', 'OC\\Template\\JSConfigHelper' => __DIR__ . '/../../..' . '/lib/private/Template/JSConfigHelper.php', 'OC\\Template\\JSResourceLocator' => __DIR__ . '/../../..' . '/lib/private/Template/JSResourceLocator.php', diff --git a/lib/private/Server.php b/lib/private/Server.php index c9f8001631e..0f406ebe9b7 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -116,6 +116,7 @@ use OC\Share20\ProviderFactory; use OC\Share20\ShareHelper; use OC\SystemTag\ManagerFactory as SystemTagManagerFactory; use OC\Tagging\TagMapper; +use OC\Template\IconsCacher; use OC\Template\JSCombiner; use OC\Template\SCSSCacher; use OCA\Theming\ImageManager; @@ -963,7 +964,8 @@ class Server extends ServerContainer implements IServerContainer { $c->getConfig(), $c->getThemingDefaults(), \OC::$SERVERROOT, - $this->getMemCacheFactory() + $this->getMemCacheFactory(), + $c->query(IconsCacher::class) ); }); $this->registerService(JSCombiner::class, function (Server $c) { diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 82cb223bb9f..e9f2a6f5976 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -231,7 +231,7 @@ class Manager implements IManager { 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], 10 => [new Section('security', $this->l->t('Security'), 0, $this->url->imagePath('core', 'actions/password.svg'))], 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], - 50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts-dark.svg'))], + 50 => [new Section('groupware', $this->l->t('Groupware'), 0, $this->url->imagePath('core', 'places/contacts.svg'))], 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], ]; diff --git a/lib/private/Template/IconsCacher.php b/lib/private/Template/IconsCacher.php new file mode 100644 index 00000000000..c262d26654f --- /dev/null +++ b/lib/private/Template/IconsCacher.php @@ -0,0 +1,147 @@ +<?php +declare (strict_types = 1); +/** + * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) + * + * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Template; + +use OCP\Files\IAppData; +use OCP\Files\NotFoundException; +use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\Files\SimpleFS\ISimpleFile; +use OCP\ILogger; +use OCP\IURLGenerator; +use OC\Files\AppData\Factory; + +class IconsCacher { + + /** @var ILogger */ + protected $logger; + + /** @var IAppData */ + protected $appData; + + /** @var ISimpleFolder */ + private $folder; + + /** @var IURLGenerator */ + protected $urlGenerator; + + /** @var string */ + private $iconVarRE = '/--(icon-[a-z0-9-]+): url\(["\']([a-z0-9-_\~\/\?\&\=\.]+)[^;]+;/m'; + + /** @var string */ + private $fileName = 'icons-vars.css'; + + /** + * @param ILogger $logger + * @param Factory $appDataFactory + * @param IURLGenerator $urlGenerator + */ + public function __construct(ILogger $logger, + Factory $appDataFactory, + IURLGenerator $urlGenerator) { + $this->logger = $logger; + $this->appData = $appDataFactory->get('css'); + $this->urlGenerator = $urlGenerator; + + try { + $this->folder = $this->appData->getFolder('icons'); + } catch (NotFoundException $e) { + $this->folder = $this->appData->newFolder('icons'); + } + } + + private function getIconsFromCss(string $css): array{ + preg_match_all($this->iconVarRE, $css, $matches, PREG_SET_ORDER); + $icons = []; + foreach ($matches as $icon) { + $icons[$icon[1]] = $icon[2]; + } + + return $icons; + } + /** + * Parse and cache css + * + * @param string $css + */ + public function setIconsCss(string $css) { + + $cachedFile = $this->getCachedCSS(); + if (!$cachedFile) { + $currentData = ''; + } else { + $currentData = $cachedFile->getContent(); + } + + // remove :root + $currentData = str_replace([':root {', '}'], '', $currentData); + + $icons = $this->getIconsFromCss($currentData . $css); + + $data = ''; + foreach ($icons as $icon => $url) { + $data .= "--$icon: url('$url?v=1');"; + } + + if (strlen($data) > 0) { + if (!$cachedFile) { + $cachedFile = $this->folder->newFile($this->fileName); + } + + $data = ":root { + $data + }"; + $cachedFile->putContent($data); + } + + return preg_replace($this->iconVarRE, '', $css); + } + + /** + * Get icons css file + * @return ISimpleFile|boolean + */ + public function getCachedCSS() { + try { + return $this->folder->getFile($this->fileName); + } catch (NotFoundException $e) { + return false; + } + } + + public function injectCss() { + // Only inject once + foreach (\OC_Util::$headers as $header) { + if ( + array_key_exists('attributes', $header) && + array_key_exists('href', $header['attributes']) && + strpos($header['attributes']['href'], $this->fileName) !== false) { + return; + } + } + $linkToCSS = substr($this->urlGenerator->linkToRoute('core.Css.getCss', ['appName' => 'icons', 'fileName' => $this->fileName]), strlen(\OC::$WEBROOT)); + \OC_Util::addHeader('link', ['rel' => 'stylesheet', 'href' => $linkToCSS], null, true); + } + +}
\ No newline at end of file diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index 6e25e1fa5de..9dcedb94daf 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -32,7 +32,6 @@ use Leafo\ScssPhp\Compiler; use Leafo\ScssPhp\Exception\ParserException; use Leafo\ScssPhp\Formatter\Crunched; use Leafo\ScssPhp\Formatter\Expanded; -use OC\Files\AppData\Factory; use OCP\Files\IAppData; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; @@ -43,6 +42,8 @@ use OCP\ICacheFactory; use OCP\IConfig; use OCP\ILogger; use OCP\IURLGenerator; +use OC\Files\AppData\Factory; +use OC\Template\IconsCacher; class SCSSCacher { @@ -73,6 +74,9 @@ class SCSSCacher { /** @var ICacheFactory */ private $cacheFactory; + /** @var IconsCacher */ + private $iconsCacher; + /** * @param ILogger $logger * @param Factory $appDataFactory @@ -81,6 +85,7 @@ class SCSSCacher { * @param \OC_Defaults $defaults * @param string $serverRoot * @param ICacheFactory $cacheFactory + * @param IconsCacher $iconsCacher */ public function __construct(ILogger $logger, Factory $appDataFactory, @@ -88,15 +93,17 @@ class SCSSCacher { IConfig $config, \OC_Defaults $defaults, $serverRoot, - ICacheFactory $cacheFactory) { - $this->logger = $logger; - $this->appData = $appDataFactory->get('css'); + ICacheFactory $cacheFactory, + IconsCacher $iconsCacher) { + $this->logger = $logger; + $this->appData = $appDataFactory->get('css'); $this->urlGenerator = $urlGenerator; - $this->config = $config; - $this->defaults = $defaults; - $this->serverRoot = $serverRoot; + $this->config = $config; + $this->defaults = $defaults; + $this->serverRoot = $serverRoot; $this->cacheFactory = $cacheFactory; - $this->depsCache = $cacheFactory->createDistributed('SCSS-' . md5($this->urlGenerator->getBaseUrl())); + $this->depsCache = $cacheFactory->createDistributed('SCSS-' . md5($this->urlGenerator->getBaseUrl())); + $this->iconsCacher = $iconsCacher; } /** @@ -112,23 +119,34 @@ class SCSSCacher { $path = explode('/', $root . '/' . $file); $fileNameSCSS = array_pop($path); - $fileNameCSS = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)), $app); + $fileNameCSS = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileNameSCSS)), $app); - $path = implode('/', $path); + $path = implode('/', $path); $webDir = $this->getWebDir($path, $app, $this->serverRoot, \OC::$WEBROOT); try { $folder = $this->appData->getFolder($app); - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { // creating css appdata folder $folder = $this->appData->newFolder($app); } - - if(!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) { + if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $folder)) { + // Inject icons vars css if any + if ($this->iconsCacher->getCachedCSS() && $this->iconsCacher->getCachedCSS()->getSize() > 0) { + $this->iconsCacher->injectCss(); + } return true; } - return $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir); + + $cached = $this->cache($path, $fileNameCSS, $fileNameSCSS, $folder, $webDir); + + // Inject icons vars css if any + if ($this->iconsCacher->getCachedCSS() && $this->iconsCacher->getCachedCSS()->getSize() > 0) { + $this->iconsCacher->injectCss(); + } + + return $cached; } /** @@ -137,8 +155,9 @@ class SCSSCacher { * @return ISimpleFile */ public function getCachedCSS(string $appName, string $fileName): ISimpleFile { - $folder = $this->appData->getFolder($appName); + $folder = $this->appData->getFolder($appName); $cachedFileName = $this->prependVersionPrefix($this->prependBaseurlPrefix($fileName), $appName); + return $folder->getFile($cachedFileName); } @@ -153,24 +172,26 @@ class SCSSCacher { $cachedFile = $folder->getFile($fileNameCSS); if ($cachedFile->getSize() > 0) { $depFileName = $fileNameCSS . '.deps'; - $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName); + $deps = $this->depsCache->get($folder->getName() . '-' . $depFileName); if ($deps === null) { $depFile = $folder->getFile($depFileName); - $deps = $depFile->getContent(); + $deps = $depFile->getContent(); //Set to memcache for next run $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); } $deps = json_decode($deps, true); - foreach ((array)$deps as $file=>$mtime) { + foreach ((array) $deps as $file => $mtime) { if (!file_exists($file) || filemtime($file) > $mtime) { return false; } } + return true; } + return false; - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { return false; } } @@ -181,11 +202,13 @@ class SCSSCacher { */ private function variablesChanged(): bool { $injectedVariables = $this->getInjectedVariables(); - if($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { + if ($this->config->getAppValue('core', 'scss.variables') !== md5($injectedVariables)) { $this->resetCache(); $this->config->setAppValue('core', 'scss.variables', md5($injectedVariables)); + return true; } + return false; } @@ -204,11 +227,12 @@ class SCSSCacher { $scss = new Compiler(); $scss->setImportPaths([ $path, - $this->serverRoot . '/core/css/', + $this->serverRoot . '/core/css/' ]); + // Continue after throw $scss->setIgnoreErrors(true); - if($this->config->getSystemValue('debug')) { + if ($this->config->getSystemValue('debug')) { // Debug mode $scss->setFormatter(Expanded::class); $scss->setLineNumberStyle(Compiler::LINE_COMMENTS); @@ -219,7 +243,7 @@ class SCSSCacher { try { $cachedfile = $folder->getFile($fileNameCSS); - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { $cachedfile = $folder->newFile($fileNameCSS); } @@ -233,14 +257,20 @@ class SCSSCacher { // Compile try { $compiledScss = $scss->compile( + '$webroot: \'' . $this->getRoutePrefix() . '\';' . '@import "variables.scss";' . + '@import "functions.scss";' . $this->getInjectedVariables() . - '@import "'.$fileNameSCSS.'";'); - } catch(ParserException $e) { + '@import "' . $fileNameSCSS . '";'); + } catch (ParserException $e) { $this->logger->error($e, ['app' => 'core']); + return false; } + // Parse Icons and create related css variables + $compiledScss = $this->iconsCacher->setIconsCss($compiledScss); + // Gzip file try { $gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz @@ -255,10 +285,12 @@ class SCSSCacher { $depFile->putContent($deps); $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps); $gzipFile->putContent(gzencode($data, 9)); - $this->logger->debug('SCSSCacher: '.$webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']); + $this->logger->debug('SCSSCacher: ' . $webDir . '/' . $fileNameSCSS . ' compiled and successfully cached', ['app' => 'core']); + return true; - } catch(NotPermittedException $e) { + } catch (NotPermittedException $e) { $this->logger->error('SCSSCacher: unable to cache: ' . $fileNameSCSS); + return false; } } @@ -275,7 +307,7 @@ class SCSSCacher { foreach ($folder->getDirectoryListing() as $file) { try { $file->delete(); - } catch(NotPermittedException $e) { + } catch (NotPermittedException $e) { $this->logger->logException($e, ['message' => 'SCSSCacher: unable to delete file: ' . $file->getName()]); } } @@ -313,8 +345,9 @@ class SCSSCacher { * @return string */ private function rebaseUrls(string $css, string $webDir): string { - $re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x'; - $subst = 'url(\''.$webDir.'/$1\')'; + $re = '/url\([\'"]([^\/][\.\w?=\/-]*)[\'"]\)/x'; + $subst = 'url(\'' . $webDir . '/$1\')'; + return preg_replace($re, $subst, $css); } @@ -326,8 +359,8 @@ class SCSSCacher { */ public function getCachedSCSS(string $appName, string $fileName): string { $tmpfileLoc = explode('/', $fileName); - $fileName = array_pop($tmpfileLoc); - $fileName = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)), $appName); + $fileName = array_pop($tmpfileLoc); + $fileName = $this->prependVersionPrefix($this->prependBaseurlPrefix(str_replace('.scss', '.css', $fileName)), $appName); return substr($this->urlGenerator->linkToRoute('core.Css.getCss', ['fileName' => $fileName, 'appName' => $appName]), strlen(\OC::$WEBROOT) + 1); } @@ -338,8 +371,16 @@ class SCSSCacher { * @return string */ private function prependBaseurlPrefix(string $cssFile): string { - $frontendController = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); - return substr(md5($this->urlGenerator->getBaseUrl() . $frontendController), 0, 4) . '-' . $cssFile; + return substr(md5($this->urlGenerator->getBaseUrl() . $this->getRoutePrefix()), 0, 4) . '-' . $cssFile; + } + + private function getRoutePrefix() { + $frontControllerActive = ($this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true'); + $prefix = \OC::$WEBROOT . '/index.php'; + if ($frontControllerActive) { + $prefix = \OC::$WEBROOT; + } + return $prefix; } /** @@ -354,6 +395,7 @@ class SCSSCacher { return substr(md5($appVersion), 0, 4) . '-' . $cssFile; } $coreVersion = \OC_Util::getVersionString(); + return substr(md5($coreVersion), 0, 4) . '-' . $cssFile; } @@ -367,12 +409,14 @@ class SCSSCacher { */ private function getWebDir(string $path, string $appName, string $serverRoot, string $webRoot): string { // Detect if path is within server root AND if path is within an app path - if ( strpos($path, $serverRoot) === false && $appWebPath = \OC_App::getAppWebPath($appName)) { + if (strpos($path, $serverRoot) === false && $appWebPath = \OC_App::getAppWebPath($appName)) { // Get the file path within the app directory $appDirectoryPath = explode($appName, $path)[1]; // Remove the webroot - return str_replace($webRoot, '', $appWebPath.$appDirectoryPath); + + return str_replace($webRoot, '', $appWebPath . $appDirectoryPath); } - return $webRoot.substr($path, strlen($serverRoot)); + + return $webRoot . substr($path, strlen($serverRoot)); } } diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index ab595d885cb..5e9a46d44a9 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -687,13 +687,20 @@ class OC_Util { * @param string $tag tag name of the element * @param array $attributes array of attributes for the element * @param string $text the text content for the element + * @param bool $prepend prepend the header to the beginning of the list */ - public static function addHeader($tag, $attributes, $text=null) { - self::$headers[] = array( + public static function addHeader($tag, $attributes, $text = null, $prepend = false) { + $header = array( 'tag' => $tag, 'attributes' => $attributes, 'text' => $text ); + if ($prepend === true) { + array_unshift (self::$headers, $header); + + } else { + self::$headers[] = $header; + } } /** diff --git a/settings/css/settings.scss b/settings/css/settings.scss index 1ca14b8f1d3..60c7f368bf1 100644 --- a/settings/css/settings.scss +++ b/settings/css/settings.scss @@ -15,23 +15,23 @@ input { /* icons for sidebar */ .nav-icon-personal-settings { - background-image: url('../img/personal.svg?v=1'); + @include icon-color('personal', 'settings', $color-black); } .nav-icon-security { - background-image: url('../img/toggle-filelist.svg?v=1'); + @include icon-color('toggle-filelist', 'settings', $color-black); } .nav-icon-clientsbox { - background-image: url('../img/change.svg?v=1'); + @include icon-color('change', 'settings', $color-black); } .nav-icon-federated-cloud { - background-image: url('../img/share.svg?v=1'); + @include icon-color('share', 'settings', $color-black); } .nav-icon-second-factor-backup-codes, .nav-icon-ssl-root-certificate { - background-image: url('../img/password.svg?v=1'); + @include icon-color('password', 'settings', $color-black); } #avatarform { diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 30a5b7bd103..76f6d867d3a 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -122,7 +122,7 @@ class ManagerTest extends TestCase { ['core', 'actions/settings-dark.svg', '1'], ['core', 'actions/share.svg', '2'], ['core', 'actions/password.svg', '3'], - ['core', 'places/contacts-dark.svg', '5'], + ['core', 'places/contacts.svg', '5'], ['settings', 'help.svg', '4'], ]); @@ -175,7 +175,7 @@ class ManagerTest extends TestCase { ['core', 'actions/settings-dark.svg', '1'], ['core', 'actions/share.svg', '2'], ['core', 'actions/password.svg', '3'], - ['core', 'places/contacts-dark.svg', '5'], + ['core', 'places/contacts.svg', '5'], ['settings', 'help.svg', '4'], ]); diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php index a8b123b8d5b..3fb7972b211 100644 --- a/tests/lib/Template/CSSResourceLocatorTest.php +++ b/tests/lib/Template/CSSResourceLocatorTest.php @@ -31,6 +31,7 @@ use OCP\ILogger; use OCP\IURLGenerator; use OCP\IConfig; use OCA\Theming\ThemingDefaults; +use OC\Template\IconsCacher; use OC\Template\SCSSCacher; use OC\Template\CSSResourceLocator; @@ -47,6 +48,8 @@ class CSSResourceLocatorTest extends \Test\TestCase { protected $cacheFactory; /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ protected $logger; + /** @var IconsCacher|\PHPUnit_Framework_MockObject_MockObject */ + protected $iconsCacher; protected function setUp() { parent::setUp(); @@ -57,6 +60,7 @@ class CSSResourceLocatorTest extends \Test\TestCase { $this->config = $this->createMock(IConfig::class); $this->cacheFactory = $this->createMock(ICacheFactory::class); $this->themingDefaults = $this->createMock(ThemingDefaults::class); + $this->iconsCacher = $this->createMock(IconsCacher::class); } private function cssResourceLocator() { @@ -70,7 +74,8 @@ class CSSResourceLocatorTest extends \Test\TestCase { $this->config, $this->themingDefaults, \OC::$SERVERROOT, - $this->cacheFactory + $this->cacheFactory, + $this->iconsCacher ); return new CSSResourceLocator( $this->logger, diff --git a/tests/lib/Template/IconsCacherTest.php b/tests/lib/Template/IconsCacherTest.php new file mode 100644 index 00000000000..106f08d5fa8 --- /dev/null +++ b/tests/lib/Template/IconsCacherTest.php @@ -0,0 +1,127 @@ +<?php +declare (strict_types = 1); +/** + * @copyright Copyright (c) 2018, John Molakvoæ (skjnldsv@protonmail.com) + * + * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace Test\Template; + +use OC\Files\AppData\AppData; +use OC\Files\AppData\Factory; +use OC\Template\IconsCacher; +use OCA\Theming\ThemingDefaults; +use OCP\Files\IAppData; +use OCP\Files\NotFoundException; +use OCP\Files\SimpleFS\ISimpleFile; +use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\ICache; +use OCP\ICacheFactory; +use OCP\IConfig; +use OCP\ILogger; +use OCP\IURLGenerator; +use OC_App; + +class IconsCacherTest extends \Test\TestCase { + /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ + protected $logger; + /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */ + protected $appData; + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlGenerator; + + protected function setUp() { + $this->logger = $this->createMock(ILogger::class); + $this->appData = $this->createMock(AppData::class); + + /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */ + $factory = $this->createMock(Factory::class); + $factory->method('get')->with('css')->willReturn($this->appData); + + $this->folder = $this->createMock(ISimpleFolder::class); + $this->appData->method('getFolder')->willReturn($this->folder); + + $this->urlGenerator = $this->createMock(IURLGenerator::class); + + $this->iconsCacher = new IconsCacher( + $this->logger, + $factory, + $this->urlGenerator + ); + } + + public function testGetIconsFromEmptyCss() { + $css = " + icon.test { + color: #aaa; + } + "; + $icons = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); + $this->assertTrue(empty($icons)); + } + + public function testGetIconsFromValidCss() { + $css = " + icon.test { + --icon-test: url('/svg/core/actions/add/000'); + background-image: var(--icon-test); + } + "; + $actual = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); + $expected = array( + 'icon-test' => '/svg/core/actions/add/000' + ); + $this->assertEquals($expected, $actual); + } + + public function testSetIconsFromEmptyCss() { + $expected = " + icon.test { + color: #aaa; + } + "; + $actual = $this->iconsCacher->setIconsCss($expected); + $this->assertEquals($expected, $actual); + } + + public function testSetIconsFromValidCss() { + $css = " + icon.test { + --icon-test: url('/svg/core/actions/add/000'); + background-image: var(--icon-test); + } + "; + $expected = " + icon.test { + + background-image: var(--icon-test); + } + "; + + $iconsFile = $this->createMock(ISimpleFile::class); + $this->folder->expects($this->once()) + ->method('getFile') + ->willReturn($iconsFile); + + $actual = $this->iconsCacher->setIconsCss($css); + $this->assertEquals($expected, $actual); + } + +}
\ No newline at end of file diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index 5e3700477ff..f32b87edcbb 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -26,6 +26,7 @@ namespace Test\Template; use OC\Files\AppData\AppData; use OC\Files\AppData\Factory; use OC\Template\SCSSCacher; +use OC\Template\IconsCacher; use OCA\Theming\ThemingDefaults; use OCP\Files\IAppData; use OCP\Files\NotFoundException; @@ -55,11 +56,14 @@ class SCSSCacherTest extends \Test\TestCase { protected $depsCache; /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $cacheFactory; + /** @var IconsCacher|\PHPUnit_Framework_MockObject_MockObject */ + protected $iconsCacher; protected function setUp() { parent::setUp(); $this->logger = $this->createMock(ILogger::class); $this->appData = $this->createMock(AppData::class); + $this->iconsCacher = $this->createMock(IconsCacher::class); /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */ $factory = $this->createMock(Factory::class); @@ -80,6 +84,11 @@ class SCSSCacherTest extends \Test\TestCase { $this->themingDefaults = $this->createMock(ThemingDefaults::class); $this->themingDefaults->expects($this->any())->method('getScssVariables')->willReturn([]); + $iconsFile = $this->createMock(ISimpleFile::class); + $this->iconsCacher->expects($this->any()) + ->method('getCachedCSS') + ->willReturn($iconsFile); + $this->scssCacher = new SCSSCacher( $this->logger, $factory, @@ -87,7 +96,8 @@ class SCSSCacherTest extends \Test\TestCase { $this->config, $this->themingDefaults, \OC::$SERVERROOT, - $this->cacheFactory + $this->cacheFactory, + $this->iconsCacher ); } @@ -103,7 +113,7 @@ class SCSSCacherTest extends \Test\TestCase { $fileDeps = $this->createMock(ISimpleFile::class); $gzfile = $this->createMock(ISimpleFile::class); $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' . - substr(md5('http://localhost/nextcloud'), 0, 4) . '-'; + substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) { @@ -126,6 +136,10 @@ class SCSSCacherTest extends \Test\TestCase { ->method('getBaseUrl') ->willReturn('http://localhost/nextcloud'); + $this->iconsCacher->expects($this->any()) + ->method('setIconsCss') + ->willReturn('scss {}'); + $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core'); $this->assertTrue($actual); } @@ -139,7 +153,7 @@ class SCSSCacherTest extends \Test\TestCase { $fileDeps = $this->createMock(ISimpleFile::class); $gzfile = $this->createMock(ISimpleFile::class); $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' . - substr(md5('http://localhost/nextcloud'), 0, 4) . '-'; + substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) { @@ -158,6 +172,10 @@ class SCSSCacherTest extends \Test\TestCase { ->with($filePrefix.'styles.css.deps') ->willReturn($fileDeps); + $this->iconsCacher->expects($this->any()) + ->method('setIconsCss') + ->willReturn('scss {}'); + $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core'); $this->assertTrue($actual); } @@ -171,7 +189,7 @@ class SCSSCacherTest extends \Test\TestCase { $fileDeps->expects($this->any())->method('getSize')->willReturn(1); $gzFile = $this->createMock(ISimpleFile::class); $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' . - substr(md5('http://localhost/nextcloud'), 0, 4) . '-'; + substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { @@ -185,6 +203,10 @@ class SCSSCacherTest extends \Test\TestCase { $this->fail(); })); + $this->iconsCacher->expects($this->any()) + ->method('setIconsCss') + ->willReturn('scss {}'); + $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core'); $this->assertTrue($actual); } @@ -205,9 +227,8 @@ class SCSSCacherTest extends \Test\TestCase { $fileDeps->expects($this->any())->method('getSize')->willReturn(1); $gzFile = $this->createMock(ISimpleFile::class); - $filePrefix = substr(md5('http://localhost/nextcloud'), 0, 8) . '-'; $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' . - substr(md5('http://localhost/nextcloud'), 0, 4) . '-'; + substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-'; $folder->method('getFile') ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) { if ($name === $filePrefix.'styles.css') { @@ -220,6 +241,10 @@ class SCSSCacherTest extends \Test\TestCase { $this->fail(); })); + $this->iconsCacher->expects($this->any()) + ->method('setIconsCss') + ->willReturn('scss {}'); + $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core'); $this->assertTrue($actual); } @@ -276,6 +301,10 @@ class SCSSCacherTest extends \Test\TestCase { throw new \Exception(); })); + $this->iconsCacher->expects($this->any()) + ->method('setIconsCss') + ->willReturn('scss {}'); + $file->expects($this->once())->method('putContent'); $depsFile->expects($this->once())->method('putContent'); $gzipFile->expects($this->once())->method('putContent'); @@ -310,6 +339,10 @@ class SCSSCacherTest extends \Test\TestCase { $depsFile->expects($this->once())->method('putContent'); $gzipFile->expects($this->once())->method('putContent'); + $this->iconsCacher->expects($this->any()) + ->method('setIconsCss') + ->willReturn('scss {}'); + $actual = self::invokePrivate($this->scssCacher, 'cache', [$path, $fileNameCSS, $fileNameSCSS, $folder, $webDir]); $this->assertTrue($actual); } @@ -336,6 +369,10 @@ class SCSSCacherTest extends \Test\TestCase { throw new \Exception(); })); + $this->iconsCacher->expects($this->at(0)) + ->method('setIconsCss') + ->willReturn('body{background-color:#0082c9}'); + $file->expects($this->at(0))->method('putContent')->with($this->callback( function ($content){ return 'body{background-color:#0082c9}' === $content; @@ -409,7 +446,7 @@ class SCSSCacherTest extends \Test\TestCase { ->method('linkToRoute') ->with('core.Css.getCss', [ 'fileName' => substr(md5($version), 0, 4) . '-' . - substr(md5('http://localhost/nextcloud'), 0, 4) . '-styles.css', + substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-styles.css', 'appName' => $appName ]) ->willReturn(\OC::$WEBROOT . $result); |