baseline-kit 5.0.0 → 5.2.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +243 -0
  2. package/README.md +227 -353
  3. package/dist/baseline-kit.css +5 -2
  4. package/dist/core.cjs +1 -1
  5. package/dist/core.d.ts +25 -9
  6. package/dist/core.mjs +1 -1
  7. package/dist/guide.cjs +1 -1
  8. package/dist/guide.cjs.map +1 -1
  9. package/dist/guide.css +1 -1
  10. package/dist/guide.d.ts +16 -16
  11. package/dist/guide.mjs +147 -150
  12. package/dist/guide.mjs.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +22 -12
  16. package/dist/index.mjs +169 -158
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/remix-server.d.ts +8 -0
  19. package/dist/remix-server.mjs +15 -0
  20. package/dist/remix-server.mjs.map +1 -0
  21. package/dist/remix.css +2 -0
  22. package/dist/remix.d.ts +191 -0
  23. package/dist/remix.mjs +984 -0
  24. package/dist/remix.mjs.map +1 -0
  25. package/dist/{src-QHaSfgVe.js → src-D0nL1BwZ.js} +96 -165
  26. package/dist/src-D0nL1BwZ.js.map +1 -0
  27. package/dist/src-R5usYJol.cjs +2 -0
  28. package/dist/src-R5usYJol.cjs.map +1 -0
  29. package/dist/styles.css +1 -1
  30. package/dist/theme/default.css +0 -1
  31. package/dist/theme/tokens.css +0 -1
  32. package/dist/theme.css +4 -1
  33. package/package.json +86 -37
  34. package/dist/README.md +0 -468
  35. package/dist/core/src/config/defaults.d.ts +0 -2
  36. package/dist/core/src/config/index.d.ts +0 -3
  37. package/dist/core/src/config/merge.d.ts +0 -21
  38. package/dist/core/src/config/schema.d.ts +0 -33
  39. package/dist/core/src/descriptors/baseline.d.ts +0 -26
  40. package/dist/core/src/descriptors/box.d.ts +0 -20
  41. package/dist/core/src/descriptors/guide.d.ts +0 -44
  42. package/dist/core/src/descriptors/index.d.ts +0 -5
  43. package/dist/core/src/descriptors/padder.d.ts +0 -19
  44. package/dist/core/src/descriptors/spacer.d.ts +0 -24
  45. package/dist/core/src/index.d.ts +0 -10
  46. package/dist/core/src/types.d.ts +0 -62
  47. package/dist/core/src/utils/convert.d.ts +0 -10
  48. package/dist/core/src/utils/grid.d.ts +0 -18
  49. package/dist/core/src/utils/index.d.ts +0 -8
  50. package/dist/core/src/utils/math.d.ts +0 -9
  51. package/dist/core/src/utils/merge.d.ts +0 -28
  52. package/dist/core/src/utils/normalize.d.ts +0 -13
  53. package/dist/core/src/utils/padding.d.ts +0 -2
  54. package/dist/core/src/utils/parse.d.ts +0 -5
  55. package/dist/core/src/utils/snapping.d.ts +0 -2
  56. package/dist/core/src/validation/guide.d.ts +0 -3
  57. package/dist/core/src/validation/index.d.ts +0 -1
  58. package/dist/dom/src/index.d.ts +0 -11
  59. package/dist/dom/src/measure.d.ts +0 -18
  60. package/dist/dom/src/observers.d.ts +0 -5
  61. package/dist/dom/src/ssr.d.ts +0 -20
  62. package/dist/dom/src/timing.d.ts +0 -2
  63. package/dist/dom/src/viewport.d.ts +0 -7
  64. package/dist/dom/src/virtual.d.ts +0 -23
  65. package/dist/react/src/components/Baseline/Baseline.d.ts +0 -13
  66. package/dist/react/src/components/Baseline/index.d.ts +0 -1
  67. package/dist/react/src/components/Box/Box.d.ts +0 -26
  68. package/dist/react/src/components/Box/index.d.ts +0 -1
  69. package/dist/react/src/components/Config/Config.d.ts +0 -20
  70. package/dist/react/src/components/Config/index.d.ts +0 -2
  71. package/dist/react/src/components/Guide/Guide.d.ts +0 -16
  72. package/dist/react/src/components/Guide/index.d.ts +0 -1
  73. package/dist/react/src/components/Padder/Padder.d.ts +0 -20
  74. package/dist/react/src/components/Padder/index.d.ts +0 -1
  75. package/dist/react/src/components/Spacer/Spacer.d.ts +0 -14
  76. package/dist/react/src/components/Spacer/index.d.ts +0 -1
  77. package/dist/react/src/components/index.d.ts +0 -12
  78. package/dist/react/src/components/types.d.ts +0 -29
  79. package/dist/react/src/guide.d.ts +0 -10
  80. package/dist/react/src/hooks/index.d.ts +0 -10
  81. package/dist/react/src/hooks/useBaseline.d.ts +0 -26
  82. package/dist/react/src/hooks/useConfig.d.ts +0 -9
  83. package/dist/react/src/hooks/useDebug.d.ts +0 -6
  84. package/dist/react/src/hooks/useGuide.d.ts +0 -7
  85. package/dist/react/src/hooks/useIsClient.d.ts +0 -4
  86. package/dist/react/src/hooks/useMeasure.d.ts +0 -10
  87. package/dist/react/src/hooks/useVirtual.d.ts +0 -14
  88. package/dist/react/src/index.d.ts +0 -21
  89. package/dist/react/src/utils/index.d.ts +0 -9
  90. package/dist/react/src/utils/merge.d.ts +0 -10
  91. package/dist/react/src/utils/ssr.d.ts +0 -1
  92. package/dist/src-CMjyHjX5.cjs +0 -2
  93. package/dist/src-CMjyHjX5.cjs.map +0 -1
  94. package/dist/src-QHaSfgVe.js.map +0 -1
