nitro-web 0.3.29 → 0.3.30

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.
@@ -13,6 +13,10 @@
13
13
  /* ---- Tailwind UI Components ---------- */
14
14
 
15
15
  @layer base {
16
+ /* Stops the parent line height stretching labels in standards mode */
17
+ label {
18
+ display: block;
19
+ }
16
20
  .border-bottom-with-space {
17
21
  @apply relative mb-[6px] after:content-[""] after:absolute after:bottom-[-4px] after:left-0 after:h-[1px] after:w-full after:bg-border;
18
22
  }
@@ -13,7 +13,7 @@ export function Dashboard() {
13
13
  <p className="mb-4">
14
14
  Welcome to Nitro, a modular React/Express base project, styled using Tailwind 🚀.
15
15
  </p>
16
- <p className="text-foreground">
16
+ <p className="flex text-foreground">
17
17
  <span className={`inline-flex items-center gap-x-1.5 rounded-md ${bgColor} px-1.5 py-0.5 text-xs font-medium ${textColor}`}>
18
18
  <svg viewBox="0 0 6 6" aria-hidden="true" className={`size-1.5 ${fillColor}`}>
19
19
  <circle r={3} cx={3} cy={3} />
@@ -112,6 +112,7 @@ export function Calendar({ value, numberOfMonths, month: monthProp, className, p
112
112
  classNames: {
113
113
  root: `${d.root} flex nitro-calendar`,
114
114
  months: `${d.months} flex-nowrap`,
115
+ month_grid: `${d.month_grid} text-[16px] leading-[normal]`,
115
116
  month_caption: `${d.month_caption} text-2xs pl-2`,
116
117
  caption_label: `${d.caption_label} z-auto`,
117
118
  button_previous: `${d.button_previous} size-8`,// [&:hover>svg]:fill-input-border-focus`,
@@ -75,7 +75,7 @@ export function Checkbox({
75
75
  checked={value}
76
76
  className={
77
77
  twMerge(
78
- `${type === 'radio' ? 'rounded-full' : 'rounded'} appearance-none border border-input-border bg-checkbox-bg forced-colors:appearance-auto disabled:border-input-border disabled:bg-input-disabled-bg disabled:checked:bg-input-disabled-bg focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ` +
78
+ `block ${type === 'radio' ? 'rounded-full' : 'rounded'} appearance-none border border-input-border bg-checkbox-bg forced-colors:appearance-auto disabled:border-input-border disabled:bg-input-disabled-bg disabled:checked:bg-input-disabled-bg focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ` +
79
79
  // Variable-selected theme colors (was .*-blue-600)
80
80
  'checked:border-variable-selected checked:bg-variable-selected indeterminate:border-variable-selected indeterminate:bg-variable-selected focus-visible:outline-variable-selected ' +
81
81
  // Dark mode not used yet... dark:focus-visible:outline-blue-800
@@ -404,9 +404,9 @@ export function Styleguide({ className, elements, children, currencies, groups }
404
404
  <div>
405
405
  <Heading>Loading Elements</Heading>
406
406
  <div class="flex flex-wrap gap-x-6 gap-y-4 items-center mb-6">
407
- <div><Spinner /></div>
408
- <div><Spinner className="border-secondary" /></div>
409
- <div><Spinner className="border-primary border-[3px]" /></div>
407
+ <div className="flex"><Spinner /></div>
408
+ <div className="flex"><Spinner className="border-secondary" /></div>
409
+ <div className="flex"><Spinner className="border-primary border-[3px]" /></div>
410
410
  <div><LoadingWithDots message="Loading" /></div>
411
411
  </div>
412
412
  </div>
@@ -767,7 +767,7 @@ export function Styleguide({ className, elements, children, currencies, groups }
767
767
  {/* <div className="mt-2.5 mb-6 mt-input-before mb-input-after pt-2"> */}
768
768
  <TimePicker
769
769
  value={state.time}
770
- className="min-h-[150] mt-2.5 mb-6 mt-input-before mb-input-after pt-2"
770
+ className="min-h-[150px] mt-2.5 mb-6 mt-input-before mb-input-after pt-2"
771
771
  onChange={(value) => onChange({ target: { name: 'time', value: value }}, setState)}
772
772
  // Testing timezone support:
773
773
  // tz="Pacific/Honolulu"
@@ -0,0 +1,62 @@
1
+ # Doctype migration
2
+
3
+ Apps without `<!DOCTYPE html>` render in quirks mode. Adding it switches to standards mode, which changes how some things look. This guide covers what to look for, how nitro fixed it in the example app, and how to check nothing changed.
4
+
5
+ ## What changes
6
+
7
+ 1. Page height: in quirks mode the body always fills the screen. In standards mode it's only as tall as its content, so short pages stop partway down and percentage heights like `min-h-full` or `min-h-[100%]` no longer resolve.
8
+ 2. Tables: in quirks mode tables don't inherit font size or line height (they use the browser default, 16px and `normal`). In standards mode they inherit from the page.
9
+ 3. Line heights: in quirks mode a line holding only an icon, checkbox, spinner or inline block shrinks to fit it. In standards mode it always reserves the parent's full line height, adding a few pixels.
10
+ 4. Labels: a label above an input gets the same extra line height, pushing the input down.
11
+ 5. Unitless lengths: quirks mode reads `min-h-[150]` as 150px. Standards mode ignores it.
12
+ 6. Table cells: quirks mode counts padding and border inside a fixed height on `display: table-cell` elements. Standards mode adds them on top.
13
+
14
+ ## Fixes used in nitro
15
+
16
+ These are guidelines from the example app, Tracform and Crosby, not fixed rules. Each app's markup differs, so use whichever fix keeps the pixels identical there.
17
+
18
+ 1. Page height: use `min-h-screen` on the layout wrapper instead of `min-h-full` or `min-h-[100%]`.
19
+ 2. Tables: set the size on the table itself, e.g. the calendar's `text-[16px] leading-[normal]` in `calendar.tsx`.
20
+ 3. Line heights: make the wrapper `flex`, or the element `block`, so there's no line box, e.g. the checkbox input and the spinner wrappers.
21
+ 4. Labels: `label { display: block; }` is in core `components.css`, so apps don't need their own rule. Classes on a label (`flex`, `block truncate`) still override it. The text and inputs render the same, only the invisible label box changes: it spans the full row and is the full line height (e.g. 19px instead of 17px).
22
+ 5. Unitless lengths: add the unit, e.g. `min-h-[150px]`. Search for them with:
23
+ ```bash
24
+ grep -rnoE "\b(m|p|w|h|min-w|min-h|max-w|max-h|top|left|gap)[a-z-]*-\[-?[0-9.]+\]" components client
25
+ ```
26
+ 6. Table cells: take the padding and border off the height, e.g. `h-[38px] py-[6px] border-b` becomes `h-[25px] py-[6px] border-b`. Where some rows drop the border (e.g. a dragged row with `!border-b-0`), putting the height on the `table-row` instead can work better, as Crosby does.
27
+ 7. Chips and tags: an inline block chip alone on a line can take `align-top`. An `inline-flex` tag in a table cell can become `flex w-fit`, though a right aligned column then needs a wrapper like `innerClassName: '[&>div]:flex [&>div]:justify-end'`. A textarea in a bordered box usually wants `block`.
28
+ 8. Small dots in a table cell: `align-top` won't shrink the line below the parent's line height, so a flex wrapper is easier, e.g. `innerClassName: '[&>div]:flex [&>div]:justify-center'`.
29
+ 9. Inline blocks inside a link in a flex heading, e.g. Crosby's order number badge in the breadcrumb: making the link `flex` keeps it in place.
30
+ 10. Text in a different font alone in a cell, e.g. a `font-mono` code: making the span `block` stops it sitting 1px lower.
31
+
32
+ Known differences:
33
+ - A chip plus text label that wraps in a narrow select menu gets rows 1.42px taller. We kept this, since the quirks spacing was the uneven one.
34
+ - A `<br />` on its own empty line gets a 0x18 box (0x0 in quirks). Pixels are the same, e.g. the 404 page.
35
+ - Spans made `block` (point 10) get a taller, full width box, like labels. Pixels are the same.
36
+
37
+ Most of these render the same in quirks mode, so they can land before the doctype. The table cell heights only work in standards mode, so they land with it.
38
+
39
+ ## Checking nothing changed
40
+
41
+ Use a visual regression loop: capture every page before the change, make the change, then compare with zero tolerance and keep fixing until nothing differs. For example, a Claude Code skill like `visual-qa-loop` paired with a reviewer agent.
42
+
43
+ 1. Baseline: run the app without the doctype and capture every page.
44
+ 2. Noise check: capture again with no change. Anything that differs (clocks, random data) gets frozen or hidden, then retake the baseline.
45
+ 3. Change: add the doctype and the fixes above.
46
+ 4. Compare: capture again and diff against the baseline. Repeat fixing until it passes.
47
+ 5. Review: have a separate reviewer click through both versions side by side for anything the capture missed.
48
+
49
+ What to capture:
50
+ - Every route, with real ids from the dev database. List them from the code (e.g. grep the `.route` objects), since nested pages like purchase orders are easy to miss.
51
+ - Interactive states: open dropdowns, selects, date and time pickers, modals, drawers, notifications, form errors, row selection, hovers.
52
+ - Three widths, e.g. 1440, 768 and 375.
53
+ - Short pages and tall pages, to check backgrounds and sidebars still reach the bottom.
54
+
55
+ How to compare:
56
+ - 2x lossless screenshots, pixel diff with zero tolerance.
57
+ - Every element's exact box (unrounded) and computed styles: font size, line height, colour, padding, margin.
58
+ - Freeze the browser clock so date and time pickers render the same.
59
+ - Disable animations and move the mouse away after clicks.
60
+ - To baseline a page or state you missed, check out the original app code, capture it, then put your changes back. To quickly compare one element, strip the doctype from the HTML response instead (e.g. a Playwright route), so the same build renders in both modes.
61
+
62
+ Shared core changes must also be checked in every app still in quirks mode, so they stay identical there too.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
4
4
  "repository": "github:boycce/nitro-web",
5
5
  "homepage": "https://boycce.github.io/nitro-web/",
6
6
  "description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",