fix(a2ui): improve modal styling

This commit is contained in:
Peter Steinberger
2025-12-20 11:12:11 +00:00
parent cd5809d11f
commit 13124542cf
3 changed files with 72 additions and 0 deletions

View File

@@ -17566,6 +17566,27 @@ function instanceOf(tagName) {
//#endregion
//#region apps/shared/ClawdisKit/Tools/CanvasA2UI/bootstrap.js
const modalStyles = i`
dialog {
padding: 24px;
border: none;
background: none;
display: flex;
align-items: center;
justify-content: center;
max-width: calc(100vw - 32px);
max-height: calc(100vh - 32px);
}
dialog::backdrop {
background: rgba(5, 8, 16, 0.65);
backdrop-filter: blur(6px);
}
`;
const modalElement = customElements.get("a2ui-modal");
if (modalElement && Array.isArray(modalElement.styles)) {
modalElement.styles = [...modalElement.styles, modalStyles];
}
const empty = Object.freeze({});
const emptyClasses = () => ({});
const textHintStyles = () => ({
@@ -17689,6 +17710,14 @@ const clawdisTheme = {
padding: "14px",
boxShadow: cardShadow
},
Modal: {
background: "rgba(12, 16, 24, 0.92)",
border: "1px solid rgba(255,255,255,.12)",
borderRadius: "16px",
padding: "16px",
boxShadow: "0 30px 80px rgba(0,0,0,.6)",
width: "min(520px, calc(100vw - 48px))"
},
Column: { gap: "10px" },
Row: {
gap: "10px",

View File

@@ -52,4 +52,16 @@ import Testing
#expect(js.contains("blur(${r(statusBlur)})"))
#expect(js.contains("box-shadow: ${r(statusShadow)}"))
}
@Test func a2uiBundleStylesModalBackdrop() throws {
guard let url = ClawdisKitResources.bundle.url(forResource: "a2ui.bundle", withExtension: "js")
else {
throw NSError(domain: "Tests", code: 1, userInfo: [
NSLocalizedDescriptionKey: "Missing resource a2ui.bundle.js",
])
}
let js = try String(contentsOf: url, encoding: .utf8)
#expect(js.contains("::backdrop"))
#expect(js.contains("backdrop-filter: blur(6px)"))
}
}

View File

@@ -6,6 +6,29 @@ import { v0_8 } from "@a2ui/lit";
import "@a2ui/lit/ui";
import { themeContext } from "@clawdis/a2ui-theme-context";
const modalStyles = css`
dialog {
padding: 24px;
border: none;
background: none;
display: flex;
align-items: center;
justify-content: center;
max-width: calc(100vw - 32px);
max-height: calc(100vh - 32px);
}
dialog::backdrop {
background: rgba(5, 8, 16, 0.65);
backdrop-filter: blur(6px);
}
`;
const modalElement = customElements.get("a2ui-modal");
if (modalElement && Array.isArray(modalElement.styles)) {
modalElement.styles = [...modalElement.styles, modalStyles];
}
const empty = Object.freeze({});
const emptyClasses = () => ({});
const textHintStyles = () => ({ h1: {}, h2: {}, h3: {}, h4: {}, h5: {}, body: {}, caption: {} });
@@ -93,6 +116,14 @@ const clawdisTheme = {
padding: "14px",
boxShadow: cardShadow,
},
Modal: {
background: "rgba(12, 16, 24, 0.92)",
border: "1px solid rgba(255,255,255,.12)",
borderRadius: "16px",
padding: "16px",
boxShadow: "0 30px 80px rgba(0,0,0,.6)",
width: "min(520px, calc(100vw - 48px))",
},
Column: { gap: "10px" },
Row: { gap: "10px", alignItems: "center" },
Divider: { opacity: "0.25" },