-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up iOS alias color tokens (#2481)
### Platforms Impacted - [x] iOS - [ ] macOS - [ ] win32 (Office) - [ ] windows - [ ] android ### Description of changes Set up iOS alias color tokens in FURN (just neutral and brand colors for now; shared colors will be done in a future PR), so the tokens specified in updated Fluent2 designs can be accessed through the theme. 1. The pipeline output is retrieved by getTokens.ios.ts - Also moved apple-theme/getiOSTokens.ts to theme-tokens/getTokens.ios.ts, as per #2190. Slightly unrelated but also recombined the existing android/windows getTokens/getShadowTokens files - they were separated to make android token integration more simple but since that work is complete, should be fine to recombine them and have less files 3. The output gets mapped in an AliasColorTokens object through mapPipelineToTheme - The AliasColorTokens object was updated to include some new mobile tokens - The existing mapPipelineToTheme method in the mapPipelineToTheme.ios.ts file was copied from the original mapPipelineToTheme.ts file. Updated it to match designs - for this file reviewing commit by commit should make the changes more clear 4. The AliasColorTokens object gets added to the iOS color palette in paletteFromAppleColors by createiOSColorAliasTokens Out of scope for this PR: 1. Shared colors (ex. dangerbackground1) - there's been some questions raised about the definitions for these tokens so they haven't been added to the design-tokens package yet 2. Moving all createAliasTokens files from platform-specific themes into the theme-tokens folder - this seemed to have been planned for all the platforms but none of them do this yet. Planning to do this in a future PR ### Verification Initial verification since the actual tokens aren't part of FURN yet - copied some tokens into the IOS alias-tokens files in node_modules, and checked that they were part of the final iOS palette. No visual changes otherwise. Will add these tokens to the Notification component in a future PR for additional verification. ### Pull request checklist This PR has considered (when applicable): - [ ] Automated Tests - [ ] Documentation and examples - [ ] Keyboard Accessibility - [ ] Voiceover - [ ] Internationalization and Right-to-left Layouts
- Loading branch information
Showing
19 changed files
with
225 additions
and
154 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-native-apple-theme-973260f3-3320-4d3c-b409-1650f9205921.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Set up iOS color alias tokens", | ||
"packageName": "@fluentui-react-native/apple-theme", | ||
"email": "78454019+lyzhan7@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-native-theme-tokens-07d59fd7-346d-4840-af85-4aea5c6ddc32.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Bump iOS token packages to include iOS color alias tokens", | ||
"packageName": "@fluentui-react-native/theme-tokens", | ||
"email": "78454019+lyzhan7@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-native-theme-types-ca2fbd5f-b4cd-4f37-8d77-6a3912348246.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Set up iOS color alias tokens", | ||
"packageName": "@fluentui-react-native/theme-types", | ||
"email": "78454019+lyzhan7@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-native-theming-utils-6d24d91b-4ecf-4d20-9965-c7e9e8d4e8f0.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Set up iOS color alias tokens", | ||
"packageName": "@fluentui-react-native/theming-utils", | ||
"email": "78454019+lyzhan7@users.noreply.github.com", | ||
"dependentChangeType": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
packages/theming/theme-tokens/src/getShadowTokens.android.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import iOSLightAliasTokens from '@fluentui-react-native/design-tokens-ios/light/tokens-aliases.json'; | ||
import iOSDarkAliasTokens from '@fluentui-react-native/design-tokens-ios/dark/tokens-aliases.json'; | ||
import iOSLightShadowTokens from '@fluentui-react-native/design-tokens-ios/light/tokens-shadow.json'; | ||
import iOSDarkShadowTokens from '@fluentui-react-native/design-tokens-ios/dark/tokens-shadow.json'; | ||
|
||
import { AppearanceOptions } from '@fluentui-react-native/theme-types'; | ||
import { assertNever } from 'assert-never'; | ||
|
||
export function getAliasTokens(mode: AppearanceOptions) { | ||
if (mode === 'light') { | ||
return iOSLightAliasTokens; | ||
} else if (mode === 'dark') { | ||
return iOSDarkAliasTokens; | ||
} else if (mode === 'highContrast') { | ||
// TODO #2492 we should be throwing an error if highContrast mode is set in iOS, but currently | ||
// the default theme tries to create a highContrast mode so as a workaround we return the light mode tokens. | ||
return iOSLightAliasTokens; | ||
} else { | ||
assertNever(mode); | ||
} | ||
} | ||
|
||
export function getShadowTokens(mode: AppearanceOptions) { | ||
if (mode === 'light') { | ||
return iOSLightShadowTokens; | ||
} else if (mode === 'dark') { | ||
return iOSDarkShadowTokens; | ||
} else if (mode === 'highContrast') { | ||
// TODO #2492 we should be throwing an error if highContrast mode is set in iOS, but currently | ||
// the default theme tries to create a highContrast mode so as a workaround we return the light mode tokens. | ||
return iOSLightShadowTokens; | ||
} else { | ||
assertNever(mode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { default as globalTokens } from './tokens-global'; | ||
export { getAliasTokens } from './getTokens'; | ||
export { getShadowTokens } from './getShadowTokens'; | ||
export { getAliasTokens, getShadowTokens } from './getTokens'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
packages/theming/theming-utils/src/mapPipelineToTheme.android.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.