@auriel/peppertino 0.2.0 → 0.3.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 CHANGED
@@ -1,6 +1,78 @@
1
1
  PeppertinoCSS — Changelog
2
2
  =========================
3
3
 
4
+ v0.3.0 — 2026-06-05
5
+ --------------------
6
+
7
+ New components
8
+
9
+ Carousel (carousel.scss + carousel.js)
10
+ - CSS scroll-snap driven, no JS required for motion
11
+ - Variants: default, --peek-2, --peek-3, --dark, --flush
12
+ - Prev/next controls, animated pill dots, gradient caption overlay
13
+ - Autoplay toggle button (UI state only)
14
+ - JS shim: ARIA region/slide/group roles, IntersectionObserver sync,
15
+ roving tabindex on dots, polite live region announcements
16
+ - ppCarousel.get(id) public API
17
+
18
+ Footer (footer.scss)
19
+ - CSS only, no JS
20
+ - Brand column + up to 4 nav columns, collapses to 2-col then 1-col
21
+ - Bottom bar: copyright + social icon links
22
+ - Variants: --dark, --accent (gradient top border)
23
+ - All links have :focus-visible outlines
24
+
25
+ Forms (forms.scss + src/scss/forms/)
26
+ - Fieldset & Legend (fieldset.scss)
27
+ - Variants: default, --ghost, --filled, --primary, --error
28
+ - disabled / aria-disabled support
29
+ - Legend modifiers: --sm, --lg, --inline (icon + text)
30
+ - Form Instructions (form-instructions.scss)
31
+ - Pre-form block (place before <form> for screen reader Forms Mode)
32
+ - Variants: default, --neutral, --warning, --error (role="alert")
33
+ - In-form hint (.pp-form-hint) and required-field note
34
+ - Label (label.scss)
35
+ - Four importance tiers: primary, secondary, tertiary, quaternary
36
+ - Apple Dynamic Type scale: headline, subheadline, body, callout,
37
+ footnote, caption
38
+ - --selectable, --truncate modifiers
39
+ - .pp-label-row for icon + label pairing
40
+ - Text Field (text-field.scss)
41
+ - .pp-field wrapper: label, input/textarea, hint, message
42
+ - Required <abbr aria-label="required"> marker
43
+ - Optional badge
44
+ - Validation states: --error, --success, --warning
45
+ - Sizes: --sm, --lg
46
+ - Icon wrap (.pp-field__input-wrap + .pp-field__icon)
47
+ - Character counter (.pp-field__count) with --warn / --over states
48
+ - Validation (validation.scss + validation.js)
49
+ - .pp-field--validate opt-in for :valid/:invalid pseudo-class styling
50
+ - aria-invalid attribute selectors (work without JS)
51
+ - .pp-field--validating spinner state for async checks
52
+ - .pp-validation-summary with role="alert", linked error items
53
+ - .pp-confirm confirmation checkbox, --destructive variant
54
+ - .pp-submit--gated: CSS :has() disables submit until confirmed
55
+ - JS shim: setError, clearError, setSuccess, setValidating, setSummary
56
+ - Auto-wires aria-describedby on init
57
+
58
+ Breakpoints
59
+ - Tailwind-compatible map: sm/md/lg/xl/2xl
60
+ - Apple device map: iphone-se through imac (12 named breakpoints)
61
+ - respond-to() mixin (min-width)
62
+ - respond-below() and respond-between() mixins
63
+
64
+ Icons
65
+ - Switched from Feather Icons to Lucide Icons (CDN + createIcons())
66
+ - Brand/logo icons in footer use inline SVG (Lucide has no brand icons)
67
+
68
+ Demo (index.html)
69
+ - Installation section with npm, CDN, SCSS import, clone instructions
70
+ - Carousel, Footer, and Forms sections added
71
+ - Nav dropdowns for Components and Forms
72
+ - Changelog section
73
+ - All external links use jsdelivr CDN
74
+
75
+
4
76
  v0.2.0 — 2026-06-01
5
77
  --------------------
6
78
  Accessibility (ARIA) — full pass across all components.
@@ -37,8 +109,8 @@ Tabs
37
109
 
38
110
  CSS
