@pexip-engage-public/color-utils 0.1.0 → 1.0.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 +6 -0
- package/{typings → dist}/color.d.ts +2 -2
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +42 -0
- package/dist/color.test.js +42 -0
- package/dist/hexValidators.js +24 -0
- package/dist/hexValidators.test.js +60 -0
- package/dist/index.d.ts +2 -0
- package/{typings → dist}/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/{typings → dist}/wcag.d.ts +1 -1
- package/dist/wcag.d.ts.map +1 -0
- package/dist/wcag.js +48 -0
- package/package.json +9 -21
- package/src/color.test.ts +3 -1
- package/src/color.ts +2 -2
- package/src/hexValidators.test.ts +3 -1
- package/src/hexValidators.ts +1 -1
- package/src/index.ts +1 -1
- package/src/wcag.ts +3 -3
- package/dist/index.mjs +0 -93
- package/typings/color.d.ts.map +0 -1
- package/typings/index.d.ts +0 -2
- package/typings/tsconfig.tsbuildinfo +0 -1
- package/typings/wcag.d.ts.map +0 -1
- /package/{typings → dist}/color.test.d.ts +0 -0
- /package/{typings → dist}/color.test.d.ts.map +0 -0
- /package/{typings → dist}/hexValidators.d.ts +0 -0
- /package/{typings → dist}/hexValidators.d.ts.map +0 -0
- /package/{typings → dist}/hexValidators.test.d.ts +0 -0
- /package/{typings → dist}/hexValidators.test.d.ts.map +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAA+B,MAAM,WAAW,CAAC;AAE5E,aAAK,UAAU;IACb,KAAK,QAAQ;IACb,KAAK,QAAQ;CACd;AAED,UAAU,MAAM;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC;CAC/E;AAYD,wBAAgB,cAAc,CAAC,EAC7B,kBAA+C,EAC/C,QAAQ,EACR,SAAS,GACV,EAAE,MAAM,GAAG,GAAG,CAoBd"}
|
package/dist/color.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { hex as convertHexTo, hsl as convertHslTo } from "color-convert";
|
|
2
|
+
import { AccessibilityLevel, calculateAccessibilityLevel } from "./wcag.js";
|
|
3
|
+
var TextColors;
|
|
4
|
+
(function (TextColors) {
|
|
5
|
+
TextColors["WHITE"] = "FFF";
|
|
6
|
+
TextColors["BLACK"] = "000";
|
|
7
|
+
})(TextColors || (TextColors = {}));
|
|
8
|
+
const SHADE_SHIFT_AMOUNT = 1;
|
|
9
|
+
// TODO @Ben: what does this mean and how can we implement this?
|
|
10
|
+
// if we would adapt text (white or black) on top of color:
|
|
11
|
+
// (we would also have to export the chosen textcolor)
|
|
12
|
+
// find whether color is on light side or dark side by finding ratio with both black and white
|
|
13
|
+
// const lightTextRatio = calculateContrastRatio({ bgColor: brandHex, textColor: "FFF" });
|
|
14
|
+
// const darkTextRatio = calculateContrastRatio({ bgColor: brandHex, textColor: "000" });
|
|
15
|
+
// const prefTextColor = lightTextRatio >= darkTextRatio ? textColors.WHITE : textColors.BLACK;
|
|
16
|
+
export function calculateColor({ accessibilityLevel = AccessibilityLevel.WCAG_AA, brandHex, textColor, }) {
|
|
17
|
+
if (accessibilityLevel === AccessibilityLevel.WCAG_AAA) {
|
|
18
|
+
console.warn("Currently WCAG_AAA is not required. Falling back to WCAG_AA");
|
|
19
|
+
}
|
|
20
|
+
const brandHexWCAG = calculateAccessibilityLevel({
|
|
21
|
+
bgColor: brandHex,
|
|
22
|
+
textColor,
|
|
23
|
+
});
|
|
24
|
+
// If color is not WCAG_AAA or WCAG_AA calculate again
|
|
25
|
+
if (brandHexWCAG === AccessibilityLevel.WCAG_A) {
|
|
26
|
+
return calculateColor({
|
|
27
|
+
brandHex: darkenOrLightenShade(brandHex, textColor),
|
|
28
|
+
textColor,
|
|
29
|
+
accessibilityLevel,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return brandHex;
|
|
33
|
+
}
|
|
34
|
+
// Make brand shade darker / lighter
|
|
35
|
+
function darkenOrLightenShade(color, textColor = TextColors.WHITE) {
|
|
36
|
+
const hsl = convertHexTo.hsl(color);
|
|
37
|
+
hsl[2] =
|
|
38
|
+
textColor === TextColors.WHITE
|
|
39
|
+
? Math.max(hsl[2] - SHADE_SHIFT_AMOUNT, 0)
|
|
40
|
+
: Math.min(hsl[2] + SHADE_SHIFT_AMOUNT, 1);
|
|
41
|
+
return "#" + convertHslTo.hex(hsl);
|
|
42
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { calculateColor } from "./color.js";
|
|
3
|
+
const WCAG_AA = [
|
|
4
|
+
{ hex: "#000000", isAA: true, expected: "#000000" },
|
|
5
|
+
{ hex: "#00008F", isAA: true, expected: "#00008F" },
|
|
6
|
+
{ hex: "#5C5C5B", isAA: true, expected: "#5C5C5B" },
|
|
7
|
+
{ hex: "#7843ab", isAA: true, expected: "#7843ab" },
|
|
8
|
+
{ hex: "#ce0303", isAA: true, expected: "#ce0303" },
|
|
9
|
+
{ hex: "#07488b", isAA: true, expected: "#07488b" },
|
|
10
|
+
{ hex: "#000000", isAA: true, expected: "#000000" },
|
|
11
|
+
{ hex: "#e20000", isAA: true, expected: "#e20000" },
|
|
12
|
+
{ hex: "#d42e41", isAA: true, expected: "#d42e41" },
|
|
13
|
+
{ hex: "#870930", isAA: true, expected: "#870930" },
|
|
14
|
+
{ hex: "#080070", isAA: true, expected: "#080070" },
|
|
15
|
+
{ hex: "#3a5c76", isAA: true, expected: "#3a5c76" },
|
|
16
|
+
{ hex: "#d71e3c", isAA: true, expected: "#d71e3c" },
|
|
17
|
+
{ hex: "#9e1c12", isAA: true, expected: "#9e1c12" },
|
|
18
|
+
{ hex: "#007279", isAA: true, expected: "#007279" },
|
|
19
|
+
{ hex: "#ae0247", isAA: true, expected: "#ae0247" },
|
|
20
|
+
{ hex: "#003D78", isAA: true, expected: "#003D78" },
|
|
21
|
+
];
|
|
22
|
+
const WCAG_A = [
|
|
23
|
+
{ hex: "#21b7c5", isAA: false, expected: "#18828C" },
|
|
24
|
+
{ hex: "#51b0a8", isAA: false, expected: "#397F7C" },
|
|
25
|
+
{ hex: "#2898cc", isAA: false, expected: "#217CA6" },
|
|
26
|
+
{ hex: "#1DFF76", isAA: false, expected: "#008535" },
|
|
27
|
+
{ hex: "#08c", isAA: false, expected: "#007AB8" },
|
|
28
|
+
{ hex: "#00b287", isAA: false, expected: "#008566" },
|
|
29
|
+
{ hex: "#79BB2B", isAA: false, expected: "#52811D" },
|
|
30
|
+
{ hex: "#fbc7ab", isAA: false, expected: "#CD4A04" },
|
|
31
|
+
{ hex: "#8dc63f", isAA: false, expected: "#597E26" },
|
|
32
|
+
{ hex: "#a9937a", isAA: false, expected: "#887359" },
|
|
33
|
+
{ hex: "#008dcd", isAA: false, expected: "#007DB8" },
|
|
34
|
+
];
|
|
35
|
+
describe("calculateColor", () => {
|
|
36
|
+
it.each(WCAG_AA)("does not convert WCAG_AA hex codes", ({ hex: brandHex }) => {
|
|
37
|
+
expect(calculateColor({ brandHex })).toEqual(brandHex);
|
|
38
|
+
});
|
|
39
|
+
it.each(WCAG_A)("does convert non-WCAG_AA hex codes to WCAG_AA", ({ expected, hex: brandHex }) => {
|
|
40
|
+
expect(calculateColor({ brandHex })).toEqual(expected);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { invariant } from "@pexip-engage/utils/invariant";
|
|
2
|
+
export function isValidColorCode(hex) {
|
|
3
|
+
return isValidSixDigitColorCode(hex) || isValidThreeDigitColorCode(hex);
|
|
4
|
+
}
|
|
5
|
+
export function isValidSixDigitColorCode(hex) {
|
|
6
|
+
return /^(#)?([0-9a-fA-F]{6})?$/.test(hex);
|
|
7
|
+
}
|
|
8
|
+
export function isValidThreeDigitColorCode(hex) {
|
|
9
|
+
return /^(#)?([0-9a-fA-F]{3})?$/.test(hex);
|
|
10
|
+
}
|
|
11
|
+
export function ensureSixDigitHex(hex) {
|
|
12
|
+
invariant(isValidColorCode(hex), `${hex} is not a valid hex code`);
|
|
13
|
+
const strippedHex = hex.replace("#", "");
|
|
14
|
+
if (isValidSixDigitColorCode(hex)) {
|
|
15
|
+
return `#${strippedHex}`;
|
|
16
|
+
}
|
|
17
|
+
return ("#" +
|
|
18
|
+
strippedHex[0] +
|
|
19
|
+
strippedHex[0] +
|
|
20
|
+
strippedHex[1] +
|
|
21
|
+
strippedHex[1] +
|
|
22
|
+
strippedHex[2] +
|
|
23
|
+
strippedHex[2]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { ensureSixDigitHex, isValidColorCode, isValidSixDigitColorCode, isValidThreeDigitColorCode, } from "./hexValidators.js";
|
|
3
|
+
describe("isValidThreeDigitColorCode", () => {
|
|
4
|
+
it("returns false when a 6-digit hex code is passed", () => {
|
|
5
|
+
expect(isValidThreeDigitColorCode("#FFFFFF")).toBeFalsy();
|
|
6
|
+
});
|
|
7
|
+
it("returns false when a random-digit hex code is passed", () => {
|
|
8
|
+
expect(isValidThreeDigitColorCode("#FFFF")).toBeFalsy();
|
|
9
|
+
});
|
|
10
|
+
it("returns true when a string without '#' is passed", () => {
|
|
11
|
+
expect(isValidThreeDigitColorCode("FFF")).toBeTruthy();
|
|
12
|
+
});
|
|
13
|
+
it("returns true when a valid 3-digit hex code is passed", () => {
|
|
14
|
+
expect(isValidThreeDigitColorCode("#FFF")).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe("isValidSixDigitColorCode", () => {
|
|
18
|
+
it("returns false when a 3-digit hex code is passed", () => {
|
|
19
|
+
expect(isValidSixDigitColorCode("#FFF")).toBeFalsy();
|
|
20
|
+
});
|
|
21
|
+
it("returns false when a random-digit hex code is passed", () => {
|
|
22
|
+
expect(isValidSixDigitColorCode("#FFFF")).toBeFalsy();
|
|
23
|
+
});
|
|
24
|
+
it("returns true when a string without '#' is passed", () => {
|
|
25
|
+
expect(isValidSixDigitColorCode("FFFFFF")).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
it("returns true when a valid 6-digit hex code is passed", () => {
|
|
28
|
+
expect(isValidSixDigitColorCode("#FFFFFF")).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("isValidColorCode", () => {
|
|
32
|
+
it("returns false when a random-digit hex code is passed", () => {
|
|
33
|
+
expect(isValidColorCode("#FFFF")).toBeFalsy();
|
|
34
|
+
});
|
|
35
|
+
it("returns false when a 6-digit string without '#' is passed", () => {
|
|
36
|
+
expect(isValidColorCode("FFFFFF")).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
it("returns false when a 3-digit string without '#' is passed", () => {
|
|
39
|
+
expect(isValidColorCode("FFF")).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
it("returns true when a valid 3-digit hex code is passed", () => {
|
|
42
|
+
expect(isValidColorCode("#FFF")).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
it("returns true when a valid 6-digit hex code is passed", () => {
|
|
45
|
+
expect(isValidColorCode("#FFFFFF")).toBeTruthy();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe("ensureSixDigitHex", () => {
|
|
49
|
+
it("throws an error when an invalid hex code is passed", () => {
|
|
50
|
+
expect(() => {
|
|
51
|
+
ensureSixDigitHex("FFFF");
|
|
52
|
+
}).toThrow();
|
|
53
|
+
});
|
|
54
|
+
it("returns a six-digit hex code with '#'", () => {
|
|
55
|
+
expect(ensureSixDigitHex("FFF")).toEqual("#FFFFFF");
|
|
56
|
+
expect(ensureSixDigitHex("#FFF")).toEqual("#FFFFFF");
|
|
57
|
+
expect(ensureSixDigitHex("FFFFFF")).toEqual("#FFFFFF");
|
|
58
|
+
expect(ensureSixDigitHex("#FFFFFF")).toEqual("#FFFFFF");
|
|
59
|
+
});
|
|
60
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { calculateColor } from "./color.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wcag.d.ts","sourceRoot":"","sources":["../src/wcag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAUxD,KAAK,MAAM,GAAG;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAIF,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,OAAO,aAAa;IACpB,QAAQ,YAAY;CACrB;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,OAAO,EACP,QAAa,EACb,SAAqB,GACtB,EAAE,MAAM,GAAG,kBAAkB,CAoB7B;AAGD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,CAQnE"}
|
package/dist/wcag.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { hex as convertHexTo } from "color-convert";
|
|
2
|
+
import { ensureSixDigitHex } from "./hexValidators.js";
|
|
3
|
+
const WCAG_RATIO_AA_LG = 3.0;
|
|
4
|
+
const WCAG_RATIO_AA_SM = 4.5;
|
|
5
|
+
const WCAG_RATIO_AAA_LG = 4.5;
|
|
6
|
+
const WCAG_RATIO_AAA_SM = 7.0;
|
|
7
|
+
const WCAG_FONT_CUTOFF = 18;
|
|
8
|
+
// There are 3 levels in Accessibility rules: A, AA, AAA. The more A's the more strict it is.
|
|
9
|
+
// We are meeting the AA levels because that's the level that is legally required for certain sites.
|
|
10
|
+
export var AccessibilityLevel;
|
|
11
|
+
(function (AccessibilityLevel) {
|
|
12
|
+
AccessibilityLevel["WCAG_A"] = "lowest";
|
|
13
|
+
AccessibilityLevel["WCAG_AA"] = "midrange";
|
|
14
|
+
AccessibilityLevel["WCAG_AAA"] = "highest";
|
|
15
|
+
})(AccessibilityLevel || (AccessibilityLevel = {}));
|
|
16
|
+
export function calculateAccessibilityLevel({ bgColor, fontSize = 14, textColor = "#FFFFFF", // Text color depends on the theme. Skedify only has light for now.
|
|
17
|
+
}) {
|
|
18
|
+
const contrastRatio = calculateContrastRatio(convertHexTo.rgb(ensureSixDigitHex(bgColor)), convertHexTo.rgb(ensureSixDigitHex(textColor)));
|
|
19
|
+
// TODO: improve me
|
|
20
|
+
if (fontSize >= WCAG_FONT_CUTOFF) {
|
|
21
|
+
return contrastRatio >= WCAG_RATIO_AAA_LG
|
|
22
|
+
? AccessibilityLevel.WCAG_AAA
|
|
23
|
+
: contrastRatio >= WCAG_RATIO_AA_LG
|
|
24
|
+
? AccessibilityLevel.WCAG_AA
|
|
25
|
+
: AccessibilityLevel.WCAG_A;
|
|
26
|
+
}
|
|
27
|
+
return contrastRatio >= WCAG_RATIO_AAA_SM
|
|
28
|
+
? AccessibilityLevel.WCAG_AAA
|
|
29
|
+
: contrastRatio >= WCAG_RATIO_AA_SM
|
|
30
|
+
? AccessibilityLevel.WCAG_AA
|
|
31
|
+
: AccessibilityLevel.WCAG_A;
|
|
32
|
+
}
|
|
33
|
+
// TODO: formula / documentation?
|
|
34
|
+
export function calculateContrastRatio(rgb1, rgb2) {
|
|
35
|
+
const lum1 = calculateLuminance(rgb1[0], rgb1[1], rgb1[2]);
|
|
36
|
+
const lum2 = calculateLuminance(rgb2[0], rgb2[1], rgb2[2]);
|
|
37
|
+
const brightest = Math.max(lum1, lum2);
|
|
38
|
+
const darkest = Math.min(lum1, lum2);
|
|
39
|
+
return (brightest + 0.05) / (darkest + 0.05);
|
|
40
|
+
}
|
|
41
|
+
// See https://www.w3.org/TR/WCAG20-TECHS/G17.html for official formula
|
|
42
|
+
function calculateLuminance(r, g, b) {
|
|
43
|
+
const a = [r, g, b].map((v) => {
|
|
44
|
+
v /= 255;
|
|
45
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
46
|
+
});
|
|
47
|
+
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pexip-engage-public/color-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://github.com/skedify/frontend-mono/tree/develop/packages/color-utils#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -18,37 +18,25 @@
|
|
|
18
18
|
"url": "https://engage.pexip.com"
|
|
19
19
|
},
|
|
20
20
|
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
21
22
|
"exports": {
|
|
22
|
-
".":
|
|
23
|
-
"types": "./typings/index.d.ts",
|
|
24
|
-
"import": "./dist/index.mjs"
|
|
25
|
-
},
|
|
26
|
-
"./src/index.ts": {
|
|
27
|
-
"types": "./typings/index.d.ts",
|
|
28
|
-
"import": "./src/index.ts"
|
|
29
|
-
}
|
|
23
|
+
".": "./dist/index.js"
|
|
30
24
|
},
|
|
31
|
-
"module": "./dist/index.mjs",
|
|
32
|
-
"types": "./typings/index.d.ts",
|
|
33
25
|
"files": [
|
|
34
26
|
"dist",
|
|
35
27
|
"CHANGELOG.md",
|
|
36
|
-
"typings",
|
|
37
28
|
"src"
|
|
38
29
|
],
|
|
39
30
|
"dependencies": {
|
|
31
|
+
"@pexip-engage/utils": "workspace*",
|
|
40
32
|
"color-convert": "^2.0.1"
|
|
41
33
|
},
|
|
42
34
|
"devDependencies": {
|
|
43
35
|
"@types/color-convert": "^2.0.2",
|
|
44
|
-
"
|
|
45
|
-
"tsup": "^7.2.0",
|
|
36
|
+
"vitest": "^0.34.6",
|
|
46
37
|
"@pexip-engage/tsconfig": "0.1.0",
|
|
47
38
|
"eslint-config-pexip-engage": "0.1.0"
|
|
48
39
|
},
|
|
49
|
-
"peerDependencies": {
|
|
50
|
-
"tiny-invariant": "^1.3.1"
|
|
51
|
-
},
|
|
52
40
|
"volta": {
|
|
53
41
|
"extends": "../../package.json"
|
|
54
42
|
},
|
|
@@ -57,11 +45,11 @@
|
|
|
57
45
|
"registry": "https://registry.npmjs.org"
|
|
58
46
|
},
|
|
59
47
|
"scripts": {
|
|
60
|
-
"build": "
|
|
61
|
-
"clean": "rm -rf .turbo node_modules dist
|
|
62
|
-
"dev": "
|
|
48
|
+
"build": "tsc --build",
|
|
49
|
+
"clean": "rm -rf .turbo node_modules dist tsconfig.tsbuildinfo",
|
|
50
|
+
"dev": "tsc --build --watch",
|
|
63
51
|
"lint": "cross-env TIMING=1 eslint --max-warnings=0 .",
|
|
64
52
|
"lint:fix": "pnpm lint --fix",
|
|
65
|
-
"
|
|
53
|
+
"test": "vitest run"
|
|
66
54
|
}
|
|
67
55
|
}
|
package/src/color.test.ts
CHANGED
package/src/color.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hex as convertHexTo, hsl as convertHslTo } from "color-convert";
|
|
2
|
-
import { HEX } from "color-convert/conversions";
|
|
2
|
+
import type { HEX } from "color-convert/conversions.js";
|
|
3
3
|
|
|
4
|
-
import { AccessibilityLevel, calculateAccessibilityLevel } from "./wcag";
|
|
4
|
+
import { AccessibilityLevel, calculateAccessibilityLevel } from "./wcag.js";
|
|
5
5
|
|
|
6
6
|
enum TextColors {
|
|
7
7
|
WHITE = "FFF",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
ensureSixDigitHex,
|
|
3
5
|
isValidColorCode,
|
|
4
6
|
isValidSixDigitColorCode,
|
|
5
7
|
isValidThreeDigitColorCode,
|
|
6
|
-
} from "./hexValidators";
|
|
8
|
+
} from "./hexValidators.js";
|
|
7
9
|
|
|
8
10
|
describe("isValidThreeDigitColorCode", () => {
|
|
9
11
|
it("returns false when a 6-digit hex code is passed", () => {
|
package/src/hexValidators.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { calculateColor } from "./color";
|
|
1
|
+
export { calculateColor } from "./color.js";
|
package/src/wcag.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hex as convertHexTo } from "color-convert";
|
|
2
|
-
import { RGB } from "color-convert/conversions";
|
|
2
|
+
import type { RGB } from "color-convert/conversions.js";
|
|
3
3
|
|
|
4
|
-
import { ensureSixDigitHex } from "./hexValidators";
|
|
4
|
+
import { ensureSixDigitHex } from "./hexValidators.js";
|
|
5
5
|
|
|
6
6
|
const WCAG_RATIO_AA_LG = 3.0;
|
|
7
7
|
const WCAG_RATIO_AA_SM = 4.5;
|
|
@@ -66,7 +66,7 @@ function calculateLuminance(r: number, g: number, b: number): number {
|
|
|
66
66
|
v /= 255;
|
|
67
67
|
|
|
68
68
|
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
69
|
-
});
|
|
69
|
+
}) as [number, number, number];
|
|
70
70
|
|
|
71
71
|
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
72
72
|
}
|
package/dist/index.mjs
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// src/color.ts
|
|
2
|
-
import { hex as convertHexTo2, hsl as convertHslTo } from "color-convert";
|
|
3
|
-
|
|
4
|
-
// src/wcag.ts
|
|
5
|
-
import { hex as convertHexTo } from "color-convert";
|
|
6
|
-
|
|
7
|
-
// src/hexValidators.ts
|
|
8
|
-
import invariant from "tiny-invariant";
|
|
9
|
-
function isValidColorCode(hex) {
|
|
10
|
-
return isValidSixDigitColorCode(hex) || isValidThreeDigitColorCode(hex);
|
|
11
|
-
}
|
|
12
|
-
function isValidSixDigitColorCode(hex) {
|
|
13
|
-
return /^(#)?([0-9a-fA-F]{6})?$/.test(hex);
|
|
14
|
-
}
|
|
15
|
-
function isValidThreeDigitColorCode(hex) {
|
|
16
|
-
return /^(#)?([0-9a-fA-F]{3})?$/.test(hex);
|
|
17
|
-
}
|
|
18
|
-
function ensureSixDigitHex(hex) {
|
|
19
|
-
invariant(isValidColorCode(hex), `${hex} is not a valid hex code`);
|
|
20
|
-
const strippedHex = hex.replace("#", "");
|
|
21
|
-
if (isValidSixDigitColorCode(hex)) {
|
|
22
|
-
return `#${strippedHex}`;
|
|
23
|
-
}
|
|
24
|
-
return "#" + strippedHex[0] + strippedHex[0] + strippedHex[1] + strippedHex[1] + strippedHex[2] + strippedHex[2];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// src/wcag.ts
|
|
28
|
-
var WCAG_RATIO_AA_LG = 3;
|
|
29
|
-
var WCAG_RATIO_AA_SM = 4.5;
|
|
30
|
-
var WCAG_RATIO_AAA_LG = 4.5;
|
|
31
|
-
var WCAG_RATIO_AAA_SM = 7;
|
|
32
|
-
var WCAG_FONT_CUTOFF = 18;
|
|
33
|
-
function calculateAccessibilityLevel({
|
|
34
|
-
bgColor,
|
|
35
|
-
fontSize = 14,
|
|
36
|
-
textColor = "#FFFFFF"
|
|
37
|
-
// Text color depends on the theme. Skedify only has light for now.
|
|
38
|
-
}) {
|
|
39
|
-
const contrastRatio = calculateContrastRatio(
|
|
40
|
-
convertHexTo.rgb(ensureSixDigitHex(bgColor)),
|
|
41
|
-
convertHexTo.rgb(ensureSixDigitHex(textColor))
|
|
42
|
-
);
|
|
43
|
-
if (fontSize >= WCAG_FONT_CUTOFF) {
|
|
44
|
-
return contrastRatio >= WCAG_RATIO_AAA_LG ? "highest" /* WCAG_AAA */ : contrastRatio >= WCAG_RATIO_AA_LG ? "midrange" /* WCAG_AA */ : "lowest" /* WCAG_A */;
|
|
45
|
-
}
|
|
46
|
-
return contrastRatio >= WCAG_RATIO_AAA_SM ? "highest" /* WCAG_AAA */ : contrastRatio >= WCAG_RATIO_AA_SM ? "midrange" /* WCAG_AA */ : "lowest" /* WCAG_A */;
|
|
47
|
-
}
|
|
48
|
-
function calculateContrastRatio(rgb1, rgb2) {
|
|
49
|
-
const lum1 = calculateLuminance(rgb1[0], rgb1[1], rgb1[2]);
|
|
50
|
-
const lum2 = calculateLuminance(rgb2[0], rgb2[1], rgb2[2]);
|
|
51
|
-
const brightest = Math.max(lum1, lum2);
|
|
52
|
-
const darkest = Math.min(lum1, lum2);
|
|
53
|
-
return (brightest + 0.05) / (darkest + 0.05);
|
|
54
|
-
}
|
|
55
|
-
function calculateLuminance(r, g, b) {
|
|
56
|
-
const a = [r, g, b].map((v) => {
|
|
57
|
-
v /= 255;
|
|
58
|
-
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
59
|
-
});
|
|
60
|
-
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/color.ts
|
|
64
|
-
var SHADE_SHIFT_AMOUNT = 1;
|
|
65
|
-
function calculateColor({
|
|
66
|
-
accessibilityLevel = "midrange" /* WCAG_AA */,
|
|
67
|
-
brandHex,
|
|
68
|
-
textColor
|
|
69
|
-
}) {
|
|
70
|
-
if (accessibilityLevel === "highest" /* WCAG_AAA */) {
|
|
71
|
-
console.warn("Currently WCAG_AAA is not required. Falling back to WCAG_AA");
|
|
72
|
-
}
|
|
73
|
-
const brandHexWCAG = calculateAccessibilityLevel({
|
|
74
|
-
bgColor: brandHex,
|
|
75
|
-
textColor
|
|
76
|
-
});
|
|
77
|
-
if (brandHexWCAG === "lowest" /* WCAG_A */) {
|
|
78
|
-
return calculateColor({
|
|
79
|
-
brandHex: darkenOrLightenShade(brandHex, textColor),
|
|
80
|
-
textColor,
|
|
81
|
-
accessibilityLevel
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return brandHex;
|
|
85
|
-
}
|
|
86
|
-
function darkenOrLightenShade(color, textColor = "FFF" /* WHITE */) {
|
|
87
|
-
const hsl = convertHexTo2.hsl(color);
|
|
88
|
-
hsl[2] = textColor === "FFF" /* WHITE */ ? Math.max(hsl[2] - SHADE_SHIFT_AMOUNT, 0) : Math.min(hsl[2] + SHADE_SHIFT_AMOUNT, 1);
|
|
89
|
-
return "#" + convertHslTo.hex(hsl);
|
|
90
|
-
}
|
|
91
|
-
export {
|
|
92
|
-
calculateColor
|
|
93
|
-
};
|
package/typings/color.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAA+B,MAAM,QAAQ,CAAC;AAEzE,aAAK,UAAU;IACb,KAAK,QAAQ;IACb,KAAK,QAAQ;CACd;AAED,UAAU,MAAM;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC;CAC/E;AAYD,wBAAgB,cAAc,CAAC,EAC7B,kBAA+C,EAC/C,QAAQ,EACR,SAAS,GACV,EAAE,MAAM,GAAG,GAAG,CAoBd"}
|
package/typings/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2023.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.esnext.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2023.array.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.2.2/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/@types+react@18.2.35/node_modules/@types/react/global.d.ts","../../../node_modules/.pnpm/csstype@3.1.1/node_modules/csstype/index.d.ts","../../../node_modules/.pnpm/@types+prop-types@15.7.5/node_modules/@types/prop-types/index.d.ts","../../../node_modules/.pnpm/@types+scheduler@0.16.2/node_modules/@types/scheduler/tracing.d.ts","../../../node_modules/.pnpm/@types+react@18.2.35/node_modules/@types/react/index.d.ts","../../../node_modules/.pnpm/@types+react@18.2.35/node_modules/@types/react/jsx-runtime.d.ts","../../../node_modules/.pnpm/@types+color-name@1.1.1/node_modules/@types/color-name/index.d.ts","../../../node_modules/.pnpm/@types+color-convert@2.0.2/node_modules/@types/color-convert/conversions.d.ts","../../../node_modules/.pnpm/@types+color-convert@2.0.2/node_modules/@types/color-convert/route.d.ts","../../../node_modules/.pnpm/@types+color-convert@2.0.2/node_modules/@types/color-convert/index.d.ts","../../../node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/tiny-invariant.d.ts","../src/hexValidators.ts","../src/wcag.ts","../src/color.ts","../src/color.test.ts","../src/hexValidators.test.ts","../src/index.ts","../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/index.d.ts","../../../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/cleanupSemantic.d.ts","../../../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/types.d.ts","../../../node_modules/.pnpm/pretty-format@27.5.1/node_modules/pretty-format/build/index.d.ts","../../../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/types.d.ts","../../../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/diffLines.d.ts","../../../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/printDiffs.d.ts","../../../node_modules/.pnpm/jest-diff@27.5.1/node_modules/jest-diff/build/index.d.ts","../../../node_modules/.pnpm/jest-matcher-utils@27.5.1/node_modules/jest-matcher-utils/build/index.d.ts","../../../node_modules/.pnpm/@types+jest@27.5.2/node_modules/@types/jest/index.d.ts"],"fileInfos":[{"version":"2ac9cdcfb8f8875c18d14ec5796a8b029c426f73ad6dc3ffb580c228b58d1c44","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","1c0cdb8dc619bc549c3e5020643e7cf7ae7940058e8c7e5aefa5871b6d86f44b","bed7b7ba0eb5a160b69af72814b4dde371968e40b6c5e73d3a9f7bee407d158c",{"version":"0075fa5ceda385bcdf3488e37786b5a33be730e8bc4aa3cf1e78c63891752ce8","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"09226e53d1cfda217317074a97724da3e71e2c545e18774484b61562afc53cd2","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"8b41361862022eb72fcc8a7f34680ac842aca802cf4bc1f915e8c620c9ce4331","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"bc496ef4377553e461efcf7cc5a5a57cf59f9962aea06b5e722d54a36bf66ea1","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"930b0e15811f84e203d3c23508674d5ded88266df4b10abee7b31b2ac77632d2","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"65be38e881453e16f128a12a8d36f8b012aa279381bf3d4dc4332a4905ceec83","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"e1913f656c156a9e4245aa111fbb436d357d9e1fe0379b9a802da7fe3f03d736","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"f35a831e4f0fe3b3697f4a0fe0e3caa7624c92b78afbecaf142c0f93abfaf379","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"0bd5e7096c7bc02bf70b2cc017fc45ef489cb19bd2f32a71af39ff5787f1b56a","affectsGlobalScope":true},"1c29793071152b207c01ea1954e343be9a44d85234447b2b236acae9e709a383","6a386ff939f180ae8ef064699d8b7b6e62bc2731a62d7fbf5e02589383838dea","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"ac1e16bbf7a4f9086bf829e14afc25943c5a23df8179447a5be1e8227e3379a2","affectsGlobalScope":true},"2879a055439b6c0c0132a1467120a0f85b56b5d735c973ad235acd958b1b5345","f0cb4b3ab88193e3e51e9e2622e4c375955003f1f81239d72c5b7a95415dad3e","206fabd39297fecdcd46451a5695bbb4df96761f4818564f1ae4f3a935b8f683","9f5868b1ffbb19aabaf87e4f756900bb76379f9e66699a163f94de21dba16835","754907a05bb4c0d1777d1d98f8d66132b24f43415bbca46ae869158d711d750d","274739c6c5cc94391cdf4acbbf72c7c6cd13429b48c6582ff9e111749fefa9fc",{"version":"06f2189d1099b5383f832b6f73610dfd6d90efb5a9a6c5d6f5579a6d7ca83855","signature":"5eb3187d0072362cda9cd18b219cf91e11c0420e5289c24bafa60c51ead12035"},{"version":"007fa6d61de34540bec47bc1b738fea8920c908960b59e1c4951e09fc6aee713","signature":"50ee38e1572fa22a2ed69ca48d3ed5c508ff00e452e5de5fbd9bf4efc57e0ec8"},{"version":"a607e33e437244b0b50d56d94140507f2565335a8848f90b66e3dd332a19e93e","signature":"0b2f096a8af44e1bb78f4d17db68a774a81e4b5d15b16fde4a6d0df20d708f44"},{"version":"e775faab001e81370f88ac793053aacf836d992c13308d34831ed50ef885d3e9","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"14cd85b1a9aedb5591bdd1e25b7135cc358d17eeb125227369aa3dc5230a2679","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},"d55408094a4b7c6318f88d18bca4718c68f14f75c7409143667893b6c49bde26","0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","d8aab31ba8e618cc3eea10b0945de81cb93b7e8150a013a482332263b9305322","462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","7adecb2c3238794c378d336a8182d4c3dd2c4fa6fa1785e2797a3db550edea62","dc12dc0e5aa06f4e1a7692149b78f89116af823b9e1f1e4eae140cd3e0e674e6","1bfc6565b90c8771615cd8cfcf9b36efc0275e5e83ac7d9181307e96eb495161","8a8a96898906f065f296665e411f51010b51372fa260d5373bf9f64356703190","7f82ef88bdb67d9a850dd1c7cd2d690f33e0f0acd208e3c9eba086f3670d4f73",{"version":"ccfd8774cd9b929f63ff7dcf657977eb0652e3547f1fcac1b3a1dc5db22d4d58","affectsGlobalScope":true}],"root":[[77,82]],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":true,"inlineSources":false,"jsx":4,"module":99,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitReturns":false,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"target":99,"tsBuildInfoFile":"./tsconfig.tsbuildinfo","useDefineForClassFields":true},"fileIdsList":[[72],[73,74],[73],[86,91],[66,67,68,69],[70],[84,87],[84,87,88,89],[86],[83,90],[85],[71,79],[71,73,75,78],[71,77],[71,76],[71,73,75,77],[73,78]],"referencedMap":[[73,1],[75,2],[74,3],[92,4],[70,5],[71,6],[88,7],[90,8],[89,7],[87,9],[91,10],[86,11],[80,12],[79,13],[81,14],[77,15],[82,12],[78,16]],"exportedModulesMap":[[73,1],[75,2],[74,3],[92,4],[70,5],[71,6],[88,7],[90,8],[89,7],[87,9],[91,10],[86,11],[79,17],[82,12],[78,3]],"semanticDiagnosticsPerFile":[73,75,74,72,92,68,66,70,71,69,83,67,84,88,90,89,87,91,86,85,76,64,65,12,13,15,14,2,16,17,18,19,20,21,22,23,3,4,24,28,25,26,27,29,30,31,5,32,33,34,35,6,39,36,37,38,40,7,41,46,47,42,43,44,45,8,51,48,49,50,52,9,53,54,55,58,56,57,59,60,10,1,11,63,62,61,80,79,81,77,82,78],"latestChangedDtsFile":"./index.d.ts"},"version":"5.2.2"}
|
package/typings/wcag.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wcag.d.ts","sourceRoot":"","sources":["../src/wcag.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAUhD,KAAK,MAAM,GAAG;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAIF,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,OAAO,aAAa;IACpB,QAAQ,YAAY;CACrB;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,OAAO,EACP,QAAa,EACb,SAAqB,GACtB,EAAE,MAAM,GAAG,kBAAkB,CAoB7B;AAGD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,MAAM,CAQnE"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|