@auriel/peppertino 0.5.0 → 0.6.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 (130) hide show
  1. package/CHANGELOG.txt +242 -224
  2. package/LICENSE +21 -21
  3. package/MIGRATION.md +52 -52
  4. package/README.md +773 -764
  5. package/agents/peppertino/SKILL.md +76 -0
  6. package/agents/peppertino/accordion.md +134 -0
  7. package/agents/peppertino/alert.md +116 -0
  8. package/agents/peppertino/badge.md +74 -0
  9. package/agents/peppertino/base.md +252 -0
  10. package/agents/peppertino/button.md +65 -0
  11. package/agents/peppertino/card.md +82 -0
  12. package/agents/peppertino/carousel.md +147 -0
  13. package/agents/peppertino/catalog.md +81 -0
  14. package/agents/peppertino/dark-mode.md +152 -0
  15. package/agents/peppertino/footer.md +109 -0
  16. package/agents/peppertino/forms-fieldset.md +85 -0
  17. package/agents/peppertino/forms-form-instructions.md +94 -0
  18. package/agents/peppertino/forms-label.md +110 -0
  19. package/agents/peppertino/forms-text-field.md +134 -0
  20. package/agents/peppertino/forms-validation.md +153 -0
  21. package/agents/peppertino/gradient.md +41 -0
  22. package/agents/peppertino/header.md +105 -0
  23. package/agents/peppertino/modal.md +123 -0
  24. package/agents/peppertino/section.md +56 -0
  25. package/agents/peppertino/select.md +110 -0
  26. package/agents/peppertino/switch.md +72 -0
  27. package/agents/peppertino/table.md +69 -0
  28. package/agents/peppertino/tabs.md +115 -0
  29. package/agents/peppertino/toast.md +96 -0
  30. package/agents/peppertino/tooltip.md +111 -0
  31. package/agents/peppertino/typography.md +118 -0
  32. package/agents/peppertino/utilities.md +194 -0
  33. package/agents/skill.md +65 -0
  34. package/build.js +53 -53
  35. package/dist/accordion.js +1 -1
  36. package/dist/accordion.js.map +2 -2
  37. package/dist/alert.js.map +1 -1
  38. package/dist/carousel.js.map +1 -1
  39. package/dist/header.js.map +1 -1
  40. package/dist/main.css +2566 -1008
  41. package/dist/main.css.map +1 -1
  42. package/dist/main.min.css +1 -0
  43. package/dist/modal.js.map +1 -1
  44. package/dist/peppertino.js +1 -1
  45. package/dist/peppertino.js.map +2 -2
  46. package/dist/select.js.map +1 -1
  47. package/dist/switch.js.map +1 -1
  48. package/dist/tabs.js.map +1 -1
  49. package/dist/theme.js.map +1 -1
  50. package/dist/toast.js.map +1 -1
  51. package/dist/validation.js.map +1 -1
  52. package/icon.svg +4 -0
  53. package/index.html +2172 -2098
  54. package/package.json +28 -28
  55. package/scripts/hex-to-hsl.mjs +75 -75
  56. package/scripts/lint-bem.mjs +53 -53
  57. package/scripts/lint-colors.mjs +87 -87
  58. package/site.webmanifest +18 -0
  59. package/src/js/accordion.js +105 -103
  60. package/src/js/alert.js +28 -28
  61. package/src/js/carousel.js +153 -153
  62. package/src/js/header.js +85 -85
  63. package/src/js/modal.js +138 -138
  64. package/src/js/peppertino.js +15 -15
  65. package/src/js/select.js +101 -101
  66. package/src/js/switch.js +28 -28
  67. package/src/js/tabs.js +104 -104
  68. package/src/js/theme.js +47 -47
  69. package/src/js/toast.js +79 -79
  70. package/src/js/validation.js +132 -132
  71. package/src/scss/accordion.scss +190 -156
  72. package/src/scss/activity.scss +17 -0
  73. package/src/scss/alert.scss +203 -203
  74. package/src/scss/badge.scss +90 -90
  75. package/src/scss/base.scss +511 -506
  76. package/src/scss/button.scss +119 -119
  77. package/src/scss/card.scss +121 -121
  78. package/src/scss/carousel.scss +303 -303
  79. package/src/scss/code-block.scss +22 -0
  80. package/src/scss/counter.scss +5 -0
  81. package/src/scss/dark-mode.scss +514 -514
  82. package/src/scss/duration.scss +26 -0
  83. package/src/scss/folder.scss +27 -0
  84. package/src/scss/footer.scss +224 -224
  85. package/src/scss/forms/fieldset.scss +127 -127
  86. package/src/scss/forms/form-instructions.scss +133 -133
  87. package/src/scss/forms/label.scss +115 -115
  88. package/src/scss/forms/text-field.scss +240 -240
  89. package/src/scss/forms/validation.scss +215 -215
  90. package/src/scss/forms.scss +8 -8
  91. package/src/scss/gradient.scss +11 -11
  92. package/src/scss/gravity-letters.scss +7 -0
  93. package/src/scss/header.scss +257 -238
  94. package/src/scss/helpers/color.scss +9 -0
  95. package/src/scss/helpers/flex.scss +14 -0
  96. package/src/scss/helpers/index.scss +6 -0
  97. package/src/scss/helpers/layout.scss +14 -0
  98. package/src/scss/helpers/spacing.scss +14 -0
  99. package/src/scss/helpers/typography.scss +11 -0
  100. package/src/scss/helpers/visibility.scss +9 -0
  101. package/src/scss/main.scss +49 -24
  102. package/src/scss/modal.scss +188 -188
  103. package/src/scss/model-picker.scss +5 -0
  104. package/src/scss/notification.scss +5 -0
  105. package/src/scss/orb.scss +7 -0
  106. package/src/scss/otp.scss +5 -0
  107. package/src/scss/pill-nav.scss +10 -0
  108. package/src/scss/prompt.scss +28 -0
  109. package/src/scss/rail.scss +7 -0
  110. package/src/scss/reactions.scss +5 -0
  111. package/src/scss/reset.scss +84 -84
  112. package/src/scss/response.scss +11 -0
  113. package/src/scss/reveal.scss +5 -0
  114. package/src/scss/scroll-progress.scss +4 -0
  115. package/src/scss/search-results.scss +13 -0
  116. package/src/scss/section.scss +87 -79
  117. package/src/scss/select.scss +210 -210
  118. package/src/scss/sidebar.scss +8 -0
  119. package/src/scss/status.scss +5 -0
  120. package/src/scss/step-list.scss +13 -0
  121. package/src/scss/switch.scss +121 -121
  122. package/src/scss/table.scss +89 -89
  123. package/src/scss/tabs.scss +156 -156
  124. package/src/scss/task-list.scss +18 -0
  125. package/src/scss/theme-picker.scss +5 -0
  126. package/src/scss/toast.scss +170 -170
  127. package/src/scss/tooltip.scss +126 -126
  128. package/src/scss/typography.scss +58 -58
  129. package/src/scss/utilities.scss +243 -243
  130. package/src/scss/voice-note.scss +5 -0
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@auriel/peppertino",
3
- "version": "0.5.0",
4
- "description": "An Apple-inspired CSS framework with a spicy red accent. Clean geometry, restrained elegance, zero Cupertino lawsuits.",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://codeberg.org/debaditya/Peppertino"
8
- },
9
- "license": "MIT",
10
- "scripts": {
11
- "build:css": "sass src/scss/main.scss dist/main.css --style=expanded --source-map",
12
- "build:css:min": "sass src/scss/main.scss dist/main.min.css --style=compressed --no-source-map",
13
- "build:js": "bun build.js",
14
- "lint:colors": "bun scripts/lint-colors.mjs",
15
- "lint:bem": "bun scripts/lint-bem.mjs",
16
- "build": "bun run build:css && bun run build:js && bun run lint:colors && bun run lint:bem",
17
- "watch:css": "sass --watch src/scss/main.scss:dist/main.css --style=expanded --source-map",
18
- "watch:js": "bun build.js --watch",
19
- "serve": "bunx --bun serve . --port 3000",
20
- "dev": "bun run build && concurrently \"bun run watch:css\" \"bun run watch:js\" \"bun run serve\""
21
- },
22
- "devDependencies": {
23
- "concurrently": "^9.1.2",
24
- "esbuild": "^0.25.4",
25
- "sass": "^1.89.0",
26
- "serve": "^14.2.4"
27
- }
28
- }
1
+ {
2
+ "name": "@auriel/peppertino",
3
+ "version": "0.6.0",
4
+ "description": "An Apple-inspired CSS framework with a spicy red accent. Clean geometry, restrained elegance, zero Cupertino lawsuits.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://codeberg.org/debaditya/Peppertino"
8
+ },
9
+ "license": "MIT",
10
+ "scripts": {
11
+ "build:css": "sass src/scss/main.scss dist/main.css --style=expanded --source-map",
12
+ "build:css:min": "sass src/scss/main.scss dist/main.min.css --style=compressed --no-source-map",
13
+ "build:js": "bun build.js",
14
+ "lint:colors": "bun scripts/lint-colors.mjs",
15
+ "lint:bem": "bun scripts/lint-bem.mjs",
16
+ "build": "bun run build:css && bun run build:css:min && bun run build:js && bun run lint:colors && bun run lint:bem",
17
+ "watch:css": "sass --watch src/scss/main.scss:dist/main.css --style=expanded --source-map",
18
+ "watch:js": "bun build.js --watch",
19
+ "serve": "bunx --bun serve . --port 3000",
20
+ "dev": "bun run build && concurrently \"bun run watch:css\" \"bun run watch:js\" \"bun run serve\""
21
+ },
22
+ "devDependencies": {
23
+ "concurrently": "^9.1.2",
24
+ "esbuild": "^0.25.4",
25
+ "sass": "^1.89.0",
26
+ "serve": "^14.2.4"
27
+ }
28
+ }
@@ -1,75 +1,75 @@
1
- // One-off script: converts all base.scss hex color tokens to decomposed HSL triplets.
2
- // Run: node scripts/hex-to-hsl.mjs
3
- // Output is printed to stdout — copy into base.scss and dark-mode.scss.
4
-
5
- function hexToHsl(hex) {
6
- hex = hex.replace('#', '');
7
- if (hex.length === 3) hex = hex.split('').map(c => c + c).join('');
8
- const r = parseInt(hex.slice(0, 2), 16) / 255;
9
- const g = parseInt(hex.slice(2, 4), 16) / 255;
10
- const b = parseInt(hex.slice(4, 6), 16) / 255;
11
-
12
- const max = Math.max(r, g, b), min = Math.min(r, g, b);
13
- let h, s, l = (max + min) / 2;
14
-
15
- if (max === min) {
16
- h = s = 0;
17
- } else {
18
- const d = max - min;
19
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
20
- switch (max) {
21
- case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
22
- case g: h = ((b - r) / d + 2) / 6; break;
23
- case b: h = ((r - g) / d + 4) / 6; break;
24
- }
25
- }
26
-
27
- return {
28
- h: Math.round(h * 360),
29
- s: Math.round(s * 1000) / 10,
30
- l: Math.round(l * 1000) / 10,
31
- };
32
- }
33
-
34
- const tokens = {
35
- 'primary': '#e90111',
36
- 'primary-light': '#ff4d5a',
37
- 'primary-dark': '#a8000c',
38
- 'accent': '#f77f00',
39
- 'gradient-start': '#ffcf67',
40
- 'gradient-end': '#ea5753',
41
- 'neutral-50': '#fafafa',
42
- 'neutral-100': '#f4f4f5',
43
- 'neutral-200': '#e4e4e7',
44
- 'neutral-300': '#d4d4d8',
45
- 'neutral-400': '#a1a1aa',
46
- 'neutral-500': '#71717a',
47
- 'neutral-600': '#52525b',
48
- 'neutral-700': '#3f3f46',
49
- 'neutral-800': '#27272a',
50
- 'neutral-900': '#18181b',
51
- 'success': '#22c55e',
52
- 'warning': '#f59e0b',
53
- 'error': '#ef4444',
54
- 'info': '#3b82f6',
55
- // Button variant shades (needed for button.scss tokens)
56
- 'success-600': '#16a34a',
57
- 'success-700': '#15803d',
58
- 'success-800': '#166534',
59
- 'warning-600': '#d97706',
60
- 'warning-700': '#b45309',
61
- 'warning-800': '#92400e',
62
- 'error-600': '#dc2626',
63
- 'error-700': '#b91c1c',
64
- };
65
-
66
- console.log(':root {');
67
- for (const [name, hex] of Object.entries(tokens)) {
68
- const { h, s, l } = hexToHsl(hex);
69
- console.log(` --pp-${name}-h: ${h};`);
70
- console.log(` --pp-${name}-s: ${s}%;`);
71
- console.log(` --pp-${name}-l: ${l}%;`);
72
- console.log(` --pp-${name}: hsl(var(--pp-${name}-h) var(--pp-${name}-s) var(--pp-${name}-l));`);
73
- console.log('');
74
- }
75
- console.log('}');
1
+ // One-off script: converts all base.scss hex color tokens to decomposed HSL triplets.
2
+ // Run: node scripts/hex-to-hsl.mjs
3
+ // Output is printed to stdout — copy into base.scss and dark-mode.scss.
4
+
5
+ function hexToHsl(hex) {
6
+ hex = hex.replace('#', '');
7
+ if (hex.length === 3) hex = hex.split('').map(c => c + c).join('');
8
+ const r = parseInt(hex.slice(0, 2), 16) / 255;
9
+ const g = parseInt(hex.slice(2, 4), 16) / 255;
10
+ const b = parseInt(hex.slice(4, 6), 16) / 255;
11
+
12
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
13
+ let h, s, l = (max + min) / 2;
14
+
15
+ if (max === min) {
16
+ h = s = 0;
17
+ } else {
18
+ const d = max - min;
19
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
20
+ switch (max) {
21
+ case r: h = ((g - b) / d + (g < b ? 6 : 0)) / 6; break;
22
+ case g: h = ((b - r) / d + 2) / 6; break;
23
+ case b: h = ((r - g) / d + 4) / 6; break;
24
+ }
25
+ }
26
+
27
+ return {
28
+ h: Math.round(h * 360),
29
+ s: Math.round(s * 1000) / 10,
30
+ l: Math.round(l * 1000) / 10,
31
+ };
32
+ }
33
+
34
+ const tokens = {
35
+ 'primary': '#e90111',
36
+ 'primary-light': '#ff4d5a',
37
+ 'primary-dark': '#a8000c',
38
+ 'accent': '#f77f00',
39
+ 'gradient-start': '#ffcf67',
40
+ 'gradient-end': '#ea5753',
41
+ 'neutral-50': '#fafafa',
42
+ 'neutral-100': '#f4f4f5',
43
+ 'neutral-200': '#e4e4e7',
44
+ 'neutral-300': '#d4d4d8',
45
+ 'neutral-400': '#a1a1aa',
46
+ 'neutral-500': '#71717a',
47
+ 'neutral-600': '#52525b',
48
+ 'neutral-700': '#3f3f46',
49
+ 'neutral-800': '#27272a',
50
+ 'neutral-900': '#18181b',
51
+ 'success': '#22c55e',
52
+ 'warning': '#f59e0b',
53
+ 'error': '#ef4444',
54
+ 'info': '#3b82f6',
55
+ // Button variant shades (needed for button.scss tokens)
56
+ 'success-600': '#16a34a',
57
+ 'success-700': '#15803d',
58
+ 'success-800': '#166534',
59
+ 'warning-600': '#d97706',
60
+ 'warning-700': '#b45309',
61
+ 'warning-800': '#92400e',
62
+ 'error-600': '#dc2626',
63
+ 'error-700': '#b91c1c',
64
+ };
65
+
66
+ console.log(':root {');
67
+ for (const [name, hex] of Object.entries(tokens)) {
68
+ const { h, s, l } = hexToHsl(hex);
69
+ console.log(` --pp-${name}-h: ${h};`);
70
+ console.log(` --pp-${name}-s: ${s}%;`);
71
+ console.log(` --pp-${name}-l: ${l}%;`);
72
+ console.log(` --pp-${name}: hsl(var(--pp-${name}-h) var(--pp-${name}-s) var(--pp-${name}-l));`);
73
+ console.log('');
74
+ }
75
+ console.log('}');
@@ -1,53 +1,53 @@
1
- #!/usr/bin/env bun
2
- // Checks compiled dist/main.css for .pp-* class selectors that violate BEM.
3
- // Valid: .pp-button, .pp-button__icon, .pp-button--outline, .pp-button--outline.pp-button--success
4
- // Invalid: .pp-button-success (compound hyphen — should be .pp-button--success)
5
- // .pp-buttonIcon (camelCase)
6
- // Usage: bun run scripts/lint-bem.mjs
7
-
8
- import { readFile } from 'fs/promises';
9
- import { join } from 'path';
10
-
11
- const cssPath = join(import.meta.dir, '..', 'dist', 'main.css');
12
-
13
- let css;
14
- try {
15
- css = await readFile(cssPath, 'utf8');
16
- } catch {
17
- console.error('✖ lint-bem: dist/main.css not found. Run build:css first.');
18
- process.exit(1);
19
- }
20
-
21
- // Extract all .pp-* class tokens from selectors
22
- // Match class selectors: .pp-something (stop at space/:/./[/{})
23
- const CLASS_PATTERN = /\.pp-[\w-]+/g;
24
-
25
- // BEM-valid patterns for .pp-* classes:
26
- // Block only: .pp-[block]
27
- // Block + element: .pp-[block]__[element]
28
- // Block + modifier: .pp-[block]--[modifier]
29
- // (double hyphen is modifier, double underscore is element — single hyphens within a segment are fine)
30
- const BEM_VALID = /^\.pp-[a-z][a-z0-9]*(-[a-z0-9]+)*(__[a-z0-9][a-z0-9]*(-[a-z0-9]+)*)?(--[a-z0-9][a-z0-9]*(-[a-z0-9]+)*)?$/;
31
-
32
- const seen = new Set();
33
- const violations = [];
34
-
35
- let match;
36
- while ((match = CLASS_PATTERN.exec(css)) !== null) {
37
- const cls = match[0];
38
- if (seen.has(cls)) continue;
39
- seen.add(cls);
40
-
41
- if (!BEM_VALID.test(cls)) {
42
- violations.push(cls);
43
- }
44
- }
45
-
46
- if (violations.length > 0) {
47
- console.error('✖ lint-bem: The following .pp-* classes violate BEM naming:');
48
- violations.forEach((v) => console.error(` ${v}`));
49
- console.error('\nExpected: .pp-block, .pp-block__element, .pp-block--modifier\n');
50
- process.exit(1);
51
- } else {
52
- console.log(`✔ lint-bem: All ${seen.size} .pp-* selectors pass BEM naming check.`);
53
- }
1
+ #!/usr/bin/env bun
2
+ // Checks compiled dist/main.css for .pp-* class selectors that violate BEM.
3
+ // Valid: .pp-button, .pp-button__icon, .pp-button--outline, .pp-button--outline.pp-button--success
4
+ // Invalid: .pp-button-success (compound hyphen — should be .pp-button--success)
5
+ // .pp-buttonIcon (camelCase)
6
+ // Usage: bun run scripts/lint-bem.mjs
7
+
8
+ import { readFile } from 'fs/promises';
9
+ import { join } from 'path';
10
+
11
+ const cssPath = join(import.meta.dir, '..', 'dist', 'main.css');
12
+
13
+ let css;
14
+ try {
15
+ css = await readFile(cssPath, 'utf8');
16
+ } catch {
17
+ console.error('✖ lint-bem: dist/main.css not found. Run build:css first.');
18
+ process.exit(1);
19
+ }
20
+
21
+ // Extract all .pp-* class tokens from selectors
22
+ // Match class selectors: .pp-something (stop at space/:/./[/{})
23
+ const CLASS_PATTERN = /\.pp-[\w-]+/g;
24
+
25
+ // BEM-valid patterns for .pp-* classes:
26
+ // Block only: .pp-[block]
27
+ // Block + element: .pp-[block]__[element]
28
+ // Block + modifier: .pp-[block]--[modifier]
29
+ // (double hyphen is modifier, double underscore is element — single hyphens within a segment are fine)
30
+ const BEM_VALID = /^\.pp-[a-z][a-z0-9]*(-[a-z0-9]+)*(__[a-z0-9][a-z0-9]*(-[a-z0-9]+)*)?(--[a-z0-9][a-z0-9]*(-[a-z0-9]+)*)?$/;
31
+
32
+ const seen = new Set();
33
+ const violations = [];
34
+
35
+ let match;
36
+ while ((match = CLASS_PATTERN.exec(css)) !== null) {
37
+ const cls = match[0];
38
+ if (seen.has(cls)) continue;
39
+ seen.add(cls);
40
+
41
+ if (!BEM_VALID.test(cls)) {
42
+ violations.push(cls);
43
+ }
44
+ }
45
+
46
+ if (violations.length > 0) {
47
+ console.error('✖ lint-bem: The following .pp-* classes violate BEM naming:');
48
+ violations.forEach((v) => console.error(` ${v}`));
49
+ console.error('\nExpected: .pp-block, .pp-block__element, .pp-block--modifier\n');
50
+ process.exit(1);
51
+ } else {
52
+ console.log(`✔ lint-bem: All ${seen.size} .pp-* selectors pass BEM naming check.`);
53
+ }
@@ -1,87 +1,87 @@
1
- #!/usr/bin/env bun
2
- // Fails if any SCSS component file contains literal color values that should
3
- // be CSS custom properties. Structural white/black overlays are allowed.
4
- // Usage: bun run scripts/lint-colors.mjs
5
-
6
- import { readdir, readFile } from 'fs/promises';
7
- import { join, relative } from 'path';
8
-
9
- const EXEMPT = new Set(['base.scss', 'dark-mode.scss']);
10
-
11
- // Patterns that are ALLOWED in component files (structural design choices):
12
- // - Pure white/black with opacity: rgb(255...), rgb(0...), rgba(#fff,...), rgba(0,0,0,...)
13
- // - Transparent keyword
14
- const ALLOWED_PATTERNS = [
15
- /rgba?\(255[^)]*\)/, // white with alpha
16
- /rgba?\(0,\s*0,\s*0[^)]*\)/, // black with alpha
17
- /rgba?\(#fff[^)]*\)/, // #fff with alpha
18
- /rgba?\(#000[^)]*\)/, // #000 with alpha
19
- /rgb\(255\s+255\s+255[^)]*\)/, // modern white syntax
20
- /rgb\(0\s+0\s+0[^)]*\)/, // modern black syntax
21
- /^#fff$/i, // pure white
22
- /^#000$/i, // pure black
23
- ];
24
-
25
- // Patterns that are BANNED (should use CSS vars instead):
26
- const BANNED = [
27
- { pattern: /rgba?\(\s*\$color[-_\w]+\s*,/g, desc: 'rgba() with SCSS color variable — use hsl(var(--pp-*-h) ... / alpha)' },
28
- { pattern: /rgba?\(\s*\$gradient[-_\w]*\s*,/g, desc: 'rgba() with SCSS gradient variable — use hsl(var(--pp-gradient-*-h) ... / alpha)' },
29
- { pattern: /#[0-9a-fA-F]{6}(?!\s*[}|;,\n]?\s*!|[0-9a-fA-F])/g, desc: '6-digit hex color — use var(--pp-*)' },
30
- ];
31
-
32
- // Allowed 6-digit hexes (structural white/black variants):
33
- const ALLOWED_HEX = new Set(['#ffffff', '#000000', '#ffb3b3']);
34
-
35
- async function scanDir(dir) {
36
- const entries = await readdir(dir, { withFileTypes: true });
37
- const files = [];
38
- for (const entry of entries) {
39
- if (entry.isDirectory()) {
40
- files.push(...await scanDir(join(dir, entry.name)));
41
- } else if (entry.name.endsWith('.scss') && !EXEMPT.has(entry.name)) {
42
- files.push(join(dir, entry.name));
43
- }
44
- }
45
- return files;
46
- }
47
-
48
- const scssDir = join(import.meta.dir, '..', 'src', 'scss');
49
- const files = await scanDir(scssDir);
50
-
51
- let totalViolations = 0;
52
-
53
- for (const file of files) {
54
- const src = await readFile(file, 'utf8');
55
- const lines = src.split('\n');
56
- const relPath = relative(join(import.meta.dir, '..'), file);
57
-
58
- lines.forEach((line, i) => {
59
- const lineNum = i + 1;
60
- const trimmed = line.trim();
61
- if (trimmed.startsWith('//')) return; // skip comments
62
-
63
- for (const { pattern, desc } of BANNED) {
64
- const regex = new RegExp(pattern.source, pattern.flags);
65
- let match;
66
- while ((match = regex.exec(line)) !== null) {
67
- const hit = match[0].toLowerCase();
68
- // Skip if it matches an allowed pattern
69
- if (ALLOWED_PATTERNS.some((p) => p.test(match[0]))) continue;
70
- if (ALLOWED_HEX.has(hit)) continue;
71
- // Skip obvious structural #fff patterns
72
- if (hit === '#fff' || hit === '#000') continue;
73
-
74
- console.error(` ${relPath}:${lineNum} ${desc}`);
75
- console.error(` → ${line.trim()}`);
76
- totalViolations++;
77
- }
78
- }
79
- });
80
- }
81
-
82
- if (totalViolations > 0) {
83
- console.error(`\n✖ lint-colors: ${totalViolations} violation(s) found. Replace with var(--pp-*) tokens.\n`);
84
- process.exit(1);
85
- } else {
86
- console.log('✔ lint-colors: No literal color tokens found in component files.');
87
- }
1
+ #!/usr/bin/env bun
2
+ // Fails if any SCSS component file contains literal color values that should
3
+ // be CSS custom properties. Structural white/black overlays are allowed.
4
+ // Usage: bun run scripts/lint-colors.mjs
5
+
6
+ import { readdir, readFile } from 'fs/promises';
7
+ import { join, relative } from 'path';
8
+
9
+ const EXEMPT = new Set(['base.scss', 'dark-mode.scss']);
10
+
11
+ // Patterns that are ALLOWED in component files (structural design choices):
12
+ // - Pure white/black with opacity: rgb(255...), rgb(0...), rgba(#fff,...), rgba(0,0,0,...)
13
+ // - Transparent keyword
14
+ const ALLOWED_PATTERNS = [
15
+ /rgba?\(255[^)]*\)/, // white with alpha
16
+ /rgba?\(0,\s*0,\s*0[^)]*\)/, // black with alpha
17
+ /rgba?\(#fff[^)]*\)/, // #fff with alpha
18
+ /rgba?\(#000[^)]*\)/, // #000 with alpha
19
+ /rgb\(255\s+255\s+255[^)]*\)/, // modern white syntax
20
+ /rgb\(0\s+0\s+0[^)]*\)/, // modern black syntax
21
+ /^#fff$/i, // pure white
22
+ /^#000$/i, // pure black
23
+ ];
24
+
25
+ // Patterns that are BANNED (should use CSS vars instead):
26
+ const BANNED = [
27
+ { pattern: /rgba?\(\s*\$color[-_\w]+\s*,/g, desc: 'rgba() with SCSS color variable — use hsl(var(--pp-*-h) ... / alpha)' },
28
+ { pattern: /rgba?\(\s*\$gradient[-_\w]*\s*,/g, desc: 'rgba() with SCSS gradient variable — use hsl(var(--pp-gradient-*-h) ... / alpha)' },
29
+ { pattern: /#[0-9a-fA-F]{6}(?!\s*[}|;,\n]?\s*!|[0-9a-fA-F])/g, desc: '6-digit hex color — use var(--pp-*)' },
30
+ ];
31
+
32
+ // Allowed 6-digit hexes (structural white/black variants):
33
+ const ALLOWED_HEX = new Set(['#ffffff', '#000000', '#ffb3b3']);
34
+
35
+ async function scanDir(dir) {
36
+ const entries = await readdir(dir, { withFileTypes: true });
37
+ const files = [];
38
+ for (const entry of entries) {
39
+ if (entry.isDirectory()) {
40
+ files.push(...await scanDir(join(dir, entry.name)));
41
+ } else if (entry.name.endsWith('.scss') && !EXEMPT.has(entry.name)) {
42
+ files.push(join(dir, entry.name));
43
+ }
44
+ }
45
+ return files;
46
+ }
47
+
48
+ const scssDir = join(import.meta.dir, '..', 'src', 'scss');
49
+ const files = await scanDir(scssDir);
50
+
51
+ let totalViolations = 0;
52
+
53
+ for (const file of files) {
54
+ const src = await readFile(file, 'utf8');
55
+ const lines = src.split('\n');
56
+ const relPath = relative(join(import.meta.dir, '..'), file);
57
+
58
+ lines.forEach((line, i) => {
59
+ const lineNum = i + 1;
60
+ const trimmed = line.trim();
61
+ if (trimmed.startsWith('//')) return; // skip comments
62
+
63
+ for (const { pattern, desc } of BANNED) {
64
+ const regex = new RegExp(pattern.source, pattern.flags);
65
+ let match;
66
+ while ((match = regex.exec(line)) !== null) {
67
+ const hit = match[0].toLowerCase();
68
+ // Skip if it matches an allowed pattern
69
+ if (ALLOWED_PATTERNS.some((p) => p.test(match[0]))) continue;
70
+ if (ALLOWED_HEX.has(hit)) continue;
71
+ // Skip obvious structural #fff patterns
72
+ if (hit === '#fff' || hit === '#000') continue;
73
+
74
+ console.error(` ${relPath}:${lineNum} ${desc}`);
75
+ console.error(` → ${line.trim()}`);
76
+ totalViolations++;
77
+ }
78
+ }
79
+ });
80
+ }
81
+
82
+ if (totalViolations > 0) {
83
+ console.error(`\n✖ lint-colors: ${totalViolations} violation(s) found. Replace with var(--pp-*) tokens.\n`);
84
+ process.exit(1);
85
+ } else {
86
+ console.log('✔ lint-colors: No literal color tokens found in component files.');
87
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "PeppertinoCSS",
3
+ "short_name": "Peppertino",
4
+ "description": "An Apple-inspired CSS framework with a spicy red accent.",
5
+ "start_url": "./",
6
+ "scope": "./",
7
+ "display": "standalone",
8
+ "background_color": "#ffffff",
9
+ "theme_color": "#e90111",
10
+ "icons": [
11
+ {
12
+ "src": "./icon.svg",
13
+ "sizes": "any",
14
+ "type": "image/svg+xml",
15
+ "purpose": "any"
16
+ }
17
+ ]
18
+ }