39
111
  - ARIA attribute selectors (aria-expanded, aria-hidden, aria-selected,
40
- aria-disabled) are now first-class CSS hooks in header.scss, modal.scss,
41
- and select.scss — visual state is driven by ARIA, not just class names
112
+ aria-disabled) are now first-class CSS hooks — visual state is driven
113
+ by ARIA, not just class names
42
114
 
43
115
  HTML demo
44
116
  - All modal backdrops updated with role, aria-modal, aria-labelledby,
@@ -48,9 +120,6 @@ HTML demo
48
120
  Page structure
49
121
  - Section order updated: Hero → Colors → Typography → Components (A→Z)
50
122
 
51
- Package
52
- - Version bumped to 2.0.0
53
-
54
123
 
55
124
  v0.1.1 — initial release
56
125
  -------------------------
@@ -60,11 +129,8 @@ v0.1.1 — initial release
60
129
  - Section: full-viewport sections, custom gradient scrollbar
61
130
  - Select: native <select> restyling + .pp-select custom dropdown
62
131
  - Table: Apple-style clean tables
63
- - Tabs: pill-style, icon + label, four variants (normal, outline,
64
- gradient, gradient-outline), sm/lg sizes
132
+ - Tabs: pill-style, icon + label, four variants, sm/lg sizes
65
133
  - Typography: Inter + Kode Mono, weight/size/spacing utility classes
66
- - Progressive enhancement: CSS-only baseline for all interactive
67
- components; JS adds keyboard nav, animations, outside-click close
68
- - Single Google Fonts request for Inter + Kode Mono
134
+ - Progressive enhancement: CSS-only baseline for all interactive components
69
135
  - esbuild bundler: per-component files + peppertino.js aggregator
70
136
  - MIT license
package/README.md CHANGED
@@ -10,7 +10,26 @@ PeppertinoCSS is an Apple-inspired CSS framework built with SCSS, featuring the
10
10
  npm install @auriel/peppertino
11
11
  ```
12
12
 
13
- Or clone and build locally:
13
+ CDN — stylesheet only:
14
+
15
+ ```html
16
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@auriel/peppertino@latest/dist/main.min.css" />
17
+ ```
18
+
19
+ CDN — with JS components:
20
+
21
+ ```html
22
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@auriel/peppertino@latest/dist/main.min.css" />
23
+ <script src="https://cdn.jsdelivr.net/npm/@auriel/peppertino@latest/dist/peppertino.js" defer></script>
24
+ ```
25
+
26
+ SCSS import into your own build:
27
+
28
+ ```scss
29
+ @use '@auriel/peppertino/src/scss/main';
30
+ ```
31
+
32
+ Clone and build locally:
14
33
 
15
34
  ```bash
16
35
  git clone https://codeberg.org/debaditya/Peppertino
@@ -38,6 +57,58 @@ Then open `http://localhost:3000` in your browser.
38
57
 
39
58
  ---
40
59
 
60
+ ## Claude Code skill
61
+
62
+ The `agents/` directory ships a Claude Code skill that gives AI agents per-component reference documentation covering classes, variants, ARIA requirements, and JS APIs.
63
+
64
+ ### Install (project-level)
65
+
66
+ Copy the skill into your project's Claude skills directory:
67
+
68
+ ```bash
69
+ cp -r agents/peppertino .claude/skills/peppertino
70
+ ```
71
+
72
+ Then invoke it in Claude Code:
73
+
74
+ ```
75
+ /peppertino
76
+ ```
77
+
78
+ ### Install (user-level — available in all projects)
79
+
80
+ ```bash
81
+ cp -r agents/peppertino ~/.claude/skills/peppertino
82
+ ```
83
+
84
+ ### What the skill contains
85
+
86
+ | File | Covers |
87
+ |---|---|
88
+ | `skill.md` | Index, ARIA/WCAG requirements, conventions |
89
+ | `base.md` | Design tokens, spacing, breakpoints, mixins |
90
+ | `button.md` | All button variants |
91
+ | `card.md` | Card parts, variants, grid |
92
+ | `carousel.md` | Carousel markup, API, keyboard |
93
+ | `footer.md` | Footer columns, social links |
94
+ | `forms-fieldset.md` | Fieldset & legend |
95
+ | `forms-form-instructions.md` | Pre-form instructions, hints |
96
+ | `forms-label.md` | Label tiers, scale, icon row |
97
+ | `forms-text-field.md` | Field wrapper, input, hint, validation |
98
+ | `forms-validation.md` | Summary, confirmation checkbox, `ppValidation` API |
99
+ | `gradient.md` | Gradient text |
100
+ | `header.md` | Header, nav, dropdown, mobile drawer |
101
+ | `modal.md` | Modal, actions, `ppModal` API |
102
+ | `section.md` | Section variants, scrollbar |
103
+ | `select.md` | Native select, custom dropdown |
104
+ | `table.md` | Table, column helpers |
105
+ | `tabs.md` | Tabs, variants, keyboard nav |
106
+ | `typography.md` | All typography utility classes |
107
+
108
+ The skill's `skill.md` enforces ARIA and WCAG AA compliance rules and instructs the agent to fetch authoritative specs from w3.org when uncertain.
109
+
110
+ ---
111
+
41
112
  ## What's inside
