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.
- package/CHANGELOG.md +243 -0
- package/README.md +227 -353
- package/dist/baseline-kit.css +5 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +25 -9
- package/dist/core.mjs +1 -1
- package/dist/guide.cjs +1 -1
- package/dist/guide.cjs.map +1 -1
- package/dist/guide.css +1 -1
- package/dist/guide.d.ts +16 -16
- package/dist/guide.mjs +147 -150
- package/dist/guide.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -12
- package/dist/index.mjs +169 -158
- package/dist/index.mjs.map +1 -1
- package/dist/remix-server.d.ts +8 -0
- package/dist/remix-server.mjs +15 -0
- package/dist/remix-server.mjs.map +1 -0
- package/dist/remix.css +2 -0
- package/dist/remix.d.ts +191 -0
- package/dist/remix.mjs +984 -0
- package/dist/remix.mjs.map +1 -0
- package/dist/{src-QHaSfgVe.js → src-D0nL1BwZ.js} +96 -165
- package/dist/src-D0nL1BwZ.js.map +1 -0
- package/dist/src-R5usYJol.cjs +2 -0
- package/dist/src-R5usYJol.cjs.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme/default.css +0 -1
- package/dist/theme/tokens.css +0 -1
- package/dist/theme.css +4 -1
- package/package.json +86 -37
- package/dist/README.md +0 -468
- package/dist/core/src/config/defaults.d.ts +0 -2
- package/dist/core/src/config/index.d.ts +0 -3
- package/dist/core/src/config/merge.d.ts +0 -21
- package/dist/core/src/config/schema.d.ts +0 -33
- package/dist/core/src/descriptors/baseline.d.ts +0 -26
- package/dist/core/src/descriptors/box.d.ts +0 -20
- package/dist/core/src/descriptors/guide.d.ts +0 -44
- package/dist/core/src/descriptors/index.d.ts +0 -5
- package/dist/core/src/descriptors/padder.d.ts +0 -19
- package/dist/core/src/descriptors/spacer.d.ts +0 -24
- package/dist/core/src/index.d.ts +0 -10
- package/dist/core/src/types.d.ts +0 -62
- package/dist/core/src/utils/convert.d.ts +0 -10
- package/dist/core/src/utils/grid.d.ts +0 -18
- package/dist/core/src/utils/index.d.ts +0 -8
- package/dist/core/src/utils/math.d.ts +0 -9
- package/dist/core/src/utils/merge.d.ts +0 -28
- package/dist/core/src/utils/normalize.d.ts +0 -13
- package/dist/core/src/utils/padding.d.ts +0 -2
- package/dist/core/src/utils/parse.d.ts +0 -5
- package/dist/core/src/utils/snapping.d.ts +0 -2
- package/dist/core/src/validation/guide.d.ts +0 -3
- package/dist/core/src/validation/index.d.ts +0 -1
- package/dist/dom/src/index.d.ts +0 -11
- package/dist/dom/src/measure.d.ts +0 -18
- package/dist/dom/src/observers.d.ts +0 -5
- package/dist/dom/src/ssr.d.ts +0 -20
- package/dist/dom/src/timing.d.ts +0 -2
- package/dist/dom/src/viewport.d.ts +0 -7
- package/dist/dom/src/virtual.d.ts +0 -23
- package/dist/react/src/components/Baseline/Baseline.d.ts +0 -13
- package/dist/react/src/components/Baseline/index.d.ts +0 -1
- package/dist/react/src/components/Box/Box.d.ts +0 -26
- package/dist/react/src/components/Box/index.d.ts +0 -1
- package/dist/react/src/components/Config/Config.d.ts +0 -20
- package/dist/react/src/components/Config/index.d.ts +0 -2
- package/dist/react/src/components/Guide/Guide.d.ts +0 -16
- package/dist/react/src/components/Guide/index.d.ts +0 -1
- package/dist/react/src/components/Padder/Padder.d.ts +0 -20
- package/dist/react/src/components/Padder/index.d.ts +0 -1
- package/dist/react/src/components/Spacer/Spacer.d.ts +0 -14
- package/dist/react/src/components/Spacer/index.d.ts +0 -1
- package/dist/react/src/components/index.d.ts +0 -12
- package/dist/react/src/components/types.d.ts +0 -29
- package/dist/react/src/guide.d.ts +0 -10
- package/dist/react/src/hooks/index.d.ts +0 -10
- package/dist/react/src/hooks/useBaseline.d.ts +0 -26
- package/dist/react/src/hooks/useConfig.d.ts +0 -9
- package/dist/react/src/hooks/useDebug.d.ts +0 -6
- package/dist/react/src/hooks/useGuide.d.ts +0 -7
- package/dist/react/src/hooks/useIsClient.d.ts +0 -4
- package/dist/react/src/hooks/useMeasure.d.ts +0 -10
- package/dist/react/src/hooks/useVirtual.d.ts +0 -14
- package/dist/react/src/index.d.ts +0 -21
- package/dist/react/src/utils/index.d.ts +0 -9
- package/dist/react/src/utils/merge.d.ts +0 -10
- package/dist/react/src/utils/ssr.d.ts +0 -1
- package/dist/src-CMjyHjX5.cjs +0 -2
- package/dist/src-CMjyHjX5.cjs.map +0 -1
- package/dist/src-QHaSfgVe.js.map +0 -1
package/dist/README.md
DELETED
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
# Baseline Kit
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-

