2026-04-30 13:01:47 +00:00
|
|
|
import type { EditorCommandId } from '@open-pencil/vue'
|
|
|
|
|
|
|
|
|
|
export type AppMenuTarget = 'all' | 'browser' | 'native'
|
|
|
|
|
|
|
|
|
|
export interface AppMenuActionItem {
|
|
|
|
|
type?: 'item'
|
|
|
|
|
id: string
|
|
|
|
|
label: string
|
|
|
|
|
shortcut?: string
|
|
|
|
|
accelerator?: string
|
|
|
|
|
command?: EditorCommandId
|
|
|
|
|
checkbox?: boolean
|
|
|
|
|
target?: AppMenuTarget
|
|
|
|
|
sub?: AppMenuEntry[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AppMenuSeparatorItem {
|
|
|
|
|
type: 'separator'
|
|
|
|
|
target?: AppMenuTarget
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type AppMenuEntry = AppMenuActionItem | AppMenuSeparatorItem
|
|
|
|
|
|
|
|
|
|
export interface AppMenuGroupSchema {
|
|
|
|
|
label: string
|
|
|
|
|
target?: AppMenuTarget
|
|
|
|
|
items: AppMenuEntry[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const APP_MENU_SCHEMA = [
|
|
|
|
|
{
|
|
|
|
|
label: 'File',
|
|
|
|
|
items: [
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'new', label: 'New', shortcut: 'MOD+N' },
|
|
|
|
|
{ id: 'open', label: 'Open…', shortcut: 'MOD+O' },
|
2026-04-30 13:01:47 +00:00
|
|
|
{ type: 'separator' },
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'save', label: 'Save', shortcut: 'MOD+S' },
|
|
|
|
|
{ id: 'save-as', label: 'Save As…', shortcut: 'MOD+SHIFT+S' },
|
2026-04-30 13:01:47 +00:00
|
|
|
{ type: 'separator' },
|
|
|
|
|
{
|
|
|
|
|
id: 'export-selection',
|
|
|
|
|
label: 'Export Selection',
|
2026-05-17 11:44:37 +00:00
|
|
|
shortcut: 'MOD+SHIFT+E',
|
2026-04-30 13:01:47 +00:00
|
|
|
sub: [
|
|
|
|
|
{ id: 'export-png', label: 'PNG' },
|
|
|
|
|
{ id: 'export-svg', label: 'SVG' },
|
|
|
|
|
{ id: 'export-fig', label: '.fig' }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{ type: 'separator' },
|
|
|
|
|
{ id: 'autosave', label: 'Autosave', checkbox: true },
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'close', label: 'Close Tab', shortcut: 'MOD+W' }
|
2026-04-30 13:01:47 +00:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Edit',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
id: 'edit.undo',
|
|
|
|
|
label: 'Undo',
|
|
|
|
|
shortcut: 'MOD+Z',
|
|
|
|
|
command: 'edit.undo'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'edit.redo',
|
|
|
|
|
label: 'Redo',
|
2026-05-17 11:44:37 +00:00
|
|
|
shortcut: 'MOD+SHIFT+Z',
|
2026-04-30 13:01:47 +00:00
|
|
|
command: 'edit.redo'
|
|
|
|
|
},
|
|
|
|
|
{ type: 'separator' },
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'copy', label: 'Copy', shortcut: 'MOD+C' },
|
|
|
|
|
{ id: 'cut', label: 'Cut', shortcut: 'MOD+X' },
|
|
|
|
|
{ id: 'paste', label: 'Paste', shortcut: 'MOD+V' },
|
2026-04-30 13:01:47 +00:00
|
|
|
{
|
|
|
|
|
id: 'selection.duplicate',
|
|
|
|
|
label: 'Duplicate',
|
|
|
|
|
shortcut: 'MOD+D',
|
|
|
|
|
command: 'selection.duplicate'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.delete',
|
|
|
|
|
label: 'Delete',
|
|
|
|
|
shortcut: '⌫',
|
|
|
|
|
command: 'selection.delete'
|
|
|
|
|
},
|
|
|
|
|
{ type: 'separator' },
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.selectAll',
|
|
|
|
|
label: 'Select All',
|
|
|
|
|
shortcut: 'MOD+A',
|
|
|
|
|
command: 'selection.selectAll'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'View',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
id: 'view.zoom100',
|
|
|
|
|
label: 'Zoom to 100%',
|
|
|
|
|
shortcut: 'MOD+0',
|
|
|
|
|
command: 'view.zoom100'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'view.zoomFit',
|
|
|
|
|
label: 'Zoom to Fit',
|
|
|
|
|
shortcut: 'MOD+1',
|
|
|
|
|
command: 'view.zoomFit'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'view.zoomSelection',
|
|
|
|
|
label: 'Zoom to Selection',
|
|
|
|
|
shortcut: 'MOD+2',
|
|
|
|
|
command: 'view.zoomSelection'
|
|
|
|
|
},
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'zoom-in', label: 'Zoom In', shortcut: 'MOD+=' },
|
|
|
|
|
{ id: 'zoom-out', label: 'Zoom Out', shortcut: 'MOD+-' },
|
2026-04-30 13:01:47 +00:00
|
|
|
{ type: 'separator' },
|
|
|
|
|
{
|
|
|
|
|
id: 'theme',
|
|
|
|
|
label: 'Theme',
|
|
|
|
|
sub: [
|
|
|
|
|
{ id: 'theme-light', label: 'Light', checkbox: true },
|
|
|
|
|
{ id: 'theme-dark', label: 'Dark', checkbox: true },
|
|
|
|
|
{ id: 'theme-auto', label: 'Auto', checkbox: true }
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{ id: 'language', label: 'Language', target: 'browser' },
|
|
|
|
|
{ type: 'separator' },
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'toggle-ui', label: 'Toggle UI', shortcut: 'MOD+\\' },
|
2026-04-30 13:01:47 +00:00
|
|
|
{ id: 'profiler', label: 'Profiler', checkbox: true, target: 'browser' },
|
|
|
|
|
{
|
|
|
|
|
id: 'dev-tools',
|
|
|
|
|
label: 'Developer Tools',
|
|
|
|
|
target: 'native'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Object',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.group',
|
|
|
|
|
label: 'Group Selection',
|
|
|
|
|
shortcut: 'MOD+G',
|
|
|
|
|
command: 'selection.group'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.ungroup',
|
|
|
|
|
label: 'Ungroup Selection',
|
2026-05-17 11:44:37 +00:00
|
|
|
shortcut: 'MOD+SHIFT+G',
|
2026-04-30 13:01:47 +00:00
|
|
|
command: 'selection.ungroup'
|
|
|
|
|
},
|
|
|
|
|
{ type: 'separator' },
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.createComponent',
|
|
|
|
|
label: 'Create Component',
|
2026-05-17 11:44:37 +00:00
|
|
|
shortcut: 'MOD+ALT+K',
|
2026-04-30 13:01:47 +00:00
|
|
|
command: 'selection.createComponent'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.createComponentSet',
|
|
|
|
|
label: 'Create Component Set',
|
|
|
|
|
command: 'selection.createComponentSet'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.detachInstance',
|
|
|
|
|
label: 'Detach Instance',
|
|
|
|
|
command: 'selection.detachInstance'
|
|
|
|
|
},
|
|
|
|
|
{ type: 'separator' },
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.bringToFront',
|
|
|
|
|
label: 'Bring to Front',
|
|
|
|
|
shortcut: ']',
|
|
|
|
|
command: 'selection.bringToFront'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.sendToBack',
|
|
|
|
|
label: 'Send to Back',
|
|
|
|
|
shortcut: '[',
|
|
|
|
|
command: 'selection.sendToBack'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Text',
|
|
|
|
|
items: [
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'text.bold', label: 'Bold', shortcut: 'MOD+B' },
|
|
|
|
|
{ id: 'text.italic', label: 'Italic', shortcut: 'MOD+I' },
|
|
|
|
|
{ id: 'text.underline', label: 'Underline', shortcut: 'MOD+U' }
|
2026-04-30 13:01:47 +00:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Arrange',
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
id: 'selection.wrapInAutoLayout',
|
|
|
|
|
label: 'Wrap in Auto Layout',
|
2026-05-17 11:44:37 +00:00
|
|
|
shortcut: 'SHIFT+A',
|
2026-04-30 13:01:47 +00:00
|
|
|
command: 'selection.wrapInAutoLayout'
|
|
|
|
|
},
|
|
|
|
|
{ type: 'separator' },
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'align-left', label: 'Align Left', shortcut: 'ALT+A' },
|
|
|
|
|
{ id: 'align-center', label: 'Align Center', shortcut: 'ALT+H' },
|
|
|
|
|
{ id: 'align-right', label: 'Align Right', shortcut: 'ALT+D' },
|
2026-04-30 13:01:47 +00:00
|
|
|
{ type: 'separator' },
|
2026-05-17 11:50:43 +00:00
|
|
|
{ id: 'align-top', label: 'Align Top', shortcut: 'ALT+W' },
|
|
|
|
|
{ id: 'align-middle', label: 'Align Middle', shortcut: 'ALT+V' },
|
|
|
|
|
{ id: 'align-bottom', label: 'Align Bottom', shortcut: 'ALT+S' }
|
2026-04-30 13:01:47 +00:00
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
] satisfies AppMenuGroupSchema[]
|