42
113
 
43
114
  ### SCSS modules (`src/scss/`)
@@ -48,6 +119,14 @@ Then open `http://localhost:3000` in your browser.
48
119
  | `base.scss` | Design tokens, helper functions, base element styles |
49
120
  | `button.scss` | `.button`, `.button-outline`, semantic variants |
50
121
  | `card.scss` | `.pp-card` and variants |
122
+ | `carousel.scss` | `.pp-carousel` — CSS scroll-snap carousel |
123
+ | `footer.scss` | `.pp-footer` — multi-column footer |
124
+ | `forms.scss` | Aggregator for all form partials |
125
+ | `forms/fieldset.scss` | `.pp-fieldset` + `.pp-legend` |
126
+ | `forms/form-instructions.scss` | `.pp-form-instructions`, `.pp-form-hint` |
127
+ | `forms/label.scss` | `.pp-label` — Apple HIG four-tier label system |
128
+ | `forms/text-field.scss` | `.pp-field` — labelled input/textarea with validation states |
129
+ | `forms/validation.scss` | `.pp-validation-summary`, `.pp-confirm`, `.pp-field--validate` |
51
130
  | `gradient.scss` | `.gradient-txt` |
52
131
  | `header.scss` | `.pp-header` — glassmorphism sticky header |
53
132
  | `modal.scss` | `.pp-modal-backdrop` + `.pp-modal` — glassmorphic modals |
@@ -61,13 +140,15 @@ Then open `http://localhost:3000` in your browser.
61
140
 
62
141
  | File | Purpose |
63
142
  |---|---|
143
+ | `carousel.js` | ARIA wiring, IntersectionObserver sync, `ppCarousel` API |
64
144
  | `header.js` | Mobile drawer, dropdown ARIA wiring for `.pp-header` |
65
145
  | `modal.js` | Open/close, focus trap, focus restore, ARIA for `.pp-modal` |
66
146
  | `select.js` | Keyboard nav, ARIA listbox/option for `.pp-select` |
67
147
  | `tabs.js` | Click + arrow key activation, ARIA tablist for `.pp-tabs` |
148
+ | `validation.js` | `aria-invalid` wiring, summary focus, `ppValidation` API |
68
149
  | `peppertino.js` | Single-file bundle of all the above |
69
150
 
70
- All JS follows progressive enhancement — CSS provides full visual baseline without JS. JS adds keyboard navigation, focus management, and ARIA state.
151
+ All JS follows progressive enhancement — CSS provides the full visual baseline without JS. JS adds keyboard navigation, focus management, and ARIA state.
71
152
 
72
153
  ---
73
154
 
@@ -104,15 +185,17 @@ radius('lg') // → 0.5rem
104
185
  z('modal') // → 200
105
186
  ```
106
187
 
107
- ### Responsive mixin
188
+ ### Responsive mixins
108
189
 
109
190
  ```scss