package/README.md CHANGED
@@ -4,464 +4,338 @@
4
4
  ![npm version](https://img.shields.io/npm/v/baseline-kit)
5
5
  ![License](https://img.shields.io/github/license/dnvt/baseline-kit)
6
6
 
7
- Baseline Kit is a lightweight development tool for visualizing and debugging grid systems and spacing in React applications. It provides configurable overlays for both column-based and baseline grids, spacing primitives, and theme-aware configuration—all optimized for performance and built with TypeScript. The library is based on the "Padded Grid" concept, originally explored in [this article](http://medium.com/design-bootcamp/the-padded-grid-a-designers-hack-to-achieve-baseline-fit-fc40d022bc84) on achieving perfect baseline alignment in digital layouts.
8
-
9
- ![Demo visual](kit.png)
10
-
11
- ## Table of Contents
12
- - [Features](#features)
13
- - [Requirements](#requirements)
14
- - [Installation](#installation)
15
- - [Quick Start](#quick-start)
16
- - [Core Concepts](#core-concepts)
17
- - [Base Unit](#base-unit)
18
- - [Spacing Values](#spacing-values)
19
- - [Grid Snapping](#grid-snapping)
20
- - [Debugging Modes](#debugging-modes)
21
- - [Components](#components)
22
- - [Component Hierarchy](#component-hierarchy)
23
- - [Key Components](#key-components)
24
- - [Config](#config)
25
- - [Baseline](#baseline)
26
- - [Guide](#guide)
27
- - [Box](#box)
28
- - [Theme System](#theme-system)
29
- - [CSS Import Options](#css-import-options)
30
- - [Theme Options](#theme-options)
31
- - [Theme Variables Reference](#theme-variables-reference)
32
- - [Browser Support](#browser-support)
33
- - [React 19 Features](#react-19-features)
34
- - [Server-Side Rendering (SSR)](#server-side-rendering-ssr)
35
- - [SSR-Friendly Design](#ssr-friendly-design)
36
- - [SSR Mode Prop](#ssr-mode-prop)
37
- - [Development](#development)
38
- - [Performance Features](#performance-features)
39
- - [Contributing](#contributing)
40
- - [License](#license)
41
-
42
- ## Features
43
-
44
- - 📏 **Baseline Grid:** Core system for maintaining vertical rhythm and consistent spacing across your layouts
45
- - 🎯 **Column Grid Guide:** Customizable overlay system for visualizing column-based layouts and alignment
46
- - 📦 **Box Component:** Basic container with configurable spacing that snaps to the baseline grid
47
- - 🧱 **Padder & Spacer:** Spacing primitives with optional baseline snapping
48
- - 🎨 **Theme System:** Customizable colors and debug visuals through a centralized configuration
7
+ Baseline Kit is a development overlay and spacing toolkit for React 19. It
8
+ provides baseline and column grids, spacing primitives, scoped configuration,
9
+ and themeable debug visuals. It also ships a React-free adapter for the Remix 3
10
+ UI runtime.
11
+
12
+ ![Demo visual](https://raw.githubusercontent.com/dnvt/baseline-kit/main/kit.png)
13
+
14
+ ## What it includes
15
+
16
+ - **`Baseline`** — a horizontal baseline-grid overlay.
17
+ - **`Guide`** — a column-grid overlay with line, pattern, fixed, and auto modes.
18
+ - **`Box`**, **`Padder`**, and **`Spacer`** — spacing primitives that can align
19
+ content to the baseline grid.
20
+ - **`Config`** — scoped defaults for the base unit, colors, variants, and
21
+ debugging visibility.
22
+ - **React-free Remix support** — native `remix/ui` components with SSR,
23
+ hydration, measurement, and cleanup support.
49
24
 
50
25
  ## Requirements
51
26
 
52
- - **React 19**: Baseline Kit is built for React 19 and uses the latest React features like the `use` hook
53
- - **Modern Browsers**: Supporting the latest CSS features
27
+ - React 19 for the default and `baseline-kit/guide` entries.
28
+ - The React/core package declares Node.js 18+; native Remix requires
29
+ `remix@3.0.0-rc.2` and its Node.js 24.3+ runtime. Other Remix versions need
30
+ a compatibility check. Repository development requires Node.js 24.15+.
31
+ - TypeScript 5.8+, 6, or 7 when using TypeScript.
32
+ - A modern browser with CSS Grid and CSS custom property support.
54
33
 
55
34
  ## Installation
56
35
 
57
36
  ```shell
58
- # Using npm
59
- npm install baseline-kit
60
-
61
- # Using yarn
62
- yarn add baseline-kit
63
-
64
- # Using pnpm
65
- pnpm add baseline-kit
37
+ npm install baseline-kit react@19 react-dom@19
38
+ # or
39
+ bun add baseline-kit react@19 react-dom@19
66
40
  ```
67
41
 
68
- After installation, import the smallest entry point that matches your use case.
69
- For a development grid overlay, use the guide-only React and CSS subpaths:
70
-
71
- ```tsx
72
- import 'baseline-kit/styles/guide'
73
- import { Config, Guide } from 'baseline-kit/guide'
74
- ```
42
+ Choose the smallest entry point that matches the application:
75
43
 
76
- For frameworks like Remix that use URL imports in a links function:
44
+ | Use case | JavaScript entry | CSS entry |
45
+ | ------------------------------- | -------------------- | --------------------------------------------------- |
46
+ | React components | `baseline-kit` | `baseline-kit/styles` plus `baseline-kit/theme` |
47
+ | React guide only | `baseline-kit/guide` | `baseline-kit/styles/guide` |
48
+ | React-free Remix 3 UI | `baseline-kit/remix` | `baseline-kit/styles/remix` |
49
+ | Framework-independent utilities | `baseline-kit/core` | None |
50
+ | All React styles and theme | — | `baseline-kit/styles/full` |
51
+ | Optional reset | — | `baseline-kit/reset` or `baseline-kit/styles/reset` |
77
52
 
78
- ```tsx
79
- export const links = () => [
80
- { rel: 'stylesheet', href: 'baseline-kit/styles/guide' },
81
- ]
82
- ```
53
+ Baseline Kit includes its own TypeScript declarations. React and Remix remain
54
+ optional peer dependencies, so an application only installs the runtime it
55
+ uses.
83
56
 
84
- For the full component set, import the root package and root component styles:
57
+ ## Quick start
85
58
 
86
59
  ```tsx
87
60
  import 'baseline-kit/styles'
88
61
  import 'baseline-kit/theme'
89
- import { Config, Guide, Baseline, Box } from 'baseline-kit'
90
- ```
91
-
92
- If you prefer a single CSS file for every component plus the theme:
93
-
94
- ```tsx
95
- import 'baseline-kit/styles/full'
96
-
97
- // For Remix:
98
- export const links = () => [
99
- { rel: 'stylesheet', href: 'baseline-kit/styles/full' },
100
- ]
101
- ```
102
-
103
- The browser reset is not included by default. Import `baseline-kit/reset` or
104
- `baseline-kit/styles/reset` only when you want Baseline Kit to provide one.
105
-
106
- Baseline Kit is written in TypeScript and includes built-in type definitions—no additional packages required.
107
-
108
- ## Quick Start
109
-
110
- ```tsx
111
- import React from 'react'
112
- import { Config, Guide, Baseline, Box } from 'baseline-kit'
113
-
114
- function App() {
115
- const isDev = process.env.NODE_ENV === 'development'
116
- const debugging = isDev ? 'visible' : 'hidden'
62
+ import { Baseline, Box, Config, Guide } from 'baseline-kit'
117
63
 
64
+ export function App() {
118
65
  return (
119
66
  <Config
120
67
  base={8}
121
- baseline={{ debugging }}
122
- box={{ debugging }}
123
- guide={{ debugging }}
124
- spacer={{ debugging }}
68
+ baseline={{ debugging: 'visible' }}
69
+ guide={{ debugging: 'visible' }}
70
+ box={{ debugging: 'visible' }}
125
71
  >
126
- {/* Baseline Grid for typography alignment */}
127
- <Baseline
128
- height="100vh"
129
- debugging="visible"
130
- />
131
-
132
- {/* Column Grid Guide */}
133
- <Guide
134
- variant="pattern"
135
- columns={['100px', '200px', '100px']}
136
- gap={16}
137
- align="center"
138
- width="1200px"
139
- />
140
-
141
- {/* Box with baseline alignment */}
142
- <Box
143
- block={[2, 5]}
144
- debugging="visible"
145
- >
146
- <h1>Content Aligned to the Grid</h1>
147
- </Box>
148
-
149
- <main>Your main content goes here...</main>
72
+ <main style={{ position: 'relative', height: '100vh' }}>
73
+ <Baseline height="100%" />
74
+ <Guide variant="fixed" columns={12} width="100%" />
75
+ <Box block={[16, 24]} snapping="height">
76
+ Content aligned to the grid
77
+ </Box>
78
+ </main>
150
79
  </Config>
151
80
  )
152
81
  }
153
82
  ```
154
83
 
155
- ## Core Concepts
84
+ ## Core concepts
156
85
 
157
- ### Base Unit
86
+ ### Base unit and sizing
158
87
 
159
- The base unit is the foundation of Baseline Kit's spacing system. All measurements are calculated as multiples of this
160
- unit:
88
+ `base` is the baseline interval in CSS pixels; it defaults to `8`. Numeric
89
+ spacing values are CSS pixel values, not multipliers. CSS dimensions such as
90
+ `100vh`, `50%`, `1rem`, and `calc(...)` on Baseline dimensions remain relative
91
+ and are resolved by the browser. Overlays are absolutely positioned: give their
92
+ parent `position: relative` and a definite height for percentage heights.
161
93
 
162
94
  ```tsx
163
- <Config base={8}> // Sets 8px as the base unit
164
- <Padder
165
- block={17} // Will be rounded to 16px (2 * base)
166
- inline={22} // Will be rounded to 24px (3 * base)
167
- >
168
- {/* Content automatically aligned to the 8px grid */}
95
+ <Config base={8}>
96
+ <Padder block={[16, 24]} inline={{ start: 8, end: 16 }}>
97
+ Content
169
98
  </Padder>
170
99
  </Config>
171
100
  ```
172
101
 
173
- ### Spacing Values
102
+ Spacing props accept the following shapes:
174
103
 
175
- Spacing props (`block`, `inline`, `gap`) accept values in three formats:
104
+ - `padding={16}` — all four sides.
105
+ - `padding={[8, 16]}` — 8px top/bottom and 16px left/right; three- and
106
+ four-value arrays follow CSS padding shorthand.
107
+ - `block={[16, 24]}` — block-start and block-end.
108
+ - `inline={{ start: 8, end: 16 }}` — inline-start and inline-end.
176
109
 
177
- ```
178
- // Single number (applies to both sides)
179
- block={16} // 16px top and bottom
180
-
181
- // Array [start, end]
182
- block={[2, 3]} // 2px top, 3px bottom
110
+ ### Grid snapping
183
111
 
184
- // Object with explicit values
185
- block={{ start: 2, end: 3 }} // Same as above
186
- ```
112
+ `Box` defaults to `snapping="clamp"`. `height` adds spacing to round the measured
113
+ height up to the next base interval; it adds that correction to the bottom by
114
+ default. Use `snapEdge="top"` with `snapping="height"` when the text's trimmed
115
+ alphabetic edge should stay anchored while the top padding absorbs the
116
+ correction. `snapEdge="bottom"` is the explicit equivalent of the default.
117
+ `clamp` reduces the top and bottom spacing modulo the base, and
118
+ `snapping="none"` keeps explicit spacing. Snapping happens once after the first
119
+ nonzero measurement, not continuously on resize. `Padder` uses height snapping
120
+ with bottom correction in both adapters. Set `ssrMode` on Padder to retain
121
+ explicit padding without applying its measured snap.
187
122
 
188
- ### Grid Snapping
123
+ ### Debugging modes
189
124
 
190
- Components automatically adjust their spacing to maintain baseline grid alignment:
125
+ Every visual component supports one of these modes:
191
126
 
192
- - **Box**: Adjusts bottom padding to ensure total height aligns with base unit
193
- - **Padder**: Snaps padded content to baseline-aligned multiples of the base unit
127
+ - `visible` — render and show the debug visual.
128
+ - `hidden` — hide debug paint while preserving content and spacing.
129
+ - `none` — disable debug paint and use ordinary padding instead of debug spacers.
194
130
 
195
- ### Debugging Modes
196
-
197
- Three modes are available for development and testing:
198
-
199
- ```tsx
200
- debugging = "visible" // Shows all grid lines and measurements
201
- debugging = "hidden" // Elements exist but are invisible
202
- debugging = "none" // Removes debug elements entirely
203
- ```
131
+ Baseline and Guide keep an empty host in both hidden modes. They are debug
132
+ overlays marked `aria-hidden`; keep meaningful application content outside them.
204
133
 
205
134
  ## Components
206
135
 
207
- ### Component Hierarchy
208
-
209
- #### 1. Spacing primitives
210
-
211
- - **`Box`** Basic container that snaps its height to the baseline grid
212
- - **`Padder`** Padding wrapper that snaps padded content to baseline multiples
213
- - **`Spacer`** Fixed-size spacer with optional measurement indicator overlay
214
-
215
- #### 2. Debug overlays
216
-
217
- - **`Baseline`** Horizontal baseline-grid overlay
218
- - **`Guide`** Column-grid overlay (line / pattern / fixed / auto variants)
219
-
220
- #### 3. Configuration
221
-
222
- - **`Config`** Theme and settings provider (base unit, colors, debug modes)
223
-
224
- ### Key Components
225
-
226
- #### Config
227
-
228
- ```tsx
229
- <Config
230
- base={8} // Base unit for calculations
231
- baseline={{ debugging }} // Baseline grid visibility
232
- guide={{ debugging }} // Guide customization
233
- >
234
- {children}
235
- </Config>
236
- ```
136
+ | Component | Purpose |
137
+ | ---------- | ------------------------------------------------------------- |
138
+ | `Config` | Supplies scoped base, variant, color, and debugging defaults. |
139
+ | `Baseline` | Renders horizontal baseline rows. |
140
+ | `Guide` | Renders a responsive or fixed column guide. |
141
+ | `Box` | Wraps content and optionally snaps its measured height. |
142
+ | `Padder` | Adds baseline-aware padding and optional measurement spacers. |
143
+ | `Spacer` | Adds a fixed-size spacer with an optional debug indicator. |
237
144
 
238
- #### Baseline
145
+ `Box` and `Padder` use `text-box-trim: trim-both` and
146
+ `text-box-edge: ex alphabetic` where the browser supports them, keeping text
147
+ edges aligned to the x-height and alphabetic baseline. Unsupported browsers
148
+ retain normal text layout. Trimming does not remove child margins or change a
149
+ nested heading's own line-box rules.
150
+ For nested text, set the same properties on its text container. See the
151
+ [CSS text-box-edge reference](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-box-edge)
152
+ for browser compatibility and alternative metrics such as `ex alphabetic`.
239
153
 
240
- ```tsx
241
- <Baseline
242
- height="100vh" // Overlay height
243
- variant="line" // "line" or "flat"
244
- debugging="visible" // Show the grid overlay
245
- />
246
- ```
247
-
248
- #### Guide
249
-
250
- ```tsx
251
- <Guide
252
- variant="pattern" // "line", "pattern", "fixed", or "auto"
253
- columns={['100px', '1fr', '100px']} // Column definition
254
- gap={8} // Gap value
255
- width="1200px" // Container width
256
- />
257
- ```
154
+ ## Styles and themes
258
155
 
259
- #### Box
156
+ Import styles explicitly so applications control their CSS footprint:
260
157
 
261
158
  ```tsx
262
- <Box
263
- block={[2, 5]} // Vertical padding in base units
264
- span={2} // Grid column span when placed in a CSS grid parent
265
- snapping="height" // "none", "height", or "clamp"
266
- >
267
- <p>Content aligned to baseline grid</p>
268
- </Box>
269
- ```
270
-
271
- ## Theme System
272
-
273
- Baseline Kit comes with a flexible CSS structure and theming system:
274
-
275
- 1. `guide.css` - Guide-only overlay styles (imported via `baseline-kit/styles/guide`)
276
- 2. `styles.css` - Root component styles and base variables (imported via `baseline-kit/styles`)
277
- 3. `theme.css` - Color variables and theming with automatic dark mode support (imported via `baseline-kit/theme`)
278
- 4. `reset.css` - Optional browser reset (imported via `baseline-kit/reset` or `baseline-kit/styles/reset`)
279
- 5. `baseline-kit.css` - Combined root component styles and theme (imported via `baseline-kit/styles/full`)
280
-
281
- ### CSS Import Options
282
-
283
- Baseline Kit gives you flexibility in how you include the styles:
284
-
285
- ```tsx
286
- // Guide-only overlay styles
287
- import 'baseline-kit/styles/guide'
288
-
289
- // Root component styles and theme separately
159
+ // React component styles and the default light/dark theme
290
160
  import 'baseline-kit/styles'
291
161
  import 'baseline-kit/theme'
292
162
 
293
- // Root component styles and theme in one file
163
+ // Or one combined file
294
164
  import 'baseline-kit/styles/full'
295
165
 
166
+ // Guide-only styles
167
+ import 'baseline-kit/styles/guide'
168
+
296
169
  // Optional reset
297
170
  import 'baseline-kit/reset'
298
171
  ```
299
172
 
300
- ### Theme Options
301
-
302
- You now have four options for using the theme system:
173
+ The built-in theme follows `prefers-color-scheme`. For a fixed theme, import
174
+ `baseline-kit/theme/default` or `baseline-kit/theme/dark`. For a custom theme,
175
+ copy the token template from `baseline-kit/theme/tokens` and define the CSS
176
+ variables your application needs.
303
177
 
304
- #### 1. Use the Built-in Theme (with automatic dark mode)
178
+ Use `Config` for scoped overrides:
305
179
 
306
180
  ```tsx
307
- import 'baseline-kit/theme' // Default theme with light/dark mode support
181
+ <Config
182
+ base={8}
183
+ baseline={{
184
+ colors: {
185
+ line: 'rgba(255, 0, 0, 0.1)',
186
+ flat: 'rgba(255, 0, 0, 0.05)',
187
+ },
188
+ }}
189
+ >
190
+ {children}
191
+ </Config>
308
192
  ```
309
193
 
310
- #### 2. Use Specific Theme Variants
194
+ Theme variables are grouped by component:
311
195
 
312
- ```tsx
313
- // Use only the light theme (no dark mode)
314
- import 'baseline-kit/theme/default'
196
+ | Component | Variable prefix |
197
+ | --------- | ----------------------- |
198
+ | Baseline | `--bk-baseline-color-*` |
199
+ | Guide | `--bk-guide-color-*` |
200
+ | Box | `--bk-box-color-*` |
201
+ | Spacer | `--bk-spacer-color-*` |
202
+ | Padder | `--bk-padder-color-*` |
315
203
 
316
- // Use only the dark theme
317
- import 'baseline-kit/theme/dark'
204
+ See the [token template](https://github.com/dnvt/baseline-kit/blob/main/packages/react/src/components/styles/theme/tokens.css)
205
+ for the complete list.
318
206
 
319
- // Example: Apply dark theme regardless of system preference
320
- import 'baseline-kit/styles'
321
- import 'baseline-kit/theme/dark'
322
- ```
207
+ ## Remix 3 UI runtime
323
208
 
324
- #### 3. Create a Custom Theme
209
+ For Node SSR, use **`baseline-kit/remix/server`**, not `remix/ui/server`.
210
+ The pinned Remix RC loses provider context while serializing component-valued
211
+ children. This server entry corrects that traversal in an isolated renderer,
212
+ preserving nested `Config` scopes even when app or library entries hydrate late.
213
+ It does not change files in `node_modules` or install process-wide module hooks.
325
214
 
326
- You can use the tokens template as a starting point:
215
+ This is a Node-only compatibility entry, not an edge/browser renderer. It loads
216
+ the installed `@remix-run/ui@0.9.0` server implementation and verifies its exact
217
+ SHA-256 before applying the correction in memory. Keep the installed Remix
218
+ runtime files available in production; do not use a standalone bundle that
219
+ omits them. Modified or upgraded implementations fail with an explicit error
220
+ until compatibility is revalidated. Import `ImportMap` from this same entry if
221
+ used; `Frame` and client components still come from `remix/ui`.
327
222
 
328
223
  ```tsx
329
- // First check the token template to see available variables
330
- import 'baseline-kit/theme/tokens' // Just for reference (contains no values)
331
- ```
224
+ import { renderToStream, ImportMap } from 'baseline-kit/remix/server'
332
225
 
333
- Then create your own custom theme file:
226
+ // If app contains an ImportMap component, use the export above.
227
+ const stream = renderToStream(app, { resolveClientEntry })
228
+ return new Response(stream, { headers: { 'Content-Type': 'text/html' } })
229
+ ```
334
230
 
335
- ```css
336
- /* yourCustomTheme.css */
337
- :root {
338
- /* Component-specific colors */
339
- --bk-baseline-color-line-theme: hsla(210, 100%, 50%, 0.15);
340
- --bk-baseline-color-flat-theme: hsla(270, 100%, 60%, 0.2);
341
- /* Add other component colors as needed */
342
- }
231
+ The React-free adapter uses `remix/ui` and does not import React or React DOM:
343
232
 
344
- /* Optional dark mode support */
345
- @media (prefers-color-scheme: dark) {
346
- :root {
347
- --bk-baseline-color-line-theme: hsla(210, 100%, 50%, 0.2);
348
- }
349
- }
233
+ ```shell
234
+ npm install baseline-kit remix@3.0.0-rc.2
350
235
  ```
351
236
 
352
- Then import your custom theme:
353
-
354
237
  ```tsx
355
- import 'baseline-kit/styles' // Required component styles
356
- import './path/to/yourCustomTheme.css' // Your custom theme
238
+ import 'baseline-kit/styles/remix'
239
+ import { Baseline, Box, Config, Guide, Spacer } from 'baseline-kit/remix'
240
+ import { jsx } from 'remix/ui/jsx-runtime'
241
+
242
+ export function App() {
243
+ return jsx(Config, {
244
+ base: 8,
245
+ baseline: { debugging: 'visible' },
246
+ children: [
247
+ jsx(Baseline, { height: '100vh' }),
248
+ jsx(Guide, { variant: 'fixed', columns: 12 }),
249
+ jsx(Box, { children: 'Native Remix content' }),
250
+ jsx(Spacer, { height: 16, variant: 'flat' }),
251
+ ],
252
+ })
253
+ }
357
254
  ```
358
255
 
359
- #### 4. Override via Config
256
+ The `resolveClientEntry` callback needs an app-owned mapping from each entry to a **browser-served
257
+ JavaScript asset**. A server filesystem URL or bare npm specifier is not a
258
+ browser asset. The mapping must handle the app's own client entries as well.
259
+ See the runnable [server resolver](https://github.com/dnvt/baseline-kit/blob/main/tests/browser/remix-ssr.ts)
260
+ and [asset-serving fixture](https://github.com/dnvt/baseline-kit/blob/main/tests/browser/vite.config.ts).
360
261
 
361
- For minor adjustments, use the Config component:
262
+ Once the server supplies public URLs, load the actual module and named export:
362
263
 
363
264
  ```tsx
364
- <Config
365
- baseline={{
366
- colors: {
367
- line: 'rgba(255,0,0,0.1)', // Custom red baseline lines
368
- flat: 'rgba(255,0,0,0.05)', // Custom red baseline backgrounds
369
- }
370
- }}
371
- >
372
- {/* Your components here */}
373
- </Config>
265
+ import { run } from 'remix/ui'
266
+ run({
267
+ loadModule: async (moduleUrl, exportName) => {
268
+ const module = await import(
269
+ /* @vite-ignore */ new URL(moduleUrl, document.baseURI).href
270
+ )
271
+ return module[exportName]
272
+ },
273
+ })
374
274
  ```
375
275
 
376
- ### Theme Variables Reference
377
-
378
- | Component | Variable Pattern | Purpose |
379
- |-----------|-----------------|---------|
380
- | Baseline | `--bk-baseline-color-[line/flat]-theme` | Colors for lines and backgrounds |
381
- | Guide | `--bk-guide-color-[line/pattern/auto/fixed]-theme` | Colors for different guide variants |
382
- | Box | `--bk-box-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
383
- | Spacer | `--bk-spacer-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
384
- | Padder | `--bk-padder-color-theme` | Padder edge color |
385
-
386
- See the [tokens file](https://github.com/dnvt/baseline-kit/blob/main/dist/theme/tokens.css) for a complete list of available variables.
387
-
388
- ## Browser Support
276
+ Callbacks such as `indicatorNode` must be created inside the hydrated module;
277
+ functions cannot cross an SSR client-entry boundary. Keep `Config` and its
278
+ consumers within an app-owned hydrated component for interactive config updates.
279
+ This adapter is separate from React-based Remix/React Router applications,
280
+ which use the regular React entry.
389
281
 
390
- - Modern browsers (Chrome, Firefox, Safari, Edge)
391
- - Requires CSS Grid Layout support and CSS Custom Properties
392
- - Falls back gracefully in unsupported browsers
282
+ In a Vite-based React application with a `links()` function, import the CSS as a
283
+ URL; a bare package specifier in `href` will not resolve:
393
284
 
394
- ## React 19 Features
395
-
396
- Baseline Kit leverages React 19's latest features:
397
- - **`use` Hook**: Replaces `useContext` for better performance and cleaner code
398
- - **Streamlined Context API**: Uses the simplified Context Provider syntax
399
- - **JSX Transform**: Takes advantage of the mandatory JSX transform in React 19
400
-
401
- These modern features allow for cleaner code and better performance, but require React 19.
402
-
403
- ## Server-Side Rendering (SSR)
404
-
405
- Baseline Kit is fully compatible with React's Server-Side Rendering in frameworks like Next.js, Remix, and other React Router-based applications.
285
+ ```tsx
286
+ import stylesheetUrl from 'baseline-kit/styles?url'
406
287
 
407
- ### SSR-Friendly Design
288
+ export const links = () => [{ rel: 'stylesheet', href: stylesheetUrl }]
289
+ ```
408
290
 
409
- Components are designed to:
410
- - Provide consistent rendering between server and client
411
- - Avoid hydration mismatches by using deterministic initial values
412
- - Progressively enhance with client-side measurements after hydration
413
- - Work with frameworks that use streaming SSR
291
+ See [Vite's explicit URL imports](https://vite.dev/guide/assets.html#explicit-url-imports).
414
292
 
415
- ### SSR Mode Prop
293
+ ## Server-side rendering
416
294
 
417
- Components accept an `ssrMode` prop to explicitly optimize for server rendering:
295
+ React Baseline/Guide begin with a hidden fallback, then measure and paint after
296
+ hydration. Native Remix uses client-entry SSR and hydration through the resolver
297
+ above. `ssrMode` on Baseline/Guide **keeps the hidden fallback permanently** while
298
+ true: it disables client measurement and rows/columns. Leave it false (the
299
+ default) for visible, interactive overlays:
418
300
 
419
301
  ```tsx
420
- <Baseline
421
- height="100vh"
422
- ssrMode={true}
423
- debugging="visible"
424
- />
302
+ <Baseline height="100vh" ssrMode debugging="visible" />
425
303
  ```
426
304
 
427
- With `ssrMode` enabled, components use simplified rendering during SSR and initial hydration, then enhance with full features after client-side hydration completes.
428
- For debug overlays such as `Guide` and `Baseline`, `ssrMode` keeps the simplified fallback markup to avoid client measurement and row/column rendering in SSR-sensitive paths.
429
-
430
305
  ## Development
431
306
 
432
307
  ```shell
433
- # Clone the repository
434
- git clone --recurse-submodules https://github.com/dnvt/baseline-kit.git
435
-
436
- # If you already cloned without submodules
437
- git submodule update --init --recursive
438
-
439
- # Install dependencies
440
- bun install
308
+ git clone https://github.com/dnvt/baseline-kit.git
309
+ cd baseline-kit
310
+ bun install --frozen-lockfile
311
+
312
+ bun run typecheck
313
+ bun run lint:check
314
+ bun run test:unit
315
+ bun run build
316
+ bun run test:integration:remix
317
+ ```
441
318
 
442
- # Start development server
443
- bun run dev
319
+ Run the Chromium and WebKit browser regressions locally with:
444
320
 
445
- # Run tests
446
- bun run test
321
+ ```shell
322
+ bun run test:browser -- --project=chromium --project=webkit
447
323
  ```
448
324
 
449
- The `.maestro/source` directory is a workflow submodule. Generated local
450
- workflow surfaces such as `.claude/`, `maestro/`, `progress/`, and `plans/` are
451
- ignored. Do not run the Maestro layout migration until the submodule source is
452
- mounted at `.maestro/source` and the migration plan has been reviewed.
325
+ For the release-equivalent browser gate, use three zero-retry passes:
453
326
 
454
- ## Performance Features
327
+ ```shell
328
+ bun run test:browser:repeat
329
+ ```
455
330
 
456
- - Virtualizes large grid overlays
457
- - Client-side only rendering for dynamic components
458
- - Optimized resize event handling
459
- - Optimizes re-renders using React.memo and useMemo
460
- - Supports tree-shaking for minimal bundle size
331
+ The release workflow runs that gate across Chromium, Firefox, and WebKit,
332
+ builds the package, verifies the packed Remix fixture three times, and
333
+ publishes through Changesets after all verification gates pass.
461
334
 
462
335
  ## Contributing
463
336
 
464
- Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
337
+ See [CONTRIBUTING.md](https://github.com/dnvt/baseline-kit/blob/main/CONTRIBUTING.md) for contribution and pull-request
338
+ guidelines.
465
339
 
466
340
  ## License
467
341