mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(packages): add settings menu (#1615)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/** Toggle a popup host linked via `commandfor` (menu, popover, etc.). */
|
||||
export function toggleCommandTarget(host: HTMLElement, commandfor: string): void {
|
||||
const root = host.getRootNode() as Document | ShadowRoot;
|
||||
const target =
|
||||
('getElementById' in root ? root.getElementById(commandfor) : null) ??
|
||||
root.querySelector<HTMLElement>(`#${CSS.escape(commandfor)}`);
|
||||
|
||||
if (!target || !('open' in target)) return;
|
||||
|
||||
const popup = target as { open: boolean };
|
||||
popup.open = !popup.open;
|
||||
}
|
||||
Reference in New Issue
Block a user