@cobalt-ui/core
Advanced tools
Comparing version
# @cobalt-ui/core | ||
## 1.1.1 | ||
### Patch Changes | ||
- [#37](https://github.com/drwpow/cobalt-ui/pull/37) [`214559f`](https://github.com/drwpow/cobalt-ui/commit/214559f87d5fe38355b5ef0552388397cb77129b) Thanks [@drwpow](https://github.com/drwpow)! - Fix Tokens Studio opacity token type | ||
- [#37](https://github.com/drwpow/cobalt-ui/pull/37) [`214559f`](https://github.com/drwpow/cobalt-ui/commit/214559f87d5fe38355b5ef0552388397cb77129b) Thanks [@drwpow](https://github.com/drwpow)! - Fix bug where `$type: number, $value: 0` was treated as a missing value | ||
## 1.1.0 | ||
@@ -4,0 +12,0 @@ |
{ | ||
"name": "@cobalt-ui/core", | ||
"description": "CLI for using the W3C design token format", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": { | ||
@@ -9,2 +9,13 @@ "name": "Drew Powers", | ||
}, | ||
"keywords": [ | ||
"design tokens", | ||
"cli", | ||
"w3c design tokens", | ||
"design system", | ||
"typescript", | ||
"sass", | ||
"css", | ||
"style tokens", | ||
"style system" | ||
], | ||
"repository": { | ||
@@ -11,0 +22,0 @@ "type": "git", |
@@ -138,4 +138,11 @@ /** | ||
case 'lineHeights': | ||
case 'opacity': | ||
case 'sizing': { | ||
addToken({$type: 'dimension', $value: v.value === '0' ? 0 : v.value}, [...path, k]); | ||
// this is a number if this is unitless | ||
const isNumber = typeof v.value === 'number' || (typeof v.value === 'string' && String(Number(v.value)) === v.value); | ||
if (isNumber) { | ||
addToken({$type: 'number', $value: Number(v.value)}, [...path, k]); | ||
} else { | ||
addToken({$type: 'dimension', $value: v.value}, [...path, k]); | ||
} | ||
break; | ||
@@ -147,8 +154,2 @@ } | ||
} | ||
// unsupported | ||
case 'opacity': { | ||
// @ts-expect-error this should throw a warning | ||
addToken({$type: 'opacity', $value: v.value}, [...path, k]); | ||
break; | ||
} | ||
case 'spacing': { | ||
@@ -155,0 +156,0 @@ // invalid token: surface error |
@@ -21,5 +21,5 @@ import type {ParsedNumberToken} from '../../token.js'; | ||
export function normalizeNumberValue(value: unknown): ParsedNumberToken['$value'] { | ||
if (!value) throw new Error('missing value'); | ||
if (value === null || value === undefined) throw new Error('missing value'); | ||
if (typeof value === 'number') return value; | ||
throw new Error(`expected number, received ${typeof value}`); | ||
} |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
54994
1.59%1314
0.08%