Skip to content

Commit f349f23

Browse files
committed
Merge branch 'main' of github.com:SAP/fundamental-styles into fix/icon-tabs-header-horizon-delta-theming
2 parents 19c43c1 + 5f537c4 commit f349f23

File tree

10 files changed

+93
-81
lines changed

10 files changed

+93
-81
lines changed

.storybook/custom/decorators/componentStylesProvider.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ import { componentsManager } from '../../environment';
33

44
const defaultManagersKey = Symbol('Default manager');
55

6-
const components = componentsManager(defaultManagersKey.toString());
6+
const components = {
7+
[defaultManagersKey.toString()]: componentsManager(defaultManagersKey.toString())
8+
};
9+
10+
function getComponentsManager(managerKey) {
11+
if (!components[managerKey]) {
12+
components[managerKey] = componentsManager(managerKey);
13+
}
14+
15+
return components[managerKey];
16+
}
717

818
export const withComponentStylesProvider = makeDecorator({
919
name: 'withComponentStyles',
@@ -12,7 +22,7 @@ export const withComponentStylesProvider = makeDecorator({
1222
wrapper: (storyFn, context) => {
1323
const forComponents = context?.parameters?.components || [];
1424
forComponents.indexOf('info-label') === -1 && forComponents.push('info-label');
15-
components.use(forComponents);
25+
getComponentsManager(context.id).use(forComponents);
1626
return storyFn(context);
1727
}
1828
});

.storybook/custom/decorators/themeProvider.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ import { themeManager } from '../../environment';
33

44
const defaultManagersKey = Symbol('Default manager');
55

6-
const themes = themeManager(defaultManagersKey.toString());
6+
const themes = {
7+
[defaultManagersKey.toString()]: themeManager(defaultManagersKey.toString())
8+
};
9+
10+
function getThemeManager(managerKey) {
11+
if (!themes.hasOwnProperty(managerKey)) {
12+
themes[managerKey] = themeManager(managerKey);
13+
}
14+
return themes[managerKey];
15+
}
716

817
// this is a story decorator, used to inject link style tags
918
// into the HTML document, based on the current selected theme
@@ -13,7 +22,7 @@ export const withThemeProvider = makeDecorator({
1322
parameterName: 'themes',
1423
wrapper: (storyFn, context) => {
1524
const newTheme = context?.parameters?.theme || context?.globals?.theme || 'sap_fiori_3';
16-
themes.use(newTheme);
25+
getThemeManager(context.id).use(newTheme);
1726
return storyFn(context);
1827
}
1928
});

.storybook/custom/styleChangers/dev/componentStylesManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ export default (manager) => {
3434

3535
return {
3636
use: (components) => {
37-
currentComponents.forEach(unuseComponent);
3837
for (const componentName of components) {
3938
useComponent(componentName);
4039
}
40+
currentComponents.forEach(unuseComponent);
4141
currentComponents = [...components];
4242
}
4343
};

.storybook/custom/styleChangers/dev/themeVariablesManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ export default (manager) => {
3434

3535
return {
3636
use: (themeName) => {
37+
baseVariables[themeName].use();
38+
styleVariables[themeName].use();
3739
if (currentTheme && currentTheme !== themeName) {
3840
baseVariables[currentTheme].unuse();
3941
styleVariables[currentTheme].unuse();
4042
}
4143
currentTheme = themeName;
42-
baseVariables[themeName].use();
43-
styleVariables[themeName].use();
4444
}
4545
};
4646
};

.storybook/custom/styleChangers/prod/componentStylesManager.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import getLazyLoader from '../utils/getLazyLoader';
33

44
export default (managedBy) => {
55
let loadedComponentStyles = {};
6-
let currentComponents = [];
76

87
const styleLinkTag = generateStyleLinkTagFn(managedBy);
98
const lazyLoader = getLazyLoader(styleLinkTag);
@@ -16,17 +15,6 @@ export default (managedBy) => {
1615
return `${stylePath}.css`;
1716
};
1817

19-
const unuseComponent = (componentName) => {
20-
if (
21-
loadedComponentStyles.hasOwnProperty(componentName)
22-
) {
23-
loadedComponentStyles[componentName].unuse();
24-
delete loadedComponentStyles[componentName];
25-
} else {
26-
console.log('Component not loaded');
27-
}
28-
};
29-
3018
const useComponent = (componentName) => {
3119
if (!loadedComponentStyles[componentName]) {
3220
loadedComponentStyles[componentName] = lazyLoader(
@@ -38,11 +26,9 @@ export default (managedBy) => {
3826

3927
return {
4028
use: (components) => {
41-
currentComponents.forEach((componentName) => unuseComponent(componentName));
4229
for (const componentName of components) {
4330
useComponent(componentName);
4431
}
45-
currentComponents = [...components];
4632
}
4733
};
4834
};

.storybook/custom/styleChangers/prod/themeVariablesManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export default (managedBy) => {
1919

2020
return {
2121
use: (themeName) => {
22+
baseVariables[themeName].use();
23+
styleVariables[themeName].use();
2224
if (currentTheme && currentTheme !== themeName) {
2325
baseVariables[currentTheme].unuse();
2426
styleVariables[currentTheme].unuse();
2527
}
2628
currentTheme = themeName;
27-
baseVariables[themeName].use();
28-
styleVariables[themeName].use();
2929
}
3030
};
3131
};

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11

2+
## 0.24.0-rc.24 (2022-04-10)
3+
4+
## 0.24.0-rc.23 (2022-04-10)
5+
6+
## 0.24.0-rc.22 (2022-04-10)
7+
8+
9+
### Features
10+
11+
* **common-css:** publish padding and margin classes ([#3306](https://github.com/SAP/fundamental-styles/issues/3306)) ([facb744](https://github.com/SAP/fundamental-styles/commit/facb744b36f7435d387c720fcda0d8cd53e37533))
12+
213
## 0.24.0-rc.21 (2022-04-05)
314

415
## 0.24.0-rc.20 (2022-04-05)

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fundamental-styles",
3-
"version": "0.24.0-rc.21",
3+
"version": "0.24.0-rc.24",
44
"description": "Fundamental Library Styles is a Design System and HTML/CSS Component Library used to build modern Product User Experiences with SAP Fiori look and feel with any web technology. Learn more about this project at - http://sap.github.io/fundamental-styles/",
55
"main": "dist/fundamental-styles.css",
66
"scripts": {
@@ -70,18 +70,18 @@
7070
"@commitlint/config-conventional": "^16.0.0",
7171
"@commitlint/travis-cli": "^16.0.0",
7272
"@sap-theming/theming-base-content": "11.1.38",
73-
"@storybook/addon-a11y": "6.4.20",
74-
"@storybook/addon-actions": "6.4.20",
75-
"@storybook/addon-controls": "6.4.20",
73+
"@storybook/addon-a11y": "6.4.21",
74+
"@storybook/addon-actions": "6.4.21",
75+
"@storybook/addon-controls": "6.4.21",
7676
"@storybook/addon-cssresources": "6.2.9",
77-
"@storybook/addon-docs": "6.4.20",
78-
"@storybook/addon-links": "6.4.20",
79-
"@storybook/addon-storyshots": "6.4.20",
80-
"@storybook/addon-toolbars": "6.4.20",
81-
"@storybook/addon-viewport": "6.4.20",
82-
"@storybook/addons": "6.4.20",
77+
"@storybook/addon-docs": "6.4.21",
78+
"@storybook/addon-links": "6.4.21",
79+
"@storybook/addon-storyshots": "6.4.21",
80+
"@storybook/addon-toolbars": "6.4.21",
81+
"@storybook/addon-viewport": "6.4.21",
82+
"@storybook/addons": "6.4.21",
8383
"@storybook/builder-webpack5": "^6.5.0-alpha.16",
84-
"@storybook/html": "6.4.20",
84+
"@storybook/html": "6.4.21",
8585
"@storybook/manager-webpack5": "^6.5.0-alpha.16",
8686
"@storybook/preset-scss": "^1.0.3",
8787
"babel-eslint": "^10.1.0",
@@ -96,7 +96,7 @@
9696
"css-loader": "^5.2.4",
9797
"cssnano": "^4.1.11",
9898
"eslint": "^7.25.0",
99-
"eslint-plugin-storybook": "^0.5.6",
99+
"eslint-plugin-storybook": "^0.5.8",
100100
"fs-extra": "^10.0.0",
101101
"gh-pages": "^3.2.3",
102102
"github-assistant": "^0.3.3",

0 commit comments

Comments
 (0)