New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cobalt-ui/core

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cobalt-ui/core - npm Package Compare versions

Comparing version

to
1.1.1

8

CHANGELOG.md
# @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 @@

13

package.json
{
"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",

15

src/parse/tokens-studio.ts

@@ -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}`);
}