|
|
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
|
-

|
|
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
|
|
49
|
-
|
|
50
|
-
## Requirements
|
|
51
|
-
|
|
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
|
|
54
|
-
|
|
55
|
-
## Installation
|
|
56
|
-
|
|
57
|
-
```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
|
|
66
|
-
```
|
|
67
|
-
|
|
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
|
-
```
|
|
75
|
-
|
|
76
|
-
For frameworks like Remix that use URL imports in a links function:
|
|
77
|
-
|
|
78
|
-
```tsx
|
|
79
|
-
export const links = () => [
|
|
80
|
-
{ rel: 'stylesheet', href: 'baseline-kit/styles/guide' },
|
|
81
|
-
]
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
For the full component set, import the root package and root component styles:
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
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'
|
|
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'
|
|
117
|
-
|
|
118
|
-
return (
|
|
119
|
-
<Config
|
|
120
|
-
base={8}
|
|
121
|
-
baseline={{ debugging }}
|
|
122
|
-
box={{ debugging }}
|
|
123
|
-
guide={{ debugging }}
|
|
124
|
-
spacer={{ debugging }}
|
|
125
|
-
>
|
|
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>
|
|
150
|
-
</Config>
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Core Concepts
|
|
156
|
-
|
|
157
|
-
### Base Unit
|
|
158
|
-
|
|
159
|
-
The base unit is the foundation of Baseline Kit's spacing system. All measurements are calculated as multiples of this
|
|
160
|
-
unit:
|
|
161
|
-
|
|
162
|
-
```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 */}
|
|
169
|
-
</Padder>
|
|
170
|
-
</Config>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Spacing Values
|
|
174
|
-
|
|
175
|
-
Spacing props (`block`, `inline`, `gap`) accept values in three formats:
|
|
176
|
-
|
|
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
|
|
183
|
-
|
|
184
|
-
// Object with explicit values
|
|
185
|
-
block={{ start: 2, end: 3 }} // Same as above
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### Grid Snapping
|
|
189
|
-
|
|
190
|
-
Components automatically adjust their spacing to maintain baseline grid alignment:
|
|
191
|
-
|
|
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
|
|
194
|
-
|
|
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
|
-
```
|
|
204
|
-
|
|
205
|
-
## Components
|
|
206
|
-
|
|
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
|
-
```
|
|
237
|
-
|
|
238
|
-
#### Baseline
|
|
239
|
-
|
|
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
|
-
```
|
|
258
|
-
|
|
259
|
-
#### Box
|
|
260
|
-
|
|
261
|
-
```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
|
|
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'
|
|
295
|
-
|
|
296
|
-
// Optional reset
|
|
297
|
-
import 'baseline-kit/reset'
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Theme Options
|
|
301
|
-
|
|
302
|
-
You now have four options for using the theme system:
|
|
303
|
-
|
|
304
|
-
#### 1. Use the Built-in Theme (with automatic dark mode)
|
|
305
|
-
|
|
306
|
-
```tsx
|
|
307
|
-
import 'baseline-kit/theme' // Default theme with light/dark mode support
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
#### 2. Use Specific Theme Variants
|
|
311
|
-
|
|
312
|
-
```tsx
|
|
313
|
-
// Use only the light theme (no dark mode)
|
|
314
|
-
import 'baseline-kit/theme/default'
|
|
315
|
-
|
|
316
|
-
// Use only the dark theme
|
|
317
|
-
import 'baseline-kit/theme/dark'
|
|
318
|
-
|
|
319
|
-
// Example: Apply dark theme regardless of system preference
|
|
320
|
-
import 'baseline-kit/styles'
|
|
321
|
-
import 'baseline-kit/theme/dark'
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
#### 3. Create a Custom Theme
|
|
325
|
-
|
|
326
|
-
You can use the tokens template as a starting point:
|
|
327
|
-
|
|
328
|
-
```tsx
|
|
329
|
-
// First check the token template to see available variables
|
|
330
|
-
import 'baseline-kit/theme/tokens' // Just for reference (contains no values)
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
Then create your own custom theme file:
|
|
334
|
-
|
|
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
|
-
}
|
|
343
|
-
|
|
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
|
-
}
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
Then import your custom theme:
|
|
353
|
-
|
|
354
|
-
```tsx
|
|
355
|
-
import 'baseline-kit/styles' // Required component styles
|
|
356
|
-
import './path/to/yourCustomTheme.css' // Your custom theme
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
#### 4. Override via Config
|
|
360
|
-
|
|
361
|
-
For minor adjustments, use the Config component:
|
|
362
|
-
|
|
363
|
-
```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>
|
|
374
|
-
```
|
|
375
|
-
|
|
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
|
|
389
|
-
|
|
390
|
-
- Modern browsers (Chrome, Firefox, Safari, Edge)
|
|
391
|
-
- Requires CSS Grid Layout support and CSS Custom Properties
|
|
392
|
-
- Falls back gracefully in unsupported browsers
|
|
393
|
-
|
|
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.
|
|
406
|
-
|
|
407
|
-
### SSR-Friendly Design
|
|
408
|
-
|
|
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
|
|
414
|
-
|
|
415
|
-
### SSR Mode Prop
|
|
416
|
-
|
|
417
|
-
Components accept an `ssrMode` prop to explicitly optimize for server rendering:
|
|
418
|
-
|
|
419
|
-
```tsx
|
|
420
|
-
<Baseline
|
|
421
|
-
height="100vh"
|
|
422
|
-
ssrMode={true}
|
|
423
|
-
debugging="visible"
|
|
424
|
-
/>
|
|
425
|
-
```
|
|
426
|
-
|
|
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
|
-
## Development
|
|
431
|
-
|
|
432
|
-
```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
|
|
441
|
-
|
|
442
|
-
# Start development server
|
|
443
|
-
bun run dev
|
|
444
|
-
|
|
445
|
-
# Run tests
|
|
446
|
-
bun run test
|
|
447
|
-
```
|
|
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
|
-
|
|
454
|
-
## Performance Features
|
|
455
|
-
|
|
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
|
|
461
|
-
|
|
462
|
-
## Contributing
|
|
463
|
-
|
|
464
|
-
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
|
|
465
|
-
|
|
466
|
-
## License
|
|
467
|
-
|
|
468
|
-
MIT © [François Denavaut](https://github.com/dnvt)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ConfigSchema } from './schema';
|
|
2
|
-
type MergeConfigParams = {
|
|
3
|
-
parentConfig: ConfigSchema;
|
|
4
|
-
base?: number;
|
|
5
|
-
baseline?: Partial<ConfigSchema['baseline']>;
|
|
6
|
-
guide?: Partial<ConfigSchema['guide']>;
|
|
7
|
-
spacer?: Partial<ConfigSchema['spacer']>;
|
|
8
|
-
box?: Partial<ConfigSchema['box']>;
|
|
9
|
-
padder?: Partial<ConfigSchema['padder']>;
|
|
10
|
-
};
|
|
11
|
-
export declare const mergeConfig: (params: MergeConfigParams) => ConfigSchema;
|
|
12
|
-
type CSSVariablesParams = {
|
|
13
|
-
base: number;
|
|
14
|
-
baseline: ConfigSchema['baseline'];
|
|
15
|
-
guide: ConfigSchema['guide'];
|
|
16
|
-
spacer: ConfigSchema['spacer'];
|
|
17
|
-
box: ConfigSchema['box'];
|
|
18
|
-
padder: ConfigSchema['padder'];
|
|
19
|
-
};
|
|
20
|
-
export declare const createCSSVariables: (params: CSSVariablesParams) => Record<string, string>;
|
|
21
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { GuideVariant, BaselineVariant, Variant, DebuggingMode } from '../types';
|
|
2
|
-
type DebugColors = {
|
|
3
|
-
line: string;
|
|
4
|
-
flat: string;
|
|
5
|
-
text: string;
|
|
6
|
-
};
|
|
7
|
-
export type ConfigSchema = {
|
|
8
|
-
base: number;
|
|
9
|
-
baseline: {
|
|
10
|
-
variant: BaselineVariant;
|
|
11
|
-
debugging: DebuggingMode;
|
|
12
|
-
colors: Record<BaselineVariant, string>;
|
|
13
|
-
};
|
|
14
|
-
guide: {
|
|
15
|
-
variant: GuideVariant;
|
|
16
|
-
debugging: DebuggingMode;
|
|
17
|
-
colors: Record<GuideVariant, string>;
|
|
18
|
-
};
|
|
19
|
-
spacer: {
|
|
20
|
-
variant: Variant;
|
|
21
|
-
debugging: DebuggingMode;
|
|
22
|
-
colors: DebugColors;
|
|
23
|
-
};
|
|
24
|
-
box: {
|
|
25
|
-
debugging: DebuggingMode;
|
|
26
|
-
colors: DebugColors;
|
|
27
|
-
};
|
|
28
|
-
padder: {
|
|
29
|
-
debugging: DebuggingMode;
|
|
30
|
-
color: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { BaselineVariant } from '../types';
|
|
2
|
-
export interface BaselineDescriptorParams {
|
|
3
|
-
base: number;
|
|
4
|
-
colors: Record<BaselineVariant, string>;
|
|
5
|
-
variant: BaselineVariant;
|
|
6
|
-
width?: number | string;
|
|
7
|
-
height?: number | string;
|
|
8
|
-
color?: string;
|
|
9
|
-
containerWidth: number;
|
|
10
|
-
containerHeight: number;
|
|
11
|
-
spacing: Record<string, unknown>;
|
|
12
|
-
isVisible: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface BaselineDescriptor {
|
|
15
|
-
containerStyle: Record<string, string>;
|
|
16
|
-
rowCount: number;
|
|
17
|
-
getRowStyle: (index: number) => Record<string, string>;
|
|
18
|
-
padding: string | undefined;
|
|
19
|
-
isVisible: boolean;
|
|
20
|
-
classTokens: string[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Computes all styles and data needed to render a Baseline component.
|
|
24
|
-
* Pure function — framework-agnostic.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createBaselineDescriptor(params: BaselineDescriptorParams): BaselineDescriptor;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface BoxDescriptorParams {
|
|
2
|
-
base: number;
|
|
3
|
-
lineColor: string;
|
|
4
|
-
width?: number | string;
|
|
5
|
-
height?: number | string;
|
|
6
|
-
span?: number;
|
|
7
|
-
colSpan?: number;
|
|
8
|
-
rowSpan?: number;
|
|
9
|
-
isVisible: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface BoxDescriptor {
|
|
12
|
-
boxStyle: Record<string, string>;
|
|
13
|
-
gridSpanStyle: Record<string, string>;
|
|
14
|
-
classTokens: string[];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Computes styles needed to render a Box component.
|
|
18
|
-
* Pure function — framework-agnostic.
|
|
19
|
-
*/
|
|
20
|
-
export declare function createBoxDescriptor(params: BoxDescriptorParams): BoxDescriptor;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { GuideVariant, GuideConfig } from '../types';
|
|
2
|
-
export interface GuideDescriptorParams {
|
|
3
|
-
base: number;
|
|
4
|
-
colors: Record<GuideVariant, string>;
|
|
5
|
-
variant: GuideVariant;
|
|
6
|
-
align: string;
|
|
7
|
-
width?: number | string;
|
|
8
|
-
height?: number | string;
|
|
9
|
-
columnWidth?: number | string;
|
|
10
|
-
maxWidth?: number | string;
|
|
11
|
-
color?: string;
|
|
12
|
-
/** Pre-computed guide template result (from useGuide or calculateGuideTemplate) */
|
|
13
|
-
template: string;
|
|
14
|
-
columnsCount: number;
|
|
15
|
-
calculatedGap: number;
|
|
16
|
-
isVisible: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface GuideDescriptor {
|
|
19
|
-
containerStyle: Record<string, string>;
|
|
20
|
-
columnColor: string;
|
|
21
|
-
columnsCount: number;
|
|
22
|
-
calculatedGap: number;
|
|
23
|
-
template: string;
|
|
24
|
-
isVisible: boolean;
|
|
25
|
-
isLineVariant: boolean;
|
|
26
|
-
classTokens: string[];
|
|
27
|
-
}
|
|
28
|
-
export interface GuideConfigParams {
|
|
29
|
-
variant: GuideVariant;
|
|
30
|
-
base: number;
|
|
31
|
-
gap: number;
|
|
32
|
-
columns?: number | readonly (string | number | undefined | 'auto')[];
|
|
33
|
-
columnWidth?: number | string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Creates a GuideConfig from component props.
|
|
37
|
-
* Pure function — no React or DOM dependency.
|
|
38
|
-
*/
|
|
39
|
-
export declare function createGuideConfig({ variant, base, gap, columns, columnWidth, }: GuideConfigParams): GuideConfig;
|
|
40
|
-
/**
|
|
41
|
-
* Computes all styles and data needed to render a Guide component.
|
|
42
|
-
* Pure function — framework-agnostic.
|
|
43
|
-
*/
|
|
44
|
-
export declare function createGuideDescriptor(params: GuideDescriptorParams): GuideDescriptor;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Padding } from '../types';
|
|
2
|
-
export interface PadderDescriptorParams {
|
|
3
|
-
base: number;
|
|
4
|
-
color: string;
|
|
5
|
-
width?: number | string;
|
|
6
|
-
height?: number | string;
|
|
7
|
-
padding: Padding;
|
|
8
|
-
enableSpacers: boolean;
|
|
9
|
-
isVisible: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface PadderDescriptor {
|
|
12
|
-
containerStyle: Record<string, string>;
|
|
13
|
-
classTokens: string[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Computes styles needed to render a Padder component.
|
|
17
|
-
* Pure function — framework-agnostic.
|
|
18
|
-
*/
|
|
19
|
-
export declare function createPadderDescriptor(params: PadderDescriptorParams): PadderDescriptor;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface SpacerDescriptorParams {
|
|
2
|
-
base: number;
|
|
3
|
-
colors: {
|
|
4
|
-
line: string;
|
|
5
|
-
flat: string;
|
|
6
|
-
text: string;
|
|
7
|
-
};
|
|
8
|
-
width?: number | string;
|
|
9
|
-
height?: number | string;
|
|
10
|
-
color?: string;
|
|
11
|
-
variant: string;
|
|
12
|
-
isVisible: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface SpacerDescriptor {
|
|
15
|
-
style: Record<string, string>;
|
|
16
|
-
normWidth: number;
|
|
17
|
-
normHeight: number;
|
|
18
|
-
classTokens: string[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Computes styles needed to render a Spacer component.
|
|
22
|
-
* Pure function — framework-agnostic.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createSpacerDescriptor(params: SpacerDescriptorParams): SpacerDescriptor;
|
package/dist/core/src/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @baseline-kit/core
|
|
3
|
-
* Pure TypeScript core: types, utilities, config, validation, and descriptors
|
|
4
|
-
* Zero dependencies — works in any JavaScript runtime
|
|
5
|
-
*/
|
|
6
|
-
export * from './types';
|
|
7
|
-
export * from './config';
|
|
8
|
-
export * from './utils';
|
|
9
|
-
export * from './validation';
|
|
10
|
-
export * from './descriptors';
|