From 117308b5d745e7f4a0530f3fcd781d6190c79af3 Mon Sep 17 00:00:00 2001 From: Toru Kobayashi Date: Sat, 11 May 2024 21:07:05 +0900 Subject: [PATCH] fix: number token values --- packages/language-server/src/tokens/get-token.ts | 2 +- sandbox/vite/panda.config.ts | 5 +++++ sandbox/vite/src/App.tsx | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/language-server/src/tokens/get-token.ts b/packages/language-server/src/tokens/get-token.ts index d7d4b88..8a79638 100644 --- a/packages/language-server/src/tokens/get-token.ts +++ b/packages/language-server/src/tokens/get-token.ts @@ -70,7 +70,7 @@ export const getTokenFromPropValue = (ctx: PandaContext, prop: string, value: st let color = token.value // could be a semantic token, so the token.value wouldn't be a color directly, it's actually a CSS variable - if (!isColor(color) && token.value.startsWith('var(--')) { + if (!isColor(color) && typeof token.value === "string" && token.value.startsWith('var(--')) { const [tokenRef] = ctx.tokens.getReferences(token.originalValue) if (tokenRef?.value) { color = tokenRef.value diff --git a/sandbox/vite/panda.config.ts b/sandbox/vite/panda.config.ts index 8005662..1f2002b 100644 --- a/sandbox/vite/panda.config.ts +++ b/sandbox/vite/panda.config.ts @@ -17,6 +17,11 @@ export default defineConfig({ recipes: { button, }, + tokens: { + lineHeights: { + normal: { value: 1.4 } + } + }, semanticTokens: { colors: { danger: { diff --git a/sandbox/vite/src/App.tsx b/sandbox/vite/src/App.tsx index 02c3171..a027d9b 100644 --- a/sandbox/vite/src/App.tsx +++ b/sandbox/vite/src/App.tsx @@ -32,6 +32,7 @@ function App() { margin: '2rem', padding: '4', fontSize: '2xl', + lineHeight: 'normal' })} > Hello from Panda !