@code-coaching/vuetiful 0.23.2 → 0.24.0

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.
Files changed (35) hide show
  1. package/dist/types/components/atoms/VLightSwitch.vue.d.ts +5 -1
  2. package/dist/types/services/dark-mode.service.d.ts +13 -13
  3. package/dist/types/services/index.d.ts +2 -2
  4. package/dist/types/utils/colors/colors.service.d.ts +69 -0
  5. package/dist/types/utils/index.d.ts +5 -1
  6. package/dist/types/utils/theme/theme.service.d.ts +8 -23
  7. package/dist/types/utils/theme/themes.d.ts +35 -0
  8. package/dist/vuetiful.es.mjs +447 -146
  9. package/dist/vuetiful.umd.js +71 -16
  10. package/package.json +1 -1
  11. package/src/components/atoms/VLightSwitch.test.ts +61 -12
  12. package/src/components/atoms/VLightSwitch.vue +13 -19
  13. package/src/components/molecules/VTabs/VTab.test.ts +21 -0
  14. package/src/directives/clipboard.test.ts +2 -2
  15. package/src/services/dark-mode.service.test.ts +58 -210
  16. package/src/services/dark-mode.service.ts +32 -51
  17. package/src/services/drawer.service.test.ts +4 -4
  18. package/src/services/highlight.service.test.ts +3 -3
  19. package/src/services/index.ts +2 -2
  20. package/src/services/rail.service.test.ts +2 -2
  21. package/src/utils/colors/colors.service.ts +293 -0
  22. package/src/utils/index.ts +5 -1
  23. package/src/utils/platform/platform.service.test.ts +3 -3
  24. package/src/utils/theme/callback.test.ts +9 -5
  25. package/src/utils/theme/remove.test.ts +7 -5
  26. package/src/utils/theme/theme-switcher.vue +34 -37
  27. package/src/utils/theme/theme.service.test.ts +160 -58
  28. package/src/utils/theme/theme.service.ts +139 -78
  29. package/src/utils/theme/themes.ts +122 -0
  30. package/dist/types/components/index.test.d.ts +0 -1
  31. package/dist/types/index.test.d.ts +0 -1
  32. package/dist/types/utils/index.test.d.ts +0 -1
  33. package/src/components/index.test.ts +0 -10
  34. package/src/index.test.ts +0 -26
  35. package/src/utils/index.test.ts +0 -11
@@ -43,8 +43,12 @@ declare const _default: import("vue").DefineComponent<{
43
43
  };
44
44
  onToggleHandler: () => void;
45
45
  onKeyDown: (event: KeyboardEvent) => void;
46
- currentMode: Readonly<import("vue").Ref<boolean>>;
46
+ chosenMode: import("vue").Ref<string>;
47
47
  iconFill: ComputedRef<string>;
