diff --git a/frontend/packages/agent/build.mjs b/frontend/packages/agent/build.mjs index c5e1edfa..be0c3e3a 100644 --- a/frontend/packages/agent/build.mjs +++ b/frontend/packages/agent/build.mjs @@ -41,6 +41,10 @@ await build({ target: ['es2022'], sourcemap: true, logLevel: 'info', + // `@hive/shared/modal.js` imports its shadow-DOM component CSS as raw + // text (see dashboard/build.mjs's matching comment) — same reasoning + // applies here. + loader: { '.css': 'text' }, }); // Bundle the CSS. `colors.css` re-exports the standalone base16 palette diff --git a/frontend/packages/agent/src/agent.css b/frontend/packages/agent/src/agent.css index 6854e3e8..28519eb4 100644 --- a/frontend/packages/agent/src/agent.css +++ b/frontend/packages/agent/src/agent.css @@ -6,10 +6,9 @@ agent SUB-pages (stats, screen) the same back-link nav the dashboard's standalone pages use. The live terminal page keeps its own header. */ @import "@hive/shared/chrome.css"; -/* Themed dialog/toast styles for the shared bindAsyncForms handler + any - direct themedConfirm/themedToast calls, so the per-agent UI's - confirmations and errors render in-theme instead of unstyled. */ -@import "@hive/shared/modal.css"; +/* Themed dialog/toast component CSS (modal.js) now lives in each + component's own shadow root (adoptedStyleSheets), not a global + stylesheet — nothing to @import here any more. */ /* ─── full-screen layout overrides ───────────────────────────────── The agent page mounts a full-viewport terminal under a fixed diff --git a/frontend/packages/dashboard/build.mjs b/frontend/packages/dashboard/build.mjs index 3306f8fe..7276a80a 100644 --- a/frontend/packages/dashboard/build.mjs +++ b/frontend/packages/dashboard/build.mjs @@ -74,6 +74,15 @@ await build({ target: ['es2022'], sourcemap: true, logLevel: 'info', + // `@hive/shared/modal.js` and `hive-btn.js` import their shadow-DOM + // component CSS (hive-dialog.css, hive-toast.css, hive-btn.css) as raw + // text via a plain `import css from './foo.css'` — the `text` loader turns + // that into a string constant at bundle time instead of erroring on an + // unrecognised extension. None of these JS entries import a `.css` + // file any other way, so this doesn't collide with the separate + // page-stylesheet bundling below (`loader: { '.css': 'css' }`), which + // runs as its own esbuild invocation over different entry points. + loader: { '.css': 'text' }, }); // Stream-worker entry (#448). Lives in a separate bundle: SharedWorker diff --git a/frontend/packages/dashboard/src/common.css b/frontend/packages/dashboard/src/common.css index ae16d272..8922df45 100644 --- a/frontend/packages/dashboard/src/common.css +++ b/frontend/packages/dashboard/src/common.css @@ -4,7 +4,6 @@ @import "@hive/shared/terminal.css"; @import "@hive/shared/tabs.css"; @import "@hive/shared/chrome.css"; -@import "@hive/shared/modal.css"; /* ─── global typography ───────────────────────────────────────────── Element-level rules shared across all three pages (index, flow, diff --git a/frontend/packages/shared/package.json b/frontend/packages/shared/package.json index 41ee6ede..333bcd63 100644 --- a/frontend/packages/shared/package.json +++ b/frontend/packages/shared/package.json @@ -17,8 +17,7 @@ "./chrome.css": "./src/chrome.css", "./forms.js": "./src/forms.js", "./dom.js": "./src/dom.js", - "./modal.js": "./src/modal.js", - "./modal.css": "./src/modal.css" + "./modal.js": "./src/modal.js" }, "files": [ "src/" diff --git a/frontend/packages/shared/src/dom.js b/frontend/packages/shared/src/dom.js index da314e69..b4b5f4ef 100644 --- a/frontend/packages/shared/src/dom.js +++ b/frontend/packages/shared/src/dom.js @@ -5,12 +5,18 @@ // used). // // `el(tag, attrs, ...children)` creates an element, applying `attrs` as -// either the `class`/`html` special cases or plain attributes, and +// either the `class`/`html`/`is` special cases or plain attributes, and // appending `children` (strings become text nodes, `null`/`undefined` // entries are skipped so callers can inline conditional children). +// `is: 'custom-name'` creates a customized built-in element (e.g. +// `el('button', { is: 'hive-btn' }, 'label')` → `