@atlaskit/storybook-addon-design-system 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/tokens/decorator.js +20 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/tokens/decorator.js +18 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/tokens/decorator.js +20 -0
- package/dist/esm/version.json +1 -1
- package/package.json +3 -2
- package/report.api.md +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/storybook-addon-design-system
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6dd7050ad7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6dd7050ad7a) - Reimplement the style tag hack required for enabling split & stack view in the Storybook addon
|
|
8
|
+
|
|
3
9
|
## 0.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -51,12 +51,32 @@ var stackColumnStyles = {
|
|
|
51
51
|
background: (0, _tokens.token)('color.background.default'),
|
|
52
52
|
color: (0, _tokens.token)('color.text.highEmphasis')
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Forcefully retarget the token declarations to apply to our hacked class,
|
|
56
|
+
* .ads-theme-override, for split and stack views.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
var hackThemeOverrideOnStyleElement = function hackThemeOverrideOnStyleElement(style, theme) {
|
|
60
|
+
return style.innerText.replace("html[data-theme=\"".concat(theme, "\"]"), "html[data-theme=\"".concat(theme, "\"],.ads-theme-override[data-theme=\"").concat(theme, "\"]"));
|
|
61
|
+
};
|
|
62
|
+
|
|
54
63
|
var withDesignTokens = (0, _addons.makeDecorator)({
|
|
55
64
|
name: _constants.DECORATOR_ID,
|
|
56
65
|
parameterName: _constants.DECORATOR_PARAM,
|
|
57
66
|
wrapper: function wrapper(storyFn, context) {
|
|
58
67
|
var theme = context.globals.adsTheme; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
59
68
|
|
|
69
|
+
(0, _addons.useEffect)(function () {
|
|
70
|
+
var adsThemes = ['light', 'dark'];
|
|
71
|
+
document.querySelectorAll('style').forEach(function (el) {
|
|
72
|
+
adsThemes.forEach(function (adsTheme) {
|
|
73
|
+
if (el.innerText.includes("html[data-theme=\"".concat(adsTheme, "\"] {"))) {
|
|
74
|
+
hackThemeOverrideOnStyleElement(el, adsTheme);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}, [context.id]); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
79
|
+
|
|
60
80
|
(0, _addons.useEffect)(function () {
|
|
61
81
|
if (!theme || theme === 'none') {
|
|
62
82
|
delete document.documentElement.dataset.theme;
|
package/dist/cjs/version.json
CHANGED
|
@@ -24,12 +24,30 @@ const stackColumnStyles = {
|
|
|
24
24
|
background: token('color.background.default'),
|
|
25
25
|
color: token('color.text.highEmphasis')
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Forcefully retarget the token declarations to apply to our hacked class,
|
|
29
|
+
* .ads-theme-override, for split and stack views.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const hackThemeOverrideOnStyleElement = (style, theme) => style.innerText.replace(`html[data-theme="${theme}"]`, `html[data-theme="${theme}"],.ads-theme-override[data-theme="${theme}"]`);
|
|
33
|
+
|
|
27
34
|
const withDesignTokens = makeDecorator({
|
|
28
35
|
name: DECORATOR_ID,
|
|
29
36
|
parameterName: DECORATOR_PARAM,
|
|
30
37
|
wrapper: (storyFn, context) => {
|
|
31
38
|
const theme = context.globals.adsTheme; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
32
39
|
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const adsThemes = ['light', 'dark'];
|
|
42
|
+
document.querySelectorAll('style').forEach(el => {
|
|
43
|
+
adsThemes.forEach(adsTheme => {
|
|
44
|
+
if (el.innerText.includes(`html[data-theme="${adsTheme}"] {`)) {
|
|
45
|
+
hackThemeOverrideOnStyleElement(el, adsTheme);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}, [context.id]); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
|
+
|
|
33
51
|
useEffect(() => {
|
|
34
52
|
if (!theme || theme === 'none') {
|
|
35
53
|
delete document.documentElement.dataset.theme;
|
package/dist/es2019/version.json
CHANGED
|
@@ -30,12 +30,32 @@ var stackColumnStyles = {
|
|
|
30
30
|
background: token('color.background.default'),
|
|
31
31
|
color: token('color.text.highEmphasis')
|
|
32
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Forcefully retarget the token declarations to apply to our hacked class,
|
|
35
|
+
* .ads-theme-override, for split and stack views.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
var hackThemeOverrideOnStyleElement = function hackThemeOverrideOnStyleElement(style, theme) {
|
|
39
|
+
return style.innerText.replace("html[data-theme=\"".concat(theme, "\"]"), "html[data-theme=\"".concat(theme, "\"],.ads-theme-override[data-theme=\"").concat(theme, "\"]"));
|
|
40
|
+
};
|
|
41
|
+
|
|
33
42
|
var withDesignTokens = makeDecorator({
|
|
34
43
|
name: DECORATOR_ID,
|
|
35
44
|
parameterName: DECORATOR_PARAM,
|
|
36
45
|
wrapper: function wrapper(storyFn, context) {
|
|
37
46
|
var theme = context.globals.adsTheme; // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
38
47
|
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
var adsThemes = ['light', 'dark'];
|
|
50
|
+
document.querySelectorAll('style').forEach(function (el) {
|
|
51
|
+
adsThemes.forEach(function (adsTheme) {
|
|
52
|
+
if (el.innerText.includes("html[data-theme=\"".concat(adsTheme, "\"] {"))) {
|
|
53
|
+
hackThemeOverrideOnStyleElement(el, adsTheme);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}, [context.id]); // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
58
|
+
|
|
39
59
|
useEffect(function () {
|
|
40
60
|
if (!theme || theme === 'none') {
|
|
41
61
|
delete document.documentElement.dataset.theme;
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/storybook-addon-design-system",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Design token storybook addon",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"draft": true
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
18
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
19
19
|
"main": "dist/cjs/index.js",
|
|
20
20
|
"module": "dist/esm/index.js",
|
|
21
21
|
"module:es2019": "dist/es2019/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"import-structure": "atlassian-conventions"
|
|
44
44
|
},
|
|
45
45
|
"@repo/internal": {
|
|
46
|
+
"dom-events": "use-bind-event-listener",
|
|
46
47
|
"design-system": "v1",
|
|
47
48
|
"deprecation": "no-deprecated-imports",
|
|
48
49
|
"styling": "emotion"
|
package/report.api.md
ADDED