Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add theme & lib/toast UI exports #1887

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-dogs-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@penumbra-zone/ui': minor
---

Add theme and lib/toast exports
14 changes: 14 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"./tailwind": "./src/tailwindConfig.ts",
"./postcss.config.js": "./postcss.config.js",
"./styles/*": "./styles/*",
"./theme": "./src/PenumbraUIProvider/theme.ts",
"./utils/*": "./src/utils/*.ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: is there something in the v1 utils we need in the DEX?

"./hooks/*": "./src/hooks/*/index.ts",
"./*": "./src/*/index.tsx"
},
Expand All @@ -46,6 +48,18 @@
"types": "./dist/components/ui/*.d.ts",
"default": "./dist/components/ui/*.js"
},
"./theme": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why is the theme needed to be exported, especially this way? We use PenumbraUIProvider in the app/app.tsx in the DEX.

suggestion: let's just export the theme object from PenumbraUIProvider/index.tsx file

"types": "./dist/src/PenumbraUIProvider/theme.d.ts",
"default": "./dist/src/PenumbraUIProvider/theme.js"
},
"./lib/toast/*": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this is the old toast library, it should not be exported. The v2 one is already working in the dex: https://github.com/penumbra-zone/dex-explorer/pull/118/files#diff-e1b5cf1eb29b361c28415989517c8312f1f349ab3e0cac44425ffc02290259c2R62

"types": "./dist/lib/toast/*.d.ts",
"default": "./dist/lib/toast/*.js"
},
"./utils/*": {
"types": "./dist/src/utils/*.d.ts",
"default": "./dist/src/utils/*.js"
},
"./*": {
"types": "./dist/src/*/index.d.ts",
"default": "./dist/src/*/index.js"
Expand Down
7 changes: 7 additions & 0 deletions packages/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ const getAllUIComponents = (): Record<string, string> => {
);
};

const getAllLibToastComponents = (): Record<string, string> => {
const source = resolve(__dirname, 'lib', 'toast');
return getRecursiveTsxFiles(source, 'lib/toast');
};

const getDeprecatedUIComponents = (): Record<string, string> => {
const source = resolve(__dirname, 'components/ui');
return getRecursiveTsxFiles(source, 'components/ui');
Expand Down Expand Up @@ -54,6 +59,8 @@ const getAllEntries = (): Record<string, string> => {
return {
tailwindconfig: resolve('../tailwind-config'),
'src/tailwindConfig': join(__dirname, 'src', 'tailwindConfig.ts'),
'src/PenumbraUIProvider/theme': join(__dirname, 'src', 'PenumbraUIProvider', 'theme.ts'),
...getAllLibToastComponents(),
...getDeprecatedUIComponents(),
...getAllUIComponents(),
};
Expand Down
Loading