diff --git a/resources/sprite/manifest/status.json b/resources/sprite/manifest/status.json index 6bcac22d29..9cfbf11bc3 100644 --- a/resources/sprite/manifest/status.json +++ b/resources/sprite/manifest/status.json @@ -1,526 +1,526 @@ { "version" : 1, "sprites" : { "status-accept" : { "name" : "status-accept", "rule" : ".status-accept", "hash" : "6493498ca9beb344cffa6211fb80cbfd" }, "status-accept-blue" : { "name" : "status-accept-blue", "rule" : ".status-accept-blue", "hash" : "c3bde2e1361bcd7259825ecaf2d4b2ff" }, "status-accept-dark" : { "name" : "status-accept-dark", "rule" : ".status-accept-dark", "hash" : "a2ec73e144ea598be15b8acb63f3c096" }, "status-accept-green" : { "name" : "status-accept-green", "rule" : ".status-accept-green", "hash" : "cf0c2339a111f54adfdcc0de5c18be22" }, "status-accept-red" : { "name" : "status-accept-red", "rule" : ".status-accept-red", "hash" : "1466a3ed72f63971e38e669715cf5b98" }, "status-accept-white" : { "name" : "status-accept-white", "rule" : ".status-accept-white", "hash" : "8ecccf5e2ce6658d8a1e963e4be6f6e9" }, "status-add" : { "name" : "status-add", "rule" : ".status-add", "hash" : "165d43c1451fb9ffd69c36ede87c7875" }, "status-add-blue" : { "name" : "status-add-blue", "rule" : ".status-add-blue", "hash" : "8860efdd8f90eed700ae48595ace6b38" }, "status-add-dark" : { "name" : "status-add-dark", "rule" : ".status-add-dark", "hash" : "38dc8634ccfe6fa30f467e97436e1a30" }, "status-add-green" : { "name" : "status-add-green", "rule" : ".status-add-green", "hash" : "5610cd9924ad6b3461a20dd050ef4866" }, "status-add-red" : { "name" : "status-add-red", "rule" : ".status-add-red", "hash" : "9e0abe2b6e37ef5a1a2522ad01002704" }, "status-add-white" : { "name" : "status-add-white", "rule" : ".status-add-white", "hash" : "1a8ab412f40c569acdc709fb281fefde" }, "status-down" : { "name" : "status-down", "rule" : ".status-down", "hash" : "85d3b2376bbed1b48cb777f07a4e244e" }, "status-down-blue" : { "name" : "status-down-blue", "rule" : ".status-down-blue", "hash" : "25baf216cd311f321656a5f3a327c38c" }, "status-down-dark" : { "name" : "status-down-dark", "rule" : ".status-down-dark", "hash" : "bb82d18b729ac30956200b655eafeeb8" }, "status-down-green" : { "name" : "status-down-green", "rule" : ".status-down-green", "hash" : "c29ad19910664ecc94e0d1fa99a0a6c0" }, "status-down-red" : { "name" : "status-down-red", "rule" : ".status-down-red", "hash" : "644f0d38cad5cc6797fe81ed30b9bc6a" }, "status-down-white" : { "name" : "status-down-white", "rule" : ".status-down-white", "hash" : "5bc0af6641ef545218ecced2d25e9a10" }, "status-info" : { "name" : "status-info", "rule" : ".status-info", "hash" : "3b9d6abe2fb44b0959208632a77d3582" }, "status-info-blue" : { "name" : "status-info-blue", "rule" : ".status-info-blue", "hash" : "2acc8c62d8963bec9ce632de60a4da41" }, "status-info-dark" : { "name" : "status-info-dark", "rule" : ".status-info-dark", "hash" : "d96f44c17e67d7c0c10a400e6ff294f1" }, "status-info-green" : { "name" : "status-info-green", "rule" : ".status-info-green", "hash" : "28fc83a1f5bee4ac39a0dcd52e180818" }, "status-info-red" : { "name" : "status-info-red", "rule" : ".status-info-red", "hash" : "fc26e5509140d8e9a3305a39c44773f0" }, "status-info-white" : { "name" : "status-info-white", "rule" : ".status-info-white", "hash" : "b70025f459685371f8397b61944bef7d" }, "status-left" : { "name" : "status-left", "rule" : ".status-left", "hash" : "4649139ffc7e668b67d6978bbd5cbf15" }, "status-left-blue" : { "name" : "status-left-blue", "rule" : ".status-left-blue", "hash" : "cdec5d2617cb7fcfbfea336881d267f0" }, "status-left-dark" : { "name" : "status-left-dark", "rule" : ".status-left-dark", "hash" : "83b58d1cde130deb01971888ad0bcfc1" }, "status-left-green" : { "name" : "status-left-green", "rule" : ".status-left-green", "hash" : "6b34445f1a034e71432a5823bed1c4d7" }, "status-left-red" : { "name" : "status-left-red", "rule" : ".status-left-red", "hash" : "38ebb75c0fbcf6fe96def6c2ab70b343" }, "status-left-white" : { "name" : "status-left-white", "rule" : ".status-left-white", "hash" : "9e89400271b55590e610188d93671934" }, "status-minus" : { "name" : "status-minus", "rule" : ".status-minus", "hash" : "a232bd27513a71ce8f4cd163d8aa05cf" }, "status-minus-blue" : { "name" : "status-minus-blue", "rule" : ".status-minus-blue", "hash" : "61ef81a9b78b4de4bf6303f8d51c86ef" }, "status-minus-dark" : { "name" : "status-minus-dark", "rule" : ".status-minus-dark", "hash" : "db4ddb69a22c7f6f09669fe3c488c4f0" }, "status-minus-green" : { "name" : "status-minus-green", "rule" : ".status-minus-green", "hash" : "9e5402f65601ced38a967d4e17b80f1c" }, "status-minus-red" : { "name" : "status-minus-red", "rule" : ".status-minus-red", "hash" : "bcaf148bc842e398f08d8c01506bd5b6" }, "status-minus-white" : { "name" : "status-minus-white", "rule" : ".status-minus-white", "hash" : "c5a3771452dda603fbaee87371044f5a" }, "status-oh-closed" : { "name" : "status-oh-closed", "rule" : ".status-oh-closed", "hash" : "fa5f2ef65de3e55c9251aebbed662f7a" }, "status-oh-closed-dark" : { "name" : "status-oh-closed-dark", "rule" : ".status-oh-closed-dark", "hash" : "926d6a4e9530a20cd9cd655b334e4f89" }, "status-oh-ok" : { "name" : "status-oh-ok", "rule" : ".status-oh-ok", "hash" : "0d1a2962da8fa12dd41a11316ba7f2eb" }, "status-oh-ok-dark" : { "name" : "status-oh-ok-dark", "rule" : ".status-oh-ok-dark", "hash" : "2daa23d9b1b6c66daac93625dbd26dbc" }, "status-oh-open" : { "name" : "status-oh-open", "rule" : ".status-oh-open", "hash" : "8d759391597ad3925abf2b4b4aaed537" }, "status-oh-open-green" : { "name" : "status-oh-open-green", "rule" : ".status-oh-open-green", "hash" : "18fbeb777a9c5a7d46e0ba0760d3a557" }, "status-oh-open-red" : { "name" : "status-oh-open-red", "rule" : ".status-oh-open-red", "hash" : "982610ba3d0bad1aaa11dcd3b593adbf" }, "status-open" : { "name" : "status-open", "rule" : ".status-open", "hash" : "5b6b67382052982358d0047f07dd0424" }, "status-open-blue" : { "name" : "status-open-blue", "rule" : ".status-open-blue", "hash" : "9632bb52d5f24941202848c2e3d4488a" }, "status-open-dark" : { "name" : "status-open-dark", "rule" : ".status-open-dark", "hash" : "ca38ff5fc8a327d96cd1bbc23043fbb4" }, "status-open-green" : { "name" : "status-open-green", "rule" : ".status-open-green", "hash" : "b4a2c17594a5301e2bd52a9df71819d3" }, "status-open-red" : { "name" : "status-open-red", "rule" : ".status-open-red", "hash" : "f92b1544978d691da6912f937df54273" }, "status-open-white" : { "name" : "status-open-white", "rule" : ".status-open-white", "hash" : "169dc0e8f36444ea30163181f9c88dc2" }, "status-pl-summary" : { "name" : "status-pl-summary", "rule" : ".status-pl-summary", "hash" : "0abd0eab8617fb88f9b8f4d2f00e17b8" }, "status-pl-testplan" : { "name" : "status-pl-testplan", "rule" : ".status-pl-testplan", "hash" : "03dbb3c53bfddfb553d49c6f27a76765" }, "status-policy-admin" : { "name" : "status-policy-admin", "rule" : ".status-policy-admin", "hash" : "16c86a605a15a7a87f4d706c2122834c" }, "status-policy-admin-white" : { "name" : "status-policy-admin-white", - "rule" : ".status-policy-admin-white, .dropdown-menu-item:hover .status-policy-admin", + "rule" : ".status-policy-admin-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-admin", "hash" : "4b16ec5170bc30fb688f7e086e61a7f1" }, "status-policy-all" : { "name" : "status-policy-all", "rule" : ".status-policy-all", "hash" : "7e8f9e8019ad7f668e51a097f0554ace" }, "status-policy-all-white" : { "name" : "status-policy-all-white", - "rule" : ".status-policy-all-white, .dropdown-menu-item:hover .status-policy-all", + "rule" : ".status-policy-all-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-all", "hash" : "24ed12bf6f58c21a82be125ace2ff0d0" }, "status-policy-custom" : { "name" : "status-policy-custom", "rule" : ".status-policy-custom", "hash" : "3cf516b1e50412ec95594b9866ab1c39" }, "status-policy-custom-white" : { "name" : "status-policy-custom-white", - "rule" : ".status-policy-custom-white, .dropdown-menu-item:hover .status-policy-custom", + "rule" : ".status-policy-custom-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-custom", "hash" : "ff8b4cbe21f3b4254f343fffc170ef4b" }, "status-policy-elist" : { "name" : "status-policy-elist", "rule" : ".status-policy-elist", "hash" : "da03d710291f394933260dbf43dbc654" }, "status-policy-elist-white" : { "name" : "status-policy-elist-white", "rule" : ".status-policy-elist-white", "hash" : "57e90e9c91fd640e6a778ddc9a2fa015" }, "status-policy-noone" : { "name" : "status-policy-noone", "rule" : ".status-policy-noone", "hash" : "e3403fb78718660105d86029518cf43c" }, "status-policy-noone-white" : { "name" : "status-policy-noone-white", - "rule" : ".status-policy-noone-white, .dropdown-menu-item:hover .status-policy-noone", + "rule" : ".status-policy-noone-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-noone", "hash" : "80fb9b153fec4d8136242c5ddc2d8e77" }, "status-policy-project" : { "name" : "status-policy-project", "rule" : ".status-policy-project", "hash" : "2b77235f7057f3b29075d153345eacc6" }, "status-policy-project-white" : { "name" : "status-policy-project-white", - "rule" : ".status-policy-project-white, .dropdown-menu-item:hover .status-policy-project", + "rule" : ".status-policy-project-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-project", "hash" : "ac2b6f19edb8d6c40f0bcb3fd477a067" }, "status-policy-public" : { "name" : "status-policy-public", "rule" : ".status-policy-public", "hash" : "e7959890117091fb185816dbc888dfd2" }, "status-policy-public-white" : { "name" : "status-policy-public-white", - "rule" : ".status-policy-public-white, .dropdown-menu-item:hover .status-policy-public", + "rule" : ".status-policy-public-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-public", "hash" : "cf809ca49eefed5375c2ea081e721971" }, "status-policy-unknown" : { "name" : "status-policy-unknown", "rule" : ".status-policy-unknown", "hash" : "0235fd879547c98ad658fa0375c386b6" }, "status-policy-unknown-white" : { "name" : "status-policy-unknown-white", - "rule" : ".status-policy-unknown-white, .dropdown-menu-item:hover .status-policy-unknown", + "rule" : ".status-policy-unknown-white, .phuix-dropdown-menu .phabricator-action-view:hover .status-policy-unknown", "hash" : "98985bfa005672c4b88feaf88cfa72bc" }, "status-policy-user" : { "name" : "status-policy-user", "rule" : ".status-policy-user", "hash" : "6c21aa20866d5b86f074bdcf4f487d40" }, "status-policy-user-white" : { "name" : "status-policy-user-white", "rule" : ".status-policy-user-white", "hash" : "97a569e973df3f1e4fe012adf216ca40" }, "status-question" : { "name" : "status-question", "rule" : ".status-question", "hash" : "f7290c6ba78eb37a6641eecfdc128f08" }, "status-question-blue" : { "name" : "status-question-blue", "rule" : ".status-question-blue", "hash" : "44ebbdbe059ca77ae4dc6a6b98de1ccf" }, "status-question-dark" : { "name" : "status-question-dark", "rule" : ".status-question-dark", "hash" : "5fdd5f2b089f4481a39760a50224d8b2" }, "status-question-green" : { "name" : "status-question-green", "rule" : ".status-question-green", "hash" : "326dfc6c1841410ce0f22d702c872c01" }, "status-question-red" : { "name" : "status-question-red", "rule" : ".status-question-red", "hash" : "18dbec41627f8c047c4e736f84dacb33" }, "status-question-white" : { "name" : "status-question-white", "rule" : ".status-question-white", "hash" : "5e7f546f978d1d0545cad127ea3bcf80" }, "status-reject" : { "name" : "status-reject", "rule" : ".status-reject", "hash" : "288489e716b390c5404969f9979b9ded" }, "status-reject-blue" : { "name" : "status-reject-blue", "rule" : ".status-reject-blue", "hash" : "b0f51db6aa6ee85a24a1f4c13812d7ef" }, "status-reject-dark" : { "name" : "status-reject-dark", "rule" : ".status-reject-dark", "hash" : "9b28c36f6cbd6d5d5731b971193a151e" }, "status-reject-green" : { "name" : "status-reject-green", "rule" : ".status-reject-green", "hash" : "fc171843df97bcdc6e4679682b3b31e4" }, "status-reject-red" : { "name" : "status-reject-red", "rule" : ".status-reject-red", "hash" : "6de0dd95a92d33bda228aaa9ba6deee5" }, "status-reject-white" : { "name" : "status-reject-white", "rule" : ".status-reject-white", "hash" : "e709a3fb3081a395900deaef0591066c" }, "status-right" : { "name" : "status-right", "rule" : ".status-right", "hash" : "cd61a821b88b7c76a43d7f405d54b6cc" }, "status-right-blue" : { "name" : "status-right-blue", "rule" : ".status-right-blue", "hash" : "ca1cae1d93486785ec50458ba3b19082" }, "status-right-dark" : { "name" : "status-right-dark", "rule" : ".status-right-dark", "hash" : "fb6600fd1775a8a4fb85709dc4f6c28c" }, "status-right-green" : { "name" : "status-right-green", "rule" : ".status-right-green", "hash" : "9a52218e6c6d3968a05eb51865ed3cba" }, "status-right-red" : { "name" : "status-right-red", "rule" : ".status-right-red", "hash" : "06bd9747ce4cc87282b2fb207c525f0c" }, "status-right-white" : { "name" : "status-right-white", "rule" : ".status-right-white", "hash" : "be2ffb65a7799cd9a5e00c2334e378b2" }, "status-time-green" : { "name" : "status-time-green", "rule" : ".status-time-green", "hash" : "5cb4771e10aaf79ac490bc93bd029d8f" }, "status-time-orange" : { "name" : "status-time-orange", "rule" : ".status-time-orange", "hash" : "aa48043beff2c8576402dbccbe4ad3e2" }, "status-time-red" : { "name" : "status-time-red", "rule" : ".status-time-red", "hash" : "e4dbf14f1ac16338b5e01aa04f2e267e" }, "status-time-yellow" : { "name" : "status-time-yellow", "rule" : ".status-time-yellow", "hash" : "79756bcf7f2401d7e3a97ff03b981dcb" }, "status-up" : { "name" : "status-up", "rule" : ".status-up", "hash" : "d42ac0a3f7bbae3bf57478f533ae88f4" }, "status-up-blue" : { "name" : "status-up-blue", "rule" : ".status-up-blue", "hash" : "44fc24b3646e29c949b639157c315140" }, "status-up-dark" : { "name" : "status-up-dark", "rule" : ".status-up-dark", "hash" : "459ed916291bfa905676ae0818bb2e1b" }, "status-up-green" : { "name" : "status-up-green", "rule" : ".status-up-green", "hash" : "6a682e48fc2f240b19bd175be52c9256" }, "status-up-red" : { "name" : "status-up-red", "rule" : ".status-up-red", "hash" : "0e38f6282e542470ecb68e55fad7eb76" }, "status-up-white" : { "name" : "status-up-white", "rule" : ".status-up-white", "hash" : "ce80e291bc905b2692ad9f3ece7cf206" }, "status-warning" : { "name" : "status-warning", "rule" : ".status-warning", "hash" : "425a02c06f9590e9f7c078badf832d0c" }, "status-warning-blue" : { "name" : "status-warning-blue", "rule" : ".status-warning-blue", "hash" : "93f5e066a01a874adc2c120cca4bd1fc" }, "status-warning-dark" : { "name" : "status-warning-dark", "rule" : ".status-warning-dark", "hash" : "273a519299d7063710452d21c0bc6406" }, "status-warning-green" : { "name" : "status-warning-green", "rule" : ".status-warning-green", "hash" : "991514e5b75509b27fd68d21755b9fa6" }, "status-warning-red" : { "name" : "status-warning-red", "rule" : ".status-warning-red", "hash" : "b15f61f314cbda5486d3aa21990153ae" }, "status-warning-white" : { "name" : "status-warning-white", "rule" : ".status-warning-white", "hash" : "62ff8f6bf696e58f71eb4e1c6fe9b2e1" } }, "scales" : [ 1, 2 ], "header" : "\/**\n * @provides sprite-status-css\n * @generated\n *\/\n\n.sprite-status {\n background-image: url(\/rsrc\/image\/sprite-status.png);\n background-repeat: no-repeat;\n}\n\n@media\nonly screen and (min-device-pixel-ratio: 1.5),\nonly screen and (-webkit-min-device-pixel-ratio: 1.5) {\n .sprite-status {\n background-image: url(\/rsrc\/image\/sprite-status-X2.png);\n background-size: {X}px {Y}px;\n }\n}\n", "type" : "standard" } diff --git a/src/infrastructure/celerity/CeleritySpriteGenerator.php b/src/infrastructure/celerity/CeleritySpriteGenerator.php index 42e33c9ca6..7be0270072 100644 --- a/src/infrastructure/celerity/CeleritySpriteGenerator.php +++ b/src/infrastructure/celerity/CeleritySpriteGenerator.php @@ -1,865 +1,860 @@ getDirectoryList('icons_1x'); $colors = array( '', 'grey', 'white', ); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(14, 14); $sprites = array(); foreach ($colors as $color) { foreach ($icons as $icon) { $prefix = 'icons_'; if (strlen($color)) { $prefix .= $color.'_'; } $suffix = ''; if (strlen($color)) { $suffix = '-'.$color; } $sprite = id(clone $template) ->setName('icons-'.$icon.$suffix); $tcss = array(); $tcss[] = '.icons-'.$icon.$suffix; if ($color == 'white') { $tcss[] = '.device-desktop .phabricator-action-view:hover '. '.icons-'.$icon; $tcss[] = '.device-desktop .phui-list-sidenav '. '.phui-list-item-href:hover .icons-'.$icon; } $sprite->setTargetCSS(implode(', ', $tcss)); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } } $remarkup_icons = $this->getDirectoryList('remarkup_1x'); foreach ($remarkup_icons as $icon) { $prefix = 'remarkup_'; // Strip 'text_' from these file names. $class_name = substr($icon, 5); if ($class_name == 'fullscreen_off') { $tcss = '.remarkup-control-fullscreen-mode .remarkup-assist-fullscreen'; } else { $tcss = '.remarkup-assist-'.$class_name; } $sprite = id(clone $template) ->setName('remarkup-assist-'.$icon) ->setTargetCSS($tcss); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('icons', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildActionsSheet() { $icons = $this->getDirectoryList('actions_white_1x'); $colors = array( 'dark', 'grey', 'white', ); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(24, 24); $sprites = array(); foreach ($colors as $color) { foreach ($icons as $icon) { $prefix = 'actions_'; if (strlen($color)) { $prefix .= $color.'_'; } $suffix = ''; if (strlen($color)) { $suffix = '-'.$color; } $sprite = id(clone $template) ->setName('actions-'.$icon.$suffix); $tcss = array(); $tcss[] = '.actions-'.$icon.$suffix; if ($color == 'dark') { $tcss[] = '.device-desktop '. '.actions-'.$icon.'-grey.phui-icon-view:hover'; } $sprite->setTargetCSS(implode(', ', $tcss)); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } } $sheet = $this->buildSheet('actions', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildMiniconsSheet() { $icons = $this->getDirectoryList('minicons_white_1x'); $colors = array( 'white', 'dark', ); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(16, 16); $sprites = array(); foreach ($colors as $color) { foreach ($icons as $icon) { $prefix = 'minicons_'; if (strlen($color)) { $prefix .= $color.'_'; } $suffix = ''; if (strlen($color)) { $suffix = '-'.$color; } $sprite = id(clone $template) ->setName('minicons-'.$icon.$suffix); $sprite->setTargetCSS('.minicons-'.$icon.$suffix); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } } $sheet = $this->buildSheet('minicons', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildMenuSheet() { $sprites = array(); $sources = array( 'seen_read_all' => array( 'x' => 18, 'y' => 18, 'css' => '.alert-notifications .phabricator-main-menu-alert-icon', ), 'seen_have_unread' => array( 'x' => 18, 'y' => 18, 'css' => '.alert-notifications:hover .phabricator-main-menu-alert-icon', ), 'unseen_any' => array( 'x' => 18, 'y' => 18, 'css' => '.alert-notifications.alert-unread .phabricator-main-menu-alert-icon', ), 'arrow-right' => array( 'x' => 9, 'y' => 31, 'css' => '.phabricator-crumb-divider', ), 'search' => array( 'x' => 24, 'y' => 24, 'css' => '.menu-icon-search', ), 'search_blue' => array( 'x' => 24, 'y' => 24, 'css' => '.menu-icon-search-blue', ), 'new' => array( 'x' => 24, 'y' => 24, 'css' => '.menu-icon-new', ), 'new_blue' => array( 'x' => 24, 'y' => 24, 'css' => '.menu-icon-new-blue', ), 'app' => array( 'x' => 24, 'y' => 24, 'css' => '.menu-icon-app', ), 'app_blue' => array( 'x' => 24, 'y' => 24, 'css' => '.menu-icon-app-blue', ), 'logo' => array( 'x' => 149, 'y' => 26, 'css' => '.phabricator-main-menu-logo-image', ), 'conf-off' => array( 'x' => 18, 'y' => 18, 'css' => '.alert-notifications .phabricator-main-menu-message-icon', ), 'conf-hover' => array( 'x' => 18, 'y' => 18, 'css' => '.alert-notifications:hover .phabricator-main-menu-message-icon', ), 'conf-unseen' => array( 'x' => 18, 'y' => 18, 'css' => '.alert-notifications.message-unread '. '.phabricator-main-menu-message-icon', ), ); $scales = array( '1x' => 1, '2x' => 2, ); $template = new PhutilSprite(); foreach ($sources as $name => $spec) { $sprite = id(clone $template) ->setName($name) ->setSourceSize($spec['x'], $spec['y']) ->setTargetCSS($spec['css']); foreach ($scales as $scale_name => $scale) { $path = 'menu_'.$scale_name.'/'.$name.'.png'; $path = $this->getPath($path); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('menu', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildTokenSheet() { $icons = $this->getDirectoryList('tokens_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(16, 16); $sprites = array(); $prefix = 'tokens_'; foreach ($icons as $icon) { $sprite = id(clone $template) ->setName('tokens-'.$icon) ->setTargetCSS('.tokens-'.$icon); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('tokens', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildButtonBarSheet() { $icons = $this->getDirectoryList('button_bar_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(14, 14); $sprites = array(); $prefix = 'button_bar_'; foreach ($icons as $icon) { $sprite = id(clone $template) ->setName('buttonbar-'.$icon) ->setTargetCSS('.buttonbar-'.$icon); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('buttonbar', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildProjectsSheet() { $icons = $this->getDirectoryList('projects_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(50, 50); $sprites = array(); $prefix = 'projects-'; foreach ($icons as $icon) { $sprite = id(clone $template) ->setName($prefix.$icon) ->setTargetCSS('.'.$prefix.$icon); foreach ($scales as $scale_key => $scale) { $path = $this->getPath('projects_'.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('projects', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildPaymentsSheet() { $icons = $this->getDirectoryList('payments_2x'); $scales = array( '2x' => 1, ); $template = id(new PhutilSprite()) ->setSourceSize(60, 32); $sprites = array(); $prefix = 'payments_'; foreach ($icons as $icon) { $sprite = id(clone $template) ->setName('payments-'.$icon) ->setTargetCSS('.payments-'.$icon); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('payments', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildConpherenceSheet() { $name = 'conpherence'; $icons = $this->getDirectoryList($name.'_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(32, 32); $sprites = array(); foreach ($icons as $icon) { $color = preg_match('/_on/', $icon) ? 'on' : 'off'; $prefix = $name.'_'; $sprite = id(clone $template) ->setName($prefix.$icon); $tcss = array(); $tcss[] = '.'.$prefix.$icon; if ($color == 'on') { $class = str_replace('_on', '_off', $prefix.$icon); $tcss[] = '.device-desktop .'.$class.':hover '; } $sprite->setTargetCSS(implode(', ', $tcss)); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet($name, true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildDocsSheet() { $icons = $this->getDirectoryList('docs_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(32, 32); $sprites = array(); $prefix = 'docs_'; foreach ($icons as $icon) { $sprite = id(clone $template) ->setName($prefix.$icon) ->setTargetCSS('.'.$prefix.$icon); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('docs', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildLoginSheet() { $icons = $this->getDirectoryList('login_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(34, 34); $sprites = array(); $prefix = 'login_'; foreach ($icons as $icon) { $sprite = id(clone $template) ->setName('login-'.$icon) ->setTargetCSS('.login-'.$icon); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('login', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildStatusSheet() { $icons = $this->getDirectoryList('status_1x'); $scales = array( '1x' => 1, '2x' => 2, ); $template = id(new PhutilSprite()) ->setSourceSize(14, 14); $sprites = array(); $prefix = 'status_'; + + $pre_rule = ', .phuix-dropdown-menu .phabricator-action-view:hover '; $extra_css = array( - 'policy-custom-white' => - ', .dropdown-menu-item:hover .status-policy-custom', - 'policy-all-white' => - ', .dropdown-menu-item:hover .status-policy-all', - 'policy-unknown-white' => - ', .dropdown-menu-item:hover .status-policy-unknown', - 'policy-admin-white' => - ', .dropdown-menu-item:hover .status-policy-admin', - 'policy-public-white' => - ', .dropdown-menu-item:hover .status-policy-public', - 'policy-project-white' => - ', .dropdown-menu-item:hover .status-policy-project', - 'policy-noone-white' => - ', .dropdown-menu-item:hover .status-policy-noone', + 'policy-custom-white' => $pre_rule.'.status-policy-custom', + 'policy-all-white' => $pre_rule.'.status-policy-all', + 'policy-unknown-white' => $pre_rule.'.status-policy-unknown', + 'policy-admin-white' => $pre_rule.'.status-policy-admin', + 'policy-public-white' => $pre_rule.'.status-policy-public', + 'policy-project-white' => $pre_rule.'.status-policy-project', + 'policy-noone-white' => $pre_rule.'.status-policy-noone', ); foreach ($icons as $icon) { $sprite = id(clone $template) ->setName('status-'.$icon) ->setTargetCSS('.status-'.$icon.idx($extra_css, $icon)); foreach ($scales as $scale_key => $scale) { $path = $this->getPath($prefix.$scale_key.'/'.$icon.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } $sheet = $this->buildSheet('status', true); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildGradientSheet() { $gradients = $this->getDirectoryList('gradients'); $template = new PhutilSprite(); $unusual_heights = array( 'dark-menu-label' => 25, 'breadcrumbs' => 31, 'menu-label' => 24, 'red-header' => 70, 'blue-header' => 70, 'green-header' => 70, 'yellow-header' => 70, 'grey-header' => 70, 'dark-grey-header' => 70, 'lightblue-header' => 240, ); $extra_css = array( 'dark-menu-label' => ', .phabricator-dark-menu .phui-list-item-type-label', 'menu-label' => ', .phabricator-side-menu .phui-list-item-type-label', ); $sprites = array(); foreach ($gradients as $gradient) { $path = $this->getPath('gradients/'.$gradient.'.png'); $sprite = id(clone $template) ->setName('gradient-'.$gradient) ->setSourceFile($path) ->setTargetCSS('.gradient-'.$gradient.idx($extra_css, $gradient)); $sprite->setSourceSize(4, idx($unusual_heights, $gradient, 26)); $sprites[] = $sprite; } $sheet = $this->buildSheet( 'gradient', false, PhutilSpriteSheet::TYPE_REPEAT_X, ', .phabricator-dark-menu .phui-list-item-type-label, '. '.phabricator-side-menu .phui-list-item-type-label'); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildMainHeaderSheet() { $gradients = $this->getDirectoryList('main_header'); $template = new PhutilSprite(); $sprites = array(); foreach ($gradients as $gradient) { $path = $this->getPath('main_header/'.$gradient.'.png'); $sprite = id(clone $template) ->setName('main-header-'.$gradient) ->setSourceFile($path) ->setTargetCSS('.main-header-'.$gradient); $sprite->setSourceSize(6, 44); $sprites[] = $sprite; } $sheet = $this->buildSheet('main-header', false, PhutilSpriteSheet::TYPE_REPEAT_X); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } public function buildAppsSheet() { return $this->buildAppsSheetVariant(1); } public function buildAppsLargeSheet() { return $this->buildAppsSheetVariant(2); } public function buildAppsXLargeSheet() { return $this->buildAppsSheetVariant(3); } private function buildAppsSheetVariant($variant) { if ($variant == 1) { $scales = array( '1x' => 1, '2x' => 2, ); $variant_name = 'apps'; $variant_short = ''; $size_x = 14; $size_y = 14; $colors = array( 'dark' => 'dark', 'white' => 'white', ); } else if ($variant == 2) { $scales = array( '2x' => 1, '4x' => 2, ); $variant_name = 'apps-large'; $variant_short = '-large'; $size_x = 28; $size_y = 28; $colors = array( 'light' => 'lb', 'dark' => 'dark', 'blue' => 'blue', 'white' => 'white', ); } else { $scales = array( '4x' => 1, ); $variant_name = 'apps-xlarge'; $variant_short = '-xlarge'; $size_x = 56; $size_y = 56; $colors = array( 'dark' => 'dark', /* TODO: These are available but not currently used. 'blue' => 'blue', 'light' => 'lb', */ ); } $apps = $this->getDirectoryList('apps_dark_1x'); $template = id(new PhutilSprite()) ->setSourceSize($size_x, $size_y); $sprites = array(); foreach ($apps as $app) { foreach ($colors as $color => $color_path) { $css = '.apps-'.$app.'-'.$color.$variant_short; if ($color == 'blue' && $variant_name == 'apps-large') { $css .= ', .phabricator-crumb-view:hover .apps-'.$app.'-dark-large'; } if ($color == 'white' && $variant == 1) { $css .= ', .phui-list-item-href:hover .apps-'.$app.'-dark'; } $sprite = id(clone $template) ->setName('apps-'.$app.'-'.$color.$variant_short) ->setTargetCSS($css); foreach ($scales as $scale_name => $scale) { $path = $this->getPath( 'apps_'.$color_path.'_'.$scale_name.'/'.$app.'.png'); $sprite->setSourceFile($path, $scale); } $sprites[] = $sprite; } } $sheet = $this->buildSheet($variant_name, count($scales) > 1); $sheet->setScales($scales); foreach ($sprites as $sprite) { $sheet->addSprite($sprite); } return $sheet; } private function getPath($to_path = null) { $root = dirname(phutil_get_library_root('phabricator')); return $root.'/resources/sprite/'.$to_path; } private function getDirectoryList($dir) { $path = $this->getPath($dir); $result = array(); $images = Filesystem::listDirectory($path, $include_hidden = false); foreach ($images as $image) { if (!preg_match('/\.png$/', $image)) { throw new Exception( "Expected file '{$image}' in '{$path}' to be a sprite source ". "ending in '.png'."); } $result[] = substr($image, 0, -4); } return $result; } private function buildSheet( $name, $has_retina, $type = null, $extra_css = '') { $sheet = new PhutilSpriteSheet(); $at = '@'; switch ($type) { case PhutilSpriteSheet::TYPE_STANDARD: default: $type = PhutilSpriteSheet::TYPE_STANDARD; $repeat_rule = 'no-repeat'; break; case PhutilSpriteSheet::TYPE_REPEAT_X: $repeat_rule = 'repeat-x'; break; case PhutilSpriteSheet::TYPE_REPEAT_Y: $repeat_rule = 'repeat-y'; break; } $retina_rules = null; if ($has_retina) { $retina_rules = <<setSheetType($type); $sheet->setCSSHeader(<<