From 0fb763ddd199c4f8f2477064d4008fdf22b949a4 Mon Sep 17 00:00:00 2001 From: Sebastian Sebald Date: Mon, 29 Jul 2024 13:21:02 +0200 Subject: [PATCH] feat: add dedicated export for tokens to all themes (#4054) * feat: add dedicated export for tokens to all themes * Create lucky-bugs-repair.md --- .changeset/lucky-bugs-repair.md | 7 +++++++ themes/theme-b2b/package.json | 8 ++++---- themes/theme-b2b/src/tokens.ts | 6 +++--- themes/theme-b2b/tsup.config.ts | 2 +- themes/theme-core/package.json | 8 ++++---- themes/theme-core/src/tokens.ts | 6 +++--- themes/theme-core/tsup.config.ts | 2 +- themes/theme-docs/package.json | 8 ++++---- themes/theme-docs/src/tokens.ts | 2 +- themes/theme-docs/tsup.config.ts | 2 +- 10 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 .changeset/lucky-bugs-repair.md diff --git a/.changeset/lucky-bugs-repair.md b/.changeset/lucky-bugs-repair.md new file mode 100644 index 0000000000..f7067b6269 --- /dev/null +++ b/.changeset/lucky-bugs-repair.md @@ -0,0 +1,7 @@ +--- +"@marigold/theme-b2b": minor +"@marigold/theme-core": minor +"@marigold/theme-docs": minor +--- + +feat: add dedicated export for tokens to all themes (`@marigold//tokens`) diff --git a/themes/theme-b2b/package.json b/themes/theme-b2b/package.json index ba5dfbc86c..04c7d74c3e 100644 --- a/themes/theme-b2b/package.json +++ b/themes/theme-b2b/package.json @@ -18,10 +18,10 @@ "import": "./dist/index.mjs", "types": "./dist/index.d.ts" }, - "./preset": { - "require": "./dist/preset.js", - "import": "./dist/preset.mjs", - "types": "./dist/preset.d.ts" + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs", + "types": "./dist/*.d.ts" }, "./styles.css": "./dist/styles.css" }, diff --git a/themes/theme-b2b/src/tokens.ts b/themes/theme-b2b/src/tokens.ts index cea120a207..1bc83da8bb 100644 --- a/themes/theme-b2b/src/tokens.ts +++ b/themes/theme-b2b/src/tokens.ts @@ -279,7 +279,7 @@ export const colors = { DEFAULT: blue[400], }, }, -}; +} as const; // Shadow // --------------- @@ -290,7 +290,7 @@ export const shadow = { overlay: boxShadow.lg, sunken: boxShadow.none, }, -}; +} as const; // Component Height // --------------- @@ -300,4 +300,4 @@ export const height = { sm: '24px', // not used at all lg: '48px', // used in button }, -}; +} as const; diff --git a/themes/theme-b2b/tsup.config.ts b/themes/theme-b2b/tsup.config.ts index 48d7b0d4e1..5fcfc56fc7 100644 --- a/themes/theme-b2b/tsup.config.ts +++ b/themes/theme-b2b/tsup.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'tsup'; export default defineConfig({ - entry: ['src/index.ts', 'src/preset.ts'], + entry: ['src/index.ts', 'src/preset.ts', 'src/tokens.ts'], format: ['esm', 'cjs'], tsconfig: './tsconfig.build.json', dts: true, diff --git a/themes/theme-core/package.json b/themes/theme-core/package.json index 81082b7c7e..b1e3f0f11b 100644 --- a/themes/theme-core/package.json +++ b/themes/theme-core/package.json @@ -18,10 +18,10 @@ "import": "./dist/index.mjs", "types": "./dist/index.d.ts" }, - "./preset": { - "require": "./dist/preset.js", - "import": "./dist/preset.mjs", - "types": "./dist/preset.d.ts" + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs", + "types": "./dist/*.d.ts" }, "./styles.css": "./dist/styles.css" }, diff --git a/themes/theme-core/src/tokens.ts b/themes/theme-core/src/tokens.ts index d9762b3568..fb5abb6ed4 100644 --- a/themes/theme-core/src/tokens.ts +++ b/themes/theme-core/src/tokens.ts @@ -277,7 +277,7 @@ export const colors = { DEFAULT: blue[500], }, }, -}; +} as const; export const shadow = { surface: { @@ -286,7 +286,7 @@ export const shadow = { overlay: boxShadow.md, sunken: boxShadow.none, }, -}; +} as const; export const height = { component: { @@ -294,4 +294,4 @@ export const height = { sm: '16px', lg: '32px', }, -}; +} as const; diff --git a/themes/theme-core/tsup.config.ts b/themes/theme-core/tsup.config.ts index 48d7b0d4e1..5fcfc56fc7 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/preset.ts'], + entry: ['src/index.ts', 'src/preset.ts', 'src/tokens.ts'], format: ['esm', 'cjs'], tsconfig: './tsconfig.build.json', dts: true, diff --git a/themes/theme-docs/package.json b/themes/theme-docs/package.json index f0aec299ae..d30fba3ae3 100644 --- a/themes/theme-docs/package.json +++ b/themes/theme-docs/package.json @@ -18,10 +18,10 @@ "import": "./dist/index.mjs", "types": "./dist/index.d.ts" }, - "./preset": { - "require": "./dist/preset.js", - "import": "./dist/preset.mjs", - "types": "./dist/preset.d.ts" + "./*": { + "require": "./dist/*.js", + "import": "./dist/*.mjs", + "types": "./dist/*.d.ts" }, "./styles.css": "./dist/styles.css" }, diff --git a/themes/theme-docs/src/tokens.ts b/themes/theme-docs/src/tokens.ts index 6c3cc634ad..6b27bd034c 100644 --- a/themes/theme-docs/src/tokens.ts +++ b/themes/theme-docs/src/tokens.ts @@ -176,4 +176,4 @@ export const colors = { success: green[600], error: red[600], }, -}; +} as const; diff --git a/themes/theme-docs/tsup.config.ts b/themes/theme-docs/tsup.config.ts index 48d7b0d4e1..5fcfc56fc7 100644 --- a/themes/theme-docs/tsup.config.ts +++ b/themes/theme-docs/tsup.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'tsup'; export default defineConfig({ - entry: ['src/index.ts', 'src/preset.ts'], + entry: ['src/index.ts', 'src/preset.ts', 'src/tokens.ts'], format: ['esm', 'cjs'], tsconfig: './tsconfig.build.json', dts: true,