Skip to content

Commit

Permalink
fix: export combined css var and themeToVar
Browse files Browse the repository at this point in the history
  • Loading branch information
akumatus committed Oct 28, 2024
1 parent fed5691 commit ed1e9ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
15 changes: 2 additions & 13 deletions packages/theme/src/index.css.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import { globalStyle } from '@vanilla-extract/css';

import {
darkCssVariables,
lightCssVariables,
combinedDarkCssVariables,
combinedLightCssVariables,
printCssVariables,
} from './index';
import { darkCssVariablesV2, lightCssVariablesV2 } from './v2';

export const combinedLightCssVariables = {
...lightCssVariables,
...lightCssVariablesV2,
};

export const combinedDarkCssVariables = {
...darkCssVariables,
...darkCssVariablesV2,
};

globalStyle(':root', {
vars: combinedLightCssVariables,
Expand Down
13 changes: 12 additions & 1 deletion packages/theme/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { grabbingCursor, grabCursor } from './cursors';
import { darkCssVariablesV2, lightCssVariablesV2 } from './v2';

export const camelToKebab = (s: string) => {
if (typeof s !== 'string') return '';
Expand All @@ -14,7 +15,7 @@ export const camelToKebab = (s: string) => {
const toCSSCursor = (cursor: string, fallbacks: string[]) => {
return `url(${cursor}), ${fallbacks.join(', ')}`;
};
const themeToVar = (themeName: keyof AffineTheme) =>
export const themeToVar = (themeName: keyof AffineTheme) =>
`--affine-${camelToKebab(themeName)}` as keyof AffineCssVariables;
const objectEntries = <T extends Record<string, any>>(
obj: T
Expand Down Expand Up @@ -454,6 +455,16 @@ export const lightCssVariables = createVariables(lightTheme);
export const darkCssVariables = createVariables(darkTheme);
export const printCssVariables = createVariables(printTheme);

export const combinedLightCssVariables = {
...lightCssVariables,
...lightCssVariablesV2,
};

export const combinedDarkCssVariables = {
...darkCssVariables,
...darkCssVariablesV2,
};

/**
* Get AFFiNE css variable name type safely
* @param key in camel or kebab format
Expand Down

0 comments on commit ed1e9ce

Please sign in to comment.