@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
package/CHANGELOG.txt
CHANGED
|
@@ -4,6 +4,94 @@ PeppertinoCSS — Changelog
|
|
|
4
4
|
All notable changes are documented here in reverse chronological order.
|
|
5
5
|
Versioning follows semver. Dates are YYYY-MM-DD.
|
|
6
6
|
|
|
7
|
+
─────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
v0.5.0 — 2026-06-18
|
|
9
|
+
─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
BEM naming (BREAKING — see MIGRATION.md)
|
|
12
|
+
- All component classes are now prefixed with pp-:
|
|
13
|
+
.button -> .pp-button
|
|
14
|
+
.gradient-txt -> .pp-gradient-text
|
|
15
|
+
- Modifier combiners confirmed: .pp-button--outline.pp-button--success (no
|
|
16
|
+
compound hyphen classes like .pp-button-outline-success).
|
|
17
|
+
|
|
18
|
+
HSL color token system
|
|
19
|
+
- base.scss: every color token decomposed into H/S/L channel properties plus
|
|
20
|
+
a composite shorthand. Pattern for each token:
|
|
21
|
+
--pp-primary-h: 356;
|
|
22
|
+
--pp-primary-s: 99.2%;
|
|
23
|
+
--pp-primary-l: 46.3%;
|
|
24
|
+
--pp-primary: hsl(var(--pp-primary-h) var(--pp-primary-s) var(--pp-primary-l));
|
|
25
|
+
- Alpha tints no longer use rgba($color-*, alpha); all component SCSS uses:
|
|
26
|
+
hsl(var(--pp-*-h) var(--pp-*-s) var(--pp-*-l) / 0.15)
|
|
27
|
+
- dark-mode.scss overrides at channel level (--pp-neutral-800-l: 95.9%) so
|
|
28
|
+
a single property change cascades to all consumers of that token.
|
|
29
|
+
- New dark shade tokens: --pp-success-900, --pp-warning-900, --pp-error-900,
|
|
30
|
+
--pp-info-900 for alert text colors that previously used hardcoded hex.
|
|
31
|
+
- All component SCSS files fully migrated: accordion, alert, button, card,
|
|
32
|
+
carousel, footer, forms (fieldset / form-instructions / text-field /
|
|
33
|
+
validation), gradient, header, modal, section, select, tabs, toast, tooltip.
|
|
34
|
+
- lint-colors.mjs enforces the ban on SCSS color vars and 6-digit hex in all
|
|
35
|
+
component files (base.scss and dark-mode.scss are exempted).
|
|
36
|
+
|
|
37
|
+
New components
|
|
38
|
+
- Badge Pill status indicators; variants: --primary/success/warning/
|
|
39
|
+
error/info; modifier: --filled; sizes: --sm, --lg; --dot for
|
|
40
|
+
8x8 presence/count circles. CSS-only, no JS.
|
|
41
|
+
- Switch iOS-style toggle; sizes: --sm, --lg. aria-checked drives visual
|
|
42
|
+
state (track color + thumb translateX). JS wires toggle on click
|
|
43
|
+
and Space key; dispatches pp:switch:change { checked: boolean }.
|
|
44
|
+
- Toast Auto-dismissing notifications. ppToast.show({ message, title,
|
|
45
|
+
variant, duration, position }). Creates container on demand.
|
|
46
|
+
Variants: neutral/info/success/warning/error. Six positions:
|
|
47
|
+
top/bottom × right/left/center. Progress bar animation.
|
|
48
|
+
duration: 0 for persistent. Events: pp:toast:show,
|
|
49
|
+
pp:toast:dismiss. data-toast-dismiss wires dismiss button.
|
|
50
|
+
- Tooltip CSS-only; no JS. Shows on :hover and :focus-within. Four
|
|
51
|
+
placements: top (default), --bottom, --left, --right. Arrow
|
|
52
|
+
via ::before. data-show to force-display. role="tooltip" on
|
|
53
|
+
content span. Keyboard accessible when trigger is focusable.
|
|
54
|
+
|
|
55
|
+
JS API consistency
|
|
56
|
+
- All CustomEvents renamed to pp:<component>:<event> format:
|
|
57
|
+
pp:accordion:open / pp:accordion:close { index, trigger, panel }
|
|
58
|
+
pp:alert:dismiss
|
|
59
|
+
pp:carousel:change { index, total, label }
|
|
60
|
+
pp:header:open / pp:header:close
|
|
61
|
+
pp:modal:open / pp:modal:close
|
|
62
|
+
pp:select:change { value }
|
|
63
|
+
pp:switch:change { checked }
|
|
64
|
+
pp:tabs:change { index }
|
|
65
|
+
pp:theme:change { theme: 'dark'|'light' }
|
|
66
|
+
pp:toast:show / pp:toast:dismiss
|
|
67
|
+
- ppAccordion.get(ref) -> { open(i), close(i), toggleAll() }
|
|
68
|
+
- ppAlert.dismiss(idOrEl)
|
|
69
|
+
- ppTabs.get(ref).activate(index)
|
|
70
|
+
- ppTheme.set(theme) / .get() / .toggle(); localStorage key: pp-theme;
|
|
71
|
+
data-theme-toggle auto-wired.
|
|
72
|
+
- New files: alert.js, switch.js, theme.js, toast.js.
|
|
73
|
+
- peppertino.js updated to import all new files.
|
|
74
|
+
|
|
75
|
+
Build guardrails
|
|
76
|
+
- scripts/lint-colors.mjs — bans rgba($color-*, ...), rgba($gradient-*, ...),
|
|
77
|
+
and 6-digit hex in all component SCSS. Structural white/black overlays
|
|
78
|
+
(rgba(255,...), rgba(0,0,0,...), #fff, #000, #ffffff) allowed. Exits 1 on
|
|
79
|
+
any violation.
|
|
80
|
+
- scripts/lint-bem.mjs — reads dist/main.css, extracts all .pp-* class
|
|
81
|
+
selectors, validates against BEM regex. Digit-starting modifiers (--2, --3)
|
|
82
|
+
allowed for grid helpers. Exits 1 on any violation.
|
|
83
|
+
- bun run build now runs: build:css && build:js && lint:colors && lint:bem.
|
|
84
|
+
- All package.json scripts migrated to bun (bun run build, bun run dev, etc.).
|
|
85
|
+
|
|
86
|
+
Demo
|
|
87
|
+
- index.html: Badge, Switch, Toast, Tooltip demo sections added.
|
|
88
|
+
- Header nav Components dropdown updated with new entries (Badge, Switch,
|
|
89
|
+
Toast, Tooltip).
|
|
90
|
+
|
|
91
|
+
Skill docs
|
|
92
|
+
- agents/peppertino/: badge.md, switch.md, toast.md, tooltip.md added.
|
|
93
|
+
- SKILL.md index updated with all new entries and corrected stale references.
|
|
94
|
+
|
|
7
95
|
─────────────────────────────────────────────────────────────────────────────
|
|
8
96
|
v0.4.0 — 2026-06-11
|
|
9
97
|
─────────────────────────────────────────────────────────────────────────────
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# PeppertinoCSS — Migration Guide
|
|
2
|
+
|
|
3
|
+
## v0.4.x → v0.5.0
|
|
4
|
+
|
|
5
|
+
### Class renames (breaking)
|
|
6
|
+
|
|
7
|
+
All class names now follow strict BEM: `.pp-<component>` / `.pp-<component>--<modifier>`.
|
|
8
|
+
|
|
9
|
+
#### Button
|
|
10
|
+
|
|
11
|
+
| v0.4.x | v0.5.0 |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `.button` | `.pp-button` |
|
|
14
|
+
| `.button-outline` | `.pp-button--outline` |
|
|
15
|
+
| `.button-success` | `.pp-button--success` |
|
|
16
|
+
| `.button-warning` | `.pp-button--warning` |
|
|
17
|
+
| `.button-error` | `.pp-button--error` |
|
|
18
|
+
| `.button-dark` | `.pp-button--dark` |
|
|
19
|
+
| `.button-gradient` | `.pp-button--gradient` |
|
|
20
|
+
| `.button-ghost` | `.pp-button--ghost` |
|
|
21
|
+
| `.button-outline-success` | `.pp-button--outline .pp-button--success` |
|
|
22
|
+
| `.button-outline-warning` | `.pp-button--outline .pp-button--warning` |
|
|
23
|
+
| `.button-outline-error` | `.pp-button--outline .pp-button--error` |
|
|
24
|
+
| `.button-outline-dark` | `.pp-button--outline .pp-button--dark` |
|
|
25
|
+
|
|
26
|
+
Note: outline+color variants changed from a single class to two combinable modifier classes. Both classes must be present on the element.
|
|
27
|
+
|
|
28
|
+
#### Gradient text
|
|
29
|
+
|
|
30
|
+
| v0.4.x | v0.5.0 |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `.gradient-txt` | `.pp-gradient-text` |
|
|
33
|
+
|
|
34
|
+
### Color tokens — hex → HSL (breaking for CSS var consumers)
|
|
35
|
+
|
|
36
|
+
All `--pp-*` custom properties that were previously flat hex values are now composed from H/S/L triplet properties. Consumers who read `--pp-primary` will still receive a valid color, but consumers who manually reference `--pp-primary-h`, `--pp-primary-s`, or `--pp-primary-l` for tint math are now supported.
|
|
37
|
+
|
|
38
|
+
### New components
|
|
39
|
+
|
|
40
|
+
Switch, Tooltip, Badge, Toast — no existing classes affected.
|
|
41
|
+
|
|
42
|
+
### New JS APIs
|
|
43
|
+
|
|
44
|
+
| Module | New methods |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `ppAccordion` | `.get(id).open(index)` · `.close(index)` · `.toggleAll()` |
|
|
47
|
+
| `ppTabs` | `.get(id).activate(index)` |
|
|
48
|
+
| `ppAlert` | `.dismiss(id)` · `[data-alert-dismiss]` attribute wiring |
|
|
49
|
+
| `ppTheme` | `.set('light'\|'dark')` · `.get()` · `.toggle()` |
|
|
50
|
+
| `ppToast` | `.show({ message, variant, duration })` |
|
|
51
|
+
|
|
52
|
+
All shims now dispatch `pp:<component>:<event>` CustomEvents on the root element.
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# PeppertinoCSS — An Apple-inspired CSS framework with a little spice.
|
|
1
|
+
# PeppertinoCSS — An Apple-inspired CSS framework with a little spice.
|
|
2
2
|
|
|
3
3
|
PeppertinoCSS is an Apple-inspired CSS framework built with SCSS, featuring the clean geometry and restrained elegance of Cupertino design — but with a spicy red accent instead of blue, because we're not Apple and we're not pretending to be.
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ PeppertinoCSS is an Apple-inspired CSS framework built with SCSS, featuring the
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
bun add @auriel/peppertino
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
CDN — stylesheet only:
|
|
@@ -34,8 +34,8 @@ Clone and build locally:
|
|
|
34
34
|
```bash
|
|
35
35
|
git clone https://codeberg.org/debaditya/Peppertino
|
|
36
36
|
cd Peppertino
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
bun install
|
|
38
|
+
bun run dev
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
Then open `http://localhost:3000` in your browser.
|
|
@@ -46,14 +46,16 @@ Then open `http://localhost:3000` in your browser.
|
|
|
46
46
|
|
|
47
47
|
| Command | Description |
|
|
48
48
|
|---|---|
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
49
|
+
| `bun run build` | Compile SCSS + JS to `dist/`, then run both linters |
|
|
50
|
+
| `bun run build:css` | SCSS only, expanded with sourcemap |
|
|
51
|
+
| `bun run build:css:min` | SCSS minified, no sourcemap |
|
|
52
|
+
| `bun run build:js` | Bundle all `src/js/` components via esbuild |
|
|
53
|
+
| `bun run lint:colors` | Fail if any component SCSS uses literal hex/SCSS color vars |
|
|
54
|
+
| `bun run lint:bem` | Fail if any `.pp-*` class in `dist/main.css` violates BEM |
|
|
55
|
+
| `bun run watch:css` | Watch and recompile SCSS on save |
|
|
56
|
+
| `bun run watch:js` | Watch and rebundle JS on save |
|
|
57
|
+
| `bun run serve` | Serve project on `http://localhost:3000` |
|
|
58
|
+
| `bun run dev` | Build + watch CSS/JS + serve, all in parallel |
|
|
57
59
|
|
|
58
60
|
---
|
|
59
61
|
|
|
@@ -87,6 +89,7 @@ cp -r agents/peppertino ~/.claude/skills/peppertino
|
|
|
87
89
|
|---|---|
|
|
88
90
|
| `skill.md` | Index, ARIA/WCAG requirements, conventions |
|
|
89
91
|
| `base.md` | Design tokens, spacing, breakpoints, mixins |
|
|
92
|
+
| `badge.md` | Badge variants, sizes, dot indicator |
|
|
90
93
|
| `button.md` | All button variants |
|
|
91
94
|
| `card.md` | Card parts, variants, grid |
|
|
92
95
|
| `carousel.md` | Carousel markup, API, keyboard |
|
|
@@ -101,8 +104,11 @@ cp -r agents/peppertino ~/.claude/skills/peppertino
|
|
|
101
104
|
| `modal.md` | Modal, actions, `ppModal` API |
|
|
102
105
|
| `section.md` | Section variants, scrollbar |
|
|
103
106
|
| `select.md` | Native select, custom dropdown |
|
|
107
|
+
| `switch.md` | Toggle switch, sizes, `ppSwitch` events |
|
|
104
108
|
| `table.md` | Table, column helpers |
|
|
105
109
|
| `tabs.md` | Tabs, variants, keyboard nav |
|
|
110
|
+
| `toast.md` | Toast positions, variants, `ppToast` API |
|
|
111
|
+
| `tooltip.md` | Tooltip placements, CSS-only usage |
|
|
106
112
|
| `typography.md` | All typography utility classes |
|
|
107
113
|
|
|
108
114
|
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.
|
|
@@ -119,7 +125,8 @@ The skill's `skill.md` enforces ARIA and WCAG AA compliance rules and instructs
|
|
|
119
125
|
| `base.scss` | Design tokens, CSS custom properties, helper functions, base element styles |
|
|
120
126
|
| `accordion.scss` | `.pp-accordion` — collapsible panels; variants: `--flush`, `--dark`, `--primary` |
|
|
121
127
|
| `alert.scss` | `.pp-alert` — inline feedback; variants: `--info/success/warning/error/primary/neutral`, `--filled` |
|
|
122
|
-
| `
|
|
128
|
+
| `badge.scss` | `.pp-badge` — pill badges; variants: `--primary/success/warning/error/info`, `--filled`, sizes `--sm/lg`, `--dot` |
|
|
129
|
+
| `button.scss` | `.pp-button`, `.pp-button--outline`, semantic variants |
|
|
123
130
|
| `card.scss` | `.pp-card` and variants |
|
|
124
131
|
| `carousel.scss` | `.pp-carousel` — CSS scroll-snap carousel |
|
|
125
132
|
| `dark-mode.scss` | `.dark` overrides for all `--pp-*` tokens — applied last |
|
|
@@ -130,13 +137,16 @@ The skill's `skill.md` enforces ARIA and WCAG AA compliance rules and instructs
|
|
|
130
137
|
| `forms/label.scss` | `.pp-label` — Apple HIG four-tier label system |
|
|
131
138
|
| `forms/text-field.scss` | `.pp-field` — labelled input/textarea with validation states |
|
|
132
139
|
| `forms/validation.scss` | `.pp-validation-summary`, `.pp-confirm`, `.pp-field--validate` |
|
|
133
|
-
| `gradient.scss` | `.gradient-
|
|
140
|
+
| `gradient.scss` | `.pp-gradient-text` |
|
|
134
141
|
| `header.scss` | `.pp-header` — glassmorphism sticky header |
|
|
135
142
|
| `modal.scss` | `.pp-modal-backdrop` + `.pp-modal` — glassmorphic modals |
|
|
136
143
|
| `section.scss` | `.pp-section` — full-viewport sections + custom scrollbar |
|
|
137
144
|
| `select.scss` | Native `<select>` restyling + `.pp-select` custom dropdown |
|
|
145
|
+
| `switch.scss` | `.pp-switch` — iOS-style toggle; sizes `--sm/lg` |
|
|
138
146
|
| `table.scss` | `.pp-table` — clean Apple-style data tables |
|
|
139
147
|
| `tabs.scss` | `.pp-tabs` — pill-style tabs with icon + label |
|
|
148
|
+
| `toast.scss` | `.pp-toast-container` + `.pp-toast` — auto-dismiss notifications |
|
|
149
|
+
| `tooltip.scss` | `.pp-tooltip` — CSS-only tooltip; placements `--top/bottom/left/right` |
|
|
140
150
|
| `typography.scss` | Utility classes for font, size, weight, spacing |
|
|
141
151
|
| `utilities.scss` | Single-purpose layout/spacing/display/visibility classes |
|
|
142
152
|
|
|
@@ -146,12 +156,16 @@ Each file is a self-contained IIFE. Import only what you need, or include `peppe
|
|
|
146
156
|
|
|
147
157
|
| File | Purpose |
|
|
148
158
|
|---|---|
|
|
149
|
-
| `accordion.js` | `aria-expanded`/`aria-hidden`, keyboard nav (↑ ↓ Home End), `data-allow-multiple` |
|
|
159
|
+
| `accordion.js` | `aria-expanded`/`aria-hidden`, keyboard nav (↑ ↓ Home End), `data-allow-multiple`; `ppAccordion.get(ref)` API |
|
|
160
|
+
| `alert.js` | `data-alert-dismiss` wiring; `window.ppAlert.dismiss(idOrEl)` |
|
|
150
161
|
| `carousel.js` | ARIA wiring, IntersectionObserver sync, `ppCarousel` API |
|
|
151
162
|
| `header.js` | Mobile drawer, dropdown ARIA wiring for `.pp-header` |
|
|
152
163
|
| `modal.js` | Open/close, focus trap, focus restore, ARIA for `.pp-modal` |
|
|
153
164
|
| `select.js` | Keyboard nav, ARIA listbox/option for `.pp-select` |
|
|
154
|
-
| `
|
|
165
|
+
| `switch.js` | `aria-checked` toggle, Space key, `pp:switch:change` event |
|
|
166
|
+
| `tabs.js` | Click + arrow key activation, ARIA tablist; `ppTabs.get(ref).activate(index)` |
|
|
167
|
+
| `theme.js` | `window.ppTheme.set/get/toggle`; persists to `localStorage`; `data-theme-toggle` wiring |
|
|
168
|
+
| `toast.js` | `window.ppToast.show({ message, title, variant, duration, position })`; auto-dismiss |
|
|
155
169
|
| `validation.js` | `aria-invalid` wiring, summary focus, `ppValidation` API |
|
|
156
170
|
| `peppertino.js` | Aggregator — imports all of the above |
|
|
157
171
|
|
|
@@ -161,17 +175,25 @@ All JS follows progressive enhancement — CSS provides the full visual baseline
|
|
|
161
175
|
|
|
162
176
|
## Design tokens (`base.scss`)
|
|
163
177
|
|
|
164
|
-
### Colors
|
|
178
|
+
### Colors — HSL channel system
|
|
165
179
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
All color tokens are decomposed into H/S/L channel properties so any component can form alpha tints without `rgba()`:
|
|
181
|
+
|
|
182
|
+
```css
|
|
183
|
+
/* Each token ships three channel vars + a composite shorthand */
|
|
184
|
+
--pp-primary-h: 356;
|
|
185
|
+
--pp-primary-s: 99.2%;
|
|
186
|
+
--pp-primary-l: 46.3%;
|
|
187
|
+
--pp-primary: hsl(var(--pp-primary-h) var(--pp-primary-s) var(--pp-primary-l));
|
|
170
188
|
|
|
171
|
-
|
|
172
|
-
|
|
189
|
+
/* Alpha tints use the channels directly — no SCSS needed */
|
|
190
|
+
background: hsl(var(--pp-primary-h) var(--pp-primary-s) var(--pp-primary-l) / 0.15);
|
|
173
191
|
```
|
|
174
192
|
|
|
193
|
+
Available token families: `--pp-primary`, `--pp-gradient-start`, `--pp-gradient-end`, neutral scale (`--pp-neutral-50` → `--pp-neutral-900`), semantic scales `--pp-success-*`, `--pp-warning-*`, `--pp-error-*`, `--pp-info-*` (each with 50/100/200/300/400/500/600/700/800/900 levels).
|
|
194
|
+
|
|
195
|
+
Dark mode overrides channel properties (`-l`, `-s`) rather than full hex values — single-token changes cascade everywhere.
|
|
196
|
+
|
|
175
197
|
### Typography
|
|
176
198
|
|
|
177
199
|
```scss
|
|
@@ -276,22 +298,49 @@ Variants: `--info` · `--success` · `--warning` · `--error` · `--primary` ·
|
|
|
276
298
|
Modifier: `--filled` (solid background instead of tint)
|
|
277
299
|
States: `.is-dismissible` · `.is-dismissing` (slide-out before removal)
|
|
278
300
|
|
|
301
|
+
JS API: `window.ppAlert.dismiss(idOrEl)` — accepts an element or its `id` string.
|
|
302
|
+
Event: `pp:alert:dismiss` dispatched on the alert element before removal.
|
|
303
|
+
|
|
304
|
+
### Badge
|
|
305
|
+
|
|
306
|
+
```html
|
|
307
|
+
<!-- Tint variants (default) -->
|
|
308
|
+
<span class="pp-badge pp-badge--info">New</span>
|
|
309
|
+
<span class="pp-badge pp-badge--success">Active</span>
|
|
310
|
+
<span class="pp-badge pp-badge--warning">Review</span>
|
|
311
|
+
<span class="pp-badge pp-badge--error">Error</span>
|
|
312
|
+
<span class="pp-badge pp-badge--primary">Beta</span>
|
|
313
|
+
|
|
314
|
+
<!-- Filled (solid background) -->
|
|
315
|
+
<span class="pp-badge pp-badge--success pp-badge--filled">Active</span>
|
|
316
|
+
|
|
317
|
+
<!-- Sizes -->
|
|
318
|
+
<span class="pp-badge pp-badge--info pp-badge--sm">Small</span>
|
|
319
|
+
<span class="pp-badge pp-badge--info pp-badge--lg">Large</span>
|
|
320
|
+
|
|
321
|
+
<!-- Dot indicator (no text — pair with sr-only label) -->
|
|
322
|
+
<span class="pp-badge pp-badge--error pp-badge--dot" aria-label="3 unread"></span>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Variants: `--primary` · `--success` · `--warning` · `--error` · `--info`
|
|
326
|
+
Modifiers: `--filled` · `--sm` · `--lg` · `--dot`
|
|
327
|
+
|
|
279
328
|
### Button
|
|
280
329
|
|
|
281
330
|
```html
|
|
282
|
-
<button class="button">Primary</button>
|
|
283
|
-
<button class="button
|
|
284
|
-
<button class="button
|
|
285
|
-
<button class="button
|
|
286
|
-
<button class="button
|
|
287
|
-
<button class="button
|
|
288
|
-
<button class="button
|
|
331
|
+
<button class="pp-button">Primary</button>
|
|
332
|
+
<button class="pp-button--success">Success</button>
|
|
333
|
+
<button class="pp-button--warning">Warning</button>
|
|
334
|
+
<button class="pp-button--error">Error</button>
|
|
335
|
+
<button class="pp-button--dark">Dark</button>
|
|
336
|
+
<button class="pp-button--gradient">Gradient</button>
|
|
337
|
+
<button class="pp-button--ghost">Ghost</button>
|
|
289
338
|
|
|
290
|
-
<button class="button
|
|
291
|
-
<button class="button
|
|
292
|
-
<button class="button
|
|
293
|
-
<button class="button
|
|
294
|
-
<button class="button
|
|
339
|
+
<button class="pp-button--outline">Primary</button>
|
|
340
|
+
<button class="pp-button--outline pp-button--success">Success</button>
|
|
341
|
+
<button class="pp-button--outline pp-button--warning">Warning</button>
|
|
342
|
+
<button class="pp-button--outline pp-button--error">Error</button>
|
|
343
|
+
<button class="pp-button--outline pp-button--dark">Dark</button>
|
|
295
344
|
```
|
|
296
345
|
|
|
297
346
|
### Card
|
|
@@ -430,7 +479,7 @@ Sizes: `--sm` · `--lg`
|
|
|
430
479
|
<input class="pp-confirm__input" type="checkbox" />
|
|
431
480
|
<span class="pp-confirm__label">I confirm this action.</span>
|
|
432
481
|
</label>
|
|
433
|
-
<button class="button pp-submit--gated" type="submit">Submit</button>
|
|
482
|
+
<button class="pp-button pp-submit--gated" type="submit">Submit</button>
|
|
434
483
|
```
|
|
435
484
|
|
|
436
485
|
JS API (optional — CSS works without it):
|
|
@@ -446,7 +495,7 @@ ppValidation.setSummary([{ input, message }], summaryEl)
|
|
|
446
495
|
### Gradient text
|
|
447
496
|
|
|
448
497
|
```html
|
|
449
|
-
<h1 class="gradient-
|
|
498
|
+
<h1 class="pp-gradient-text">PeppertinoCSS</h1>
|
|
450
499
|
```
|
|
451
500
|
|
|
452
501
|
### Header
|
|
@@ -517,6 +566,24 @@ ppValidation.setSummary([{ input, message }], summaryEl)
|
|
|
517
566
|
|
|
518
567
|
Sizes: `.pp-select--sm` · `.pp-select--lg`
|
|
519
568
|
|
|
569
|
+
### Switch
|
|
570
|
+
|
|
571
|
+
```html
|
|
572
|
+
<!-- Basic toggle -->
|
|
573
|
+
<button class="pp-switch" role="switch" aria-checked="false" aria-label="Enable notifications"></button>
|
|
574
|
+
|
|
575
|
+
<!-- Pre-checked -->
|
|
576
|
+
<button class="pp-switch" role="switch" aria-checked="true" aria-label="Dark mode"></button>
|
|
577
|
+
|
|
578
|
+
<!-- Sizes -->
|
|
579
|
+
<button class="pp-switch pp-switch--sm" role="switch" aria-checked="false" aria-label="Compact mode"></button>
|
|
580
|
+
<button class="pp-switch pp-switch--lg" role="switch" aria-checked="false" aria-label="Accessibility features"></button>
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
Sizes: `--sm` (32×20px) · default (44×26px) · `--lg` (56×32px)
|
|
584
|
+
JS handles `aria-checked` toggle on click and Space key.
|
|
585
|
+
Event: `pp:switch:change` with `{ checked: boolean }` on the switch element.
|
|
586
|
+
|
|
520
587
|
### Tabs
|
|
521
588
|
|
|
522
589
|
```html
|
|
@@ -531,7 +598,9 @@ Sizes: `.pp-select--sm` · `.pp-select--lg`
|
|
|
531
598
|
|
|
532
599
|
Variants: default · `--outline` · `--gradient` · `--gradient-outline`
|
|
533
600
|
Sizes: `--sm` · `--lg`
|
|
534
|
-
Keyboard: `←` / `→` arrows, `Home`, `End`
|
|
601
|
+
Keyboard: `←` / `→` arrows, `Home`, `End`
|
|
602
|
+
JS API: `ppTabs.get(ref).activate(index)` — programmatically activate a tab by index.
|
|
603
|
+
Event: `pp:tabs:change` with `{ index }` on the `.pp-tabs` element.
|
|
535
604
|
|
|
536
605
|
### Table
|
|
537
606
|
|
|
@@ -545,6 +614,47 @@ Keyboard: `←` / `→` arrows, `Home`, `End`
|
|
|
545
614
|
|
|
546
615
|
Column helpers: `.pp-table--cols-1` → `.pp-table--cols-4`
|
|
547
616
|
|
|
617
|
+
### Toast
|
|
618
|
+
|
|
619
|
+
```js
|
|
620
|
+
// Show a toast (JS required)
|
|
621
|
+
ppToast.show({ message: 'File saved.', variant: 'success' });
|
|
622
|
+
ppToast.show({ message: 'Sync failed.', title: 'Error', variant: 'error', duration: 6000 });
|
|
623
|
+
ppToast.show({ message: 'Update available.', variant: 'info', position: 'bottom-center' });
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
```html
|
|
627
|
+
<!-- Dismiss button with data attribute (no JS needed) -->
|
|
628
|
+
<button data-toast-dismiss aria-label="Dismiss">✕</button>
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Variants: `--info` · `--success` · `--warning` · `--error` · `--neutral`
|
|
632
|
+
Positions: `top-right` (default) · `top-left` · `top-center` · `bottom-right` · `bottom-left` · `bottom-center`
|
|
633
|
+
Options: `message` · `title` · `variant` · `duration` (ms, default 4000) · `position`
|
|
634
|
+
Events: `pp:toast:show` / `pp:toast:dismiss` on the toast element.
|
|
635
|
+
|
|
636
|
+
### Tooltip
|
|
637
|
+
|
|
638
|
+
```html
|
|
639
|
+
<!-- CSS-only: shows on hover and :focus-within -->
|
|
640
|
+
<span class="pp-tooltip">
|
|
641
|
+
Hover me
|
|
642
|
+
<span class="pp-tooltip__content" role="tooltip">Helpful hint</span>
|
|
643
|
+
</span>
|
|
644
|
+
|
|
645
|
+
<!-- Force-show via attribute (e.g. for testing) -->
|
|
646
|
+
<span class="pp-tooltip">
|
|
647
|
+
Click me
|
|
648
|
+
<span class="pp-tooltip__content pp-tooltip__content--bottom" role="tooltip" data-show>
|
|
649
|
+
Shown below
|
|
650
|
+
</span>
|
|
651
|
+
</span>
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
Placements: default (top) · `--bottom` · `--left` · `--right`
|
|
655
|
+
Shown automatically on `:hover` and `:focus-within` — no JS required.
|
|
656
|
+
Add `data-show` to force-display for testing.
|
|
657
|
+
|
|
548
658
|
### Section
|
|
549
659
|
|
|
550
660
|
```html
|
|
@@ -595,18 +705,50 @@ Add `class="dark"` to `<html>` (or any ancestor element). All component tokens f
|
|
|
595
705
|
</html>
|
|
596
706
|
```
|
|
597
707
|
|
|
598
|
-
Toggle from JS:
|
|
708
|
+
Toggle from JS using the `ppTheme` API (requires `theme.js`):
|
|
599
709
|
|
|
600
710
|
```js
|
|
601
|
-
|
|
602
|
-
//
|
|
603
|
-
|
|
711
|
+
ppTheme.set('dark'); // switch to dark mode
|
|
712
|
+
ppTheme.set('light'); // switch to light mode
|
|
713
|
+
ppTheme.toggle(); // flip current mode
|
|
714
|
+
ppTheme.get(); // → 'dark' | 'light'
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
Or add `data-theme-toggle` to any button — it wires automatically:
|
|
718
|
+
|
|
719
|
+
```html
|
|
720
|
+
<button data-theme-toggle aria-label="Toggle dark mode">Dark</button>
|
|
604
721
|
```
|
|
605
722
|
|
|
723
|
+
The preference is persisted to `localStorage` under `pp-theme` and restored on page load. Event: `pp:theme:change` with `{ theme: 'dark' | 'light' }` dispatched on `document`.
|
|
724
|
+
|
|
606
725
|
All `--pp-*` tokens are defined on `:root` as light defaults. `dark-mode.scss` overrides them under `.dark`. The neutral scale is fully inverted (50 ↔ 900), surfaces swap, and glass/shadow values are strengthened for dark backgrounds.
|
|
607
726
|
|
|
608
727
|
---
|
|
609
728
|
|
|
729
|
+
## CustomEvents reference
|
|
730
|
+
|
|
731
|
+
All JS components dispatch `pp:<component>:<event>` CustomEvents that bubble. Listen at any ancestor:
|
|
732
|
+
|
|
733
|
+
| Event | Dispatched on | Detail |
|
|
734
|
+
|---|---|---|
|
|
735
|
+
| `pp:accordion:open` | `.pp-accordion` | `{ index, trigger, panel }` |
|
|
736
|
+
| `pp:accordion:close` | `.pp-accordion` | `{ index, trigger, panel }` |
|
|
737
|
+
| `pp:alert:dismiss` | `.pp-alert` | — |
|
|
738
|
+
| `pp:carousel:change` | `.pp-carousel` | `{ index, total, label }` |
|
|
739
|
+
| `pp:header:open` | `.pp-header` | — |
|
|
740
|
+
| `pp:header:close` | `.pp-header` | — |
|
|
741
|
+
| `pp:modal:open` | `.pp-modal-backdrop` | — |
|
|
742
|
+
| `pp:modal:close` | `.pp-modal-backdrop` | — |
|
|
743
|
+
| `pp:select:change` | `.pp-select` | `{ value }` |
|
|
744
|
+
| `pp:switch:change` | `.pp-switch` | `{ checked: boolean }` |
|
|
745
|
+
| `pp:tabs:change` | `.pp-tabs` | `{ index }` |
|
|
746
|
+
| `pp:theme:change` | `document` | `{ theme: 'dark' \| 'light' }` |
|
|
747
|
+
| `pp:toast:show` | `.pp-toast` | — |
|
|
748
|
+
| `pp:toast:dismiss` | `.pp-toast` | — |
|
|
749
|
+
|
|
750
|
+
---
|
|
751
|
+
|
|
610
752
|
## Changelog
|
|
611
753
|
|
|
612
754
|
See [CHANGELOG.txt](CHANGELOG.txt)
|
package/dist/accordion.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
(function() {
|
|
3
|
-
|
|
3
|
+
const registry = {};
|
|
4
|
+
document.querySelectorAll(".pp-accordion").forEach((accordion, accordionIdx) => {
|
|
4
5
|
const allowMultiple = accordion.hasAttribute("data-allow-multiple");
|
|
5
|
-
accordion.
|
|
6
|
+
const id = accordion.id || `pp-accordion-${accordionIdx}`;
|
|
7
|
+
if (!accordion.id) accordion.id = id;
|
|
8
|
+
const triggers = [...accordion.querySelectorAll(".pp-accordion__trigger")];
|
|
9
|
+
triggers.forEach((trigger, i) => {
|
|
6
10
|
const panelId = trigger.getAttribute("aria-controls");
|
|
7
11
|
const panel = panelId ? document.getElementById(panelId) : trigger.nextElementSibling;
|
|
8
12
|
if (!panel) return;
|
|
@@ -12,7 +16,7 @@
|
|
|
12
16
|
trigger.addEventListener("click", () => {
|
|
13
17
|
const expanded = trigger.getAttribute("aria-expanded") === "true";
|
|
14
18
|
if (!allowMultiple) {
|
|
15
|
-
|
|
19
|
+
triggers.forEach((t) => {
|
|
16
20
|
if (t === trigger) return;
|
|
17
21
|
t.setAttribute("aria-expanded", "false");
|
|
18
22
|
const p = t.getAttribute("aria-controls") ? document.getElementById(t.getAttribute("aria-controls")) : t.nextElementSibling;
|
|
@@ -26,9 +30,12 @@
|
|
|
26
30
|
trigger.setAttribute("aria-expanded", String(next));
|
|
27
31
|
panel.setAttribute("aria-hidden", String(!next));
|
|
28
32
|
panel.classList.toggle("is-open", next);
|
|
33
|
+
accordion.dispatchEvent(new CustomEvent(next ? "pp:accordion:open" : "pp:accordion:close", {
|
|
34
|
+
bubbles: true,
|
|
35
|
+
detail: { index: i, trigger, panel }
|
|
36
|
+
}));
|
|
29
37
|
});
|
|
30
38
|
trigger.addEventListener("keydown", (e) => {
|
|
31
|
-
const triggers = [...accordion.querySelectorAll(".pp-accordion__trigger")];
|
|
32
39
|
const idx = triggers.indexOf(trigger);
|
|
33
40
|
if (e.key === "ArrowDown") {
|
|
34
41
|
e.preventDefault();
|
|
@@ -45,7 +52,37 @@
|
|
|
45
52
|
}
|
|
46
53
|
});
|
|
47
54
|
});
|
|
55
|
+
function setItem(index, open) {
|
|
56
|
+
const trigger = triggers[index];
|
|
57
|
+
if (!trigger) return;
|
|
58
|
+
const panelId = trigger.getAttribute("aria-controls");
|
|
59
|
+
const panel = panelId ? document.getElementById(panelId) : trigger.nextElementSibling;
|
|
60
|
+
if (!panel) return;
|
|
61
|
+
trigger.setAttribute("aria-expanded", String(open));
|
|
62
|
+
panel.setAttribute("aria-hidden", String(!open));
|
|
63
|
+
panel.classList.toggle("is-open", open);
|
|
64
|
+
accordion.dispatchEvent(new CustomEvent(open ? "pp:accordion:open" : "pp:accordion:close", {
|
|
65
|
+
bubbles: true,
|
|
66
|
+
detail: { index, trigger, panel }
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
const api = {
|
|
70
|
+
open: (index) => setItem(index, true),
|
|
71
|
+
close: (index) => setItem(index, false),
|
|
72
|
+
toggleAll() {
|
|
73
|
+
const anyOpen = triggers.some((t) => t.getAttribute("aria-expanded") === "true");
|
|
74
|
+
triggers.forEach((_, i) => setItem(i, !anyOpen));
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
registry[id] = api;
|
|
48
78
|
});
|
|
79
|
+
window.ppAccordion = {
|
|
80
|
+
get(ref) {
|
|
81
|
+
if (typeof ref === "string") return registry[ref];
|
|
82
|
+
if (ref instanceof Element) return registry[ref.id];
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
49
86
|
})();
|
|
50
87
|
})();
|
|
51
88
|
//# sourceMappingURL=accordion.js.map
|
package/dist/accordion.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/js/accordion.js"],
|
|
4
|
-
"sourcesContent": ["(function () {\n document.querySelectorAll('.pp-accordion').forEach((accordion) => {\n const allowMultiple = accordion.hasAttribute('data-allow-multiple');\n\n accordion.querySelectorAll('.pp-accordion__trigger').forEach((trigger) => {\n const panelId = trigger.getAttribute('aria-controls');\n const panel = panelId\n ? document.getElementById(panelId)\n : trigger.nextElementSibling;\n\n if (!panel) return;\n\n
|
|
5
|
-
"mappings": ";AAAA,GAAC,WAAY;AACX,aAAS,iBAAiB,eAAe,EAAE,QAAQ,CAAC,
|
|
4
|
+
"sourcesContent": ["(function () {\n const registry = {};\n\n document.querySelectorAll('.pp-accordion').forEach((accordion, accordionIdx) => {\n const allowMultiple = accordion.hasAttribute('data-allow-multiple');\n const id = accordion.id || `pp-accordion-${accordionIdx}`;\n if (!accordion.id) accordion.id = id;\n\n const triggers = [...accordion.querySelectorAll('.pp-accordion__trigger')];\n\n triggers.forEach((trigger, i) => {\n const panelId = trigger.getAttribute('aria-controls');\n const panel = panelId\n ? document.getElementById(panelId)\n : trigger.nextElementSibling;\n\n if (!panel) return;\n\n const isOpen = trigger.getAttribute('aria-expanded') === 'true';\n panel.setAttribute('aria-hidden', isOpen ? 'false' : 'true');\n if (isOpen) panel.classList.add('is-open');\n\n trigger.addEventListener('click', () => {\n const expanded = trigger.getAttribute('aria-expanded') === 'true';\n\n if (!allowMultiple) {\n triggers.forEach((t) => {\n if (t === trigger) return;\n t.setAttribute('aria-expanded', 'false');\n const p = t.getAttribute('aria-controls')\n ? document.getElementById(t.getAttribute('aria-controls'))\n : t.nextElementSibling;\n if (p) {\n p.setAttribute('aria-hidden', 'true');\n p.classList.remove('is-open');\n }\n });\n }\n\n const next = !expanded;\n trigger.setAttribute('aria-expanded', String(next));\n panel.setAttribute('aria-hidden', String(!next));\n panel.classList.toggle('is-open', next);\n\n accordion.dispatchEvent(new CustomEvent(next ? 'pp:accordion:open' : 'pp:accordion:close', {\n bubbles: true,\n detail: { index: i, trigger, panel },\n }));\n });\n\n trigger.addEventListener('keydown', (e) => {\n const idx = triggers.indexOf(trigger);\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n triggers[(idx + 1) % triggers.length].focus();\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n triggers[(idx - 1 + triggers.length) % triggers.length].focus();\n } else if (e.key === 'Home') {\n e.preventDefault();\n triggers[0].focus();\n } else if (e.key === 'End') {\n e.preventDefault();\n triggers[triggers.length - 1].focus();\n }\n });\n });\n\n function setItem(index, open) {\n const trigger = triggers[index];\n if (!trigger) return;\n const panelId = trigger.getAttribute('aria-controls');\n const panel = panelId ? document.getElementById(panelId) : trigger.nextElementSibling;\n if (!panel) return;\n trigger.setAttribute('aria-expanded', String(open));\n panel.setAttribute('aria-hidden', String(!open));\n panel.classList.toggle('is-open', open);\n accordion.dispatchEvent(new CustomEvent(open ? 'pp:accordion:open' : 'pp:accordion:close', {\n bubbles: true,\n detail: { index, trigger, panel },\n }));\n }\n\n const api = {\n open: (index) => setItem(index, true),\n close: (index) => setItem(index, false),\n toggleAll() {\n const anyOpen = triggers.some((t) => t.getAttribute('aria-expanded') === 'true');\n triggers.forEach((_, i) => setItem(i, !anyOpen));\n },\n };\n\n registry[id] = api;\n });\n\n window.ppAccordion = {\n get(ref) {\n if (typeof ref === 'string') return registry[ref];\n if (ref instanceof Element) return registry[ref.id];\n return null;\n },\n };\n})();\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
(function() {
|
|
3
|
+
function dismiss(alertEl) {
|
|
4
|
+
if (alertEl._dismissed) return;
|
|
5
|
+
alertEl._dismissed = true;
|
|
6
|
+
alertEl.classList.add("is-dismissing");
|
|
7
|
+
alertEl.dispatchEvent(new CustomEvent("pp:alert:dismiss", { bubbles: true }));
|
|
8
|
+
alertEl.addEventListener("animationend", () => alertEl.remove(), { once: true });
|
|
9
|
+
setTimeout(() => alertEl.remove(), 250);
|
|
10
|
+
}
|
|
11
|
+
window.ppAlert = {
|
|
12
|
+
dismiss(idOrEl) {
|
|
13
|
+
const el = typeof idOrEl === "string" ? document.getElementById(idOrEl) : idOrEl;
|
|
14
|
+
if (el) dismiss(el);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
document.addEventListener("click", (e) => {
|
|
18
|
+
const btn = e.target.closest("[data-alert-dismiss]");
|
|
19
|
+
if (btn) {
|
|
20
|
+
const alert = btn.closest(".pp-alert");
|
|
21
|
+
if (alert) dismiss(alert);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
})();
|
|
25
|
+
})();
|
|
26
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/js/alert.js"],
|
|
4
|
+
"sourcesContent": ["(function () {\n function dismiss(alertEl) {\n if (alertEl._dismissed) return;\n alertEl._dismissed = true;\n alertEl.classList.add('is-dismissing');\n alertEl.dispatchEvent(new CustomEvent('pp:alert:dismiss', { bubbles: true }));\n alertEl.addEventListener('animationend', () => alertEl.remove(), { once: true });\n setTimeout(() => alertEl.remove(), 250);\n }\n\n window.ppAlert = {\n dismiss(idOrEl) {\n const el = typeof idOrEl === 'string'\n ? document.getElementById(idOrEl)\n : idOrEl;\n if (el) dismiss(el);\n },\n };\n\n // Auto-wire [data-alert-dismiss] buttons\n document.addEventListener('click', (e) => {\n const btn = e.target.closest('[data-alert-dismiss]');\n if (btn) {\n const alert = btn.closest('.pp-alert');\n if (alert) dismiss(alert);\n }\n });\n})();\n"],
|
|
5
|
+
"mappings": ";AAAA,GAAC,WAAY;AACX,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,QAAQ,QAAQ;AACd,cAAM,KAAK,OAAO,WAAW,WACzB,SAAS,eAAe,MAAM,IAC9B;AACJ,YAAI,GAAI,SAAQ,EAAE;AAAA,MACpB;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
|
+
}
|