lumiverse-spindle-types 0.4.0 → 0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -623,6 +623,48 @@ export interface ThemeInfoDTO {
623
623
  characterAware: boolean;
624
624
  }
625
625
 
626
+ /**
627
+ * Input config for `spindle.theme.generateVariables()`.
628
+ *
629
+ * Mirrors the inputs that Lumiverse's theme engine uses to produce the full
630
+ * set of ~80+ CSS variables. Extensions can use the result as a complete,
631
+ * coherent override set for `spindle.theme.apply()`.
632
+ */
633
+ export interface ThemeVariablesConfigDTO {
634
+ /** Primary accent color in HSL. */
635
+ accent: { h: number; s: number; l: number };
636
+ /** Resolved color mode. */
637
+ mode: "dark" | "light";
638
+ /** Enable glassmorphic backdrop-filter tokens (default: `true`). */
639
+ enableGlass?: boolean;
640
+ /** Border radius multiplier (default: `1`). */
641
+ radiusScale?: number;
642
+ /** Font size multiplier (default: `1`). */
643
+ fontScale?: number;
644
+ /** Full UI zoom multiplier (default: `1`). */
645
+ uiScale?: number;
646
+ /** Optional base color overrides. Each value is a CSS color string. */
647
+ baseColors?: {
648
+ primary?: string;
649
+ secondary?: string;
650
+ background?: string;
651
+ text?: string;
652
+ danger?: string;
653
+ success?: string;
654
+ warning?: string;
655
+ /** Dialogue / speech color override. */
656
+ speech?: string;
657
+ /** Italic / thoughts color override. */
658
+ thoughts?: string;
659
+ };
660
+ /** Status color overrides (danger, success, warning). */
661
+ statusColors?: {
662
+ danger?: string;
663
+ success?: string;
664
+ warning?: string;
665
+ };
666
+ }
667
+
626
668
  // ─── Modal content items (used by backend-initiated modals) ─────────────
627
669
 
628
670
  /**
@@ -933,6 +975,8 @@ export type WorkerToHost =
933
975
  | { type: "theme_get_current"; requestId: string; userId?: string }
934
976
  // ─── Color Extraction (gated: "app_manipulation") ─────────────────────
935
977
  | { type: "color_extract"; requestId: string; imageId: string; userId?: string }
978
+ // ─── Theme Variable Generation (gated: "app_manipulation") ────────────
979
+ | { type: "theme_generate_variables"; requestId: string; config: ThemeVariablesConfigDTO }
936
980
  // ─── Commands (free tier) ──────────────────────────────────────────────
937
981
  | { type: "commands_register"; commands: SpindleCommandDTO[] }
938
982
  | { type: "commands_unregister"; commandIds: string[] };
package/src/index.ts CHANGED
@@ -53,6 +53,7 @@ export type {
53
53
  ImageGenResultDTO,
54
54
  ThemeOverrideDTO,
55
55
  ThemeInfoDTO,
56
+ ThemeVariablesConfigDTO,
56
57
  ColorExtractionResult,
57
58
  ColorRGB,
58
59
  ColorHSL,
@@ -32,6 +32,7 @@ import type {
32
32
  ImageGenProviderDTO,
33
33
  ThemeOverrideDTO,
34
34
  ThemeInfoDTO,
35
+ ThemeVariablesConfigDTO,
35
36
  ColorExtractionResult,
36
37
  SpindleModalItemDTO,
37
38
  SpindleCommandDTO,
@@ -635,6 +636,27 @@ export interface SpindleAPI {
635
636
  * @param imageId - ID of an image in the images table
636
637
  */
637
638
  extractColors(imageId: string, userId?: string): Promise<ColorExtractionResult>;
639
+ /**
640
+ * Generate the full set of Lumiverse CSS variables from a theme config.
641
+ *
642
+ * Returns a `Record<string, string>` containing every CSS variable the
643
+ * theme engine would produce — primary accent variants, backgrounds,
644
+ * borders, text, glass tokens, shadows, radii, prose tokens, and more
645
+ * (~80+ variables). The result can be passed directly to `apply()` for a
646
+ * complete, coherent theme override.
647
+ *
648
+ * @example
649
+ * ```ts
650
+ * // Extract palette from an image, then generate + apply a full theme
651
+ * const palette = await spindle.theme.extractColors(imageId)
652
+ * const vars = await spindle.theme.generateVariables({
653
+ * accent: palette.dominantHsl,
654
+ * mode: 'dark',
655
+ * })
656
+ * await spindle.theme.apply({ variables: vars })
657
+ * ```
658
+ */
659
+ generateVariables(config: ThemeVariablesConfigDTO): Promise<Record<string, string>>;
638
660
  };
639
661
 
640
662
  /**