feat: add live preview system and enhance dev workflow

- Implement debounced live preview in modal editing (500ms)
- Add LivePreviewManager class with element tracking and restoration
- Enhance modal sizing for comfortable 60-80 character editing
- Add auto-copy plugin to rollup config for seamless development
- Update dev command to automatically sync changes to demo-site

The live preview system provides real-time visual feedback while typing in modals,
showing changes in context without saving. Enhanced dev workflow eliminates manual
build steps, enabling instant iteration during development.
This commit is contained in:
2025-09-07 19:15:10 +02:00
parent ae9d8e4058
commit 2346eea874
2 changed files with 326 additions and 39 deletions

View File

@@ -1,5 +1,21 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import { execSync } from 'child_process';
// Simple copy plugin to auto-copy to demo-site during development
function copyToDemo() {
return {
name: 'copy-to-demo',
writeBundle() {
try {
execSync('cp dist/insertr.js ../demo-site/insertr.js');
console.log('📄 Copied to demo-site/insertr.js');
} catch (error) {
console.warn('⚠️ Failed to copy to demo-site:', error.message);
}
}
};
}
export default [
// Development build
@@ -11,7 +27,8 @@ export default [
name: 'Insertr'
},
plugins: [
nodeResolve()
nodeResolve(),
copyToDemo()
]
},
// Production build (minified)