@auriel/peppertino 0.4.0 → 0.5.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.txt +88 -0
- package/MIGRATION.md +52 -0
- package/README.md +184 -42
- package/dist/accordion.js +41 -4
- package/dist/accordion.js.map +2 -2
- package/dist/alert.js +26 -0
- package/dist/alert.js.map +7 -0
- package/dist/carousel.js +4 -0
- package/dist/carousel.js.map +2 -2
- package/dist/header.js +1 -0
- package/dist/header.js.map +2 -2
- package/dist/main.css +1047 -338
- package/dist/main.css.map +1 -1
- package/dist/modal.js +2 -0
- package/dist/modal.js.map +2 -2
- package/dist/peppertino.js +244 -15
- package/dist/peppertino.js.map +3 -3
- package/dist/select.js +2 -4
- package/dist/select.js.map +2 -2
- package/dist/switch.js +29 -0
- package/dist/switch.js.map +7 -0
- package/dist/tabs.js +27 -7
- package/dist/tabs.js.map +2 -2
- package/dist/theme.js +47 -0
- package/dist/theme.js.map +7 -0
- package/dist/toast.js +69 -0
- package/dist/toast.js.map +7 -0
- package/index.html +241 -45
- package/package.json +6 -4
- package/scripts/hex-to-hsl.mjs +75 -0
- package/scripts/lint-bem.mjs +53 -0
- package/scripts/lint-colors.mjs +87 -0
- package/src/js/accordion.js +48 -6
- package/src/js/alert.js +28 -0
- package/src/js/carousel.js +5 -0
- package/src/js/header.js +1 -0
- package/src/js/modal.js +4 -0
- package/src/js/peppertino.js +4 -0
- package/src/js/select.js +2 -4
- package/src/js/switch.js +28 -0
- package/src/js/tabs.js +31 -21
- package/src/js/theme.js +47 -0
- package/src/js/toast.js +79 -0
- package/src/scss/accordion.scss +8 -8
- package/src/scss/alert.scss +30 -31
- package/src/scss/badge.scss +90 -0
- package/src/scss/base.scss +267 -66
- package/src/scss/button.scss +44 -46
- package/src/scss/carousel.scss +18 -28
- package/src/scss/dark-mode.scss +135 -95
- package/src/scss/footer.scss +12 -12
- package/src/scss/forms/fieldset.scss +8 -8
- package/src/scss/forms/form-instructions.scss +8 -8
- package/src/scss/forms/text-field.scss +13 -13
- package/src/scss/forms/validation.scss +11 -11
- package/src/scss/gradient.scss +2 -2
- package/src/scss/main.scss +4 -0
- package/src/scss/modal.scss +2 -2
- package/src/scss/select.scss +3 -3
- package/src/scss/switch.scss +121 -0
- package/src/scss/tabs.scss +26 -26
- package/src/scss/toast.scss +170 -0
- package/src/scss/tooltip.scss +126 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/js/toast.js"],
|
|
4
|
+
"sourcesContent": ["(function () {\n const ICON_SVG = {\n info: '<svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>',\n success: '<svg viewBox=\"0 0 24 24\"><path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\"/><polyline points=\"22 4 12 14.01 9 11.01\"/></svg>',\n warning: '<svg viewBox=\"0 0 24 24\"><path d=\"m10.29 3.86-8.61 14.88A2 2 0 0 0 3.4 22h17.2a2 2 0 0 0 1.72-3l-8.6-15a2 2 0 0 0-3.43 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>',\n error: '<svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"/><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"/></svg>',\n neutral: '<svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>',\n };\n\n function getOrCreateContainer(position) {\n const cls = `pp-toast-container--${position}`;\n let container = document.querySelector(`.pp-toast-container.${cls}`);\n if (!container) {\n container = document.createElement('div');\n container.className = `pp-toast-container ${cls}`;\n container.setAttribute('aria-live', 'polite');\n container.setAttribute('aria-atomic', 'false');\n document.body.appendChild(container);\n }\n return container;\n }\n\n function dismiss(toastEl) {\n if (toastEl._dismissed) return;\n toastEl._dismissed = true;\n toastEl.classList.add('is-dismissing');\n toastEl.dispatchEvent(new CustomEvent('pp:toast:dismiss', { bubbles: true }));\n toastEl.addEventListener('animationend', () => toastEl.remove(), { once: true });\n setTimeout(() => toastEl.remove(), 300);\n }\n\n window.ppToast = {\n show({ message = '', title = '', variant = 'neutral', duration = 4000, position = 'top-right' } = {}) {\n const container = getOrCreateContainer(position);\n\n const toast = document.createElement('div');\n toast.className = `pp-toast pp-toast--${variant}`;\n toast.setAttribute('role', 'status');\n\n const icon = ICON_SVG[variant] || ICON_SVG.neutral;\n\n toast.innerHTML = `\n <span class=\"pp-toast__icon\" aria-hidden=\"true\">${icon}</span>\n <div class=\"pp-toast__body\">\n ${title ? `<div class=\"pp-toast__title\">${title}</div>` : ''}\n <div class=\"pp-toast__message\">${message}</div>\n </div>\n <button class=\"pp-toast__dismiss\" aria-label=\"Dismiss\">\n <svg viewBox=\"0 0 24 24\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>\n </button>\n ${duration > 0 ? `<span class=\"pp-toast__progress\" style=\"--pp-toast-duration:${duration}ms\"></span>` : ''}\n `.trim();\n\n toast.querySelector('.pp-toast__dismiss').addEventListener('click', () => dismiss(toast));\n\n container.appendChild(toast);\n\n toast.dispatchEvent(new CustomEvent('pp:toast:show', {\n bubbles: true,\n detail: { message, title, variant, duration },\n }));\n\n if (duration > 0) {\n setTimeout(() => dismiss(toast), duration);\n }\n\n return { dismiss: () => dismiss(toast) };\n },\n };\n\n // Auto-wire any [data-toast-dismiss] buttons in static markup\n document.addEventListener('click', (e) => {\n const btn = e.target.closest('[data-toast-dismiss]');\n if (btn) {\n const toast = btn.closest('.pp-toast');\n if (toast) dismiss(toast);\n }\n });\n})();\n"],
|
|
5
|
+
"mappings": ";AAAA,GAAC,WAAY;AACX,UAAM,WAAW;AAAA,MACf,MAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,OAAS;AAAA,MACT,SAAS;AAAA,IACX;AAEA,aAAS,qBAAqB,UAAU;AACtC,YAAM,MAAM,uBAAuB,QAAQ;AAC3C,UAAI,YAAY,SAAS,cAAc,uBAAuB,GAAG,EAAE;AACnE,UAAI,CAAC,WAAW;AACd,oBAAY,SAAS,cAAc,KAAK;AACxC,kBAAU,YAAY,sBAAsB,GAAG;AAC/C,kBAAU,aAAa,aAAa,QAAQ;AAC5C,kBAAU,aAAa,eAAe,OAAO;AAC7C,iBAAS,KAAK,YAAY,SAAS;AAAA,MACrC;AACA,aAAO;AAAA,IACT;AAEA,aAAS,QAAQ,SAAS;AACxB,UAAI,QAAQ,WAAY;AACxB,cAAQ,aAAa;AACrB,cAAQ,UAAU,IAAI,eAAe;AACrC,cAAQ,cAAc,IAAI,YAAY,oBAAoB,EAAE,SAAS,KAAK,CAAC,CAAC;AAC5E,cAAQ,iBAAiB,gBAAgB,MAAM,QAAQ,OAAO,GAAG,EAAE,MAAM,KAAK,CAAC;AAC/E,iBAAW,MAAM,QAAQ,OAAO,GAAG,GAAG;AAAA,IACxC;AAEA,WAAO,UAAU;AAAA,MACf,KAAK,EAAE,UAAU,IAAI,QAAQ,IAAI,UAAU,WAAW,WAAW,KAAM,WAAW,YAAY,IAAI,CAAC,GAAG;AACpG,cAAM,YAAY,qBAAqB,QAAQ;AAE/C,cAAM,QAAQ,SAAS,cAAc,KAAK;AAC1C,cAAM,YAAY,sBAAsB,OAAO;AAC/C,cAAM,aAAa,QAAQ,QAAQ;AAEnC,cAAM,OAAO,SAAS,OAAO,KAAK,SAAS;AAE3C,cAAM,YAAY;AAAA,0DACkC,IAAI;AAAA;AAAA,YAElD,QAAQ,gCAAgC,KAAK,WAAW,EAAE;AAAA,2CAC3B,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,UAKxC,WAAW,IAAI,+DAA+D,QAAQ,gBAAgB,EAAE;AAAA,QAC1G,KAAK;AAEP,cAAM,cAAc,oBAAoB,EAAE,iBAAiB,SAAS,MAAM,QAAQ,KAAK,CAAC;AAExF,kBAAU,YAAY,KAAK;AAE3B,cAAM,cAAc,IAAI,YAAY,iBAAiB;AAAA,UACnD,SAAS;AAAA,UACT,QAAQ,EAAE,SAAS,OAAO,SAAS,SAAS;AAAA,QAC9C,CAAC,CAAC;AAEF,YAAI,WAAW,GAAG;AAChB,qBAAW,MAAM,QAAQ,KAAK,GAAG,QAAQ;AAAA,QAC3C;AAEA,eAAO,EAAE,SAAS,MAAM,QAAQ,KAAK,EAAE;AAAA,MACzC;AAAA,IACF;AAGA,aAAS,iBAAiB,SAAS,CAAC,MAAM;AACxC,YAAM,MAAM,EAAE,OAAO,QAAQ,sBAAsB;AACnD,UAAI,KAAK;AACP,cAAM,QAAQ,IAAI,QAAQ,WAAW;AACrC,YAAI,MAAO,SAAQ,KAAK;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
<ul class="pp-header__dropdown" role="menu" aria-label="Components">
|
|
35
35
|
<li role="none"><a href="#accordion" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Accordion</a></li>
|
|
36
36
|
<li role="none"><a href="#alert" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Alert</a></li>
|
|
37
|
+
<li role="none"><a href="#badges" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Badge</a></li>
|
|
37
38
|
<li role="none"><a href="#buttons" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Buttons</a></li>
|
|
38
39
|
<li role="none"><a href="#cards" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Cards</a></li>
|
|
39
40
|
<li role="none"><a href="#carousel" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Carousel</a></li>
|
|
@@ -41,8 +42,11 @@
|
|
|
41
42
|
<li role="none"><a href="#gradient" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Gradient</a></li>
|
|
42
43
|
<li role="none"><a href="#modals" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Modals</a></li>
|
|
43
44
|
<li role="none"><a href="#selects" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Selects</a></li>
|
|
45
|
+
<li role="none"><a href="#switches" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Switch</a></li>
|
|
44
46
|
<li role="none"><a href="#tabs" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Tabs</a></li>
|
|
45
47
|
<li role="none"><a href="#tables" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Tables</a></li>
|
|
48
|
+
<li role="none"><a href="#toasts" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Toast</a></li>
|
|
49
|
+
<li role="none"><a href="#tooltips" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Tooltip</a></li>
|
|
46
50
|
</ul>
|
|
47
51
|
</li>
|
|
48
52
|
<li class="pp-header__nav-item" role="none">
|
|
@@ -101,8 +105,8 @@
|
|
|
101
105
|
<h1 class="font-sans font-700 tracking-tight">PeppertinoCSS</h1>
|
|
102
106
|
<p class="font-sans font-400 text-lg leading-relaxed">A modern, opinionated SCSS framework. Fast to build with, easy to extend.</p>
|
|
103
107
|
<div class="row">
|
|
104
|
-
<button class="button font-sans font-400" style="background:#fff;color:#ea5753;">Get Started</button>
|
|
105
|
-
<button class="button
|
|
108
|
+
<button class="pp-button font-sans font-400" style="background:#fff;color:#ea5753;">Get Started</button>
|
|
109
|
+
<button class="pp-button--outline font-sans font-400" style="border-color:#fff;color:#fff;">View Source</button>
|
|
106
110
|
</div>
|
|
107
111
|
</div>
|
|
108
112
|
</section>
|
|
@@ -529,6 +533,59 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
529
533
|
</div>
|
|
530
534
|
</section>
|
|
531
535
|
|
|
536
|
+
<!-- Badge -->
|
|
537
|
+
<section id="badges" class="pp-section">
|
|
538
|
+
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:720px;">
|
|
539
|
+
<h2 class="font-sans font-700 tracking-tight">Badge</h2>
|
|
540
|
+
<p class="font-sans font-400 text-sm" style="color:#71717a;">Pill-shaped status indicators. CSS-only — no JS required.</p>
|
|
541
|
+
|
|
542
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Tint variants (default)</p>
|
|
543
|
+
<div style="display:flex;flex-wrap:wrap;gap:0.5rem;margin-top:0.5rem;align-items:center;">
|
|
544
|
+
<span class="pp-badge pp-badge--primary font-sans">Primary</span>
|
|
545
|
+
<span class="pp-badge pp-badge--success font-sans">Success</span>
|
|
546
|
+
<span class="pp-badge pp-badge--warning font-sans">Warning</span>
|
|
547
|
+
<span class="pp-badge pp-badge--error font-sans">Error</span>
|
|
548
|
+
<span class="pp-badge pp-badge--info font-sans">Info</span>
|
|
549
|
+
</div>
|
|
550
|
+
|
|
551
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Filled</p>
|
|
552
|
+
<div style="display:flex;flex-wrap:wrap;gap:0.5rem;margin-top:0.5rem;align-items:center;">
|
|
553
|
+
<span class="pp-badge pp-badge--primary pp-badge--filled font-sans">Primary</span>
|
|
554
|
+
<span class="pp-badge pp-badge--success pp-badge--filled font-sans">Success</span>
|
|
555
|
+
<span class="pp-badge pp-badge--warning pp-badge--filled font-sans">Warning</span>
|
|
556
|
+
<span class="pp-badge pp-badge--error pp-badge--filled font-sans">Error</span>
|
|
557
|
+
<span class="pp-badge pp-badge--info pp-badge--filled font-sans">Info</span>
|
|
558
|
+
</div>
|
|
559
|
+
|
|
560
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Sizes</p>
|
|
561
|
+
<div style="display:flex;flex-wrap:wrap;gap:0.5rem;margin-top:0.5rem;align-items:center;">
|
|
562
|
+
<span class="pp-badge pp-badge--info pp-badge--sm font-sans">Small</span>
|
|
563
|
+
<span class="pp-badge pp-badge--info font-sans">Default</span>
|
|
564
|
+
<span class="pp-badge pp-badge--info pp-badge--lg font-sans">Large</span>
|
|
565
|
+
</div>
|
|
566
|
+
|
|
567
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Dot indicator</p>
|
|
568
|
+
<div style="display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.5rem;align-items:center;">
|
|
569
|
+
<span class="pp-badge pp-badge--error pp-badge--dot" aria-label="3 unread notifications"></span>
|
|
570
|
+
<span class="pp-badge pp-badge--success pp-badge--dot" aria-label="Online"></span>
|
|
571
|
+
<span class="pp-badge pp-badge--warning pp-badge--dot" aria-label="Away"></span>
|
|
572
|
+
</div>
|
|
573
|
+
|
|
574
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">In context</p>
|
|
575
|
+
<div style="display:flex;flex-wrap:wrap;gap:1rem;margin-top:0.5rem;align-items:center;">
|
|
576
|
+
<span class="font-sans font-500" style="color:var(--pp-on-surface);">
|
|
577
|
+
Messages <span class="pp-badge pp-badge--error pp-badge--filled">3</span>
|
|
578
|
+
</span>
|
|
579
|
+
<span class="font-sans font-500" style="color:var(--pp-on-surface);">
|
|
580
|
+
Status <span class="pp-badge pp-badge--success">Active</span>
|
|
581
|
+
</span>
|
|
582
|
+
<span class="font-sans font-500" style="color:var(--pp-on-surface);">
|
|
583
|
+
Plan <span class="pp-badge pp-badge--primary pp-badge--filled">Beta</span>
|
|
584
|
+
</span>
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|
|
587
|
+
</section>
|
|
588
|
+
|
|
532
589
|
<!-- Buttons -->
|
|
533
590
|
<section id="buttons" class="pp-section">
|
|
534
591
|
<div class="pp-section__inner" style="align-items:flex-start;">
|
|
@@ -536,41 +593,41 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
536
593
|
|
|
537
594
|
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;">Filled</p>
|
|
538
595
|
<div class="row" style="justify-content:flex-start;">
|
|
539
|
-
<button class="button font-sans">Primary</button>
|
|
540
|
-
<button class="button
|
|
541
|
-
<button class="button
|
|
542
|
-
<button class="button
|
|
543
|
-
<button class="button
|
|
544
|
-
<button class="button
|
|
545
|
-
<button class="button
|
|
596
|
+
<button class="pp-button font-sans">Primary</button>
|
|
597
|
+
<button class="pp-button--success font-sans">Success</button>
|
|
598
|
+
<button class="pp-button--warning font-sans">Warning</button>
|
|
599
|
+
<button class="pp-button--error font-sans">Error</button>
|
|
600
|
+
<button class="pp-button--dark font-sans">Dark</button>
|
|
601
|
+
<button class="pp-button--gradient font-sans">Gradient</button>
|
|
602
|
+
<button class="pp-button--ghost font-sans">Ghost</button>
|
|
546
603
|
</div>
|
|
547
604
|
|
|
548
605
|
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Outline</p>
|
|
549
606
|
<div class="row" style="justify-content:flex-start;">
|
|
550
|
-
<button class="button
|
|
551
|
-
<button class="button
|
|
552
|
-
<button class="button
|
|
553
|
-
<button class="button
|
|
554
|
-
<button class="button
|
|
607
|
+
<button class="pp-button--outline font-sans">Primary</button>
|
|
608
|
+
<button class="pp-button--outline pp-button--success font-sans">Success</button>
|
|
609
|
+
<button class="pp-button--outline pp-button--warning font-sans">Warning</button>
|
|
610
|
+
<button class="pp-button--outline pp-button--error font-sans">Error</button>
|
|
611
|
+
<button class="pp-button--outline pp-button--dark font-sans">Dark</button>
|
|
555
612
|
</div>
|
|
556
613
|
|
|
557
614
|
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:2rem;">Dark mode preview</p>
|
|
558
615
|
<div class="dark" style="margin-top:0.5rem;background:#18181b;border-radius:16px;padding:1.25rem 1.5rem;display:flex;flex-direction:column;gap:1rem;align-items:flex-start;">
|
|
559
616
|
<div class="row" style="justify-content:flex-start;">
|
|
560
|
-
<button class="button font-sans">Primary</button>
|
|
561
|
-
<button class="button
|
|
562
|
-
<button class="button
|
|
563
|
-
<button class="button
|
|
564
|
-
<button class="button
|
|
565
|
-
<button class="button
|
|
566
|
-
<button class="button
|
|
617
|
+
<button class="pp-button font-sans">Primary</button>
|
|
618
|
+
<button class="pp-button--success font-sans">Success</button>
|
|
619
|
+
<button class="pp-button--warning font-sans">Warning</button>
|
|
620
|
+
<button class="pp-button--error font-sans">Error</button>
|
|
621
|
+
<button class="pp-button--dark font-sans">Dark</button>
|
|
622
|
+
<button class="pp-button--gradient font-sans">Gradient</button>
|
|
623
|
+
<button class="pp-button--ghost font-sans">Ghost</button>
|
|
567
624
|
</div>
|
|
568
625
|
<div class="row" style="justify-content:flex-start;">
|
|
569
|
-
<button class="button
|
|
570
|
-
<button class="button
|
|
571
|
-
<button class="button
|
|
572
|
-
<button class="button
|
|
573
|
-
<button class="button
|
|
626
|
+
<button class="pp-button--outline font-sans">Primary</button>
|
|
627
|
+
<button class="pp-button--outline pp-button--success font-sans">Success</button>
|
|
628
|
+
<button class="pp-button--outline pp-button--warning font-sans">Warning</button>
|
|
629
|
+
<button class="pp-button--outline pp-button--error font-sans">Error</button>
|
|
630
|
+
<button class="pp-button--outline pp-button--dark font-sans">Dark</button>
|
|
574
631
|
</div>
|
|
575
632
|
</div>
|
|
576
633
|
</div>
|
|
@@ -587,7 +644,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
587
644
|
<p class="pp-card__title">Clean by default</p>
|
|
588
645
|
<p class="pp-card__body">White background, subtle shadow, 16px radius. The base card — works for anything.</p>
|
|
589
646
|
<div class="pp-card__footer">
|
|
590
|
-
<button class="button font-sans font-400">Learn more</button>
|
|
647
|
+
<button class="pp-button font-sans font-400">Learn more</button>
|
|
591
648
|
</div>
|
|
592
649
|
</div>
|
|
593
650
|
<div class="pp-card pp-card--dark">
|
|
@@ -595,7 +652,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
595
652
|
<p class="pp-card__title">Midnight surface</p>
|
|
596
653
|
<p class="pp-card__body">Deep neutral background with a primary-light eyebrow. Pairs well with dark sections.</p>
|
|
597
654
|
<div class="pp-card__footer">
|
|
598
|
-
<button class="button font-sans font-400">Learn more</button>
|
|
655
|
+
<button class="pp-button font-sans font-400">Learn more</button>
|
|
599
656
|
</div>
|
|
600
657
|
</div>
|
|
601
658
|
<div class="pp-card pp-card--gradient">
|
|
@@ -603,7 +660,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
603
660
|
<p class="pp-card__title">A little spice</p>
|
|
604
661
|
<p class="pp-card__body">The signature PeppertinoCSS gradient — warm gold to red. Use sparingly for emphasis.</p>
|
|
605
662
|
<div class="pp-card__footer">
|
|
606
|
-
<button class="button font-sans font-400" style="background:#fff;color:#ea5753;">Learn more</button>
|
|
663
|
+
<button class="pp-button font-sans font-400" style="background:#fff;color:#ea5753;">Learn more</button>
|
|
607
664
|
</div>
|
|
608
665
|
</div>
|
|
609
666
|
</div>
|
|
@@ -614,7 +671,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
614
671
|
<p class="pp-card__title">Solid red card</p>
|
|
615
672
|
<p class="pp-card__body">Full primary background. Strong call-to-action surface — use for featured content.</p>
|
|
616
673
|
<div class="pp-card__footer">
|
|
617
|
-
<button class="button
|
|
674
|
+
<button class="pp-button--outline font-sans font-400" style="border-color:rgba(255,255,255,0.5);color:#fff;">Explore</button>
|
|
618
675
|
</div>
|
|
619
676
|
</div>
|
|
620
677
|
<div class="pp-card pp-card--ghost">
|
|
@@ -622,7 +679,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
622
679
|
<p class="pp-card__title">Transparent surface</p>
|
|
623
680
|
<p class="pp-card__body">No background, border only. Fills white and gains a shadow on hover. Great for secondary content.</p>
|
|
624
681
|
<div class="pp-card__footer">
|
|
625
|
-
<button class="button
|
|
682
|
+
<button class="pp-button--outline font-sans font-400">Explore</button>
|
|
626
683
|
</div>
|
|
627
684
|
</div>
|
|
628
685
|
</div>
|
|
@@ -634,19 +691,19 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
634
691
|
<p class="pp-card__eyebrow">Framework</p>
|
|
635
692
|
<p class="pp-card__title">Clean by default</p>
|
|
636
693
|
<p class="pp-card__body">Dark mode flips the surface — same classes, zero extra markup.</p>
|
|
637
|
-
<div class="pp-card__footer"><button class="button font-sans font-400">Learn more</button></div>
|
|
694
|
+
<div class="pp-card__footer"><button class="pp-button font-sans font-400">Learn more</button></div>
|
|
638
695
|
</div>
|
|
639
696
|
<div class="pp-card pp-card--dark">
|
|
640
697
|
<p class="pp-card__eyebrow">Dark variant</p>
|
|
641
698
|
<p class="pp-card__title">Midnight surface</p>
|
|
642
699
|
<p class="pp-card__body">Explicit dark variant stays dark regardless of the global toggle.</p>
|
|
643
|
-
<div class="pp-card__footer"><button class="button font-sans font-400">Learn more</button></div>
|
|
700
|
+
<div class="pp-card__footer"><button class="pp-button font-sans font-400">Learn more</button></div>
|
|
644
701
|
</div>
|
|
645
702
|
<div class="pp-card pp-card--ghost">
|
|
646
703
|
<p class="pp-card__eyebrow">Ghost variant</p>
|
|
647
704
|
<p class="pp-card__title">Border only</p>
|
|
648
705
|
<p class="pp-card__body">Ghost card adapts its hover fill to the dark surface token.</p>
|
|
649
|
-
<div class="pp-card__footer"><button class="button
|
|
706
|
+
<div class="pp-card__footer"><button class="pp-button--outline font-sans font-400">Explore</button></div>
|
|
650
707
|
</div>
|
|
651
708
|
</div>
|
|
652
709
|
</div>
|
|
@@ -796,8 +853,8 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
796
853
|
<section id="gradient" class="pp-section pp-section--dark">
|
|
797
854
|
<div class="pp-section__inner">
|
|
798
855
|
<h2 class="font-sans font-700 tracking-tight" style="color:#fff;">Gradient Text</h2>
|
|
799
|
-
<h1 class="gradient-
|
|
800
|
-
<p class="gradient-
|
|
856
|
+
<h1 class="pp-gradient-text font-sans font-700 tracking-tight">PeppertinoCSS</h1>
|
|
857
|
+
<p class="pp-gradient-text font-sans font-400 text-xl leading-relaxed">The quick brown fox jumps over the lazy dog.</p>
|
|
801
858
|
</div>
|
|
802
859
|
</section>
|
|
803
860
|
|
|
@@ -807,9 +864,9 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
807
864
|
<h2 class="font-sans font-700 tracking-tight" style="color:#fff;">Modals</h2>
|
|
808
865
|
<p class="font-sans font-400 text-sm" style="color:rgba(255,255,255,0.6);">Glassmorphic backdrop blur with frosted container.</p>
|
|
809
866
|
<div class="row">
|
|
810
|
-
<button class="button font-sans" data-modal-open="modal-basic">Basic</button>
|
|
811
|
-
<button class="button font-sans" data-modal-open="modal-destructive">Destructive</button>
|
|
812
|
-
<button class="button
|
|
867
|
+
<button class="pp-button font-sans" data-modal-open="modal-basic">Basic</button>
|
|
868
|
+
<button class="pp-button font-sans" data-modal-open="modal-destructive">Destructive</button>
|
|
869
|
+
<button class="pp-button--outline font-sans" style="border-color:rgba(255,255,255,0.4);color:#fff;" data-modal-open="modal-confirm">Confirm</button>
|
|
813
870
|
</div>
|
|
814
871
|
</div>
|
|
815
872
|
</section>
|
|
@@ -985,6 +1042,58 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
985
1042
|
</div>
|
|
986
1043
|
</section>
|
|
987
1044
|
|
|
1045
|
+
<!-- Switch -->
|
|
1046
|
+
<section id="switches" class="pp-section">
|
|
1047
|
+
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:720px;">
|
|
1048
|
+
<h2 class="font-sans font-700 tracking-tight">Switch</h2>
|
|
1049
|
+
<p class="font-sans font-400 text-sm" style="color:#71717a;">iOS-style toggle. JS wires <code class="font-mono">aria-checked</code> and Space key. CSS provides the full visual baseline.</p>
|
|
1050
|
+
|
|
1051
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Default</p>
|
|
1052
|
+
<div style="display:flex;flex-wrap:wrap;gap:1.5rem;margin-top:0.75rem;align-items:center;">
|
|
1053
|
+
<div style="display:flex;flex-direction:column;align-items:center;gap:0.5rem;">
|
|
1054
|
+
<button class="pp-switch" role="switch" aria-checked="false" aria-label="Notifications off"></button>
|
|
1055
|
+
<span class="font-sans text-xs" style="color:#71717a;">Off</span>
|
|
1056
|
+
</div>
|
|
1057
|
+
<div style="display:flex;flex-direction:column;align-items:center;gap:0.5rem;">
|
|
1058
|
+
<button class="pp-switch" role="switch" aria-checked="true" aria-label="Notifications on"></button>
|
|
1059
|
+
<span class="font-sans text-xs" style="color:#71717a;">On</span>
|
|
1060
|
+
</div>
|
|
1061
|
+
</div>
|
|
1062
|
+
|
|
1063
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Sizes</p>
|
|
1064
|
+
<div style="display:flex;flex-wrap:wrap;gap:2rem;margin-top:0.75rem;align-items:center;">
|
|
1065
|
+
<div style="display:flex;flex-direction:column;align-items:center;gap:0.5rem;">
|
|
1066
|
+
<button class="pp-switch pp-switch--sm" role="switch" aria-checked="true" aria-label="Compact mode"></button>
|
|
1067
|
+
<span class="font-sans text-xs" style="color:#71717a;">Small</span>
|
|
1068
|
+
</div>
|
|
1069
|
+
<div style="display:flex;flex-direction:column;align-items:center;gap:0.5rem;">
|
|
1070
|
+
<button class="pp-switch" role="switch" aria-checked="true" aria-label="Default size"></button>
|
|
1071
|
+
<span class="font-sans text-xs" style="color:#71717a;">Default</span>
|
|
1072
|
+
</div>
|
|
1073
|
+
<div style="display:flex;flex-direction:column;align-items:center;gap:0.5rem;">
|
|
1074
|
+
<button class="pp-switch pp-switch--lg" role="switch" aria-checked="true" aria-label="Large mode"></button>
|
|
1075
|
+
<span class="font-sans text-xs" style="color:#71717a;">Large</span>
|
|
1076
|
+
</div>
|
|
1077
|
+
</div>
|
|
1078
|
+
|
|
1079
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">In a settings row</p>
|
|
1080
|
+
<div style="display:flex;flex-direction:column;gap:0;margin-top:0.5rem;border:1px solid var(--pp-neutral-200);border-radius:12px;overflow:hidden;">
|
|
1081
|
+
<label style="display:flex;justify-content:space-between;align-items:center;padding:0.875rem 1rem;border-bottom:1px solid var(--pp-neutral-200);">
|
|
1082
|
+
<span class="font-sans font-500 text-sm" style="color:var(--pp-on-surface);">Push notifications</span>
|
|
1083
|
+
<button class="pp-switch" role="switch" aria-checked="true" aria-label="Push notifications"></button>
|
|
1084
|
+
</label>
|
|
1085
|
+
<label style="display:flex;justify-content:space-between;align-items:center;padding:0.875rem 1rem;border-bottom:1px solid var(--pp-neutral-200);">
|
|
1086
|
+
<span class="font-sans font-500 text-sm" style="color:var(--pp-on-surface);">Email digest</span>
|
|
1087
|
+
<button class="pp-switch" role="switch" aria-checked="false" aria-label="Email digest"></button>
|
|
1088
|
+
</label>
|
|
1089
|
+
<label style="display:flex;justify-content:space-between;align-items:center;padding:0.875rem 1rem;">
|
|
1090
|
+
<span class="font-sans font-500 text-sm" style="color:var(--pp-on-surface);">Dark mode</span>
|
|
1091
|
+
<button class="pp-switch" role="switch" aria-checked="false" aria-label="Dark mode" data-theme-toggle></button>
|
|
1092
|
+
</label>
|
|
1093
|
+
</div>
|
|
1094
|
+
</div>
|
|
1095
|
+
</section>
|
|
1096
|
+
|
|
988
1097
|
<!-- Tables -->
|
|
989
1098
|
<section id="tables" class="pp-section">
|
|
990
1099
|
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:1100px;">
|
|
@@ -1034,6 +1143,93 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
1034
1143
|
</div>
|
|
1035
1144
|
</section>
|
|
1036
1145
|
|
|
1146
|
+
<!-- Toast -->
|
|
1147
|
+
<section id="toasts" class="pp-section pp-section--muted">
|
|
1148
|
+
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:720px;">
|
|
1149
|
+
<h2 class="font-sans font-700 tracking-tight">Toast</h2>
|
|
1150
|
+
<p class="font-sans font-400 text-sm" style="color:#71717a;">Auto-dismissing notification toasts. <code class="font-mono">ppToast.show()</code> creates and injects them on demand.</p>
|
|
1151
|
+
|
|
1152
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Trigger examples</p>
|
|
1153
|
+
<div style="display:flex;flex-wrap:wrap;gap:0.75rem;margin-top:0.75rem;">
|
|
1154
|
+
<button class="pp-button font-sans" onclick="ppToast.show({ message: 'Changes saved successfully.', variant: 'success' })">
|
|
1155
|
+
Success toast
|
|
1156
|
+
</button>
|
|
1157
|
+
<button class="pp-button--outline pp-button--error font-sans" onclick="ppToast.show({ message: 'Network error — please retry.', title: 'Connection failed', variant: 'error', duration: 6000 })">
|
|
1158
|
+
Error toast
|
|
1159
|
+
</button>
|
|
1160
|
+
<button class="pp-button--outline font-sans" onclick="ppToast.show({ message: 'Review required before publishing.', variant: 'warning' })">
|
|
1161
|
+
Warning toast
|
|
1162
|
+
</button>
|
|
1163
|
+
<button class="pp-button--outline font-sans" onclick="ppToast.show({ message: 'v0.5.0 is now available.', title: 'Update', variant: 'info', position: 'bottom-center' })">
|
|
1164
|
+
Info (bottom)
|
|
1165
|
+
</button>
|
|
1166
|
+
<button class="pp-button--ghost font-sans" onclick="ppToast.show({ message: 'Action completed.', variant: 'neutral' })">
|
|
1167
|
+
Neutral toast
|
|
1168
|
+
</button>
|
|
1169
|
+
</div>
|
|
1170
|
+
|
|
1171
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Positions</p>
|
|
1172
|
+
<div style="display:flex;flex-wrap:wrap;gap:0.5rem;margin-top:0.5rem;">
|
|
1173
|
+
<code class="font-mono text-xs" style="background:var(--pp-neutral-100);color:var(--pp-on-surface);padding:0.25rem 0.5rem;border-radius:6px;">top-right</code>
|
|
1174
|
+
<code class="font-mono text-xs" style="background:var(--pp-neutral-100);color:var(--pp-on-surface);padding:0.25rem 0.5rem;border-radius:6px;">top-left</code>
|
|
1175
|
+
<code class="font-mono text-xs" style="background:var(--pp-neutral-100);color:var(--pp-on-surface);padding:0.25rem 0.5rem;border-radius:6px;">top-center</code>
|
|
1176
|
+
<code class="font-mono text-xs" style="background:var(--pp-neutral-100);color:var(--pp-on-surface);padding:0.25rem 0.5rem;border-radius:6px;">bottom-right</code>
|
|
1177
|
+
<code class="font-mono text-xs" style="background:var(--pp-neutral-100);color:var(--pp-on-surface);padding:0.25rem 0.5rem;border-radius:6px;">bottom-left</code>
|
|
1178
|
+
<code class="font-mono text-xs" style="background:var(--pp-neutral-100);color:var(--pp-on-surface);padding:0.25rem 0.5rem;border-radius:6px;">bottom-center</code>
|
|
1179
|
+
</div>
|
|
1180
|
+
</div>
|
|
1181
|
+
</section>
|
|
1182
|
+
|
|
1183
|
+
<!-- Tooltip -->
|
|
1184
|
+
<section id="tooltips" class="pp-section">
|
|
1185
|
+
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:720px;">
|
|
1186
|
+
<h2 class="font-sans font-700 tracking-tight">Tooltip</h2>
|
|
1187
|
+
<p class="font-sans font-400 text-sm" style="color:#71717a;">CSS-only. Shows on <code class="font-mono">:hover</code> and <code class="font-mono">:focus-within</code> — no JavaScript required. Four placements.</p>
|
|
1188
|
+
|
|
1189
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Placements</p>
|
|
1190
|
+
<div style="display:flex;flex-wrap:wrap;gap:3rem;margin-top:2.5rem;padding-bottom:2rem;align-items:center;justify-content:flex-start;">
|
|
1191
|
+
<span class="pp-tooltip">
|
|
1192
|
+
<button class="pp-button--outline font-sans">Top (default)</button>
|
|
1193
|
+
<span class="pp-tooltip__content" role="tooltip">Default placement</span>
|
|
1194
|
+
</span>
|
|
1195
|
+
<span class="pp-tooltip">
|
|
1196
|
+
<button class="pp-button--outline font-sans">Bottom</button>
|
|
1197
|
+
<span class="pp-tooltip__content pp-tooltip__content--bottom" role="tooltip">Shown below</span>
|
|
1198
|
+
</span>
|
|
1199
|
+
<span class="pp-tooltip">
|
|
1200
|
+
<button class="pp-button--outline font-sans">Left</button>
|
|
1201
|
+
<span class="pp-tooltip__content pp-tooltip__content--left" role="tooltip">Shown left</span>
|
|
1202
|
+
</span>
|
|
1203
|
+
<span class="pp-tooltip">
|
|
1204
|
+
<button class="pp-button--outline font-sans">Right</button>
|
|
1205
|
+
<span class="pp-tooltip__content pp-tooltip__content--right" role="tooltip">Shown right</span>
|
|
1206
|
+
</span>
|
|
1207
|
+
</div>
|
|
1208
|
+
|
|
1209
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:0.5rem;">On icon buttons</p>
|
|
1210
|
+
<div style="display:flex;gap:1.5rem;margin-top:1.25rem;align-items:center;">
|
|
1211
|
+
<span class="pp-tooltip">
|
|
1212
|
+
<button class="pp-button--ghost font-sans" style="padding:0.5rem;" aria-label="Settings">
|
|
1213
|
+
<i data-lucide="settings" aria-hidden="true"></i>
|
|
1214
|
+
</button>
|
|
1215
|
+
<span class="pp-tooltip__content pp-tooltip__content--bottom" role="tooltip">Settings</span>
|
|
1216
|
+
</span>
|
|
1217
|
+
<span class="pp-tooltip">
|
|
1218
|
+
<button class="pp-button--ghost font-sans" style="padding:0.5rem;" aria-label="Notifications">
|
|
1219
|
+
<i data-lucide="bell" aria-hidden="true"></i>
|
|
1220
|
+
</button>
|
|
1221
|
+
<span class="pp-tooltip__content pp-tooltip__content--bottom" role="tooltip">Notifications</span>
|
|
1222
|
+
</span>
|
|
1223
|
+
<span class="pp-tooltip">
|
|
1224
|
+
<button class="pp-button--ghost font-sans" style="padding:0.5rem;" aria-label="Delete">
|
|
1225
|
+
<i data-lucide="trash-2" aria-hidden="true"></i>
|
|
1226
|
+
</button>
|
|
1227
|
+
<span class="pp-tooltip__content pp-tooltip__content--bottom" role="tooltip" style="background:var(--pp-error);">Delete</span>
|
|
1228
|
+
</span>
|
|
1229
|
+
</div>
|
|
1230
|
+
</div>
|
|
1231
|
+
</section>
|
|
1232
|
+
|
|
1037
1233
|
<!-- Forms -->
|
|
1038
1234
|
<section id="forms" class="pp-section">
|
|
1039
1235
|
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:860px;">
|
|
@@ -1524,7 +1720,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
1524
1720
|
I have checked that the amount I wish to transfer is correct and understand this action cannot be undone.
|
|
1525
1721
|
</span>
|
|
1526
1722
|
</label>
|
|
1527
|
-
<button class="button font-sans pp-submit--gated" type="button">Confirm transfer</button>
|
|
1723
|
+
<button class="pp-button font-sans pp-submit--gated" type="button">Confirm transfer</button>
|
|
1528
1724
|
</div>
|
|
1529
1725
|
|
|
1530
1726
|
<!-- Destructive confirmation -->
|
|
@@ -1536,7 +1732,7 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
1536
1732
|
I understand that deleting my account is permanent and all my data will be removed.
|
|
1537
1733
|
</span>
|
|
1538
1734
|
</label>
|
|
1539
|
-
<button class="button
|
|
1735
|
+
<button class="pp-button--error font-sans pp-submit--gated" type="button">Delete account</button>
|
|
1540
1736
|
</div>
|
|
1541
1737
|
|
|
1542
1738
|
<!-- ppValidation API demo -->
|
|
@@ -1549,15 +1745,15 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
1549
1745
|
<span class="pp-field__hint" id="api-field-hint">3–20 characters, letters and underscores only.</span>
|
|
1550
1746
|
</div>
|
|
1551
1747
|
<div class="row" style="justify-content:flex-start;">
|
|
1552
|
-
<button class="button
|
|
1748
|
+
<button class="pp-button--error font-sans font-400" type="button"
|
|
1553
1749
|
onclick="ppValidation.setError(document.getElementById('api-field'), 'Username already taken.')">
|
|
1554
1750
|
Set error
|
|
1555
1751
|
</button>
|
|
1556
|
-
<button class="button
|
|
1752
|
+
<button class="pp-button--success font-sans font-400" type="button"
|
|
1557
1753
|
onclick="ppValidation.setSuccess(document.getElementById('api-field'), 'Username is available.')">
|
|
1558
1754
|
Set success
|
|
1559
1755
|
</button>
|
|
1560
|
-
<button class="button
|
|
1756
|
+
<button class="pp-button--ghost font-sans font-400" type="button"
|
|
1561
1757
|
onclick="ppValidation.clearError(document.getElementById('api-field'))">
|
|
1562
1758
|
Clear
|
|
1563
1759
|
</button>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auriel/peppertino",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "An Apple-inspired CSS framework with a spicy red accent. Clean geometry, restrained elegance, zero Cupertino lawsuits.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build:css": "sass src/scss/main.scss dist/main.css --style=expanded --source-map",
|
|
12
12
|
"build:css:min": "sass src/scss/main.scss dist/main.min.css --style=compressed --no-source-map",
|
|
13
|
-
"build:js": "
|
|
14
|
-
"
|
|
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",
|
|
15
17
|
"watch:css": "sass --watch src/scss/main.scss:dist/main.css --style=expanded --source-map",
|
|
16
|
-
"watch:js": "
|
|
18
|
+
"watch:js": "bun build.js --watch",
|
|
17
19
|
"serve": "bunx --bun serve . --port 3000",
|
|
18
20
|
"dev": "bun run build && concurrently \"bun run watch:css\" \"bun run watch:js\" \"bun run serve\""
|
|
19
21
|
},
|
|
@@ -0,0 +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('}');
|
|
@@ -0,0 +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
|
+
}
|