zeus-css 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.
Files changed (105) hide show
  1. package/README.md +81 -0
  2. package/bin/init.js +89 -0
  3. package/dist/zeus.css +8456 -0
  4. package/dist/zeus.min.css +1 -0
  5. package/package.json +44 -0
  6. package/scss/.stylelintrc.json +41 -0
  7. package/scss/API.md +168 -0
  8. package/scss/CHANGELOG.md +281 -0
  9. package/scss/LICENSE +21 -0
  10. package/scss/README.md +160 -0
  11. package/scss/cheatsheet.md +249 -0
  12. package/scss/dist/zeus.css +8465 -0
  13. package/scss/dist/zeus.css.map +1 -0
  14. package/scss/dist/zeus.min.css +1 -0
  15. package/scss/dist/zeus.min.css.map +1 -0
  16. package/scss/foundation/core/_api.scss +10 -0
  17. package/scss/foundation/core/_design.scss +33 -0
  18. package/scss/foundation/core/_engine.scss +18 -0
  19. package/scss/foundation/core/buttons/variants.scss +72 -0
  20. package/scss/foundation/core/design/_design-system.scss +41 -0
  21. package/scss/foundation/core/design/_validate.scss +114 -0
  22. package/scss/foundation/core/design/borders/border-line.scss +29 -0
  23. package/scss/foundation/core/design/borders/border-radius.scss +31 -0
  24. package/scss/foundation/core/design/buttons/sizes.scss +32 -0
  25. package/scss/foundation/core/design/colors/_color-derivation.scss +80 -0
  26. package/scss/foundation/core/design/colors/base-colors.scss +31 -0
  27. package/scss/foundation/core/design/colors/semantic-colors.scss +130 -0
  28. package/scss/foundation/core/design/core/basic.scss +40 -0
  29. package/scss/foundation/core/design/dimensions/sizes.scss +29 -0
  30. package/scss/foundation/core/design/dimensions/spaces.scss +42 -0
  31. package/scss/foundation/core/design/effects/_z-index.scss +30 -0
  32. package/scss/foundation/core/design/effects/shadows.scss +65 -0
  33. package/scss/foundation/core/design/layout/grid.scss +86 -0
  34. package/scss/foundation/core/design/typography/typography.scss +435 -0
  35. package/scss/foundation/core/engine/_fluid-core.scss +54 -0
  36. package/scss/foundation/core/engine/animations.scss +91 -0
  37. package/scss/foundation/core/engine/buttons.scss +226 -0
  38. package/scss/foundation/core/engine/color-api.scss +37 -0
  39. package/scss/foundation/core/engine/helpers.scss +39 -0
  40. package/scss/foundation/core/engine/layout.scss +156 -0
  41. package/scss/foundation/core/engine/responsive.scss +67 -0
  42. package/scss/foundation/core/engine/shadows.scss +186 -0
  43. package/scss/foundation/core/engine/shortcuts.scss +30 -0
  44. package/scss/foundation/core/engine/sizing.scss +49 -0
  45. package/scss/foundation/core/engine/theme-builder.scss +83 -0
  46. package/scss/foundation/core/engine/typographics.scss +44 -0
  47. package/scss/foundation/core/engine/typography-calc.scss +71 -0
  48. package/scss/foundation/foundation.scss +29 -0
  49. package/scss/foundation/views/_render.scss +13 -0
  50. package/scss/foundation/views/components/_alert.scss +103 -0
  51. package/scss/foundation/views/components/_avatar.scss +84 -0
  52. package/scss/foundation/views/components/_badge.scss +100 -0
  53. package/scss/foundation/views/components/_breadcrumb.scss +70 -0
  54. package/scss/foundation/views/components/_card.scss +117 -0
  55. package/scss/foundation/views/components/_dropdown.scss +123 -0
  56. package/scss/foundation/views/components/_form.scss +209 -0
  57. package/scss/foundation/views/components/_index.scss +20 -0
  58. package/scss/foundation/views/components/_modal.scss +138 -0
  59. package/scss/foundation/views/components/_pagination.scss +82 -0
  60. package/scss/foundation/views/components/_skeleton.scss +69 -0
  61. package/scss/foundation/views/components/_table.scss +94 -0
  62. package/scss/foundation/views/components/_tabs.scss +96 -0
  63. package/scss/foundation/views/components/_toast.scss +139 -0
  64. package/scss/foundation/views/components/_tooltip.scss +100 -0
  65. package/scss/foundation/views/patterns/_hero.scss +121 -0
  66. package/scss/foundation/views/patterns/_index.scss +8 -0
  67. package/scss/foundation/views/patterns/_sidebar-layout.scss +83 -0
  68. package/scss/foundation/views/render/_layer-order.scss +11 -0
  69. package/scss/foundation/views/render/classes/_animations.scss +233 -0
  70. package/scss/foundation/views/render/classes/_aspect-ratio.scss +17 -0
  71. package/scss/foundation/views/render/classes/_borders.scss +31 -0
  72. package/scss/foundation/views/render/classes/_buttons.scss +40 -0
  73. package/scss/foundation/views/render/classes/_colors.scss +83 -0
  74. package/scss/foundation/views/render/classes/_compounds.scss +103 -0
  75. package/scss/foundation/views/render/classes/_containers.scss +20 -0
  76. package/scss/foundation/views/render/classes/_misc-utils.scss +51 -0
  77. package/scss/foundation/views/render/classes/_position.scss +56 -0
  78. package/scss/foundation/views/render/classes/_sections.scss +30 -0
  79. package/scss/foundation/views/render/classes/_shadows.scss +198 -0
  80. package/scss/foundation/views/render/classes/_sizes.scss +39 -0
  81. package/scss/foundation/views/render/classes/_sizing-utils.scss +53 -0
  82. package/scss/foundation/views/render/classes/_spacing.scss +91 -0
  83. package/scss/foundation/views/render/classes/_state-variants.scss +47 -0
  84. package/scss/foundation/views/render/classes/_typography.scss +32 -0
  85. package/scss/foundation/views/render/classes/_utilities.scss +103 -0
  86. package/scss/foundation/views/render/classes/_z-index.scss +22 -0
  87. package/scss/foundation/views/render/classes/flexbox.scss +56 -0
  88. package/scss/foundation/views/render/classes/grid.scss +195 -0
  89. package/scss/foundation/views/render/classes.scss +116 -0
  90. package/scss/foundation/views/render/html-body.scss +54 -0
  91. package/scss/foundation/views/render/property-registration.scss +77 -0
  92. package/scss/foundation/views/render/reset.scss +147 -0
  93. package/scss/foundation/views/render/root-generator.scss +166 -0
  94. package/scss/foundation/views/render/root.scss +19 -0
  95. package/scss/foundation/views/render/typography.scss +129 -0
  96. package/scss/llms.txt +247 -0
  97. package/scss/package.json +89 -0
  98. package/scss/scripts/gen-cheatsheet.mjs +178 -0
  99. package/scss/scripts/gen-tokens.mjs +91 -0
  100. package/scss/scripts/test-compile.mjs +474 -0
  101. package/scss/zeus.config.scss +99 -0
  102. package/scss/zeus.customize.scss +246 -0
  103. package/scss/zeus.scss +17 -0
  104. package/scss/zeus.token.sets.example.scss +176 -0
  105. package/scss/zeus.tokens.json +687 -0
