From f15d1ae0e99b8a18b28d7cfc18232f635d7a950f Mon Sep 17 00:00:00 2001 From: Daniil Suvorov Date: Wed, 23 Aug 2023 12:03:11 +0300 Subject: [PATCH] =?UTF-8?q?fix(vkontakte):=20themeNameBase=20=D0=98=D1=81?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5=D0=BC=20themeNameBas?= =?UTF-8?q?e=20=D0=B4=D0=BB=D1=8F=20=D1=82=D0=B5=D0=BC=20vkontakte*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/snapthots.test.ts.snap | 95 ++++++++++--------- .../themes/vkontakteAndroid/index.ts | 10 +- .../themes/vkontakteCom/index.ts | 10 +- .../themes/vkontakteIOS/index.ts | 10 +- 4 files changed, 75 insertions(+), 50 deletions(-) diff --git a/src/build/__snapshots__/snapthots.test.ts.snap b/src/build/__snapshots__/snapthots.test.ts.snap index 6992534f..9b36812a 100644 --- a/src/build/__snapshots__/snapthots.test.ts.snap +++ b/src/build/__snapshots__/snapthots.test.ts.snap @@ -308050,13 +308050,17 @@ exports[`shapshots vkontakteAndroid theme should match cssVars snapshot 1`] = ` "name": "--vkui--spacing_size_xs", "value": "var(--vkui--spacing_size_xs, 4px)", }, + "themeInheritsFrom": { + "name": "--vkui--theme_inherits_from", + "value": "var(--vkui--theme_inherits_from, vkBase)", + }, "themeName": { "name": "--vkui--theme_name", "value": "var(--vkui--theme_name, vkontakteAndroid)", }, "themeNameBase": { "name": "--vkui--theme_name_base", - "value": "var(--vkui--theme_name_base, vkBase)", + "value": "var(--vkui--theme_name_base, vkontakteAndroid)", }, "themeType": "cssVars", "vkontakteBackgroundHoverAlpha": { @@ -309967,8 +309971,9 @@ exports[`shapshots vkontakteAndroid theme should match pixelify theme snapshot 1 "spacingSizeS": "6px", "spacingSizeXl": "12px", "spacingSizeXs": "4px", + "themeInheritsFrom": "vkBase", "themeName": "vkontakteAndroid", - "themeNameBase": "vkBase", + "themeNameBase": "vkontakteAndroid", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "rgba(0, 0, 0, 0.12)", @@ -311212,8 +311217,9 @@ exports[`shapshots vkontakteAndroid theme should match pseudo theme from CssVars "spacingSizeS": "var(--vkui--spacing_size_s, 6px)", "spacingSizeXl": "var(--vkui--spacing_size_xl, 12px)", "spacingSizeXs": "var(--vkui--spacing_size_xs, 4px)", + "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBase)", "themeName": "var(--vkui--theme_name, vkontakteAndroid)", - "themeNameBase": "var(--vkui--theme_name_base, vkBase)", + "themeNameBase": "var(--vkui--theme_name_base, vkontakteAndroid)", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "var(--vkui--vkontakte_background_hover_alpha--active, rgba(0, 0, 0, 0.12))", @@ -312457,8 +312463,9 @@ exports[`shapshots vkontakteAndroid theme should match root theme snapshot 1`] = "spacingSizeS": 6, "spacingSizeXl": 12, "spacingSizeXs": 4, + "themeInheritsFrom": "vkBase", "themeName": "vkontakteAndroid", - "themeNameBase": "vkBase", + "themeNameBase": "vkontakteAndroid", "themeType": "root", "vkontakteBackgroundHoverAlpha": { "active": "rgba(0, 0, 0, 0.12)", @@ -315741,7 +315748,7 @@ exports[`shapshots vkontakteAndroidDark theme should match cssVars snapshot 1`] }, "themeInheritsFrom": { "name": "--vkui--theme_inherits_from", - "value": "var(--vkui--theme_inherits_from, vkBase)", + "value": "var(--vkui--theme_inherits_from, vkBaseDark)", }, "themeName": { "name": "--vkui--theme_name", @@ -315749,7 +315756,7 @@ exports[`shapshots vkontakteAndroidDark theme should match cssVars snapshot 1`] }, "themeNameBase": { "name": "--vkui--theme_name_base", - "value": "var(--vkui--theme_name_base, vkBase)", + "value": "var(--vkui--theme_name_base, vkontakteAndroid)", }, "themeType": "cssVars", "vkontakteBackgroundHoverAlpha": { @@ -317660,9 +317667,9 @@ exports[`shapshots vkontakteAndroidDark theme should match pixelify theme snapsh "spacingSizeS": "6px", "spacingSizeXl": "12px", "spacingSizeXs": "4px", - "themeInheritsFrom": "vkBase", + "themeInheritsFrom": "vkBaseDark", "themeName": "vkontakteAndroidDark", - "themeNameBase": "vkBase", + "themeNameBase": "vkontakteAndroid", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "rgba(255, 255, 255, 0.12)", @@ -318906,9 +318913,9 @@ exports[`shapshots vkontakteAndroidDark theme should match pseudo theme from Css "spacingSizeS": "var(--vkui--spacing_size_s, 6px)", "spacingSizeXl": "var(--vkui--spacing_size_xl, 12px)", "spacingSizeXs": "var(--vkui--spacing_size_xs, 4px)", - "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBase)", + "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBaseDark)", "themeName": "var(--vkui--theme_name, vkontakteAndroidDark)", - "themeNameBase": "var(--vkui--theme_name_base, vkBase)", + "themeNameBase": "var(--vkui--theme_name_base, vkontakteAndroid)", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "var(--vkui--vkontakte_background_hover_alpha--active, rgba(255, 255, 255, 0.12))", @@ -320152,9 +320159,9 @@ exports[`shapshots vkontakteAndroidDark theme should match root theme snapshot 1 "spacingSizeS": 6, "spacingSizeXl": 12, "spacingSizeXs": 4, - "themeInheritsFrom": "vkBase", + "themeInheritsFrom": "vkBaseDark", "themeName": "vkontakteAndroidDark", - "themeNameBase": "vkBase", + "themeNameBase": "vkontakteAndroid", "themeType": "root", "vkontakteBackgroundHoverAlpha": { "active": "rgba(255, 255, 255, 0.12)", @@ -323437,7 +323444,7 @@ exports[`shapshots vkontakteCom theme should match cssVars snapshot 1`] = ` }, "themeInheritsFrom": { "name": "--vkui--theme_inherits_from", - "value": "var(--vkui--theme_inherits_from, vkBase)", + "value": "var(--vkui--theme_inherits_from, vkCom)", }, "themeName": { "name": "--vkui--theme_name", @@ -323445,7 +323452,7 @@ exports[`shapshots vkontakteCom theme should match cssVars snapshot 1`] = ` }, "themeNameBase": { "name": "--vkui--theme_name_base", - "value": "var(--vkui--theme_name_base, vkCom)", + "value": "var(--vkui--theme_name_base, vkontakteCom)", }, "themeType": "cssVars", "vkontakteBackgroundHoverAlpha": { @@ -325356,9 +325363,9 @@ exports[`shapshots vkontakteCom theme should match pixelify theme snapshot 1`] = "spacingSizeS": "6px", "spacingSizeXl": "12px", "spacingSizeXs": "4px", - "themeInheritsFrom": "vkBase", + "themeInheritsFrom": "vkCom", "themeName": "vkontakteCom", - "themeNameBase": "vkCom", + "themeNameBase": "vkontakteCom", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "rgba(174, 183, 194, 0.2)", @@ -326602,9 +326609,9 @@ exports[`shapshots vkontakteCom theme should match pseudo theme from CssVars 1`] "spacingSizeS": "var(--vkui--spacing_size_s, 6px)", "spacingSizeXl": "var(--vkui--spacing_size_xl, 12px)", "spacingSizeXs": "var(--vkui--spacing_size_xs, 4px)", - "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBase)", + "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkCom)", "themeName": "var(--vkui--theme_name, vkontakteCom)", - "themeNameBase": "var(--vkui--theme_name_base, vkCom)", + "themeNameBase": "var(--vkui--theme_name_base, vkontakteCom)", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "var(--vkui--vkontakte_background_hover_alpha--active, rgba(174, 183, 194, 0.2))", @@ -327848,9 +327855,9 @@ exports[`shapshots vkontakteCom theme should match root theme snapshot 1`] = ` "spacingSizeS": 6, "spacingSizeXl": 12, "spacingSizeXs": 4, - "themeInheritsFrom": "vkBase", + "themeInheritsFrom": "vkCom", "themeName": "vkontakteCom", - "themeNameBase": "vkCom", + "themeNameBase": "vkontakteCom", "themeType": "root", "vkontakteBackgroundHoverAlpha": { "active": "rgba(174, 183, 194, 0.2)", @@ -331133,7 +331140,7 @@ exports[`shapshots vkontakteComDark theme should match cssVars snapshot 1`] = ` }, "themeInheritsFrom": { "name": "--vkui--theme_inherits_from", - "value": "var(--vkui--theme_inherits_from, vkBaseDark)", + "value": "var(--vkui--theme_inherits_from, vkComDark)", }, "themeName": { "name": "--vkui--theme_name", @@ -331141,7 +331148,7 @@ exports[`shapshots vkontakteComDark theme should match cssVars snapshot 1`] = ` }, "themeNameBase": { "name": "--vkui--theme_name_base", - "value": "var(--vkui--theme_name_base, vkCom)", + "value": "var(--vkui--theme_name_base, vkontakteCom)", }, "themeType": "cssVars", "vkontakteBackgroundHoverAlpha": { @@ -333052,9 +333059,9 @@ exports[`shapshots vkontakteComDark theme should match pixelify theme snapshot 1 "spacingSizeS": "6px", "spacingSizeXl": "12px", "spacingSizeXs": "4px", - "themeInheritsFrom": "vkBaseDark", + "themeInheritsFrom": "vkComDark", "themeName": "vkontakteComDark", - "themeNameBase": "vkCom", + "themeNameBase": "vkontakteCom", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "rgba(255, 255, 255, 0.16)", @@ -334298,9 +334305,9 @@ exports[`shapshots vkontakteComDark theme should match pseudo theme from CssVars "spacingSizeS": "var(--vkui--spacing_size_s, 6px)", "spacingSizeXl": "var(--vkui--spacing_size_xl, 12px)", "spacingSizeXs": "var(--vkui--spacing_size_xs, 4px)", - "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBaseDark)", + "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkComDark)", "themeName": "var(--vkui--theme_name, vkontakteComDark)", - "themeNameBase": "var(--vkui--theme_name_base, vkCom)", + "themeNameBase": "var(--vkui--theme_name_base, vkontakteCom)", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "var(--vkui--vkontakte_background_hover_alpha--active, rgba(255, 255, 255, 0.16))", @@ -335544,9 +335551,9 @@ exports[`shapshots vkontakteComDark theme should match root theme snapshot 1`] = "spacingSizeS": 6, "spacingSizeXl": 12, "spacingSizeXs": 4, - "themeInheritsFrom": "vkBaseDark", + "themeInheritsFrom": "vkComDark", "themeName": "vkontakteComDark", - "themeNameBase": "vkCom", + "themeNameBase": "vkontakteCom", "themeType": "root", "vkontakteBackgroundHoverAlpha": { "active": "rgba(255, 255, 255, 0.16)", @@ -338829,7 +338836,7 @@ exports[`shapshots vkontakteIOS theme should match cssVars snapshot 1`] = ` }, "themeInheritsFrom": { "name": "--vkui--theme_inherits_from", - "value": "var(--vkui--theme_inherits_from, vkBase)", + "value": "var(--vkui--theme_inherits_from, vkIOS)", }, "themeName": { "name": "--vkui--theme_name", @@ -338837,7 +338844,7 @@ exports[`shapshots vkontakteIOS theme should match cssVars snapshot 1`] = ` }, "themeNameBase": { "name": "--vkui--theme_name_base", - "value": "var(--vkui--theme_name_base, vkIOS)", + "value": "var(--vkui--theme_name_base, vkontakteIOS)", }, "themeType": "cssVars", "vkontakteBackgroundHoverAlpha": { @@ -340748,9 +340755,9 @@ exports[`shapshots vkontakteIOS theme should match pixelify theme snapshot 1`] = "spacingSizeS": "6px", "spacingSizeXl": "12px", "spacingSizeXs": "4px", - "themeInheritsFrom": "vkBase", + "themeInheritsFrom": "vkIOS", "themeName": "vkontakteIOS", - "themeNameBase": "vkIOS", + "themeNameBase": "vkontakteIOS", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "rgba(0, 0, 0, 0.12)", @@ -341994,9 +342001,9 @@ exports[`shapshots vkontakteIOS theme should match pseudo theme from CssVars 1`] "spacingSizeS": "var(--vkui--spacing_size_s, 6px)", "spacingSizeXl": "var(--vkui--spacing_size_xl, 12px)", "spacingSizeXs": "var(--vkui--spacing_size_xs, 4px)", - "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBase)", + "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkIOS)", "themeName": "var(--vkui--theme_name, vkontakteIOS)", - "themeNameBase": "var(--vkui--theme_name_base, vkIOS)", + "themeNameBase": "var(--vkui--theme_name_base, vkontakteIOS)", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "var(--vkui--vkontakte_background_hover_alpha--active, rgba(0, 0, 0, 0.12))", @@ -343240,9 +343247,9 @@ exports[`shapshots vkontakteIOS theme should match root theme snapshot 1`] = ` "spacingSizeS": 6, "spacingSizeXl": 12, "spacingSizeXs": 4, - "themeInheritsFrom": "vkBase", + "themeInheritsFrom": "vkIOS", "themeName": "vkontakteIOS", - "themeNameBase": "vkIOS", + "themeNameBase": "vkontakteIOS", "themeType": "root", "vkontakteBackgroundHoverAlpha": { "active": "rgba(0, 0, 0, 0.12)", @@ -346525,7 +346532,7 @@ exports[`shapshots vkontakteIOSDark theme should match cssVars snapshot 1`] = ` }, "themeInheritsFrom": { "name": "--vkui--theme_inherits_from", - "value": "var(--vkui--theme_inherits_from, vkBaseDark)", + "value": "var(--vkui--theme_inherits_from, vkIOSDark)", }, "themeName": { "name": "--vkui--theme_name", @@ -346533,7 +346540,7 @@ exports[`shapshots vkontakteIOSDark theme should match cssVars snapshot 1`] = ` }, "themeNameBase": { "name": "--vkui--theme_name_base", - "value": "var(--vkui--theme_name_base, vkIOS)", + "value": "var(--vkui--theme_name_base, vkontakteIOS)", }, "themeType": "cssVars", "vkontakteBackgroundHoverAlpha": { @@ -348444,9 +348451,9 @@ exports[`shapshots vkontakteIOSDark theme should match pixelify theme snapshot 1 "spacingSizeS": "6px", "spacingSizeXl": "12px", "spacingSizeXs": "4px", - "themeInheritsFrom": "vkBaseDark", + "themeInheritsFrom": "vkIOSDark", "themeName": "vkontakteIOSDark", - "themeNameBase": "vkIOS", + "themeNameBase": "vkontakteIOS", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "rgba(255, 255, 255, 0.12)", @@ -349690,9 +349697,9 @@ exports[`shapshots vkontakteIOSDark theme should match pseudo theme from CssVars "spacingSizeS": "var(--vkui--spacing_size_s, 6px)", "spacingSizeXl": "var(--vkui--spacing_size_xl, 12px)", "spacingSizeXs": "var(--vkui--spacing_size_xs, 4px)", - "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkBaseDark)", + "themeInheritsFrom": "var(--vkui--theme_inherits_from, vkIOSDark)", "themeName": "var(--vkui--theme_name, vkontakteIOSDark)", - "themeNameBase": "var(--vkui--theme_name_base, vkIOS)", + "themeNameBase": "var(--vkui--theme_name_base, vkontakteIOS)", "themeType": "pixelify", "vkontakteBackgroundHoverAlpha": { "active": "var(--vkui--vkontakte_background_hover_alpha--active, rgba(255, 255, 255, 0.12))", @@ -350936,9 +350943,9 @@ exports[`shapshots vkontakteIOSDark theme should match root theme snapshot 1`] = "spacingSizeS": 6, "spacingSizeXl": 12, "spacingSizeXs": 4, - "themeInheritsFrom": "vkBaseDark", + "themeInheritsFrom": "vkIOSDark", "themeName": "vkontakteIOSDark", - "themeNameBase": "vkIOS", + "themeNameBase": "vkontakteIOS", "themeType": "root", "vkontakteBackgroundHoverAlpha": { "active": "rgba(255, 255, 255, 0.12)", diff --git a/src/themeDescriptions/themes/vkontakteAndroid/index.ts b/src/themeDescriptions/themes/vkontakteAndroid/index.ts index 8f5e37c0..646e6673 100644 --- a/src/themeDescriptions/themes/vkontakteAndroid/index.ts +++ b/src/themeDescriptions/themes/vkontakteAndroid/index.ts @@ -7,6 +7,8 @@ import type { ThemeVkontakteAndroidDarkDescription } from '@/interfaces/themes/v import { darkTheme as vkDarkTheme, lightTheme as vkLightTheme } from '../../base/vk'; +const themeNameBase = 'vkontakteAndroid'; + export const vkontakteLocalColorLight: LocalVkontakteAndroidColorsDescriptionStruct = { vkontakteColorSnippetBorderAlpha: 'rgba(0, 0, 0, 0.15)', vkontakteColorSnippetBackground: '#FFFFFF', @@ -232,7 +234,9 @@ export const vkontakteTokens = { export const vkontakteAndroidTheme: ThemeVkontakteAndroidDescription = { ...vkLightTheme, - themeName: 'vkontakteAndroid', + themeName: themeNameBase, + themeNameBase, + themeInheritsFrom: vkLightTheme.themeName, colors: { ...vkLightTheme.colors, @@ -243,7 +247,9 @@ export const vkontakteAndroidTheme: ThemeVkontakteAndroidDescription = { export const vkontakteAndroidThemeDark: ThemeVkontakteAndroidDarkDescription = { ...vkDarkTheme, - themeName: 'vkontakteAndroidDark', + themeName: `${themeNameBase}Dark`, + themeNameBase, + themeInheritsFrom: vkDarkTheme.themeName, colorsScheme: 'dark', colors: { diff --git a/src/themeDescriptions/themes/vkontakteCom/index.ts b/src/themeDescriptions/themes/vkontakteCom/index.ts index f567c6ed..e3732234 100644 --- a/src/themeDescriptions/themes/vkontakteCom/index.ts +++ b/src/themeDescriptions/themes/vkontakteCom/index.ts @@ -4,6 +4,8 @@ import { ThemeVkontakteComDarkDescription } from '../../../interfaces/themes/vko import { vkComTheme, vkComThemeDark } from '../vkCom'; import { vkontakteTokens } from '../vkontakteAndroid'; +const themeNameBase = 'vkontakteCom'; + const vkontakteComLocalColorLight: LocalVkontakteAndroidColorsDescriptionStruct = { vkontakteColorSnippetBorderAlpha: 'rgba(0, 0, 0, 0.12)', vkontakteColorSnippetBackground: '#FFFFFF', @@ -188,7 +190,9 @@ const vkontakteComLocalColorDark: LocalVkontakteAndroidColorsDescriptionStruct = export const vkontakteComTheme: ThemeVkontakteComDescription = { ...vkComTheme, - themeName: 'vkontakteCom', + themeName: themeNameBase, + themeNameBase, + themeInheritsFrom: vkComTheme.themeName, colors: { ...vkComTheme.colors, @@ -199,7 +203,9 @@ export const vkontakteComTheme: ThemeVkontakteComDescription = { export const vkontakteComThemeDark: ThemeVkontakteComDarkDescription = { ...vkComThemeDark, - themeName: 'vkontakteComDark', + themeName: `${themeNameBase}Dark`, + themeNameBase, + themeInheritsFrom: vkComThemeDark.themeName, colorsScheme: 'dark', colors: { diff --git a/src/themeDescriptions/themes/vkontakteIOS/index.ts b/src/themeDescriptions/themes/vkontakteIOS/index.ts index f4bf772b..3cda32c5 100644 --- a/src/themeDescriptions/themes/vkontakteIOS/index.ts +++ b/src/themeDescriptions/themes/vkontakteIOS/index.ts @@ -7,9 +7,13 @@ import { vkontakteTokens, } from '../vkontakteAndroid'; +const themeNameBase = 'vkontakteIOS'; + export const vkontakteIOSTheme: ThemeVkontakteIOSDescription = { ...vkIOSTheme, - themeName: 'vkontakteIOS', + themeName: themeNameBase, + themeNameBase, + themeInheritsFrom: vkIOSTheme.themeName, colors: { ...vkIOSTheme.colors, @@ -20,7 +24,9 @@ export const vkontakteIOSTheme: ThemeVkontakteIOSDescription = { export const vkontakteIOSThemeDark: ThemeVkontakteIOSDarkDescription = { ...vkIOSThemeDark, - themeName: 'vkontakteIOSDark', + themeName: `${themeNameBase}Dark`, + themeNameBase, + themeInheritsFrom: vkIOSThemeDark.themeName, colorsScheme: 'dark', colors: {