@atlaskit/app-provider 3.3.0 → 3.3.2
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 +15 -0
- package/dist/cjs/theme-provider/index.js +1 -7
- package/dist/cjs/theme-provider/utils/load-and-mount-themes.js +2 -2
- package/dist/es2019/theme-provider/index.js +2 -9
- package/dist/es2019/theme-provider/utils/load-and-mount-themes.js +2 -2
- package/dist/esm/theme-provider/index.js +2 -8
- package/dist/esm/theme-provider/utils/load-and-mount-themes.js +2 -2
- package/dist/types/theme-provider/utils/load-and-mount-themes.d.ts +2 -2
- package/dist/types-ts4.5/theme-provider/utils/load-and-mount-themes.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/app-provider
|
|
2
2
|
|
|
3
|
+
## 3.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`d9d9cbc1507f6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d9d9cbc1507f6) -
|
|
14
|
+
Internal change how default theme settings are shared between `@atlaskit/tokens` and
|
|
15
|
+
`@atlaskit/app-provider`.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.3.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -178,13 +178,7 @@ function ThemeProvider(_ref) {
|
|
|
178
178
|
} else {
|
|
179
179
|
// For other theme providers (whether outside AppProvider or nested inside a ThemeProvider),
|
|
180
180
|
// we treat them as sub-tree themes that do not load global theme state.
|
|
181
|
-
|
|
182
|
-
colorMode: reconciledColorMode,
|
|
183
|
-
contrastMode: _tokens.themeStateDefaults.contrastMode,
|
|
184
|
-
shape: _tokens.themeStateDefaults.shape(),
|
|
185
|
-
typography: _tokens.themeStateDefaults.typography()
|
|
186
|
-
});
|
|
187
|
-
(0, _loadAndMountThemes.loadAndMountThemes)(themeState);
|
|
181
|
+
(0, _loadAndMountThemes.loadAndMountThemes)(theme);
|
|
188
182
|
}
|
|
189
183
|
}, [isInsideAppProvider, isInsideThemeProvider, isRootThemeProvider, reconciledColorMode, theme]);
|
|
190
184
|
(0, _react.useEffect)(function () {
|
|
@@ -109,12 +109,12 @@ var loadAndMountThemeCss = /*#__PURE__*/function () {
|
|
|
109
109
|
};
|
|
110
110
|
}();
|
|
111
111
|
var loadAndMountThemes = exports.loadAndMountThemes = /*#__PURE__*/function () {
|
|
112
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(
|
|
112
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(theme) {
|
|
113
113
|
var themesToLoad;
|
|
114
114
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
115
115
|
while (1) switch (_context4.prev = _context4.next) {
|
|
116
116
|
case 0:
|
|
117
|
-
themesToLoad =
|
|
117
|
+
themesToLoad = Object.values(theme).filter(function (themeId) {
|
|
118
118
|
return !!themeId;
|
|
119
119
|
});
|
|
120
120
|
themesToLoad.forEach(loadAndMountThemeCss);
|
|
@@ -5,7 +5,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { bind } from 'bind-event-listener';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { getThemeHtmlAttrs, setGlobalTheme, SUBTREE_THEME_ATTRIBUTE
|
|
8
|
+
import { getThemeHtmlAttrs, setGlobalTheme, SUBTREE_THEME_ATTRIBUTE } from '@atlaskit/tokens';
|
|
9
9
|
import { useIsInsideAppProvider } from '../context';
|
|
10
10
|
import { ColorModeContext, SetColorModeContext } from './context/color-mode';
|
|
11
11
|
import { InsideThemeProviderContext } from './context/inside-theme-provider';
|
|
@@ -122,14 +122,7 @@ function ThemeProvider({
|
|
|
122
122
|
} else {
|
|
123
123
|
// For other theme providers (whether outside AppProvider or nested inside a ThemeProvider),
|
|
124
124
|
// we treat them as sub-tree themes that do not load global theme state.
|
|
125
|
-
|
|
126
|
-
...theme,
|
|
127
|
-
colorMode: reconciledColorMode,
|
|
128
|
-
contrastMode: themeStateDefaults.contrastMode,
|
|
129
|
-
shape: themeStateDefaults.shape(),
|
|
130
|
-
typography: themeStateDefaults.typography()
|
|
131
|
-
};
|
|
132
|
-
loadAndMountThemes(themeState);
|
|
125
|
+
loadAndMountThemes(theme);
|
|
133
126
|
}
|
|
134
127
|
}, [isInsideAppProvider, isInsideThemeProvider, isRootThemeProvider, reconciledColorMode, theme]);
|
|
135
128
|
useEffect(() => {
|
|
@@ -41,7 +41,7 @@ const loadAndMountThemeCss = async themeId => {
|
|
|
41
41
|
}
|
|
42
42
|
mountThemeCss(themeCss, themeId);
|
|
43
43
|
};
|
|
44
|
-
export const loadAndMountThemes = async
|
|
45
|
-
const themesToLoad =
|
|
44
|
+
export const loadAndMountThemes = async theme => {
|
|
45
|
+
const themesToLoad = Object.values(theme).filter(themeId => !!themeId);
|
|
46
46
|
themesToLoad.forEach(loadAndMountThemeCss);
|
|
47
47
|
};
|
|
@@ -11,7 +11,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
11
11
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
12
|
import { bind } from 'bind-event-listener';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
import { getThemeHtmlAttrs, setGlobalTheme, SUBTREE_THEME_ATTRIBUTE
|
|
14
|
+
import { getThemeHtmlAttrs, setGlobalTheme, SUBTREE_THEME_ATTRIBUTE } from '@atlaskit/tokens';
|
|
15
15
|
import { useIsInsideAppProvider } from '../context';
|
|
16
16
|
import { ColorModeContext, SetColorModeContext } from './context/color-mode';
|
|
17
17
|
import { InsideThemeProviderContext } from './context/inside-theme-provider';
|
|
@@ -169,13 +169,7 @@ function ThemeProvider(_ref) {
|
|
|
169
169
|
} else {
|
|
170
170
|
// For other theme providers (whether outside AppProvider or nested inside a ThemeProvider),
|
|
171
171
|
// we treat them as sub-tree themes that do not load global theme state.
|
|
172
|
-
|
|
173
|
-
colorMode: reconciledColorMode,
|
|
174
|
-
contrastMode: themeStateDefaults.contrastMode,
|
|
175
|
-
shape: themeStateDefaults.shape(),
|
|
176
|
-
typography: themeStateDefaults.typography()
|
|
177
|
-
});
|
|
178
|
-
loadAndMountThemes(themeState);
|
|
172
|
+
loadAndMountThemes(theme);
|
|
179
173
|
}
|
|
180
174
|
}, [isInsideAppProvider, isInsideThemeProvider, isRootThemeProvider, reconciledColorMode, theme]);
|
|
181
175
|
useEffect(function () {
|
|
@@ -102,12 +102,12 @@ var loadAndMountThemeCss = /*#__PURE__*/function () {
|
|
|
102
102
|
};
|
|
103
103
|
}();
|
|
104
104
|
export var loadAndMountThemes = /*#__PURE__*/function () {
|
|
105
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(
|
|
105
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(theme) {
|
|
106
106
|
var themesToLoad;
|
|
107
107
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
108
108
|
while (1) switch (_context4.prev = _context4.next) {
|
|
109
109
|
case 0:
|
|
110
|
-
themesToLoad =
|
|
110
|
+
themesToLoad = Object.values(theme).filter(function (themeId) {
|
|
111
111
|
return !!themeId;
|
|
112
112
|
});
|
|
113
113
|
themesToLoad.forEach(loadAndMountThemeCss);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const loadAndMountThemes: (
|
|
1
|
+
import { type Theme } from '../context/theme';
|
|
2
|
+
export declare const loadAndMountThemes: (theme: Partial<Theme>) => Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare const loadAndMountThemes: (
|
|
1
|
+
import { type Theme } from '../context/theme';
|
|
2
|
+
export declare const loadAndMountThemes: (theme: Partial<Theme>) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/app-provider",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "A top level provider for the Design System.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
39
39
|
"@atlaskit/css": "^0.19.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
41
|
-
"@atlaskit/tokens": "^
|
|
41
|
+
"@atlaskit/tokens": "^10.0.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"bind-event-listener": "^3.0.0"
|
|
44
44
|
},
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@af/visual-regression": "workspace:^",
|
|
50
50
|
"@atlaskit/dropdown-menu": "^16.4.0",
|
|
51
|
-
"@atlaskit/primitives": "^17.
|
|
51
|
+
"@atlaskit/primitives": "^17.1.0",
|
|
52
52
|
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
53
53
|
"@atlassian/ssr-tests": "workspace:^",
|
|
54
54
|
"@testing-library/react": "^16.3.0",
|