@fluentui/react-theme 0.0.0-nightlye0b8e1fa6920220128.1 → 0.0.0-nightlye1926bfeca20220204.1

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 CHANGED
@@ -2,15 +2,15 @@
2
2
  "name": "@fluentui/react-theme",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 28 Jan 2022 04:13:23 GMT",
6
- "tag": "@fluentui/react-theme_v0.0.0-nightlye0b8e1fa6920220128.1",
7
- "version": "0.0.0-nightlye0b8e1fa6920220128.1",
5
+ "date": "Fri, 04 Feb 2022 04:13:21 GMT",
6
+ "tag": "@fluentui/react-theme_v0.0.0-nightlye1926bfeca20220204.1",
7
+ "version": "0.0.0-nightlye1926bfeca20220204.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
11
11
  "author": "email not defined",
12
12
  "package": "@fluentui/react-theme",
13
- "commit": "90d10ec8c2d159575962c4d3d913317633b44a7a",
13
+ "commit": "448766390ca759acf60ffccef08e4c3ffe41f4f6",
14
14
  "comment": "Release nightly v9"
15
15
  },
16
16
  {
@@ -43,6 +43,12 @@
43
43
  "commit": "1dba2fca2365f1a748505896679ae160a6fec270",
44
44
  "comment": "remove mergeThemes API"
45
45
  },
46
+ {
47
+ "author": "Humberto.Morimoto@microsoft.com",
48
+ "package": "@fluentui/react-theme",
49
+ "commit": "1c2a4410205d3c86bc885fb74d6aede75d9bd99d",
50
+ "comment": "Theme: Adding function to programmatically generate tokens object based on a theme."
51
+ },
46
52
  {
47
53
  "author": "bsunderhus@microsoft.com",
48
54
  "package": "@fluentui/react-theme",
package/CHANGELOG.md CHANGED
@@ -1,22 +1,23 @@
1
1
  # Change Log - @fluentui/react-theme
2
2
 
3
- This log was last generated on Fri, 28 Jan 2022 04:13:23 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 04 Feb 2022 04:13:21 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightlye0b8e1fa6920220128.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-theme_v0.0.0-nightlye0b8e1fa6920220128.1)
7
+ ## [0.0.0-nightlye1926bfeca20220204.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-theme_v0.0.0-nightlye1926bfeca20220204.1)
8
8
 
9
- Fri, 28 Jan 2022 04:13:23 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-theme_v9.0.0-beta.4..@fluentui/react-theme_v0.0.0-nightlye0b8e1fa6920220128.1)
9
+ Fri, 04 Feb 2022 04:13:21 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-theme_v9.0.0-beta.4..@fluentui/react-theme_v0.0.0-nightlye1926bfeca20220204.1)
11
11
 
12
12
  ### Changes
13
13
 
