@atlaskit/help-article 6.0.35 → 6.0.37

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,19 @@
1
1
  # @atlaskit/help-article
2
2
 
3
+ ## 6.0.37
4
+
5
+ ### Patch Changes
6
+
7
+ - [`379cf9c4c25f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/379cf9c4c25f0) -
8
+ Internal changes to remove unnecessary token fallbacks and imports from `@atlaskit/theme`
9
+ - Updated dependencies
10
+
11
+ ## 6.0.36
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 6.0.35
4
18
 
5
19
  ### Patch Changes
@@ -32,6 +32,9 @@
32
32
  {
33
33
  "path": "../../../design-system/icon/afm-cc/tsconfig.json"
34
34
  },
35
+ {
36
+ "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
37
+ },
35
38
  {
36
39
  "path": "../../../design-system/primitives/afm-cc/tsconfig.json"
37
40
  },
@@ -32,6 +32,9 @@
32
32
  {
33
33
  "path": "../../../design-system/icon/afm-jira/tsconfig.json"
34
34
  },
35
+ {
36
+ "path": "../../../platform/feature-flags/afm-jira/tsconfig.json"
37
+ },
35
38
  {
36
39
  "path": "../../../design-system/primitives/afm-jira/tsconfig.json"
37
40
  },
@@ -32,6 +32,9 @@
32
32
  {
33
33
  "path": "../../../design-system/icon/afm-products/tsconfig.json"
34
34
  },
35
+ {
36
+ "path": "../../../platform/feature-flags/afm-products/tsconfig.json"
37
+ },
35
38
  {
36
39
  "path": "../../../design-system/primitives/afm-products/tsconfig.json"
37
40
  },
@@ -13,6 +13,7 @@ var _renderer = require("@atlaskit/renderer");
13
13
  var _HelpArticle = require("../../model/HelpArticle");
14
14
  var _resetCss = _interopRequireDefault(require("./resetCss"));
15
15
  var _styled = require("./styled");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
18
  // eslint-disable-next-line import/no-extraneous-dependencies
18
19
 
@@ -138,6 +139,30 @@ var ArticleBody = exports.ArticleBody = function ArticleBody(props) {
138
139
  var style = iframeDocument.createElement('style');
139
140
  style.innerText = _resetCss.default;
140
141
  head.appendChild(style);
142
+ if ((0, _platformFeatureFlags.fg)('asf-943-in-product-help-dark-mode')) {
143
+ // Copy theme attributes from parent document to iframe for dark mode support
144
+ var parentHtml = document.documentElement;
145
+ var iframeHtml = iframeDocument.documentElement;
146
+ var colorMode = parentHtml.getAttribute('data-color-mode');
147
+ var themeAttr = parentHtml.getAttribute('data-theme');
148
+ if (colorMode) {
149
+ iframeHtml.setAttribute('data-color-mode', colorMode);
150
+ }
151
+ if (themeAttr) {
152
+ iframeHtml.setAttribute('data-theme', themeAttr);
153
+ }
154
+
155
+ // Copy theme style elements from parent document into the iframe
156
+ var themeStyles = document.querySelectorAll('style[data-theme]');
157
+ themeStyles.forEach(function (themeStyle) {
158
+ var clonedStyle = iframeDocument.createElement('style');
159
+ clonedStyle.textContent = themeStyle.textContent;
160
+ if (themeStyle instanceof HTMLElement && themeStyle.dataset.theme) {
161
+ clonedStyle.dataset.theme = themeStyle.dataset.theme;
162
+ }
163
+ head.appendChild(clonedStyle);
164
+ });
165
+ }
141
166
  resizeIframe();
142
167
  if (onArticleRenderBegin) {
143
168
  onArticleRenderBegin();
@@ -7,6 +7,7 @@ import { ReactRenderer } from '@atlaskit/renderer';
7
7
  import { BODY_FORMAT_TYPES } from '../../model/HelpArticle';
8
8
  import resetCSS from './resetCss';
9
9
  import { ArticleFrame } from './styled';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  const IFRAME_CONTAINER_ID = 'help-iframe-container';
11
12
  const IFRAME_ID = 'help-iframe';
12
13
 
@@ -127,6 +128,30 @@ export const ArticleBody = props => {
127
128
  const style = iframeDocument.createElement('style');
128
129
  style.innerText = resetCSS;
129
130
  head.appendChild(style);
131
+ if (fg('asf-943-in-product-help-dark-mode')) {
132
+ // Copy theme attributes from parent document to iframe for dark mode support
133
+ const parentHtml = document.documentElement;
134
+ const iframeHtml = iframeDocument.documentElement;
135
+ const colorMode = parentHtml.getAttribute('data-color-mode');
136
+ const themeAttr = parentHtml.getAttribute('data-theme');
137
+ if (colorMode) {
138
+ iframeHtml.setAttribute('data-color-mode', colorMode);
139
+ }
140
+ if (themeAttr) {
141
+ iframeHtml.setAttribute('data-theme', themeAttr);
142
+ }
143
+
144
+ // Copy theme style elements from parent document into the iframe
145
+ const themeStyles = document.querySelectorAll('style[data-theme]');
146
+ themeStyles.forEach(themeStyle => {
147
+ const clonedStyle = iframeDocument.createElement('style');
148
+ clonedStyle.textContent = themeStyle.textContent;
149
+ if (themeStyle instanceof HTMLElement && themeStyle.dataset.theme) {
150
+ clonedStyle.dataset.theme = themeStyle.dataset.theme;
151
+ }
152
+ head.appendChild(clonedStyle);
153
+ });
154
+ }
130
155
  resizeIframe();
131
156
  if (onArticleRenderBegin) {
132
157
  onArticleRenderBegin();
@@ -7,6 +7,7 @@ import { ReactRenderer } from '@atlaskit/renderer';
7
7
  import { BODY_FORMAT_TYPES } from '../../model/HelpArticle';
8
8
  import resetCSS from './resetCss';
9
9
  import { ArticleFrame } from './styled';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  var IFRAME_CONTAINER_ID = 'help-iframe-container';
11
12
  var IFRAME_ID = 'help-iframe';
12
13
 
@@ -129,6 +130,30 @@ export var ArticleBody = function ArticleBody(props) {
129
130
  var style = iframeDocument.createElement('style');
130
131
  style.innerText = resetCSS;
131
132
  head.appendChild(style);
133
+ if (fg('asf-943-in-product-help-dark-mode')) {
134
+ // Copy theme attributes from parent document to iframe for dark mode support
135
+ var parentHtml = document.documentElement;
136
+ var iframeHtml = iframeDocument.documentElement;
137
+ var colorMode = parentHtml.getAttribute('data-color-mode');
138
+ var themeAttr = parentHtml.getAttribute('data-theme');
139
+ if (colorMode) {
140
+ iframeHtml.setAttribute('data-color-mode', colorMode);
141
+ }
142
+ if (themeAttr) {
143
+ iframeHtml.setAttribute('data-theme', themeAttr);
144
+ }
145
+
146
+ // Copy theme style elements from parent document into the iframe
147
+ var themeStyles = document.querySelectorAll('style[data-theme]');
148
+ themeStyles.forEach(function (themeStyle) {
149
+ var clonedStyle = iframeDocument.createElement('style');
150
+ clonedStyle.textContent = themeStyle.textContent;
151
+ if (themeStyle instanceof HTMLElement && themeStyle.dataset.theme) {
152
+ clonedStyle.dataset.theme = themeStyle.dataset.theme;
153
+ }
154
+ head.appendChild(clonedStyle);
155
+ });
156
+ }
132
157
  resizeIframe();
133
158
  if (onArticleRenderBegin) {
134
159
  onArticleRenderBegin();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/help-article",
3
- "version": "6.0.35",
3
+ "version": "6.0.37",
4
4
  "description": "A cross-product help-article component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,12 +31,13 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/css-reset": "^7.3.0",
34
+ "@atlaskit/css-reset": "^7.4.0",
35
35
  "@atlaskit/heading": "^5.3.0",
36
- "@atlaskit/icon": "^32.1.0",
37
- "@atlaskit/primitives": "^18.0.0",
38
- "@atlaskit/renderer": "^128.0.0",
39
- "@atlaskit/tokens": "^11.1.0",
36
+ "@atlaskit/icon": "^33.1.0",
37
+ "@atlaskit/platform-feature-flags": "^1.1.0",
38
+ "@atlaskit/primitives": "^18.1.0",
39
+ "@atlaskit/renderer": "^128.6.0",
40
+ "@atlaskit/tokens": "^11.4.0",
40
41
  "@babel/runtime": "^7.0.0",
41
42
  "@compiled/react": "^0.20.0",
42
43
  "lodash": "^4.17.21"
@@ -65,5 +66,10 @@
65
66
  "compiled"
66
67
  ]
67
68
  }
69
+ },
70
+ "platform-feature-flags": {
71
+ "asf-943-in-product-help-dark-mode": {
72
+ "type": "boolean"
73
+ }
68
74
  }
69
75
  }