@cronocode/react-box 1.3.9 → 1.4.1

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 (40) hide show
  1. package/baseSvg.module.css.cjs.js +1 -0
  2. package/baseSvg.module.css.es.js +4 -0
  3. package/box.cjs.js +1 -0
  4. package/{box.mjs → box.es.js} +3 -3
  5. package/box.module.css.cjs.js +1 -0
  6. package/box.module.css.es.js +4 -0
  7. package/components/baseSvg.cjs.js +1 -0
  8. package/components/baseSvg.d.ts +6 -9
  9. package/components/{baseSvg.mjs → baseSvg.es.js} +2 -2
  10. package/components/button.cjs.js +1 -0
  11. package/components/{button.mjs → button.es.js} +4 -4
  12. package/components/checkbox.cjs.js +1 -0
  13. package/components/{checkbox.mjs → checkbox.es.js} +5 -5
  14. package/components/dataGrid.cjs.js +1 -0
  15. package/components/{dataGrid.mjs → dataGrid.es.js} +4 -4
  16. package/components/flex.cjs.js +1 -0
  17. package/components/{flex.mjs → flex.es.js} +4 -4
  18. package/components/form.cjs.js +1 -0
  19. package/components/{form.mjs → form.es.js} +4 -4
  20. package/components/radioButton.cjs.js +1 -0
  21. package/components/{radioButton.mjs → radioButton.es.js} +4 -4
  22. package/components/textarea.cjs.js +1 -0
  23. package/components/{textarea.mjs → textarea.es.js} +4 -4
  24. package/components/textbox.cjs.js +1 -0
  25. package/components/{textbox.mjs → textbox.es.js} +4 -4
  26. package/components/tooltip.cjs.js +1 -0
  27. package/components/{tooltip.mjs → tooltip.es.js} +4 -4
  28. package/package.json +15 -10
  29. package/plugins.cjs.js +220 -0
  30. package/plugins.d.ts +11 -0
  31. package/plugins.es.js +231 -0
  32. package/style.css +1 -1
  33. package/theme.cjs.js +1 -0
  34. package/types.d.ts +6 -2
  35. package/utils/utils.cjs.js +1 -0
  36. package/baseSvg.module.css.mjs +0 -4
  37. package/box.module.css.mjs +0 -4
  38. package/plugins/box-theme.ts +0 -250
  39. /package/{theme.mjs → theme.es.js} +0 -0
  40. /package/utils/{utils.mjs → utils.es.js} +0 -0
