diff --git a/.electron-vue/dev-client.js b/.electron-vue/dev-client.js index 2913ea4b..81f73ee1 100755 --- a/.electron-vue/dev-client.js +++ b/.electron-vue/dev-client.js @@ -1,40 +1,40 @@ -const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') +// const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') -hotClient.subscribe(event => { - /** - * Reload browser when HTMLWebpackPlugin emits a new index.html - * - * Currently disabled until jantimon/html-webpack-plugin#680 is resolved. - * https://github.com/SimulatedGREG/electron-vue/issues/437 - * https://github.com/jantimon/html-webpack-plugin/issues/680 - */ - // if (event.action === 'reload') { - // window.location.reload() - // } +// hotClient.subscribe(event => { +// /** +// * Reload browser when HTMLWebpackPlugin emits a new index.html +// * +// * Currently disabled until jantimon/html-webpack-plugin#680 is resolved. +// * https://github.com/SimulatedGREG/electron-vue/issues/437 +// * https://github.com/jantimon/html-webpack-plugin/issues/680 +// */ +// if (event.action === 'reload') { +// window.location.reload() +// } - /** - * Notify `mainWindow` when `main` process is compiling, - * giving notice for an expected reload of the `electron` process - */ - if (event.action === 'compiling') { - document.body.innerHTML += ` - +// /** +// * Notify `mainWindow` when `main` process is compiling, +// * giving notice for an expected reload of the `electron` process +// */ +// if (event.action === 'compiling') { +// document.body.innerHTML += ` +// -
- Compiling Main Process... -
- ` - } -}) +//
+// Compiling Main Process... +//
+// ` +// } +// }) diff --git a/.electron-vue/dev-runner.js b/.electron-vue/dev-runner.js index 95b2115e..703d68f1 100755 --- a/.electron-vue/dev-runner.js +++ b/.electron-vue/dev-runner.js @@ -11,7 +11,7 @@ const { } = require('child_process') const webpack = require('webpack') const WebpackDevServer = require('webpack-dev-server') -const webpackHotMiddleware = require('webpack-hot-middleware') +// const webpackHotMiddleware = require('webpack-hot-middleware') const mainConfig = require('./webpack.main.config') const rendererConfig = require('./webpack.renderer.config') @@ -46,15 +46,16 @@ function startRenderer() { return new Promise((resolve, reject) => { rendererConfig.entry.renderer = [path.join(__dirname, 'dev-client')].concat(rendererConfig.entry.renderer) rendererConfig.mode = 'development' + const compiler = webpack(rendererConfig) - hotMiddleware = webpackHotMiddleware(compiler, { - log: false, - heartbeat: 2500, - // logLevel: 'debug' - }) + + // hotMiddleware = webpackHotMiddleware(compiler, { + // heartbeat: 2500, + // logLevel: 'debug', + // quiet: true + // }) // Original - // Webpack 3 // compiler.hooks.compilation.tap('compilation', compilation => { // compilation.hooks.htmlWebpackPluginAfterEmit.tapAsync('html-webpack-plugin-after-emit', (data, cb) => { // hotMiddleware.publish({ @@ -64,27 +65,34 @@ function startRenderer() { // }) // }) - // Webpack 4 - compiler.hooks.compilation.tap('html-webpack-plugin-after-emit', () => { - hotMiddleware.publish({ - action: 'reload' - }); - }); + // compiler.hooks.compilation.tap('compilation', (compilation) => { + // HtmlWebpackPlugin.getHooks(compilation).beforeEmit.tapAsync( + // 'html-webpack-plugin', + // (data, cb) => { + // hotMiddleware.publish({ + // action: 'reload' + // }); + + // // Tell webpack to move on + // cb() + // } + // ) + // }) compiler.hooks.done.tap('done', stats => { logStats('Renderer', stats) }) + // Create a Webpack Dev Server const server = new WebpackDevServer( compiler, { contentBase: path.join(__dirname, '../'), quiet: true, - // logLevel: 'debug', + logLevel: 'debug', + hot: true, + port: 9080, before(app, ctx) { - app.use(hotMiddleware) - ctx.middleware.waitUntilValid(() => { - resolve() - }) + resolve() } } ) @@ -101,9 +109,9 @@ function startMain() { compiler.hooks.watchRun.tapAsync('watch-run', (compilation, done) => { logStats('Main', chalk.white.bold('compiling...')) - hotMiddleware.publish({ - action: 'compiling' - }) + // hotMiddleware.publish({ + // action: 'compiling' + // }) done() }) diff --git a/.electron-vue/webpack.web.config.js b/.electron-vue/webpack.web.config.js index d835504d..071a8798 100755 --- a/.electron-vue/webpack.web.config.js +++ b/.electron-vue/webpack.web.config.js @@ -35,14 +35,6 @@ let webConfig = { test: /\.scss$/, use: ['vue-style-loader', 'css-loader', 'sass-loader'] }, - { - test: /\.sass$/, - use: ['vue-style-loader', 'css-loader', 'sass-loader?indentedSyntax'] - }, - { - test: /\.less$/, - use: ['vue-style-loader', 'css-loader', 'less-loader'] - }, { test: /\.css$/, use: ['vue-style-loader', 'css-loader'] @@ -64,9 +56,7 @@ let webConfig = { options: { extractCSS: true, loaders: { - sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1', - scss: 'vue-style-loader!css-loader!sass-loader', - less: 'vue-style-loader!css-loader!less-loader' + scss: 'vue-style-loader!css-loader!sass-loader' } } } diff --git a/package.json b/package.json index e08c3246..840e322b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "reflex", "productName": "Reflex", "description": "Make responsive websites without the guesswork.", - "version": "0.6.4", + "version": "0.6.5", "author": "Nick Wittwer", "license": "MIT", "main": "./dist/electron/main.js", @@ -74,12 +74,15 @@ }, "dependencies": { "@simonwep/selection-js": "^1.2.0", + "babel-preset-minify": "^0.5.1", "browser-sync": "^2.26.7", "electron-debug": "^3.0.1", + "electron-is-dev": "^1.1.0", "electron-log": "^3.0.7", "electron-updater": "^4.1.2", "is-electron": "^2.2.0", "lodash.debounce": "^4.0.8", + "uuid": "^3.3.3", "vue": "^2.6.10", "vue-electron": "^1.0.6", "vue-router": "^3.1.2", @@ -93,41 +96,41 @@ "@babel/plugin-transform-runtime": "^7.5.5", "@babel/preset-env": "^7.5.5", "@babel/runtime": "^7.5.5", - "@vue/cli": "^3.10.0", + "@vue/cli": "^3.11.0", "@vue/test-utils": "^1.0.0-beta.29", "babel-core": "^7.0.0-bridge.0", - "babel-eslint": "^10.0.2", - "babel-jest": "^24.8.0", + "babel-eslint": "^10.0.3", + "babel-jest": "^24.9.0", "babel-loader": "^8.0.6", "babel-minify-webpack-plugin": "^0.3.1", "babel-plugin-require-context-hook": "^1.0.0", "browser-sync-webpack-plugin": "^2.2.2", - "cfonts": "^2.4.4", + "cfonts": "^2.4.5", "chalk": "^2.4.2", "copy-webpack-plugin": "^5.0.4", "cross-env": "^5.1.6", "css-loader": "^3.2.0", - "del": "^5.0.0", + "del": "^5.1.0", "devtron": "^1.4.0", - "electron": "^6.0.1", + "electron": "^6.0.4", "electron-builder": "^21.2.0", "electron-devtools-installer": "^2.2.4", - "eslint": "^6.1.0", - "eslint-config-standard": "^13.0.1", + "eslint": "^6.3.0", + "eslint-config-standard": "^14.1.0", "eslint-friendly-formatter": "^4.0.1", - "eslint-loader": "^2.2.1", + "eslint-loader": "^3.0.0", "eslint-plugin-import": "^2.18.2", - "eslint-plugin-node": "^9.1.0", + "eslint-plugin-node": "^9.2.0", "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-standard": "^4.0.0", + "eslint-plugin-standard": "^4.0.1", "eslint-plugin-vue": "^5.2.3", "file-loader": "^4.2.0", "gulp": "^4.0.2", "gulp-hub": "^4.2.0", "gulp-notify": "^3.2.0", "gulp-replace": "^1.0.0", - "html-webpack-plugin": "^3.2.0", - "jest": "^24.8.0", + "html-webpack-plugin": "^4.0.0-beta.8", + "jest": "^24.9.0", "jest-vue-preprocessor": "^1.5.0", "mini-css-extract-plugin": "^0.8.0", "moment": "^2.24.0", @@ -135,7 +138,7 @@ "node-loader": "^0.6.0", "node-sass": "^4.12.0", "opn": "^6.0.0", - "sass-loader": "^7.2.0", + "sass-loader": "^8.0.0", "style-loader": "^1.0.0", "url-loader": "^2.1.0", "vue-eslint-parser": "^6.0.4", @@ -144,10 +147,10 @@ "vue-loader": "^15.7.1", "vue-style-loader": "^4.1.0", "vue-template-compiler": "^2.6.10", - "webpack": "^4.39.2", - "webpack-cli": "^3.3.6", + "webpack": "^4.39.3", + "webpack-cli": "^3.3.7", "webpack-dev-server": "^3.8.0", "webpack-hot-middleware": "^2.25.0", - "webpack-merge": "^4.1.3" + "webpack-merge": "^4.2.2" } } diff --git a/screenshot.png b/screenshot.png index c0e4434a..bf15de33 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/src/main/index.js b/src/main/index.js index 7d9d8574..6467b29b 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -14,6 +14,7 @@ import { version } from '../../package.json' const log = require('electron-log') +const isDev = require('electron-is-dev') // Set the version app.getVersion = () => version @@ -27,7 +28,7 @@ if (process.env.NODE_ENV !== 'development') { } let mainWindow -const winURL = process.env.NODE_ENV === 'development' +const winURL = isDev ? `http://localhost:9080` : `file://${__dirname}/index.html` diff --git a/src/main/menu.js b/src/main/menu.js index e9e38f04..3ee13e54 100644 --- a/src/main/menu.js +++ b/src/main/menu.js @@ -3,6 +3,7 @@ const { Menu, shell } = require('electron') +const isDev = require('electron-is-dev') export function setMenu(window) { const template = [{ @@ -120,38 +121,39 @@ export function setMenu(window) { } ] - // if (process.platform === 'darwin') { - template.unshift({ - label: app.getName(), - submenu: [{ - role: 'about' - }, - { - type: 'separator' - }, - { - role: 'services' - }, - { - type: 'separator' - }, - { - role: 'hide' - }, - { - role: 'hideothers' - }, - { - role: 'unhide' - }, - { - type: 'separator' - }, - { - role: 'quit' - } - ] - }) + if (process.platform === 'darwin') { + template.unshift({ + label: app.getName(), + submenu: [{ + role: 'about' + }, + { + type: 'separator' + }, + { + role: 'services' + }, + { + type: 'separator' + }, + { + role: 'hide' + }, + { + role: 'hideothers' + }, + { + role: 'unhide' + }, + { + type: 'separator' + }, + { + role: 'quit' + } + ] + }) + } // Edit menu template[1].submenu.push({ @@ -181,7 +183,19 @@ export function setMenu(window) { role: 'front' } ] - // } + + // If in Dev mode, add menu + if (isDev) { + template.splice(4, 0, { + label: 'Developer', + submenu: [{ + label: 'Show Canvas Debugger', + click() { + window.webContents.send('menu_show-developer-canvas-debugger') + } + }] + }) + } const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu) diff --git a/src/renderer/components/Screens/Artboard.vue b/src/renderer/components/Screens/Artboard.vue index 704d0c18..f1bb2cca 100644 --- a/src/renderer/components/Screens/Artboard.vue +++ b/src/renderer/components/Screens/Artboard.vue @@ -45,9 +45,8 @@ export default { WebPage }, props: { - index: Number, - id: Number, title: String, + id: String, height: Number, width: Number, selectedItems: Array @@ -59,18 +58,23 @@ export default { } }; }, + + mounted() { + this.$nextTick(() => { + // Remove any leftover selected artboards + // @TODO: This should be done from VueX Store, or wiped before quitting + this.$store.dispatch("selectedArtboardsEmpty"); + }); + }, + computed: { ...mapState({ url: state => state.history.currentPage.url, selectedArtboards: state => state.selectedArtboards }), - ...mapGetters( - ['isInteracting'] - ), + ...mapGetters(["isInteracting"]), isSelected() { - const isSelected = this.selectedArtboards.filter( - item => item == this.id - ); + const isSelected = this.selectedArtboards.filter(item => item == this.id); if (isSelected.length) { return true; } else { @@ -94,13 +98,6 @@ export default { return false; // Otherwise, false } }, - mounted() { - this.$nextTick(() => { - // Remove any leftover selected artboards - // @TODO: This should be done from VueX Store, or wiped before quitting - this.$store.dispatch("selectedArtboardsEmpty"); - }); - }, methods: { // Limits the size of an artboard @@ -242,20 +239,6 @@ export default { value: false }); } - }, - - toggleSelectedState() { - // Change the state - this.state.isSelected = !this.state.isSelected; - - // Update the VueX Store - if (this.state.isSelected === true) { - // Add to Store - this.$store.dispatch("selectedArtboardsAdd", this.index); - } else { - // Remove from Store - this.$store.dispatch("selectedArtboardsRemove", this.index); - } } } }; diff --git a/src/renderer/components/Screens/Artboards.vue b/src/renderer/components/Screens/Artboards.vue index d95be9e8..2fe990b4 100644 --- a/src/renderer/components/Screens/Artboards.vue +++ b/src/renderer/components/Screens/Artboards.vue @@ -154,6 +154,7 @@ export default {