unpreset / unocss-preset-theme

The dynamic theme presets for UnoCSS.
https://unocss-preset-theme.todev.cc
131 stars 11 forks source link

type definition errors on presetTheme #8

Closed MellKam closed 1 year ago

MellKam commented 1 year ago

image

My code -

import { defineConfig, presetUno } from 'unocss';
import presetTheme from 'unocss-preset-theme';
import type { Theme } from 'unocss/preset-uno';

export default defineConfig({
  theme: {
    colors: {
      primary: '#1677ff',
      'primary-border': '#1677ff',
      text: 'rgba(0, 0, 0, 0.88)',
      container: '#ffffff',
      border: '#d9d9d9',
    },
    spacing: {
      xss: '4px',
      xs: '8px',
      sm: '12px',
      base: '16px',
      lg: '24px',
      xl: '32px',
    },
  },
  presets: [
    presetUno(),
    presetTheme<Theme>({
      theme: {
        dark: {
          colors: {
            primary: '#1668dc',
            'primary-border': '#1668dc',
            border: '#424242',
            container: '#141414',
            text: 'rgba(255, 255, 255, 0.85)',
          },
        },
        compact: {
          spacing: {
            xss: '2px',
            xs: '4px',
            sm: '6px',
            base: '8px',
            lg: '12px',
            xl: '16px',
          },
        },
      },
    }),
  ],
});

Reproduction - https://codesandbox.io/p/sandbox/distracted-wilson-tydk5g?welcome=true

I saw you already have this issue, but for some reason it is not fixed. https://github.com/Dunqing/unocss-preset-theme/issues/4

Dunqing commented 1 year ago

Hi, Thank you for your feedback, you can install the latest version, and this issue will be fixed.

MellKam commented 1 year ago

Hi! I updated the version in codesandbox, but it still gives an error :( https://codesandbox.io/p/sandbox/distracted-wilson-tydk5g?welcome=true

Dunqing commented 1 year ago

Do you forget to re-install dependencies?

image

The type error disappears when I re-install dependencies

image
MellKam commented 1 year ago

Yes, sorry. Now it is works👌 Thanks for fix