@udixio/theme 1.0.0-beta.6 → 1.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.service.d.ts +6 -3
- package/dist/color/color.interface.d.ts +1 -2
- package/dist/color/entities/color.entity.d.ts +6 -1
- package/dist/color/index.d.ts +1 -2
- package/dist/color/models/default-color.model.d.ts +2 -3
- package/dist/color/services/color-manager.service.d.ts +18 -0
- package/dist/color/services/color.service.d.ts +21 -0
- package/dist/color/services/index.d.ts +2 -0
- package/dist/config/config.interface.d.ts +14 -0
- package/dist/config/config.module.d.ts +2 -0
- package/dist/config/config.service.d.ts +12 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/main.d.ts +2 -1
- package/dist/plugin/plugin.abstract.d.ts +6 -0
- package/dist/plugin/plugin.module.d.ts +2 -0
- package/dist/plugin/plugin.service.d.ts +9 -0
- package/dist/theme/entities/variant.entity.d.ts +2 -1
- package/dist/theme/services/scheme.service.d.ts +7 -2
- package/dist/theme/services/theme.service.d.ts +10 -4
- package/dist/theme/services/variant.service.d.ts +4 -0
- package/dist/theme.cjs.development.js +1077 -506
- package/dist/theme.cjs.development.js.map +1 -1
- package/dist/theme.cjs.production.min.js +1 -1
- package/dist/theme.cjs.production.min.js.map +1 -1
- package/dist/theme.esm.js +1073 -507
- package/dist/theme.esm.js.map +1 -1
- package/package.json +3 -5
- package/src/app.container.ts +9 -1
- package/src/app.service.ts +8 -2
- package/src/color/color.interface.ts +1 -3
- package/src/color/color.module.ts +2 -2
- package/src/color/entities/color.entity.ts +13 -1
- package/src/color/index.ts +1 -2
- package/src/color/models/default-color.model.ts +205 -202
- package/src/color/{color-manager.service.ts → services/color-manager.service.ts} +17 -10
- package/src/color/{color.service.spec.ts → services/color.service.spec.ts} +1 -1
- package/src/color/{color.service.ts → services/color.service.ts} +33 -21
- package/src/color/services/index.ts +2 -0
- package/src/config/config.interface.ts +15 -0
- package/src/config/config.module.ts +7 -0
- package/src/config/config.service.ts +68 -0
- package/src/config/index.ts +2 -0
- package/src/index.ts +3 -0
- package/src/main.ts +9 -1
- package/src/plugin/plugin.abstract.ts +7 -0
- package/src/plugin/plugin.module.ts +7 -0
- package/src/plugin/plugin.service.ts +26 -0
- package/src/theme/entities/variant.entity.ts +2 -1
- package/src/theme/models/variant.model.ts +7 -0
- package/src/theme/services/scheme.service.ts +39 -9
- package/src/theme/services/theme.service.ts +18 -8
- package/src/theme/services/variant.service.ts +36 -2
- package/dist/color/color-manager.service.d.ts +0 -17
- package/dist/color/color.service.d.ts +0 -16
package/dist/app.service.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { ColorService } from './color
|
|
2
|
-
import { ThemeService } from './theme
|
|
1
|
+
import { ColorService } from './color';
|
|
2
|
+
import { ThemeService } from './theme';
|
|
3
|
+
import { PluginService } from './plugin/plugin.service';
|
|
3
4
|
export declare class AppService {
|
|
4
5
|
colorService: ColorService;
|
|
5
6
|
themeService: ThemeService;
|
|
6
|
-
|
|
7
|
+
pluginService: PluginService;
|
|
8
|
+
constructor({ colorService, themeService, pluginService, }: {
|
|
7
9
|
colorService: ColorService;
|
|
8
10
|
themeService: ThemeService;
|
|
11
|
+
pluginService: PluginService;
|
|
9
12
|
});
|
|
10
13
|
}
|
|
@@ -4,6 +4,5 @@ export interface ColorInterface {
|
|
|
4
4
|
removeColor(key: string): boolean;
|
|
5
5
|
getColor(key: string): ColorEntity;
|
|
6
6
|
updateColor(key: string, newColor: ColorOptions): ColorEntity;
|
|
7
|
-
|
|
8
|
-
addColors(colors: Record<string, ColorOptions>): ColorEntity[];
|
|
7
|
+
getColors(): ReadonlyMap<string, ColorEntity>;
|
|
9
8
|
}
|
|
@@ -3,7 +3,7 @@ import { SchemeEntity } from '../../theme/entities/scheme.entity';
|
|
|
3
3
|
import { DynamicColor } from '../../material-color-utilities/dynamic_color';
|
|
4
4
|
import { ContrastCurve } from '../../material-color-utilities';
|
|
5
5
|
import { SchemeService } from '../../theme/services/scheme.service';
|
|
6
|
-
import { ColorManagerService } from '../color-manager.service';
|
|
6
|
+
import { ColorManagerService } from '../services/color-manager.service';
|
|
7
7
|
export interface ColorOptions {
|
|
8
8
|
palette: (scheme: SchemeEntity) => TonalPalette;
|
|
9
9
|
tone: (scheme: SchemeEntity) => number;
|
|
@@ -32,6 +32,11 @@ export declare class ColorEntity {
|
|
|
32
32
|
}>): void;
|
|
33
33
|
getHex(): string;
|
|
34
34
|
getArgb(): number;
|
|
35
|
+
getRgb(): {
|
|
36
|
+
r: number;
|
|
37
|
+
g: number;
|
|
38
|
+
b: number;
|
|
39
|
+
};
|
|
35
40
|
getName(): string;
|
|
36
41
|
getDynamicColor(): DynamicColor;
|
|
37
42
|
}
|
package/dist/color/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ColorManagerService } from '../color-manager.service';
|
|
1
|
+
import { AddColorsOptions } from '../services/color.service';
|
|
3
2
|
export type DynamicColorKey = 'background' | 'onBackground' | 'surface' | 'surfaceDim' | 'surfaceBright' | 'surfaceContainerLowest' | 'surfaceContainerLow' | 'surfaceContainer' | 'surfaceContainerHigh' | 'surfaceContainerHighest' | 'onSurface' | 'surfaceVariant' | 'onSurfaceVariant' | 'inverseSurface' | 'inverseOnSurface' | 'outline' | 'outlineVariant' | 'shadow' | 'scrim' | 'surfaceTint' | 'primary' | 'onPrimary' | 'primaryContainer' | 'onPrimaryContainer' | 'inversePrimary' | 'secondary' | 'onSecondary' | 'secondaryContainer' | 'onSecondaryContainer' | 'tertiary' | 'onTertiary' | 'tertiaryContainer' | 'onTertiaryContainer' | 'error' | 'onError' | 'errorContainer' | 'onErrorContainer' | 'primaryFixed' | 'primaryFixedDim' | 'onPrimaryFixed' | 'onPrimaryFixedVariant' | 'secondaryFixed' | 'secondaryFixedDim' | 'onSecondaryFixed' | 'onSecondaryFixedVariant' | 'tertiaryFixed' | 'tertiaryFixedDim' | 'onTertiaryFixed' | 'onTertiaryFixedVariant';
|
|
4
|
-
export declare const defaultColors:
|
|
3
|
+
export declare const defaultColors: AddColorsOptions;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DynamicColor } from '../../material-color-utilities/dynamic_color';
|
|
2
|
+
import { SchemeEntity } from '../../theme/entities/scheme.entity';
|
|
3
|
+
import { ColorEntity, ColorOptions } from '../entities/color.entity';
|
|
4
|
+
import { SchemeService } from '../../theme/services/scheme.service';
|
|
5
|
+
import { ColorService } from './color.service';
|
|
6
|
+
export declare const highestSurface: (s: SchemeEntity, colorService: ColorManagerService | ColorService) => DynamicColor;
|
|
7
|
+
export declare class ColorManagerService {
|
|
8
|
+
private colorMap;
|
|
9
|
+
private readonly schemeService;
|
|
10
|
+
constructor({ schemeService }: {
|
|
11
|
+
schemeService: SchemeService;
|
|
12
|
+
});
|
|
13
|
+
createOrUpdate(key: string, args: Partial<ColorOptions>): ColorEntity;
|
|
14
|
+
remove(key: string): boolean;
|
|
15
|
+
get(key: string): ColorEntity;
|
|
16
|
+
getAll(): ReadonlyMap<string, ColorEntity>;
|
|
17
|
+
addFromPalette(key: string): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ColorManagerService } from './color-manager.service';
|
|
2
|
+
import { ColorInterface } from '../color.interface';
|
|
3
|
+
import { ColorEntity, ColorOptions } from '../entities';
|
|
4
|
+
type AddColors = {
|
|
5
|
+
colors?: Record<string, Partial<ColorOptions>>;
|
|
6
|
+
fromPalettes?: string[] | string;
|
|
7
|
+
};
|
|
8
|
+
export type AddColorsOptions = AddColors | ((colorService: ColorService) => AddColors);
|
|
9
|
+
export declare class ColorService implements ColorInterface {
|
|
10
|
+
private readonly colorManagerService;
|
|
11
|
+
constructor({ colorManagerService, }: {
|
|
12
|
+
colorManagerService: ColorManagerService;
|
|
13
|
+
});
|
|
14
|
+
getColors(): ReadonlyMap<string, ColorEntity>;
|
|
15
|
+
addColor(key: string, color: Partial<ColorOptions>): ColorEntity;
|
|
16
|
+
addColors(args: AddColorsOptions | AddColorsOptions[]): void;
|
|
17
|
+
getColor(key: string): ColorEntity;
|
|
18
|
+
removeColor(key: string): boolean;
|
|
19
|
+
updateColor(key: string, newColor: Partial<ColorOptions>): ColorEntity;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VariantEntity } from '../theme';
|
|
2
|
+
import { AddColorsOptions } from '../color';
|
|
3
|
+
import { PluginAbstract } from '../plugin/plugin.abstract';
|
|
4
|
+
import { AppService } from '../app.service';
|
|
5
|
+
export interface ConfigInterface {
|
|
6
|
+
sourceColor: string;
|
|
7
|
+
contrastLevel?: 0;
|
|
8
|
+
isDark?: boolean;
|
|
9
|
+
variant?: VariantEntity;
|
|
10
|
+
colors?: AddColorsOptions | AddColorsOptions[];
|
|
11
|
+
useDefaultColors?: boolean;
|
|
12
|
+
palettes?: Record<string, string>;
|
|
13
|
+
plugins?: (new (appService: AppService) => PluginAbstract)[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigInterface } from './config.interface';
|
|
2
|
+
import { AppService } from '../app.service';
|
|
3
|
+
export declare function defineConfig(configObject: ConfigInterface): ConfigInterface;
|
|
4
|
+
export declare class ConfigService {
|
|
5
|
+
configPath: string;
|
|
6
|
+
private appService;
|
|
7
|
+
constructor({ appService }: {
|
|
8
|
+
appService: AppService;
|
|
9
|
+
});
|
|
10
|
+
loadConfig(): Promise<void>;
|
|
11
|
+
private getConfig;
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export { default as AppContainer } from './app.container';
|
|
1
2
|
export * from './app.container';
|
|
3
|
+
export * from './app.module';
|
|
2
4
|
export * from './app.service';
|
|
3
5
|
export * from './color';
|
|
6
|
+
export * from './config';
|
|
4
7
|
export * from './main';
|
|
5
8
|
export * from './material-color-utilities';
|
|
6
9
|
export * from './theme';
|
package/dist/main.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginAbstract } from './plugin.abstract';
|
|
2
|
+
import { AppService } from '../app.service';
|
|
3
|
+
export declare class PluginService {
|
|
4
|
+
private pluginInstances;
|
|
5
|
+
private pluginConstructors;
|
|
6
|
+
addPlugin(plugin: new (appService: AppService) => PluginAbstract): void;
|
|
7
|
+
loadPlugins(appService: AppService): void;
|
|
8
|
+
getPlugin<T extends PluginAbstract>(plugin: new (appService: AppService) => T): T | undefined;
|
|
9
|
+
}
|
|
@@ -2,5 +2,6 @@ import { Hct, TonalPalette } from '@material/material-color-utilities';
|
|
|
2
2
|
export declare const getRotatedHue: (sourceColor: Hct, hues: number[], rotations: number[]) => number;
|
|
3
3
|
export declare class VariantEntity {
|
|
4
4
|
palettes: Record<string, (sourceColorHct: Hct) => TonalPalette>;
|
|
5
|
-
|
|
5
|
+
customPalettes?: ((colorHct: Hct) => TonalPalette) | undefined;
|
|
6
|
+
constructor(palettes?: Record<string, (sourceColorHct: Hct) => TonalPalette>, customPalettes?: ((colorHct: Hct) => TonalPalette) | undefined);
|
|
6
7
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { SchemeEntity, SchemeOptions } from '../entities/scheme.entity';
|
|
2
2
|
import { Hct, TonalPalette } from '@material/material-color-utilities';
|
|
3
3
|
export type SchemeServiceOptions = Omit<SchemeOptions, 'palettes' | 'sourceColorArgb'> & {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
sourcesColorHex: Record<string, string> & {
|
|
5
|
+
primary?: string;
|
|
6
|
+
};
|
|
7
|
+
palettes: Record<string, {
|
|
8
|
+
sourceColorkey?: string;
|
|
9
|
+
tonalPalette: (sourceColorHct: Hct) => TonalPalette;
|
|
10
|
+
}>;
|
|
6
11
|
};
|
|
7
12
|
export declare class SchemeService {
|
|
8
13
|
private schemeEntity?;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SchemeService, SchemeServiceOptions } from './scheme.service';
|
|
2
2
|
import { VariantService } from './variant.service';
|
|
3
3
|
import { VariantEntity } from '../entities/variant.entity';
|
|
4
|
-
type ThemeOptions = Omit<SchemeServiceOptions, 'palettes'
|
|
4
|
+
type ThemeOptions = Omit<SchemeServiceOptions, 'palettes' | 'sourcesColorHex'> & {
|
|
5
|
+
sourceColorHex: string;
|
|
6
|
+
};
|
|
5
7
|
export declare class ThemeService {
|
|
6
8
|
private readonly schemeService;
|
|
7
9
|
private readonly variantService;
|
|
@@ -9,8 +11,12 @@ export declare class ThemeService {
|
|
|
9
11
|
schemeService: SchemeService;
|
|
10
12
|
variantService: VariantService;
|
|
11
13
|
});
|
|
12
|
-
create(options: ThemeOptions
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
create(options: ThemeOptions & {
|
|
15
|
+
variant: VariantEntity;
|
|
16
|
+
}): void;
|
|
17
|
+
update(options: Partial<ThemeOptions> & {
|
|
18
|
+
variant?: VariantEntity;
|
|
19
|
+
}): void;
|
|
20
|
+
addCustomPalette(key: string, colorHex: string): void;
|
|
15
21
|
}
|
|
16
22
|
export {};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { SchemeService } from './scheme.service';
|
|
2
2
|
import { VariantEntity } from '../entities/variant.entity';
|
|
3
3
|
export declare class VariantService {
|
|
4
|
+
customPalettes: Record<string, string>;
|
|
5
|
+
private variantEntity?;
|
|
4
6
|
private readonly schemeService;
|
|
5
7
|
constructor({ schemeService }: {
|
|
6
8
|
schemeService: SchemeService;
|
|
7
9
|
});
|
|
10
|
+
addCustomPalette(key: string, colorHex: string): void;
|
|
8
11
|
set(variantEntity: VariantEntity): void;
|
|
12
|
+
private update;
|
|
9
13
|
}
|