@askewly/design 0.3.0 → 0.4.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/data/DESIGN.md +71 -0
- package/data/askewly.css +25 -0
- package/data/recipes.json +1 -1
- package/data/terms.json +1 -1
- package/data/tokens.css +41 -0
- package/data/tokens.json +1 -1
- package/dist/index.js +20 -2
- package/dist/kickstart.js +462 -0
- package/dist/verify.js +17 -2
- package/package.json +1 -1
package/dist/verify.js
CHANGED
|
@@ -14,7 +14,7 @@ const TYPOGRAPHY_MARKER = /askewly-typography-ok(?::([^\n]*))?/;
|
|
|
14
14
|
const DEFAULT_EXTENSIONS = ["tsx", "ts", "jsx", "js", "css", "html"];
|
|
15
15
|
const SKIP_DIRS = new Set(["node_modules", "dist", "build", ".git", ".next"]);
|
|
16
16
|
// Generated token files legitimately contain raw color values.
|
|
17
|
-
const SKIP_FILES = new Set(["tokens.css", "askewly.css"]);
|
|
17
|
+
const SKIP_FILES = new Set(["tokens.css", "askewly.css", "askewly-brand.css"]);
|
|
18
18
|
const HEX_RULE = /#[0-9a-fA-F]{3,8}\b/;
|
|
19
19
|
const COLOR_FN_RULE = /\b(?:rgb|rgba|hsl|hsla|oklch)\(/;
|
|
20
20
|
// Every rule is checked independently per line. A single ternary would report
|
|
@@ -30,6 +30,21 @@ const LINE_COMMENT_EXTENSIONS = new Set(["ts", "tsx", "js", "jsx"]);
|
|
|
30
30
|
// Two SVG shapes: paired <svg>…</svg> and self-closing <svg … />.
|
|
31
31
|
const SVG_PAIRED = /<svg\b[\s\S]*?<\/svg\s*>/gi;
|
|
32
32
|
const SVG_SELF_CLOSING = /<svg\b[^>]*\/>/gi;
|
|
33
|
+
/**
|
|
34
|
+
* CSS attribute selectors whose value is a hex color, e.g. the Tailwind
|
|
35
|
+
* arbitrary variant `[&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border`.
|
|
36
|
+
*
|
|
37
|
+
* The hex there is a *match target*, not a color the file paints with: it names
|
|
38
|
+
* a value some third-party library already emitted so the rule can override it
|
|
39
|
+
* with a token. Flagging it inverts the gate — the line doing the token work is
|
|
40
|
+
* the line getting reported.
|
|
41
|
+
*
|
|
42
|
+
* Deliberately narrow: an attribute name, an `=` (optionally prefixed by a CSS
|
|
43
|
+
* match operator), and a *quoted* hex. Tailwind arbitrary values like
|
|
44
|
+
* `bg-[#ccc]` have no `=` and no quotes, so they stay violations. The optional
|
|
45
|
+
* backslashes cover selectors written inside a same-quoted JS string.
|
|
46
|
+
*/
|
|
47
|
+
const ATTR_SELECTOR_HEX = /\[[A-Za-z_-][\w:.-]*\s*[~^|*$]?=\s*\\?(['"])#[0-9a-fA-F]{3,8}\\?\1\s*[iIsS]?\s*\]/g;
|
|
33
48
|
/**
|
|
34
49
|
* Blanks regions whose color literals are not rendered output — comments and
|
|
35
50
|
* SVG markup — while preserving every character position and newline, so
|
|
@@ -109,7 +124,7 @@ export function maskIgnoredRegions(source, ext) {
|
|
|
109
124
|
// Pass 2 — SVG markup, matched against the comment-masked text so a commented
|
|
110
125
|
// out `</svg>` cannot terminate a block early.
|
|
111
126
|
let masked = chars.join("");
|
|
112
|
-
for (const pattern of [SVG_PAIRED, SVG_SELF_CLOSING]) {
|
|
127
|
+
for (const pattern of [SVG_PAIRED, SVG_SELF_CLOSING, ATTR_SELECTOR_HEX]) {
|
|
113
128
|
masked = masked.replace(pattern, (match) => match.replace(/[^\n]/g, " "));
|
|
114
129
|
}
|
|
115
130
|
return masked;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askewly/design",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Query, inject, and verify the Askewly Design system (tokens, UI vocabulary, recipes) from your terminal or coding agent.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://ui.askewly.com",
|