-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename to CSSTokens and CSS custom properties
- Loading branch information
Showing
14 changed files
with
83 additions
and
83 deletions.
There are no files selected for viewing
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,18 @@ | ||
import CustomPropertyNames from './CustomPropertyNames'; | ||
|
||
type CustomPropertyNamesType = typeof CustomPropertyNames; | ||
|
||
type CSSTokensType<T extends Readonly<Record<string, string>>> = { | ||
[K in keyof T]: `var(${T[K]})`; | ||
}; | ||
|
||
// To add/remove/update a token, go to `CustomPropertyName.ts`. | ||
const CSSTokens = new Proxy<CSSTokensType<CustomPropertyNamesType>>({} as CSSTokensType<CustomPropertyNamesType>, { | ||
get(_, key: keyof CustomPropertyNamesType) { | ||
// We already checked in the `CustomPropertyName`. | ||
// eslint-disable-next-line security/detect-object-injection | ||
return `var(${CustomPropertyNames[key]})`; | ||
} | ||
}); | ||
|
||
export default CSSTokens; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const CustomPropertyNames = Object.freeze({ | ||
// Make sure key names does not have JavaScript forbidden names. | ||
ColorAccent: '--webchat__color--accent', | ||
ColorTimestamp: '--webchat__color--timestamp', | ||
FontPrimary: '--webchat__font--primary', | ||
FontSizeSmall: '--webchat__font-size--small', | ||
IconURLExternalLink: '--webchat__icon-url--external-link', | ||
MaxWidthBubble: '--webchat__max-width--bubble', | ||
MinHeightBubble: '--webchat__min-height--bubble', | ||
PaddingRegular: '--webchat__padding--regular' | ||
} as const); | ||
|
||
// This is for type-checking only to make sure the CSS custom property names is `--webchat__${string}`. | ||
const _TypeChecking: Readonly<Record<string, `--webchat__${string}`>> = CustomPropertyNames; | ||
|
||
export default CustomPropertyNames; |
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
14 changes: 0 additions & 14 deletions
14
packages/component/src/Styles/StyleSet/OriginatorActivityStatus.ts
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
6 changes: 4 additions & 2 deletions
6
packages/component/src/Styles/StyleSet/SlottedActivityStatus.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
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