@hanzogui/themes 8.0.0 → 8.1.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.
- package/dist/cjs/brands.cjs +54 -0
- package/dist/cjs/brands.native.js +57 -0
- package/dist/cjs/brands.native.js.map +1 -0
- package/dist/cjs/generated-new.cjs +2961 -1969
- package/dist/cjs/generated-new.native.js +2961 -1969
- package/dist/cjs/generated-new.native.js.map +1 -1
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.native.js +1 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/palettes.cjs +4 -1
- package/dist/cjs/palettes.native.js +6 -1
- package/dist/cjs/palettes.native.js.map +1 -1
- package/dist/cjs/themes-new.cjs +8 -1
- package/dist/cjs/themes-new.native.js +8 -1
- package/dist/cjs/themes-new.native.js.map +1 -1
- package/dist/cjs/v3-themes.cjs +2 -2
- package/dist/cjs/v3-themes.native.js +2 -2
- package/dist/cjs/v3-themes.native.js.map +1 -1
- package/dist/cjs/v4-default.cjs +16 -0
- package/dist/cjs/v4-default.native.js +16 -0
- package/dist/cjs/v4-default.native.js.map +1 -1
- package/dist/esm/brands.mjs +28 -0
- package/dist/esm/brands.mjs.map +1 -0
- package/dist/esm/brands.native.js +28 -0
- package/dist/esm/brands.native.js.map +1 -0
- package/dist/esm/componentThemeDefinitions.native.js.map +1 -1
- package/dist/esm/generated-new.mjs +2961 -1969
- package/dist/esm/generated-new.mjs.map +1 -1
- package/dist/esm/generated-new.native.js +2961 -1969
- package/dist/esm/generated-new.native.js.map +1 -1
- package/dist/esm/generated-v3.native.js.map +1 -1
- package/dist/esm/generated-v4-hanzogui.native.js.map +1 -1
- package/dist/esm/generated-v4.native.js.map +1 -1
- package/dist/esm/generated-v5-subtle.native.js.map +1 -1
- package/dist/esm/generated-v5.native.js.map +1 -1
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +1 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/opacify.native.js.map +1 -1
- package/dist/esm/palettes.mjs +4 -1
- package/dist/esm/palettes.mjs.map +1 -1
- package/dist/esm/palettes.native.js +6 -1
- package/dist/esm/palettes.native.js.map +1 -1
- package/dist/esm/shadows.native.js.map +1 -1
- package/dist/esm/subtleChildrenThemes.native.js.map +1 -1
- package/dist/esm/templates.native.js.map +1 -1
- package/dist/esm/themes-new.mjs +8 -1
- package/dist/esm/themes-new.mjs.map +1 -1
- package/dist/esm/themes-new.native.js +8 -1
- package/dist/esm/themes-new.native.js.map +1 -1
- package/dist/esm/themes-old.native.js.map +1 -1
- package/dist/esm/themes.native.js.map +1 -1
- package/dist/esm/tokens.native.js.map +1 -1
- package/dist/esm/utils.native.js.map +1 -1
- package/dist/esm/v3-themes.mjs +2 -2
- package/dist/esm/v3-themes.mjs.map +1 -1
- package/dist/esm/v3-themes.native.js +2 -2
- package/dist/esm/v3-themes.native.js.map +1 -1
- package/dist/esm/v3-tokens.native.js.map +1 -1
- package/dist/esm/v3.native.js.map +1 -1
- package/dist/esm/v4-default.mjs +16 -0
- package/dist/esm/v4-default.mjs.map +1 -1
- package/dist/esm/v4-default.native.js +16 -0
- package/dist/esm/v4-default.native.js.map +1 -1
- package/dist/esm/v4-hanzogui.native.js.map +1 -1
- package/dist/esm/v4-tokens.native.js.map +1 -1
- package/dist/esm/v4.native.js.map +1 -1
- package/dist/esm/v5-subtle.native.js.map +1 -1
- package/dist/esm/v5-templates.native.js.map +1 -1
- package/dist/esm/v5-themes-subtle.native.js.map +1 -1
- package/dist/esm/v5-themes.native.js.map +1 -1
- package/dist/esm/v5-tokens.native.js.map +1 -1
- package/dist/esm/v5.native.js.map +1 -1
- package/package.json +39 -7
- package/src/brands.ts +57 -0
- package/src/generated-new.ts +3071 -1971
- package/src/index.tsx +1 -0
- package/src/palettes.tsx +16 -0
- package/src/themes-new.ts +14 -1
- package/src/v3-themes.ts +5 -2
- package/src/v4-default.ts +9 -0
- package/types/brands.d.ts +35 -0
- package/types/brands.d.ts.map +1 -0
- package/types/generated-new.d.ts +4 -4
- package/types/generated-new.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/palettes.d.ts +8 -0
- package/types/palettes.d.ts.map +1 -1
- package/types/themes-new.d.ts +1 -42242
- package/types/themes-new.d.ts.map +1 -1
- package/types/tokens.d.ts +72 -72
- package/types/v3-themes.d.ts +48 -48
- package/types/v3-themes.d.ts.map +1 -1
- package/types/v4-default.d.ts +26 -26
- package/types/v4-default.d.ts.map +1 -1
- package/types/v4-hanzogui.d.ts +12 -12
- package/types/v5-themes-subtle.d.ts +12 -12
- package/types/v5-themes.d.ts +12 -12
- package/.turbo/turbo-build.log +0 -2
- package/tests/v5-themes.test.ts +0 -215
- package/tsconfig.json +0 -43
package/types/v4-hanzogui.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
declare const themes: Record<"light_blue" | "light_gray" | "light_green" | "light_orange" | "light_pink" | "light_purple" | "light_red" | "light_yellow" | "dark_blue" | "dark_gray" | "dark_green" | "dark_orange" | "dark_pink" | "dark_purple" | "dark_red" | "dark_yellow" | "light" | "dark" | "light_accent" | "dark_accent" | "light_black" | "light_white" | "light_blue_surface1" | "light_gray_surface1" | "light_green_surface1" | "light_orange_surface1" | "light_pink_surface1" | "light_purple_surface1" | "light_red_surface1" | "light_yellow_surface1" | "light_black_surface1" | "light_white_surface1" | "light_blue_surface2" | "light_gray_surface2" | "light_green_surface2" | "light_orange_surface2" | "light_pink_surface2" | "light_purple_surface2" | "light_red_surface2" | "light_yellow_surface2" | "light_black_surface2" | "light_white_surface2" | "light_blue_accent" | "light_gray_accent" | "light_green_accent" | "light_orange_accent" | "light_pink_accent" | "light_purple_accent" | "light_red_accent" | "light_yellow_accent" | "light_black_accent" | "light_white_accent" | "dark_black" | "dark_white" | "dark_blue_surface1" | "dark_gray_surface1" | "dark_green_surface1" | "dark_orange_surface1" | "dark_pink_surface1" | "dark_purple_surface1" | "dark_red_surface1" | "dark_yellow_surface1" | "dark_black_surface1" | "dark_white_surface1" | "dark_blue_surface2" | "dark_gray_surface2" | "dark_green_surface2" | "dark_orange_surface2" | "dark_pink_surface2" | "dark_purple_surface2" | "dark_red_surface2" | "dark_yellow_surface2" | "dark_black_surface2" | "dark_white_surface2" | "dark_blue_accent" | "dark_gray_accent" | "dark_green_accent" | "dark_orange_accent" | "dark_pink_accent" | "dark_purple_accent" | "dark_red_accent" | "dark_yellow_accent" | "dark_black_accent" | "dark_white_accent" | "light_blue_alt1" | "light_blue_alt2" | "light_green_alt1" | "light_green_alt2" | "light_orange_alt1" | "light_orange_alt2" | "light_pink_alt1" | "light_pink_alt2" | "light_purple_alt1" | "light_purple_alt2" | "light_red_alt1" | "light_red_alt2" | "light_yellow_alt1" | "light_yellow_alt2" | "dark_blue_alt1" | "dark_blue_alt2" | "dark_green_alt1" | "dark_green_alt2" | "dark_orange_alt1" | "dark_orange_alt2" | "dark_pink_alt1" | "dark_pink_alt2" | "dark_purple_alt1" | "dark_purple_alt2" | "dark_red_alt1" | "dark_red_alt2" | "dark_yellow_alt1" | "dark_yellow_alt2" | "light_gray_alt1" | "light_gray_alt2" | "dark_gray_alt1" | "dark_gray_alt2" | "light_blue_surface3" | "light_gray_surface3" | "light_green_surface3" | "light_orange_surface3" | "light_pink_surface3" | "light_purple_surface3" | "light_red_surface3" | "light_yellow_surface3" | "dark_blue_surface3" | "dark_gray_surface3" | "dark_green_surface3" | "dark_orange_surface3" | "dark_pink_surface3" | "dark_purple_surface3" | "dark_red_surface3" | "dark_yellow_surface3" | "light_tan" | "light_tan_surface1" | "light_tan_surface2" | "light_black_surface3" | "light_white_surface3" | "light_tan_surface3" | "light_tan_accent" | "light_black_alt1" | "light_white_alt1" | "light_tan_alt1" | "light_black_alt2" | "light_white_alt2" | "light_tan_alt2" | "dark_tan" | "dark_tan_surface1" | "dark_tan_surface2" | "dark_black_surface3" | "dark_white_surface3" | "dark_tan_surface3" | "dark_tan_accent" | "dark_black_alt1" | "dark_white_alt1" | "dark_tan_alt1" | "dark_black_alt2" | "dark_white_alt2" | "dark_tan_alt2", {
|
|
2
|
+
blue1: string;
|
|
3
|
+
blue2: string;
|
|
4
|
+
blue3: string;
|
|
5
|
+
blue4: string;
|
|
6
|
+
blue5: string;
|
|
7
|
+
blue6: string;
|
|
8
|
+
blue7: string;
|
|
9
|
+
blue8: string;
|
|
10
|
+
blue9: string;
|
|
11
|
+
blue10: string;
|
|
12
|
+
blue11: string;
|
|
13
|
+
blue12: string;
|
|
2
14
|
yellow1: string;
|
|
3
15
|
yellow2: string;
|
|
4
16
|
yellow3: string;
|
|
@@ -83,18 +95,6 @@ declare const themes: Record<"light_blue" | "light_gray" | "light_green" | "ligh
|
|
|
83
95
|
gray10: string;
|
|
84
96
|
gray11: string;
|
|
85
97
|
gray12: string;
|
|
86
|
-
blue1: string;
|
|
87
|
-
blue2: string;
|
|
88
|
-
blue3: string;
|
|
89
|
-
blue4: string;
|
|
90
|
-
blue5: string;
|
|
91
|
-
blue6: string;
|
|
92
|
-
blue7: string;
|
|
93
|
-
blue8: string;
|
|
94
|
-
blue9: string;
|
|
95
|
-
blue10: string;
|
|
96
|
-
blue11: string;
|
|
97
|
-
blue12: string;
|
|
98
98
|
color: string;
|
|
99
99
|
shadowColor: string;
|
|
100
100
|
borderColor: string;
|
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export * from './v5-themes';
|
|
5
5
|
export declare const themes: Record<"light_blue" | "light_gray" | "light_green" | "light_orange" | "light_pink" | "light_purple" | "light_red" | "light_yellow" | "dark_blue" | "dark_gray" | "dark_green" | "dark_orange" | "dark_pink" | "dark_purple" | "dark_red" | "dark_yellow" | "light" | "dark" | "light_accent" | "dark_accent" | "light_neutral" | "light_black" | "light_white" | "light_teal" | "light_blue_surface1" | "light_gray_surface1" | "light_green_surface1" | "light_orange_surface1" | "light_pink_surface1" | "light_purple_surface1" | "light_red_surface1" | "light_yellow_surface1" | "light_neutral_surface1" | "light_black_surface1" | "light_white_surface1" | "light_teal_surface1" | "light_blue_surface2" | "light_gray_surface2" | "light_green_surface2" | "light_orange_surface2" | "light_pink_surface2" | "light_purple_surface2" | "light_red_surface2" | "light_yellow_surface2" | "light_neutral_surface2" | "light_black_surface2" | "light_white_surface2" | "light_teal_surface2" | "light_blue_accent" | "light_gray_accent" | "light_green_accent" | "light_orange_accent" | "light_pink_accent" | "light_purple_accent" | "light_red_accent" | "light_yellow_accent" | "light_neutral_accent" | "light_black_accent" | "light_white_accent" | "light_teal_accent" | "dark_neutral" | "dark_black" | "dark_white" | "dark_teal" | "dark_blue_surface1" | "dark_gray_surface1" | "dark_green_surface1" | "dark_orange_surface1" | "dark_pink_surface1" | "dark_purple_surface1" | "dark_red_surface1" | "dark_yellow_surface1" | "dark_neutral_surface1" | "dark_black_surface1" | "dark_white_surface1" | "dark_teal_surface1" | "dark_blue_surface2" | "dark_gray_surface2" | "dark_green_surface2" | "dark_orange_surface2" | "dark_pink_surface2" | "dark_purple_surface2" | "dark_red_surface2" | "dark_yellow_surface2" | "dark_neutral_surface2" | "dark_black_surface2" | "dark_white_surface2" | "dark_teal_surface2" | "dark_blue_accent" | "dark_gray_accent" | "dark_green_accent" | "dark_orange_accent" | "dark_pink_accent" | "dark_purple_accent" | "dark_red_accent" | "dark_yellow_accent" | "dark_neutral_accent" | "dark_black_accent" | "dark_white_accent" | "dark_teal_accent", {
|
|
6
|
+
blue1: string;
|
|
7
|
+
blue2: string;
|
|
8
|
+
blue3: string;
|
|
9
|
+
blue4: string;
|
|
10
|
+
blue5: string;
|
|
11
|
+
blue6: string;
|
|
12
|
+
blue7: string;
|
|
13
|
+
blue8: string;
|
|
14
|
+
blue9: string;
|
|
15
|
+
blue10: string;
|
|
16
|
+
blue11: string;
|
|
17
|
+
blue12: string;
|
|
6
18
|
yellow1: string;
|
|
7
19
|
yellow2: string;
|
|
8
20
|
yellow3: string;
|
|
@@ -87,18 +99,6 @@ export declare const themes: Record<"light_blue" | "light_gray" | "light_green"
|
|
|
87
99
|
gray10: string;
|
|
88
100
|
gray11: string;
|
|
89
101
|
gray12: string;
|
|
90
|
-
blue1: string;
|
|
91
|
-
blue2: string;
|
|
92
|
-
blue3: string;
|
|
93
|
-
blue4: string;
|
|
94
|
-
blue5: string;
|
|
95
|
-
blue6: string;
|
|
96
|
-
blue7: string;
|
|
97
|
-
blue8: string;
|
|
98
|
-
blue9: string;
|
|
99
|
-
blue10: string;
|
|
100
|
-
blue11: string;
|
|
101
|
-
blue12: string;
|
|
102
102
|
color: string;
|
|
103
103
|
shadowColor: string;
|
|
104
104
|
borderColor: string;
|
package/types/v5-themes.d.ts
CHANGED
|
@@ -523,6 +523,18 @@ export type CreateV5ThemeOptions<Children extends Record<string, ChildTheme> = t
|
|
|
523
523
|
*/
|
|
524
524
|
export declare function createV5Theme<Children extends Record<string, ChildTheme> = typeof defaultChildrenThemes, GrandChildren extends Record<string, GrandChildrenThemeDefinition> = typeof v5GrandchildrenThemes, GetThemeReturn extends Record<string, string | number> = {}>(options?: CreateV5ThemeOptions<Children, GrandChildren, GetThemeReturn>): Record<"light" | "dark" | "light_accent" | "dark_accent" | ("black" | "white" | keyof Children extends string ? `light_${(GrandChildren extends undefined ? undefined : Record<keyof GrandChildren, any>) extends infer T ? T extends (GrandChildren extends undefined ? undefined : Record<keyof GrandChildren, any>) ? T extends undefined ? "black" | "white" | (string & keyof Children) : "black" | "white" | (string & keyof Children) | (keyof T extends infer T_1 ? T_1 extends keyof T ? T_1 extends string ? `black_${T_1}` | `white_${T_1}` | `${string & keyof Children}_${T_1}` : never : never : never) : never : never}` | `dark_${(GrandChildren extends undefined ? undefined : Record<keyof GrandChildren, any>) extends infer T_2 ? T_2 extends (GrandChildren extends undefined ? undefined : Record<keyof GrandChildren, any>) ? T_2 extends undefined ? "black" | "white" | (string & keyof Children) : "black" | "white" | (string & keyof Children) | (keyof T_2 extends infer T_3 ? T_3 extends keyof T_2 ? T_3 extends string ? `black_${T_3}` | `white_${T_3}` | `${string & keyof Children}_${T_3}` : never : never : never) : never : never}` : never), { [ThemeKey in "color" | "shadowColor" | "borderColor" | "borderColorHover" | "colorHover" | "colorFocus" | "colorPress" | "color1" | "color2" | "color3" | "color4" | "color5" | "color6" | "color7" | "color8" | "color9" | "color10" | "color11" | "color12" | "background" | "placeholderColor" | "colorTransparent" | "backgroundHover" | "backgroundPress" | "backgroundFocus" | "borderColorFocus" | "borderColorPress" | "accentBackground" | "accentColor" | "background0" | "background02" | "background04" | "background06" | "background08" | "color0" | "color02" | "color04" | "color06" | "color08" | "black" | "black2" | "black1" | "black4" | "black8" | "black12" | "black3" | "black5" | "black7" | "black9" | "black10" | "black6" | "black11" | "white" | "white2" | "white1" | "white4" | "white8" | "white12" | "white3" | "white5" | "white7" | "white9" | "white10" | "white6" | "white11" | "white0" | "white02" | "white04" | "white06" | "white08" | "black0" | "black02" | "black04" | "black06" | "black08" | "shadow1" | "shadow2" | "shadow3" | "shadow4" | "shadow5" | "shadow6" | "shadow7" | "shadow8" | "highlight1" | "highlight2" | "highlight3" | "highlight4" | "highlight5" | "highlight6" | "highlight7" | "highlight8" | "outlineColor" | "accent0" | "accent2" | "accent1" | "accent4" | "accent8" | "accent12" | "accent3" | "accent5" | "accent7" | "accent9" | "accent10" | "accent6" | "accent11" | keyof UnionToIntersection<ChildrenColors<Children, "dark">>]: string; } & Omit<DefaultV5ThemeValues, keyof GetThemeReturn> & GetThemeReturn>;
|
|
525
525
|
export declare const themes: Record<"light_blue" | "light_gray" | "light_green" | "light_orange" | "light_pink" | "light_purple" | "light_red" | "light_yellow" | "dark_blue" | "dark_gray" | "dark_green" | "dark_orange" | "dark_pink" | "dark_purple" | "dark_red" | "dark_yellow" | "light" | "dark" | "light_accent" | "dark_accent" | "light_neutral" | "light_black" | "light_white" | "light_teal" | "light_blue_surface1" | "light_gray_surface1" | "light_green_surface1" | "light_orange_surface1" | "light_pink_surface1" | "light_purple_surface1" | "light_red_surface1" | "light_yellow_surface1" | "light_neutral_surface1" | "light_black_surface1" | "light_white_surface1" | "light_teal_surface1" | "light_blue_surface2" | "light_gray_surface2" | "light_green_surface2" | "light_orange_surface2" | "light_pink_surface2" | "light_purple_surface2" | "light_red_surface2" | "light_yellow_surface2" | "light_neutral_surface2" | "light_black_surface2" | "light_white_surface2" | "light_teal_surface2" | "light_blue_accent" | "light_gray_accent" | "light_green_accent" | "light_orange_accent" | "light_pink_accent" | "light_purple_accent" | "light_red_accent" | "light_yellow_accent" | "light_neutral_accent" | "light_black_accent" | "light_white_accent" | "light_teal_accent" | "dark_neutral" | "dark_black" | "dark_white" | "dark_teal" | "dark_blue_surface1" | "dark_gray_surface1" | "dark_green_surface1" | "dark_orange_surface1" | "dark_pink_surface1" | "dark_purple_surface1" | "dark_red_surface1" | "dark_yellow_surface1" | "dark_neutral_surface1" | "dark_black_surface1" | "dark_white_surface1" | "dark_teal_surface1" | "dark_blue_surface2" | "dark_gray_surface2" | "dark_green_surface2" | "dark_orange_surface2" | "dark_pink_surface2" | "dark_purple_surface2" | "dark_red_surface2" | "dark_yellow_surface2" | "dark_neutral_surface2" | "dark_black_surface2" | "dark_white_surface2" | "dark_teal_surface2" | "dark_blue_accent" | "dark_gray_accent" | "dark_green_accent" | "dark_orange_accent" | "dark_pink_accent" | "dark_purple_accent" | "dark_red_accent" | "dark_yellow_accent" | "dark_neutral_accent" | "dark_black_accent" | "dark_white_accent" | "dark_teal_accent", {
|
|
526
|
+
blue1: string;
|
|
527
|
+
blue2: string;
|
|
528
|
+
blue3: string;
|
|
529
|
+
blue4: string;
|
|
530
|
+
blue5: string;
|
|
531
|
+
blue6: string;
|
|
532
|
+
blue7: string;
|
|
533
|
+
blue8: string;
|
|
534
|
+
blue9: string;
|
|
535
|
+
blue10: string;
|
|
536
|
+
blue11: string;
|
|
537
|
+
blue12: string;
|
|
526
538
|
yellow1: string;
|
|
527
539
|
yellow2: string;
|
|
528
540
|
yellow3: string;
|
|
@@ -607,18 +619,6 @@ export declare const themes: Record<"light_blue" | "light_gray" | "light_green"
|
|
|
607
619
|
gray10: string;
|
|
608
620
|
gray11: string;
|
|
609
621
|
gray12: string;
|
|
610
|
-
blue1: string;
|
|
611
|
-
blue2: string;
|
|
612
|
-
blue3: string;
|
|
613
|
-
blue4: string;
|
|
614
|
-
blue5: string;
|
|
615
|
-
blue6: string;
|
|
616
|
-
blue7: string;
|
|
617
|
-
blue8: string;
|
|
618
|
-
blue9: string;
|
|
619
|
-
blue10: string;
|
|
620
|
-
blue11: string;
|
|
621
|
-
blue12: string;
|
|
622
622
|
color: string;
|
|
623
623
|
shadowColor: string;
|
|
624
624
|
borderColor: string;
|
package/.turbo/turbo-build.log
DELETED
package/tests/v5-themes.test.ts
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test, assertType } from 'vitest'
|
|
2
|
-
import {
|
|
3
|
-
createV5Theme,
|
|
4
|
-
themes as defaultThemes,
|
|
5
|
-
defaultChildrenThemes,
|
|
6
|
-
} from '../src/v5-themes'
|
|
7
|
-
import { opacify, interpolateColor } from '../src/opacify'
|
|
8
|
-
|
|
9
|
-
describe('opacify', () => {
|
|
10
|
-
test('converts hex to hex with alpha', () => {
|
|
11
|
-
expect(opacify('#ff0000', 0.5)).toBe('#ff000080')
|
|
12
|
-
expect(opacify('#fff', 0.25)).toBe('#ffffff40') // shorthand
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
test('converts hsl to hsla', () => {
|
|
16
|
-
expect(opacify('hsl(0, 100%, 50%)', 0.5)).toBe('hsla(0, 100%, 50%, 0.5)')
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
test('returns unsupported formats unchanged', () => {
|
|
20
|
-
expect(opacify('rgb(255, 0, 0)', 0.5)).toBe('rgb(255, 0, 0)')
|
|
21
|
-
expect(opacify('invalid', 0.5)).toBe('invalid')
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
describe('interpolateColor', () => {
|
|
26
|
-
test('interpolates between colors', () => {
|
|
27
|
-
expect(interpolateColor('#000000', '#ffffff', 0)).toBe('rgb(0, 0, 0)')
|
|
28
|
-
expect(interpolateColor('#000000', '#ffffff', 1)).toBe('rgb(255, 255, 255)')
|
|
29
|
-
expect(interpolateColor('#000000', '#ffffff', 0.5)).toBe('rgb(128, 128, 128)')
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
test('handles different color formats', () => {
|
|
33
|
-
expect(interpolateColor('rgb(0, 0, 0)', 'rgb(255, 255, 255)', 0.5)).toBe(
|
|
34
|
-
'rgb(128, 128, 128)'
|
|
35
|
-
)
|
|
36
|
-
expect(interpolateColor('hsl(0, 100%, 50%)', 'hsl(0, 100%, 100%)', 0.5)).toMatch(
|
|
37
|
-
/^rgb/
|
|
38
|
-
)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
test('returns first color on invalid input', () => {
|
|
42
|
-
expect(interpolateColor('#ff0000', 'invalid', 0.5)).toBe('#ff0000')
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
describe('v5 themes', () => {
|
|
47
|
-
test('generates expected theme structure', () => {
|
|
48
|
-
const keys = Object.keys(defaultThemes)
|
|
49
|
-
|
|
50
|
-
// Base + accent
|
|
51
|
-
expect(keys).toContain('light')
|
|
52
|
-
expect(keys).toContain('dark')
|
|
53
|
-
expect(keys).toContain('light_accent')
|
|
54
|
-
|
|
55
|
-
// Children themes
|
|
56
|
-
expect(keys).toContain('light_blue')
|
|
57
|
-
expect(keys).toContain('dark_red')
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
test('light and dark themes have different values', () => {
|
|
61
|
-
expect(defaultThemes.light.background).not.toBe(defaultThemes.dark.background)
|
|
62
|
-
expect(defaultThemes.light.color).not.toBe(defaultThemes.dark.color)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
test('accent themes are inverted', () => {
|
|
66
|
-
expect(defaultThemes.light.background).not.toBe(defaultThemes.light_accent.background)
|
|
67
|
-
expect(defaultThemes.dark.background).not.toBe(defaultThemes.dark_accent.background)
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
test('getTheme computes opacity and interpolation colors', () => {
|
|
71
|
-
// Opacity variants
|
|
72
|
-
expect(defaultThemes.light.color01).toBeDefined()
|
|
73
|
-
expect(defaultThemes.light.background01).toBeDefined()
|
|
74
|
-
expect(defaultThemes.light.background08).toBeDefined()
|
|
75
|
-
expect(defaultThemes.light.outlineColor).toBeDefined()
|
|
76
|
-
|
|
77
|
-
// Works on all theme types
|
|
78
|
-
expect(defaultThemes.light_blue.color01).toBeDefined()
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
test('children colors spread to base theme extras', () => {
|
|
82
|
-
expect(defaultThemes.light.blue1).toBe(defaultChildrenThemes.blue.light.blue1)
|
|
83
|
-
expect(defaultThemes.light.blue12).toBe(defaultChildrenThemes.blue.light.blue12)
|
|
84
|
-
expect(defaultThemes.dark.blue1).toBe(defaultChildrenThemes.blue.dark.blue1)
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
test('includes shadow and whiteBlack colors', () => {
|
|
88
|
-
expect(defaultThemes.light.shadow1).toBeDefined()
|
|
89
|
-
expect(defaultThemes.light.shadow6).toBeDefined()
|
|
90
|
-
expect(defaultThemes.light.white).toBe('rgba(255,255,255,1)')
|
|
91
|
-
expect(defaultThemes.light.black).toBe('rgba(0,0,0,1)')
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
test('has color1-12 and accent1-12 tokens', () => {
|
|
95
|
-
expect(defaultThemes.light.color1).toBeDefined()
|
|
96
|
-
expect(defaultThemes.light.color12).toBeDefined()
|
|
97
|
-
expect(defaultThemes.light.accent1).toBeDefined()
|
|
98
|
-
expect(defaultThemes.light.accent12).toBeDefined()
|
|
99
|
-
})
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
describe('createV5Theme options', () => {
|
|
103
|
-
test('custom palettes affect black/white colors', () => {
|
|
104
|
-
const themes = createV5Theme({
|
|
105
|
-
darkPalette: [
|
|
106
|
-
'#111',
|
|
107
|
-
'#222',
|
|
108
|
-
'#333',
|
|
109
|
-
'#444',
|
|
110
|
-
'#555',
|
|
111
|
-
'#666',
|
|
112
|
-
'#777',
|
|
113
|
-
'#888',
|
|
114
|
-
'#999',
|
|
115
|
-
'#aaa',
|
|
116
|
-
'#bbb',
|
|
117
|
-
'#ccc',
|
|
118
|
-
],
|
|
119
|
-
})
|
|
120
|
-
expect(themes.light.black1).toBe('#111')
|
|
121
|
-
expect(themes.light.black12).toBe('#ccc')
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
test('componentThemes: false removes component themes', () => {
|
|
125
|
-
const themes = createV5Theme({ componentThemes: false })
|
|
126
|
-
const keys = Object.keys(themes)
|
|
127
|
-
expect(keys.filter((k) => k.includes('Button'))).toHaveLength(0)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
test('empty childrenThemes produces minimal themes', () => {
|
|
131
|
-
const themes = createV5Theme({ childrenThemes: {} })
|
|
132
|
-
const keys = Object.keys(themes)
|
|
133
|
-
expect(keys).toContain('light')
|
|
134
|
-
expect(keys).toContain('light_black') // internal
|
|
135
|
-
expect(keys).not.toContain('light_blue')
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
test('custom childrenThemes adds color themes', () => {
|
|
139
|
-
const themes = createV5Theme({
|
|
140
|
-
childrenThemes: {
|
|
141
|
-
brand: {
|
|
142
|
-
light: { brand1: '#e0f7fa', brand12: '#00251a' },
|
|
143
|
-
dark: { brand1: '#00251a', brand12: '#e0f7fa' },
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
})
|
|
147
|
-
expect(themes.light.brand1).toBe('#e0f7fa')
|
|
148
|
-
expect(themes.dark.brand1).toBe('#00251a')
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
test('grandChildrenThemes override defaults', () => {
|
|
152
|
-
const themes = createV5Theme({
|
|
153
|
-
grandChildrenThemes: { custom: { template: 'surface1' } },
|
|
154
|
-
})
|
|
155
|
-
const keys = Object.keys(themes)
|
|
156
|
-
expect(keys).toContain('light_blue_custom')
|
|
157
|
-
expect(keys).not.toContain('light_blue_accent')
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
test('custom getTheme merges on top of built-in computed values', () => {
|
|
161
|
-
const themes = createV5Theme({
|
|
162
|
-
getTheme: ({ palette }) => ({
|
|
163
|
-
myOverlay: opacify(palette![7]!, 0.5),
|
|
164
|
-
outlineColor: '#123456',
|
|
165
|
-
}),
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
expect(themes.light.color01).toBeDefined()
|
|
169
|
-
expect(themes.light.myOverlay).toBeDefined()
|
|
170
|
-
expect(themes.light.outlineColor).toBe('#123456')
|
|
171
|
-
})
|
|
172
|
-
})
|
|
173
|
-
|
|
174
|
-
describe('defaultChildrenThemes', () => {
|
|
175
|
-
test('has expected structure', () => {
|
|
176
|
-
expect(Object.keys(defaultChildrenThemes.blue.light)).toHaveLength(12)
|
|
177
|
-
expect(defaultChildrenThemes.neutral.light).toEqual(
|
|
178
|
-
defaultChildrenThemes.neutral.dark
|
|
179
|
-
)
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
describe('type safety', () => {
|
|
184
|
-
test('theme values are string | number', () => {
|
|
185
|
-
assertType<string | number>(defaultThemes.light.background)
|
|
186
|
-
assertType<string | number>(defaultThemes.light.color01)
|
|
187
|
-
assertType<string | number>(defaultThemes.light.blue1)
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
test('custom themes infer types correctly', () => {
|
|
191
|
-
const themes = createV5Theme({
|
|
192
|
-
childrenThemes: {
|
|
193
|
-
brand: {
|
|
194
|
-
light: { brand1: '#fff', brand12: '#000' },
|
|
195
|
-
dark: { brand1: '#000', brand12: '#fff' },
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
})
|
|
199
|
-
// brand colors should be typed
|
|
200
|
-
assertType<string | number>(themes.light.brand1)
|
|
201
|
-
})
|
|
202
|
-
|
|
203
|
-
test('custom getTheme values infer types correctly', () => {
|
|
204
|
-
const themes = createV5Theme({
|
|
205
|
-
getTheme: ({ palette }) => ({
|
|
206
|
-
myOverlay: opacify(palette![7]!, 0.5),
|
|
207
|
-
}),
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
assertType<string | number>(themes.light.myOverlay)
|
|
211
|
-
assertType<string | number>(themes.dark.outlineColor)
|
|
212
|
-
// @ts-expect-error
|
|
213
|
-
themes.light.nonValidCustomKey
|
|
214
|
-
})
|
|
215
|
-
})
|
package/tsconfig.json
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"composite": true
|
|
5
|
-
},
|
|
6
|
-
"exclude": [
|
|
7
|
-
"types",
|
|
8
|
-
"tests",
|
|
9
|
-
"v2.d.ts",
|
|
10
|
-
"v2.js",
|
|
11
|
-
"v2-themes.cjs",
|
|
12
|
-
"v2-themes.d.ts",
|
|
13
|
-
"v3.d.ts",
|
|
14
|
-
"v3.cjs",
|
|
15
|
-
"v3-themes.cjs",
|
|
16
|
-
"v3-themes.d.ts",
|
|
17
|
-
"v4.d.ts",
|
|
18
|
-
"v4.cjs",
|
|
19
|
-
"v5.d.ts",
|
|
20
|
-
"v5.cjs",
|
|
21
|
-
"v5-subtle.d.ts",
|
|
22
|
-
"v5-subtle.cjs",
|
|
23
|
-
"dist",
|
|
24
|
-
"**/__tests__"
|
|
25
|
-
],
|
|
26
|
-
"references": [
|
|
27
|
-
{
|
|
28
|
-
"path": "../cli"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"path": "../colors"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"path": "../create-theme"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"path": "../theme-builder"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"path": "../web"
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
}
|