@clickhouse/click-ui 0.0.237-sc-deprecation.1 → 0.0.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +20 -161
  2. package/dist/click-ui.bundled.es.js +49537 -41533
  3. package/dist/click-ui.bundled.es.js.map +1 -0
  4. package/dist/click-ui.bundled.umd.js +53057 -78
  5. package/dist/click-ui.bundled.umd.js.map +1 -0
  6. package/dist/click-ui.es.js +48004 -41168
  7. package/dist/click-ui.es.js.map +1 -0
  8. package/dist/click-ui.umd.js +51888 -78
  9. package/dist/click-ui.umd.js.map +1 -0
  10. package/dist/components/Accordion/Accordion.d.ts +3 -3
  11. package/dist/components/Alert/Alert.d.ts +9 -3
  12. package/dist/components/AutoComplete/AutoComplete.d.ts +1 -0
  13. package/dist/components/Avatar/Avatar.d.ts +1 -1
  14. package/dist/components/Badge/Badge.d.ts +1 -1
  15. package/dist/components/BigStat/BigStat.d.ts +1 -1
  16. package/dist/components/Button/Button.d.ts +1 -1
  17. package/dist/components/ButtonGroup/ButtonGroup.d.ts +1 -1
  18. package/dist/components/CardHorizontal/CardHorizontal.d.ts +1 -1
  19. package/dist/components/CardPrimary/CardPrimaryTopBadge.d.ts +3 -14
  20. package/dist/components/CardPromotion/CardPromotion.d.ts +1 -1
  21. package/dist/components/CardSecondary/CardSecondary.d.ts +1 -1
  22. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  23. package/dist/components/ClickUIProvider/ClickUIProvider.d.ts +15 -0
  24. package/dist/components/CodeBlock/CodeBlock.d.ts +1 -1
  25. package/dist/components/CodeBlock/useColorStyle.d.ts +1 -1
  26. package/dist/components/Collapsible/Collapsible.d.ts +3 -3
  27. package/dist/components/Container/Container.d.ts +6 -5
  28. package/dist/components/DatePicker/Common.d.ts +3 -8
  29. package/dist/components/Dialog/Dialog.d.ts +2 -2
  30. package/dist/components/EllipsisContent/EllipsisContent.d.ts +6 -4
  31. package/dist/components/FileTabs/FileTabs.d.ts +2 -2
  32. package/dist/components/Flyout/Flyout.d.ts +1 -1
  33. package/dist/components/GenericMenu.d.ts +10 -22
  34. package/dist/components/Grid/Cell.d.ts +1 -2
  35. package/dist/components/Grid/StyledCell.d.ts +2 -5
  36. package/dist/components/Grid/types.d.ts +1 -1
  37. package/dist/components/GridContainer/GridContainer.d.ts +5 -4
  38. package/dist/components/Icon/IconCommon.d.ts +3 -3
  39. package/dist/components/Icon/types.d.ts +0 -2
  40. package/dist/components/IconWrapper/IconWrapper.d.ts +2 -2
  41. package/dist/components/Input/InputWrapper.d.ts +18 -25
  42. package/dist/components/Link/Link.d.ts +6 -4
  43. package/dist/components/Link/common.d.ts +7 -0
  44. package/dist/components/Logos/Logo.d.ts +1 -1
  45. package/dist/components/MultiAccordion/MultiAccordion.d.ts +1 -1
  46. package/dist/components/Panel/Panel.d.ts +1 -1
  47. package/dist/components/ProgressBar/ProgressBar.d.ts +1 -1
  48. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  49. package/dist/components/Select/common/SelectStyled.d.ts +26 -24
  50. package/dist/components/Separator/Separator.d.ts +3 -4
  51. package/dist/components/SidebarNavigationItem/SidebarNavigationItem.d.ts +9 -5
  52. package/dist/components/SidebarNavigationTitle/SidebarNavigationTitle.d.ts +7 -5
  53. package/dist/components/Spacer/Spacer.d.ts +1 -2
  54. package/dist/components/SplitButton/SplitButton.d.ts +1 -1
  55. package/dist/components/Tabs/Tabs.d.ts +24 -26
  56. package/dist/components/Typography/Text/Text.d.ts +5 -4
  57. package/dist/components/VerticalStepper/VerticalStepper.d.ts +2 -2
  58. package/dist/components/commonElement.d.ts +17 -21
  59. package/dist/components/commonTypes.d.ts +1 -1
  60. package/dist/components/icons/HorizontalLoading.d.ts +1 -3
  61. package/dist/components/icons/Loading.d.ts +1 -1
  62. package/dist/components/icons/LoadingAnimated.d.ts +1 -3
  63. package/dist/components/index.d.ts +3 -6
  64. package/dist/components/types.d.ts +83 -51
  65. package/dist/index.d.ts +1 -77
  66. package/dist/styles/variables.classic.json.d.ts +993 -0
  67. package/dist/{theme/tokens → styles}/variables.dark.json.d.ts +117 -117
  68. package/dist/{theme/tokens → styles}/variables.light.json.d.ts +142 -142
  69. package/dist/theme/index.d.ts +12 -6
  70. package/dist/theme/theme.d.ts +7 -0
  71. package/dist/utils/test-utils.d.ts +3 -1
  72. package/package.json +14 -40
  73. package/bin/README.md +0 -178
  74. package/bin/click-ui.config.example.ts +0 -70
  75. package/bin/click-ui.js +0 -97
  76. package/bin/commands/build-default-theme.ts +0 -48
  77. package/bin/commands/generate.js +0 -117
  78. package/bin/commands/init.js +0 -110
  79. package/bin/utils/config-loader.ts +0 -61
  80. package/bin/utils/css-generator.js +0 -32
  81. package/dist/components/Link/linkStyles.d.ts +0 -134
  82. package/dist/components/ThemeToggle/ThemeToggle.d.ts +0 -4
  83. package/dist/config/tokens/types.d.ts +0 -15296
  84. package/dist/config/tokens/types.d.ts.map +0 -1
  85. package/dist/config/tokens/types.js +0 -2
  86. package/dist/config/tokens/types.js.map +0 -1
  87. package/dist/config/types.d.ts +0 -55
  88. package/dist/config/types.d.ts.map +0 -1
  89. package/dist/config/types.js +0 -2
  90. package/dist/config/types.js.map +0 -1
  91. package/dist/config/utils/css-builder.d.ts +0 -38
  92. package/dist/config/utils/css-builder.d.ts.map +0 -1
  93. package/dist/config/utils/css-builder.js +0 -56
  94. package/dist/config/utils/css-builder.js.map +0 -1
  95. package/dist/config/utils/css-generator.d.ts +0 -25
  96. package/dist/config/utils/css-generator.d.ts.map +0 -1
  97. package/dist/config/utils/css-generator.js +0 -151
  98. package/dist/config/utils/css-generator.js.map +0 -1
  99. package/dist/config/utils/find-config.d.ts +0 -17
  100. package/dist/config/utils/find-config.d.ts.map +0 -1
  101. package/dist/config/utils/find-config.js +0 -28
  102. package/dist/config/utils/find-config.js.map +0 -1
  103. package/dist/cui-components.css +0 -1
  104. package/dist/cui-default-theme.css +0 -1809
  105. package/dist/cui.css +0 -3
  106. package/dist/stories/ChartColorComponent.d.ts +0 -1
  107. package/dist/stories/chart-examples/ChartTooltip.d.ts +0 -12
  108. package/dist/stories/chart-examples/ColorSwatchesChart.d.ts +0 -1
  109. package/dist/stories/chart-examples/GroupedBarChart.d.ts +0 -1
  110. package/dist/stories/chart-examples/MultiLineChart.d.ts +0 -1
  111. package/dist/stories/chart-examples/StackedAreaChart.d.ts +0 -1
  112. package/dist/stories/chart-examples/StackedBarChartDemo.d.ts +0 -1
  113. package/dist/theme/ClickUIProvider/ClickUIProvider.d.ts +0 -5
  114. package/dist/theme/ClickUIProvider/ServerClickUIProvider.d.ts +0 -23
  115. package/dist/theme/ClickUIProvider/context.d.ts +0 -24
  116. package/dist/theme/ClickUIProvider/hooks.d.ts +0 -4
  117. package/dist/theme/ClickUIProvider/index.d.ts +0 -6
  118. package/dist/theme/ClickUIProvider/types.d.ts +0 -39
  119. package/dist/theme/config.d.ts +0 -22
  120. package/dist/theme/hooks/useSystemColorSchemePreference.d.ts +0 -7
  121. package/dist/theme/types.d.ts +0 -54
  122. package/dist/theme/utils/css-builder.d.ts +0 -37
  123. package/dist/theme/utils/css-generator.d.ts +0 -25
  124. package/dist/theme/utils/find-config.d.ts +0 -16
  125. package/dist/theme/utils/theme-attribute.d.ts +0 -13
  126. package/dist/theme/utils.d.ts +0 -29
  127. package/dist/utils/capitalize.d.ts +0 -12
  128. package/dist/utils/polymorphic/index.d.ts +0 -48
  129. /package/dist/{theme/tokens → styles}/types.d.ts +0 -0
  130. /package/dist/{theme/tokens → styles}/variables.json.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ import { ThemeName } from '.';