110
- @include respond-to('md') {
111
- // min-width: 768px
112
- }
191
+ @include respond-to('md') { /* min-width: 768px */ }
192
+ @include respond-below('md') { /* max-width: 767px */ }
193
+ @include respond-between('sm','lg') { /* 640px – 1023px */ }
113
194
  ```
114
195
 
115
- Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 1536px
196
+ Tailwind breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 1536px
197
+
198
+ Apple device breakpoints: `iphone-se` · `iphone` · `iphone-plus` · `iphone-pro-max` · `ipad-mini` · `ipad-air` · `ipad-pro-11` · `ipad-pro-13` · `macbook-air-13` · `macbook-pro-14` · `macbook-pro-16` · `imac`
116
199
 
117
200
  ---
118
201
 
@@ -142,7 +225,6 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
142
225
  ### Button
143
226
 
144
227
  ```html
145
- <!-- Filled -->
146
228
  <button class="button">Primary</button>
147
229
  <button class="button-success">Success</button>
148
230
  <button class="button-warning">Warning</button>
@@ -151,7 +233,6 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
151
233
  <button class="button-gradient">Gradient</button>
152
234
  <button class="button-ghost">Ghost</button>
153
235
 
154
- <!-- Outline -->
155
236
  <button class="button-outline">Primary</button>
156
237
  <button class="button-outline-success">Success</button>
157
238
  <button class="button-outline-warning">Warning</button>
@@ -171,6 +252,143 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
171
252
 
172
253
  Grid helpers: `.pp-card-grid--2` · `.pp-card-grid--3` · `.pp-card-grid--4`
173
254
 
