From 81cfd4057848a5145a4cccab620cd9238ee7a419 Mon Sep 17 00:00:00 2001 From: John Otander Date: Wed, 4 May 2022 10:35:33 -0600 Subject: [PATCH] Fix pascal case bug --- .changeset/stupid-sheep-draw.md | 5 +++++ packages/gui/src/lib/util.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/stupid-sheep-draw.md diff --git a/.changeset/stupid-sheep-draw.md b/.changeset/stupid-sheep-draw.md new file mode 100644 index 00000000..5449ea1f --- /dev/null +++ b/.changeset/stupid-sheep-draw.md @@ -0,0 +1,5 @@ +--- +'@compai/css-gui': patch +--- + +Fix pascal case bug diff --git a/packages/gui/src/lib/util.ts b/packages/gui/src/lib/util.ts index 884d2e7b..b546227b 100644 --- a/packages/gui/src/lib/util.ts +++ b/packages/gui/src/lib/util.ts @@ -1,7 +1,7 @@ import { EditorProps } from '../types/editor' import { isPseudoClass, isPseudoElement } from './pseudos' import { isElement } from './elements' -import { camelCase, lowerCase, startCase, upperFirst } from 'lodash-es' +import { lowerCase, startCase, upperFirst } from 'lodash-es' export type EditorPropsWithLabel = EditorProps & { label: string } /** @@ -96,13 +96,13 @@ export const toGoogleFontUrl = (families: FontFamilyData[]) => { */ export const toGoogleVariableFontUrl = (variableFonts: any[]) => { if (!variableFonts?.length) return null - + let familyQueries: any[] = [] variableFonts.forEach((vFont) => { let prependQuery = `family=${plusify(vFont.name)}:` delete vFont['name'] - + let orderedKeys = [ ...Object.keys(vFont) .filter((k) => k === k.toLowerCase()) @@ -111,9 +111,9 @@ export const toGoogleVariableFontUrl = (variableFonts: any[]) => { .filter((k) => k === k.toUpperCase()) .sort(), ] - + const queryParams = orderedKeys.join(',') - + const queryRange = orderedKeys .map((key) => { if (key === 'ital') return null @@ -137,5 +137,5 @@ export const toGoogleVariableFontUrl = (variableFonts: any[]) => { } export function pascalCase(str: string) { - return startCase(camelCase(str)) + return startCase(str).replace(/\s/g, '') }