From af69384dc6035d9bda17f6f578cde741ce251ff0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 09:11:22 +0000 Subject: [PATCH 1/5] Layout editor: quick fixes, several controls at once, undo with selection, faster edits Working aids: - Undo and redo bring back the control that was selected - Checks: a click focuses the property a line is about; a button fixes what has one fix (create the attribute a binding names, remove an unused one, reset a refused value, build a list's template, create a tree's nodes table, bind an input to a new attribute) - Several controls at once: Ctrl/Shift+click on canvas, outline or code; delete, duplicate, move, copy, cut and "Wrap in" VBox/HBox/FlexBox/Panel - Ctrl+Up/Down move the selection; arrow keys on the drawer tabs - Outline filter by type or text - Properties show the defaults of the canvas's UI5; event fields offer the event names the design raises already - Data: attributes and fields move up and down; "Paste rows" takes rows from a spreadsheet or CSV - Preview mode lists the events raised and the model changes by then - Designs saved in this browser under their class name, next to Recent - The editor's own dialogs instead of confirm( ); errors stay until closed; a share link over 8 kB says so Performance and structure: - The outline, data, checks list and class render only while on screen - A commit serializes the design once, typing writes the store debounced - One implementation of the edits on the selection (src/ui/actions.js) for keys, command palette and canvas toolbar Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017kNeryZR99nVMy4Q21eYXA --- AGENTS.md | 5 + README.md | 43 +++++++-- index.html | 9 +- preview.html | 1 + src/app.js | 48 ++++++--- src/model.js | 115 ++++++++++++++++++++-- src/preview/init.js | 39 +++++++- src/ui/actions.js | 75 ++++++++++++++ src/ui/code.js | 8 +- src/ui/data.js | 121 ++++++++++++++++++++--- src/ui/dom.js | 31 ++++++ src/ui/edit.js | 89 +++++++++++++---- src/ui/files.js | 89 ++++++++++++----- src/ui/inspector.js | 100 +++++++++++++------ src/ui/keys.js | 21 ++-- src/ui/layers.js | 40 ++++++-- src/ui/palette.js | 27 ++++-- src/ui/preview.js | 84 +++++++++++++--- src/ui/store.js | 144 +++++++++++++++++++++++---- styles.css | 33 ++++++- test/e2e/workflow.spec.mjs | 193 +++++++++++++++++++++++++++++++++++++ test/model.test.mjs | 89 +++++++++++++++++ 22 files changed, 1227 insertions(+), 177 deletions(-) create mode 100644 src/ui/actions.js create mode 100644 test/e2e/workflow.spec.mjs diff --git a/AGENTS.md b/AGENTS.md index 485d0e3..9499d11 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,6 +63,11 @@ The product is the generated class. It must: in `src/ui/store.js`, the same list in `preview.html`, which takes any host only when the editor frames it). Any other host comes from the UI5 field, typed by the user. Never widen the list for a link. +- An edit on the selection (delete, duplicate, move, wrap, select the + parent) is written once, in `src/ui/actions.js`, and works on every + selected control; the keys, the command palette and the canvas toolbar + call it. A question to the user goes through `choose( )` in + `src/ui/dom.js`, never the browser's `confirm( )`. - The preview module (`src/preview/init.js`) runs inside UI5 1.71: ES5 style, `sap.ui.define`, no API newer than 1.71. diff --git a/README.md b/README.md index ac83794..425eeee 100644 --- a/README.md +++ b/README.md @@ -113,19 +113,42 @@ Also in the editor: extension (`vscode://abap2ui5.abap2ui5/open`), which opens it as an unsaved `.clas.abap` and offers to run it. - **Save / Open** stores the design as JSON so you can continue later. The - design is also kept in the browser between visits; what New, Open or - Import replaced is under *Recent designs*. **Copy share link** puts the - whole design into a URL - open it anywhere, the editor loads it. -- **Undo/redo** with Ctrl+Z and Ctrl+Shift+Z, **Delete** or **Backspace** - removes the selection, **Ctrl+D** duplicates it, **Ctrl+C / Ctrl+X / - Ctrl+V** copy, cut and paste it (also into another design or tab), - **Alt+↑** selects the parent, **Escape** the view, **Ctrl+S** saves the - design. In the outline the arrow keys walk the tree. + design is also kept in the browser between visits. *Save in browser* + keeps it there under its class name, next to others; *Designs in this + browser* lists those, and what New, Open or Import replaced. **Copy share + link** puts the whole design into a URL - open it anywhere, the editor + loads it (a link of more than 8 kB says so: some chats and mail cut it). +- **Undo/redo** with Ctrl+Z and Ctrl+Shift+Z - each step brings back the + control that was selected. **Delete** or **Backspace** removes the + selection, **Ctrl+D** duplicates it, **Ctrl+↑ / Ctrl+↓** move it among + its siblings, **Ctrl+C / Ctrl+X / Ctrl+V** copy, cut and paste it (also + into another design or tab), **Alt+↑** selects the parent, **Escape** + the view, **Ctrl+S** saves the design. In the outline the arrow keys walk + the tree, and the tabs of the drawer go by arrow key too. +- **Several controls at once**: Ctrl+click (or Shift+click) on the canvas, + in the outline or in the code adds a control to the selection. Delete, + duplicate, move, copy and cut act on all of them; *Wrap in…* puts + controls side by side into a new VBox, HBox, FlexBox or Panel. +- The **outline filter** shows the controls whose type or text matches, and + the way down to them. - A drop on the canvas lands before, into or after the control under the pointer: the upper quarter is before, the lower after. The panels on the left and right can be dragged wider. - **Checks** lists what would break the class or the view, and inputs - whose entry goes nowhere. + whose entry goes nowhere. A click on a line selects the control and + focuses the property it is about; where there is one fix, a button does + it: create the attribute a binding names, remove an unused one, reset a + value UI5 would refuse, build the template of a bound list, bind an input + to a new attribute. +- **Properties** show the default of the canvas's UI5 where nothing is + set, and an event field offers the names the design raises already - two + buttons, one `WHEN` branch. +- **Data**: attributes and fields move up and down (their order is the + order of the declarations), and *Paste rows…* takes sample rows copied + from a spreadsheet or CSV - with a header line, the columns go to the + fields of the same name, and a new name becomes a new field. +- **Preview** mode lists the events the view raised, with what the user + had changed in the model by then - what `on_event` would read. - The canvas can show a phone or tablet width, the Horizon, Quartz or Belize themes, and any UI5 version. Enter `1.71.80` to see the view on the oldest release abap2UI5 supports. @@ -248,7 +271,7 @@ runtime. Run it when the palette gains a control. | `src/xml.js` | Design → XML view (preview, export), and XML view → design (import) | | `src/app.js` | The editor UI: wires the panels and renders them on every change | | `src/ui/store.js` | The state, commit( ) with undo and the browser store, selection | -| `src/ui/*.js` | One module per panel: insert, layers, inspector, data, code, preview, palette, files, keys, edit (drop and clipboard) | +| `src/ui/*.js` | One module per panel: insert, layers, inspector, data, code, preview, palette, files, keys, edit (drop and clipboard), actions (the edits on the selection, for keys, palette and canvas toolbar) | | `src/preview/init.js` | The preview frame (a UI5 module) | | `tools/` | Dev server, metadata dump, class generation, runtime verification | | `test/` | Unit tests, fixtures, the builder model, browser tests | diff --git a/index.html b/index.html index 999c083..ea5f9ca 100644 --- a/index.html +++ b/index.html @@ -31,9 +31,10 @@ + - + @@ -70,7 +71,10 @@