255
+ ### Carousel
256
+
257
+ ```html
258
+ <div class="pp-carousel" id="my-carousel" data-label="Featured">
259
+ <div class="pp-carousel__track">
260
+ <div class="pp-carousel__slide" id="my-carousel-slide-0">...</div>
261
+ <div class="pp-carousel__slide" id="my-carousel-slide-1">...</div>
262
+ </div>
263
+ <button class="pp-carousel__prev" type="button" aria-label="Previous slide">
264
+ <svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="15 18 9 12 15 6"/></svg>
265
+ </button>
266
+ <button class="pp-carousel__next" type="button" aria-label="Next slide">
267
+ <svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="9 6 15 12 9 18"/></svg>
268
+ </button>
269
+ <div class="pp-carousel__dots" aria-label="Slide navigation">
270
+ <button class="pp-carousel__dot" type="button" aria-label="Go to slide 1" aria-controls="my-carousel-slide-0"></button>
271
+ <button class="pp-carousel__dot" type="button" aria-label="Go to slide 2" aria-controls="my-carousel-slide-1"></button>
272
+ </div>
273
+ <div class="pp-carousel__announcer" aria-live="polite" aria-atomic="true"></div>
274
+ </div>
275
+ <script src="dist/carousel.js" defer></script>
276
+ ```
277
+
278
+ Variants: `--peek-2` · `--peek-3` · `--dark` · `--flush`
279
+ API: `ppCarousel.get(id).goTo(n)`
280
+
281
+ ### Footer
282
+
283
+ ```html
284
+ <footer class="pp-footer" role="contentinfo">
285
+ <div class="pp-footer__top">
286
+ <div class="pp-footer__brand">
287
+ <a href="#" class="pp-footer__logo">Brand</a>
288
+ <p class="pp-footer__tagline">Tagline</p>
289
+ </div>
290
+ <div class="pp-footer__col">
291
+ <p class="pp-footer__col-title">Column</p>
292
+ <ul class="pp-footer__nav" aria-label="Column links">
293
+ <li><a href="#" class="pp-footer__nav-link">Link</a></li>
294
+ </ul>
295
+ </div>
296
+ </div>
297
+ <div class="pp-footer__bottom">
298
+ <p class="pp-footer__legal">&copy; 2026 Brand.</p>
299
+ <ul class="pp-footer__social" aria-label="Social links">
300
+ <li><a href="#" class="pp-footer__social-link" aria-label="GitHub"><i data-lucide="github"></i></a></li>
301
+ </ul>
302
+ </div>
303
+ </footer>
304
+ ```
305
+
306
+ Variants: `--dark` · `--accent`
307
+
308
+ ### Forms
309
+
310
+ #### Label
311
+
312
+ ```html
313
+ <span class="pp-label pp-label--primary">Primary</span>
314
+ <span class="pp-label pp-label--secondary pp-label--callout">Secondary callout</span>
315
+ <span class="pp-label pp-label--selectable">Selectable text</span>
316
+ <span class="pp-label-row pp-label"><i data-lucide="wifi" aria-hidden="true"></i> Wi-Fi</span>
317
+ ```
318
+
319
+ Tiers: `--primary` · `--secondary` · `--tertiary` · `--quaternary`
320
+ Scale: `--headline` · `--subheadline` · `--body` · `--callout` · `--footnote` · `--caption`
321
+
322
+ #### Fieldset
323
+
324
+ ```html
325
+ <fieldset class="pp-fieldset">
326
+ <legend>Group name</legend>
327
+ <!-- controls -->
328
+ </fieldset>
329
+ ```
330
+
331
+ Variants: `--ghost` · `--filled` · `--primary` · `--error`
332
+ Legend modifiers: `--sm` · `--lg` · `--inline`
333
+
334
+ #### Form Instructions
335
+
336
+ ```html
337
+ <!-- Place BEFORE <form> -->
338
+ <div class="pp-form-instructions" role="note" aria-label="Form instructions">
339
+ <p class="pp-form-instructions__title">Before you begin</p>
340
+ <ul class="pp-form-instructions__list">
341
+ <li class="pp-form-instructions__item">Fields marked * are required.</li>
342
+ </ul>
343
+ </div>
344
+ ```
345
+
346
+ Variants: `--neutral` · `--warning` · `--error` (use `role="alert"` for errors)
347
+
348
+ #### Text Field
349
+
350
+ ```html
351
+ <div class="pp-field">
352
+ <label class="pp-field__label" for="name">
353
+ Name
354
+ <abbr class="pp-field__required" aria-label="required" title="required"></abbr>
355
+ </label>
356
+ <input class="pp-field__input" type="text" id="name" name="name"
357
+ required aria-required="true" aria-describedby="name-hint" />
358
+ <span class="pp-field__hint" id="name-hint">Your full legal name.</span>
359
+ </div>
360
+ ```
361
+
362
+ States: `--error` · `--success` · `--warning` · `--validating`
363
+ Sizes: `--sm` · `--lg`
364
+
365
+ #### Validation
366
+
367
+ ```html
368
+ <!-- Summary (place before or at top of form) -->
369
+ <div class="pp-validation-summary" role="alert" aria-label="Form errors">
370
+ <p class="pp-validation-summary__title">Errors prevented submission</p>
371
+ <ul class="pp-validation-summary__list"></ul>
372
+ </div>
373
+
374
+ <!-- Confirmation checkbox -->
375
+ <label class="pp-confirm">
376
+ <input class="pp-confirm__input" type="checkbox" />
377
+ <span class="pp-confirm__label">I confirm this action.</span>
378
+ </label>
379
+ <button class="button pp-submit--gated" type="submit">Submit</button>
380
+ ```
381
+
382
+ JS API (optional — CSS works without it):
383
+
384
+ ```js
385
+ ppValidation.setError(input, 'Message')
386
+ ppValidation.clearError(input)
387
+ ppValidation.setSuccess(input, 'Message')
388
+ ppValidation.setValidating(input)
389
+ ppValidation.setSummary([{ input, message }], summaryEl)
390
+ ```
391
+
174
392
  ### Gradient text
175
393
 
176
394
  ```html
@@ -202,8 +420,6 @@ Grid helpers: `.pp-card-grid--2` · `.pp-card-grid--3` · `.pp-card-grid--4`
202
420
  <script src="dist/header.js" defer></script>
203
421
  ```
204
422
 
205
- Sticky, glassmorphism background. Dropdowns appear on hover (desktop) or tap (mobile). Hamburger animates to × when open. Full ARIA menubar/menu/menuitem semantics.
206
-
207
423
  ### Modal
208
424
 
209
425
  ```html
@@ -227,19 +443,19 @@ Sticky, glassmorphism background. Dropdowns appear on hover (desktop) or tap (mo
227
443
  <script src="dist/modal.js" defer></script>
228
444
  ```
229
445
 
230
- JS adds focus trap, focus restore on close, and Escape key support. `window.ppModal.open(id)` / `.close(id)` / `.closeAll()` available globally.
446
+ `window.ppModal.open(id)` / `.close(id)` / `.closeAll()`
231
447
 
