@clickhouse/click-ui 0.0.234-sc-deprecation.9 → 0.0.234-sc-deprecation.10
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.
- package/bin/commands/init.js +78 -97
- package/dist/click-ui.bundled.es.js +441 -480
- package/dist/click-ui.bundled.umd.js +12 -12
- package/dist/click-ui.es.js +441 -480
- package/dist/click-ui.umd.js +12 -12
- package/dist/config/core.d.ts +1 -5
- package/dist/config/core.d.ts.map +1 -1
- package/dist/config/core.js +0 -8
- package/dist/config/core.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/next.d.ts.map +1 -1
- package/dist/config/next.js +0 -11
- package/dist/config/next.js.map +1 -1
- package/dist/config/rollup.d.ts.map +1 -1
- package/dist/config/rollup.js +0 -10
- package/dist/config/rollup.js.map +1 -1
- package/dist/config/types.d.ts +0 -3
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/vite.d.ts.map +1 -1
- package/dist/config/vite.js +1 -8
- package/dist/config/vite.js.map +1 -1
- package/dist/config/webpack.d.ts.map +1 -1
- package/dist/config/webpack.js +0 -19
- package/dist/config/webpack.js.map +1 -1
- package/dist/theme/config.d.ts +1 -1
- package/dist/theme/types.d.ts +10 -1
- package/package.json +1 -1
package/bin/commands/init.js
CHANGED
|
@@ -1,106 +1,84 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import fs from
|
|
4
|
-
import path from
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
|
|
6
|
+
const CONFIG_BODY = ` // Optional: Customize the storage key for theme persistence
|
|
7
|
+
// storageKey: 'click-ui-theme',
|
|
8
|
+
|
|
9
|
+
// Optional: Customize light mode theme
|
|
10
|
+
// theme: {
|
|
11
|
+
// global: {
|
|
12
|
+
// color: {
|
|
13
|
+
// brand: '#FFCC00',
|
|
14
|
+
// background: {
|
|
15
|
+
// default: '#FFFFFF'
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
|
+
// },
|
|
19
|
+
// button: {
|
|
20
|
+
// space: {
|
|
21
|
+
// x: '1rem',
|
|
22
|
+
// y: '0.5rem'
|
|
23
|
+
// },
|
|
24
|
+
// radii: {
|
|
25
|
+
// all: '0.375rem'
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
// },
|
|
29
|
+
|
|
30
|
+
// Optional: Dark mode overrides
|
|
31
|
+
// If not defined, theme values are used for dark mode too
|
|
32
|
+
// dark: {
|
|
33
|
+
// global: {
|
|
34
|
+
// color: {
|
|
35
|
+
// background: {
|
|
36
|
+
// default: '#0D1117'
|
|
37
|
+
// },
|
|
38
|
+
// text: {
|
|
39
|
+
// default: '#F0F6FC'
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
|
+
// }
|
|
43
|
+
// },
|
|
44
|
+
|
|
45
|
+
// Optional: Tooltip configuration
|
|
46
|
+
// tooltipConfig: {
|
|
47
|
+
// delayDuration: 100,
|
|
48
|
+
// skipDelayDuration: 300,
|
|
49
|
+
// disableHoverableContent: false,
|
|
50
|
+
// },
|
|
51
|
+
|
|
52
|
+
// Optional: Toast configuration
|
|
53
|
+
// toastConfig: {
|
|
54
|
+
// duration: 4000,
|
|
55
|
+
// swipeDirection: 'right',
|
|
56
|
+
// swipeThreshold: 50,
|
|
57
|
+
// },`;
|
|
9
58
|
|
|
10
59
|
const CONFIG_TEMPLATES = {
|
|
11
60
|
ts: `import type { ThemeConfig } from '@clickhouse/click-ui/theme';
|
|
12
61
|
|
|
13
62
|
const config: ThemeConfig = {
|
|
14
|
-
|
|
15
|
-
storageKey: 'click-ui-theme',
|
|
16
|
-
|
|
17
|
-
// Light mode theme (default)
|
|
18
|
-
theme: {
|
|
19
|
-
global: {
|
|
20
|
-
color: {
|
|
21
|
-
brand: '#FFCC00',
|
|
22
|
-
background: {
|
|
23
|
-
default: '#FFFFFF'
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
button: {
|
|
28
|
-
space: {
|
|
29
|
-
x: '1rem',
|
|
30
|
-
y: '0.5rem'
|
|
31
|
-
},
|
|
32
|
-
radii: {
|
|
33
|
-
all: '0.375rem'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// Dark mode overrides - if not defined, theme values are used for dark mode too
|
|
39
|
-
dark: {
|
|
40
|
-
global: {
|
|
41
|
-
color: {
|
|
42
|
-
background: {
|
|
43
|
-
default: '#0D1117'
|
|
44
|
-
},
|
|
45
|
-
text: {
|
|
46
|
-
default: '#F0F6FC'
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
63
|
+
${CONFIG_BODY}
|
|
51
64
|
};
|
|
52
65
|
|
|
53
66
|
export default config;
|
|
54
67
|
`,
|
|
55
68
|
js: `/** @type {import('@clickhouse/click-ui/theme').ThemeConfig} */
|
|
56
69
|
const config = {
|
|
57
|
-
|
|
58
|
-
storageKey: 'click-ui-theme',
|
|
59
|
-
|
|
60
|
-
// Light mode theme (default)
|
|
61
|
-
theme: {
|
|
62
|
-
global: {
|
|
63
|
-
color: {
|
|
64
|
-
brand: '#FFCC00',
|
|
65
|
-
background: {
|
|
66
|
-
default: '#FFFFFF'
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
button: {
|
|
71
|
-
space: {
|
|
72
|
-
x: '1rem',
|
|
73
|
-
y: '0.5rem'
|
|
74
|
-
},
|
|
75
|
-
radii: {
|
|
76
|
-
all: '0.375rem'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// Dark mode overrides - if not defined, theme values are used for dark mode too
|
|
82
|
-
dark: {
|
|
83
|
-
global: {
|
|
84
|
-
color: {
|
|
85
|
-
background: {
|
|
86
|
-
default: '#0D1117'
|
|
87
|
-
},
|
|
88
|
-
text: {
|
|
89
|
-
default: '#F0F6FC'
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
70
|
+
${CONFIG_BODY}
|
|
94
71
|
};
|
|
95
72
|
|
|
96
73
|
export default config;
|
|
97
74
|
`
|
|
98
75
|
};
|
|
99
76
|
|
|
100
|
-
export const initCommand =
|
|
101
|
-
const format = options.format ===
|
|
77
|
+
export const initCommand = options => {
|
|
78
|
+
const format = options.format === "js" ? "js" : "ts";
|
|
102
79
|
const filename = `click-ui.config.${format}`;
|
|
103
80
|
const targetPath = path.join(process.cwd(), filename);
|
|
81
|
+
const configExt = format === "ts" ? "ts" : "js";
|
|
104
82
|
|
|
105
83
|
// Check if config already exists
|
|
106
84
|
if (fs.existsSync(targetPath) && !options.force) {
|
|
@@ -110,22 +88,25 @@ export const initCommand = (options) => {
|
|
|
110
88
|
|
|
111
89
|
// Write config file
|
|
112
90
|
try {
|
|
113
|
-
fs.writeFileSync(targetPath, CONFIG_TEMPLATES[format],
|
|
114
|
-
console.log(`✅ Created ${filename}`);
|
|
115
|
-
console.log(
|
|
116
|
-
console.log(` 1. Customize your theme in ${filename}`);
|
|
117
|
-
console.log(
|
|
118
|
-
console.log(
|
|
119
|
-
console.log(
|
|
120
|
-
console.log(
|
|
121
|
-
console.log(
|
|
122
|
-
console.log(
|
|
123
|
-
console.log(
|
|
124
|
-
console.log(
|
|
125
|
-
console.log(
|
|
126
|
-
console.log(
|
|
127
|
-
console.log(
|
|
128
|
-
console.log(
|
|
91
|
+
fs.writeFileSync(targetPath, CONFIG_TEMPLATES[format], "utf-8");
|
|
92
|
+
console.log(`✅ Created ${filename}\n`);
|
|
93
|
+
console.log("📝 Next steps:\n");
|
|
94
|
+
console.log(` 1. Customize your theme in ${filename}\n`);
|
|
95
|
+
console.log(" 2. Add plugin to your bundler config:\n");
|
|
96
|
+
console.log(` // vite.config.${configExt}`);
|
|
97
|
+
console.log(" import { clickUIConfig } from '@clickhouse/click-ui/config';\n");
|
|
98
|
+
console.log(" export default defineConfig({");
|
|
99
|
+
console.log(" plugins: [");
|
|
100
|
+
console.log(" react(),");
|
|
101
|
+
console.log(` clickUIConfig(), // Loads ${filename}`);
|
|
102
|
+
console.log(" ],");
|
|
103
|
+
console.log(" });\n");
|
|
104
|
+
console.log(" 3. Use ClickUIProvider in your app:\n");
|
|
105
|
+
console.log(" import { ClickUIProvider } from '@clickhouse/click-ui';\n");
|
|
106
|
+
console.log(" <ClickUIProvider>");
|
|
107
|
+
console.log(" {/* Your app */}");
|
|
108
|
+
console.log(" </ClickUIProvider>\n");
|
|
109
|
+
console.log(" 🎨 Your custom theme will be applied!");
|
|
129
110
|
} catch (error) {
|
|
130
111
|
console.error(`❌ Failed to create config file: ${error.message}`);
|
|
131
112
|
process.exit(1);
|