@themal/editor 0.17.1 → 0.18.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 +37 -3
- package/dist/index.d.ts +14 -0
- package/dist/index.js +2403 -2404
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ The editor writes CSS custom properties (HSL values) to `:root`, so it works wit
|
|
|
54
54
|
| `showNavLinks` | `boolean` | `true` | Show page navigation links in the header and mobile menu. |
|
|
55
55
|
| `headerRight` | `React.ReactNode` | — | Custom content rendered on the right side of the header (e.g. auth buttons). |
|
|
56
56
|
| `aboutUrl` | `string` | — | URL for the About page link in the header navigation. |
|
|
57
|
+
| `customIcons` | `CustomIcon[]` | — | Custom icons to display in the Icons preview section. Each entry needs `name` and `icon` (a React component). |
|
|
58
|
+
| `iconMode` | `"append" \| "replace"` | `"append"` | `"append"` adds custom icons after the built-in lucide icons. `"replace"` hides built-ins and shows only custom icons. |
|
|
57
59
|
|
|
58
60
|
## Premium Features
|
|
59
61
|
|
|
@@ -159,6 +161,37 @@ import { LicenseProvider } from '@themal/editor';
|
|
|
159
161
|
/>
|
|
160
162
|
```
|
|
161
163
|
|
|
164
|
+
### With custom icons
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
import { Rocket, Star, Flame } from 'lucide-react';
|
|
168
|
+
// Or use any React component that accepts className
|
|
169
|
+
import { MyBrandIcon } from './icons';
|
|
170
|
+
|
|
171
|
+
<DesignSystemEditor
|
|
172
|
+
customIcons={[
|
|
173
|
+
{ name: "Rocket", icon: Rocket },
|
|
174
|
+
{ name: "Star", icon: Star },
|
|
175
|
+
{ name: "Flame", icon: Flame },
|
|
176
|
+
{ name: "Brand", icon: MyBrandIcon },
|
|
177
|
+
]}
|
|
178
|
+
/>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Replace built-in icons entirely
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<DesignSystemEditor
|
|
185
|
+
customIcons={[
|
|
186
|
+
{ name: "Brand", icon: MyBrandIcon },
|
|
187
|
+
{ name: "Product", icon: ProductIcon },
|
|
188
|
+
]}
|
|
189
|
+
iconMode="replace"
|
|
190
|
+
/>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The Icons section includes a "Hide All" / "Show All" toggle so users can collapse the icon grid.
|
|
194
|
+
|
|
162
195
|
### Embedded / headless
|
|
163
196
|
|
|
164
197
|
```tsx
|
|
@@ -228,6 +261,7 @@ import {
|
|
|
228
261
|
import type {
|
|
229
262
|
DesignSystemEditorProps,
|
|
230
263
|
TokenDefinition,
|
|
264
|
+
CustomIcon,
|
|
231
265
|
HarmonyScheme,
|
|
232
266
|
CardStyleState,
|
|
233
267
|
TypographyState,
|
|
@@ -245,9 +279,9 @@ import type {
|
|
|
245
279
|
|
|
246
280
|
## How It Works
|
|
247
281
|
|
|
248
|
-
1. **Color picking** — Click any swatch to open the native color picker. Changing a key color (brand, secondary, accent, background) automatically derives related tokens.
|
|
282
|
+
1. **Color picking** — Click any swatch to scroll the Colors section into view, then open the native color picker. Changing a key color (brand, secondary, accent, background) automatically derives related tokens.
|
|
249
283
|
2. **Harmony schemes** *(Pro)* — Generate palettes using complementary, analogous, triadic, or split-complementary color relationships.
|
|
250
|
-
3. **Contrast enforcement** — Every foreground/background pair is checked against WCAG AA (4.5:1). Failing pairs are auto-corrected by adjusting lightness.
|
|
284
|
+
3. **Contrast enforcement** — Every foreground/background pair is checked against WCAG AA (4.5:1). Failing pairs are auto-corrected by adjusting lightness. The accessibility audit shows a centered modal with results. On failure, choose "Ignore" to dismiss or "Suggest Alternative" to auto-fix contrast issues.
|
|
251
285
|
4. **Typography** — Choose heading and body fonts (including custom Google Fonts), adjust sizes, weights, line height, and letter spacing with live preview. Five built-in presets (System, Modern, Classic, Compact, Editorial).
|
|
252
286
|
5. **Button interactions** *(Pro)* — Fine-tune hover opacity, hover/active scale, transition duration, and focus ring width with presets (Subtle, Elevated, Bold).
|
|
253
287
|
6. **Typography interactions** *(Pro)* — Customize link hover/active behavior (opacity, scale, underline) and heading hover effects with live preview.
|
|
@@ -256,7 +290,7 @@ import type {
|
|
|
256
290
|
9. **Shareable URLs** — Encode your full theme state in the URL hash and share it with anyone via a single link.
|
|
257
291
|
10. **Palette export** *(Pro)* — Download your palette as SVG or PNG, or copy as a HEX/RGB/RGBA text list.
|
|
258
292
|
11. **Custom fonts** *(Pro)* — Add any Google Font by name. The editor validates the font exists, loads all weights, adds it to heading/body dropdowns, and persists it across sessions.
|
|
259
|
-
12. **Mobile friendly** — Fully responsive UI with mobile-optimized dropdowns, compact swatch labels, and stacked layouts for smaller screens.
|
|
293
|
+
12. **Mobile friendly** — Fully responsive UI with a 2D color spectrum picker (saturation/lightness canvas + hue slider) for intuitive touch-based color selection, mobile-optimized dropdowns, compact swatch labels, and stacked layouts for smaller screens.
|
|
260
294
|
|
|
261
295
|
## Package Architecture
|
|
262
296
|
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,16 @@ export declare interface CustomFontEntry {
|
|
|
64
64
|
spec: string;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
export declare interface CustomIcon {
|
|
68
|
+
/** Display name for the icon */
|
|
69
|
+
name: string;
|
|
70
|
+
/** React component that renders the icon. Receives className and standard SVG props. */
|
|
71
|
+
icon: default_2.ComponentType<{
|
|
72
|
+
className?: string;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
export declare function deserializeThemeState(hash: string): {
|
|
68
78
|
colors: Record<string, string>;
|
|
69
79
|
cardStyle: CardStyleState;
|
|
@@ -103,6 +113,10 @@ export declare interface DesignSystemEditorProps {
|
|
|
103
113
|
featuresUrl?: string;
|
|
104
114
|
/** URL for the About page link in the header */
|
|
105
115
|
aboutUrl?: string;
|
|
116
|
+
/** Custom icons to display in the Icons preview section */
|
|
117
|
+
customIcons?: CustomIcon[];
|
|
118
|
+
/** How custom icons interact with built-in icons. "append" adds them after built-ins, "replace" hides built-ins entirely. Default: "append" */
|
|
119
|
+
iconMode?: "append" | "replace";
|
|
106
120
|
}
|
|
107
121
|
|
|
108
122
|
export declare const EDITABLE_VARS: readonly [{
|