From 1ff1da5c485e2d6d55fc66030d82f49f92321da6 Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Sun, 6 Aug 2023 07:23:32 +0200 Subject: [PATCH] b2b exposes preset --- themes/theme-core/package.json | 10 ++++++---- themes/theme-core/src/preset.ts | 11 +++++++---- themes/theme-core/src/screens.ts | 7 +++++++ themes/theme-core/src/theme.ts | 16 ++++++---------- themes/theme-core/tsup.config.ts | 2 +- 5 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 themes/theme-core/src/screens.ts diff --git a/themes/theme-core/package.json b/themes/theme-core/package.json index c909ebde62..1c00f79370 100644 --- a/themes/theme-core/package.json +++ b/themes/theme-core/package.json @@ -13,7 +13,9 @@ "module": "./dist/index.mjs", "types": "./dist/index.d.ts", "exports": { - "./index.css": "./dist/index.css" + "./index.css": "./dist/index.css", + "./preset": "./dist/preset.mjs", + "./preset/cjs": "./dist/preset.js" }, "sideEffects": false, "files": [ @@ -25,7 +27,6 @@ "directory": "packages/theme-core" }, "devDependencies": { - "@marigold/theme-preset": "workspace:*", "@marigold/tsconfig": "workspace:*", "autoprefixer": "10.4.14", "cssnano": "6.0.1", @@ -33,9 +34,10 @@ "tailwindcss": "3.3.3", "tsup": "6.7.0" }, - "peerDependencies": { + "dependencies": { "@marigold/components": "workspace:*", - "@marigold/system": "workspace:*" + "@marigold/system": "workspace:*", + "@marigold/theme-preset": "workspace:*" }, "scripts": { "build": "NODE_ENV=production tsup", diff --git a/themes/theme-core/src/preset.ts b/themes/theme-core/src/preset.ts index c220322b0d..963eb24f0b 100644 --- a/themes/theme-core/src/preset.ts +++ b/themes/theme-core/src/preset.ts @@ -1,26 +1,29 @@ import { createPreset } from '@marigold/theme-preset'; -import { theme } from './theme'; +import { screens } from './screens'; +import { colors } from './tokens'; export interface PresetConfig { name: string; preflight?: boolean; } -export const preset = createPreset('core', { +export type Preset = ReturnType; + +export const preset: Preset = createPreset('core', { corePlugins: { preflight: false, }, theme: { extend: { - screens: theme.screens, + screens, fontFamily: { body: 'Arial, Helvetica, sans-serif', }, fontSize: { body: '13px', }, - colors: theme.colors, + colors, transitionTimingFunction: { 'ease-out': 'ease-out', }, diff --git a/themes/theme-core/src/screens.ts b/themes/theme-core/src/screens.ts new file mode 100644 index 0000000000..ec164f2227 --- /dev/null +++ b/themes/theme-core/src/screens.ts @@ -0,0 +1,7 @@ +export const screens = { + sm: '640px', + md: '768px', + lg: '1024px', + xl: '1280px', + '2xl': '1536px', +}; diff --git a/themes/theme-core/src/theme.ts b/themes/theme-core/src/theme.ts index 364d18cd86..5765937b2d 100644 --- a/themes/theme-core/src/theme.ts +++ b/themes/theme-core/src/theme.ts @@ -1,19 +1,15 @@ import { Theme } from '@marigold/system'; -import { colors } from './tokens'; -import * as components from './components'; import { root } from './root'; +import { screens } from './screens'; +import { colors } from './tokens'; + +import * as components from './components'; export const theme: Theme = { name: 'core', - screens: { - sm: '640px', - md: '768px', - lg: '1024px', - xl: '1280px', - '2xl': '1536px', - }, + screens, root, - colors: colors, + colors, components, }; diff --git a/themes/theme-core/tsup.config.ts b/themes/theme-core/tsup.config.ts index 48fa877fa6..0f4bafd707 100644 --- a/themes/theme-core/tsup.config.ts +++ b/themes/theme-core/tsup.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'tsup'; export default defineConfig({ - entry: ['src/index.ts', 'src/index.css'], + entry: ['src/index.ts', 'src/index.css', 'src/preset.ts'], format: ['esm', 'cjs'], tsconfig: './tsconfig.build.json', dts: true,