baseline-kit 3.0.2 → 5.1.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 (79) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/README.md +226 -334
  3. package/dist/baseline-kit.css +7 -22
  4. package/dist/core.cjs +1 -0
  5. package/dist/core.d.ts +354 -0
  6. package/dist/core.mjs +2 -0
  7. package/dist/guide.cjs +2 -0
  8. package/dist/guide.cjs.map +1 -0
  9. package/dist/guide.css +2 -0
  10. package/dist/guide.d.ts +146 -0
  11. package/dist/guide.mjs +586 -0
  12. package/dist/guide.mjs.map +1 -0
  13. package/dist/index.cjs +2 -2
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +204 -30
  16. package/dist/index.mjs +620 -1747
  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 +177 -0
  23. package/dist/remix.mjs +989 -0
  24. package/dist/remix.mjs.map +1 -0
  25. package/dist/reset.css +43 -0
  26. package/dist/src-C-1u5WNS.cjs +2 -0
  27. package/dist/src-C-1u5WNS.cjs.map +1 -0
  28. package/dist/src-C3TICsw6.js +547 -0
  29. package/dist/src-C3TICsw6.js.map +1 -0
  30. package/dist/styles.css +1 -1
  31. package/dist/theme/dark.css +0 -8
  32. package/dist/theme/default.css +0 -10
  33. package/dist/theme/tokens.css +1 -11
  34. package/dist/theme.css +4 -19
  35. package/package.json +135 -46
  36. package/dist/README.md +0 -446
  37. package/dist/components/Baseline/Baseline.d.ts +0 -48
  38. package/dist/components/Baseline/index.d.ts +0 -6
  39. package/dist/components/Box/Box.d.ts +0 -73
  40. package/dist/components/Box/index.d.ts +0 -6
  41. package/dist/components/Config/Config.d.ts +0 -179
  42. package/dist/components/Config/defaults.d.ts +0 -25
  43. package/dist/components/Config/index.d.ts +0 -11
  44. package/dist/components/Guide/Guide.d.ts +0 -70
  45. package/dist/components/Guide/index.d.ts +0 -6
  46. package/dist/components/Guide/types.d.ts +0 -144
  47. package/dist/components/Guide/validation.d.ts +0 -82
  48. package/dist/components/Layout/Layout.d.ts +0 -73
  49. package/dist/components/Layout/index.d.ts +0 -10
  50. package/dist/components/Padder/Padder.d.ts +0 -67
  51. package/dist/components/Padder/index.d.ts +0 -10
  52. package/dist/components/Spacer/Spacer.d.ts +0 -48
  53. package/dist/components/Spacer/index.d.ts +0 -10
  54. package/dist/components/Stack/Stack.d.ts +0 -84
  55. package/dist/components/Stack/index.d.ts +0 -10
  56. package/dist/components/index.d.ts +0 -16
  57. package/dist/components/styles/index.d.ts +0 -11
  58. package/dist/components/types.d.ts +0 -102
  59. package/dist/hooks/index.d.ts +0 -11
  60. package/dist/hooks/useBaseline.d.ts +0 -55
  61. package/dist/hooks/useConfig.d.ts +0 -41
  62. package/dist/hooks/useDebug.d.ts +0 -49
  63. package/dist/hooks/useGuide.d.ts +0 -61
  64. package/dist/hooks/useIsClient.d.ts +0 -6
  65. package/dist/hooks/useMeasure.d.ts +0 -35
  66. package/dist/hooks/useVirtual.d.ts +0 -60
  67. package/dist/styles.d.ts +0 -6
  68. package/dist/theme.d.ts +0 -6
  69. package/dist/utils/convert.d.ts +0 -24
  70. package/dist/utils/grid.d.ts +0 -22
  71. package/dist/utils/index.d.ts +0 -15
  72. package/dist/utils/math.d.ts +0 -48
  73. package/dist/utils/merge.d.ts +0 -117
  74. package/dist/utils/normalize.d.ts +0 -30
  75. package/dist/utils/padding.d.ts +0 -11
  76. package/dist/utils/parse.d.ts +0 -18
  77. package/dist/utils/snapping.d.ts +0 -28
  78. package/dist/utils/ssr.d.ts +0 -26
  79. package/dist/utils/timing.d.ts +0 -45