232
448
  ### Select
233
449
 
234
450
  ```html
235
451
  <div class="pp-select">
236
- <button class="pp-select__trigger" type="button">
452
+ <button class="pp-select__trigger" type="button" aria-label="Choose option">
237
453
  <span class="pp-select__value">Choose…</span>
238
454
  <span class="pp-select__chevron"></span>
239
455
  </button>
240
456
  <ul class="pp-select__panel" role="listbox">
241
- <li><button class="pp-select__option" data-value="a" role="option">Option A</button></li>
242
- <li><button class="pp-select__option" data-value="b" role="option">Option B</button></li>
457
+ <li role="option"><button class="pp-select__option" data-value="a">Option A</button></li>
458
+ <li role="option"><button class="pp-select__option" data-value="b">Option B</button></li>
243
459
  </ul>
244
460
  </div>
245
461
  <script src="dist/select.js" defer></script>
@@ -254,15 +470,14 @@ Sizes: `.pp-select--sm` · `.pp-select--lg`
254
470
  <button class="pp-tabs__item is-active" role="tab" aria-selected="true">Tab 1</button>
255
471
  <button class="pp-tabs__item" role="tab" aria-selected="false">Tab 2</button>
256
472
  </div>
257
- <!-- optional panels -->
258
473
  <div data-tab-panel="tab1" role="tabpanel">Panel 1</div>
259
474
  <div data-tab-panel="tab2" role="tabpanel" hidden>Panel 2</div>
260
475
  <script src="dist/tabs.js" defer></script>
261
476
  ```
262
477
 
263
- Variants: default · `.pp-tabs--outline` · `.pp-tabs--gradient` · `.pp-tabs--gradient-outline`
264
- Sizes: `.pp-tabs--sm` · `.pp-tabs--lg`
265
- Keyboard: `←` / `→` arrows, `Home`, `End`.
478
+ Variants: default · `--outline` · `--gradient` · `--gradient-outline`
479
+ Sizes: `--sm` · `--lg`
480
+ Keyboard: `←` / `→` arrows, `Home`, `End`
266
481
 
267
482
  ### Table
268
483
 
@@ -286,35 +501,13 @@ Column helpers: `.pp-table--cols-1` → `.pp-table--cols-4`
286
501
  </section>