@@ -0,0 +1,178 @@
1
+ #!/usr/bin/env node
2
+ // ╔══════════════════════════════════════════════════════════════╗
3
+ // ║ ⚡ Zeus CSS — Cheatsheet Generator ║
4
+ // ║ ║
5
+ // ║ Scans the actual SCSS source (never hand-maintained, so it ║
6
+ // ║ can't drift) for every public @mixin/@function signature and ║
7
+ // ║ every utility-class family pattern, and emits: ║
8
+ // ║ llms.txt — flat, LLM-context-friendly reference ║
9
+ // ║ cheatsheet.md — the same content, as readable Markdown ║
10
+ // ║ ║
11
+ // ║ "Public" = does not start with "_" — the framework's own ║
12
+ // ║ established convention for internal/private helpers. ║
13
+ // ╚══════════════════════════════════════════════════════════════╝
14
+
15
+ import { fileURLToPath } from "node:url";
16
+ import { dirname, join, relative } from "node:path";
17
+ import { readFileSync, writeFileSync, readdirSync, statSync } from "node:fs";
18
+
19
+ const __dirname = dirname(fileURLToPath(import.meta.url));
20
+ const ROOT = join(__dirname, "..");
21
+
22
+ function walk(dir) {
23
+ let out = [];
24
+ for (const entry of readdirSync(dir)) {
25
+ const full = join(dir, entry);
26
+ const s = statSync(full);
27
+ if (s.isDirectory()) out = out.concat(walk(full));
28
+ else if (entry.endsWith(".scss")) out.push(full);
29
+ }
30
+ return out;
31
+ }
32
+
33
+ // ── 1. Mixins & functions ─────────────────────────────────────────
34
+ const engineFiles = walk(join(ROOT, "foundation/core/engine")).concat(
35
+ walk(join(ROOT, "foundation/core/buttons"))
36
+ );
37
+
38
+ const apiEntries = [];
39
+ const defStartRegex = /^(@mixin|@function)\s+([a-zA-Z][a-zA-Z0-9-]*)\s*(\(|\{|$)/;
40
+
41
+ // A comment line counts as a real description only if it's mostly letters —
42
+ // filters out decorative dividers like "╚══...══╝", "----...----",
43
+ // "= = = = = = =" that would otherwise get picked up as the "description".
44
+ function isProseComment(line) {
45
+ const stripped = line.trim().replace(/^\/+\s*/, "");
46
+ if (stripped.length < 3) return false;
47
+ const letters = (stripped.match(/[a-zA-Z]/g) || []).length;
48
+ return letters / stripped.length > 0.4;
49
+ }
50
+
51
+ for (const file of engineFiles) {
52
+ const raw = readFileSync(file, "utf8");
53
+ const lines = raw.split("\n");
54
+ const relPath = relative(ROOT, file).replace(/\\/g, "/");
55
+
56
+ // Whole-file opt-out: a header explicitly stating this file is private
57
+ // (e.g. "Private file — NOT part of the public API", fluid-core.scss)
58
+ // takes precedence over the underscore-name convention below.
59
+ const header = lines.slice(0, 15).join("\n");
60
+ if (/not part of the public api|private file/i.test(header)) continue;
61
+
62
+ for (let i = 0; i < lines.length; i++) {
63
+ const m = lines[i].match(defStartRegex);
64
+ if (!m) continue;
65
+ const [, kind, name] = m;
66
+ if (name.startsWith("_")) continue; // private, skip
67
+
68
+ // Collect the full signature by tracking paren depth across lines —
69
+ // handles both multi-line parameter lists (@mixin slide-in(\n $a,\n $b\n))
70
+ // and default values that themselves contain parens (rgba(59,130,246,0.5)).
71
+ let sigText = "";
72
+ let depth = 0;
73
+ let started = false;
74
+ outer: for (let j = i; j < lines.length; j++) {
75
+ for (const ch of lines[j]) {
76
+ if (ch === "(") {
77
+ depth++;
78
+ started = true;
79
+ } else if (ch === ")") {
80
+ depth--;
81
+ }
82
+ sigText += ch;
83
+ if (started && depth === 0) break outer;
84
+ if (!started && ch === "{") break outer; // no-parens mixin: "@mixin foo() {" already handled; "@mixin foo {" edge case
85
+ }
86
+ sigText += " ";
87
+ }
88
+ const parenMatch = sigText.match(/\(([\s\S]*)\)/);
89
+ const params = parenMatch
90
+ ? "(" + parenMatch[1].replace(/\s+/g, " ").trim() + ")"
91
+ : "()";
92
+
93
+ // Find the nearest preceding prose comment line as description
94
+ let desc = "";
95
+ for (let j = i - 1; j >= 0 && j > i - 6; j--) {
96
+ const t = lines[j].trim();
97
+ if (t === "") continue;
98
+ if (t.startsWith("//")) {
99
+ if (isProseComment(t)) desc = t.replace(/^\/+\s*/, "");
100
+ break;
101
+ }
102
+ break;
103
+ }
104
+ apiEntries.push({ kind: kind.slice(1), name, params, desc, file: relPath });
105
+ }
106
+ }
107
+
108
+ // ── 2. Utility class families ──────────────────────────────────────
109
+ const classFiles = walk(join(ROOT, "foundation/views/render/classes"));
110
+ const classFamilies = [];
111
+ const mixinNameRegex = /@mixin\s+(load-[a-zA-Z-]+)/;
112
+ const classRegex = /\.#\{\$prefix\}([a-zA-Z0-9_\\:-]+)/g;
113
+
114
+ for (const file of classFiles) {
115
+ const src = readFileSync(file, "utf8");
116
+ const relPath = relative(ROOT, file).replace(/\\/g, "/");
117
+ const mixinMatch = src.match(mixinNameRegex);
118
+ const loaderName = mixinMatch ? mixinMatch[1] : relPath;
119
+ const seen = new Set();
120
+ let m;
121
+ while ((m = classRegex.exec(src)) !== null) {
122
+ // The regex boundary already stops before "#{...}" interpolations, so a
123
+ // dynamic class like ".col-span-#{$i}" is captured as "col-span-" — turn
124
+ // that trailing dash into a readable "{n}" placeholder. Also strip a
125
+ // trailing "\\:" left over from the hover:/focus: variant escape.
126
+ let family = m[1].replace(/\\:$/, "");
127
+ if (family.endsWith("-")) family += "{n}";
128
+ if (!seen.has(family)) {
129
+ seen.add(family);
130
+ classFamilies.push({ family, loader: loaderName, file: relPath });
131
+ }
132
+ }
133
+ }
134
+
135
+ // ── 3. Render llms.txt ──────────────────────────────────────────────
136
+ let llms = "";
137
+ llms += "# Zeus CSS — LLM Reference\n\n";
138
+ llms += "Auto-generated from source (scripts/gen-cheatsheet.mjs). Two entry points:\n";
139
+ llms += ' @use "zeus" as *; — mixins/functions only, zero CSS emitted\n';
140
+ llms += ' @use "foundation"; — full compiled CSS, import once at app root\n\n';
141
+
142
+ llms += "## Mixins & Functions\n\n";
143
+ for (const e of apiEntries) {
144
+ llms += `${e.kind} ${e.name}${e.params}`;
145
+ if (e.desc) llms += ` — ${e.desc}`;
146
+ llms += ` [${e.file}]\n`;
147
+ }
148
+
149
+ llms += "\n## Utility Class Families\n\n";
150
+ for (const c of classFamilies) {
151
+ llms += `.${c.family} (${c.loader}) [${c.file}]\n`;
152
+ }
153
+
154
+ writeFileSync(join(ROOT, "llms.txt"), llms);
155
+
156
+ // ── 4. Render cheatsheet.md ──────────────────────────────────────────
157
+ let md = "# Zeus CSS Cheatsheet\n\n";
158
+ md += "> Auto-generated from source — do not hand-edit. Regenerate with `npm run gen:cheatsheet`.\n\n";
159
+
160
+ md += "## Mixins & Functions\n\n";
161
+ md += "| Kind | Signature | Description | File |\n";
162
+ md += "|---|---|---|---|\n";
163
+ for (const e of apiEntries) {
164
+ md += `| ${e.kind} | \`${e.name}${e.params}\` | ${e.desc} | \`${e.file}\` |\n`;
165
+ }
166
+
167
+ md += "\n## Utility Class Families\n\n";
168
+ md += "| Class pattern | Generator mixin | File |\n";
169
+ md += "|---|---|---|\n";
170
+ for (const c of classFamilies) {
171
+ md += `| \`.${c.family}\` | \`${c.loader}()\` | \`${c.file}\` |\n`;
172
+ }
173
+
174
+ writeFileSync(join(ROOT, "cheatsheet.md"), md);
175
+
176
+ console.log(
177
+ `Wrote llms.txt + cheatsheet.md — ${apiEntries.length} mixins/functions, ${classFamilies.length} utility class families`
178
+ );
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ // ╔══════════════════════════════════════════════════════════════╗
3
+ // ║ ⚡ Zeus CSS — Design Tokens JSON Generator ║
4
+ // ║ ║
5
+ // ║ Compiles foundation.scss, extracts every :root custom ║
6
+ // ║ property, and emits a W3C Design Tokens Community Group ║
7
+ // ║ format JSON manifest (zeus.tokens.json) — a single, ║
8
+ // ║ machine-readable contract of the whole token system for ║
9
+ // ║ design tools and AI coding agents. Always generated FROM the ║
10
+ // ║ compiled output, never hand-maintained, so it can never drift ║
11
+ // ║ from what actually ships. ║
12
+ // ╚══════════════════════════════════════════════════════════════╝
13
+
14
+ import * as sass from "sass";
15
+ import { fileURLToPath } from "node:url";
16
+ import { dirname, join } from "node:path";
17
+ import { writeFileSync } from "node:fs";
18
+
19
+ const __dirname = dirname(fileURLToPath(import.meta.url));
20
+ const ROOT = join(__dirname, "..");
21
+
22
+ // ── 1. Compile the default build ─────────────────────────────────
23
+ const { css } = sass.compile(join(ROOT, "foundation/foundation.scss"), {
24
+ loadPaths: [ROOT],
25
+ });
26
+
27
+ // ── 2. Extract every custom property declaration ─────────────────
28
+ // Matches " --name: value;" lines anywhere in the compiled CSS —
29
+ // deliberately not limited to a single :root block, since color-scheme
30
+ // strategies ("class"/"attribute") can emit more than one root selector.
31
+ // The value class excludes { and } so this can never accidentally match
32
+ // INTO a BEM modifier selector like ".z-card--flat:hover { ... }" — without
33
+ // that exclusion, "--flat:hover {\n box-shadow: none" looks exactly like a
34
+ // "--flat: <value>;" custom property declaration to a naive regex.
35
+ const propRegex = /--([a-zA-Z][a-zA-Z0-9-]*):\s*([^;{}]+);/g;
36
+ const tokens = new Map(); // name -> value (first occurrence wins — the
37
+ // light/base value, consistent across strategies)
38
+ let match;
39
+ while ((match = propRegex.exec(css)) !== null) {
40
+ const [, name, value] = match;
41
+ if (!tokens.has(name)) tokens.set(name, value.trim());
42
+ }
43
+
44
+ // ── 3. Categorize + assign a W3C token $type ──────────────────────
45
+ // Order matters — first matching prefix wins.
46
+ const CATEGORY_RULES = [
47
+ { prefix: "color-", group: "color", type: "color" },
48
+ { prefix: "base-", group: "base", type: "color" },
49
+ { prefix: "shadow-", group: "shadow", type: "shadow" },
50
+ { prefix: "text-", group: "typography", type: "typography" },
51
+ { prefix: "space-", group: "space", type: "dimension" },
52
+ { prefix: "border-radius-", group: "borderRadius", type: "dimension" },
53
+ { prefix: "border-line-", group: "borderWidth", type: "dimension" },
54
+ { prefix: "size-icon-", group: "iconSize", type: "dimension" },
55
+ { prefix: "col-gap-", group: "columnGap", type: "dimension" },
56
+ { prefix: "padding-outer", group: "spacing", type: "dimension" },
57
+ { prefix: "z-", group: "zIndex", type: "number" },
58
+ ];
59
+
60
+ function classify(name) {
61
+ for (const rule of CATEGORY_RULES) {
62
+ if (name.startsWith(rule.prefix)) {
63
+ return { group: rule.group, type: rule.type, key: name.slice(rule.prefix.length) || name };
64
+ }
65
+ }
66
+ return { group: "custom", type: "other", key: name };
67
+ }
68
+
69
+ // ── 4. Build the W3C Design Tokens tree ───────────────────────────
70
+ const manifest = {
71
+ $description:
72
+ "Zeus CSS design tokens — auto-generated from the compiled stylesheet. " +
73
+ "Do not hand-edit; regenerate with `npm run gen:tokens`.",
74
+ };
75
+
76
+ for (const [name, rawValue] of tokens) {
77
+ const { group, type, key } = classify(name);
78
+ manifest[group] ??= {};
79
+ // $type: "number" tokens (the z-index scale) get a real JSON number,
80
+ // per the W3C format — not a numeric-looking string.
81
+ const value = type === "number" && !Number.isNaN(Number(rawValue)) ? Number(rawValue) : rawValue;
82
+ manifest[group][key] = {
83
+ $value: value,
84
+ $type: type,
85
+ $description: `--${name}`,
86
+ };
87
+ }
88
+
89
+ const outPath = join(ROOT, "zeus.tokens.json");
90
+ writeFileSync(outPath, JSON.stringify(manifest, null, 2) + "\n");
91
+ console.log(`Wrote ${tokens.size} tokens across ${Object.keys(manifest).length - 1} groups to zeus.tokens.json`);