@phantompixeldev/retrocss 2.8.1 → 3.0.1

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/MIGRATION.md CHANGED
@@ -1,3 +1,212 @@
1
+ # Migrating to RetroCSS 3.0
2
+
3
+ 3.0 is a visual release. Nothing was renamed and no class was removed, but two
4
+ changes are visible on every page that consumes the framework, so they are
5
+ called out first.
6
+
7
+ > **If you are on 3.0.0, upgrade to 3.0.1.** 3.0.0 shipped a regression that
8
+ > rounded eleven components. See [section 2](#2-border-radius-is-no-longer-important).
9
+
10
+ ## 1. Body text is 16px
11
+
12
+ `--retro-font-size` moves from `0.875rem` (14px) to `1rem` (16px). The rest of
13
+ the scale is expressed in `rem` against the root, so headings, buttons, badges
14
+ and inputs all move with it.
15
+
16
+ 14px is the authentic Win9x metric and 16px is not. The trade was made
17
+ deliberately: the framework is used to build things people read, and 14px is
18
+ below the size at which most people read comfortably. One line puts it back:
19
+
20
+ ```css
21
+ :root { --retro-font-size: 0.875rem; }
22
+ ```
23
+
24
+ Expect layouts that were tuned to the pixel at 14px to need a little room. If
25
+ you pinned a width in `px` to fit a specific string, it will now clip.
26
+
27
+ ## 2. `border-radius: 0` is no longer `!important`
28
+
29
+ The reset was `* { border-radius: 0 !important }`, which meant nothing in a
30
+ consuming application could round a corner — including `.retro-rounded`, which
31
+ had to fight the reset, and `_modal.scss`, which needed its own `!important` to
32
+ get 4px back. The default is still square:
33
+
34
+ ```css
35
+ * { border-radius: 0; }
36
+ ```
37
+
38
+ If you were relying on the reset to flatten a third-party widget's corners,
39
+ that widget's own radius now wins, and you will need to zero it yourself.
40
+
41
+ ### The 3.0.0 regression, fixed in 3.0.1
42
+
43
+ Dropping the `!important` had a consequence nobody caught: the reset had been
44
+ suppressing 31 hardcoded `border-radius` declarations scattered through the
45
+ components, written over the years by people who never saw them take effect.
46
+ All of them came alive at once. **3.0.0 renders these rounded**, and 3.0.1
47
+ returns them to square:
48
+
49
+ | Component | 3.0.0 | 3.0.1 |
50
+ | --- | --- | --- |
51
+ | `.retro-nav-pills .retro-nav-item` | 999px | 999px *(kept, see below)* |
52
+ | `.retro-tag` | 12px | 12px *(kept, see below)* |
53
+ | `.retro-list` / `.retro-list li` | 6px / 4px | 0 |
54
+ | `.retro-rating-star` | 6px | 0 |
55
+ | `.retro-tag-input`, `.retro-search-bar`, `.retro-file-upload`, `.retro-tooltip`, `.retro-sidebar`, `.retro-tab` | 4px | 0 |
56
+ | `.retro-breadcrumbs`, `.retro-dropdown-menu`, `.retro-pagination .retro-btn`, `.retro-divider-vertical` | 2px | 0 |
57
+
58
+ Those declarations now read `var(--retro-border-radius)`, which is `0` by
59
+ default. So the fix is not a second reversal — it is the radius system finally
60
+ being wired up. **You can round all of them at once:**
61
+
62
+ ```css
63
+ :root { --retro-border-radius: 4px; }
64
+ ```
65
+
66
+ `.retro-nav-pills` and `.retro-tag` keep their shapes deliberately: a pill and
67
+ a chip are the shapes those components are named for, and they are the one
68
+ place the framework spends a modern idiom on purpose.
69
+
70
+ Note that the core Win9x chrome — card, button, badge, table, input, modal,
71
+ alert, progress, carousel — sets `border-radius: 0` directly and does **not**
72
+ follow the token. Rounding those too is a change under consideration; if you
73
+ need it today, override them yourself.
74
+
75
+ `scripts/check-radius.mjs` now runs in CI and fails the build on any new
76
+ hardcoded radius, so this cannot recur.
77
+
78
+ ### Radio buttons and the spinner are round again
79
+
80
+ The same reset had been squaring six declarations that were never chrome:
81
+ `.retro-radio` and its checked dot, `input[type="radio"].retro-input` and its
82
+ dot, `.retro-spinner`, and the `.retro-list` bullet. A Windows 95 radio button
83
+ is a circle, so squaring them was a long-standing bug. They are circular from
84
+ 3.0.0 onward and stay that way. If you were relying on square radios, set
85
+ `border-radius: 0` on them yourself.
86
+
87
+ ## 3. On-fill text follows the theme
88
+
89
+ If you built a component that pairs a RetroCSS hue fill with white text:
90
+
91
+ ```css
92
+ /* before */
93
+ .my-chip { background: var(--retro-primary); color: var(--retro-white); }
94
+ ```
95
+
96
+ ...that pair breaks in dark mode. `--retro-white` inverts to `#3a3a3a` while
97
+ the fill *lightens* to `#4a90e2`, so both move and the contrast collapses —
98
+ this was measuring 3.45:1 on the framework's own active nav items. Use the
99
+ `-fg` token, which is defined as "text on this fill" and is contrast-gated in
100
+ both themes:
101
+
102
+ ```css
103
+ /* after */
104
+ .my-chip { background: var(--retro-primary); color: var(--retro-primary-fg); }
105
+ ```
106
+
107
+ The `--retro-black` / `--retro-white` pair is still fine *together* — both
108
+ invert, so a black chip with white text simply becomes a white chip with dark
109
+ text.
110
+
111
+ ## 4. Tooltips are instant
112
+
113
+ `.retro-tooltip` toggles `display` rather than `opacity` + `visibility`, so the
114
+ 0.2s fade is gone. This was not a style choice: a hidden tooltip kept its box in
115
+ the page's scrollable overflow region, so a `.retro-tooltip-right` on a trigger
116
+ near the viewport edge widened the whole page while invisible. Instant tooltips
117
+ are period-correct anyway.
118
+
119
+ If you were animating `.retro-tooltip` yourself, animate a child instead.
120
+
121
+ ## Smaller changes
122
+
123
+ - **Nav variants and breadcrumbs wrap.** `.retro-nav-tabbed`,
124
+ `.retro-nav-underlined`, `.retro-nav-buttons` and `.retro-breadcrumbs` were
125
+ single unwrapped flex rows, so a long set of labels pushed the page sideways
126
+ on narrow viewports. They wrap onto a second line now.
127
+ - **`.retro-nav-vertical`** is capped at `max-width: 100%`; it was sized to its
128
+ longest label with `width: max-content`.
129
+ - **`.retro-alert-close`** inherits the alert's own text colour and no longer
130
+ renders at `opacity: 0.7`.
131
+ - **Unfilled `.retro-rating-star`** uses `--retro-text-muted` instead of
132
+ `--retro-border-dark`, which was invisible on the dark chassis.
133
+ - **`.retro-heading-variant`** drops its `letter-spacing`. Uppercase plus
134
+ monospace already carries the emphasis.
135
+
136
+ ## Removed
137
+
138
+ Everything here was already dead: unreachable, uninitialised, or compiling to
139
+ nothing. If you were using any of it, it was not doing what its name implied.
140
+
141
+ - **`window.RetroSidebar` / `src/js/sidebar.js`** — 234 lines that were bundled
142
+ but never initialised. Wiring it in would have injected a toggle button and a
143
+ full-screen overlay into every consuming page, hijacked every sidebar link
144
+ with smooth scrolling and `history.pushState`, overwritten whichever link the
145
+ author had marked `.active`, and bound an unthrottled `scroll` listener that
146
+ re-queried `section[id], div[id]` across the whole document on every event.
147
+ That is application logic, not framework logic. The CSS stays —
148
+ `.retro-sidebar`, `.retro-sidebar-toggle` and `.retro-sidebar-overlay` are all
149
+ still styled, so the same UI is a few lines of your own JS.
150
+ - **Eleven `@container` blocks** in `utilities/_container-queries.scss`:
151
+ `.retro-cq-sm`, `-md`, `-lg`, `-xl`, `-wide`, `-tall`, `-landscape`,
152
+ `-portrait`, `-size-sm`, `-size-md`, `-size-lg`. Every one had a comment for a
153
+ body and compiled to nothing. The blocks with real declarations
154
+ (`.retro-cq-hide`, `-show`, `-text-lg`, `-text-xl`, `-flex-row`, `-flex-col`,
155
+ `-p-4`, `-p-6`, `-grid-2`, `-grid-3`) are untouched.
156
+ - **Five Sass mixins**: `retro-border`, `retro-hover`, `retro-active`,
157
+ `retro-transition`, `retro-z-index`. None was called from anywhere in the
158
+ framework. Their values are all reachable directly as custom properties —
159
+ `--retro-border-dark`, `--retro-border-sunken`, `--retro-z-index-modal` and so
160
+ on — which is what the components use. `retro-box-shadow`, `retro-focus`,
161
+ `retro-focus-ring` and `retro-breakpoint` are still here.
162
+ - **Five devDependencies**: `concat-cli`, `copyfiles`, `mkdirp`, `onchange`,
163
+ `uglify-js`. No script, workflow or config invoked any of them.
164
+
165
+ ## New
166
+
167
+ - **Sortable tables actually work.** `.retro-table-sortable` had working JS and
168
+ no styles, no markup anywhere in the repo, and no way to reach it from the
169
+ keyboard. Headers are now focusable and respond to Enter and Space, carry
170
+ `aria-sort`, and show a direction indicator. Columns are sniffed as numeric or
171
+ text, or declared:
172
+
173
+ ```html
174
+ <table class="retro-table retro-table-sortable">
175
+ <thead>
176
+ <tr>
177
+ <th>Name</th>
178
+ <th data-sort="number">Size</th>
179
+ <th data-sort="none">Actions</th>
180
+ </tr>
181
+ </thead>
182
+ <tbody>...</tbody>
183
+ </table>
184
+ ```
185
+
186
+ A cell can carry `data-sort-value` to sort a formatted value ("2 days ago",
187
+ "$1,204.00") by what it means. The numeric sniff is deliberately strict: a
188
+ loose `parseFloat` reads `2023-09-01` as `2023` and `SKU-001` as `-1`, which
189
+ quietly sorts a date column by year and an ID column by the digits after the
190
+ first dash.
191
+
192
+ - **Code blocks get a copy button.** `code-copy.js` was bundled but never
193
+ initialised, so `.retro-code-copy` existed only in the stylesheet. It now runs
194
+ from `RetroCSS.init()`. Outside a secure context, where
195
+ `navigator.clipboard` is undefined, it selects the code and says
196
+ `Press Ctrl+C` rather than failing silently.
197
+
198
+ - **`npm run docs:api`** renders the SassDoc blocks the SCSS has always carried
199
+ to `docs/api/`. `sassdoc` was installed and never wired up.
200
+
201
+ ## Verifying your own pages
202
+
203
+ `npm run check:pages` renders every page in the repo in real Chromium, in both
204
+ themes, at 1200/980/760/420/360px, and fails on console errors, horizontal
205
+ overflow, a missing or duplicated `h1`, contrast below AA on any rendered text,
206
+ or an input glyph off-centre. It is worth pointing at your own pages.
207
+
208
+ ---
209
+
1
210
  # Migrating to RetroCSS 2.0
2
211
 
3
212
  2.0 is an accessibility and readability release. Nothing was renamed and no
package/README.md CHANGED
@@ -175,9 +175,24 @@ Typography is tokenised the same way: `--retro-font`, `--retro-font-heading`,
175
175
  default; for a modern heading font, set
176
176
  `--retro-font-heading: 'Segoe UI', Tahoma, sans-serif;`.
177
177
 
178
- > **Upgrading from 1.x?** See [MIGRATION.md](MIGRATION.md). No classes were
179
- > renamed or removed, but 2.0 visibly restyles a few things to meet WCAG AA —
180
- > each with a one-line override.
178
+ Corners are square, because Windows 95 was. One token softens the components
179
+ that opt in — lists, dropdowns, breadcrumbs, tooltips, the search bar, the
180
+ sidebar, tabs, pagination and the file uploader:
181
+
182
+ ```css
183
+ :root { --retro-border-radius: 4px; }
184
+ ```
185
+
186
+ The core chrome — card, button, badge, table, input, modal — stays square
187
+ regardless, and `.retro-rounded` / `-lg` / `-full` still round one element at a
188
+ time.
189
+
190
+ > **Upgrading?** See [MIGRATION.md](MIGRATION.md). No class has ever been
191
+ > renamed, but 3.0 raises the body text to 16px and drops the `!important` from
192
+ > the `border-radius` reset, both of which are visible on every page — each with
193
+ > a one-line override. **On 3.0.0, upgrade to 3.0.1**: dropping that
194
+ > `!important` woke 31 dormant radius declarations and rounded eleven
195
+ > components. 2.0 restyled a few things to meet WCAG AA.
181
196
 
182
197
  ## Utilities
183
198
 
@@ -210,6 +225,13 @@ themes. `npm run check:a11y` compiles the SCSS and asserts it, and fails the
210
225
  build on a regression — it also catches any `var(--retro-*)` that resolves to
211
226
  nothing.
212
227
 
228
+ That proves the *tokens* are sound. `npm run check:pages` proves the *pages*
229
+ are: it renders every page in the repo in real Chromium, in both themes, at
230
+ 1200/980/760/420/360px, and fails on a console error, horizontal overflow, a
231
+ missing or duplicated `<h1>`, any rendered text below AA against the surface
232
+ actually painted behind it, or an input glyph off its field's centre line. Both
233
+ run in CI on every push.
234
+
213
235
  Beyond colour:
214
236
 
215
237
  - **Focus rings are `:focus-visible`.** Keyboard and assistive-tech users get a
@@ -224,6 +246,8 @@ Beyond colour:
224
246
  Tab all behave. Escape returns focus to the toggle.
225
247
  - **`prefers-reduced-motion` is honoured** — every animation and transition is
226
248
  neutralised, with the looping text effects switched off outright.
249
+ - **Sortable tables are operable.** `.retro-table-sortable` headers are
250
+ focusable, sort on Enter and Space as well as click, and carry `aria-sort`.
227
251
  - **`.retro-sr-only`** labels icon-only controls; `.retro-sr-only-focusable`
228
252
  gives you a skip link.
229
253
 
@@ -262,6 +286,25 @@ Watch for changes:
262
286
  npm run watch
263
287
  ```
264
288
 
289
+ Run the gates:
290
+
291
+ ```bash
292
+ npm run check:a11y && npm run check:radius && npm run check:pages
293
+ ```
294
+
295
+ `check:a11y` gates the tokens (every `var(--retro-*)` resolves, every
296
+ text/surface pair clears WCAG AA), `check:radius` gates the shape (nothing
297
+ hardcodes a corner behind `--retro-border-radius`), and `check:pages` gates the
298
+ rendered result across 8 pages × 2 themes × 5 widths.
299
+
300
+ `check:pages` needs a browser once: `npx playwright install chromium`.
301
+
302
+ Render the SassDoc API reference to `docs/api/`:
303
+
304
+ ```bash
305
+ npm run docs:api
306
+ ```
307
+
265
308
  ## License
266
309
 
267
310
  MIT