basalt-ui 1.4.0 → 1.4.1

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.4.1](https://github.com/jkrumm/basalt-ui/compare/v1.4.0...v1.4.1) (2026-07-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * tell a spacing length apart from a dimensionless ratio ([d7629e5](https://github.com/jkrumm/basalt-ui/commit/d7629e5ec4b5d224accb31ac00a2e40d89de6dca))
7
+
1
8
  # [1.4.0](https://github.com/jkrumm/basalt-ui/compare/v1.3.0...v1.4.0) (2026-07-28)
2
9
 
3
10
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAA;AA6N9D,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,EAAE,WAmBlC,CAAA;AAgSD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;gCA0BL,WAAW;;;;;;gCAaX,WAAW;;;;;;;gCAaX,WAAW;;;;;;;gCAQX,WAAW;;;;;;gCAOX,WAAW;;;;;;;gCASX,WAAW;;;;;;gCAOX,WAAW;;;;;;;gCASX,WAAW;;;;;;gCAMX,WAAW;;;;;;;gCASX,WAAW;;;;;;;gCAUX,WAAW;;;;;;;gCAUX,WAAW;;;;;;;gCASX,WAAW;;;;;;;gCASX,WAAW;;;;;;;gCAUX,WAAW;;;;CAOmB,CAAA;AAUjD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,EAAE,CA2NtF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE7E,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,CAAA;AAsO9D,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,EAAE,WAmBlC,CAAA;AAgSD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;gCA0BL,WAAW;;;;;;gCAaX,WAAW;;;;;;;gCAaX,WAAW;;;;;;;gCAQX,WAAW;;;;;;gCAOX,WAAW;;;;;;;gCASX,WAAW;;;;;;gCAOX,WAAW;;;;;;;gCASX,WAAW;;;;;;gCAMX,WAAW;;;;;;;gCASX,WAAW;;;;;;;gCAUX,WAAW;;;;;;;gCAUX,WAAW;;;;;;;gCASX,WAAW;;;;;;;gCASX,WAAW;;;;;;;gCAUX,WAAW;;;;CAOmB,CAAA;AAUjD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,EAAE,CA2NtF"}
@@ -19,8 +19,9 @@ const LAYOUT_SURFACE_PROP = /\b(?:display|padding|margin|gap|flex|grid|border|ba
19
19
  const BOX_SIDE = "(?:Top|Bottom|Left|Right|Block|Inline)(?:Start|End)?";
20
20
  const BOX_SIDE_KEBAB = "(?:top|bottom|left|right|block|inline)(?:-(?:start|end))?";
21
21
  const SPACING_PROP = `(?:padding|margin)(?:${BOX_SIDE}|-${BOX_SIDE_KEBAB})?|gap|rowGap|columnGap|row-gap|column-gap`;
22
+ const SPACING_NUMBER = "(?:\\d*\\.\\d+(?=[a-z%])|\\d+(?!\\.\\d))";
22
23
  const INLINE_SPACING = new RegExp(
23
- `(?<![\\w-])(?:${SPACING_PROP})\\s*:\\s*(?!var\\()['"]?[-+]?(?!0(?![.\\d]))(?:\\d|\\.\\d)`,
24
+ `(?<![\\w-])(?:${SPACING_PROP})\\s*:\\s*(?!var\\()['"]?[-+]?(?!0(?![.\\d]))${SPACING_NUMBER}`,
24
25
  "g"
25
26
  );
26
27
  const MICRO_SPACING_CEILING_PX = 10;
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # basalt-ui v1.4.0
1
+ # basalt-ui v1.4.1
2
2
  # Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets
3
3
  #
4
4
  # basalt-ui is an opinionated framework for Mantine-based React apps.
@@ -19,7 +19,7 @@
19
19
  # ./tokens.css subpath. Guide: docs/FRAMEWORK-FREE.md in the repo.
20
20
 
21
21
  Package: basalt-ui
22
- Version: 1.4.0
22
+ Version: 1.4.1
23
23
 
24
24
  ## basalt-ui
25
25
  Import: import { ... } from 'basalt-ui'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basalt-ui",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
5
5
  "keywords": [
6
6
  "charts",
@@ -1173,6 +1173,27 @@ describe('CSS applicability', () => {
1173
1173
  expect(cssSpacing('padding: 2em')).toEqual(['inline-spacing'])
1174
1174
  })
1175
1175
 
1176
+ it('does NOT read a unitless fraction — that is a ratio, not a length', () => {
1177
+ // visx band padding. Ten of these in one consumer's chart files the day the leading-decimal fix
1178
+ // shipped: `padding` here is dimensionless 0–1, and "use p/m/gap with xs..xl" cannot be done to
1179
+ // it. Admitting `.75rem` and admitting `0.3` are the same regex change; the unit tells them
1180
+ // apart. Scoping inline-spacing out of chart files would also have cleared it, and would have
1181
+ // dropped real coverage inside charts/ while leaving the false positive live everywhere else.
1182
+ const scale = (src: string): GuardKind[] =>
1183
+ kinds(checkSource(src, 'src/charts/kinds/Bars.tsx', DEFAULT_GUARD_CONFIG)).filter(
1184
+ (k) => k === 'inline-spacing',
1185
+ )
1186
+ expect(
1187
+ scale('const s = scalePoint<string>({ domain: d, range: [0, w], padding: 0.3 })'),
1188
+ ).toEqual([])
1189
+ expect(scale('const s = scaleBand({ padding: .2 })')).toEqual([])
1190
+ // A unitless INTEGER is still 4px by React's convention, and still a finding.
1191
+ expect(scale('<Box style={{ padding: 4 }} />')).toEqual(['inline-spacing'])
1192
+ // A fraction WITH a unit is a real length and still flags — above the sub-scale ceiling, since
1193
+ // 0.3rem is 4.8px and would be excused by the micro-spacing escape for that reason instead.
1194
+ expect(cssSpacing('padding: 0.7rem')).toEqual(['inline-spacing'])
1195
+ })
1196
+
1176
1197
  it('reads a CSS number without its integer part, and one carrying an explicit +', () => {
1177
1198
  // `.75rem` IS `0.75rem` and `+12px` IS `12px`. Requiring a leading digit skipped both — the
1178
1199
  // same silent skip the `0.` guard was fixed for, one spelling over.
@@ -82,17 +82,26 @@ const SPACING_PROP = `(?:padding|margin)(?:${BOX_SIDE}|-${BOX_SIDE_KEBAB})?|gap|
82
82
  // starting `0.` matched the guard and dropped out of the scan entirely. `0.75rem` is 12px, a real
83
83
  // spacing value, and it was invisible. `(?!0(?![.\d]))` excuses only a zero that ends there.
84
84
  //
85
- // The number itself is `[-+]?(?:\d|\.\d)`, not `-?\d`: CSS lets a value carry an explicit `+` and
86
- // omit the integer part, so `.75rem` and `+12px` are the same spacing as `0.75rem` and `12px`.
87
- // Requiring a leading digit skipped both — the same silent-skip the zero guard above was fixed for,
88
- // one spelling over.
89
- //
90
85
  // The property is preceded by `(?<![\w-])`, not `\b`: a `\b` boundary sits inside a hyphenated
91
86
  // identifier, so every custom property whose NAME ends in a spacing word — the token layer's own
92
87
  // `--vx-space-article-header-padding-bottom`, a consumer's `--card-padding-inline` — matched as if
93
88
  // it were a declaration. A custom property is a definition, not a rendered spacing decision.
89
+ //
90
+ // The number does two things at once. CSS lets a value carry an explicit `+` and omit the integer
91
+ // part, so `.75rem` and `+12px` are the same spacing as `0.75rem` and `12px`; requiring a leading
92
+ // digit skipped both — the same silent-skip the zero guard above was fixed for, one spelling over.
93
+ //
94
+ // But admitting a fractional part also admits values that are not lengths at all. A UNITLESS
95
+ // fraction is never a spacing literal: `padding: 4` in an inline style is 4px by React's convention,
96
+ // while `padding: 0.3` is a RATIO — visx's band padding (`scalePoint({ padding: 0.3 })`) found this,
97
+ // ten times over in one consumer, and the guard's own advice ("use p/m/gap with xs..xl") is
98
+ // meaningless for it. So the discriminator is the UNIT, not the digit shape: a fraction must carry
99
+ // one (`.75rem`), and a unitless number must be an integer (`padding: 4` — still 4px, still a
100
+ // finding). `0.3` matches neither and drops out. `(?=[a-z%])` covers every CSS unit without
101
+ // enumerating them, and the sign stays outside so the zero guard still sees `-0` as a zero.
102
+ const SPACING_NUMBER = '(?:\\d*\\.\\d+(?=[a-z%])|\\d+(?!\\.\\d))'
94
103
  const INLINE_SPACING = new RegExp(
95
- `(?<![\\w-])(?:${SPACING_PROP})\\s*:\\s*(?!var\\()['"]?[-+]?(?!0(?![.\\d]))(?:\\d|\\.\\d)`,
104
+ `(?<![\\w-])(?:${SPACING_PROP})\\s*:\\s*(?!var\\()['"]?[-+]?(?!0(?![.\\d]))${SPACING_NUMBER}`,
96
105
  'g',
97
106
  )
98
107