enso/app/gui2/vite.config.ts
somebody1234 b59e7c088e
[gui2] Shortcut manager + shortcuts for selecting nodes (#7893)
- Closes #7874
- Chosen solution: Use the dashboard's shortcut manager to register keybinds and match mouse shortcuts
- Switch existing shortcuts to shortcut manager as well
- Switch visualizations to use the shortcut manager too
- Closes #7865
- Implements all shortcuts for node selection, *except* the arrow key shortcut
- Adds circle cursor selection brush
- The fade out from inactivity (which is present in the Rust source code) is currently missing

Other changes:
- Change everything to use `pointerdown` as appropriate, to ensure the event handlers are called in the right order

# Important Notes
The arrow key shortcut to navigate to the nearest node in that direction *has not* been implemented.
This may need discussion on how it should work

The implementation in general is pretty inefficient - this is intentional, performance can be optimized in the future
2023-10-02 09:03:47 +00:00

56 lines
1.7 KiB
TypeScript

import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'node:url'
import postcssNesting from 'postcss-nesting'
import tailwindcss from 'tailwindcss'
import tailwindcssNesting from 'tailwindcss/nesting'
import { defineConfig, Plugin } from 'vite'
import topLevelAwait from 'vite-plugin-top-level-await'
import * as tailwindConfig from '../ide-desktop/lib/dashboard/tailwind.config'
import { createGatewayServer } from './ydoc-server'
const projectManagerUrl = 'ws://127.0.0.1:30535'
// https://vitejs.dev/config/
export default defineConfig({
cacheDir: '../../node_modules/.cache/vite',
plugins: [vue(), gatewayServer(), topLevelAwait()],
optimizeDeps: {
entries: 'index.html',
},
resolve: {
alias: {
shared: fileURLToPath(new URL('./shared', import.meta.url)),
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
define: {
REDIRECT_OVERRIDE: JSON.stringify('http://localhost:8080'),
PROJECT_MANAGER_URL: JSON.stringify(projectManagerUrl),
global: 'globalThis',
IS_DEV_MODE: JSON.stringify(process.env.NODE_ENV !== 'production'),
CLOUD_ENV:
process.env.ENSO_CLOUD_ENV != null ? JSON.stringify(process.env.ENSO_CLOUD_ENV) : 'undefined',
},
assetsInclude: ['**/*.yaml', '**/*.svg'],
css: {
postcss: {
plugins: [tailwindcssNesting(postcssNesting()), tailwindcss({ config: tailwindConfig })],
},
},
build: {
// dashboard chunk size is larger than the default warning limit
chunkSizeWarningLimit: 700,
},
})
function gatewayServer(): Plugin {
return {
name: 'gateway-server',
configureServer(server) {
if (server.httpServer == null) return
createGatewayServer(server.httpServer)
},
}
}