baseline-kit 3.0.1 → 5.0.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 (123) hide show
  1. package/README.md +99 -63
  2. package/dist/README.md +99 -63
  3. package/dist/baseline-kit.css +3 -21
  4. package/dist/core/src/config/defaults.d.ts +2 -0
  5. package/dist/core/src/config/index.d.ts +3 -0
  6. package/dist/core/src/config/merge.d.ts +21 -0
  7. package/dist/core/src/config/schema.d.ts +33 -0
  8. package/dist/core/src/descriptors/baseline.d.ts +26 -0
  9. package/dist/core/src/descriptors/box.d.ts +20 -0
  10. package/dist/core/src/descriptors/guide.d.ts +44 -0
  11. package/dist/core/src/descriptors/index.d.ts +5 -0
  12. package/dist/core/src/descriptors/padder.d.ts +19 -0
  13. package/dist/core/src/descriptors/spacer.d.ts +24 -0
  14. package/dist/core/src/index.d.ts +10 -0
  15. package/dist/core/src/types.d.ts +62 -0
  16. package/dist/core/src/utils/convert.d.ts +10 -0
  17. package/dist/core/src/utils/grid.d.ts +18 -0
  18. package/dist/{utils → core/src/utils}/index.d.ts +2 -9
  19. package/dist/core/src/utils/math.d.ts +9 -0
  20. package/dist/core/src/utils/merge.d.ts +28 -0
  21. package/dist/core/src/utils/normalize.d.ts +13 -0
  22. package/dist/core/src/utils/padding.d.ts +2 -0
  23. package/dist/core/src/utils/parse.d.ts +5 -0
  24. package/dist/core/src/utils/snapping.d.ts +2 -0
  25. package/dist/core/src/validation/guide.d.ts +3 -0
  26. package/dist/core/src/validation/index.d.ts +1 -0
  27. package/dist/core.cjs +1 -0
  28. package/dist/core.d.ts +344 -0
  29. package/dist/core.mjs +2 -0
  30. package/dist/dom/src/index.d.ts +11 -0
  31. package/dist/dom/src/measure.d.ts +18 -0
  32. package/dist/dom/src/observers.d.ts +5 -0
  33. package/dist/{utils → dom/src}/ssr.d.ts +0 -6
  34. package/dist/dom/src/timing.d.ts +2 -0
  35. package/dist/dom/src/viewport.d.ts +7 -0
  36. package/dist/dom/src/virtual.d.ts +23 -0
  37. package/dist/guide.cjs +2 -0
  38. package/dist/guide.cjs.map +1 -0
  39. package/dist/guide.css +2 -0
  40. package/dist/guide.d.ts +146 -0
  41. package/dist/guide.mjs +589 -0
  42. package/dist/guide.mjs.map +1 -0
  43. package/dist/index.cjs +2 -2
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.ts +197 -30
  46. package/dist/index.mjs +614 -1747
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/react/src/components/Baseline/Baseline.d.ts +13 -0
  49. package/dist/react/src/components/Baseline/index.d.ts +1 -0
  50. package/dist/react/src/components/Box/Box.d.ts +26 -0
  51. package/dist/react/src/components/Box/index.d.ts +1 -0
  52. package/dist/react/src/components/Config/Config.d.ts +20 -0
  53. package/dist/react/src/components/Config/index.d.ts +2 -0
  54. package/dist/react/src/components/Guide/Guide.d.ts +16 -0
  55. package/dist/react/src/components/Guide/index.d.ts +1 -0
  56. package/dist/react/src/components/Padder/Padder.d.ts +20 -0
  57. package/dist/react/src/components/Padder/index.d.ts +1 -0
  58. package/dist/react/src/components/Spacer/Spacer.d.ts +14 -0
  59. package/dist/react/src/components/Spacer/index.d.ts +1 -0
  60. package/dist/{components → react/src/components}/index.d.ts +1 -5
  61. package/dist/react/src/components/types.d.ts +29 -0
  62. package/dist/react/src/guide.d.ts +10 -0
  63. package/dist/{hooks → react/src/hooks}/index.d.ts +2 -3
  64. package/dist/react/src/hooks/useBaseline.d.ts +26 -0
  65. package/dist/react/src/hooks/useConfig.d.ts +9 -0
  66. package/dist/react/src/hooks/useDebug.d.ts +6 -0
  67. package/dist/react/src/hooks/useGuide.d.ts +7 -0
  68. package/dist/{hooks → react/src/hooks}/useIsClient.d.ts +0 -2
  69. package/dist/react/src/hooks/useMeasure.d.ts +10 -0
  70. package/dist/react/src/hooks/useVirtual.d.ts +14 -0
  71. package/dist/react/src/index.d.ts +21 -0
  72. package/dist/react/src/utils/index.d.ts +9 -0
  73. package/dist/react/src/utils/merge.d.ts +10 -0
  74. package/dist/react/src/utils/ssr.d.ts +1 -0
  75. package/dist/reset.css +43 -0
  76. package/dist/src-CMjyHjX5.cjs +2 -0
  77. package/dist/src-CMjyHjX5.cjs.map +1 -0
  78. package/dist/src-QHaSfgVe.js +619 -0
  79. package/dist/src-QHaSfgVe.js.map +1 -0
  80. package/dist/styles.css +1 -1
  81. package/dist/theme/dark.css +0 -8
  82. package/dist/theme/default.css +0 -9
  83. package/dist/theme/tokens.css +1 -10
  84. package/dist/theme.css +0 -18
  85. package/package.json +82 -42
  86. package/dist/components/Baseline/Baseline.d.ts +0 -48
  87. package/dist/components/Baseline/index.d.ts +0 -6
  88. package/dist/components/Box/Box.d.ts +0 -73
  89. package/dist/components/Box/index.d.ts +0 -6
  90. package/dist/components/Config/Config.d.ts +0 -179
  91. package/dist/components/Config/defaults.d.ts +0 -25
  92. package/dist/components/Config/index.d.ts +0 -11
  93. package/dist/components/Guide/Guide.d.ts +0 -70
  94. package/dist/components/Guide/index.d.ts +0 -6
  95. package/dist/components/Guide/types.d.ts +0 -144
  96. package/dist/components/Guide/validation.d.ts +0 -82
  97. package/dist/components/Layout/Layout.d.ts +0 -73
  98. package/dist/components/Layout/index.d.ts +0 -10
  99. package/dist/components/Padder/Padder.d.ts +0 -67
  100. package/dist/components/Padder/index.d.ts +0 -10
  101. package/dist/components/Spacer/Spacer.d.ts +0 -48
  102. package/dist/components/Spacer/index.d.ts +0 -10
  103. package/dist/components/Stack/Stack.d.ts +0 -84
  104. package/dist/components/Stack/index.d.ts +0 -10
  105. package/dist/components/styles/index.d.ts +0 -11
  106. package/dist/components/types.d.ts +0 -102
  107. package/dist/hooks/useBaseline.d.ts +0 -55
  108. package/dist/hooks/useConfig.d.ts +0 -41
  109. package/dist/hooks/useDebug.d.ts +0 -49
  110. package/dist/hooks/useGuide.d.ts +0 -61
  111. package/dist/hooks/useMeasure.d.ts +0 -35
  112. package/dist/hooks/useVirtual.d.ts +0 -60
  113. package/dist/styles.d.ts +0 -6
  114. package/dist/theme.d.ts +0 -6
  115. package/dist/utils/convert.d.ts +0 -24
  116. package/dist/utils/grid.d.ts +0 -22
  117. package/dist/utils/math.d.ts +0 -48
  118. package/dist/utils/merge.d.ts +0 -117
  119. package/dist/utils/normalize.d.ts +0 -30
  120. package/dist/utils/padding.d.ts +0 -11
  121. package/dist/utils/parse.d.ts +0 -18
  122. package/dist/utils/snapping.d.ts +0 -28
  123. package/dist/utils/timing.d.ts +0 -45
