@atlaskit/storybook-addon-design-system 0.3.3 → 0.3.5

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/storybook-addon-design-system
2
2
 
3
+ ## 0.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 0.3.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`43464a5fb17`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43464a5fb17) - Update split and stack theme settings to use tilde selectors
14
+
3
15
  ## 0.3.3
4
16
 
5
17
  ### Patch Changes
@@ -56,8 +56,12 @@ var stackColumnStyles = {
56
56
  * .ads-theme-override, for split and stack views.
57
57
  */
58
58
 
59
- var hackThemeOverrideOnStyleElement = function hackThemeOverrideOnStyleElement(style, theme) {
60
- style.innerText = style.textContent.replace("html[data-theme=\"".concat(theme, "\"]"), "html[data-theme=\"".concat(theme, "\"],.ads-theme-override[data-theme=\"").concat(theme, "\"]"));
59
+ var hackThemeOverrideOnStyleElement = function hackThemeOverrideOnStyleElement(style) {
60
+ var regex = /html\[(data-theme.?=)"(light|dark)"\](\s{)/i;
61
+
62
+ if (regex.test(style.innerText)) {
63
+ style.innerText = style.textContent.replace(regex, "html[$1\"$2\"], .ads-theme-override[$1\"$2\"]$3");
64
+ }
61
65
  };
62
66
 
63
67
  var withDesignTokens = (0, _addons.makeDecorator)({
@@ -67,13 +71,8 @@ var withDesignTokens = (0, _addons.makeDecorator)({
67
71
  var theme = context.globals.adsTheme; // eslint-disable-next-line react-hooks/rules-of-hooks
68
72
 
69
73
  (0, _addons.useEffect)(function () {
70
- var adsThemes = ['light', 'dark'];
71
74
  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
- });
75
+ hackThemeOverrideOnStyleElement(el);
77
76
  });
78
77
  }, [context.id]); // eslint-disable-next-line react-hooks/rules-of-hooks
79
78
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/storybook-addon-design-system",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "sideEffects": false
5
5
  }
@@ -29,8 +29,12 @@ const stackColumnStyles = {
29
29
  * .ads-theme-override, for split and stack views.
30
30
  */
31
31
 
32
- const hackThemeOverrideOnStyleElement = (style, theme) => {
33
- style.innerText = style.textContent.replace(`html[data-theme="${theme}"]`, `html[data-theme="${theme}"],.ads-theme-override[data-theme="${theme}"]`);
32
+ const hackThemeOverrideOnStyleElement = style => {
33
+ const regex = /html\[(data-theme.?=)"(light|dark)"\](\s{)/i;
34
+
35
+ if (regex.test(style.innerText)) {
36
+ style.innerText = style.textContent.replace(regex, `html[$1"$2"], .ads-theme-override[$1"$2"]$3`);
37
+ }
34
38
  };
35
39
 
36
40
  const withDesignTokens = makeDecorator({
@@ -40,13 +44,8 @@ const withDesignTokens = makeDecorator({
40
44
  const theme = context.globals.adsTheme; // eslint-disable-next-line react-hooks/rules-of-hooks
41
45
 
42
46
  useEffect(() => {
43
- const adsThemes = ['light', 'dark'];
44
47
  document.querySelectorAll('style').forEach(el => {
45
- adsThemes.forEach(adsTheme => {
46
- if (el.innerText.includes(`html[data-theme="${adsTheme}"] {`)) {
47
- hackThemeOverrideOnStyleElement(el, adsTheme);
48
- }
49
- });
48
+ hackThemeOverrideOnStyleElement(el);
50
49
  });
51
50
  }, [context.id]); // eslint-disable-next-line react-hooks/rules-of-hooks
52
51
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/storybook-addon-design-system",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "sideEffects": false
5
5
  }
@@ -35,8 +35,12 @@ var stackColumnStyles = {
35
35
  * .ads-theme-override, for split and stack views.
36
36
  */
37
37
 
38
- var hackThemeOverrideOnStyleElement = function hackThemeOverrideOnStyleElement(style, theme) {
39
- style.innerText = style.textContent.replace("html[data-theme=\"".concat(theme, "\"]"), "html[data-theme=\"".concat(theme, "\"],.ads-theme-override[data-theme=\"").concat(theme, "\"]"));
38
+ var hackThemeOverrideOnStyleElement = function hackThemeOverrideOnStyleElement(style) {
39
+ var regex = /html\[(data-theme.?=)"(light|dark)"\](\s{)/i;
40
+
41
+ if (regex.test(style.innerText)) {
42
+ style.innerText = style.textContent.replace(regex, "html[$1\"$2\"], .ads-theme-override[$1\"$2\"]$3");
43
+ }
40
44
  };
41
45
 
42
46
  var withDesignTokens = makeDecorator({
@@ -46,13 +50,8 @@ var withDesignTokens = makeDecorator({
46
50
  var theme = context.globals.adsTheme; // eslint-disable-next-line react-hooks/rules-of-hooks
47
51
 
48
52
  useEffect(function () {
49
- var adsThemes = ['light', 'dark'];
50
53
  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
- });
54
+ hackThemeOverrideOnStyleElement(el);
56
55
  });
57
56
  }, [context.id]); // eslint-disable-next-line react-hooks/rules-of-hooks
58
57
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/storybook-addon-design-system",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/storybook-addon-design-system",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Design token storybook addon",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -35,7 +35,7 @@
35
35
  ".": "./src/index.tsx"
36
36
  },
37
37
  "dependencies": {
38
- "@atlaskit/tokens": "^0.10.0",
38
+ "@atlaskit/tokens": "^0.11.0",
39
39
  "@babel/runtime": "^7.0.0",
40
40
  "@storybook/addons": "^6.4.0",
41
41
  "@storybook/api": "^6.4.0",
@@ -55,7 +55,9 @@
55
55
  "dom-events": "use-bind-event-listener",
56
56
  "design-system": "v1",
57
57
  "deprecation": "no-deprecated-imports",
58
- "styling": "emotion"
58
+ "styling": [
59
+ "emotion"
60
+ ]
59
61
  }
60
62
  },
61
63
  "homepage": "https://atlassian.design/components/storybook-addon-design-system",
package/report.api.md CHANGED
@@ -1,11 +1,16 @@
1
- ## API Report File for "@atlaskit/storybook-addon-design-system".
1
+ ## API Report File for "@atlaskit/storybook-addon-design-system"
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
4
8
 
5
9
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
10
 
7
11
  ```ts
8
- export declare const withDesignTokens: (...args: any) => any;
12
+ // @public (undocumented)
13
+ export const withDesignTokens: (...args: any) => any;
9
14
 
10
- export {};
15
+ // (No @packageDocumentation comment for this package)
11
16
  ```
@@ -1 +0,0 @@
1
- export { withDesignTokens } from './tokens';
@@ -1 +0,0 @@
1
- export { default as Tool } from './tool';
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * __Tool__
4
- *
5
- * ADS Toolbar UI, visible in the topbar of the storybook UI.
6
- */
7
- declare const Tool: () => JSX.Element;
8
- export default Tool;
@@ -1,5 +0,0 @@
1
- export declare const ADDON_ID = "ads-tokens";
2
- export declare const TOOL_ID: string;
3
- export declare const TITLE = "Design Tokens";
4
- export declare const DECORATOR_ID = "withDesignTokens";
5
- export declare const DECORATOR_PARAM = "DesignTokens";
@@ -1,4 +0,0 @@
1
- import '@atlaskit/tokens/css/atlassian-light.css';
2
- import '@atlaskit/tokens/css/atlassian-dark.css';
3
- declare const withDesignTokens: (...args: any) => any;
4
- export default withDesignTokens;
@@ -1 +0,0 @@
1
- export { default as withDesignTokens } from './decorator';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare type Themes = 'light' | 'dark' | 'none' | 'split' | 'stack';