2
+
3
+ declare const ThemeProvider: ({ theme: name, children, }: {
4
+ theme: ThemeName;
5
+ children: React.ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export { ThemeProvider };
@@ -1,4 +1,6 @@
1
- declare const renderCUI: (children: React.ReactNode) => {
1
+ import { ThemeName } from '../theme';
2
+
3
+ declare const renderCUI: (children: React.ReactNode, theme?: ThemeName) => {
2
4
  rerender: (rerenderChildren: React.ReactNode) => void;
3
5
  container: HTMLElement;
4
6
  baseElement: HTMLElement;
package/package.json CHANGED
@@ -1,24 +1,12 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.237-sc-deprecation.1",
3
+ "version": "0.0.238",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
- "sideEffects": [
8
- "**/*.css",
9
- "**/*.scss",
10
- "./dist/cui.css",
11
- "./dist/cui-components.css",
12
- "./dist/cui-default-theme.css",
13
- "./src/theme/global.scss"
14
- ],
15
7
  "files": [
16
- "dist",
17
- "bin"
8
+ "dist"
18
9
  ],
19
- "bin": {
20
- "click-ui": "./bin/click-ui.js"
21
- },
22
10
  "exports": {
23
11
  ".": {
24
12
  "types": "./dist/index.d.ts",
@@ -29,14 +17,7 @@
29
17
  "types": "./dist/index.d.ts",
30
18
  "import": "./dist/click-ui.bundled.es.js",
31
19
  "require": "./dist/click-ui.bundled.umd.js"
32
- },
33
- "./theme": {
34
- "types": "./dist/theme/index.d.ts"
35
- },
36
- "./cui.css": "./dist/cui.css",
37
- "./cui-components.css": "./dist/cui-components.css",
38
- "./cui-default-theme.css": "./dist/cui-default-theme.css",
39
- "./style.css": "./dist/cui-components.css"
20
+ }
40
21
  },
41
22
  "main": "./dist/click-ui.umd.js",
42
23
  "module": "./dist/click-ui.es.js",
@@ -52,16 +33,12 @@
52
33
  },
53
34
  "homepage": "https://clickhouse.com",
54
35
  "scripts": {
55
- "build": "npm run generate-theme-css && tsc && vite build && npm run build:bundled && npm run copy-css-files",
36
+ "build": "tsc && vite build && yarn build:bundled",
56
37
  "build:bundled": "vite build -- bundled",
57
- "copy-css-files": "npm run rename-css && cp src/styles/cui-default-theme.css dist/ && npm run build-combined-css",
58
- "rename-css": "mv dist/style.css dist/cui-components.css",
59
- "build-combined-css": "echo '/* Click UI - Combined CSS */\n@import \"./cui-default-theme.css\";\n@import \"./cui-components.css\";' > dist/cui.css",
60
38
  "build-storybook": "storybook build",
61
39
  "build:watch": "watch 'npm run build' ./src",
62
40
  "chromatic": "npx chromatic",
63
41
  "dev": "vite",
64
- "generate-theme-css": "npx tsx bin/commands/build-default-theme.ts",
65
42
  "generate-tokens": "node build-tokens.js",
66
43
  "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
67
44
  "prettify": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\" --config .prettierrc",
@@ -86,11 +63,12 @@
86
63
  "@radix-ui/react-popover": "^1.0.7",
87
64
  "@radix-ui/react-popper": "^1.1.3",
88
65
  "@radix-ui/react-radio-group": "^1.1.3",
66
+ "@radix-ui/react-separator": "^1.0.3",
89
67
  "@radix-ui/react-switch": "^1.0.2",
90
68
  "@radix-ui/react-tabs": "^1.0.4",
91
69
  "@radix-ui/react-toast": "^1.1.5",
92
70
  "@radix-ui/react-tooltip": "^1.0.7",
93
- "clsx": "^2.1.1",
71
+ "lodash": "^4.17.21",
94
72
  "react-sortablejs": "^6.1.4",
95
73
  "react-syntax-highlighter": "^15.5.0",
96
74
  "react-virtualized-auto-sizer": "^1.0.20",
@@ -107,15 +85,17 @@
107
85
  "@testing-library/react": "^15.0.7",
108
86
  "@testing-library/user-event": "^14.5.2",
109
87
  "@tokens-studio/sd-transforms": "^0.10.3",
110
- "@types/node": "^20.0.0",
88
+ "@types/lodash-es": "^4.17.7",
111
89
  "@types/react": "^18.3.2",
112
90
  "@types/react-dom": "^18.3.0",
113
91
  "@types/react-syntax-highlighter": "^15.5.13",
114
92
  "@types/react-window": "^1.8.8",
115
93
  "@types/sortablejs": "^1.15.2",
94
+ "@types/styled-components": "^5.1.34",
116
95
  "@typescript-eslint/eslint-plugin": "^7.16.1",
117
96
  "@typescript-eslint/parser": "^7.16.1",
118
97
  "@vitejs/plugin-react": "^4.2.1",
98
+ "babel-plugin-styled-components": "^2.1.4",
119
99
  "chromatic": "^13.3.3",
120
100
  "eslint": "^8.57.0",
121
101
  "eslint-plugin-prefer-arrow-functions": "^3.3.2",
@@ -124,9 +104,7 @@
124
104
  "eslint-plugin-storybook": "^10.0.7",
125
105
  "jsdom": "^24.0.0",
126
106
  "prettier": "^3.6.2",
127
- "recharts": "^3.4.1",
128
- "rollup": "^4.52.4",
129
- "sass-embedded": "^1.93.0",
107
+ "prop-types": "^15.8.1",
130
108
  "storybook": "^10.0.7",
131
109
  "storybook-addon-pseudo-states": "^10.0.7",
132
110
  "styled-components": "^6.1.11",
@@ -139,13 +117,9 @@
139
117
  "watch": "^1.0.2"
140
118
  },
141
119
  "peerDependencies": {
142
- "dayjs": "^1.11.18",
143
- "react": "^18.2.0 || ^19.0.0",
144
- "react-dom": "^18.2.0 || ^19.0.0"
145
- },
146
- "peerDependenciesMeta": {
147
- "dayjs": {
148
- "optional": true
149
- }
120
+ "dayjs": "^1.11.13",
121
+ "react": "^18.2.0",
122
+ "react-dom": "^18.2.0",
123
+ "styled-components": ">= 5"
150
124
  }
151
125
  }
package/bin/README.md DELETED
@@ -1,178 +0,0 @@
1
- # Click UI CLI
2
-
3
- This directory contains the Click UI command-line interface for theme customization.
4
-
5
- ## Quick Start
6
-
7
- ```bash
8
- # Initialize a config file
9
- npx click-ui init
10
-
11
- # Generate custom theme CSS
12
- npx click-ui generate
13
-
14
- # Get help
15
- npx click-ui --help
16
- ```
17
-
18
- ## Commands
19
-
20
- ### `click-ui init`
21
-
22
- Creates a `click-ui.config.ts` file in your project root with default configuration.
23
-
24
- **Options:**
25
- - `-f, --format <format>` - Config format: `js` or `ts` (default: `ts`)
26
- - `--force` - Overwrite existing config file
27
- - `-h, --help` - Display help
28
-
29
- **Example:**
30
- ```bash
31
- npx click-ui init
32
- npx click-ui init --format js
33
- npx click-ui init --force
34
- ```
35
-
36
- ### `click-ui generate`
37
-
38
- Generates custom theme CSS from your `click-ui.config.ts` file.
39
-
40
- **Options:**
41
- - `-o, --output <path>` - Output file path (default: `public/cui-custom-theme.css`)
42
- - `-v, --verbose` - Show detailed output
43
- - `-w, --watch` - Watch for config changes and regenerate
44
- - `-h, --help` - Display help
45
-
46
- **Example:**
47
- ```bash
48
- npx click-ui generate
49
- npx click-ui generate --output src/theme.css
50
- npx click-ui generate --watch
51
- ```
52
-
53
- ## Configuration
54
-
55
- See [click-ui.config.example.ts](./click-ui.config.example.ts) for a complete example configuration.
56
-
57
- ### Basic Structure
58
-
59
- ```typescript
60
- import type { ThemeConfig } from '@clickhouse/click-ui/theme';
61
-
62
- const config: ThemeConfig = {
63
- // Light mode theme
64
- theme: {
65
- global: {
66
- color: {
67
- brand: '#FF6B6B',
68
- }
69
- }
70
- },
71
-
72
- // Dark mode overrides
73
- dark: {
74
- global: {
75
- color: {
76
- brand: '#FF8A80',
77
- }
78
- }
79
- },
80
-
81
- // Runtime configuration
82
- storageKey: 'my-app-theme',
83
- };
84
-
85
- export default config;
86
- ```
87
-
88
- ## Workflow
89
-
90
- 1. **Create config:**
91
- ```bash
92
- npx click-ui init
93
- ```
94
-
95
- 2. **Customize theme** in `click-ui.config.ts`:
96
- ```typescript
97
- theme: {
98
- button: {
99
- primary: {
100
- background: { default: '#FF6B6B' }
101
- }
102
- }
103
- }
104
- ```
105
-
106
- 3. **Generate CSS:**
107
- ```bash
108
- npx click-ui generate
109
- ```
110
-
111
- 4. **Import in your app:**
112
- ```typescript
113
- import '@clickhouse/click-ui/cui.css';
114
- import './public/cui-custom-theme.css'; // Your custom theme
115
- import { ClickUIProvider } from '@clickhouse/click-ui';
116
- // OR for simple setup without custom theme:
117
- // import '@clickhouse/click-ui/cui.css';
118
-
119
- function App() {
120
- return (
121
- <ClickUIProvider>
122
- {/* Your app */}
123
- </ClickUIProvider>
124
- );
125
- }
126
- ```
127
-
128
- ## File Structure
129
-
130
- ```
131
- bin/
132
- ├── click-ui.js # CLI entry point
133
- ├── click-ui.config.example.ts # Example configuration
134
- ├── commands/
135
- │ ├── init.js # Creates config file
136
- │ ├── generate.js # Generates theme CSS
137
- │ └── build-default-theme.ts # Internal: builds library's default theme
138
- └── utils/
139
- └── css-generator.js # CSS generation utilities
140
- ```
141
-
142
- ## TypeScript Support
143
-
144
- Full TypeScript support with autocomplete for theme configuration:
145
-
146
- ```typescript
147
- import type { ThemeConfig } from '@clickhouse/click-ui/theme';
148
-
149
- const config: ThemeConfig = {
150
- theme: {
151
- // TypeScript autocomplete works here! ✨
152
- }
153
- };
154
- ```
155
-
156
- ## CSS Output
157
-
158
- The CLI generates CSS using `light-dark()` functions for automatic theme switching:
159
-
160
- ```css
161
- :root {
162
- color-scheme: light dark;
163
- --click-button-color-primary-background-default: light-dark(#FF6B6B, #FF8A80);
164
- }
165
- ```
166
-
167
- This allows the browser to automatically switch between light and dark values based on the user's system preference or your theme setting.
168
-
169
- ## Documentation
170
-
171
- For more information:
172
- - [Main README](../README.md) - Getting started
173
- - [Theme Documentation](../src/theme/index.md) - Theme configuration guide
174
- - [GitHub Repository](https://github.com/ClickHouse/click-ui)
175
-
176
- ## License
177
-
178
- Apache-2.0
@@ -1,70 +0,0 @@
1
- import type { ThemeConfig } from "@clickhouse/click-ui/theme";
2
-
3
- const config: ThemeConfig = {
4
- storageKey: "click-ui-theme",
5
-
6
- // Light mode theme (default)
7
- theme: {
8
- global: {
9
- color: {
10
- brand: "#FF6B6B",
11
- background: {
12
- default: "#FFFFFF",
13
- },
14
- },
15
- },
16
- button: {
17
- space: {
18
- x: "1.5rem",
19
- y: "0.75rem",
20
- },
21
- radii: {
22
- all: "0.5rem",
23
- },
24
- primary: {
25
- background: {
26
- default: "#FF6B6B",
27
- hover: "#FF5252",
28
- },
29
- },
30
- },
31
- },
32
-
33
- // Dark mode overrides - if not defined, theme values are used for dark mode too
34
- dark: {
35
- global: {
36
- color: {
37
- background: {
38
- default: "#0D1117",
39
- },
40
- text: {
41
- default: "#F0F6FC",
42
- },
43
- },
44
- },
45
- button: {
46
- primary: {
47
- background: {
48
- default: "#FF8A80",
49
- hover: "#FF7043",
50
- },
51
- },
52
- },
53
- },
54
-
55
- // Tooltip configuration (optional)
56
- // tooltipConfig: {
57
- // delayDuration: 100,
58
- // skipDelayDuration: 300,
59
- // disableHoverableContent: false,
60
- // },
61
-
62
- // Toast configuration (optional)
63
- // toastConfig: {
64
- // duration: 4000,
65
- // swipeDirection: "right",
66
- // swipeThreshold: 50,
67
- // },
68
- };
69
-
70
- export default config;
package/bin/click-ui.js DELETED
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { initCommand } from './commands/init.js';
4
- import { generateCommand } from './commands/generate.js';
5
-
6
- const args = process.argv.slice(2);
7
- const command = args[0];
8
-
9
- if (command === 'init') {
10
- const options = {
11
- format: 'ts',
12
- force: false
13
- };
14
-
15
- // Parse options
16
- for (let i = 1; i < args.length; i++) {
17
- if (args[i] === '-f' || args[i] === '--format') {
18
- options.format = args[i + 1];
19
- i++;
20
- } else if (args[i] === '--force') {
21
- options.force = true;
22
- } else if (args[i] === '-h' || args[i] === '--help') {
23
- console.log(`
24
- Usage: @clickhouse/click-ui init [options]
25
-
26
- Initialize Click UI configuration file
27
-
28
- Options:
29
- -f, --format <format> Config format (js or ts) (default: "ts")
30
- --force Overwrite existing config file
31
- -h, --help Display help for command
32
- `);
33
- process.exit(0);
34
- }
35
- }
36
-
37
- initCommand(options);
38
- } else if (command === 'generate') {
39
- const options = {
40
- output: null,
41
- verbose: false,
42
- watch: false
43
- };
44
-
45
- // Parse options
46
- for (let i = 1; i < args.length; i++) {
47
- if (args[i] === '-o' || args[i] === '--output') {
48
- options.output = args[i + 1];
49
- i++;
50
- } else if (args[i] === '-v' || args[i] === '--verbose') {
51
- options.verbose = true;
52
- } else if (args[i] === '-w' || args[i] === '--watch') {
53
- options.watch = true;
54
- } else if (args[i] === '-h' || args[i] === '--help') {
55
- console.log(`
56
- Usage: @clickhouse/click-ui generate [options]
57
-
58
- Generate custom theme CSS from click-ui.config.ts/js
59
-
60
- Options:
61
- -o, --output <path> Output file path (default: "public/cui-custom-theme.css")
62
- -v, --verbose Show detailed output
63
- -w, --watch Watch for config changes and regenerate
64
- -h, --help Display help for command
65
-
66
- Example:
67
- click-ui generate
68
- click-ui generate --output src/theme.css
69
- click-ui generate --watch
70
- `);
71
- process.exit(0);
72
- }
73
- }
74
-
75
- generateCommand(options);
76
- } else if (command === '--version' || command === '-V') {
77
- console.log('0.0.234');
78
- } else if (command === '--help' || command === '-h' || !command) {
79
- console.log(`
80
- Usage: @clickhouse/click-ui [options] [command]
81
-
82
- CLI for ClickHouse Click UI
83
-
84
- Options:
85
- -V, --version Output the version number
86
- -h, --help Display help for command
87
-
88
- Commands:
89
- init [options] Initialize Click UI configuration file
90
- generate [options] Generate custom theme CSS from config
91
- help [command] Display help for command
92
- `);
93
- } else {
94
- console.error(`Unknown command: ${command}`);
95
- console.log('Run "@clickhouse/click-ui --help" for usage information.');
96
- process.exit(1);
97
- }
@@ -1,48 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Generate theme-default.css with light-dark() functions
5
- * This runs during library build to create pre-compiled CSS
6
- */
7
-
8
- import * as fs from "fs";
9
- import * as path from "path";
10
- import { getBaseTheme } from "../../src/theme/utils";
11
- import { generateLightDarkVariables, generateThemeOverrides } from "../../src/theme/utils/css-generator";
12
- import { buildCSSOutput } from "../../src/theme/utils/css-builder";
13
-
14
- // Load light and dark base themes from tokens
15
- const lightTheme = getBaseTheme("light");
16
- const darkTheme = getBaseTheme("dark");
17
-
18
- // Debug: Check if themes loaded correctly
19
- console.log("\n🔍 Debug Info:");
20
- console.log(`Light theme loaded: ${Object.keys(lightTheme).length} keys`);
21
- console.log(`Dark theme loaded: ${Object.keys(darkTheme).length} keys`);
22
- console.log(`Light accordion color: ${lightTheme?.click?.accordion?.color?.default?.label?.default}`);
23
- console.log(`Dark accordion color: ${darkTheme?.click?.accordion?.color?.default?.label?.default}`);
24
-
25
- // Generate CSS using the same logic as injectThemeStyles()
26
- const lightDarkVars = generateLightDarkVariables(lightTheme, darkTheme);
27
- const themeOverrides = generateThemeOverrides(lightTheme, darkTheme);
28
-
29
- // Build CSS using shared builder
30
- const css = buildCSSOutput(lightDarkVars, themeOverrides, {
31
- headerComment: '/* Click UI Default Theme */\n/* Generated during library build - DO NOT EDIT MANUALLY */\n/* Uses light-dark() CSS function for automatic theme switching */\n'
32
- });
33
-
34
- // Ensure output directory exists
35
- const outputDir = path.join(process.cwd(), "src", "styles");
36
- if (!fs.existsSync(outputDir)) {
37
- fs.mkdirSync(outputDir, { recursive: true });
38
- }
39
-
40
- // Write the CSS file
41
- const outputPath = path.join(outputDir, "cui-default-theme.css");
42
- fs.writeFileSync(outputPath, css, "utf-8");
43
-
44
- console.log(`✅ Generated cui-default-theme.css (${css.length} bytes)`);
45
- console.log(` Location: ${outputPath}`);
46
- console.log(` Light vars: ${Object.keys(lightDarkVars).length}`);
47
- console.log(` Light overrides: ${Object.keys(themeOverrides.light).length}`);
48
- console.log(` Dark overrides: ${Object.keys(themeOverrides.dark).length}`);
@@ -1,117 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import fs from 'fs';
4
- import path from 'path';
5
- import { fileURLToPath } from 'url';
6
- import { pathToFileURL } from 'url';
7
- import { findConfigFile } from '../../src/theme/utils/find-config.js';
8
- import { loadConfig, validateConfig } from '../utils/config-loader.js';
9
-
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = path.dirname(__filename);
12
-
13
- /**
14
- * Generate custom theme CSS from click-ui.config.ts/js
15
- */
16
- export async function generateCommand(options = {}) {
17
- const cwd = process.cwd();
18
- const outputPath = options.output || path.join(cwd, 'public', 'cui-custom-theme.css');
19
- const verbose = options.verbose || false;
20
-
21
- console.log('🎨 Click UI Theme Generator\n');
22
-
23
- try {
24
- // Find config file
25
- const configFile = findConfigFile(cwd);
26
-
27
- if (!configFile) {
28
- console.log('ℹ️ No click-ui.config.ts/js found');
29
- console.log(' Run "click-ui init" to create a config file');
30
- process.exit(0);
31
- }
32
-
33
- if (verbose) {
34
- console.log(`📄 Found config: ${path.relative(cwd, configFile)}`);
35
- }
36
-
37
- // Load config
38
- const config = await loadConfig(configFile);
39
-
40
- if (!validateConfig(config)) {
41
- console.log('⚠️ Config file exists but has no theme configuration');
42
- console.log(' Add "theme" or "dark" properties to customize your theme');
43
- process.exit(0);
44
- }
45
-
46
- // Generate CSS
47
- const css = await generateCSS(config);
48
-
49
- // Ensure output directory exists
50
- const outputDir = path.dirname(outputPath);
51
- if (!fs.existsSync(outputDir)) {
52
- fs.mkdirSync(outputDir, { recursive: true });
53
- if (verbose) {
54
- console.log(`📁 Created directory: ${path.relative(cwd, outputDir)}`);
55
- }
56
- }
57
-
58
- // Write CSS file
59
- fs.writeFileSync(outputPath, css, 'utf-8');
60
-
61
- console.log('✅ Generated custom theme CSS');
62
- console.log(` Location: ${path.relative(cwd, outputPath)}`);
63
- console.log(` Size: ${(css.length / 1024).toFixed(2)} KB\n`);
64
-
65
- console.log('📝 Next steps:');
66
- console.log(' 1. Import the CSS in your app:');
67
- console.log(` import '${path.relative(cwd, outputPath).replace(/\\/g, '/')}';`);
68
- console.log(' 2. Or add to your HTML:');
69
- console.log(` <link rel="stylesheet" href="/${path.basename(outputPath)}">`);
70
-
71
- } catch (error) {
72
- console.error('❌ Failed to generate theme CSS:', error.message);
73
- if (verbose) {
74
- console.error(error.stack);
75
- }
76
- process.exit(1);
77
- }
78
- }
79
-
80
- /**
81
- * Generate CSS from config
82
- */
83
- async function generateCSS(config) {
84
- // Import the CSS generation function from bin/utils
85
- const cssGeneratorPath = path.join(__dirname, '../utils/css-generator.js');
86
-
87
- if (!fs.existsSync(cssGeneratorPath)) {
88
- throw new Error('CSS generator module not found at ' + cssGeneratorPath);
89
- }
90
-
91
- const { generateThemeCSS } = await import(pathToFileURL(cssGeneratorPath).href);
92
-
93
- // Get full config and generate CSS
94
- const fullConfig = config.default || config;
95
- const css = generateThemeCSS(fullConfig);
96
-
97
- if (!css || css.length === 0) {
98
- throw new Error('No CSS generated. Please check your theme configuration.');
99
- }
100
-
101
- return css;
102
- }
103
-
104
- /**
105
- * Split config into build-time and runtime
106
- */
107
- function splitConfig(fullConfig) {
108
- const { theme, dark, ...runtimeConfig } = fullConfig;
109
-
110
- return {
111
- buildTimeConfig: {
112
- ...(theme && { theme }),
113
- ...(dark && { dark }),
114
- },
115
- runtimeConfig,
116
- };
117
- }