@fluentui-react-native/apple-theme 0.9.6 → 0.9.10
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.json +174 -1
- package/CHANGELOG.md +44 -2
- package/babel.config.js +1 -1
- package/just.config.js +1 -1
- package/lib/appleColors.macos.d.ts.map +1 -1
- package/lib/appleColors.macos.js +29 -29
- package/lib/appleColors.macos.js.map +1 -1
- package/lib/appleColors.types.macos.d.ts +6 -1
- package/lib/appleColors.types.macos.d.ts.map +1 -1
- package/lib/appleHighContrast.macos.d.ts +3 -0
- package/lib/appleHighContrast.macos.d.ts.map +1 -0
- package/lib/appleHighContrast.macos.js +8 -0
- package/lib/appleHighContrast.macos.js.map +1 -0
- package/lib/createAppleTheme.macos.d.ts.map +1 -1
- package/lib/createAppleTheme.macos.js +16 -1
- package/lib/createAppleTheme.macos.js.map +1 -1
- package/lib/createMacOSAliasTokens.d.ts +1 -1
- package/lib/createMacOSAliasTokens.d.ts.map +1 -1
- package/lib/createMacOSAliasTokens.js +4 -4
- package/lib/createMacOSAliasTokens.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/appleColors.macos.d.ts.map +1 -1
- package/lib-commonjs/appleColors.macos.js +29 -29
- package/lib-commonjs/appleColors.macos.js.map +1 -1
- package/lib-commonjs/appleColors.types.macos.d.ts +6 -1
- package/lib-commonjs/appleColors.types.macos.d.ts.map +1 -1
- package/lib-commonjs/appleHighContrast.macos.d.ts +3 -0
- package/lib-commonjs/appleHighContrast.macos.d.ts.map +1 -0
- package/lib-commonjs/appleHighContrast.macos.js +13 -0
- package/lib-commonjs/appleHighContrast.macos.js.map +1 -0
- package/lib-commonjs/createAppleTheme.macos.d.ts.map +1 -1
- package/lib-commonjs/createAppleTheme.macos.js +16 -1
- package/lib-commonjs/createAppleTheme.macos.js.map +1 -1
- package/lib-commonjs/createMacOSAliasTokens.d.ts +1 -1
- package/lib-commonjs/createMacOSAliasTokens.d.ts.map +1 -1
- package/lib-commonjs/createMacOSAliasTokens.js +3 -3
- package/lib-commonjs/createMacOSAliasTokens.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -9
- package/src/appleColors.macos.ts +29 -32
- package/src/appleColors.types.macos.ts +6 -1
- package/src/appleHighContrast.macos.ts +9 -0
- package/src/createAppleTheme.macos.ts +18 -2
- package/src/createMacOSAliasTokens.ts +4 -4
- package/src/index.ts +1 -0
|
@@ -210,17 +210,22 @@ interface FluentAppleButtonTokens {
|
|
|
210
210
|
brandBackgroundHovered: ColorValue;
|
|
211
211
|
brandBackgroundPressed: ColorValue;
|
|
212
212
|
brandForegroundDisabled: ColorValue;
|
|
213
|
-
|
|
213
|
+
brandForegroundPressed: ColorValue;
|
|
214
214
|
neutralStrokeDisabled: ColorValue;
|
|
215
215
|
neutralBackgroundInverted: ColorValue;
|
|
216
216
|
neutralForegroundInverted: ColorValue;
|
|
217
217
|
neutralForeground2: ColorValue;
|
|
218
218
|
neutralBackground1: ColorValue;
|
|
219
219
|
neutralBackground2: ColorValue;
|
|
220
|
+
neutralBackgroundDisabled: ColorValue;
|
|
221
|
+
neutralBackground2Pressed: ColorValue;
|
|
220
222
|
neutralStroke2: ColorValue;
|
|
221
223
|
neutralForeground3: ColorValue;
|
|
224
|
+
neutralForegroundDisabled: ColorValue;
|
|
225
|
+
neutralForeground2Pressed: ColorValue;
|
|
222
226
|
neutralBackground3: ColorValue;
|
|
223
227
|
transparentBackground: ColorValue;
|
|
228
|
+
transparentStroke: ColorValue;
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
export type FluentUIApplePalette = FluentUIAppleBasePalette & FluentAppleButtonTokens;
|
|
@@ -2,15 +2,31 @@ import { ThemeReference } from '@fluentui-react-native/theme';
|
|
|
2
2
|
import { Theme } from '@fluentui-react-native/theme-types';
|
|
3
3
|
import { Appearance } from 'react-native';
|
|
4
4
|
import { getBaseAppleThemeMacOS } from './appleTheme.macos';
|
|
5
|
+
import { AccessibilityInfo } from 'react-native-macos';
|
|
6
|
+
import { setIsHighContrast } from './appleHighContrast.macos';
|
|
7
|
+
|
|
8
|
+
let appleThemeReference: ThemeReference;
|
|
5
9
|
|
|
6
10
|
export function createAppleTheme(): ThemeReference {
|
|
7
|
-
|
|
11
|
+
appleThemeReference = new ThemeReference({} as Theme, () => {
|
|
8
12
|
return getBaseAppleThemeMacOS();
|
|
9
13
|
});
|
|
14
|
+
// Fetch initial system settings for high contrast mode
|
|
15
|
+
highContrastHandler();
|
|
16
|
+
// Invalidate theme and set prop when high contrast setting changes
|
|
17
|
+
AccessibilityInfo.addEventListener('highContrastChanged', () => {
|
|
18
|
+
highContrastHandler();
|
|
19
|
+
});
|
|
10
20
|
|
|
11
21
|
Appearance.addChangeListener(() => {
|
|
12
22
|
appleThemeReference.invalidate();
|
|
13
23
|
});
|
|
14
|
-
|
|
15
24
|
return appleThemeReference;
|
|
16
25
|
}
|
|
26
|
+
|
|
27
|
+
function highContrastHandler() {
|
|
28
|
+
AccessibilityInfo.isHighContrastEnabled().then((isEnabled) => {
|
|
29
|
+
setIsHighContrast(isEnabled);
|
|
30
|
+
appleThemeReference.invalidate();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getMacOSAliasTokens } from '@fluentui-react-native/theme-tokens';
|
|
2
2
|
import { AliasColorTokens, AppearanceOptions } from '@fluentui-react-native/theme-types';
|
|
3
|
-
import { memoize } from '@fluentui-react-native/memo-cache';
|
|
4
3
|
import { mapPipelineToTheme } from '@fluentui-react-native/theming-utils';
|
|
4
|
+
import { memoize } from '@fluentui-react-native/memo-cache';
|
|
5
5
|
|
|
6
|
-
function createMacOSAliasTokensWorker(mode: AppearanceOptions): AliasColorTokens {
|
|
7
|
-
const aliasTokens =
|
|
6
|
+
function createMacOSAliasTokensWorker(mode: AppearanceOptions, isHighContrast: boolean): AliasColorTokens {
|
|
7
|
+
const aliasTokens = getMacOSAliasTokens(mode, isHighContrast);
|
|
8
8
|
return mapPipelineToTheme(aliasTokens);
|
|
9
9
|
}
|
|
10
10
|
|
package/src/index.ts
CHANGED