Skip to content

Commit

Permalink
feat: add color recipes to web component packages (#16755)
Browse files Browse the repository at this point in the history
* feat: move color recipes into fluent web component package

* Change files

* udpate recipe paths

* ensure tests and syntax are correct

* add more typedoc comments

* update FAST deps

* add generated file to prettier ignore

* Change files
  • Loading branch information
chrisdholt authored Feb 2, 2021
1 parent 84ab12f commit e4079ad
Show file tree
Hide file tree
Showing 57 changed files with 4,871 additions and 172 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ change

# package specific files
packages/web-components/**/*.spec.ts
packages/web-components/src/default-palette.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "feat: move color recipes into fluent web component package",
"packageName": "@fluentui/web-components",
"email": "chhol@microsoft.com",
"dependentChangeType": "patch",
"date": "2021-02-02T19:55:41.615Z"
}
1 change: 1 addition & 0 deletions packages/web-components/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/typedef': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
},
Expand Down
29 changes: 29 additions & 0 deletions packages/web-components/build/generate-default-palettes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import fs from 'fs';
import path from 'path';
import { parseColorHexRGB } from '@microsoft/fast-colors';
import { createColorPalette } from '../src/color/create-color-palette';
import { accentBaseColor, neutralBaseColor } from '../src/color/color-constants';

const outpath = path.resolve(__dirname, '../src/default-palette.ts');

/**
* Define palettes from base colors
*/
const neutralPalette = createColorPalette(parseColorHexRGB(neutralBaseColor));
const accentPalette = createColorPalette(parseColorHexRGB(accentBaseColor));

const file = `/**
* DO NOT EDIT THIS FILE DIRECTLY
* This file generated by web-components/build/${path.parse(__filename).name}${path.parse(__filename).ext}
*/
export const neutralPalette: string[] = ${JSON.stringify(neutralPalette, null, 4)};
export const accentPalette: string[] = ${JSON.stringify(accentPalette, null, 4)};
`;

fs.writeFile(outpath, file, error => {
if (error) {
throw error;
} else {
console.log('\nPalette data written to', outpath, '\n');
}
});
31 changes: 0 additions & 31 deletions packages/web-components/color.ts

This file was deleted.

Loading

0 comments on commit e4079ad

Please sign in to comment.