All files / packages/core/src/catalog sets.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46                                    33x                                 33x 495x     33x            
// SPDX-License-Identifier: MIT
/**
 * Named theme presets built on top of {@link createThemeCatalog}.
 *
 * These provide opinionated defaults so consumers don't rebuild the same
 * "minimal" or "dark-only" lists in every app. Per-vendor sets are derived
 * from the `packages` keys, so new vendor variants appear automatically on
 * upgrade for opted-in vendors.
 */
 
import { packages } from '../tokens/index.js';
import type { ThemeId } from '../themes/theme-ids.js';
import { createThemeCatalog, type ThemeCatalog } from './create.js';
 
/**
 * The curated "minimal" starter set: one light + one dark theme from the two
 * most common vendors.
 */
const MINIMAL_THEME_IDS: readonly ThemeId[] = [
  'catppuccin-mocha',
  'catppuccin-latte',
  'github-light',
  'github-dark',
];
 
/**
 * Named theme presets. Known keys (`minimal`, `dark`, `light`) are always
 * present; additional keys are one per vendor (e.g. `catppuccin`, `dracula`).
 */
export type ThemeSets = {
  readonly minimal: ThemeCatalog;
  readonly dark: ThemeCatalog;
  readonly light: ThemeCatalog;
} & { readonly [vendor: string]: ThemeCatalog };
 
const perVendorSets: Record<string, ThemeCatalog> = Object.fromEntries(
  Object.keys(packages).map((vendor) => [vendor, createThemeCatalog({ vendors: [vendor] })]),
);
 
export const themeSets: ThemeSets = {
  ...perVendorSets,
  minimal: createThemeCatalog({ vendors: [], include: MINIMAL_THEME_IDS }),
  dark: createThemeCatalog({ appearances: ['dark'] }),
  light: createThemeCatalog({ appearances: ['light'] }),
};