@cronocode/react-box 1.3.9 → 1.4.0
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/baseSvg.module.css.mjs +1 -1
- package/box.module.css.mjs +1 -1
- package/components/baseSvg.d.ts +6 -9
- package/package.json +7 -2
- package/plugins.d.ts +11 -0
- package/plugins.mjs +231 -0
- package/style.css +1 -1
- package/types.d.ts +6 -2
- package/plugins/box-theme.ts +0 -250
package/components/baseSvg.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SvgStyles } from '../types';
|
|
3
3
|
import ClassNameUtils from '../utils/className/classNameUtils';
|
|
4
|
-
interface SvgNormalStyles {
|
|
5
|
-
fill?: ColorType | string;
|
|
6
|
-
stroke?: ColorType | string;
|
|
7
|
-
rotate?: 0 | 90 | 180 | 270;
|
|
8
|
-
flip?: 'xAxis' | 'yAxis';
|
|
9
|
-
}
|
|
10
|
-
export type SvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles> & Focused<SvgNormalStyles> & Activated<SvgNormalStyles>;
|
|
11
4
|
type AllSvgProps = React.SVGProps<SVGElement>;
|
|
12
5
|
type SvgPropsType = Omit<AllSvgProps, 'className' | 'style' | 'width' | 'height'>;
|
|
13
6
|
type SvgStyleType = Omit<React.CSSProperties, 'width' | 'height'>;
|
|
14
|
-
|
|
7
|
+
export declare namespace Augmented {
|
|
8
|
+
interface Props {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface Props extends SvgStyles, Augmented.Props {
|
|
15
12
|
children?: React.ReactNode | ((props: {
|
|
16
13
|
isHover: boolean;
|
|
17
14
|
}) => React.ReactNode);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronocode/react-box",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"main": "./box.mjs",
|
|
5
5
|
"module": "./box.mjs",
|
|
6
6
|
"types": "./box.d.ts",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"import": "./components/*.mjs",
|
|
21
21
|
"require": "./components/*.mjs",
|
|
22
22
|
"types": "./components/*.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./plugins": {
|
|
25
|
+
"import": "./plugins.mjs",
|
|
26
|
+
"require": "./plugins.mjs",
|
|
27
|
+
"types": "./plugins.d.ts"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"scripts": {
|
|
@@ -28,7 +33,7 @@
|
|
|
28
33
|
"preview": "vite preview",
|
|
29
34
|
"build": "vite build",
|
|
30
35
|
"build:dev": "vite build --mode dev",
|
|
31
|
-
"postbuild": "cp package.json dist & cp LICENSE dist &
|
|
36
|
+
"postbuild": "cp package.json dist & cp LICENSE dist & rm ./dist/index.d.ts & rm ./dist/index.js",
|
|
32
37
|
"compile": "tsc --noEmit --skipLibCheck",
|
|
33
38
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
34
39
|
},
|
package/plugins.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PluginOption } from 'vite';
|
|
2
|
+
interface BoxThemeOptions {
|
|
3
|
+
cssPath: string;
|
|
4
|
+
boxDtsPath: string;
|
|
5
|
+
baseSvgDtsPath: string;
|
|
6
|
+
colors: Record<string, string>;
|
|
7
|
+
shadows: Record<string, string>;
|
|
8
|
+
backgrounds: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export declare function boxTheme(options: BoxThemeOptions): PluginOption;
|
|
11
|
+
export {};
|
package/plugins.mjs
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
function C(r) {
|
|
2
|
+
return {
|
|
3
|
+
name: "boxTheme",
|
|
4
|
+
configResolved(u) {
|
|
5
|
+
const t = Object.entries(r.colors).map(([o, e]) => `--color${o}: ${e};`).join(`
|
|
6
|
+
`), _ = Object.entries(r.shadows).map(([o, e]) => `--shadow${o}: ${e};`).join(`
|
|
7
|
+
`), i = Object.entries(r.backgrounds).map(([o, e]) => `--background${o}: ${e};`).join(`
|
|
8
|
+
`), $ = `:root {
|
|
9
|
+
${t}
|
|
10
|
+
${_}
|
|
11
|
+
${i}
|
|
12
|
+
}`, h = Object.keys(r.colors).map((o) => `
|
|
13
|
+
.color_${o},
|
|
14
|
+
.color_h_${o}:hover,
|
|
15
|
+
._h:hover>.color_h_${o} {
|
|
16
|
+
color: var(--color${o});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.color_f_${o}:focus-within,
|
|
20
|
+
._f:focus-within>.color_f_${o} {
|
|
21
|
+
color: var(--color${o});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.color_a_${o}:active {
|
|
25
|
+
color: var(--color${o});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.bgColor_${o},
|
|
29
|
+
.bgColor_h_${o}:hover,
|
|
30
|
+
._h:hover>.bgColor_h_${o} {
|
|
31
|
+
background-color: var(--color${o});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.bgColor_f_${o}:focus-within,
|
|
35
|
+
._f:focus-within>.bgColor_f_${o} {
|
|
36
|
+
background-color: var(--color${o});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.bgColor_a_${o}:active {
|
|
40
|
+
background-color: var(--color${o});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.borderColor_${o},
|
|
44
|
+
.borderColor_h_${o}:hover,
|
|
45
|
+
._h:hover>.borderColor_h_${o} {
|
|
46
|
+
border-color: var(--color${o});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.borderColor_f_${o}:focus-within,
|
|
50
|
+
._f:focus-within>.borderColor_f_${o} {
|
|
51
|
+
border-color: var(--color${o});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.borderColor_a_${o}:active {
|
|
55
|
+
border-color: var(--color${o});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.outlineColor_${o},
|
|
59
|
+
.outlineColor_h_${o}:hover,
|
|
60
|
+
._h:hover>.outlineColor_h_${o} {
|
|
61
|
+
outline-color: var(--color${o});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.outlineColor_f_${o}:focus-within,
|
|
65
|
+
._f:focus-within>.outlineColor_f_${o} {
|
|
66
|
+
outline-color: var(--color${o});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.outlineColor_a_${o}:active {
|
|
70
|
+
outline-color: var(--color${o});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.fill_${o},
|
|
74
|
+
.fill_h_${o}:hover,
|
|
75
|
+
._h:hover>.fill_h_${o} {
|
|
76
|
+
path,
|
|
77
|
+
circle,
|
|
78
|
+
rect,
|
|
79
|
+
line {
|
|
80
|
+
fill: var(--color${o});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.fill_f_${o}:focus-within,
|
|
85
|
+
._f:focus-within>.fill_f_${o} {
|
|
86
|
+
path,
|
|
87
|
+
circle,
|
|
88
|
+
rect,
|
|
89
|
+
line {
|
|
90
|
+
fill: var(--color${o});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.fill_a_${o}:active {
|
|
95
|
+
path,
|
|
96
|
+
circle,
|
|
97
|
+
rect,
|
|
98
|
+
line {
|
|
99
|
+
fill: var(--color${o});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.stroke_${o},
|
|
104
|
+
.stroke_h_${o}:hover,
|
|
105
|
+
._h:hover>.stroke_h_${o} {
|
|
106
|
+
path,
|
|
107
|
+
circle,
|
|
108
|
+
rect,
|
|
109
|
+
line {
|
|
110
|
+
stroke: var(--color${o});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.stroke_f_${o}:focus-within,
|
|
115
|
+
._f:focus-within>.stroke_f_${o} {
|
|
116
|
+
path,
|
|
117
|
+
circle,
|
|
118
|
+
rect,
|
|
119
|
+
line {
|
|
120
|
+
stroke: var(--color${o});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.stroke_a_${o}:active {
|
|
125
|
+
path,
|
|
126
|
+
circle,
|
|
127
|
+
rect,
|
|
128
|
+
line {
|
|
129
|
+
stroke: var(--color${o});
|
|
130
|
+
}
|
|
131
|
+
}`), s = Object.keys(r.shadows).map((o) => `
|
|
132
|
+
.shadow_${o},
|
|
133
|
+
.shadow_h_${o}:hover,
|
|
134
|
+
._h:hover>.shadow_h_${o} {
|
|
135
|
+
box-shadow: var(--shadow${o});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.shadow_f_${o}:focus-within,
|
|
139
|
+
._f:focus-within>.shadow_f_${o} {
|
|
140
|
+
box-shadow: var(--shadow${o});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.shadow_a_${o}:active {
|
|
144
|
+
box-shadow: var(--shadow${o});
|
|
145
|
+
}`), b = Object.keys(r.backgrounds).map((o) => `
|
|
146
|
+
.bg_${o},
|
|
147
|
+
.bg_h_${o}:hover,
|
|
148
|
+
._h:hover>.bg_h_${o} {
|
|
149
|
+
background: var(--background${o});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.bg_f_${o}:focus-within,
|
|
153
|
+
._f:focus-within>.bg_f_${o} {
|
|
154
|
+
background: var(--background${o});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.bg_a_${o}:active {
|
|
158
|
+
background: var(--background${o});
|
|
159
|
+
}`), l = Object.keys(r.colors).map((o) => `'${o}'`).join(" | "), c = Object.keys(r.backgrounds).map((o) => `'${o}'`).join(" | "), n = Object.keys(r.shadows).map((o) => `'${o}'`).join(" | "), d = `import '@cronocode/react-box';
|
|
160
|
+
|
|
161
|
+
declare module '@cronocode/react-box' {
|
|
162
|
+
type ColorType = ${l};
|
|
163
|
+
type BackgroundType = ${c};
|
|
164
|
+
type ShadowType = ${n};
|
|
165
|
+
|
|
166
|
+
namespace Augmented {
|
|
167
|
+
interface Props {
|
|
168
|
+
color?: ColorType;
|
|
169
|
+
colorH?: ColorType;
|
|
170
|
+
colorF?: ColorType;
|
|
171
|
+
colorA?: ColorType;
|
|
172
|
+
bgColor?: ColorType;
|
|
173
|
+
bgColorH?: ColorType;
|
|
174
|
+
bgColorF?: ColorType;
|
|
175
|
+
bgColorA?: ColorType;
|
|
176
|
+
backgroundColor?: ColorType;
|
|
177
|
+
backgroundColorH?: ColorType;
|
|
178
|
+
backgroundColorF?: ColorType;
|
|
179
|
+
backgroundColorA?: ColorType;
|
|
180
|
+
borderColor?: ColorType;
|
|
181
|
+
borderColorH?: ColorType;
|
|
182
|
+
borderColorF?: ColorType;
|
|
183
|
+
borderColorA?: ColorType;
|
|
184
|
+
outlineColor?: ColorType;
|
|
185
|
+
outlineColorH?: ColorType;
|
|
186
|
+
outlineColorF?: ColorType;
|
|
187
|
+
outlineColorA?: ColorType;
|
|
188
|
+
bg?: BackgroundType;
|
|
189
|
+
bgH?: BackgroundType;
|
|
190
|
+
bgF?: BackgroundType;
|
|
191
|
+
bgA?: BackgroundType;
|
|
192
|
+
background?: BackgroundType;
|
|
193
|
+
backgroundH?: BackgroundType;
|
|
194
|
+
backgroundF?: BackgroundType;
|
|
195
|
+
backgroundA?: BackgroundType;
|
|
196
|
+
shadow?: ShadowType;
|
|
197
|
+
shadowH?: ShadowType;
|
|
198
|
+
shadowF?: ShadowType;
|
|
199
|
+
shadowA?: ShadowType;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
`, p = `import '@cronocode/react-box/components/baseSvg';
|
|
204
|
+
|
|
205
|
+
declare module '@cronocode/react-box/components/baseSvg' {
|
|
206
|
+
type ColorType = ${l};
|
|
207
|
+
type BackgroundType = ${c};
|
|
208
|
+
type ShadowType = ${n};
|
|
209
|
+
|
|
210
|
+
namespace Augmented {
|
|
211
|
+
interface Props {
|
|
212
|
+
fill?: ColorType;
|
|
213
|
+
fillH?: ColorType;
|
|
214
|
+
fillF?: ColorType;
|
|
215
|
+
fillA?: ColorType;
|
|
216
|
+
stroke?: ColorType;
|
|
217
|
+
strokeH?: ColorType;
|
|
218
|
+
strokeF?: ColorType;
|
|
219
|
+
strokeA?: ColorType;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`;
|
|
224
|
+
(void 0)(r.cssPath, [$, ...h, ...s, ...b].join(`
|
|
225
|
+
`)), (void 0)(r.boxDtsPath, d), (void 0)(r.baseSvgDtsPath, p);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
export {
|
|
230
|
+
C as boxTheme
|
|
231
|
+
};
|