287
502
  ```
288
503
 
289
- Variants: `pp-section--primary` · `pp-section--dark` · `pp-section--muted` · `pp-section--gradient`
504
+ Variants: `--primary` · `--dark` · `--muted` · `--gradient`
290
505
 
291
506
  ---
292
507
 
293
508
  ## Changelog
294
509
 
295
- ### v0.2.0 — 2026-06-01
296
-
297
- **Accessibility (ARIA) — full pass across all components**
298
-
299
- - **Header:** `role="menubar"` on nav list, `role="menu"` on dropdowns, `role="menuitem"` on all links and dropdown items, `role="none"` on `<li>` wrappers; `aria-haspopup` + `aria-expanded` on dropdown triggers; `aria-controls` wired to dropdown `id`s; `aria-hidden` toggled on mobile nav drawer; `aria-label` on `<nav>`.
300
- - **Modal:** `role="dialog"` + `aria-modal="true"` on backdrop; `aria-labelledby` + `aria-describedby` auto-wired to title/description elements; `aria-label="Close"` on close button; focus trap (Tab/Shift+Tab stays inside open modal); focus restored to the triggering element on close.
301
- - **Select:** `role="combobox"` on trigger; `role="listbox"` on panel; `role="option"` + `aria-selected` on every option; `aria-controls` + `aria-activedescendant` kept in sync; `aria-disabled` CSS hook for disabled state.
302
- - **Tabs:** `role="tablist"` on container; `role="tab"` on items; `aria-controls` wired to panel `id`s; `role="tabpanel"` + `aria-labelledby` on panels; `Home`/`End` keyboard shortcuts added.
303
- - **CSS:** All ARIA attribute states (`aria-expanded`, `aria-selected`, `aria-hidden`, `aria-disabled`) are now first-class CSS selectors — visual state is driven by ARIA, not just class names.
304
- - **HTML demo:** All modal backdrops updated with `role`, `aria-modal`, `aria-labelledby`, `aria-describedby`, `aria-hidden`; nav updated with full menubar semantics.
305
-
306
- **Page structure**
307
-
308
- - Section order updated: Hero → Colors → Typography → Components (A→Z).
309
-
310
- ---
311
-
312
- ### v0.1.1
313
-
314
- - Initial release with: reset, base tokens, button, card, gradient, header, modal, section, select, table, tabs, typography.
315
- - Progressive enhancement: CSS-only baseline for all interactive components; JS adds keyboard navigation, animations, outside-click close.
316
- - Single Google Fonts request for Inter + Kode Mono.
317
- - esbuild bundler with per-component files + `peppertino.js` aggregator.
510
+ See [CHANGELOG.txt](CHANGELOG.txt)
318
511
 
319
512
  ---
320
513
 
@@ -0,0 +1,152 @@
1
+ (() => {
2
+ (function() {
3
+ function initCarousel(root, rootIdx) {
4
+ const track = root.querySelector(".pp-carousel__track");
5
+ const slides = [...root.querySelectorAll(".pp-carousel__slide")];
6
+ const dots = [...root.querySelectorAll(".pp-carousel__dot")];
7
+ const prevBtn = root.querySelector(".pp-carousel__prev");
8
+ const nextBtn = root.querySelector(".pp-carousel__next");
9
+ const autoplayBtn = root.querySelector(".pp-carousel__autoplay");
10
+ if (!track || !slides.length) return;
11
+ const total = slides.length;
12
+ let current = 0;
13
+ if (!root.getAttribute("role")) root.setAttribute("role", "region");
14
+ if (!root.getAttribute("aria-roledescription")) root.setAttribute("aria-roledescription", "carousel");
15
+ if (!root.getAttribute("aria-label") && !root.getAttribute("aria-labelledby")) {
16
+ root.setAttribute("aria-label", root.dataset.label || `Carousel ${rootIdx + 1}`);
17
+ }
18
+ track.setAttribute("aria-live", "off");
19
+ slides.forEach((slide, i) => {
20
+ slide.setAttribute("role", "group");
21
+ if (!slide.getAttribute("aria-roledescription")) slide.setAttribute("aria-roledescription", "slide");
22
+ if (!slide.getAttribute("aria-label")) slide.setAttribute("aria-label", `${i + 1} of ${total}`);
23
+ });
24
+ let announcer = root.querySelector(".pp-carousel__announcer");
25
+ if (!announcer) {
26
+ announcer = document.createElement("div");
27
+ announcer.className = "pp-carousel__announcer";
28
+ root.appendChild(announcer);
29
+ }
30
+ announcer.setAttribute("aria-live", "polite");
31
+ announcer.setAttribute("aria-atomic", "true");
32
+ dots.forEach((dot, i) => {
33
+ if (!dot.id) dot.id = `pp-carousel-${rootIdx}-dot-${i}`;
34
+ if (!dot.getAttribute("aria-label")) dot.setAttribute("aria-label", `Go to slide ${i + 1}`);
35
+ });
36
+ if (prevBtn && !prevBtn.getAttribute("aria-label")) prevBtn.setAttribute("aria-label", "Previous slide");
37
+ if (nextBtn && !nextBtn.getAttribute("aria-label")) nextBtn.setAttribute("aria-label", "Next slide");
38
+ function syncUI(idx) {
39
+ current = idx;
40
+ slides.forEach((slide, i) => slide.setAttribute("aria-hidden", String(i !== idx)));
41
+ dots.forEach((dot, i) => {
42
+ dot.classList.toggle("is-active", i === idx);
43
+ dot.setAttribute("aria-current", String(i === idx));
44
+ dot.setAttribute("tabindex", i === idx ? "0" : "-1");
45
+ });
46
+ if (prevBtn) {
47
+ prevBtn.disabled = idx === 0;
48
+ prevBtn.setAttribute("aria-disabled", String(idx === 0));
49
+ }
50
+ if (nextBtn) {
51
+ nextBtn.disabled = idx === total - 1;
52
+ nextBtn.setAttribute("aria-disabled", String(idx === total - 1));
53
+ }
54
+ const label = slides[idx].getAttribute("aria-label") || `Slide ${idx + 1}`;
55
+ announcer.textContent = "";
56
+ requestAnimationFrame(() => {
57
+ announcer.textContent = label;
58
+ });
59
+ }
60
+ const observer = new IntersectionObserver(
61
+ (entries) => {
62
+ entries.forEach((entry) => {
63
+ if (entry.isIntersecting) {
64
+ const idx = slides.indexOf(entry.target);
65
+ if (idx !== -1 && idx !== current) syncUI(idx);
66
+ }
67
+ });
68
+ },
69
+ { root: track, threshold: 0.5 }
70
+ );
71
+ slides.forEach((slide) => observer.observe(slide));
72
+ function goTo(idx) {
73
+ const clamped = Math.max(0, Math.min(total - 1, idx));
74
+ slides[clamped].scrollIntoView({ behavior: "smooth", block: "nearest", inline: "start" });
75
+ syncUI(clamped);
76
+ }
77
+ if (prevBtn) prevBtn.addEventListener("click", () => goTo(current - 1));
78
+ if (nextBtn) nextBtn.addEventListener("click", () => goTo(current + 1));
79
+ dots.forEach((dot, i) => {
80
+ dot.addEventListener("click", () => goTo(i));
81
+ dot.addEventListener("keydown", (e) => {
82
+ if (e.key === "ArrowRight" || e.key === "ArrowDown") {
83
+ e.preventDefault();
84
+ goTo((i + 1) % total);
85
+ dots[(i + 1) % total].focus();
86
+ }
87
+ if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
88
+ e.preventDefault();
89
+ goTo((i - 1 + total) % total);
90
+ dots[(i - 1 + total) % total].focus();
91
+ }
92
+ if (e.key === "Home") {
93
+ e.preventDefault();
94
+ goTo(0);
95
+ dots[0].focus();
96
+ }
97
+ if (e.key === "End") {
98
+ e.preventDefault();
99
+ goTo(total - 1);
100
+ dots[total - 1].focus();
101
+ }
102
+ });
103
+ });
104
+ if (autoplayBtn) {
105
+ autoplayBtn.addEventListener("click", () => {
106
+ const playing = root.classList.contains("pp-carousel--playing");
107
+ root.classList.toggle("pp-carousel--playing", !playing);
108
+ root.classList.toggle("pp-carousel--paused", playing);
109
+ autoplayBtn.setAttribute("aria-pressed", String(!playing));
110
+ autoplayBtn.setAttribute("aria-label", playing ? "Start autoplay" : "Pause autoplay");
111
+ root.dispatchEvent(new CustomEvent("pp-carousel:autoplay", { bubbles: true, detail: { playing: !playing } }));
112
+ });
113
+ }
114
+ track.setAttribute("tabindex", "0");
115
+ track.addEventListener("keydown", (e) => {
116
+ if (e.key === "ArrowRight") {
117
+ e.preventDefault();
118
+ goTo(current + 1);
119
+ }
120
+ if (e.key === "ArrowLeft") {
121
+ e.preventDefault();
122
+ goTo(current - 1);
123
+ }
124
+ if (e.key === "Home") {
125
+ e.preventDefault();
126
+ goTo(0);
127
+ }
128
+ if (e.key === "End") {
129
+ e.preventDefault();
130
+ goTo(total - 1);
131
+ }
132
+ });
133
+ syncUI(0);
134
+ return { goTo, current: () => current, total };
135
+ }
136
+ const instances = {};
137
+ document.querySelectorAll(".pp-carousel").forEach((el, i) => {
138
+ const id = el.id || `pp-carousel-${i}`;
139
+ const api = initCarousel(el, i);
140
+ if (api) instances[id] = api;
141
+ });
142
+ window.ppCarousel = {
143
+ get(ref) {
144
+ if (typeof ref === "string") return instances[ref];
145
+ if (ref instanceof Element) return instances[ref.id] || Object.values(instances).find((_, k) => document.getElementById(Object.keys(instances)[k]) === ref);
146
+ return null;
147
+ },
148
+ instances
149
+ };
150
+ })();
151
+ })();
152
+ //# sourceMappingURL=carousel.js.map