Update editor, workspace, Git services, appearance, and project guides
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import ContextMenu from "$lib/layout/ContextMenu.svelte";
|
||||
import type { MenuItem } from "$lib/layout/menuTypes";
|
||||
import { installedPlugins, pluginTools, openPluginView, runPluginCommand } from "./external";
|
||||
let { surface }: { surface: "commands" | "open" } = $props();
|
||||
let { surface, compact = false }: { surface: "commands" | "open"; compact?: boolean } = $props();
|
||||
let anchor = $state<HTMLButtonElement>();
|
||||
let position = $state<{ x: number; y: number } | null>(null);
|
||||
let error = $state("");
|
||||
@@ -25,10 +25,11 @@
|
||||
</script>
|
||||
|
||||
{#if tools.length}
|
||||
<button class="access-button" bind:this={anchor} aria-haspopup="menu" aria-expanded={position !== null} title={label}
|
||||
<button class="access-button" class:compact bind:this={anchor} aria-label={label} aria-haspopup="menu" aria-expanded={position !== null} title={label}
|
||||
onpointerdown={() => pointerWasOpen = position !== null}
|
||||
onclick={event => { const close = event.detail > 0 ? pointerWasOpen : position !== null; const bounds = anchor!.getBoundingClientRect(); position = close ? null : { x: bounds.left, y: bounds.bottom + 4 }; }}>
|
||||
<Icon icon={surface === "open" ? "chevron-down" : "code"} /><span>{label}</span>
|
||||
<Icon icon={surface === "open" ? "chevron-down" : "code"} />{#if !compact}<span>{label}</span>{/if}
|
||||
{#if compact}<span class="access-tooltip" role="tooltip">{label}</span>{/if}
|
||||
</button>
|
||||
{/if}
|
||||
{#if position && tools.length}<ContextMenu {...position} {items} {label} onClose={() => position = null} />{/if}
|
||||
@@ -38,5 +39,8 @@
|
||||
.access-button { display: flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 32px; padding: 5px 8px; border: 0; border-radius: var(--rs-control-radius); background: transparent; color: var(--rs-text); }
|
||||
.access-button:hover, .access-button[aria-expanded="true"] { background: var(--rs-bg-active); }
|
||||
.access-button:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: -2px; }
|
||||
.access-button.compact { position: relative; width: 28px; height: 28px; min-height: 28px; padding: 5px; }
|
||||
.access-tooltip { display: none; position: absolute; top: calc(100% + 6px); right: 0; padding: 5px 8px; border-radius: var(--rs-control-radius); background: var(--rs-bg-elevated); border: 1px solid var(--rs-border); z-index: 60; pointer-events: none; }
|
||||
.access-button:is(:hover, :focus-visible) .access-tooltip { display: block; }
|
||||
.error { position: fixed; top: 48px; right: 12px; z-index: 60; max-width: 420px; padding: 12px; background: var(--rs-bg); color: var(--rs-error); border: 1px solid var(--rs-border); border-radius: var(--rs-control-radius); }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user