import type { RequestOptions } from "../base-client"; import type { RequestBuilder } from "../request-builder"; /** A platform theme record — shadcn-compatible design token bundle. */ export type Theme = { id: string; name: string; slug: string; description?: string | null; tokens: Record; preset: "neutral" | "healthcare" | "legal" | "ios" | "material" | "fluent" | "slds" | "polaris" | "custom"; tenant_id?: string | null; application_id?: string | null; workspace_id?: string | null; is_system: boolean; source_registry_url?: string | null; inserted_at: string; updated_at: string; }; /** A single contrast-check entry produced by the contrast report. */ export type ContrastEntry = { pair: string; ratio: number; aa: boolean; aaa: boolean; }; /** Result of the contrast-report action on a theme. */ export type ThemeContrastReport = { passing: ContrastEntry[]; warnings: ContrastEntry[]; }; /** Attributes for creating a theme. */ export type CreateThemeAttributes = { /** Required. Human-readable theme name. */ name: string; /** Required. URL-safe slug — immutable after creation. */ slug: string; /** Optional description of this theme. */ description?: string; /** Design token map (shadcn registry-item.json subset). Defaults to empty object. */ tokens?: Record; /** Design preset. Defaults to "neutral". */ preset?: "neutral" | "healthcare" | "legal" | "ios" | "material" | "fluent" | "slds" | "polaris" | "custom"; /** Scoping — omit for platform-wide themes. */ tenant_id?: string; /** Scoping — omit for platform-wide themes. */ application_id?: string; /** Scoping — omit for platform-wide themes. */ workspace_id?: string; /** Platform-only flag. Marks the theme as a built-in system theme. */ is_system?: boolean; /** Original shadcn/UI registry URL this theme was imported from. */ source_registry_url?: string; }; /** Attributes for updating a theme (PATCH semantics — all fields optional). */ export type UpdateThemeAttributes = { name?: string; description?: string; tokens?: Record; preset?: "neutral" | "healthcare" | "legal" | "ios" | "material" | "fluent" | "slds" | "polaris" | "custom"; is_system?: boolean; source_registry_url?: string; }; /** Arguments for the import-from-url action. */ export type ImportThemeFromUrlArgs = { /** Public URL of a shadcn/UI registry-item.json file. */ url: string; /** Override the imported theme's name. */ name?: string; /** Override the imported theme's slug. */ slug?: string; /** Scope the imported theme to an application. */ application_id?: string; /** Scope the imported theme to a workspace. */ workspace_id?: string; }; /** Result of import-from-url — the created theme plus any fields stripped during import. */ export type ImportThemeFromUrlResult = { theme: Theme; stripped_fields: string[]; }; /** * Creates the `themes` namespace for the admin SDK. * * Provides full platform-level access to theme management including CRUD, * registry import, and WCAG contrast reporting across all workspaces. * * @param rb - The RequestBuilder bound to the authenticated admin client. * @returns An object with all theme-related methods. * * @example * ```ts * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * const themes = await admin.themes.list(); * const theme = await admin.themes.get(themeId); * ``` */ export declare function createThemesNamespace(rb: RequestBuilder): { /** * Lists all themes visible to the current actor. * * @param options - Optional request options (pagination, filters, sorting). * @returns A list of `Theme` records. * * @example * ```ts * const themes = await admin.themes.list(); * ``` */ list: (options?: RequestOptions) => Promise; /** * Fetches a single theme by ID. * * @param id - The UUID of the theme. * @param options - Optional request options. * @returns The `Theme` record. * * @example * ```ts * const theme = await admin.themes.get("theme-uuid"); * ``` */ get: (id: string, options?: RequestOptions) => Promise; /** * Creates a new theme. * * @param attributes - Theme attributes (name, slug, tokens, preset, scoping). * @param options - Optional request options. * @returns The created `Theme`. * * @example * ```ts * const theme = await admin.themes.create({ * name: "Healthcare Dark", * slug: "healthcare-dark", * preset: "healthcare", * tokens: { "--primary": "210 100% 56%" }, * }); * ``` */ create: (attributes: CreateThemeAttributes, options?: RequestOptions) => Promise; /** * Updates a theme by ID (PATCH semantics — only send fields to change). * * @param id - The UUID of the theme. * @param attributes - Fields to update. * @param options - Optional request options. * @returns The updated `Theme`. * * @example * ```ts * const updated = await admin.themes.update("theme-uuid", { * name: "Healthcare Dark v2", * }); * ``` */ update: (id: string, attributes: UpdateThemeAttributes, options?: RequestOptions) => Promise; /** * Permanently deletes a theme by ID. * * @param id - The UUID of the theme to delete. * @param options - Optional request options. * @returns `true` on success. * * @example * ```ts * await admin.themes.destroy("theme-uuid"); * ``` */ destroy: (id: string, options?: RequestOptions) => Promise; /** * Imports a theme from a public shadcn/UI registry-item.json URL. * * The server fetches the URL, parses the registry item JSON, maps * design tokens into the platform token schema, and creates the theme. * Fields not recognised by the platform schema are stripped and returned * in `stripped_fields` so callers can audit what was dropped. * * @param args - URL (required) plus optional overrides and scoping. * @param options - Optional request options. * @returns The imported `Theme` record and the `stripped_fields` array. * * @example * ```ts * const { theme, stripped_fields } = await admin.themes.importFromUrl({ * url: "https://ui.shadcn.com/registry/themes/rose.json", * name: "Rose", * application_id: "app-uuid", * }); * if (stripped_fields.length > 0) { * console.warn("Dropped fields:", stripped_fields); * } * ``` */ importFromUrl: (args: ImportThemeFromUrlArgs, options?: RequestOptions) => Promise; /** * Returns a WCAG contrast report for the theme's token set. * * Evaluates foreground/background colour pairs defined in the theme's * tokens against WCAG 2.1 AA and AAA contrast ratio thresholds. * * @param id - The UUID of the theme. * @param options - Optional request options. * @returns `passing` and `warnings` arrays of contrast entries. * * @example * ```ts * const { passing, warnings } = await admin.themes.getContrastReport("theme-uuid"); * if (warnings.length > 0) { * console.warn("Contrast warnings:", warnings); * } * ``` */ getContrastReport: (id: string, options?: RequestOptions) => Promise; }; //# sourceMappingURL=themes.d.ts.map