{#- The dashboard studio: palette, canvas, toolbar, properties panel and
keyboard list, shared by every page that embeds the editor.
Plain HTML with no template syntax. The comments are Jinja-style comment
blocks, so a template engine that includes this file
drops them at build time, and a plain consumer removes them before it
inserts the markup (README.md, "Consuming the editor"). Nothing else in
this file may use template delimiters, and tests/fragment.test.mjs holds
that.
The host supplies what is not here: an element carrying
`data-dashboard-editor` around this markup, optionally with
`data-sources-href` naming the source-list route; the raw JSON pane (a
textarea carrying `data-dashboard-raw` inside a details element, with a
`data-dashboard-raw-error` beside it); and the save control. -#}
{#- data-mode is the whole selection model: "nav" while the canvas owns the
arrow keys and "edit" while the properties panel has the focus. It is
an attribute rather than a class because studio.css reads it and
dashboard-editor.js writes it, and neither wants to own a list of
class names the other has to match. -#}
{#- Undo and Redo act on the document, so they sit above all three
columns rather than in the palette (which adds a block) or in the
properties panel (which edits one). Disabled until there is
something to undo, which is also how a fresh editor says the stack
starts empty. -#}
{#- The dashboard as a .wdash file (docs/wdash.md), in and out. They
act on the whole document like Undo and Redo, so they share the
bar, at its far end.
Each control belongs to a form the host supplies outside its own
editor form, by id, because a form cannot nest: the host's
`dashboard_import_form` (POST, multipart, with whatever hidden
fields it checks) and `dashboard_export_form` (GET). With
scripting off they are those forms' own controls, so an import
posts the file and an export downloads it with no script at all.
dashboard-file.js hides the file field behind Import, sends the
file without leaving the page, and hides any control whose form
the host does not supply. An import never stores: the file's
document lands in the editor, and Save keeps it. -#}
{#- What the last import did. The refusal is the reader's own reason,
and the notice says the document is not stored yet. Both are
empty, and so take no room, until there is something to say. -#}
{#- True of the page as served. dashboard-editor.js replaces it with
"Add a block from the palette.", which is true only where the
palette answers a click. -#}
This canvas needs scripting. The document is in the Raw dashboard JSON pane below, which posts without it.
{#- One toolbar, server-rendered once and moved onto whichever block is
selected, rather than one per block. It is the only place a block's
own operations live, which is what keeps them reachable when the
properties panel is stacked below the canvas on a narrow screen.
role="toolbar" and a roving tabindex: the whole thing is one Tab
stop and the arrow keys move between its buttons, so a person
tabbing through the page passes it in one press instead of six.
Alt+F10 reaches it from the canvas. -#}
{#- Both flows, because the two are one operation with a direction
and offering only the row made the section reachable solely by
grouping into a row and then changing the flow in the panel. -#}
{#- The inserter. The palette appends at the end of the document,
which is the only position a palette can mean; this one inserts at
a position, directly after the selected block and in that block's
own list, so an insert inside a row stays in the row. On the grid
it had to push everything below down by the height of the block
going in; a flow document has no rows to run out of, so it is a
splice. The same kinds the palette offers, because a second list
of kinds is a second list to keep in step. -#}
Insert under this block
{#- Exactly the shortcuts this editor implements, and no others. A list of
chords a page does not answer is worse than no list, so this one is
short on purpose: an assistive-technology user cannot remap these, and
a chord with three modifiers collides with screen reader and operating
system bindings, so fewer of them is better than more.
Every one of them is also a control. The toolbar carries the four
block operations, the palette appends a block, Undo and Redo are
buttons above the canvas, and the properties panel holds the frame
fields, so nothing here is a gesture with no visible equivalent.
Dragging a block is the one gesture with no chord of its own, on the
canvas and in the list view both. It needs none: every placement a drop
can make, the Alt arrows above make too, which is why they exist. A
pointer reaches no arrangement a keyboard cannot.
A rather than a