48
+ MODE: {
49
+ LIGHT: string;
50
+ DARK: string;
51
+ };
48
52
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
49
53
  bgLight: {
50
54
  type: () => CssClasses;
@@ -1,19 +1,19 @@
1
- import { Ref } from 'vue';
1
+ declare const MODE: {
2
+ LIGHT: string;
3
+ DARK: string;
4
+ };
5
+ export declare type Mode = (typeof MODE)[keyof typeof MODE];
2
6
  declare const useDarkMode: () => {
3
- modeOsPrefers: Readonly<Ref<boolean>>;
4
- modeUserPrefers: Readonly<Ref<boolean | undefined>>;
5
- currentMode: Readonly<Ref<boolean>>;
6
- isDark: Readonly<Ref<boolean>>;
7
- getModeOsPrefers: () => boolean;
8
- getModeUserPrefers: () => boolean | undefined;
9
- getModeAutoPrefers: () => boolean;
10
- setModeUserPrefers: (value: boolean) => void;
11
- setModeCurrent: (value: boolean) => void;
12
- autoModeWatcher: () => void;
7
+ chosenMode: import("vue").Ref<string>;
8
+ isDark: Readonly<import("vue").Ref<boolean>>;
13
9
  initializeMode: () => void;
10
+ applyMode: (value: Mode) => void;
11
+ autoModeWatcher: () => void;
12
+ applyModeSSR: (html: string, mode: Mode) => string;
13
+ getModeFromCookie: (cookies: string) => string;
14
14
  MODE: {
15
- LIGHT: boolean;
16
- DARK: boolean;
15
+ LIGHT: string;
16
+ DARK: string;
17
17
  };
18
18
  };
19
19
  export { useDarkMode };
@@ -1,7 +1,7 @@
1
- import { useDarkMode } from './dark-mode.service';
1
+ import { useDarkMode, Mode } from './dark-mode.service';
2
2
  import { useDrawer } from './drawer.service';
3
3
  import { useHighlight } from './highlight.service';
4
4
  import { useRail } from './rail.service';
5
5
  import { useSettings, VuetifulSettings } from './settings.service';
6
6
  export { useDarkMode, useDrawer, useHighlight, useRail, useSettings };
7
- export type { VuetifulSettings };
7
+ export type { VuetifulSettings, Mode };
@@ -0,0 +1,69 @@
1
+ declare type ContrastLevel = 'AA' | 'AAA';
2
+ declare type ContrastSize = 'small' | 'large';
3
+ export interface Report {
4
+ emoji: string;
5
+ note: string;
6
+ }
7
+ export interface PassReport {
8
+ textColor: string;
9
+ backgroundColor: string;
10
+ contrast: number;
11
+ report: Report;
12
+ smallAA: boolean;
13
+ smallAAA: boolean;
14
+ largeAA: boolean;
15
+ largeAAA: boolean;
16
+ fails: boolean;
17
+ }
18
+ export declare type Palette = {
19
+ [key: number]: {
20
+ hex: string;
21
+ rgb: string;
22
+ on: string;
23
+ };
24
+ };
25
+ export declare const semanticNames: readonly ["primary", "secondary", "tertiary", "success", "warning", "error", "surface"];
26
+ export declare type SemanticNames = (typeof semanticNames)[number];
27
+ export interface ColorSettings {
28
+ key: SemanticNames;
29
+ label: string;
30
+ hex: string;
31
+ rgb: string;
32
+ on: string;
33
+ }
34
+ declare type Rgb = {
35
+ r: number;
36
+ g: number;
37
+ b: number;
38
+ };
39
+ declare const useColors: () => {
40
+ hexToRgb: (hex: string) => Rgb | null;
41
+ hexToTailwindRgbString: (hex: string) => string;
42
+ rgbToHex: (r: number, g: number, b: number) => string;
43
+ generateA11yOnColor: (hex: string) => '255 255 255' | '0 0 0';
44
+ lighten: (hex: string, intensity: number) => string;
45
+ darken: (hex: string, intensity: number) => string;
46
+ generatePalette: (baseColor: string) => Palette;
47
+ contrastLevels: Record<ContrastSize, {
48
+ AA: number;
49
+ AAA: number;
50
+ }>;
51
+ getLuminance: {
52
+ (r: Rgb): number;
53
+ (r: number, g: number, b: number): number;
54
+ };
55
+ destringRgb: (rgbString: string) => Rgb;
56
+ handleStringColor: {
57
+ (colorString: string): Rgb;
58
+ (colorString: string, returnType: 'rgb'): Rgb;
59
+ (colorString: string, returnType: 'hex'): string;
60
+ (colorString: string, returnType?: "rgb" | "hex" | undefined): string | Rgb;
61
+ };
62
+ calculateRatio: (luminance1: string | number, luminance2: string | number) => number;
63
+ textPasses: (textColor: string, backgroundColor: string, size: ContrastSize, level: ContrastLevel) => boolean;
64
+ hexValueIsValid: (textColor: string) => boolean;
65
+ getPassReport: (textColor: string, backgroundColor: string) => PassReport;
66
+ hexValuesAreValid: (colors: Array<ColorSettings>) => boolean;
67
+ semanticNames: readonly ["primary", "secondary", "tertiary", "success", "warning", "error", "surface"];
68
+ };
69
+ export { useColors };
@@ -1,3 +1,7 @@
1
+ import type { ColorSettings, Palette, PassReport, Report, SemanticNames } from './colors/colors.service';
2
+ import { useColors } from './colors/colors.service';
3
+ import { usePlatform } from './platform/platform.service';
1
4
  import ThemeSwitcher from './theme/theme-switcher.vue';
2
5
  import { useTheme } from './theme/theme.service';
3
- export { ThemeSwitcher, useTheme };
6
+ export { ThemeSwitcher, useColors, usePlatform, useTheme };
7
+ export type { ColorSettings, Palette, PassReport, Report, SemanticNames };
@@ -1,28 +1,13 @@
1
1
  import { Ref } from 'vue';
2
- export interface Theme {
3
- name: string;
4
- url: string;
5
- }
2
+ import { Theme } from './themes';
6
3
  declare const useTheme: () => {
7
- themes: Readonly<Ref<readonly {
8
- readonly name: string;
9
- readonly url: string;
10
- }[]>>;
11
- chosenTheme: Readonly<Ref<string>>;
4
+ chosenTheme: Ref<Theme>;
5
+ themes: Theme[];
6
+ applyThemeSSR: (html: string, theme: Theme) => string;
7
+ applyTheme: (theme: Theme, callback?: Function | undefined) => void;
8
+ getThemeFromCookie: (cookies: string) => Theme;
12
9
  initializeTheme: (callback?: Function | undefined) => void;
13
- loadTheme: (themeName: string, callback?: Function | undefined) => void;
14
- saveThemeToStorage: (name: string) => void;
15
- THEMES: {
16
- VUETIFUL: string;
17
- ROCKET: string;
18
- SAHARA: string;
19
- SEAFOAM: string;
20
- SEASONAL: string;
21
- SKELETON: string;
22
- VINTAGE: string;
23
- };
24
- overwriteThemes: (newThemes: Array<Theme>) => void;
25
- registerAllBuiltInThemes: () => Array<Theme>;
26
- registerTheme: (name: string, url: string) => Theme;
10
+ changeDataTheme: (name: string) => void;
11
+ registerTheme: (theme: Theme) => void;
27
12
  };
28
13
  export { useTheme };
@@ -0,0 +1,35 @@
1
+ import { ColorSettings } from '../colors/colors.service';
2
+ export declare const themes: Array<Theme>;
3
+ export interface Theme {
4
+ name: string;
5
+ gradients: Gradients;
6
+ colors: {
7
+ primary: ColorSettings;
8
+ secondary: ColorSettings;
9
+ tertiary: ColorSettings;
10
+ success: ColorSettings;
11
+ warning: ColorSettings;
12
+ error: ColorSettings;
13
+ surface: ColorSettings;
14
+ };
15
+ fonts: Fonts;
16
+ textColorLight: string;
17
+ textColorDark: string;
18
+ roundedBase: string;
19
+ roundedContainer: string;
20
+ borderBase: string;
21
+ customCss: string;
22
+ [key: string]: any;
23
+ }
24
+ export interface Fonts {
25
+ base: string;
26
+ customBase: string;
27
+ baseImports: string;
28
+ headings: string;
29
+ customHeadings: string;
30
+ headingImports: string;
31
+ }
32
+ export interface Gradients {
33
+ light: string;
34
+ dark: string;
35
+ }