@moda/tokens 5.5.4 → 5.7.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 +14 -0
- package/README.md +10 -1
- package/dist/helpers.d.ts +4 -3
- package/dist/helpers.js +3 -1
- package/dist/helpers.js.map +1 -1
- package/lib/assets/stylesheets/tokens/_utilities.scss +3 -1
- package/lib/assets/stylesheets/tokens/variables/_typography.scss +2 -1
- package/package.json +6 -6
- package/src/helpers.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.7.0](https://github.com/ModaOperandi/tokens/compare/v5.6.0...v5.7.0) (2023-01-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* move from node-sass to sass ([#761](https://github.com/ModaOperandi/tokens/issues/761)) ([c2c5258](https://github.com/ModaOperandi/tokens/commit/c2c525821a2e26b23941f19db703e95a3dad35b9))
|
|
12
|
+
|
|
13
|
+
# [5.6.0](https://github.com/ModaOperandi/tokens/compare/v5.5.4...v5.6.0) (2022-10-14)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* adds js function to retrieve hex for a specific color name ([5460cad](https://github.com/ModaOperandi/tokens/commit/5460cadd8d0627d437b71f886e518551d11acad4))
|
|
19
|
+
|
|
6
20
|
## [5.5.4](https://github.com/ModaOperandi/tokens/compare/v5.5.3...v5.5.4) (2022-09-05)
|
|
7
21
|
|
|
8
22
|
|
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
|
|
201
|
+
const colorInHex: (name: Color, alpha?: number) => string
|
|
193
202
|
```
|
|
194
203
|
|
|
195
204
|
##### `spacing`
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { colors } from './colors';
|
|
2
2
|
import { typography } from './typography';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
export type Font = keyof typeof typography.fonts;
|
|
4
|
+
export type TextTreatment = keyof typeof typography['text-treatments'];
|
|
5
|
+
export type Color = keyof typeof colors.all;
|
|
6
6
|
export declare const text: (name: TextTreatment, font?: "code" | "serif" | "sans") => {
|
|
7
7
|
'font-family': string;
|
|
8
8
|
'line-height': string;
|
|
@@ -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;
|
package/dist/helpers.js.map
CHANGED
|
@@ -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,SAAS,GAAG,uBAAU,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC;IACtD,6BACK,SAAS,KACZ,aAAa,EAAE,uBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC/C,aAAa,EAAE,UAAG,SAAS,CAAC,aAAa,CAAC,CAAE,IAC5C;AACJ,CAAC,CAAC;AAPW,QAAA,I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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"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
1
3
|
/// Returns the named value of a map. Throws an error if it does not exist.
|
|
2
4
|
///
|
|
3
5
|
/// @param {map} $map
|
|
@@ -38,5 +40,5 @@
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
@function __strip-units__($value) {
|
|
41
|
-
@return $value
|
|
43
|
+
@return math.div($value, ($value * 0 + 1));
|
|
42
44
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
1
2
|
@import "../utilities";
|
|
2
3
|
|
|
3
4
|
$root-font-size: 16px;
|
|
4
|
-
$root-one-px: 1
|
|
5
|
+
$root-one-px: math.div(1, __strip-units__($root-font-size));
|
|
5
6
|
|
|
6
7
|
$font-stack-moda-sans: "Moda Operandi Sans", Arial, sans-serif;
|
|
7
8
|
$font-stack-moda-serif: "Moda Operandi Serif", "Times New Roman", Times, serif;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moda/tokens",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "Constant values for modaoperandi.com",
|
|
5
5
|
"repository": "git@github.com:ModaOperandi/tokens.git",
|
|
6
6
|
"author": "Moda Operandi",
|
|
@@ -30,9 +30,10 @@
|
|
|
30
30
|
"@commitlint/cli": "^17.0.0",
|
|
31
31
|
"@commitlint/config-conventional": "^17.0.0",
|
|
32
32
|
"@jedmao/semantic-release-npm-github-config": "^1.0.9",
|
|
33
|
+
"@moda/node-sass-export": "^0.1.1",
|
|
33
34
|
"@types/color-string": "^1.5.0",
|
|
34
|
-
"@types/node": "^
|
|
35
|
-
"@types/
|
|
35
|
+
"@types/node": "^18.7.15",
|
|
36
|
+
"@types/sass": "^1.43.1",
|
|
36
37
|
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
|
37
38
|
"@typescript-eslint/parser": "^5.30.0",
|
|
38
39
|
"cz-conventional-changelog": "3.3.0",
|
|
@@ -44,11 +45,10 @@
|
|
|
44
45
|
"eslint-plugin-prettier": "^4.2.1",
|
|
45
46
|
"gh-pages": "4.0.0",
|
|
46
47
|
"husky": "^8.0.1",
|
|
47
|
-
"jest": "^
|
|
48
|
-
"node-sass": "^7.0.0",
|
|
49
|
-
"node-sass-export": "^0.0.7",
|
|
48
|
+
"jest": "^29.0.2",
|
|
50
49
|
"pinst": "^3.0.0",
|
|
51
50
|
"prettier": "^2.7.1",
|
|
51
|
+
"sass": "^1.57.1",
|
|
52
52
|
"semantic-release": "^19.0.2",
|
|
53
53
|
"typescript": "^4.0.2"
|
|
54
54
|
},
|
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,
|