@conductor-by-89soone/tokens 0.2.0 → 0.2.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/dist/contrast-cli.js +5 -1
- package/dist/lint-cli.js +3 -3
- package/package.json +1 -1
package/dist/contrast-cli.js
CHANGED
|
@@ -384,7 +384,10 @@ var forbiddenPairs = [
|
|
|
384
384
|
id: "FP-002",
|
|
385
385
|
foreground: "accent",
|
|
386
386
|
background: "surface.elevated",
|
|
387
|
-
reason: "the accent is a body foreground on `surface.base` and `surface.raised` only; on the elevated surface it measures 4.40:1 in dark, below body 4.5:1 (tokens spec 8.4)"
|
|
387
|
+
reason: "the accent is a body foreground on `surface.base` and `surface.raised` only; on the elevated surface it measures 4.40:1 in dark, below body 4.5:1 (tokens spec 8.4)",
|
|
388
|
+
// Body only. 4.40:1 clears both the `large` 3:1 and the `nonText` 3:1 thresholds, and the
|
|
389
|
+
// SRS forbids only body use on this surface.
|
|
390
|
+
usages: ["body"]
|
|
388
391
|
}
|
|
389
392
|
];
|
|
390
393
|
|
|
@@ -1772,6 +1775,7 @@ function assertNotForbidden(pair2, index, forbidden) {
|
|
|
1772
1775
|
const bannedForeground = aliasTerminus(index, banned.foreground);
|
|
1773
1776
|
const bannedBackground = aliasTerminus(index, banned.background);
|
|
1774
1777
|
if (resolvedForeground !== bannedForeground || resolvedBackground !== bannedBackground) continue;
|
|
1778
|
+
if (banned.usages !== void 0 && !banned.usages.includes(pair2.usage)) continue;
|
|
1775
1779
|
throw new TokenBuildError("TOK-CP-FORBIDDEN", "contrast pair declares a forbidden combination", [
|
|
1776
1780
|
`pair: ${pair2.id} (${pair2.foreground} on ${pair2.background})`,
|
|
1777
1781
|
`forbidden: ${banned.id} (${banned.foreground} on ${banned.background})`,
|
package/dist/lint-cli.js
CHANGED
|
@@ -125,9 +125,9 @@ function isAllowed(allowances, line) {
|
|
|
125
125
|
// src/lint/rules.ts
|
|
126
126
|
var HEX_COLOR = /#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})\b/gi;
|
|
127
127
|
var FUNCTIONAL_COLOR = /\b(?:rgba?|hsla?)\([^)]*\)/gi;
|
|
128
|
-
var PX_LITERAL = /(?<![\w#.])(\d+(?:\.\d+)
|
|
129
|
-
var REM_LITERAL = /(?<![\w#.])(\d+(?:\.\d+)
|
|
130
|
-
var MS_LITERAL = /(?<![\w#.])(\d+(?:\.\d+)
|
|
128
|
+
var PX_LITERAL = /(?<![\w#.])(\d+(?:\.\d+)?|\.\d+)px\b/g;
|
|
129
|
+
var REM_LITERAL = /(?<![\w#.])(\d+(?:\.\d+)?|\.\d+)rem\b/g;
|
|
130
|
+
var MS_LITERAL = /(?<![\w#.])(\d+(?:\.\d+)?|\.\d+)ms\b/g;
|
|
131
131
|
var Z_INDEX = /\b(?:z-index|zIndex)\s*:\s*["'`]?\s*(-?\d+)/g;
|
|
132
132
|
var FONT_SIZE_PX = /\b(?:font-size|fontSize)\s*:\s*["'`]?\s*(\d+(?:\.\d+)?px)/g;
|
|
133
133
|
var MEDIA_PRELUDE = /@media[^{;]*/g;
|
package/package.json
CHANGED