Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

move theme types to shared package

Abhinav121efa8c24b3
diff --git a/apps/photos/src/themes/types.ts b/apps/photos/src/themes/types.ts
deleted file mode 100644
index be03a6d0c2..0000000000
--- a/apps/photos/src/themes/types.ts
+++ /dev/null
@@ -1,204 +0,0 @@
-import { PaletteColor, PaletteColorOptions } from '@mui/material';
-import React from 'react';
-
-declare module '@mui/material/styles' {
- interface Theme {
- colors: ThemeColors;
- }
-
- interface ThemeOptions {
- colors?: ThemeColorsOptions;
- }
-
- interface Palette {
- accent: PaletteColor;
- critical: PaletteColor;
- }
-
- interface PaletteOptions {
- accent?: PaletteColorOptions;
- critical?: PaletteColorOptions;
- }
-
- interface TypeText {
- base: string;
- muted: string;
- faint: string;
- }
-
- interface TypographyVariants {
- large: React.CSSProperties;
- body: React.CSSProperties;
- small: React.CSSProperties;
- mini: React.CSSProperties;
- tiny: React.CSSProperties;
- }
- interface TypographyVariantsOptions {
- large?: React.CSSProperties;
- body?: React.CSSProperties;
- small?: React.CSSProperties;
- mini?: React.CSSProperties;
- tiny?: React.CSSProperties;
- }
-}
-
-declare module '@mui/material/Typography' {
- interface TypographyPropsVariantOverrides {
- large: true;
- body: true;
- small: true;
- mini: true;
- tiny: true;
- h4: false;
- h5: false;
- h6: false;
- subtitle1: false;
- subtitle2: false;
- body1: false;
- body2: false;
- caption: false;
- button: false;
- overline: false;
- }
-}
-
-declare module '@mui/material/Button' {
- interface ButtonPropsColorOverrides {
- accent: true;
- critical: true;
- error: false;
- success: false;
- info: false;
- warning: false;
- }
-}
-declare module '@mui/material/Checkbox' {
- interface CheckboxPropsColorOverrides {
- accent: true;
- critical: true;
- }
-}
-
-declare module '@mui/material/Switch' {
- interface SwitchPropsColorOverrides {
- accent: true;
- }
-}
-
-declare module '@mui/material/SvgIcon' {
- interface SvgIconPropsColorOverrides {
- accent: true;
- }
-}
-
-declare module '@mui/material/CircularProgress' {
- interface CircularProgressPropsColorOverrides {
- accent: true;
- }
-}
-
-// =================================================
-// Custom Interfaces
-// =================================================
-
-declare module '@mui/material/styles' {
- interface ThemeColors {
- background: BackgroundType;
- backdrop: Strength;
- text: Strength;
- fill: FillStrength;
- stroke: StrokeStrength;
- shadows: Shadows;
- accent: ColorStrength;
- warning: ColorStrength;
- danger: ColorStrength;
- blur: BlurStrength;
- white: Omit<Strength, 'faint'>;
- black: Omit<Strength, 'faint'>;
- avatarColors: AvatarColors;
- }
-
- interface ThemeColorsOptions {
- background?: Partial<BackgroundType>;
- backdrop?: Partial<Strength>;
- text?: Partial<Strength>;
- fill?: Partial<FillStrength>;
- stroke?: Partial<StrokeStrength>;
- shadows?: Partial<Shadows>;
- accent?: Partial<ColorStrength>;
- warning?: Partial<ColorStrength>;
- danger?: Partial<ColorStrength>;
- blur?: Partial<BlurStrength>;
- white?: Partial<Omit<Strength, 'faint'>>;
- black?: Partial<Omit<Strength, 'faint'>>;
- avatarColors?: Partial<AvatarColors>;
- }
-
- interface ColorStrength {
- A800: string;
- A700: string;
- A500: string;
- A400: string;
- A300: string;
- }
-
- interface FixedColors {
- accent: string;
- warning: string;
- danger: string;
- blur: number;
- white: string;
- black: string;
- }
-
- interface BackgroundType {
- base: string;
- elevated: string;
- elevated2: string;
- }
-
- interface Strength {
- base: string;
- muted: string;
- faint: string;
- }
-
- type FillStrength = Strength & StrengthFillPressed & StrengthFillStrong;
-
- interface StrengthFillPressed {
- basePressed: string;
- faintPressed: string;
- }
-
- interface StrengthFillStrong {
- strong: string;
- }
-
- type StrokeStrength = Strength & StrengthExtras;
-
- interface StrengthExtras {
- fainter: string;
- }
-
- interface Shadows {
- float: Shadow[];
- menu: Shadow[];
- button: Shadow[];
- }
-
- interface Shadow {
- x: number;
- y: number;
- blur: number;
- color: string;
- }
-
- interface BlurStrength {
- base: number;
- muted: number;
- faint: number;
- }
-
- type AvatarColors = Array<string>;
-}
-export {};
diff --git a/apps/photos/tsconfig.json b/apps/photos/tsconfig.json
index cb48924695..9eb9375675 100644
--- a/apps/photos/tsconfig.json
+++ b/apps/photos/tsconfig.json
@@ -13,6 +13,12 @@
"target": "es5",
"useUnknownInCatchVariables": false
},
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ "**/*.js",
+ "../../packages/shared/theme/mui-theme.d.ts"
+ ],
"exclude": ["node_modules", "out", ".next", "thirdparty"]
}
diff --git a/packages/accounts/tsconfig.json b/packages/accounts/tsconfig.json
index 0d15c40108..c683c0756d 100644
--- a/packages/accounts/tsconfig.json
+++ b/packages/accounts/tsconfig.json
@@ -16,6 +16,6 @@
"**/*.ts",
"**/*.tsx",
"**/*.js",
- "../mui-config/mui-theme.d.ts"
+ "../shared/theme/mui-theme.d.ts"
]
}
diff --git a/packages/mui-config/.eslintrc.js b/packages/mui-config/.eslintrc.js
deleted file mode 100644
index 6ca4594799..0000000000
--- a/packages/mui-config/.eslintrc.js
+++ /dev/null
@@ -1,9 +0,0 @@
-module.exports = {
- extends: ['@ente/eslint-config'],
- parser: '@typescript-eslint/parser',
- parserOptions: {
- tsconfigRootDir: __dirname,
- project: './tsconfig.json',
- },
- ignorePatterns: ['.eslintrc.js'],
-};
diff --git a/packages/mui-config/package.json b/packages/mui-config/package.json
deleted file mode 100644
index c0bed74946..0000000000
--- a/packages/mui-config/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "@ente/mui-config",
- "version": "0.0.0"
-}
diff --git a/packages/mui-config/tsconfig.json b/packages/mui-config/tsconfig.json
deleted file mode 100644
index 02ec15ac42..0000000000
--- a/packages/mui-config/tsconfig.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": "../../tsconfig.base.json"
-}
diff --git a/packages/mui-config/mui-theme.d.ts b/packages/shared/theme/mui-theme.d.ts
similarity index 100%
rename from packages/mui-config/mui-theme.d.ts
rename to packages/shared/theme/mui-theme.d.ts
diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json
index 0d15c40108..3943cf709d 100644
--- a/packages/shared/tsconfig.json
+++ b/packages/shared/tsconfig.json
@@ -12,10 +12,5 @@
"target": "es5",
"useUnknownInCatchVariables": false
},
- "include": [
- "**/*.ts",
- "**/*.tsx",
- "**/*.js",
- "../mui-config/mui-theme.d.ts"
- ]
+ "include": ["**/*.ts", "**/*.tsx", "**/*.js"]
}