Package Anidev Skill and standalone API panel integration
This commit is contained in:
1 parent
8e4e8e6ef0
commit
61b05abe44
43 files changed
+1859
-57
No files matched your search
@@ -0,0 +1,36 @@
|
||||
export { iconSvg, iconNames } from "../icons/icons.js";
|
||||
export { createNotifier } from "../components/toast.js";
|
||||
export {
|
||||
searchSelectMarkup,
|
||||
mountSearchSelect,
|
||||
} from "../components/search-select.js";
|
||||
export { mountCopyField } from "../components/copy-field.js";
|
||||
export { mountDock } from "../components/dock.js";
|
||||
export {
|
||||
mountNavigation,
|
||||
validateNavigation,
|
||||
} from "../components/navigation.js";
|
||||
import { tokensFor, cssVars } from "../concepts/registry.js";
|
||||
|
||||
/** Apply one document-wide Dock theme. Persistence belongs to the consuming app. */
|
||||
export function applyTheme({
|
||||
theme = "light",
|
||||
density = "normal",
|
||||
accent,
|
||||
} = {}) {
|
||||
if (!["light", "dark"].includes(theme)) throw new TypeError("Unknown theme");
|
||||
if (!["compact", "normal", "relaxed"].includes(density))
|
||||
throw new TypeError("Unknown density");
|
||||
if (accent !== undefined && !/^#[0-9a-f]{6}$/i.test(accent))
|
||||
throw new TypeError("Accent must be #RRGGBB");
|
||||
let style = document.querySelector("style[data-anidev-tokens]");
|
||||
if (!style) {
|
||||
style = document.createElement("style");
|
||||
style.dataset.anidevTokens = "";
|
||||
document.head.append(style);
|
||||
}
|
||||
style.textContent = `:root {${cssVars(tokensFor("dock", theme, accent, density))}}`;
|
||||
document.body.dataset.concept = "dock";
|
||||
document.body.dataset.theme = theme;
|
||||
document.body.dataset.density = density;
|
||||
}
|
||||
Reference in new issue
Block a user