The rule editor shows every rule with all its fields open. Most of the time only one rule is being worked on, and the others are there for reference, not editing. Show the others folded, one line each, with a way to open them.
Post-M1. M1-UI-008 still holds: every rule keeps its structured controls, some of them folded. REQUIREMENTS.md stays unchanged.
Behaviour #
- One open rule. At most one rule is open at a time. Opening a rule folds the one that was open. The open rule can also be folded, leaving none open.
- Folded line. Name, target account, and the condition cut to one line in monospace. A rule with an empty name shows "(unnamed rule)". The line follows the fields as they are typed, so it is never out of date once folded.
- Open rule's line. Just the name, updated as it is typed. It is the handle to fold the rule; the condition and accounts are in the fields below it.
- Page load. Every rule starts folded. Nothing is remembered across reloads: the draft is not
either, and an index remembered in
localStoragecould open the wrong rule. - Add rule. The new rule opens, the others fold, and the cursor goes to its name field.
- Delete. Only inside the open rule, never on a folded line. Deleting therefore leaves every rule folded.
- Errors. A folded line carries no error marker. The problems list already satisfies M1-UI-011; per-rule problems are "Interactive: show each rule's problems on its own card".
- Folding is keyboard-accessible: the line is a focusable control toggled with Enter or Space.
Out of scope, each its own issue if wanted:
- Clicking a rule name in the rows table's "rules" column to open that rule.
- How many current rows each rule matches, on its folded line. The state payload has no per-rule count today.
Design #
<rule-editor>owns its line. It draws it from the rule it already holds and has anopenproperty. When the user opens it, it emitsrule-open. How a rule is shown stays in one element.app.jsdecides which rule is current. It keeps the open index, closes the others onrule-open, and reapplies it whenrenderEditor()rebuilds the cards on add and delete.- Not
<details name="rules">: exclusive<details>groups do not reach across shadow roots, and moving<details>into the light DOM would makeapp.jsdraw a rule's line from the draft too, a second place that knows how a rule is shown (STYLE.md).
Testing #
No automated test, under D1. A D10 row and a manual check recipe in DESIGN_M1.md, next to §6.3, with the gap named in the commit message.
Commits #
rule-editor.js/.css: the folded line, the open line, theopenproperty andrule-open. Each rule folds on its own. Every rule starts folded. D10 and the recipe for folding.app.js: one open rule at a time, kept across rebuilds; "add rule" opens the new rule and focuses its name. The recipe extended for both.