package/CHANGELOG.md ADDED
@@ -0,0 +1,235 @@
1
+ # baseline-kit
2
+
3
+ ## Unreleased
4
+
5
+ ### Improvements
6
+
7
+ - Added the React-free Remix 3 entry point and its dedicated CSS entry.
8
+ - Added a Node-only Remix SSR compatibility entry that preserves nested Config
9
+ context during serialization and fails closed if the pinned Remix renderer
10
+ changes.
11
+ - Added TypeScript 7 compiler support while keeping lint and declaration tools
12
+ on the official TypeScript 6 compatibility API until their TypeScript 7 APIs
13
+ are released.
14
+ - Simplified the public documentation around entry points, sizing, themes,
15
+ text-box alignment, SSR, and release checks.
16
+ - Removed unused CSS and linting dependencies, including `cssnano`.
17
+
18
+ ### Bug fixes
19
+
20
+ - Fixed relative browser sizing, scoped Config color propagation, and delayed
21
+ hydration regressions across the React and native Remix adapters.
22
+ - Box and Padder now opt into `text-box: trim-both ex alphabetic` when the
23
+ browser supports it, while retaining normal line boxes as a fallback.
24
+
25
+ ## 5.1.0
26
+
27
+ ### Minor Changes
28
+
29
+ - fbc8acc: Validation complete: the delayed-entry nested Config regressions and complete
30
+ browser matrix pass in the packed consumer. Version and publish this candidate
31
+ through the normal Changesets workflow after review.
32
+
33
+ Use the new Node-only `baseline-kit/remix/server` renderer for SSR with the
34
+ pinned Remix RC. It preserves nested provider context during serialization,
35
+ validates the upstream source digest, and leaves installed dependencies unchanged.
36
+
37
+ Add a React-free `baseline-kit/remix` adapter and `baseline-kit/styles/remix`, tested with Remix 3.0.0-rc.2. React applications keep using the root or guide entry without installing Remix.
38
+
39
+ Fix browser-resolved Baseline sizing, scoped Config color propagation, default paint without a theme, shared React Config across root/guide imports, and observer lifecycle regressions. Box and Padder now apply CSS text-box trimming using x-height (`ex`) and alphabetic baseline metrics; unsupported browsers retain normal line boxes.
40
+
41
+ Update the public installation, SSR, asset loading, spacing, browser support, and contributor documentation. Keep internal workspaces private, include the changelog in npm packages, and verify browser behavior using the packed native adapter before release.
42
+
43
+ ## 5.0.0
44
+
45
+ ### Breaking changes
46
+
47
+ - **Removed `Layout` and `Stack` components.** The library now focuses on its
48
+ core mission — baseline-grid visualization (`Baseline`, `Guide`) and spacing
49
+ primitives (`Box`, `Padder`, `Spacer`, `Config`). The following exports are
50
+ gone:
51
+ - Components: `Layout`, `Stack`
52
+ - Types: `LayoutProps`, `StackProps`
53
+ - Pure descriptors: `createLayoutDescriptor`, `createStackDescriptor`,
54
+ `getGridTemplate`, `LayoutDescriptor`, `LayoutDescriptorParams`,
55
+ `StackDescriptor`, `StackDescriptorParams`, `DIRECTION_AXIS`
56
+ - `Config` schema: `stack` and `layout` branches on `ConfigSchema`,
57
+ corresponding `stack` / `layout` props on `<Config>`
58
+ - CSS variables: `--bksk-*`, `--bkly-*`, and their themed counterparts
59
+ `--bk-stack-color-*`, `--bk-layout-color-*`
60
+
61
+ **Migration** — replace `<Layout>` with a plain `<div>` using `display: grid`
62
+ (or your design system's grid wrapper), and `<Stack>` with `display: flex`:
63
+
64
+ ```tsx
65
+ // Before
66
+ <Layout columns={3} gap={16}>{children}</Layout>
67
+ <Stack direction="column" gap={8}>{children}</Stack>
68
+
69
+ // After
70
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16 }}>
71
+ {children}
72
+ </div>
73
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
74
+ {children}
75
+ </div>
76
+ ```
77
+
78
+ ### Bug fixes
79
+
80
+ - `Stack` gap / rowGap / columnGap values are now emitted with `px` units.
81
+ Numeric gaps were stringified to unitless values (`"8"`), which browsers
82
+ drop for non-zero `row-gap` / `column-gap` declarations, silently breaking
83
+ spacing. _(This fix landed before the `Stack` component was retired; it
84
+ matters now for any code still using `createStackDescriptor` from the core
85
+ package up to 5.0.0 — though that descriptor itself has also been removed.)_
86
+ - `useBaseline` snapping now fires on the first real measurement. The previous
87
+ implementation flipped a "did-snap" latch during the initial render (when
88
+ `useMeasure` has not yet reported a height), so `Box` and `Padder` using
89
+ `snapping="height"` or `"clamp"` silently skipped the snap entirely.
90
+ - `createMeasureObserver` and `createVirtualTracker` now cancel their pending
91
+ `requestAnimationFrame` callback inside `disconnect()`. Previously an
92
+ in-flight frame could invoke `onChange` after the consumer had already
93
+ unmounted the observer.
94
+ - `calculateGuideTemplate` and `normalizeValue` accept a `ConversionContext`
95
+ that threads the real browser viewport through for `vw` / `vh` / `vmin` /
96
+ `vmax` conversion. The React hooks pass it via a new `getViewportContext()`
97
+ helper in `@baseline-kit/dom`. Core stays zero-dependency.
98
+
99
+ ### Architecture
100
+
101
+ - Source is now a monorepo under `packages/{core, dom, react}`.
102
+ `@baseline-kit/core` is pure TypeScript (zero dependencies), `@baseline-kit/dom`
103
+ holds imperative observers and timing utilities, `@baseline-kit/react` is the
104
+ React adapter that consumers publish-install as plain `baseline-kit`.
105
+ Types for the top-level `baseline-kit` entry are now bundled flat into
106
+ `dist/index.d.ts` via `rollup-plugin-dts`, so consumers don't see workspace
107
+ paths in their editor.
108
+
109
+ ### Improvements
110
+
111
+ - Spacer measurement labels (e.g. `"8px"`) are marked `aria-hidden="true"` —
112
+ they're developer annotations, not content screen readers should announce.
113
+ - `Baseline` (`.bas`) and `Guide` (`.cols`) overlays get
114
+ `contain: layout style paint`, isolating debug-grid updates from surrounding
115
+ page layout.
116
+ - Removed dead `createStyleOverride` calls in Box / Stack / Layout / Baseline
117
+ descriptors where the "override" value was always identical to its default.
118
+ CSS module defaults in `base.css` carry the values the user sees.
119
+ - Hydration state consolidated: `Box`, `Spacer`, `Padder` now use a single
120
+ `useIsClient` hook instead of five copies of the `useState` + `useEffect`
121
+ pattern.
122
+ - Dropped the dead `warnOnMisalignment` option from `BaselineOptions` (the
123
+ hook had been ignoring it since deprecation).
124
+ - Standardised ref typing (`HTMLDivElement | null`) across components.
125
+
126
+ ### Dependencies
127
+
128
+ - `jsdom` 26 → 29 (test env)
129
+ - `rollup-plugin-visualizer` 5 → 7 (dev-only bundle analyzer)
130
+ - `typescript` peer range widened to `^5.8.2 || ^6.0.0` so consumers can use
131
+ TS 6; devDep pinned at `^5.9.3` for reproducible builds.
132
+ - `eslint` 10 held back — upstream `eslint-plugin-react` 7.37.5 still uses
133
+ APIs removed in ESLint 10. Will revisit when the plugin ships a compatible
134
+ release.
135
+ - `eslint-plugin-react-hooks` 7 held back — its new rules flag longstanding
136
+ patterns (`useBaseline` ref-latch, `useIsClient` setState-in-effect) that
137
+ need their own refactor.
138
+ - `@types/node` kept on 22 (LTS alignment).
139
+
140
+ ### CI
141
+
142
+ - Pinned Node to `22` in `test.yml` and `publish.yml` via
143
+ `actions/setup-node@v4` to satisfy engine requirements of the bumped
144
+ `jsdom` and `rollup-plugin-visualizer`.
145
+ - `typescript` added to `devDependencies` so CI resolves the same version as
146
+ local development (fresh checkouts were otherwise pulling the peer range's
147
+ latest satisfying version).
148
+
149
+ ### Testing
150
+
151
+ - 206 tests, up from 174 at the start of the v5 cycle. Coverage added for
152
+ every pure descriptor (`baseline`, `box`, `guide`, `padder`, `spacer`, plus
153
+ pre-existing `stack` regression test), viewport context threading,
154
+ `rafThrottle` cancel, and the `useBaseline` first-measurement snap.
155
+
156
+ ## 3.0.2
157
+
158
+ ### Patch Changes
159
+
160
+ - More Readme fix
161
+
162
+ ## 3.0.1
163
+
164
+ ### Patch Changes
165
+
166
+ - Update README
167
+
168
+ ## 3.0.0
169
+
170
+ ### Major Changes
171
+
172
+ - comprehensive component library redesign with improved theming system and optimized rendering
173
+
174
+ ## 2.1.0
175
+
176
+ ### Minor Changes
177
+
178
+ - Added comprehensive Server-Side Rendering (SSR) support:
179
+ - Created new SSR utilities for stable rendering between server and client
180
+ - Updated package exports for proper CSS file resolution in SSR environments
181
+ - Added deterministic initial rendering for all components
182
+ - Implemented hydration-aware components that enhance after client-side hydration
183
+ - Added `ssrMode` prop for explicit SSR optimization
184
+ - Improved compatibility with Next.js, Remix, and other React Router applications
185
+
186
+ ## 2.0.2
187
+
188
+ ### Patch Changes
189
+
190
+ - React 19 compatibility:
191
+ - Replaced useContext with the React 19 `use` hook
192
+ - Updated Context Provider syntax
193
+ - Improved theme system organization and documentation
194
+ - Fixed gitignore and repository organization
195
+ - Updated dependencies
196
+
197
+ ## 2.0.1
198
+
199
+ ### Patch Changes
200
+
201
+ - 63a10ba: Fix readme, remove the demo and improved layout
202
+
203
+ ## 2.0.0
204
+
205
+ ### Major Changes
206
+
207
+ - 883f42d: API Refactor and added Stack Layout components
208
+
209
+ ## 1.1.2
210
+
211
+ ### Patch Changes
212
+
213
+ - type and lint fixing
214
+
215
+ ## 1.1.1
216
+
217
+ ### Patch Changes
218
+
219
+ - documentation update
220
+
221
+ ## 1.1.0
222
+
223
+ ### Minor Changes
224
+
225
+ - Added Spacer component
226
+
227
+ ## 1.0.0
228
+
229
+ ### Major Changes
230
+
231
+ - Removed PaddedGrid Component and update API
232
+
233
+ ### Patch Changes
234
+
235
+ - 4ec1a23: Refactor the props configurations