├── .babelrc ├── .editorconfig ├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── manifest.json ├── manifest_beta.json ├── manifest_prod.json ├── package-lock.json ├── package.json ├── secrets_default.json ├── src ├── App.css ├── App.js ├── Core.js ├── ui │ ├── Bulletproof.css │ ├── Element.js │ ├── FigmaUI.css │ ├── components │ │ ├── display │ │ │ ├── DisplayComponent.css │ │ │ └── DisplayComponent.js │ │ ├── select │ │ │ ├── SelectComponent.css │ │ │ └── SelectComponent.js │ │ └── toolbar │ │ │ ├── ToolbarComponent.css │ │ │ └── ToolbarComponent.js │ ├── icons │ │ ├── IconCheck.js │ │ └── IconShow.js │ └── views │ │ ├── form │ │ ├── FormView.css │ │ └── FormView.js │ │ └── preferences │ │ ├── PreferencesView.css │ │ └── PreferencesView.js └── utils │ ├── DisplayNetwork.js │ ├── Router.js │ └── Tracking.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env"], 3 | "plugins": [ 4 | "transform-custom-element-classes", 5 | "webpack-alias" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | # Unix-style newlines with a newline ending every file 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | charset = utf-8 9 | 10 | [*.{js, html, css}] 11 | indent_style = tab 12 | indent_size = 2 13 | 14 | [*.{yml, conf, json}] 15 | indent_style = space 16 | indent_size = 4 17 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ['https://paypal.me/basiclines'] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | .nova 4 | secrets.json 5 | node_modules/ 6 | dist/ 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ismael González 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Super Tidy 2 | *A Figma plugin to easily align, rename and reorder your frames based in their canvas position.* 3 | 4 | Super Tidy renames your frames and reorders them in the layers list by their position in the canvas. It also replicates the Figma Tidy feature so you can run it all at once: Rename, Reorder and Tidy. 5 | 6 | ## Tutorials & related articles 7 | * [How to use Figma Super Tidy](https://www.youtube.com/watch?v=i681_evMv2k) 8 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Super Tidy", 3 | "id": "731260060173130163", 4 | "api": "1.0.0", 5 | "ui": "dist/ui.html", 6 | "main": "dist/core.js", 7 | "menu": [ 8 | {"name": "Rename", "command": "rename"}, 9 | {"name": "Reorder", "command": "reorder"}, 10 | {"name": "Tidy", "command": "tidy"}, 11 | {"name": "Pager", "command": "pager"}, 12 | {"name": "Run all", "command": "all"}, 13 | {"separator": true}, 14 | {"name": "Run custom...", "command": "options"} 15 | ], 16 | "editorType": ["figma", "figjam"] 17 | } 18 | -------------------------------------------------------------------------------- /manifest_beta.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Super Tidy Beta", 3 | "id": "952126876347866723", 4 | "api": "1.0.0", 5 | "ui": "dist/ui.html", 6 | "main": "dist/core.js", 7 | "menu": [ 8 | {"name": "Rename", "command": "rename"}, 9 | {"name": "Reorder", "command": "reorder"}, 10 | {"name": "Tidy", "command": "tidy"}, 11 | {"name": "Run all", "command": "all"}, 12 | {"separator": true}, 13 | {"name": "Run custom...", "command": "options"} 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /manifest_prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Super Tidy", 3 | "id": "731260060173130163", 4 | "api": "1.0.0", 5 | "ui": "dist/ui.html", 6 | "main": "dist/core.js", 7 | "menu": [ 8 | {"name": "Rename", "command": "rename"}, 9 | {"name": "Reorder", "command": "reorder"}, 10 | {"name": "Tidy", "command": "tidy"}, 11 | {"name": "Run all", "command": "all"}, 12 | {"separator": true}, 13 | {"name": "Run custom...", "command": "options"} 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dev": "NODE_ENV=development npx webpack --mode=development --watch", 4 | "build": "NODE_ENV=production npx webpack --mode=production", 5 | "test": "echo \"Error: no test specified\" && exit 1" 6 | }, 7 | "devDependencies": { 8 | "babel-core": "^6.26.0", 9 | "babel-loader": "^7.1.2", 10 | "babel-plugin-transform-custom-element-classes": "^0.1.0", 11 | "babel-plugin-webpack-alias": "^2.1.2", 12 | "babel-preset-env": "^1.6.1", 13 | "css-loader": "^3.5.2", 14 | "html-webpack-inline-source-plugin": "0.0.10", 15 | "html-webpack-plugin": "^3.2.0", 16 | "style-loader": "^1.1.4", 17 | "url-loader": "^4.1.0", 18 | "webpack": "^4.42.1", 19 | "webpack-cli": "^3.3.11" 20 | }, 21 | "dependencies": { 22 | "@basiclines/leo": "^0.6.4", 23 | "ua-parser-js": "^0.7.24" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /secrets_default.json: -------------------------------------------------------------------------------- 1 | { 2 | "README": "DUPLICATE ME AS secrets.json", 3 | "AMPLITUDE_KEY": "" 4 | } 5 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family:'Inter'; 3 | font-style: normal; 4 | font-weight: 400; 5 | src: url("https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.7") format("woff2"), url("https://rsms.me/inter/font-files/Inter-Regular.woff?v=3.7") format("woff") 6 | } 7 | 8 | @font-face { 9 | font-family:'Inter'; 10 | font-style: normal; 11 | font-weight: 500; 12 | src: url("https://rsms.me/inter/font-files/Inter-Medium.woff2?v=3.7") format("woff2"), url("https://rsms.me/inter/font-files/Inter-Medium.woff2?v=3.7") format("woff") 13 | } 14 | 15 | @font-face { 16 | font-family: 'Inter'; 17 | font-style: normal; 18 | font-weight: 600; 19 | src: url("https://rsms.me/inter/font-files/Inter-SemiBold.woff2?v=3.7") format("woff2"), url("https://rsms.me/inter/font-files/Inter-SemiBold.woff2?v=3.7") format("woff") 20 | } 21 | 22 | :root { 23 | --type-small-normal: 400 11px/16px "Inter", sans-serif; 24 | --type-small-medium: 500 11px/16px "Inter", sans-serif; 25 | --type-small-bold: 600 11px/16px "Inter", sans-serif; 26 | --type-medium-normal: 400 12px/16px "Inter", sans-serif; 27 | --type-medium-medium: 500 12px/16px "Inter", sans-serif; 28 | --type-medium-bold: 600 12px/16px "Inter", sans-serif; 29 | --type-large-normal: 400 13px/24px "Inter", sans-serif; 30 | --type-large-medium: 500 13px/24px "Inter", sans-serif; 31 | --type-large-bold: 600 13px/24px "Inter", sans-serif; 32 | --type-xlarge-normal: 400 14px/24px "Inter", sans-serif; 33 | --type-xlarge-medium: 500 14px/24px "Inter", sans-serif; 34 | --type-xlarge-bold: 600 14px/24px "Inter", sans-serif; 35 | 36 | --color-interactive-positive: #18A0FB; 37 | --color-interactive-negative: #E41761; 38 | --color-text-primary: #03121C; 39 | --color-text-secondary: #64646C; 40 | --color-text-tertiary: #AAAAB2; 41 | --color-background-primary: #FFFFFF; 42 | --color-decorator-strong: #C5CED2; 43 | --color-decorator-regular: #D5DDE2; 44 | --color-decorator-soft: #F1F4F4; 45 | 46 | --color-separator: rgba(0, 0, 0, 0.12); 47 | } 48 | 49 | body { text-align: left; overflow: hidden; } 50 | root-ui { transition: opacity 0.05s linear; display: block; position: relative; height: 539px; } 51 | root-ui[notready] { opacity: 0; pointer-events: none; } 52 | 53 | .c-icon { 54 | display: inline-flex; 55 | align-items: center; 56 | justify-content: center; 57 | vertical-align: middle; 58 | width: 16px; 59 | height: 16px; 60 | pointer-events: none; 61 | } 62 | .c-icon img { width: 100%; height: 100%; } 63 | 64 | .view { 65 | display: block; 66 | position: absolute; 67 | top: 40px; 68 | left: 0; 69 | right: 0; 70 | bottom: 0; 71 | overflow-y: auto; 72 | } 73 | 74 | .switch .switch__container { flex-shrink: 0; align-self: flex-start; margin-top: 4px; } 75 | .switch__label p { color: var(--color-text-secondary); } 76 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import 'src/ui/Bulletproof.css' 2 | import 'src/App.css' 3 | import 'src/ui/FigmaUI.css' 4 | 5 | import Tracking from 'src/utils/Tracking' 6 | import Router from 'src/utils/Router' 7 | import Element from 'src/ui/Element' 8 | 9 | import 'src/ui/components/toolbar/ToolbarComponent' 10 | import 'src/ui/views/form/FormView' 11 | import 'src/ui/views/preferences/PreferencesView' 12 | import 'src/ui/components/display/DisplayComponent' 13 | 14 | 15 | class ui extends Element { 16 | 17 | beforeMount() { 18 | window.addEventListener('message', e => { 19 | let msg = event.data.pluginMessage 20 | if (msg.type == 'init-hidden' || msg.type == 'init') { 21 | this.data.preferences = msg.preferences 22 | Tracking.setup(WP_AMPLITUDE_KEY, msg.UUID) 23 | Tracking.track('openPlugin', { cmd: msg.cmd }) 24 | } 25 | 26 | if (msg.type == 'init') { 27 | this.insertDisplay(msg.AD_LAST_SHOWN_DATE, msg.AD_LAST_SHOWN_IMPRESSION) 28 | } 29 | }) 30 | 31 | Router.setup({ 32 | index: '#index', 33 | preferences: '#preferences' 34 | }) 35 | } 36 | 37 | bind() { 38 | Router.on('change:url', url => this.showActiveView(url)) 39 | } 40 | 41 | insertDisplay(lastShownDate, lastShownImpression) { 42 | let elem = document.createElement('c-display') 43 | elem.setAttribute('lastshowndate', lastShownDate) 44 | elem.setAttribute('lastshownimpression', lastShownImpression) 45 | elem.setAttribute('hidden', '') 46 | document.body.insertBefore(elem, document.body.querySelector('root-ui')) 47 | } 48 | 49 | showActiveView(url) { 50 | let view = url.replace('#', '') 51 | this.findAll('[data-view]').forEach(view => view.setAttribute('hidden', '')) 52 | this.find(`[data-view="${view}"]`).removeAttribute('hidden') 53 | } 54 | 55 | render() { 56 | if (!this.data.preferences) return ''; 57 | return` 58 | 59 | 60 |