├── .gitattributes ├── .gitignore ├── .gitlab-ci.yml ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── gifs ├── autohider.gif └── autohiderleft.gif ├── lib ├── config.js └── minimap-autohider.js ├── package-lock.json ├── package.json ├── spec └── minimap-autohider-spec.js └── styles ├── custom.less ├── default.less └── minimap-autohider.less /.gitattributes: -------------------------------------------------------------------------------- 1 | package-lock.json -diff 2 | * text=auto !eol 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | image: node:10 2 | 3 | before_script: 4 | - npm i 5 | 6 | cache: 7 | paths: 8 | - node_modules/ 9 | 10 | publish: 11 | stage: deploy 12 | only: 13 | - tags 14 | - triggers 15 | script: 16 | - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc 17 | - npm publish 18 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.5.4 - Clean up styling/less variable logic (@cbarrick) and basic unit tests 4 | 5 | **Patch** 6 | 7 | - removed unit tests, config and setTimeout makes them ahrd to deal with 8 | - maybe later 9 | - visible percentage is now handled by changing a less variable 10 | - makes for cleaner code 11 | - matches other config option logic 12 | - `.scrolling` is no longer used 13 | - changing visible percentage now requires reload, same as transition duration 14 | 15 | ## 1.5.3 - last change was a hardcore typo 16 | 17 | **Minor** 18 | 19 | - element !== editor, oops 20 | 21 | ## 1.5.2 - editor.editorElement -> editor.element 22 | 23 | **Minor** 24 | 25 | - editorElement is private, and being removed in the future 26 | - switch to element, which is public and references the same thing 27 | 28 | ## 1.5.1 - forgot to check the ShowOnHover, changed it to a dropdown 29 | 30 | **Minor** 31 | 32 | - check HiddenPercentage instead of the ShowOnHover config 33 | - remove unused clickHandler method 34 | - switch observers to `onDidChange` so old value can be used 35 | 36 | ## 1.5.0 - Deprecate `.scrolling` class, replace yarn with npm@5, add event options 37 | 38 | **Major** 39 | 40 | - Deprecate `.scrolling` class 41 | - can still be used, but I'm now using `.autovisible` in the package itself 42 | - add an option to disable visibility on scroll 43 | - add an option for showing the minimap on hover 44 | - add an option for showing the minimap on click 45 | 46 | **Minor** 47 | 48 | - replace yarn with npm@5, because I'm a hipster 49 | 50 | ## 1.4.0 - Add error handling for writeFile for Node v7 51 | 52 | **Major** 53 | 54 | - Add callback to writeFile for saving settings to `.less` 55 | - Fire off `atom.notifications.addWarning` if writeFile fails 56 | 57 | **Minor** 58 | 59 | - none 60 | 61 | ## 1.3.3 - Fix TransitionDuration Bug 62 | 63 | **Minor** 64 | 65 | - reenable transition duration 66 | - add disclaimer that it requires a reload 67 | - add a `default.less` file in case `custom.less` is being written as it's read 68 | 69 | ## 1.3.2 - Patch TransitionDuration Bug 70 | 71 | **Minor** 72 | 73 | - remove TransitionDuration setting until I can actually fix it 74 | - Broke windows in 1.14.4 75 | 76 | ## 1.3.1 - Configurable Transitions 77 | 78 | **Minor** 79 | 80 | - reformat Changelog (so meta) 81 | - reformat Readme 82 | - new gifs 83 | 84 | ## 1.3.0 - Configurable Transitions 85 | 86 | **Major** 87 | 88 | - added a config option for transition duration 89 | - had to add file writing logic since less can't see config 90 | - added custom.less (autogenerated) 91 | - update spec to use config transition duration 92 | 93 | ## 1.2.0 - The Performance-ening 94 | 95 | **Major** 96 | 97 | - transition now works on transform, not left, for silky smooth frames 98 | - updated readme 99 | - added delay to opacity spec 100 | 101 | **Minor** 102 | 103 | - added support for left-aligned minimaps (previously broken) 104 | 105 | ## 1.1.0 - Renamed 106 | 107 | **Major** 108 | 109 | - this is really a breaking change, but I'm a rebel 110 | - renamed to `minimap-autohider` instead of keeping the name or adding `-2` 111 | 112 | **Minor** 113 | 114 | - removed an inconsistent spec 115 | 116 | ## 1.0.0 - Fork! 117 | 118 | **Breaking** 119 | 120 | - Convert to vanilla node4-compliant javascript 121 | - remove `::shadow` selector (deprecated in Atom 1.13) 122 | - fix refererence to `editor.editorElement.onDidChangeScrollTop` (deprecated in Atom 1.13) 123 | 124 | **Major** 125 | 126 | - add settings config, currently just for custom delay before hiding 127 | - added working specs 128 | 129 | ## 0.10.1 130 | 131 | **Major** 132 | 133 | - merge ncreep’s hover class change to keep the minimap open on hover 134 | 135 | ## 0.9.0 - First Release 136 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Jay Kuri 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # minimap-autohider 2 | 3 | ## Hide your minimap until you need it. 4 | 5 | _Forked from [jayk/minimap-autohide](https://github.com/jayk/minimap-autohide)_ 6 | 7 | When editing normally, you have the entire window for your editor. As soon as you begin to scroll, the minimap appears and you can interact with it normally. 8 | 9 | ![Default Autohide Behavior](https://raw.githubusercontent.com/ansballard/minimap-autohider/master/gifs/autohider.gif) 10 | 11 | By default, the minimap will be hidden when not scrolling, and will slide out when scrolling. The minimap will slide in for 100ms, stay until you have not scrolled for 1500ms, and slide out for 100ms. The above times can be customized in the settings page for this package. For example, you could slow down the time to slide in to 500ms, and slide back out after 1000ms. You can also move the minimap to the left via `minimap`'s settings, which was not supported in the original package. 12 | 13 | ![Modified Autohider Behavior](https://raw.githubusercontent.com/ansballard/minimap-autohider/master/gifs/autohiderleft.gif) 14 | 15 | This forked version also transforms the position of the minimap based on translateX rather than left. This should mean much smoother transitions, and a little less work atom has to do via repaints. 16 | 17 | Originally written by @JayKuri, forked and updated by @ansballard. If you like it, say Hi! 18 | -------------------------------------------------------------------------------- /gifs/autohider.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansballard/minimap-autohider/eddeedaee850ad55570a7606d9b1665d2310de5a/gifs/autohider.gif -------------------------------------------------------------------------------- /gifs/autohiderleft.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ansballard/minimap-autohider/eddeedaee850ad55570a7606d9b1665d2310de5a/gifs/autohiderleft.gif -------------------------------------------------------------------------------- /lib/config.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | module.exports = { 3 | TimeToHide: { 4 | description: 5 | "Number of milliseconds to wait after a visibilty event to hide minimap", 6 | type: "integer", 7 | default: 1500, 8 | minimum: 1, 9 | }, 10 | TransitionDuration: { 11 | description: 12 | "Number of milliseconds to it takes for minimap to activate (requires reload)", 13 | type: "integer", 14 | default: 100, 15 | minimum: 1, 16 | }, 17 | ShowOnScroll: { 18 | description: "Show the minimap on scroll", 19 | type: "boolean", 20 | default: true, 21 | }, 22 | ShowOnClick: { 23 | description: "Show the minimap on click", 24 | type: "boolean", 25 | default: false, 26 | }, 27 | VisiblePercentage: { 28 | description: 29 | "Percent of the minimap to show when inactive (requires reload)", 30 | type: "integer", 31 | default: 0, 32 | enum: [0, 25, 50, 75, 100], 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /lib/minimap-autohider.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | const { CompositeDisposable } = require("atom"); 3 | const { writeFile } = require("fs"); 4 | const { join } = require("path"); 5 | 6 | const config = require("./config"); 7 | 8 | module.exports = { 9 | config, 10 | active: false, 11 | depActivation: require("atom-package-deps").install("minimap-autohider"), 12 | 13 | isActive() { 14 | return this.active; 15 | }, 16 | 17 | activate() { 18 | return this.depActivation.then(() => { 19 | atom.config.onDidChange( 20 | "minimap-autohider.TransitionDuration", 21 | updateStyleVars 22 | ); 23 | atom.config.onDidChange( 24 | "minimap-autohider.VisiblePercentage", 25 | updateStyleVars 26 | ); 27 | return (this.subscriptions = new CompositeDisposable()); 28 | }); 29 | }, 30 | 31 | consumeMinimapServiceV1(minimap) { 32 | this.minimap = minimap; 33 | return this.minimap.registerPlugin("minimap-autohider", this); 34 | }, 35 | 36 | deactivate() { 37 | this.minimap.unregisterPlugin("minimap-autohider"); 38 | return (this.minimap = null); 39 | }, 40 | 41 | activatePlugin() { 42 | if (this.active) { 43 | return; 44 | } 45 | this.active = true; 46 | return this.depActivation.then(() => { 47 | const minimapsSubscription = this.minimap.observeMinimaps((minimap) => { 48 | let editor, minimapElement; 49 | minimapElement = atom.views.getView(minimap); 50 | editor = minimap.getTextEditor(); 51 | editor.element.addEventListener("mouseup", () => 52 | this.handleAutohide({ 53 | minimapElement, 54 | type: "ShowOnClick", 55 | }) 56 | ); 57 | return ( 58 | this.subscriptions && 59 | this.subscriptions.add( 60 | editor.element.onDidChangeScrollTop(() => 61 | this.handleAutohide({ 62 | minimapElement, 63 | type: "ShowOnScroll", 64 | }) 65 | ) 66 | ) 67 | ); 68 | }); 69 | this.minimapsSubscription = minimapsSubscription; 70 | }); 71 | }, 72 | 73 | handleAutohide({ minimapElement, type }) { 74 | if (!atom.config.get("minimap-autohider")[type]) { 75 | return; 76 | } 77 | if (minimapElement.timer) { 78 | clearTimeout(minimapElement.timer); 79 | } else { 80 | minimapElement.classList.add("autovisible"); 81 | } 82 | minimapElement.timer = setTimeout(() => { 83 | minimapElement.classList.remove("autovisible"); 84 | minimapElement.timer = undefined; 85 | }, atom.config.get("minimap-autohider").TimeToHide); 86 | }, 87 | 88 | deactivatePlugin() { 89 | if (!this.active) { 90 | return; 91 | } 92 | this.active = false; 93 | this.minimapsSubscription.dispose(); 94 | return this.subscriptions.dispose(); 95 | }, 96 | }; 97 | 98 | function updateStyleVars() { 99 | const conf = atom.config.get("minimap-autohider"); 100 | const style = 101 | "// AUTOGENERATED\n" + 102 | `@TransitionDuration: ${conf.TransitionDuration / 1000}s;\n` + 103 | `@VisiblePercentage: ${conf.VisiblePercentage}%;\n`; 104 | writeFile( 105 | join(__dirname, "..", "styles", "custom.less"), 106 | style, 107 | "utf8", 108 | (err) => { 109 | if (err) { 110 | atom.notifications.addWarning("Warning from minimap-autohider", { 111 | dismissable: true, 112 | description: 113 | "minimap-autohider failed to write your settings to a file. Transition Duration will reset to 100ms.", 114 | detail: `error message from writeFile: ${err.message}`, 115 | }); 116 | } 117 | } 118 | ); 119 | } 120 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "minimap-autohider", 3 | "version": "1.7.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "atom-package-deps": { 8 | "version": "7.0.2", 9 | "resolved": "https://registry.npmjs.org/atom-package-deps/-/atom-package-deps-7.0.2.tgz", 10 | "integrity": "sha512-Z0JS0pUZiq+f3BFCj3lErQo8DdJEQmt4syVCBakidUxIl3mBee4uSX7MBMzhupMkjInEyKTTEIy4EaIDj4842Q==" 11 | }, 12 | "buffer-from": { 13 | "version": "1.1.1", 14 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 15 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", 16 | "dev": true 17 | }, 18 | "concat-stream": { 19 | "version": "1.6.2", 20 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", 21 | "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", 22 | "dev": true, 23 | "requires": { 24 | "buffer-from": "^1.0.0", 25 | "inherits": "^2.0.3", 26 | "readable-stream": "^2.2.2", 27 | "typedarray": "^0.0.6" 28 | } 29 | }, 30 | "core-util-is": { 31 | "version": "1.0.2", 32 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 33 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 34 | "dev": true 35 | }, 36 | "cross-spawn": { 37 | "version": "5.1.0", 38 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", 39 | "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", 40 | "dev": true, 41 | "requires": { 42 | "lru-cache": "^4.0.1", 43 | "shebang-command": "^1.2.0", 44 | "which": "^1.2.9" 45 | } 46 | }, 47 | "inherits": { 48 | "version": "2.0.4", 49 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 50 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 51 | "dev": true 52 | }, 53 | "isarray": { 54 | "version": "1.0.0", 55 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 56 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 57 | "dev": true 58 | }, 59 | "isexe": { 60 | "version": "2.0.0", 61 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 62 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", 63 | "dev": true 64 | }, 65 | "lru-cache": { 66 | "version": "4.1.5", 67 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", 68 | "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", 69 | "dev": true, 70 | "requires": { 71 | "pseudomap": "^1.0.2", 72 | "yallist": "^2.1.2" 73 | } 74 | }, 75 | "os-shim": { 76 | "version": "0.1.3", 77 | "resolved": "https://registry.npmjs.org/os-shim/-/os-shim-0.1.3.tgz", 78 | "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", 79 | "dev": true 80 | }, 81 | "pre-commit": { 82 | "version": "1.2.2", 83 | "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.2.2.tgz", 84 | "integrity": "sha1-287g7p3nI15X95xW186UZBpp7sY=", 85 | "dev": true, 86 | "requires": { 87 | "cross-spawn": "^5.0.1", 88 | "spawn-sync": "^1.0.15", 89 | "which": "1.2.x" 90 | } 91 | }, 92 | "prettier": { 93 | "version": "2.2.1", 94 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", 95 | "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", 96 | "dev": true 97 | }, 98 | "process-nextick-args": { 99 | "version": "2.0.1", 100 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 101 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", 102 | "dev": true 103 | }, 104 | "pseudomap": { 105 | "version": "1.0.2", 106 | "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", 107 | "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", 108 | "dev": true 109 | }, 110 | "readable-stream": { 111 | "version": "2.3.7", 112 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 113 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 114 | "dev": true, 115 | "requires": { 116 | "core-util-is": "~1.0.0", 117 | "inherits": "~2.0.3", 118 | "isarray": "~1.0.0", 119 | "process-nextick-args": "~2.0.0", 120 | "safe-buffer": "~5.1.1", 121 | "string_decoder": "~1.1.1", 122 | "util-deprecate": "~1.0.1" 123 | } 124 | }, 125 | "safe-buffer": { 126 | "version": "5.1.2", 127 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 128 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 129 | "dev": true 130 | }, 131 | "shebang-command": { 132 | "version": "1.2.0", 133 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 134 | "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 135 | "dev": true, 136 | "requires": { 137 | "shebang-regex": "^1.0.0" 138 | } 139 | }, 140 | "shebang-regex": { 141 | "version": "1.0.0", 142 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 143 | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", 144 | "dev": true 145 | }, 146 | "spawn-sync": { 147 | "version": "1.0.15", 148 | "resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-1.0.15.tgz", 149 | "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", 150 | "dev": true, 151 | "requires": { 152 | "concat-stream": "^1.4.7", 153 | "os-shim": "^0.1.2" 154 | } 155 | }, 156 | "string_decoder": { 157 | "version": "1.1.1", 158 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 159 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 160 | "dev": true, 161 | "requires": { 162 | "safe-buffer": "~5.1.0" 163 | } 164 | }, 165 | "typedarray": { 166 | "version": "0.0.6", 167 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 168 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", 169 | "dev": true 170 | }, 171 | "util-deprecate": { 172 | "version": "1.0.2", 173 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 174 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 175 | "dev": true 176 | }, 177 | "which": { 178 | "version": "1.2.14", 179 | "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", 180 | "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", 181 | "dev": true, 182 | "requires": { 183 | "isexe": "^2.0.0" 184 | } 185 | }, 186 | "yallist": { 187 | "version": "2.1.2", 188 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", 189 | "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", 190 | "dev": true 191 | } 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "minimap-autohider", 3 | "main": "lib/minimap-autohider.js", 4 | "version": "1.7.0", 5 | "description": "Automatically hide the minimap when you aren't using it.", 6 | "repository": "https://github.com/ansballard/minimap-autohider", 7 | "author": { 8 | "name": "Aaron Ballard (ansballard)", 9 | "email": "ans.ballard@gmail.com" 10 | }, 11 | "scripts": { 12 | "prettier": "prettier --write \"{lib,spec,styles}/*.{js,less}\"", 13 | "gitadd": "git add lib styles spec" 14 | }, 15 | "precommit": [ 16 | "prettier", 17 | "gitadd" 18 | ], 19 | "activationHooks": [ 20 | "core:loaded-shell-environment" 21 | ], 22 | "package-deps": [ 23 | { 24 | "name": "minimap" 25 | } 26 | ], 27 | "contributors": [ 28 | { 29 | "name": "Jay Kuri (jayk)" 30 | }, 31 | { 32 | "name": "Aaron Ballard (ansballard)", 33 | "email": "ans.ballard@gmail.com" 34 | } 35 | ], 36 | "license": "MIT", 37 | "engines": { 38 | "atom": ">=1.13.0" 39 | }, 40 | "consumedServices": { 41 | "minimap": { 42 | "versions": { 43 | "1.0.0": "consumeMinimapServiceV1" 44 | } 45 | } 46 | }, 47 | "devDependencies": { 48 | "pre-commit": "^1.2.2", 49 | "prettier": "^2.2.1" 50 | }, 51 | "dependencies": { 52 | "atom-package-deps": "^7.0.2" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /spec/minimap-autohider-spec.js: -------------------------------------------------------------------------------- 1 | // require("../lib/minimap-autohider.js"); 2 | // 3 | // const TimeToHide = 300; 4 | // const TransitionDuration = 300; 5 | // const VisiblePercentage = 0; 6 | // const ShowOnScroll = true; 7 | 8 | describe("minimap-autohider", () => { 9 | // let [editor, editorElement, workspaceElement] = []; 10 | // beforeEach(() => { 11 | // workspaceElement = atom.views.getView(atom.workspace); 12 | // jasmine.attachToDOM(workspaceElement); 13 | // 14 | // atom.config.set("minimap-autohider.TimeToHide", TimeToHide); 15 | // atom.config.set("minimap-autohider.TransitionDuration", TransitionDuration); 16 | // atom.config.set("minimap-autohider.VisiblePercentage", VisiblePercentage); 17 | // atom.config.set("minimap-autohider.ShowOnScroll", ShowOnScroll); 18 | // 19 | // waitsForPromise(() => atom.workspace.open()); 20 | // waitsForPromise(() => atom.packages.activatePackage("minimap")); 21 | // waitsForPromise(() => atom.packages.activatePackage("minimap-autohider")); 22 | // waitsFor(() => workspaceElement.querySelector("atom-text-editor")); 23 | // runs(() => { 24 | // editor = atom.workspace.getActiveTextEditor(); 25 | // editorElement = atom.views.getView(editor); 26 | // for (let i = 0; i < 20; i++) { 27 | // editor.insertText("Hello World!\n"); 28 | // } 29 | // }); 30 | // waitsFor(() => 31 | // workspaceElement.querySelector( 32 | // "atom-text-editor atom-text-editor-minimap" 33 | // ) 34 | // ); 35 | // }); 36 | // 37 | // describe("with an open editor with minimap and autohider active", () => { 38 | // it("minimap is not visible after `atom.get('minimap-autohider').TimeToHide` milliseconds", () => { 39 | // let done = false; 40 | // jasmine.unspy(window, "setTimeout"); 41 | // setTimeout(() => { 42 | // done = true; 43 | // }, atom.config.get("minimap-autohider").TimeToHide + 100); 44 | // waitsFor(() => done); 45 | // runs(() => { 46 | // expect( 47 | // window.getComputedStyle( 48 | // editorElement.querySelector("atom-text-editor-minimap") 49 | // ).opacity 50 | // ).toBe("0.05"); 51 | // }); 52 | // }); 53 | // it("minimap should be visible after adding .autovisible", () => { 54 | // const opacity = () => 55 | // window.getComputedStyle( 56 | // editorElement.querySelector("atom-text-editor-minimap") 57 | // ).opacity; 58 | // let done = false; 59 | // jasmine.unspy(window, "setTimeout"); 60 | // expect(opacity()).toBe("1"); 61 | // setTimeout(() => { 62 | // expect(opacity()).toBe("0.05"); 63 | // editorElement 64 | // .querySelector("atom-text-editor-minimap") 65 | // .classList.add("autovisible"); 66 | // setTimeout(() => { 67 | // done = true; 68 | // }, atom.config.get("minimap-autohider").TransitionDuration + 100); 69 | // }, atom.config.get("minimap-autohider").TransitionDuration + 100); 70 | // waitsFor(() => done); 71 | // runs(() => { 72 | // expect(opacity()).toBe("1"); 73 | // }); 74 | // }); 75 | // }); 76 | }); 77 | -------------------------------------------------------------------------------- /styles/custom.less: -------------------------------------------------------------------------------- 1 | // AUTOGENERATED 2 | @TransitionDuration: 0.1s; 3 | @VisiblePercentage: 0%; 4 | -------------------------------------------------------------------------------- /styles/default.less: -------------------------------------------------------------------------------- 1 | @TransitionDuration: 0.1s; 2 | @VisiblePercentage: 0%; 3 | -------------------------------------------------------------------------------- /styles/minimap-autohider.less: -------------------------------------------------------------------------------- 1 | // The ui-variables file is provided by base themes provided by Atom. 2 | // 3 | 4 | // See https://github.com/atom/atom-dark-ui/blob/master/stylesheets/ui-variables.less 5 | // for a full listing of what's available. 6 | 7 | // @import "ui-variables"; // not currently used 8 | @import "./default"; 9 | @import "./custom"; 10 | 11 | atom-text-editor { 12 | atom-text-editor-minimap { 13 | background: rgba(0, 0, 0, 0.2); 14 | position: absolute; 15 | transition: transform @TransitionDuration, opacity @TransitionDuration * 2; 16 | 17 | // Opacity animation 18 | opacity: 0.05; 19 | &.autovisible, 20 | &:hover { 21 | opacity: 1; 22 | } 23 | 24 | // Right-side slide animation 25 | &:not(.left) { 26 | left: 100%; 27 | transform: translateX(-@VisiblePercentage); 28 | &.autovisible, 29 | &:hover { 30 | transform: translateX(-100%); 31 | } 32 | } 33 | 34 | // Left-side slide animation 35 | &.left { 36 | left: 0; 37 | transform: translateX(-100% + @VisiblePercentage); 38 | &.autovisible, 39 | &:hover { 40 | transform: translateX(0); 41 | } 42 | } 43 | } 44 | } 45 | --------------------------------------------------------------------------------