package/README.md CHANGED
@@ -4,34 +4,47 @@
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 19 applications. It provides configurable overlays for both column-based and baseline grids, flexible layout components, and theme-aware configuration—all optimized for performance and built with TypeScript.
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
8
 
9
9
  ![Demo visual](kit.png)
10
10
 
11
11
  ## Table of Contents
12
- - [Base Unit](#base-unit)
13
- - [Spacing Values](#spacing-values)
14
- - [Grid Snapping](#grid-snapping)
15
- - [Debugging Modes](#debugging-modes)
16
- - [Component Hierarchy](#component-hierarchy)
17
- - [Key Components](#key-components)
18
- - [Config](#config)
19
- - [Baseline](#baseline)
20
- - [Guide](#guide)
21
- - [Box](#box)
22
- - [CSS Import Options](#css-import-options)
23
- - [Theme Options](#theme-options)
24
- - [Theme Variables Reference](#theme-variables-reference)
25
- - [SSR-Friendly Design](#ssr-friendly-design)
26
- - [SSR Mode Prop](#ssr-mode-prop)
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)
27
41
 
28
42
  ## Features
29
43
 
30
44
  - 📏 **Baseline Grid:** Core system for maintaining vertical rhythm and consistent spacing across your layouts
31
45
  - 🎯 **Column Grid Guide:** Customizable overlay system for visualizing column-based layouts and alignment
32
46
  - 📦 **Box Component:** Basic container with configurable spacing that snaps to the baseline grid
33
- - 🧩 **Layout Component:** CSS Grid-based container with automatic column calculations and baseline alignment
34
- - 📐 **Stack Component:** Flex-based container that maintains consistent spacing and baseline alignment
47
+ - 🧱 **Padder & Spacer:** Spacing primitives with optional baseline snapping
35
48
  - 🎨 **Theme System:** Customizable colors and debug visuals through a centralized configuration
36
49
 
37
50
  ## Requirements
@@ -52,35 +65,44 @@ yarn add baseline-kit
52
65
  pnpm add baseline-kit
53
66
  ```
54
67
 
55
- After installation, import both the styles and theme in your application:
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:
56
70
 
57
71
  ```tsx
58
- // Import in your main entry file (e.g., index.js, App.js)
59
- import 'baseline-kit/styles'; // Required core styles
60
- import 'baseline-kit/theme'; // Recommended theme (or use your own)
72
+ import 'baseline-kit/styles/guide'
73
+ import { Config, Guide } from 'baseline-kit/guide'
61
74
  ```
62
75
 
63
76
  For frameworks like Remix that use URL imports in a links function:
64
77
 
65
78
  ```tsx
66
79
  export const links = () => [
67
- { rel: "stylesheet", href: "baseline-kit/styles" },
68
- { rel: "stylesheet", href: "baseline-kit/theme" }
69
- ];
80
+ { rel: 'stylesheet', href: 'baseline-kit/styles/guide' },
81
+ ]
70
82
  ```
71
83
 
72
- If you prefer a single CSS file that includes everything:
84
+ For the full component set, import the root package and root component styles:
73
85
 
74
86
  ```tsx
75
- // Alternative: Import everything in one file
76
- import 'baseline-kit/full';
87
+ import 'baseline-kit/styles'
88
+ 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'
77
96
 
78
97
  // For Remix:
79
98
  export const links = () => [
80
- { rel: "stylesheet", href: "baseline-kit/full" }
81
- ];
99
+ { rel: 'stylesheet', href: 'baseline-kit/styles/full' },
100
+ ]
82
101
  ```
83
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
+
84
106
  Baseline Kit is written in TypeScript and includes built-in type definitions—no additional packages required.
85
107
 
86
108
  ## Quick Start
@@ -139,12 +161,12 @@ unit:
139
161
 
140
162
  ```tsx
141
163
  <Config base={8}> // Sets 8px as the base unit
142
- <Layout
164
+ <Padder
143
165
  block={17} // Will be rounded to 16px (2 * base)
144
166
  inline={22} // Will be rounded to 24px (3 * base)
145
167
  >
146
168
  {/* Content automatically aligned to the 8px grid */}
147
- </Layout>
169
+ </Padder>
148
170
  </Config>
149
171
  ```
150
172
 
@@ -168,8 +190,7 @@ block={{ start: 2, end: 3 }} // Same as above
168
190
  Components automatically adjust their spacing to maintain baseline grid alignment:
169
191
 
170
192
  - **Box**: Adjusts bottom padding to ensure total height aligns with base unit
171
- - **Stack**: Maintains baseline alignment in flex layouts
172
- - **Layout**: Ensures grid cells align with baseline
193
+ - **Padder**: Snaps padded content to baseline-aligned multiples of the base unit
173
194
 
174
195
  ### Debugging Modes
175
196
 
@@ -185,21 +206,20 @@ debugging = "none" // Removes debug elements entirely
185
206
 
186
207
  ### Component Hierarchy
187
208
 
188
- #### 1. Core Components
209
+ #### 1. Spacing primitives
189
210
 
190
- - **`Box`** Basic container for text alignment
191
- - **`Stack`** Flex-based layouts (one-dimensional)
192
- - **`Layout`** Grid-based layouts (two-dimensional)
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
193
214
 
194
- #### 2. Development Tools
215
+ #### 2. Debug overlays
195
216
 
196
- - **`Baseline`** Horizontal grid overlay
197
- - **`Guide`** Vertical grid overlay
198
- - **`Spacer`** Precise spacing measurement
217
+ - **`Baseline`** Horizontal baseline-grid overlay
218
+ - **`Guide`** Column-grid overlay (line / pattern / fixed / auto variants)
199
219
 
200
220
  #### 3. Configuration
201
221
 
202
- - **`Config`** Theme and settings provider
222
+ - **`Config`** Theme and settings provider (base unit, colors, debug modes)
203
223
 
204
224
  ### Key Components
205
225
 
@@ -241,7 +261,7 @@ debugging = "none" // Removes debug elements entirely
241
261
  ```tsx
242
262
  <Box
243
263
  block={[2, 5]} // Vertical padding in base units
244
- span={2} // Grid column span when used in Layout
264
+ span={2} // Grid column span when placed in a CSS grid parent
245
265
  snapping="height" // "none", "height", or "clamp"
246
266
  >
247
267
  <p>Content aligned to baseline grid</p>
@@ -252,21 +272,29 @@ debugging = "none" // Removes debug elements entirely
252
272
 
253
273
  Baseline Kit comes with a flexible CSS structure and theming system:
254
274
 
255
- 1. `core.css` - Contains the core component styles required for functionality (imported via `baseline-kit/styles`)
256
- 2. `theme.css` - Contains color variables and theming with automatic dark mode support (imported via `baseline-kit/theme`)
257
- 3. `baseline-kit.css` - Combined file with both core and theme styles (imported via `baseline-kit/full`)
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`)
258
280
 
259
281
  ### CSS Import Options
260
282
 
261
283
  Baseline Kit gives you flexibility in how you include the styles:
262
284
 
263
285
  ```tsx
264
- // Option 1: Import core styles and theme separately (recommended)
265
- import 'baseline-kit/styles';
266
- import 'baseline-kit/theme';
286
+ // Guide-only overlay styles
287
+ import 'baseline-kit/styles/guide'
288
+
289
+ // Root component styles and theme separately
290
+ import 'baseline-kit/styles'
291
+ import 'baseline-kit/theme'
292
+
293
+ // Root component styles and theme in one file
294
+ import 'baseline-kit/styles/full'
267
295
 
268
- // Option 2: Import everything in one file
269
- import 'baseline-kit/full';
296
+ // Optional reset
297
+ import 'baseline-kit/reset'
270
298
  ```
271
299
 
272
300
  ### Theme Options
@@ -276,21 +304,21 @@ You now have four options for using the theme system:
276
304
  #### 1. Use the Built-in Theme (with automatic dark mode)
277
305
 
278
306
  ```tsx
279
- import 'baseline-kit/theme'; // Default theme with light/dark mode support
307
+ import 'baseline-kit/theme' // Default theme with light/dark mode support
280
308
  ```
281
309
 
282
310
  #### 2. Use Specific Theme Variants
283
311
 
284
312
  ```tsx
285
313
  // Use only the light theme (no dark mode)
286
- import 'baseline-kit/theme/default';
314
+ import 'baseline-kit/theme/default'
287
315
 
288
316
  // Use only the dark theme
289
- import 'baseline-kit/theme/dark';
317
+ import 'baseline-kit/theme/dark'
290
318
 
291
319
  // Example: Apply dark theme regardless of system preference
292
- import 'baseline-kit/styles';
293
- import 'baseline-kit/theme/dark';
320
+ import 'baseline-kit/styles'
321
+ import 'baseline-kit/theme/dark'
294
322
  ```
295
323
 
296
324
  #### 3. Create a Custom Theme
@@ -299,7 +327,7 @@ You can use the tokens template as a starting point:
299
327
 
300
328
  ```tsx
301
329
  // First check the token template to see available variables
302
- import 'baseline-kit/theme/tokens'; // Just for reference (contains no values)
330
+ import 'baseline-kit/theme/tokens' // Just for reference (contains no values)
303
331
  ```
304
332
 
305
333
  Then create your own custom theme file:
@@ -324,8 +352,8 @@ Then create your own custom theme file:
324
352
  Then import your custom theme:
325
353
 
326
354
  ```tsx
327
- import 'baseline-kit/styles'; // Required core styles
328
- import './path/to/yourCustomTheme.css'; // Your custom theme
355
+ import 'baseline-kit/styles' // Required component styles
356
+ import './path/to/yourCustomTheme.css' // Your custom theme
329
357
  ```
330
358
 
331
359
  #### 4. Override via Config
@@ -352,9 +380,8 @@ For minor adjustments, use the Config component:
352
380
  | Baseline | `--bk-baseline-color-[line/flat]-theme` | Colors for lines and backgrounds |
353
381
  | Guide | `--bk-guide-color-[line/pattern/auto/fixed]-theme` | Colors for different guide variants |
354
382
  | Box | `--bk-box-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
355
- | Stack | `--bk-stack-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
356
- | Layout | `--bk-layout-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
357
383
  | Spacer | `--bk-spacer-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
384
+ | Padder | `--bk-padder-color-theme` | Padder edge color |
358
385
 
359
386
  See the [tokens file](https://github.com/dnvt/baseline-kit/blob/main/dist/theme/tokens.css) for a complete list of available variables.
360
387
 
@@ -398,12 +425,16 @@ Components accept an `ssrMode` prop to explicitly optimize for server rendering:
398
425
  ```
399
426
 
400
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.
401
429
 
402
430
  ## Development
403
431
 
404
432
  ```shell
405
433
  # Clone the repository
406
- git clone https://github.com/dnvt/baseline-kit.git
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
407
438
 
408
439
  # Install dependencies
409
440
  bun install
@@ -415,6 +446,11 @@ bun run dev
415
446
  bun run test
416
447
  ```
417
448
 
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.
453
+
418
454
  ## Performance Features
419
455
 
420
456
  - Virtualizes large grid overlays
package/dist/README.md CHANGED
@@ -4,34 +4,47 @@
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 19 applications. It provides configurable overlays for both column-based and baseline grids, flexible layout components, and theme-aware configuration—all optimized for performance and built with TypeScript.
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
8
 
9
9
  ![Demo visual](kit.png)
10
10
 
11
11
  ## Table of Contents
12
- - [Base Unit](#base-unit)
13
- - [Spacing Values](#spacing-values)
14
- - [Grid Snapping](#grid-snapping)
15
- - [Debugging Modes](#debugging-modes)
16
- - [Component Hierarchy](#component-hierarchy)
17
- - [Key Components](#key-components)
18
- - [Config](#config)
19
- - [Baseline](#baseline)
20
- - [Guide](#guide)
21
- - [Box](#box)
22
- - [CSS Import Options](#css-import-options)
23
- - [Theme Options](#theme-options)
24
- - [Theme Variables Reference](#theme-variables-reference)
25
- - [SSR-Friendly Design](#ssr-friendly-design)
26
- - [SSR Mode Prop](#ssr-mode-prop)
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)
27
41
 
28
42
  ## Features
29
43
 
30
44
  - 📏 **Baseline Grid:** Core system for maintaining vertical rhythm and consistent spacing across your layouts
31
45
  - 🎯 **Column Grid Guide:** Customizable overlay system for visualizing column-based layouts and alignment
32
46
  - 📦 **Box Component:** Basic container with configurable spacing that snaps to the baseline grid
33
- - 🧩 **Layout Component:** CSS Grid-based container with automatic column calculations and baseline alignment
34
- - 📐 **Stack Component:** Flex-based container that maintains consistent spacing and baseline alignment
47
+ - 🧱 **Padder & Spacer:** Spacing primitives with optional baseline snapping
35
48
  - 🎨 **Theme System:** Customizable colors and debug visuals through a centralized configuration
36
49
 
37
50
  ## Requirements
@@ -52,35 +65,44 @@ yarn add baseline-kit
52
65
  pnpm add baseline-kit
53
66
  ```
54
67
 
55
- After installation, import both the styles and theme in your application:
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:
56
70
 
57
71
  ```tsx
58
- // Import in your main entry file (e.g., index.js, App.js)
59
- import 'baseline-kit/styles'; // Required core styles
60
- import 'baseline-kit/theme'; // Recommended theme (or use your own)
72
+ import 'baseline-kit/styles/guide'
73
+ import { Config, Guide } from 'baseline-kit/guide'
61
74
  ```
62
75
 
63
76
  For frameworks like Remix that use URL imports in a links function:
64
77
 
65
78
  ```tsx
66
79
  export const links = () => [
67
- { rel: "stylesheet", href: "baseline-kit/styles" },
68
- { rel: "stylesheet", href: "baseline-kit/theme" }
69
- ];
80
+ { rel: 'stylesheet', href: 'baseline-kit/styles/guide' },
81
+ ]
70
82
  ```
71
83
 
72
- If you prefer a single CSS file that includes everything:
84
+ For the full component set, import the root package and root component styles:
73
85
 
74
86
  ```tsx
75
- // Alternative: Import everything in one file
76
- import 'baseline-kit/full';
87
+ import 'baseline-kit/styles'
88
+ 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'
77
96
 
78
97
  // For Remix:
79
98
  export const links = () => [
80
- { rel: "stylesheet", href: "baseline-kit/full" }
81
- ];
99
+ { rel: 'stylesheet', href: 'baseline-kit/styles/full' },
100
+ ]
82
101
  ```
83
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
+
84
106
  Baseline Kit is written in TypeScript and includes built-in type definitions—no additional packages required.
85
107
 
86
108
  ## Quick Start
@@ -139,12 +161,12 @@ unit:
139
161
 
140
162
  ```tsx
141
163
  <Config base={8}> // Sets 8px as the base unit
142
- <Layout
164
+ <Padder
143
165
  block={17} // Will be rounded to 16px (2 * base)
144
166
  inline={22} // Will be rounded to 24px (3 * base)
145
167
  >
146
168
  {/* Content automatically aligned to the 8px grid */}
147
- </Layout>
169
+ </Padder>
148
170
  </Config>
149
171
  ```
150
172
 
@@ -168,8 +190,7 @@ block={{ start: 2, end: 3 }} // Same as above
168
190
  Components automatically adjust their spacing to maintain baseline grid alignment:
169
191
 
170
192
  - **Box**: Adjusts bottom padding to ensure total height aligns with base unit
171
- - **Stack**: Maintains baseline alignment in flex layouts
172
- - **Layout**: Ensures grid cells align with baseline
193
+ - **Padder**: Snaps padded content to baseline-aligned multiples of the base unit
173
194
 
174
195
  ### Debugging Modes
175
196
 
@@ -185,21 +206,20 @@ debugging = "none" // Removes debug elements entirely
185
206
 
186
207
  ### Component Hierarchy
187
208
 
188
- #### 1. Core Components
209
+ #### 1. Spacing primitives
189
210
 
190
- - **`Box`** Basic container for text alignment
191
- - **`Stack`** Flex-based layouts (one-dimensional)
192
- - **`Layout`** Grid-based layouts (two-dimensional)
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
193
214
 
194
- #### 2. Development Tools
215
+ #### 2. Debug overlays
195
216
 
196
- - **`Baseline`** Horizontal grid overlay
197
- - **`Guide`** Vertical grid overlay
198
- - **`Spacer`** Precise spacing measurement
217
+ - **`Baseline`** Horizontal baseline-grid overlay
218
+ - **`Guide`** Column-grid overlay (line / pattern / fixed / auto variants)
199
219
 
200
220
  #### 3. Configuration
201
221
 
202
- - **`Config`** Theme and settings provider
222
+ - **`Config`** Theme and settings provider (base unit, colors, debug modes)
203
223
 
204
224
  ### Key Components
205
225
 
@@ -241,7 +261,7 @@ debugging = "none" // Removes debug elements entirely
241
261
  ```tsx
242
262
  <Box
243
263
  block={[2, 5]} // Vertical padding in base units
244
- span={2} // Grid column span when used in Layout
264
+ span={2} // Grid column span when placed in a CSS grid parent
245
265
  snapping="height" // "none", "height", or "clamp"
246
266
  >
247
267
  <p>Content aligned to baseline grid</p>
@@ -252,21 +272,29 @@ debugging = "none" // Removes debug elements entirely
252
272
 
253
273
  Baseline Kit comes with a flexible CSS structure and theming system:
254
274
 
255
- 1. `core.css` - Contains the core component styles required for functionality (imported via `baseline-kit/styles`)
256
- 2. `theme.css` - Contains color variables and theming with automatic dark mode support (imported via `baseline-kit/theme`)
257
- 3. `baseline-kit.css` - Combined file with both core and theme styles (imported via `baseline-kit/full`)
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`)
258
280
 
259
281
  ### CSS Import Options
260
282
 
261
283
  Baseline Kit gives you flexibility in how you include the styles:
262
284
 
263
285
  ```tsx
264
- // Option 1: Import core styles and theme separately (recommended)
265
- import 'baseline-kit/styles';
266
- import 'baseline-kit/theme';
286
+ // Guide-only overlay styles
287
+ import 'baseline-kit/styles/guide'
288
+
289
+ // Root component styles and theme separately
290
+ import 'baseline-kit/styles'
291
+ import 'baseline-kit/theme'
292
+
293
+ // Root component styles and theme in one file
294
+ import 'baseline-kit/styles/full'
267
295
 
268
- // Option 2: Import everything in one file
269
- import 'baseline-kit/full';
296
+ // Optional reset
297
+ import 'baseline-kit/reset'
270
298
  ```
271
299
 
272
300
  ### Theme Options
@@ -276,21 +304,21 @@ You now have four options for using the theme system:
276
304
  #### 1. Use the Built-in Theme (with automatic dark mode)
277
305
 
278
306
  ```tsx
279
- import 'baseline-kit/theme'; // Default theme with light/dark mode support
307
+ import 'baseline-kit/theme' // Default theme with light/dark mode support
280
308
  ```
281
309
 
282
310
  #### 2. Use Specific Theme Variants
283
311
 
284
312
  ```tsx
285
313
  // Use only the light theme (no dark mode)
286
- import 'baseline-kit/theme/default';
314
+ import 'baseline-kit/theme/default'
287
315
 
288
316
  // Use only the dark theme
289
- import 'baseline-kit/theme/dark';
317
+ import 'baseline-kit/theme/dark'
290
318
 
291
319
  // Example: Apply dark theme regardless of system preference
292
- import 'baseline-kit/styles';
293
- import 'baseline-kit/theme/dark';
320
+ import 'baseline-kit/styles'
321
+ import 'baseline-kit/theme/dark'
294
322
  ```
295
323
 
296
324
  #### 3. Create a Custom Theme
@@ -299,7 +327,7 @@ You can use the tokens template as a starting point:
299
327
 
300
328
  ```tsx
301
329
  // First check the token template to see available variables
302
- import 'baseline-kit/theme/tokens'; // Just for reference (contains no values)
330
+ import 'baseline-kit/theme/tokens' // Just for reference (contains no values)
303
331
  ```
304
332
 
305
333
  Then create your own custom theme file:
@@ -324,8 +352,8 @@ Then create your own custom theme file:
324
352
  Then import your custom theme:
325
353
 
326
354
  ```tsx
327
- import 'baseline-kit/styles'; // Required core styles
328
- import './path/to/yourCustomTheme.css'; // Your custom theme
355
+ import 'baseline-kit/styles' // Required component styles
356
+ import './path/to/yourCustomTheme.css' // Your custom theme
329
357
  ```
330
358
 
331
359
  #### 4. Override via Config
@@ -352,9 +380,8 @@ For minor adjustments, use the Config component:
352
380
  | Baseline | `--bk-baseline-color-[line/flat]-theme` | Colors for lines and backgrounds |
353
381
  | Guide | `--bk-guide-color-[line/pattern/auto/fixed]-theme` | Colors for different guide variants |
354
382
  | Box | `--bk-box-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
355
- | Stack | `--bk-stack-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
356
- | Layout | `--bk-layout-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
357
383
  | Spacer | `--bk-spacer-color-[line/flat/text]-theme` | Colors for borders, backgrounds and text |
384
+ | Padder | `--bk-padder-color-theme` | Padder edge color |
358
385
 
359
386
  See the [tokens file](https://github.com/dnvt/baseline-kit/blob/main/dist/theme/tokens.css) for a complete list of available variables.
360
387
 
@@ -398,12 +425,16 @@ Components accept an `ssrMode` prop to explicitly optimize for server rendering:
398
425
  ```
399
426
 
400
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.
401
429
 
402
430
  ## Development
403
431
 
404
432
  ```shell
405
433
  # Clone the repository
406
- git clone https://github.com/dnvt/baseline-kit.git
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
407
438
 
408
439
  # Install dependencies
409
440
  bun install
@@ -415,6 +446,11 @@ bun run dev
415
446
  bun run test
416
447
  ```
417
448
 
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.
453
+
418
454
  ## Performance Features
419
455
 
420
456
  - Virtualizes large grid overlays