@moda/tokens 5.5.3 → 5.6.0

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.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.6.0](https://github.com/ModaOperandi/tokens/compare/v5.5.4...v5.6.0) (2022-10-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * adds js function to retrieve hex for a specific color name ([5460cad](https://github.com/ModaOperandi/tokens/commit/5460cadd8d0627d437b71f886e518551d11acad4))
12
+
13
+ ## [5.5.4](https://github.com/ModaOperandi/tokens/compare/v5.5.3...v5.5.4) (2022-09-05)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * netlify build ([d163d37](https://github.com/ModaOperandi/tokens/commit/d163d3738110be38946781215846313b97cabe01))
19
+ * predeploy ([3053346](https://github.com/ModaOperandi/tokens/commit/305334685845108d85ca28dd2b8951289808c7b3))
20
+
6
21
  ## [5.5.3](https://github.com/ModaOperandi/tokens/compare/v5.5.2...v5.5.3) (2022-07-05)
7
22
 
8
23
 
package/README.md CHANGED
@@ -185,11 +185,20 @@ const remToUnitlessPx: (value: string) => number;
185
185
 
186
186
  ##### `color`
187
187
 
188
+ Accepts the name of a color and returns back the corresponding rgb(a) value.
189
+
190
+ ```tsx
191
+ type Color = "ink" | "cement" | "fog" | "elephant" | "noise" | "snow" | "strawberry" | "code-red" | "mint" | "money-good" | "fuchsia" | "klein-blue" | "brick" | "goldenrod" | "seafoam" | "coral" | ... 7 more ... | "canary"
192
+ const color: (name: Color, alpha?: number) => string
193
+ ```
194
+
195
+ ##### `colorInHex`
196
+
188
197
  Accepts the name of a color and returns back the corresponding hex value.
189
198
 
190
199
  ```tsx
191
200
  type Color = "ink" | "cement" | "fog" | "elephant" | "noise" | "snow" | "strawberry" | "code-red" | "mint" | "money-good" | "fuchsia" | "klein-blue" | "brick" | "goldenrod" | "seafoam" | "coral" | ... 7 more ... | "canary"
192
- const color: (name: Color) => string
201
+ const colorInHex: (name: Color, alpha?: number) => string
193
202
  ```
194
203
 
195
204
  ##### `spacing`
package/dist/helpers.d.ts CHANGED
@@ -63,4 +63,5 @@ export declare const text: (name: TextTreatment, font?: "code" | "serif" | "sans
63
63
  };
64
64
  export declare const remToUnitlessPx: (value: string) => number;
65
65
  export declare const color: (name: Color, alpha?: number) => string;
66
+ export declare const colorInHex: (name: Color, alpha?: number) => string;
66
67
  export declare const spacing: (topY: number | string, rightX?: number | string, bottom?: number | string, left?: number | string) => string | number | undefined;
package/dist/helpers.js CHANGED
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  return to.concat(ar || Array.prototype.slice.call(from));
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.spacing = exports.color = exports.remToUnitlessPx = exports.text = void 0;
23
+ exports.spacing = exports.colorInHex = exports.color = exports.remToUnitlessPx = exports.text = void 0;
24
24
  var colorString = require("color-string");
25
25
  var colors_1 = require("./colors");
26
26
  var space_1 = require("./space");
@@ -44,6 +44,8 @@ var color = function (name, alpha) {
44
44
  : color;
45
45
  };
46
46
  exports.color = color;
47
+ var colorInHex = function (name, alpha) { return colorString.to.hex(colorString.get.rgb((0, exports.color)(name, alpha))); };
48
+ exports.colorInHex = colorInHex;
47
49
  var spacing = function (topY, rightX, bottom, left) {
48
50
  return [topY, rightX, bottom, left].reduce(function (acc, value) {
49
51
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA4C;AAC5C,mCAAkC;AAClC,iCAAgC;AAChC,2CAA0C;AAMnC,IAAM,IAAI,GAAG,UAAC,IAAmB,EAAE,IAAqB;IAArB,qBAAA,EAAA,OAAO,MAAc;IAC7D,IAAM,S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KAAK,SAMhB;AAEK,IAAM,UAAU,GAAG,UAAC,IAAW,EAAE,KAAc,IAAa,OAAA,WAAW,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAA,aAAK,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAA3D,CAA2D,CAAC;AAAlH,QAAA,UAAU,cAAwG;AAExH,IAAM,OAAO,GAAG,UACrB,IAAqB,EACrB,MAAwB,EACxB,MAAwB,EACxB,IAAsB;IAEtB,OAAA,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,KAAK;;QAC7C,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,GAAG,CAAC;QACpC,OAAO,CAAC,GAAG,EAAE,MAAA,aAAK,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAI,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC,EAAE,EAAE,CAAC;AAHN,CAGM,CAAC;AATI,QAAA,OAAO,WASX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moda/tokens",
3
- "version": "5.5.3",
3
+ "version": "5.6.0",
4
4
  "description": "Constant values for modaoperandi.com",
5
5
  "repository": "git@github.com:ModaOperandi/tokens.git",
6
6
  "author": "Moda Operandi",
@@ -31,7 +31,7 @@
31
31
  "@commitlint/config-conventional": "^17.0.0",
32
32
  "@jedmao/semantic-release-npm-github-config": "^1.0.9",
33
33
  "@types/color-string": "^1.5.0",
34
- "@types/node": "^17.0.0",
34
+ "@types/node": "^18.7.15",
35
35
  "@types/node-sass": "^4.11.3",
36
36
  "@typescript-eslint/eslint-plugin": "^5.30.0",
37
37
  "@typescript-eslint/parser": "^5.30.0",
@@ -44,7 +44,7 @@
44
44
  "eslint-plugin-prettier": "^4.2.1",
45
45
  "gh-pages": "4.0.0",
46
46
  "husky": "^8.0.1",
47
- "jest": "^28.0.2",
47
+ "jest": "^29.0.2",
48
48
  "node-sass": "^7.0.0",
49
49
  "node-sass-export": "^0.0.7",
50
50
  "pinst": "^3.0.0",
package/src/helpers.ts CHANGED
@@ -27,6 +27,8 @@ export const color = (name: Color, alpha?: number) => {
27
27
  : color;
28
28
  };
29
29
 
30
+ export const colorInHex = (name: Color, alpha?: number): string => colorString.to.hex(colorString.get.rgb(color(name, alpha)));
31
+
30
32
  export const spacing = (
31
33
  topY: number | string,
32
34
  rightX?: number | string,