Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/base/src/UI5Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import type I18nBundle from "./i18nBundle.js";
import { fetchCldr } from "./asset-registries/LocaleData.js";
import getLocale from "./locale/getLocale.js";
import { getLanguageChangePending } from "./config/Language.js";
import { getThemeProperties } from "./asset-registries/Themes.js";
import { getTheme } from "./config/Theme.js";

const DEV_MODE = true;
let autoId = 0;
Expand Down Expand Up @@ -1327,6 +1329,8 @@ abstract class UI5Element extends HTMLElement {
return this.i18nBundleStorage;
}

static themeProperties?: string;

/**
* Registers a UI5 Web Component in the browser window object
* @public
Expand All @@ -1344,6 +1348,7 @@ abstract class UI5Element extends HTMLElement {
const bundleName = pair[1].bundleName;
this.i18nBundleStorage[bundleName] = i18nBundles[index];
});
this.themeProperties = await getThemeProperties("@ui5/webcomponents", getTheme());
this.asyncFinished = true;
};
this.definePromise = defineSequence();
Expand Down
4 changes: 4 additions & 0 deletions packages/base/src/css/SystemCSSVars.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
:root {
--_ui5_content_density:cozy;
--_compact_size: 0;
--_cozy_size: 1;
}

[data-ui5-compact-size],
.ui5-content-density-compact,
.sapUiSizeCompact {
--_ui5_content_density:compact;
--_compact_size: 1;
--_cozy_size: 0;
}
3 changes: 2 additions & 1 deletion packages/base/src/theming/applyTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { attachCustomThemeStylesToHead, getThemeRoot } from "../config/ThemeRoot.js";
import type OpenUI5Support from "../features/OpenUI5Support.js";
import { DEFAULT_THEME } from "../generated/AssetParameters.js";
import { getCurrentRuntimeIndex } from "../Runtimes.js";

Check failure on line 9 in packages/base/src/theming/applyTheme.ts

View workflow job for this annotation

GitHub Actions / check

'getCurrentRuntimeIndex' is defined but never used

// eslint-disable-next-line
export let _lib = "ui5";
Expand Down Expand Up @@ -45,7 +45,8 @@

const cssData = await getThemeProperties(packageName, theme, externalThemeName);
if (cssData) {
createOrUpdateStyle(cssData, `data-ui5-component-properties-${getCurrentRuntimeIndex()}`, packageName);
//
// createOrUpdateStyle(cssData, `data-ui5-component-properties-${getCurrentRuntimeIndex()}`, packageName);
}
});

Expand Down
4 changes: 3 additions & 1 deletion packages/base/src/theming/getEffectiveStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { getFeature } from "../FeaturesRegistry.js";
import type UI5Element from "../UI5Element.js";
import type OpenUI5Enablement from "../features/OpenUI5Enablement.js";
import { getThemeProperties } from "../asset-registries/Themes.js";

Check failure on line 6 in packages/base/src/theming/getEffectiveStyle.ts

View workflow job for this annotation

GitHub Actions / check

'getThemeProperties' is defined but never used

const effectiveStyleMap = new Map<string, string>();

Expand All @@ -24,8 +25,9 @@

const customStyle = getCustomCSS(tag) || "";
const builtInStyles = getStylesString(ElementClass.styles);
const properties = ElementClass.themeProperties?.replaceAll(":root", ":host") || "";

const effectiveStyle = `${builtInStyles} ${customStyle} ${busyIndicatorStyles}`;
const effectiveStyle = `${builtInStyles} ${customStyle} ${busyIndicatorStyles} ${properties}`;
effectiveStyleMap.set(key, effectiveStyle);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/test/pages/ShellBar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html dir="ltr">
<head>
<meta charset="utf-8">
<title>Shell Bar</title>
Expand Down
3 changes: 2 additions & 1 deletion packages/main/src/themes/base/Button-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
--_ui5_button_focused_border_radius: 0.25rem;
--_ui5_button_focused_inner_border_radius: 0;
--_ui5_button_base_min_width: 2.5rem;
--_ui5_button_base_height: var(--sapElement_Height);
/* --_ui5_button_base_height: if(style(--_cozy_size): var(--sapElement_Height); else: var(--sapElement_Compact_Height)); */
--_ui5_button_base_height: calc(var(--_cozy_size) * var(--sapElement_Height) + var(--_compact_size) * var(--sapElement_Compact_Height));
--_ui5_button_border_radius: var(--sapButton_BorderCornerRadius);
--_ui5_button_base_padding: 0.6875rem;
--_ui5_button_base_icon_margin: 0.563rem;
Expand Down
6 changes: 6 additions & 0 deletions packages/main/src/themes/base/rtl-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@
--_ui5_segmented_btn_item_border_left: 0.0625rem;
--_ui5_segmented_btn_item_border_right: 0px;
--_ui5-shellbar-notification-btn-count-offset: auto;
}

:host(:dir(rtl)),
:dir(rtl) {
background-color: rgb(239, 185, 185);
--my-height: 200px;
}
2 changes: 1 addition & 1 deletion packages/main/src/themes/base/sizes-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
--_ui5_bar_base_height: 2.5rem;
--_ui5_bar_subheader_height: 2.25rem;

--_ui5_button_base_height: var(--sapElement_Compact_Height);
/* --_ui5_button_base_height: var(--sapElement_Compact_Height); */
--_ui5_button_base_padding: 0.4375rem;
--_ui5_button_base_min_width: 2rem;
--_ui5-button-badge-diameter: 0.625rem;
Expand Down
12 changes: 10 additions & 2 deletions packages/main/test/pages/Button.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@


<link rel="stylesheet" type="text/css" href="./styles/Button.css">

<style>
ui5-button.my-class {
--sapButton_BorderCornerRadius: 100px;
}
:dir(rtl) {
background-color: greenyellow;
}
</style>
</head>

<body class="button1auto">
<ui5-button design="Negative" icon="decline">Reject</ui5-button>
<ui5-button class="my-class" design="Negative" icon="decline">Reject</ui5-button>
<ui5-button design="Positive" icon="add">Add</ui5-button>
<ui5-button icon="home" id="icon-only-comment"><!----><!----></ui5-button>
<ui5-button icon="text" id="icon-only-blank-text"> </ui5-button>
Expand Down Expand Up @@ -148,6 +155,7 @@
</div>

<div dir="rtl">
<span>text</span>
<ui5-title>Cozy</ui5-title>

<ui5-button icon="employee">Emphasized
Expand Down
Loading