css-calipers 0.11.1 → 0.12.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/README.md +13 -5
- package/dist/esm/units/time.d.ts +1 -0
- package/dist/esm/units/time.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CSS-Calipers
|
|
2
2
|
|
|
3
|
-
**CSS is code.
|
|
3
|
+
**CSS is code. Treat it that way.**
|
|
4
4
|
Compile-time unit safety for numeric, unit-bearing CSS values, no surprises at runtime.
|
|
5
5
|
|
|
6
6
|
CSS-Calipers is a tiny layer for typed CSS measurements. Stop parsing CSS
|
|
@@ -125,8 +125,8 @@ CSS-Calipers is a good fit if:
|
|
|
125
125
|
- You already use TypeScript (or plan to) and want compile-time guarantees around CSS units.
|
|
126
126
|
- You have a design system or token layer where layout math and unit conversions matter.
|
|
127
127
|
- You care about catching unit mismatches and layout invariants early, in dev or tests.
|
|
128
|
-
This library is opinionated about types and emitting valid CSS at the edges,
|
|
129
|
-
but intentionally loose about how you structure or apply styles in between.
|
|
128
|
+
This library is opinionated about types and emitting valid CSS at the edges,
|
|
129
|
+
but intentionally loose about how you structure or apply styles in between.
|
|
130
130
|
|
|
131
131
|
It’s probably overkill if:
|
|
132
132
|
|
|
@@ -177,7 +177,7 @@ const columns = 3;
|
|
|
177
177
|
if (process.env.NODE_ENV !== "production") {
|
|
178
178
|
assertCondition(
|
|
179
179
|
() => columns > 0,
|
|
180
|
-
"cardGridStyles: columns must be greater than zero"
|
|
180
|
+
"cardGridStyles: columns must be greater than zero",
|
|
181
181
|
);
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -218,7 +218,7 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
218
218
|
assertMatchingUnits(
|
|
219
219
|
formTokens.field.paddingBlock,
|
|
220
220
|
formTokens.field.paddingInline,
|
|
221
|
-
"Form control padding mismatch"
|
|
221
|
+
"Form control padding mismatch",
|
|
222
222
|
);
|
|
223
223
|
}
|
|
224
224
|
```
|
|
@@ -268,9 +268,11 @@ css-calipers.m: Non-finite measurement value: undefined [code=CALIPERS_E_NONFINI
|
|
|
268
268
|
```
|
|
269
269
|
|
|
270
270
|
What it means
|
|
271
|
+
|
|
271
272
|
- A measurement was constructed with undefined, NaN, or Infinity.
|
|
272
273
|
|
|
273
274
|
How to fix
|
|
275
|
+
|
|
274
276
|
- Provide a real numeric value and a unit (m(12), m(12, "px")).
|
|
275
277
|
- Add a context label so the error points to the calling helper or token (m(12, { context: "tokens.cardWidth" })).
|
|
276
278
|
|
|
@@ -283,9 +285,11 @@ css-calipers.assertMatchingUnits: measurement unit mismatch: px vs em [code=CALI
|
|
|
283
285
|
```
|
|
284
286
|
|
|
285
287
|
What it means
|
|
288
|
+
|
|
286
289
|
- You mixed units without an explicit conversion.
|
|
287
290
|
|
|
288
291
|
How to fix
|
|
292
|
+
|
|
289
293
|
- Normalize units at the source (convert em to px or vice versa).
|
|
290
294
|
- Add an assertMatchingUnits call where the values enter your system.
|
|
291
295
|
|
|
@@ -298,9 +302,11 @@ css-calipers.Measurement.divide: Cannot divide 10px by zero [code=CALIPERS_E_DIV
|
|
|
298
302
|
```
|
|
299
303
|
|
|
300
304
|
What it means
|
|
305
|
+
|
|
301
306
|
- You attempted to divide by zero in a measurement operation.
|
|
302
307
|
|
|
303
308
|
How to fix
|
|
309
|
+
|
|
304
310
|
- Guard inputs before dividing or replace zero with a safe fallback.
|
|
305
311
|
|
|
306
312
|
### Clamp bounds
|
|
@@ -312,9 +318,11 @@ css-calipers.Measurement.clamp: clamp: min (20px) must be <= max (12px) [code=CA
|
|
|
312
318
|
```
|
|
313
319
|
|
|
314
320
|
What it means
|
|
321
|
+
|
|
315
322
|
- The clamp minimum is greater than the clamp maximum.
|
|
316
323
|
|
|
317
324
|
How to fix
|
|
325
|
+
|
|
318
326
|
- Ensure min and max come from the same source or swap them before calling clamp.
|
|
319
327
|
|
|
320
328
|
### Stack hints and configuration
|
package/dist/esm/units/time.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare const mS: import("../core").UnitHelper<"s">;
|
|
|
3
3
|
export declare const mMs: import("../core").UnitHelper<"ms">;
|
|
4
4
|
export type SMeasurement = MeasurementOf<typeof mS>;
|
|
5
5
|
export type MsMeasurement = MeasurementOf<typeof mMs>;
|
|
6
|
+
export type TimeMeasurement = SMeasurement | MsMeasurement;
|
|
6
7
|
//# sourceMappingURL=time.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/units/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,EAAE,mCAAqC,CAAC;AACrD,eAAO,MAAM,GAAG,oCAAsC,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,GAAG,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/units/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,EAAE,mCAAqC,CAAC;AACrD,eAAO,MAAM,GAAG,oCAAsC,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,OAAO,GAAG,CAAC,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,aAAa,CAAC"}
|