From 4a3d9dc47745a4bf338390ca4426345450cec3c1 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Wed, 18 Feb 2026 11:11:16 -0600 Subject: [PATCH 1/2] refactor(themes): Moving QThemeMetaData out of core - into qqq-frontend-material-dashboard (as MaterialDashboardThemeMetaData) --- src/model/metaData/QInstance.ts | 7 - src/model/metaData/QThemeMetaData.ts | 312 -------------------- tests/model/metaData/QThemeMetaData.test.ts | 216 -------------- 3 files changed, 535 deletions(-) delete mode 100644 src/model/metaData/QThemeMetaData.ts delete mode 100644 tests/model/metaData/QThemeMetaData.test.ts diff --git a/src/model/metaData/QInstance.ts b/src/model/metaData/QInstance.ts index bc3b6c2..9d6dc81 100644 --- a/src/model/metaData/QInstance.ts +++ b/src/model/metaData/QInstance.ts @@ -27,7 +27,6 @@ import {QHelpContent} from "./QHelpContent"; import {QProcessMetaData} from "./QProcessMetaData"; import {QReportMetaData} from "./QReportMetaData"; import {QTableMetaData} from "./QTableMetaData"; -import {QThemeMetaData} from "./QThemeMetaData"; import {QWidgetMetaData} from "./QWidgetMetaData"; /******************************************************************************* @@ -43,7 +42,6 @@ export class QInstance apps?: Map; appTree?: QAppTreeNode[]; branding?: QBrandingMetaData; - theme?: QThemeMetaData; environmentValues?: Map; helpContent?: Map; supplementalInstanceMetaData: Map = new Map(); @@ -126,11 +124,6 @@ export class QInstance { this.supplementalInstanceMetaData.set(key, object.supplementalInstanceMetaData[key]); } - - if (object.supplementalInstanceMetaData["theme"]) - { - this.theme = new QThemeMetaData(object.supplementalInstanceMetaData["theme"]); - } } this.helpContent = QHelpContent.buildMap(object.helpContents); diff --git a/src/model/metaData/QThemeMetaData.ts b/src/model/metaData/QThemeMetaData.ts deleted file mode 100644 index b5d52aa..0000000 --- a/src/model/metaData/QThemeMetaData.ts +++ /dev/null @@ -1,312 +0,0 @@ -/* - * QQQ - Low-code Application Framework for Engineers. - * Copyright (C) 2021-2025. Kingsrook, LLC - * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States - * contact@kingsrook.com - * https://github.com/Kingsrook/ - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -/******************************************************************************* - ** Meta-Data to define theme configuration in a QQQ instance. - ** - *******************************************************************************/ -export class QThemeMetaData -{ - // Color palette - primaryColor?: string; - secondaryColor?: string; - backgroundColor?: string; - surfaceColor?: string; - textPrimary?: string; - textSecondary?: string; - errorColor?: string; - warningColor?: string; - successColor?: string; - infoColor?: string; - - // Typography - Base - fontFamily?: string; - headerFontFamily?: string; - monoFontFamily?: string; - fontSizeBase?: string; - fontWeightLight?: number; - fontWeightRegular?: number; - fontWeightMedium?: number; - fontWeightBold?: number; - - // Typography - H1 - typographyH1FontSize?: string; - typographyH1FontWeight?: number; - typographyH1LineHeight?: number; - typographyH1LetterSpacing?: string; - typographyH1TextTransform?: string; - - // Typography - H2 - typographyH2FontSize?: string; - typographyH2FontWeight?: number; - typographyH2LineHeight?: number; - typographyH2LetterSpacing?: string; - typographyH2TextTransform?: string; - - // Typography - H3 - typographyH3FontSize?: string; - typographyH3FontWeight?: number; - typographyH3LineHeight?: number; - typographyH3LetterSpacing?: string; - typographyH3TextTransform?: string; - - // Typography - H4 - typographyH4FontSize?: string; - typographyH4FontWeight?: number; - typographyH4LineHeight?: number; - typographyH4LetterSpacing?: string; - typographyH4TextTransform?: string; - - // Typography - H5 - typographyH5FontSize?: string; - typographyH5FontWeight?: number; - typographyH5LineHeight?: number; - typographyH5LetterSpacing?: string; - typographyH5TextTransform?: string; - - // Typography - H6 - typographyH6FontSize?: string; - typographyH6FontWeight?: number; - typographyH6LineHeight?: number; - typographyH6LetterSpacing?: string; - typographyH6TextTransform?: string; - - // Typography - Body1 - typographyBody1FontSize?: string; - typographyBody1FontWeight?: number; - typographyBody1LineHeight?: number; - typographyBody1LetterSpacing?: string; - typographyBody1TextTransform?: string; - - // Typography - Body2 - typographyBody2FontSize?: string; - typographyBody2FontWeight?: number; - typographyBody2LineHeight?: number; - typographyBody2LetterSpacing?: string; - typographyBody2TextTransform?: string; - - // Typography - Button - typographyButtonFontSize?: string; - typographyButtonFontWeight?: number; - typographyButtonLineHeight?: number; - typographyButtonLetterSpacing?: string; - typographyButtonTextTransform?: string; - - // Typography - Caption - typographyCaptionFontSize?: string; - typographyCaptionFontWeight?: number; - typographyCaptionLineHeight?: number; - typographyCaptionLetterSpacing?: string; - typographyCaptionTextTransform?: string; - - // Sizing - borderRadius?: string; - density?: "compact" | "normal" | "comfortable"; - - // Asset paths - logoPath?: string; - iconPath?: string; - faviconPath?: string; - - // Custom CSS - customCss?: string; - - // Icon style - iconStyle?: "filled" | "outlined" | "rounded" | "sharp" | "two-tone"; - - // Branded Header Bar - brandedHeaderEnabled?: boolean; - brandedHeaderBackgroundColor?: string; - brandedHeaderTextColor?: string; - brandedHeaderLogoPath?: string; - brandedHeaderLogoAltText?: string; - brandedHeaderHeight?: string; - brandedHeaderTagline?: string; - - // App Bar - appBarBackgroundColor?: string; - appBarTextColor?: string; - - // Sidebar - sidebarBackgroundColor?: string; - sidebarTextColor?: string; - sidebarIconColor?: string; - sidebarSelectedBackgroundColor?: string; - sidebarSelectedTextColor?: string; - sidebarHoverBackgroundColor?: string; - sidebarDividerColor?: string; - - // Tables - tableHeaderBackgroundColor?: string; - tableHeaderTextColor?: string; - tableRowHoverColor?: string; - tableRowSelectedColor?: string; - tableBorderColor?: string; - - // General - dividerColor?: string; - borderColor?: string; - cardBorderColor?: string; - - constructor(object: any) - { - // Color palette - this.primaryColor = object.primaryColor; - this.secondaryColor = object.secondaryColor; - this.backgroundColor = object.backgroundColor; - this.surfaceColor = object.surfaceColor; - this.textPrimary = object.textPrimary; - this.textSecondary = object.textSecondary; - this.errorColor = object.errorColor; - this.warningColor = object.warningColor; - this.successColor = object.successColor; - this.infoColor = object.infoColor; - - // Typography - Base - this.fontFamily = object.fontFamily; - this.headerFontFamily = object.headerFontFamily; - this.monoFontFamily = object.monoFontFamily; - this.fontSizeBase = object.fontSizeBase; - this.fontWeightLight = object.fontWeightLight; - this.fontWeightRegular = object.fontWeightRegular; - this.fontWeightMedium = object.fontWeightMedium; - this.fontWeightBold = object.fontWeightBold; - - // Typography - H1 - this.typographyH1FontSize = object.typographyH1FontSize; - this.typographyH1FontWeight = object.typographyH1FontWeight; - this.typographyH1LineHeight = object.typographyH1LineHeight; - this.typographyH1LetterSpacing = object.typographyH1LetterSpacing; - this.typographyH1TextTransform = object.typographyH1TextTransform; - - // Typography - H2 - this.typographyH2FontSize = object.typographyH2FontSize; - this.typographyH2FontWeight = object.typographyH2FontWeight; - this.typographyH2LineHeight = object.typographyH2LineHeight; - this.typographyH2LetterSpacing = object.typographyH2LetterSpacing; - this.typographyH2TextTransform = object.typographyH2TextTransform; - - // Typography - H3 - this.typographyH3FontSize = object.typographyH3FontSize; - this.typographyH3FontWeight = object.typographyH3FontWeight; - this.typographyH3LineHeight = object.typographyH3LineHeight; - this.typographyH3LetterSpacing = object.typographyH3LetterSpacing; - this.typographyH3TextTransform = object.typographyH3TextTransform; - - // Typography - H4 - this.typographyH4FontSize = object.typographyH4FontSize; - this.typographyH4FontWeight = object.typographyH4FontWeight; - this.typographyH4LineHeight = object.typographyH4LineHeight; - this.typographyH4LetterSpacing = object.typographyH4LetterSpacing; - this.typographyH4TextTransform = object.typographyH4TextTransform; - - // Typography - H5 - this.typographyH5FontSize = object.typographyH5FontSize; - this.typographyH5FontWeight = object.typographyH5FontWeight; - this.typographyH5LineHeight = object.typographyH5LineHeight; - this.typographyH5LetterSpacing = object.typographyH5LetterSpacing; - this.typographyH5TextTransform = object.typographyH5TextTransform; - - // Typography - H6 - this.typographyH6FontSize = object.typographyH6FontSize; - this.typographyH6FontWeight = object.typographyH6FontWeight; - this.typographyH6LineHeight = object.typographyH6LineHeight; - this.typographyH6LetterSpacing = object.typographyH6LetterSpacing; - this.typographyH6TextTransform = object.typographyH6TextTransform; - - // Typography - Body1 - this.typographyBody1FontSize = object.typographyBody1FontSize; - this.typographyBody1FontWeight = object.typographyBody1FontWeight; - this.typographyBody1LineHeight = object.typographyBody1LineHeight; - this.typographyBody1LetterSpacing = object.typographyBody1LetterSpacing; - this.typographyBody1TextTransform = object.typographyBody1TextTransform; - - // Typography - Body2 - this.typographyBody2FontSize = object.typographyBody2FontSize; - this.typographyBody2FontWeight = object.typographyBody2FontWeight; - this.typographyBody2LineHeight = object.typographyBody2LineHeight; - this.typographyBody2LetterSpacing = object.typographyBody2LetterSpacing; - this.typographyBody2TextTransform = object.typographyBody2TextTransform; - - // Typography - Button - this.typographyButtonFontSize = object.typographyButtonFontSize; - this.typographyButtonFontWeight = object.typographyButtonFontWeight; - this.typographyButtonLineHeight = object.typographyButtonLineHeight; - this.typographyButtonLetterSpacing = object.typographyButtonLetterSpacing; - this.typographyButtonTextTransform = object.typographyButtonTextTransform; - - // Typography - Caption - this.typographyCaptionFontSize = object.typographyCaptionFontSize; - this.typographyCaptionFontWeight = object.typographyCaptionFontWeight; - this.typographyCaptionLineHeight = object.typographyCaptionLineHeight; - this.typographyCaptionLetterSpacing = object.typographyCaptionLetterSpacing; - this.typographyCaptionTextTransform = object.typographyCaptionTextTransform; - - // Sizing - this.borderRadius = object.borderRadius; - this.density = object.density; - - // Asset paths - this.logoPath = object.logoPath; - this.iconPath = object.iconPath; - this.faviconPath = object.faviconPath; - - // Custom CSS - this.customCss = object.customCss; - - // Icon style - this.iconStyle = object.iconStyle; - - // Branded Header Bar - this.brandedHeaderEnabled = object.brandedHeaderEnabled; - this.brandedHeaderBackgroundColor = object.brandedHeaderBackgroundColor; - this.brandedHeaderTextColor = object.brandedHeaderTextColor; - this.brandedHeaderLogoPath = object.brandedHeaderLogoPath; - this.brandedHeaderLogoAltText = object.brandedHeaderLogoAltText; - this.brandedHeaderHeight = object.brandedHeaderHeight; - this.brandedHeaderTagline = object.brandedHeaderTagline; - - // App Bar - this.appBarBackgroundColor = object.appBarBackgroundColor; - this.appBarTextColor = object.appBarTextColor; - - // Sidebar - this.sidebarBackgroundColor = object.sidebarBackgroundColor; - this.sidebarTextColor = object.sidebarTextColor; - this.sidebarIconColor = object.sidebarIconColor; - this.sidebarSelectedBackgroundColor = object.sidebarSelectedBackgroundColor; - this.sidebarSelectedTextColor = object.sidebarSelectedTextColor; - this.sidebarHoverBackgroundColor = object.sidebarHoverBackgroundColor; - this.sidebarDividerColor = object.sidebarDividerColor; - - // Tables - this.tableHeaderBackgroundColor = object.tableHeaderBackgroundColor; - this.tableHeaderTextColor = object.tableHeaderTextColor; - this.tableRowHoverColor = object.tableRowHoverColor; - this.tableRowSelectedColor = object.tableRowSelectedColor; - this.tableBorderColor = object.tableBorderColor; - - // General - this.dividerColor = object.dividerColor; - this.borderColor = object.borderColor; - this.cardBorderColor = object.cardBorderColor; - } -} diff --git a/tests/model/metaData/QThemeMetaData.test.ts b/tests/model/metaData/QThemeMetaData.test.ts deleted file mode 100644 index 40071af..0000000 --- a/tests/model/metaData/QThemeMetaData.test.ts +++ /dev/null @@ -1,216 +0,0 @@ -/* - * QQQ - Low-code Application Framework for Engineers. - * Copyright (C) 2021-2025. Kingsrook, LLC - * 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States - * contact@kingsrook.com - * https://github.com/Kingsrook/ - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -import {QThemeMetaData} from "../../../src/model/metaData/QThemeMetaData"; - -describe("QThemeMetaData", () => -{ - describe("constructor", () => - { - it("should construct with all properties from object", () => - { - const theme = new QThemeMetaData({ - primaryColor: "#FF0000", - secondaryColor: "#00FF00", - backgroundColor: "#0000FF", - surfaceColor: "#FFFFFF", - textPrimary: "#000000", - textSecondary: "#666666", - errorColor: "#FF0000", - warningColor: "#FFA500", - successColor: "#00FF00", - infoColor: "#0000FF", - fontFamily: "Roboto", - headerFontFamily: "Open Sans", - borderRadius: "8px", - density: "compact", - logoPath: "/assets/logo.svg", - iconPath: "/assets/icon.svg", - faviconPath: "/assets/favicon.ico", - customCss: "body { margin: 0; }", - iconStyle: "outlined" - }); - - expect(theme.primaryColor).toBe("#FF0000"); - expect(theme.secondaryColor).toBe("#00FF00"); - expect(theme.backgroundColor).toBe("#0000FF"); - expect(theme.surfaceColor).toBe("#FFFFFF"); - expect(theme.textPrimary).toBe("#000000"); - expect(theme.textSecondary).toBe("#666666"); - expect(theme.errorColor).toBe("#FF0000"); - expect(theme.warningColor).toBe("#FFA500"); - expect(theme.successColor).toBe("#00FF00"); - expect(theme.infoColor).toBe("#0000FF"); - expect(theme.fontFamily).toBe("Roboto"); - expect(theme.headerFontFamily).toBe("Open Sans"); - expect(theme.borderRadius).toBe("8px"); - expect(theme.density).toBe("compact"); - expect(theme.logoPath).toBe("/assets/logo.svg"); - expect(theme.iconPath).toBe("/assets/icon.svg"); - expect(theme.faviconPath).toBe("/assets/favicon.ico"); - expect(theme.customCss).toBe("body { margin: 0; }"); - expect(theme.iconStyle).toBe("outlined"); - }); - - it("should handle empty object", () => - { - const theme = new QThemeMetaData({}); - - expect(theme.primaryColor).toBeUndefined(); - expect(theme.secondaryColor).toBeUndefined(); - expect(theme.backgroundColor).toBeUndefined(); - expect(theme.surfaceColor).toBeUndefined(); - expect(theme.textPrimary).toBeUndefined(); - expect(theme.textSecondary).toBeUndefined(); - expect(theme.errorColor).toBeUndefined(); - expect(theme.warningColor).toBeUndefined(); - expect(theme.successColor).toBeUndefined(); - expect(theme.infoColor).toBeUndefined(); - expect(theme.fontFamily).toBeUndefined(); - expect(theme.headerFontFamily).toBeUndefined(); - expect(theme.borderRadius).toBeUndefined(); - expect(theme.density).toBeUndefined(); - expect(theme.logoPath).toBeUndefined(); - expect(theme.iconPath).toBeUndefined(); - expect(theme.faviconPath).toBeUndefined(); - expect(theme.customCss).toBeUndefined(); - expect(theme.iconStyle).toBeUndefined(); - }); - - it("should handle partial object", () => - { - const theme = new QThemeMetaData({ - primaryColor: "#FF0000", - density: "normal" - }); - - expect(theme.primaryColor).toBe("#FF0000"); - expect(theme.density).toBe("normal"); - expect(theme.secondaryColor).toBeUndefined(); - expect(theme.iconStyle).toBeUndefined(); - }); - }); - - describe("density type", () => - { - it("should accept compact density", () => - { - const theme = new QThemeMetaData({density: "compact"}); - expect(theme.density).toBe("compact"); - }); - - it("should accept normal density", () => - { - const theme = new QThemeMetaData({density: "normal"}); - expect(theme.density).toBe("normal"); - }); - - it("should accept comfortable density", () => - { - const theme = new QThemeMetaData({density: "comfortable"}); - expect(theme.density).toBe("comfortable"); - }); - }); - - describe("iconStyle type", () => - { - it("should accept filled iconStyle", () => - { - const theme = new QThemeMetaData({iconStyle: "filled"}); - expect(theme.iconStyle).toBe("filled"); - }); - - it("should accept outlined iconStyle", () => - { - const theme = new QThemeMetaData({iconStyle: "outlined"}); - expect(theme.iconStyle).toBe("outlined"); - }); - - it("should accept rounded iconStyle", () => - { - const theme = new QThemeMetaData({iconStyle: "rounded"}); - expect(theme.iconStyle).toBe("rounded"); - }); - - it("should accept sharp iconStyle", () => - { - const theme = new QThemeMetaData({iconStyle: "sharp"}); - expect(theme.iconStyle).toBe("sharp"); - }); - - it("should accept two-tone iconStyle", () => - { - const theme = new QThemeMetaData({iconStyle: "two-tone"}); - expect(theme.iconStyle).toBe("two-tone"); - }); - }); - - describe("color properties", () => - { - it("should handle hex color formats", () => - { - const theme = new QThemeMetaData({ - primaryColor: "#F00", - secondaryColor: "#00FF00", - errorColor: "#FF0000FF" - }); - - expect(theme.primaryColor).toBe("#F00"); - expect(theme.secondaryColor).toBe("#00FF00"); - expect(theme.errorColor).toBe("#FF0000FF"); - }); - }); - - describe("asset paths", () => - { - it("should handle various path formats", () => - { - const theme = new QThemeMetaData({ - logoPath: "/assets/logo.svg", - iconPath: "https://example.com/icon.png", - faviconPath: "./favicon.ico" - }); - - expect(theme.logoPath).toBe("/assets/logo.svg"); - expect(theme.iconPath).toBe("https://example.com/icon.png"); - expect(theme.faviconPath).toBe("./favicon.ico"); - }); - }); - - describe("customCss", () => - { - it("should handle multi-line CSS", () => - { - const css = ` - body { - margin: 0; - padding: 0; - } - .custom-class { - color: red; - } - `; - const theme = new QThemeMetaData({customCss: css}); - - expect(theme.customCss).toBe(css); - }); - }); -}); -- 2.54.0 From 5464627053a45197dad9a8e28d757be90d585da9 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Wed, 18 Feb 2026 11:11:33 -0600 Subject: [PATCH 2/2] feat(themes): Add accentColorLight and gravatarDefault attributes --- src/model/metaData/QBrandingMetaData.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/model/metaData/QBrandingMetaData.ts b/src/model/metaData/QBrandingMetaData.ts index a065efc..ea5db58 100644 --- a/src/model/metaData/QBrandingMetaData.ts +++ b/src/model/metaData/QBrandingMetaData.ts @@ -33,6 +33,8 @@ export class QBrandingMetaData logo?: string; icon?: string; accentColor?: string; + accentColorLight?: string; + gravatarDefault?: string; // Deprecated environmentBannerText?: string; @@ -50,6 +52,8 @@ export class QBrandingMetaData this.logo = object.logo; this.icon = object.icon; this.accentColor = object.accentColor; + this.accentColorLight = object.accentColorLight; + this.gravatarDefault = object.gravatarDefault; this.environmentBannerText = object.environmentBannerText; this.environmentBannerColor = object.environmentBannerColor; -- 2.54.0