Release RuneStone 0.1.7 with plugin documents and shared menus

This commit is contained in:
Knotty Wyvern
2026-10-06 09:29:09 -07:00
parent 6b7af0d527
commit 5d0a4a24f9
75 changed files with 2286 additions and 1665 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
<circle cx="12" cy="12" r="9" /><path d="M9.5 9a2.5 2.5 0 1 1 4 2c-1 .6-1.5 1-1.5 3M12 17h.01" />
{:else if icon === "puzzle"}
<path d="M9 3H4v6a3 3 0 1 1 0 6v5h6a3 3 0 1 1 6 0h4v-6a3 3 0 1 0 0-6V3h-5a3 3 0 1 1-6 0Z" />
{:else if icon === "up" || icon === "down"}
{:else if icon === "up" || icon === "down" || icon === "kanban" || icon === "link"}
{@html actionIcons[icon]}
{:else if icon === "more"}
<circle cx="5" cy="12" r="1" /><circle cx="12" cy="12" r="1" /><circle cx="19" cy="12" r="1" />
+2
View File
@@ -5,6 +5,8 @@
| "settings"
| "help"
| "puzzle"
| "link"
| "kanban"
| "split"
| "more"
| "chevron-down"
+5
View File
@@ -1,5 +1,10 @@
// Stroke icons share the same 24px grid and weight as IconButton.
export const actionIcons = {
kanban: '<rect x="3" y="4" width="5" height="16" rx="1"/><rect x="10" y="4" width="5" height="11" rx="1"/><rect x="17" y="4" width="4" height="7" rx="1"/>',
bookmark: '<path d="M6 4h12v16l-6-3-6 3z"/>',
'file-plus': '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6M12 18v-6M9 15h6"/>',
'folder-plus': '<path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9L9.2 3.9A2 2 0 0 0 7.5 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2zM12 10v6M9 13h6"/>',
pin: '<path d="m16 3 5 5-4 1-3 3 1 4-2 2-7-7 2-2 4 1 3-3ZM8 16l-5 5"/>',
book: '<path d="M12 6v15M3 3h5a4 4 0 0 1 4 3 4 4 0 0 1 4-3h5v15h-5a4 4 0 0 0-4 3 4 4 0 0 0-4-3H3Z"/>',
folder: '<path d="M3 7V4h6l3 3h9v13H3Z"/>',
+6 -4
View File
@@ -1,9 +1,9 @@
import { actionIcon, type ActionIcon } from "./actionIcons";
export type ActionMenuItem = { label: string; icon: ActionIcon; shortcut?: string; run?: () => void; children?: ActionMenuItem[]; disabled?: boolean; title?: string } | { separator: true };
export type ActionMenuItem = { label: string; icon?: ActionIcon; shortcut?: string; run?: () => void; children?: ActionMenuItem[]; disabled?: boolean; title?: string } | { separator: true };
export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClose: () => void, label = "Table actions") {
const root = document.createElement("div"); root.className = "table-cell-menu"; root.setAttribute("role", "menu"); root.setAttribute("aria-label", label);
const root = document.createElement("div"); root.className = "rs-menu table-cell-menu"; root.setAttribute("role", "menu"); root.setAttribute("aria-label", label);
let opened: HTMLElement | undefined, owner: HTMLButtonElement | undefined;
if (label.startsWith("Terminal")) root.style.width = "min(430px, calc(100vw - 16px))";
const submenus = new Map<HTMLButtonElement, HTMLElement>();
@@ -25,12 +25,14 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
const button = document.createElement("button"); button.type = "button"; button.setAttribute("role", "menuitem"); button.disabled = !!item.disabled;
if (item.title) button.title = item.title;
const label = document.createElement("span"); label.className = "action-label"; label.textContent = item.label;
button.append(actionIcon(item.icon), label); panel.append(button);
const icon = item.icon ? actionIcon(item.icon) : document.createElement("span");
icon.classList.add("action-icon"); icon.setAttribute("aria-hidden", "true");
button.append(icon, label); panel.append(button);
if (item.shortcut) { const shortcut = document.createElement("span"); shortcut.textContent = item.shortcut; shortcut.style.cssText = "margin-left:auto;color:var(--rs-text-dim);font-size:12px;white-space:nowrap"; button.append(shortcut); }
if (item.children) {
button.setAttribute("aria-haspopup", "menu"); button.setAttribute("aria-expanded", "false");
const arrow = actionIcon("chevron"); arrow.classList.add("action-chevron"); button.append(arrow);
const submenu = document.createElement("div"); submenu.className = "table-cell-submenu"; submenu.setAttribute("role", "menu"); submenu.setAttribute("aria-label", item.label); submenu.hidden = true;
const submenu = document.createElement("div"); submenu.className = "rs-menu table-cell-submenu"; submenu.setAttribute("role", "menu"); submenu.setAttribute("aria-label", item.label); submenu.hidden = true;
populate(submenu, item.children); root.append(submenu); submenus.set(button, submenu);
button.addEventListener("mousemove", () => { if (!button.disabled) reveal(button, submenu); });
button.addEventListener("click", () => reveal(button, submenu, true));
+42
View File
@@ -0,0 +1,42 @@
.rs-menu {
position: fixed;
z-index: 1000;
width: var(--rs-menu-width);
max-width: calc(100vw - 16px);
max-height: calc(100vh - 16px);
overflow-y: auto;
padding: var(--rs-menu-padding);
border: 1px solid var(--rs-border);
border-radius: var(--rs-control-radius);
background: var(--rs-bg-elevated);
color: var(--rs-text);
box-shadow: var(--rs-menu-shadow);
font: 13px/1.4 var(--rs-font-ui);
}
.rs-menu.table-cell-submenu { z-index: 1001; }
.rs-menu > button {
display: flex;
align-items: center;
gap: var(--rs-menu-icon-gap);
width: 100%;
min-height: var(--rs-menu-row-height);
padding: var(--rs-menu-row-padding);
border: 0;
border-radius: var(--rs-control-radius);
background: transparent;
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
}
.rs-menu > button:disabled { opacity: .4; cursor: default; }
.rs-menu > button:not(:disabled):is(:hover, :focus-visible, [aria-expanded="true"]) {
background: var(--rs-bg-active);
outline: none;
}
.rs-menu > hr { margin: 4px 0; border: 0; border-top: 1px solid var(--rs-border); }
.rs-menu > button > .action-icon { width: var(--rs-menu-icon-size); height: var(--rs-menu-icon-size); flex-basis: var(--rs-menu-icon-size); }
.rs-menu > button > .action-chevron { width: 13px; height: 13px; flex-basis: 13px; }