@codemonster-ru/vueforge 0.7.0 → 0.8.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/README.md CHANGED
@@ -54,6 +54,67 @@ app.use(VueForge, {
54
54
  - Select
55
55
  - Switch
56
56
 
57
+ ## Tokens
58
+
59
+ VueForge exposes design tokens as CSS variables generated from the theme preset. Core groups:
60
+
61
+ - `colors.*` → `--vf-{color}` + shades (`--vf-{color}-100..900`)
62
+ - `radii.*` → corner radii
63
+ - `typography.*` → base font size & line height
64
+ - `states.*` → focus ring, disabled opacity
65
+ - `controls.*` → base control sizing (height, padding)
66
+ - `sizes.sm/lg` → shared small/large sizing for Button/Input/Select
67
+
68
+ Typed tokens:
69
+
70
+ - `ThemeTokens`/`ThemeOptions`/`ThemePreset` are exported for type-safe theming in TS.
71
+ - `components.*` accepts component-specific tokens (typed keys: button/card/checkbox/codeBlock/input/link/menu/popover/select/switch).
72
+
73
+ Default core values (from `DefaultTheme`):
74
+
75
+ | Token | Value |
76
+ | ------------------------ | ---------------------------------------------- |
77
+ | `borderWidth` | `1px` |
78
+ | `controls.height` | `2rem` |
79
+ | `controls.paddingY` | `0.25rem` |
80
+ | `controls.paddingX` | `0.6rem` |
81
+ | `radii.sm` | `4px` |
82
+ | `radii.md` | `6px` |
83
+ | `radii.lg` | `10px` |
84
+ | `typography.fontSize` | `1rem` |
85
+ | `typography.lineHeight` | `1.4` |
86
+ | `states.disabledOpacity` | `0.6` |
87
+ | `states.focusRingShadow` | `0 0 0 3px rgba(var(--vf-blue-600-rgb), 0.12)` |
88
+ | `sizes.sm.fontSize` | `0.875rem` |
89
+ | `sizes.sm.paddingY` | `0.2rem` |
90
+ | `sizes.sm.paddingX` | `0.5rem` |
91
+ | `sizes.lg.fontSize` | `1.125rem` |
92
+ | `sizes.lg.paddingY` | `0.5rem` |
93
+ | `sizes.lg.paddingX` | `1rem` |
94
+
95
+ Example override:
96
+
97
+ ```ts
98
+ setTheme({
99
+ preset: DefaultTheme,
100
+ overrides: {
101
+ typography: {
102
+ fontSize: '0.9375rem',
103
+ lineHeight: '1.4',
104
+ },
105
+ controls: {
106
+ height: '2rem',
107
+ paddingY: '0.25rem',
108
+ paddingX: '0.6rem',
109
+ },
110
+ sizes: {
111
+ sm: { fontSize: '0.8125rem', paddingY: '0.2rem', paddingX: '0.45rem' },
112
+ lg: { fontSize: '1.125rem', paddingY: '0.5rem', paddingX: '1rem' },
113
+ },
114
+ },
115
+ });
116
+ ```
117
+
57
118
  ## Examples
58
119
 
59
120
  The example app lives in `src/example` and showcases all components.
@@ -70,6 +131,7 @@ VueForge maps the theme preset to CSS variables. You can override parts of the p
70
131
  app.use(VueForge, {
71
132
  theme: {
72
133
  preset: DefaultTheme,
134
+ strict: false,
73
135
  overrides: {
74
136
  colors: {
75
137
  green: '#18a66a',
@@ -94,6 +156,40 @@ updateTheme({
94
156
  });
95
157
  ```
96
158
 
159
+ Notes:
160
+
161
+ - Non-hex colors (e.g. `rgb(...)`, `hsl(...)`, `var(--brand)`) are allowed, but shade variables (`--vf-*-100..900`) will not be generated.
162
+ - Set `theme.strict: true` to throw on invalid token values (non-string / non-plain object) during theme application.
163
+
164
+ ## Theme API
165
+
166
+ Core methods:
167
+
168
+ - `setTheme(options)` — apply a theme preset (with optional overrides).
169
+ - `updateTheme(partial)` — update only parts of the current theme.
170
+ - `getTheme()` — get the last applied theme options.
171
+
172
+ Key options:
173
+
174
+ - `preset`: base theme object (e.g. `DefaultTheme`)
175
+ - `overrides`: partial overrides merged into preset
176
+ - `selector`: CSS selector for base variables (default `:root`)
177
+ - `darkSelector`: selector for dark scheme (default `:root[data-theme=dark]`)
178
+ - `strict`: throw on invalid token values (otherwise warnings)
179
+
180
+ Example:
181
+
182
+ ```ts
183
+ setTheme({
184
+ preset: DefaultTheme,
185
+ overrides: {
186
+ colors: { blue: '#2b6cb0' },
187
+ typography: { fontSize: '0.95rem' },
188
+ },
189
+ strict: true,
190
+ });
191
+ ```
192
+
97
193
  ## License
98
194
 
99
195
  [MIT](https://github.com/codemonster-ru/vueforge/blob/main/LICENSE)
package/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export { default as Checkbox } from './package/components/checkbox.vue';
8
8
  export { default as Switch } from './package/components/switch.vue';
9
9
  export { default as Popover } from './package/components/popover.vue';
10
10
  export { default as VueForge, setTheme, updateTheme, getTheme } from './package/config/index';
11
+ export type { ThemeTokens, ThemeOptions, ThemePreset } from './package/config/theme-core';
11
12
  export { default as DefaultTheme } from './package/themes/default';