@themal/editor 0.18.0 → 0.18.2

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
@@ -36,7 +36,7 @@ function App() {
36
36
  }
37
37
  ```
38
38
 
39
- The editor writes CSS custom properties (HSL values) to `:root`, so it works with any framework that consumes CSS variables.
39
+ The editor writes CSS custom properties (HSL values) to `:root` and injects global typography styles, so colors and fonts apply across your entire site.
40
40
 
41
41
  ## Props
42
42
 
@@ -56,6 +56,7 @@ The editor writes CSS custom properties (HSL values) to `:root`, so it works wit
56
56
  | `aboutUrl` | `string` | — | URL for the About page link in the header navigation. |
57
57
  | `customIcons` | `CustomIcon[]` | — | Custom icons to display in the Icons preview section. Each entry needs `name` and `icon` (a React component). |
58
58
  | `iconMode` | `"append" \| "replace"` | `"append"` | `"append"` adds custom icons after the built-in lucide icons. `"replace"` hides built-ins and shows only custom icons. |
59
+ | `showLogo` | `boolean` | `true` | Show the Themal logo in the header. Set `false` for white-label or plugin usage. |
59
60
 
60
61
  ## Premium Features
61
62
 
@@ -66,7 +67,7 @@ The following features require a valid license key:
66
67
  | Harmony schemes | Generate palettes using complementary, analogous, triadic, or split-complementary color relationships. |
67
68
  | Color locks | Lock up to 4 colors to preserve them during palette regeneration. |
68
69
  | PR integration | Create design system pull requests directly from the editor. |
69
- | Undo/redo | History management for color changes. |
70
+ | Undo/redo | Up to 10 levels of undo for theme refreshes and image palette applications. |
70
71
  | Image palette extraction | Extract color palettes from uploaded images with preview confirmation. |
71
72
  | Palette export | Download palette as SVG/PNG, or copy as HEX/RGB/RGBA text. |
72
73
  | Interaction states | Style hover, focus, and active states for buttons and components. |
@@ -223,7 +224,7 @@ import {
223
224
 
224
225
  // Card, typography & interaction style utilities
225
226
  applyStoredCardStyle, // Restore card style from localStorage
226
- applyStoredTypography, // Restore typography from localStorage
227
+ applyStoredTypography, // Restore typography from localStorage (applies site-wide)
227
228
  applyStoredAlertStyle, // Restore dialog alert style from localStorage
228
229
  applyStoredToastStyle, // Restore toast style from localStorage
229
230
  applyStoredInteractionStyle, // Restore button interaction style from localStorage
@@ -281,8 +282,8 @@ import type {
281
282
 
282
283
  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.
283
284
  2. **Harmony schemes** *(Pro)* — Generate palettes using complementary, analogous, triadic, or split-complementary color relationships.
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.
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).
285
+ 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. A WCAG On/Off toggle lets you disable auto-correction for marketing or other contexts that don't require WCAG compliance. Locks are still honored when enforcement is off.
286
+ 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). Typography applies site-wide, not just within the editor component, so toggling fonts updates the entire page.
286
287
  5. **Button interactions** *(Pro)* — Fine-tune hover opacity, hover/active scale, transition duration, and focus ring width with presets (Subtle, Elevated, Bold).
287
288
  6. **Typography interactions** *(Pro)* — Customize link hover/active behavior (opacity, scale, underline) and heading hover effects with live preview.
288
289
  7. **Persistence** — All settings (colors, typography, card styles, dialog styles, toast styles, interactions) are saved to `localStorage` and restored on reload.
@@ -318,6 +319,63 @@ Import the main entry point for components and utilities, and `style.css` separa
318
319
 
319
320
  The editor ships pre-compiled CSS via `@themal/editor/style.css`. Styles are scoped using Tailwind's `important: '.ds-editor'` so they don't conflict with your app's styles. The root element is automatically wrapped in `<div className="ds-editor">`.
320
321
 
322
+ ## Web Component
323
+
324
+ The editor is also available as a `<themal-editor>` custom element for non-React sites (WordPress, Shopify, plain HTML).
325
+
326
+ ### Basic usage
327
+
328
+ ```html
329
+ <script src="https://unpkg.com/@themal/editor/dist/themal-editor.js"></script>
330
+ <themal-editor></themal-editor>
331
+ ```
332
+
333
+ ### Attributes
334
+
335
+ All props that accept strings or booleans can be set as HTML attributes using kebab-case:
336
+
337
+ ```html
338
+ <themal-editor
339
+ license-key="THEMAL-XXXX-XXXX-XXXX"
340
+ show-header="false"
341
+ show-nav-links="false"
342
+ icon-mode="replace"
343
+ show-logo="true"
344
+ accessibility-audit="true"
345
+ upgrade-url="/pricing"
346
+ sign-in-url="/sign-in"
347
+ about-url="/about"
348
+ pr-endpoint-url="/api/create-design-pr"
349
+ ></themal-editor>
350
+ ```
351
+
352
+ Note: The Themal logo is hidden by default in the web component. Set `show-logo="true"` to display it.
353
+
354
+ ### Custom icons via JavaScript
355
+
356
+ Since HTML attributes can only pass strings, custom icons are set programmatically with the `setIcons()` method. Pass an array of `{ name, svg }` objects where `svg` is a raw SVG string:
357
+
358
+ ```html
359
+ <script src="https://unpkg.com/@themal/editor/dist/themal-editor.js"></script>
360
+ <themal-editor icon-mode="replace"></themal-editor>
361
+
362
+ <script>
363
+ const editor = document.querySelector('themal-editor');
364
+ editor.setIcons([
365
+ {
366
+ name: "Heart",
367
+ svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg>'
368
+ },
369
+ {
370
+ name: "Star",
371
+ svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>'
372
+ },
373
+ ]);
374
+ </script>
375
+ ```
376
+
377
+ Set `icon-mode="replace"` to hide the built-in icons and show only your custom set, or omit it (defaults to `"append"`) to add yours alongside the built-ins.
378
+
321
379
  ## Development
322
380
 
323
381
  ```bash
package/dist/index.d.ts CHANGED
@@ -117,6 +117,8 @@ export declare interface DesignSystemEditorProps {
117
117
  customIcons?: CustomIcon[];
118
118
  /** How custom icons interact with built-in icons. "append" adds them after built-ins, "replace" hides built-ins entirely. Default: "append" */
119
119
  iconMode?: "append" | "replace";
120
+ /** Show the Themal logo in the header. Default: true */
121
+ showLogo?: boolean;
120
122
  }
121
123
 
122
124
  export declare const EDITABLE_VARS: readonly [{