14
- - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/90d10ec8c2d159575962c4d3d913317633b44a7a) by email not defined)
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/448766390ca759acf60ffccef08e4c3ffe41f4f6) by email not defined)
15
15
  - feat(react-theme): Add colorNeutralForeground1Static token ([PR #21385](https://github.com/microsoft/fluentui/pull/21385) by miroslav.stastny@microsoft.com)
16
16
  - updating brand colors ([PR #20140](https://github.com/microsoft/fluentui/pull/20140) by andmarti@microsoft.com)
17
17
  - feat: Export tokens as mapping to CSS variables ([PR #21026](https://github.com/microsoft/fluentui/pull/21026) by Humberto.Morimoto@microsoft.com)
18
18
  - Extend brand ramp from 13 to 16 tokens ([PR #20884](https://github.com/microsoft/fluentui/pull/20884) by miroslav.stastny@microsoft.com)
19
19
  - remove mergeThemes API ([PR #21278](https://github.com/microsoft/fluentui/pull/21278) by martinhochel@microsoft.com)
20
+ - Theme: Adding function to programmatically generate tokens object based on a theme. ([PR #21548](https://github.com/microsoft/fluentui/pull/21548) by Humberto.Morimoto@microsoft.com)
20
21
  - Remove `themeToCSSVariables` function ([PR #20828](https://github.com/microsoft/fluentui/pull/20828) by bsunderhus@microsoft.com)
21
22
  - feat(react-theme) Add border1 color token for shared colors ([PR #20963](https://github.com/microsoft/fluentui/pull/20963) by miroslav.stastny@microsoft.com)
22
23
 
@@ -337,6 +337,16 @@ export declare const teamsLightTheme: Theme;
337
337
 
338
338
  export declare type Theme = FontSizeTokens & LineHeightTokens & BorderRadiusTokens & StrokeWidthTokens & ShadowTokens & ShadowBrandTokens & FontFamilyTokens & FontWeightTokens & ColorPaletteTokens & ColorTokens;
339
339
 
340
+ /**
341
+ * Programmatically generates a tokens to css variables mapping object from the keys in a theme.
342
+ * This helps with ease of use as a user of a custom theme does not have to manually construct this object, but it could
343
+ * affect tree-shaking since bundlers do not know the shape of the output.
344
+ *
345
+ * @param theme - Theme from which to get the keys to generate the tokens to css variables mapping object
346
+ * @returns Tokens to css variables mapping object corresponding to the passed theme
347
+ */
348
+ export declare function themeToTokensObject<TTheme extends Theme>(theme: TTheme): Record<keyof TTheme, string>;
349
+
340
350
  export declare const tokens: Record<keyof Theme, string>;
341
351
 
342
352
  export declare const webDarkTheme: Theme;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './themes/index';
2
2
  export * from './utils/index';
3
+ export { themeToTokensObject } from './themeToTokensObject';
3
4
  export { tokens } from './tokens';
4
5
  export type { Brands, BrandVariants, FontSizeTokens, FontWeightTokens, LineHeightTokens, BorderRadiusTokens, StrokeWidthTokens, ShadowTokens, ShadowBrandTokens, FontFamilyTokens, ColorPaletteTokens, ColorPaletteDarkRed, ColorPaletteBurgundy, ColorPaletteCranberry, ColorPaletteRed, ColorPaletteDarkOrange, ColorPaletteBronze, ColorPalettePumpkin, ColorPaletteOrange, ColorPalettePeach, ColorPaletteMarigold, ColorPaletteYellow, ColorPaletteGold, ColorPaletteBrass, ColorPaletteBrown, ColorPaletteDarkBrown, ColorPaletteLime, ColorPaletteForest, ColorPaletteSeafoam, ColorPaletteLightGreen, ColorPaletteGreen, ColorPaletteDarkGreen, ColorPaletteLightTeal, ColorPaletteTeal, ColorPaletteDarkTeal, ColorPaletteCyan, ColorPaletteSteel, ColorPaletteLightBlue, ColorPaletteBlue, ColorPaletteRoyalBlue, ColorPaletteDarkBlue, ColorPaletteCornflower, ColorPaletteNavy, ColorPaletteLavender, ColorPalettePurple, ColorPaletteDarkPurple, ColorPaletteOrchid, ColorPaletteGrape, ColorPaletteBerry, ColorPaletteLilac, ColorPalettePink, ColorPaletteHotPink, ColorPaletteMagenta, ColorPalettePlum, ColorPaletteBeige, ColorPaletteMink, ColorPaletteSilver, ColorPalettePlatinum, ColorPaletteAnchor, ColorPaletteCharcoal, ColorTokens, PartialTheme, Theme, } from './types';
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './themes/index';
2
2
  export * from './utils/index';
3
+ export { themeToTokensObject } from './themeToTokensObject';
3
4
  export { tokens } from './tokens';
4
5
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Theme } from './types';
2
+ /**
3
+ * Programmatically generates a tokens to css variables mapping object from the keys in a theme.
4
+ * This helps with ease of use as a user of a custom theme does not have to manually construct this object, but it could
5
+ * affect tree-shaking since bundlers do not know the shape of the output.
6
+ *
7
+ * @param theme - Theme from which to get the keys to generate the tokens to css variables mapping object
8
+ * @returns Tokens to css variables mapping object corresponding to the passed theme
9
+ */
10
+ export declare function themeToTokensObject<TTheme extends Theme>(theme: TTheme): Record<keyof TTheme, string>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Programmatically generates a tokens to css variables mapping object from the keys in a theme.
3
+ * This helps with ease of use as a user of a custom theme does not have to manually construct this object, but it could
4
+ * affect tree-shaking since bundlers do not know the shape of the output.
5
+ *
6
+ * @param theme - Theme from which to get the keys to generate the tokens to css variables mapping object
7
+ * @returns Tokens to css variables mapping object corresponding to the passed theme
8
+ */
9
+ export function themeToTokensObject(theme) {
10
+ const tokens = {};
11
+ const keys = Object.keys(theme);
12
+
13
+ for (const key of keys) {
14
+ tokens[key] = `var(--${key})`;
15
+ }
16
+
17
+ return tokens;
18
+ }
19
+ //# sourceMappingURL=themeToTokensObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/themeToTokensObject.ts"],"names":[],"mappings":"AAEA;;;;;;;AAOG;AACH,OAAM,SAAU,mBAAV,CAAoD,KAApD,EAAiE;AACrE,QAAM,MAAM,GAAG,EAAf;AACA,QAAM,IAAI,GAAG,MAAM,CAAC,IAAP,CAAY,KAAZ,CAAb;;AACA,OAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,IAAA,MAAM,CAAC,GAAD,CAAN,GAAc,SAAS,GAAG,GAA1B;AACD;;AACD,SAAO,MAAP;AACD","sourceRoot":""}
@@ -1,4 +1,5 @@
1
1
  export * from './themes/index';
2
2
  export * from './utils/index';
3
+ export { themeToTokensObject } from './themeToTokensObject';
3
4
  export { tokens } from './tokens';
4
5
  export type { Brands, BrandVariants, FontSizeTokens, FontWeightTokens, LineHeightTokens, BorderRadiusTokens, StrokeWidthTokens, ShadowTokens, ShadowBrandTokens, FontFamilyTokens, ColorPaletteTokens, ColorPaletteDarkRed, ColorPaletteBurgundy, ColorPaletteCranberry, ColorPaletteRed, ColorPaletteDarkOrange, ColorPaletteBronze, ColorPalettePumpkin, ColorPaletteOrange, ColorPalettePeach, ColorPaletteMarigold, ColorPaletteYellow, ColorPaletteGold, ColorPaletteBrass, ColorPaletteBrown, ColorPaletteDarkBrown, ColorPaletteLime, ColorPaletteForest, ColorPaletteSeafoam, ColorPaletteLightGreen, ColorPaletteGreen, ColorPaletteDarkGreen, ColorPaletteLightTeal, ColorPaletteTeal, ColorPaletteDarkTeal, ColorPaletteCyan, ColorPaletteSteel, ColorPaletteLightBlue, ColorPaletteBlue, ColorPaletteRoyalBlue, ColorPaletteDarkBlue, ColorPaletteCornflower, ColorPaletteNavy, ColorPaletteLavender, ColorPalettePurple, ColorPaletteDarkPurple, ColorPaletteOrchid, ColorPaletteGrape, ColorPaletteBerry, ColorPaletteLilac, ColorPalettePink, ColorPaletteHotPink, ColorPaletteMagenta, ColorPalettePlum, ColorPaletteBeige, ColorPaletteMink, ColorPaletteSilver, ColorPalettePlatinum, ColorPaletteAnchor, ColorPaletteCharcoal, ColorTokens, PartialTheme, Theme, } from './types';
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.tokens = void 0;
6
+ exports.tokens = exports.themeToTokensObject = void 0;
7
7
 
8
8
  const tslib_1 = /*#__PURE__*/require("tslib");
9
9
 
@@ -11,6 +11,15 @@ tslib_1.__exportStar(require("./themes/index"), exports);
11
11
 
12
12
  tslib_1.__exportStar(require("./utils/index"), exports);
13
13
 
14
+ var themeToTokensObject_1 = /*#__PURE__*/require("./themeToTokensObject");
15
+
16
+ Object.defineProperty(exports, "themeToTokensObject", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return themeToTokensObject_1.themeToTokensObject;
20
+ }
21
+ });
22
+
14
23
  var tokens_1 = /*#__PURE__*/require("./tokens");
15
24
 
16
25
  Object.defineProperty(exports, "tokens", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AAEA,IAAA,QAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,QAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,QAAA,CAAA,MAAA;AAAM;AAAN,CAAA","sourceRoot":""}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AAEA,IAAA,qBAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,qBAAA,CAAA,mBAAA;AAAmB;AAAnB,CAAA;;AACT,IAAA,QAAA,gBAAA,OAAA,CAAA,UAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,QAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,QAAA,CAAA,MAAA;AAAM;AAAN,CAAA","sourceRoot":""}
@@ -0,0 +1,10 @@
1
+ import { Theme } from './types';
2
+ /**
3
+ * Programmatically generates a tokens to css variables mapping object from the keys in a theme.
4
+ * This helps with ease of use as a user of a custom theme does not have to manually construct this object, but it could
5
+ * affect tree-shaking since bundlers do not know the shape of the output.
6
+ *
7
+ * @param theme - Theme from which to get the keys to generate the tokens to css variables mapping object
8
+ * @returns Tokens to css variables mapping object corresponding to the passed theme
9
+ */
10
+ export declare function themeToTokensObject<TTheme extends Theme>(theme: TTheme): Record<keyof TTheme, string>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.themeToTokensObject = void 0;
7
+ /**
8
+ * Programmatically generates a tokens to css variables mapping object from the keys in a theme.
9
+ * This helps with ease of use as a user of a custom theme does not have to manually construct this object, but it could
10
+ * affect tree-shaking since bundlers do not know the shape of the output.
11
+ *
12
+ * @param theme - Theme from which to get the keys to generate the tokens to css variables mapping object
13
+ * @returns Tokens to css variables mapping object corresponding to the passed theme
14
+ */
15
+
16
+ function themeToTokensObject(theme) {
17
+ const tokens = {};
18
+ const keys = Object.keys(theme);
19
+
20
+ for (const key of keys) {
21
+ tokens[key] = `var(--${key})`;
22
+ }
23
+
24
+ return tokens;
25
+ }
26
+
27
+ exports.themeToTokensObject = themeToTokensObject;
28
+ //# sourceMappingURL=themeToTokensObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/themeToTokensObject.ts"],"names":[],"mappings":";;;;;;AAEA;;;;;;;AAOG;;AACH,SAAgB,mBAAhB,CAA0D,KAA1D,EAAuE;AACrE,QAAM,MAAM,GAAG,EAAf;AACA,QAAM,IAAI,GAAG,MAAM,CAAC,IAAP,CAAY,KAAZ,CAAb;;AACA,OAAK,MAAM,GAAX,IAAkB,IAAlB,EAAwB;AACtB,IAAA,MAAM,CAAC,GAAD,CAAN,GAAc,SAAS,GAAG,GAA1B;AACD;;AACD,SAAO,MAAP;AACD;;AAPD,OAAA,CAAA,mBAAA,GAAA,mBAAA","sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-theme",
3
- "version": "0.0.0-nightlye0b8e1fa6920220128.1",
3
+ "version": "0.0.0-nightlye1926bfeca20220204.1",
4
4
  "description": "Fluent UI themes",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",