Skip to content

Commit 2e2439a

Browse files
authored
feat: provide named exports for some base modules (#347)
- UI5Element is now default export of webcomponents-base - Theming features exported in - "@ui5/webcomponents-base/Theming"
1 parent 9eed566 commit 2e2439a

File tree

6 files changed

+14
-3
lines changed

6 files changed

+14
-3
lines changed

packages/base/Theming.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { setTheme, addCustomCSS } from "./src/Theming.js";
2+
3+
export { setTheme, addCustomCSS };

packages/base/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import UI5Element from "./src/UI5Element.js";
2+
3+
export default UI5Element;
4+
export { UI5Element };

packages/base/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "UI5 Web Components: webcomponents.base",
55
"author": "SAP SE (https://www.sap.com)",
66
"license": "Apache-2.0",
7+
"module": "index.js",
78
"keywords": [
89
"openui5",
910
"sapui5",

packages/base/src/Theming.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getTheme, _setTheme } from "./Configuration.js";
2-
import { getCustomCSS } from "./theming/CustomStyle.js";
2+
import { addCustomCSS, getCustomCSS } from "./theming/CustomStyle.js";
33
import { getThemeProperties } from "./theming/ThemeProperties.js";
44
import { injectThemeProperties } from "./theming/StyleInjection.js";
55

@@ -58,4 +58,5 @@ export {
5858
applyTheme,
5959
setTheme,
6060
getEffectiveStyle,
61+
addCustomCSS,
6162
};

packages/base/src/theming/ThemeProperties.js

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ const getThemeProperties = async (packageName, themeName) => {
2626

2727
const fetchThemeProperties = async (packageName, themeName) => {
2828
const url = themeURLs.get(`${packageName}_${themeName}`);
29+
30+
if (!url) {
31+
throw new Error(`You have to import @ui5/webcomponents/dist/ThemePropertiesProvider module to use theme switching`);
32+
}
2933
return fetchTextOnce(url);
3034
};
3135

packages/main/src/ThemePropertiesProvider.js

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { registerThemeProperties } from "@ui5/webcomponents-base/src/theming/The
22

33
import belizeThemeProperties from "./themes/sap_belize/parameters-bundle.css.js";
44
import belizeHcbThemeProperties from "./themes/sap_belize_hcb/parameters-bundle.css.js";
5-
import fiori3ThemeProperties from "./themes/sap_fiori_3/parameters-bundle.css.js";
65

76
registerThemeProperties("@ui5/webcomponents", "sap_belize", belizeThemeProperties);
87
registerThemeProperties("@ui5/webcomponents", "sap_belize_hcb", belizeHcbThemeProperties);
9-
registerThemeProperties("@ui5/webcomponents", "sap_fiori_3", fiori3ThemeProperties);

0 commit comments

Comments
 (0)