<hive-agent-menu> bundled two concerns: the agent-specific trigger/item list, and generic "click a trigger, get a positioned dropdown" mechanics (shadow attach, open/close, singleton close-on-open coordination, outside-click/Escape handling). Pulled the latter out into a new @hive/shared/hive-menu.js (<hive-menu>), following the established per-component-directory + ._opts-before-append shadow-DOM pattern (<hive-dialog>). <hive-agent-menu> now just builds the "⋮" trigger and the action list and hands them to an internal <hive-menu> instance. <hive-menu> takes ownership of every <hive-menu> instance in the app for singleton coordination (closeAllMenus, renamed from closeAllAgentMenus) — a deliberate widening from the old per-agent-menu-only tracking, since the mechanism was never agent-specific to begin with. The one subtlety worth spelling out: <hive-menu> projects the caller's opaque trigger/content nodes via named <slot>s rather than moving them into its own shadow root. That's load-bearing, not cosmetic — if it re-parented them into its own shadow tree instead, <hive-agent-menu>'s own classes (.agent-menu-btn, .agent-menu-item, ...) would stop applying, since a <style> only styles elements within the same shadow tree/document it's part of, and only slotting (not re-parenting) keeps the caller's nodes in the caller's own tree for styling purposes. That in turn made <hive-agent-menu>'s own shadow root redundant once it wasn't the thing positioning or owning open/close state anymore, so it's dropped in favor of a plain light-DOM element styled by dashboard.css (already the one page it renders on) — hive-agent-menu.css is gone, its rules folded into dashboard.css's per-agent-menu section, minus the positioning rules that moved into hive-menu.css as the new generic `.menu-dropdown` wrapper. Verified with a standalone esbuild bundle + a cached nix chromium driven over raw CDP (no puppeteer/playwright/python3 available): hover-reveal opacity, dropdown open/close/positioning, outside-click/Escape dismissal, and cross-instance singleton coordination all behave identically to before the split.
27 lines
912 B
JSON
27 lines
912 B
JSON
{
|
|
"name": "@hive/shared",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"description": "Shared frontend modules used by both the dashboard and the per-agent UI: terminal log pane, Catppuccin palette, base typography. Imported by sibling workspaces; not bundled standalone.",
|
|
"type": "module",
|
|
"main": "./src/index.js",
|
|
"exports": {
|
|
".": "./src/index.js",
|
|
"./terminal.js": "./src/terminal.js",
|
|
"./tabs.js": "./src/tabs.js",
|
|
"./tabs.css": "./src/tabs.css",
|
|
"./colors.css": "./src/colors.css",
|
|
"./theme.css": "./src/theme.css",
|
|
"./base.css": "./src/base.css",
|
|
"./terminal.css": "./src/terminal.css",
|
|
"./chrome.css": "./src/chrome.css",
|
|
"./forms.js": "./src/forms.js",
|
|
"./dom.js": "./src/dom.js",
|
|
"./modal.js": "./src/modal.js",
|
|
"./shadow-css.js": "./src/shadow-css.js",
|
|
"./hive-menu.js": "./src/hive-menu/hive-menu.js"
|
|
},
|
|
"files": [
|
|
"src/"
|
|
]
|
|
}
|