Fixes #15007 /ok-to-test tags="@tag.Theme" <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10733545727> > Commit: dec21477152095d034f63a7e08d2719cb0687b12 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10733545727&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Theme` > Spec: > <hr>Fri, 06 Sep 2024 06:48:00 UTC <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced theme validation for the multi-select widget, improving the robustness of theme-related tests. - Added new locators for featured themes to enhance testing capabilities. - **Bug Fixes** - Reactivated a previously skipped test case to validate font consistency across the application. - **Refactor** - Optimized color change handling in the ColorPicker component for better performance and reliability. - Refactored theme color control logic for improved maintainability and clarity. - **Improvements** - Enhanced type safety in theme properties to prevent misconfigurations. - Improved testability of the ThemeCard and ThemeSelector components with new attributes for automated testing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
93 lines
1.8 KiB
TypeScript
93 lines
1.8 KiB
TypeScript
type DefaultStylesheet = {
|
|
[key: string]: string | DefaultStylesheet;
|
|
} & {
|
|
childStylesheet?: AppThemeStylesheet;
|
|
};
|
|
|
|
export type Stylesheet<T = void> = T extends void
|
|
? DefaultStylesheet
|
|
: T & DefaultStylesheet;
|
|
|
|
export interface AppThemeStylesheet {
|
|
[key: string]: Stylesheet;
|
|
}
|
|
|
|
export interface ButtonStyles {
|
|
resetButtonStyles: {
|
|
[key: string]: string;
|
|
};
|
|
submitButtonStyles: {
|
|
[key: string]: string;
|
|
};
|
|
}
|
|
|
|
export interface ChildStylesheet {
|
|
childStylesheet: AppThemeStylesheet;
|
|
}
|
|
|
|
export interface AppTheme {
|
|
id: string;
|
|
name: string;
|
|
displayName: string;
|
|
created_by: string;
|
|
created_at: string;
|
|
isSystemTheme?: boolean;
|
|
// available values for particular type
|
|
// NOTE: config represents options available and
|
|
// properties represents the selected option
|
|
config: {
|
|
order: number;
|
|
isDeprecated?: boolean;
|
|
colors: {
|
|
primaryColor: string;
|
|
backgroundColor: string;
|
|
[key: string]: string;
|
|
};
|
|
borderRadius: {
|
|
[key: string]: {
|
|
[key: string]: string;
|
|
};
|
|
};
|
|
boxShadow: {
|
|
[key: string]: {
|
|
[key: string]: string;
|
|
};
|
|
};
|
|
fontFamily: {
|
|
[key: string]: string[];
|
|
};
|
|
};
|
|
// styles for specific widgets
|
|
stylesheet: AppThemeStylesheet;
|
|
// current values for the theme
|
|
properties: AppThemeProperties;
|
|
}
|
|
|
|
export interface AppThemeProperties {
|
|
colors: {
|
|
primaryColor: string;
|
|
backgroundColor: string;
|
|
[key: Exclude<string, number>]: string;
|
|
};
|
|
borderRadius: {
|
|
[key: string]: string;
|
|
};
|
|
boxShadow: {
|
|
[key: string]: string;
|
|
};
|
|
fontFamily: {
|
|
[key: string]: string;
|
|
};
|
|
}
|
|
|
|
export interface SetterConfig {
|
|
__setters: {
|
|
[key: string]: {
|
|
path: string;
|
|
type: string;
|
|
disabled?: string;
|
|
accessor?: string;
|
|
};
|
|
};
|
|
}
|