From a5fc7c3580f2475eea68cfbd3bea6a98c4f81b25 Mon Sep 17 00:00:00 2001 From: Vladislav Tasev Date: Wed, 18 Dec 2024 09:32:01 +0200 Subject: [PATCH 1/3] fix: custom theme detection --- packages/base/src/theming/getThemeDesignerTheme.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/src/theming/getThemeDesignerTheme.ts b/packages/base/src/theming/getThemeDesignerTheme.ts index 0197df3ff756..b9b7a79dfe83 100644 --- a/packages/base/src/theming/getThemeDesignerTheme.ts +++ b/packages/base/src/theming/getThemeDesignerTheme.ts @@ -68,7 +68,7 @@ const processThemeMetadata = (metadata: ThemeMetadata): ThemeDescriptor | undefi let baseThemeName; try { - themeName = metadata.Path.match(/\.([^.]+)\.css_variables$/)![1]; + themeName = metadata.Path.split(".")![2]; baseThemeName = metadata.Extends[0]; } catch (ex) { if (!warnings.has("object")) { From 03e89a3a3a09328560469e895735f6a39687a8bd Mon Sep 17 00:00:00 2001 From: Vladislav Tasev Date: Wed, 18 Dec 2024 13:34:57 +0200 Subject: [PATCH 2/3] chore: add fallback --- packages/base/src/theming/getThemeDesignerTheme.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/base/src/theming/getThemeDesignerTheme.ts b/packages/base/src/theming/getThemeDesignerTheme.ts index b9b7a79dfe83..a8e7619966e4 100644 --- a/packages/base/src/theming/getThemeDesignerTheme.ts +++ b/packages/base/src/theming/getThemeDesignerTheme.ts @@ -68,7 +68,8 @@ const processThemeMetadata = (metadata: ThemeMetadata): ThemeDescriptor | undefi let baseThemeName; try { - themeName = metadata.Path.split(".")![2]; + const pathParts = metadata.Path.split("."); + themeName = pathParts.length === 4 ? pathParts[2] : getComputedStyle(document.body).getPropertyValue('--sapSapThemeId'); baseThemeName = metadata.Extends[0]; } catch (ex) { if (!warnings.has("object")) { From b7bd9bc5c129a6ee3ba575140d9f174195f31dbb Mon Sep 17 00:00:00 2001 From: Vladislav Tasev Date: Wed, 18 Dec 2024 13:48:02 +0200 Subject: [PATCH 3/3] chore: lint --- packages/base/src/theming/getThemeDesignerTheme.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/src/theming/getThemeDesignerTheme.ts b/packages/base/src/theming/getThemeDesignerTheme.ts index a8e7619966e4..031327b47f71 100644 --- a/packages/base/src/theming/getThemeDesignerTheme.ts +++ b/packages/base/src/theming/getThemeDesignerTheme.ts @@ -69,7 +69,7 @@ const processThemeMetadata = (metadata: ThemeMetadata): ThemeDescriptor | undefi try { const pathParts = metadata.Path.split("."); - themeName = pathParts.length === 4 ? pathParts[2] : getComputedStyle(document.body).getPropertyValue('--sapSapThemeId'); + themeName = pathParts.length === 4 ? pathParts[2] : getComputedStyle(document.body).getPropertyValue("--sapSapThemeId"); baseThemeName = metadata.Extends[0]; } catch (ex) { if (!warnings.has("object")) {