Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions editor-ui/src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export class RegisterMapEditor {
) {
container.classList.add("bust-editor");
container.replaceChildren(
this.toolbar,
this.summary,
element("div", { class: "bust-editor-head" }, this.summary, this.toolbar),
this.messages,
element(
"div",
Expand Down Expand Up @@ -211,13 +210,7 @@ export class RegisterMapEditor {
this.button("Undo", () => this.undo(), { isEnabled: state.canUndo, shortcut: "Ctrl+Z" }),
this.button("Redo", () => this.redo(), { isEnabled: state.canRedo, shortcut: "Ctrl+Shift+Z" }),
),
element(
"div",
{ class: "bust-editor-group" },
this.button("Add register", () => this.addRegister(this.registers.length), { shortcut: SHORTCUTS.addRegister }),
this.button("Module and bus", () => this.editModule(), { shortcut: SHORTCUTS.module }),
),
element("p", { class: "bust-editor-hint" }, "Right-click a register or field, or press ", element("kbd", {}, "Shift+F10"), ", for its menu."),
this.button("Add register", () => this.addRegister(this.registers.length), { shortcut: SHORTCUTS.addRegister }),
);
}

Expand All @@ -229,7 +222,7 @@ export class RegisterMapEditor {
facts.push(`version ${String(module.version)}`);
}
const name = this.button(String(module.name), () => this.editModule(), { className: "bust-editor-module-name" });
name.title = "Module and bus";
name.title = `Module and bus (${SHORTCUTS.module})`;
this.summary.replaceChildren(name, element("span", {}, facts.join(" · ")));
if (module.description) {
this.summary.append(element("p", {}, String(module.description)));
Expand Down Expand Up @@ -327,7 +320,7 @@ export class RegisterMapEditor {
edit: () => void,
openMenu: (x: number, y: number, anchor?: HTMLElement) => void,
): HTMLTableRowElement {
const more = element("button", { type: "button", class: "bust-editor-more", "aria-label": "Actions", "aria-haspopup": "menu" }, "⋯");
const more = element("button", { type: "button", class: "bust-editor-more", "aria-label": "Actions", "aria-haspopup": "menu", title: `Actions (right-click or ${SHORTCUTS.menu})` }, "⋯");
more.addEventListener("click", (event) => {
event.stopPropagation();
select();
Expand Down Expand Up @@ -381,7 +374,7 @@ export class RegisterMapEditor {
if (!value.isSet) {
valueElement.classList.add("bust-editor-unset");
}
list.append(element("div", {}, element("dt", {}, button), valueElement));
list.append(element("div", { "data-key": key }, element("dt", {}, button), valueElement));
}
const edit = this.button("Edit", () => (kind === "field" ? this.editField() : this.editRegister()), { shortcut: SHORTCUTS.edit });
this.keysPane.replaceChildren(element("div", { class: "bust-editor-pane-head" }, element("h3", {}, owner), edit), list);
Expand Down
70 changes: 39 additions & 31 deletions editor-ui/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,62 +79,60 @@

.bust-editor h3 {
margin: 0;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--bust-editor-muted);
font-size: 0.9rem;
font-weight: 600;
color: var(--bust-editor-ink);
}

.bust-editor-toolbar {
/* The module on the left and the few actions that are not about one
register or field on the right. */
.bust-editor-head {
display: flex;
flex-wrap: wrap;
align-items: center;
align-items: flex-start;
justify-content: space-between;
gap: 0.5rem 1rem;
}

.bust-editor-toolbar,
.bust-editor-group {
display: flex;
gap: 0.25rem;
}

.bust-editor-hint {
margin: 0 0 0 auto;
font-size: 0.8rem;
color: var(--bust-editor-muted);
.bust-editor-toolbar {
gap: 0.75rem;
}

.bust-editor-summary {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 0.25rem 0.75rem;
font-family: var(--bust-editor-mono);
gap: 0.1rem 0.75rem;
min-width: 0;
font-size: 0.85rem;
color: var(--bust-editor-muted);
}

.bust-editor-summary p {
flex-basis: 100%;
margin: 0;
font-family: initial;
font-family: inherit;
}

.bust-editor .bust-editor-module-name {
padding: 0;
font-family: inherit;
font-family: var(--bust-editor-mono);
font-size: 1.1rem;
font-weight: 700;
color: var(--bust-editor-ink);
background: none;
border: none;
border-bottom: 2px solid var(--bust-editor-teal);
border-radius: 0;
}

.bust-editor .bust-editor-module-name:hover:not(:disabled) {
color: var(--bust-editor-teal);
text-decoration: underline;
background: none;
}

Expand Down Expand Up @@ -169,7 +167,7 @@
.bust-editor-body {
display: grid;
grid-template-columns: minmax(0, 3fr) minmax(14rem, 1.3fr);
gap: 0.75rem;
gap: 1.25rem;
align-items: start;
}

Expand All @@ -182,7 +180,7 @@
.bust-editor-main {
display: flex;
flex-direction: column;
gap: 0.75rem;
gap: 1.5rem;
min-width: 0;
}

Expand All @@ -191,17 +189,23 @@
flex-direction: column;
gap: 0.5rem;
min-width: 0;
padding: 0.6rem;
border: 1px solid var(--bust-editor-border);
border-radius: 6px;
}

.bust-editor-pane:empty {
display: none;
.bust-editor-keys {
padding-left: 0.75rem;
border-left: 1px solid var(--bust-editor-border);
}

.bust-editor-pane:focus-within {
border-color: var(--bust-editor-teal);
@container (max-width: 52rem) {
.bust-editor-keys {
padding: 0.75rem 0 0;
border-top: 1px solid var(--bust-editor-border);
border-left: none;
}
}

.bust-editor-pane:empty {
display: none;
}

.bust-editor-pane:focus-within > h3,
Expand Down Expand Up @@ -252,7 +256,6 @@
.bust-editor-table td {
padding: 0.25rem 0.5rem;
white-space: nowrap;
border-bottom: 1px solid color-mix(in srgb, var(--bust-editor-border) 50%, transparent);
}

.bust-editor-table td:not(.bust-editor-name, :last-child, :nth-last-child(2)) {
Expand Down Expand Up @@ -299,16 +302,17 @@
text-align: right;
}

/* Shown on the row in hand only. Right-click and Shift+F10 open the same menu. */
.bust-editor .bust-editor-more {
padding: 0 0.45rem;
line-height: 1.3;
background: none;
border-color: transparent;
opacity: 0;
}

.bust-editor tr:hover .bust-editor-more,
.bust-editor tr[aria-selected="true"] .bust-editor-more {
border-color: var(--bust-editor-border);
.bust-editor tr:is(:hover, :focus-within, [aria-selected="true"]) .bust-editor-more {
opacity: 1;
}

.bust-editor-hidden {
Expand Down Expand Up @@ -400,7 +404,6 @@
grid-template-columns: 9.5rem minmax(0, 1fr);
gap: 0.5rem;
align-items: baseline;
border-bottom: 1px solid color-mix(in srgb, var(--bust-editor-border) 50%, transparent);
}

.bust-editor-key-list dt {
Expand Down Expand Up @@ -428,6 +431,11 @@
font-size: 0.8rem;
}

.bust-editor-key-list [data-key="description"] dd {
font-family: inherit;
font-size: 0.85rem;
}

.bust-editor-unset {
color: var(--bust-editor-muted);
}
Expand Down
Loading