@@ -1,250 +0,0 @@
1
- import * as fs from 'fs';
2
- import { PluginOption } from 'vite';
3
-
4
- interface BoxThemeOptions {
5
- cssPath: string;
6
- dtsPath: string;
7
- colors: Record<string, string>;
8
- shadows: Record<string, string>;
9
- backgrounds: Record<string, string>;
10
- }
11
-
12
- export default function boxTheme(options: BoxThemeOptions): PluginOption {
13
- return {
14
- name: 'boxTheme',
15
- configResolved(_config) {
16
- const colorVariables = Object.entries(options.colors)
17
- .map(([colorName, colorValue]) => `--color${colorName}: ${colorValue};`)
18
- .join('\n');
19
- const shadowVariables = Object.entries(options.shadows)
20
- .map(([shadowName, shadowValue]) => `--shadow${shadowName}: ${shadowValue};`)
21
- .join('\n');
22
- const bgVariables = Object.entries(options.backgrounds)
23
- .map(([backgroundName, backgroundValue]) => `--background${backgroundName}: ${backgroundValue};`)
24
- .join('\n');
25
-
26
- const variables = `:root {
27
- ${colorVariables}
28
- ${shadowVariables}
29
- ${bgVariables}
30
- }`;
31
-
32
- const colors = Object.keys(options.colors).map((colorName) => {
33
- return `
34
- .color_${colorName},
35
- .color_h_${colorName}:hover,
36
- ._h:hover>.color_h_${colorName} {
37
- color: var(--color${colorName});
38
- }
39
-
40
- .color_f_${colorName}:focus-within,
41
- ._f:focus-within>.color_f_${colorName} {
42
- color: var(--color${colorName});
43
- }
44
-
45
- .color_a_${colorName}:active {
46
- color: var(--color${colorName});
47
- }
48
-
49
- .bgColor_${colorName},
50
- .bgColor_h_${colorName}:hover,
51
- ._h:hover>.bgColor_h_${colorName} {
52
- background-color: var(--color${colorName});
53
- }
54
-
55
- .bgColor_f_${colorName}:focus-within,
56
- ._f:focus-within>.bgColor_f_${colorName} {
57
- background-color: var(--color${colorName});
58
- }
59
-
60
- .bgColor_a_${colorName}:active {
61
- background-color: var(--color${colorName});
62
- }
63
-
64
- .borderColor_${colorName},
65
- .borderColor_h_${colorName}:hover,
66
- ._h:hover>.borderColor_h_${colorName} {
67
- border-color: var(--color${colorName});
68
- }
69
-
70
- .borderColor_f_${colorName}:focus-within,
71
- ._f:focus-within>.borderColor_f_${colorName} {
72
- border-color: var(--color${colorName});
73
- }
74
-
75
- .borderColor_a_${colorName}:active {
76
- border-color: var(--color${colorName});
77
- }
78
-
79
- .outlineColor_${colorName},
80
- .outlineColor_h_${colorName}:hover,
81
- ._h:hover>.outlineColor_h_${colorName} {
82
- outline-color: var(--color${colorName});
83
- }
84
-
85
- .outlineColor_f_${colorName}:focus-within,
86
- ._f:focus-within>.outlineColor_f_${colorName} {
87
- outline-color: var(--color${colorName});
88
- }
89
-
90
- .outlineColor_a_${colorName}:active {
91
- outline-color: var(--color${colorName});
92
- }
93
-
94
- .fill_${colorName},
95
- .fill_h_${colorName}:hover,
96
- ._h:hover>.fill_h_${colorName} {
97
- path,
98
- circle,
99
- rect,
100
- line {
101
- fill: var(--color${colorName});
102
- }
103
- }
104
-
105
- .fill_f_${colorName}:focus-within,
106
- ._f:focus-within>.fill_f_${colorName} {
107
- path,
108
- circle,
109
- rect,
110
- line {
111
- fill: var(--color${colorName});
112
- }
113
- }
114
-
115
- .fill_a_${colorName}:active {
116
- path,
117
- circle,
118
- rect,
119
- line {
120
- fill: var(--color${colorName});
121
- }
122
- }
123
-
124
- .stroke_${colorName},
125
- .stroke_h_${colorName}:hover,
126
- ._h:hover>.stroke_h_${colorName} {
127
- path,
128
- circle,
129
- rect,
130
- line {
131
- stroke: var(--color${colorName});
132
- }
133
- }
134
-
135
- .stroke_f_${colorName}:focus-within,
136
- ._f:focus-within>.stroke_f_${colorName} {
137
- path,
138
- circle,
139
- rect,
140
- line {
141
- stroke: var(--color${colorName});
142
- }
143
- }
144
-
145
- .stroke_a_${colorName}:active {
146
- path,
147
- circle,
148
- rect,
149
- line {
150
- stroke: var(--color${colorName});
151
- }
152
- }`;
153
- });
154
-
155
- const shadows = Object.keys(options.shadows).map((shadowName) => {
156
- return `
157
- .shadow_${shadowName},
158
- .shadow_h_${shadowName}:hover,
159
- ._h:hover>.shadow_h_${shadowName} {
160
- box-shadow: var(--shadow${shadowName});
161
- }
162
-
163
- .shadow_f_${shadowName}:focus-within,
164
- ._f:focus-within>.shadow_f_${shadowName} {
165
- box-shadow: var(--shadow${shadowName});
166
- }
167
-
168
- .shadow_a_${shadowName}:active {
169
- box-shadow: var(--shadow${shadowName});
170
- }`;
171
- });
172
-
173
- const backgrounds = Object.keys(options.backgrounds).map((backgroundName) => {
174
- return `
175
- .bg_${backgroundName},
176
- .bg_h_${backgroundName}:hover,
177
- ._h:hover>.bg_h_${backgroundName} {
178
- background: var(--background${backgroundName});
179
- }
180
-
181
- .bg_f_${backgroundName}:focus-within,
182
- ._f:focus-within>.bg_f_${backgroundName} {
183
- background: var(--background${backgroundName});
184
- }
185
-
186
- .bg_a_${backgroundName}:active {
187
- background: var(--background${backgroundName});
188
- }`;
189
- });
190
-
191
- const colorType = Object.keys(options.colors)
192
- .map((item) => `'${item}'`)
193
- .join(' | ');
194
- const backgroundType = Object.keys(options.backgrounds)
195
- .map((item) => `'${item}'`)
196
- .join(' | ');
197
- const shadowType = Object.keys(options.shadows)
198
- .map((item) => `'${item}'`)
199
- .join(' | ');
200
- const typings = `import '@cronocode/react-box';
201
-
202
- declare module '@cronocode/react-box' {
203
- type ColorType = ${colorType};
204
- type BackgroundType = ${backgroundType};
205
- type ShadowType = ${shadowType};
206
-
207
- namespace Augmented {
208
- interface Props {
209
- color?: ColorType;
210
- colorH?: ColorType;
211
- colorF?: ColorType;
212
- colorA?: ColorType;
213
- bgColor?: ColorType;
214
- bgColorH?: ColorType;
215
- bgColorF?: ColorType;
216
- bgColorA?: ColorType;
217
- backgroundColor?: ColorType;
218
- backgroundColorH?: ColorType;
219
- backgroundColorF?: ColorType;
220
- backgroundColorA?: ColorType;
221
- borderColor?: ColorType;
222
- borderColorH?: ColorType;
223
- borderColorF?: ColorType;
224
- borderColorA?: ColorType;
225
- outlineColor?: ColorType;
226
- outlineColorH?: ColorType;
227
- outlineColorF?: ColorType;
228
- outlineColorA?: ColorType;
229
- bg?: BackgroundType;
230
- bgH?: BackgroundType;
231
- bgF?: BackgroundType;
232
- bgA?: BackgroundType;
233
- background?: BackgroundType;
234
- backgroundH?: BackgroundType;
235
- backgroundF?: BackgroundType;
236
- backgroundA?: BackgroundType;
237
- shadow?: ShadowType;
238
- shadowH?: ShadowType;
239
- shadowF?: ShadowType;
240
- shadowA?: ShadowType;
241
- }
242
- }
243
- }
244
- `;
245
-
246
- fs.writeFileSync(options.cssPath, [variables, ...colors, ...shadows, ...backgrounds].join('\n'));
247
- fs.writeFileSync(options.dtsPath, typings);
248
- },
249
- };
250
- }
File without changes
File without changes