From 4aa11a1af4883c79a107bb0c9d7bf604aca65041 Mon Sep 17 00:00:00 2001 From: Jess Sullivan Date: Sun, 31 May 2026 01:59:10 -0400 Subject: [PATCH 1/2] feat(themes): add getThemeCatalog (monorepo reconciliation, TIN-1746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport the package-curated theme catalog API that existed only in the tinyland.dev monorepo mirror (tinyvectors 0.2.3) and was lost when the standalone evolved to 0.3.0 along the THEME_PRESETS line — a bidirectional drift. Ports verbatim against the standalone's theme-presets schema (ThemePreset already has label/hasVectors/colors; ThemePresetName matches): - getThemeCatalog(), getThemeCatalogEntry(), getThemePreviewColors(), getThemeVectorColors(); ThemeCatalogEntry + PackageThemeName types. - Export from src/index.ts. Version 0.3.0 -> 0.3.1 (package.json + MODULE.bazel). Prerequisite for tinyland-stores (TIN-1741): themeStore.svelte.ts imports getThemeCatalog from @tummycrypt/tinyvectors. The Bazel module is the SSOT; release = tag v0.3.1 + BCR registration (npm derived/disabled). --- MODULE.bazel | 2 +- package.json | 2 +- src/index.ts | 6 ++++ src/themes/index.ts | 84 ++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 91 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 128fa67..1b253b3 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,7 +7,7 @@ Usage from external repo: module( name = "tummycrypt_tinyvectors", - version = "0.3.0", + version = "0.3.1", compatibility_level = 1, ) diff --git a/package.json b/package.json index 9b73641..9451dbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tummycrypt/tinyvectors", - "version": "0.3.0", + "version": "0.3.1", "description": "Animated vector blob backgrounds with physics simulation for Svelte 5", "type": "module", "packageManager": "pnpm@9.15.9", diff --git a/src/index.ts b/src/index.ts index 9bbf0fb..4ca1381 100644 --- a/src/index.ts +++ b/src/index.ts @@ -97,6 +97,12 @@ export { generateThemeCSS, isDarkMode, watchDarkMode, + getThemePreviewColors, + getThemeVectorColors, + getThemeCatalogEntry, + getThemeCatalog, + type PackageThemeName, + type ThemeCatalogEntry, } from './themes/index.js'; export { diff --git a/src/themes/index.ts b/src/themes/index.ts index 46ead4d..0361267 100644 --- a/src/themes/index.ts +++ b/src/themes/index.ts @@ -2,7 +2,11 @@ -import { THEME_PRESETS, type ThemePreset } from '../core/theme-presets.js'; +import { + THEME_PRESETS, + type ThemePreset, + type ThemePresetName, +} from '../core/theme-presets.js'; export { THEME_PRESETS, @@ -22,6 +26,84 @@ export function getThemePreset(name: string): ThemePreset | undefined { return THEME_PRESETS[name as keyof typeof THEME_PRESETS]; } +// Theme catalog — the package-curated set of presets with derived preview/ +// vector color swatches. Hub/spoke consumers (e.g. @tummycrypt/tinyland-stores +// themeStore) render this catalog; keeping it here makes the package the +// single source of truth for which themes ship and how they preview. +export type PackageThemeName = Exclude; + +export interface ThemeCatalogEntry { + name: PackageThemeName; + label: string; + description: string; + hasVectors: boolean; + colors: string[]; + previewColors: string[]; + vectorColors: string[]; + source: 'tinyvectors'; +} + +const PACKAGE_THEME_ORDER = [ + 'tinyland', + 'trans', + 'pride', + 'high-contrast', +] as const satisfies readonly PackageThemeName[]; + +const THEME_DESCRIPTIONS: Record = { + tinyland: 'Soft violet, blue, and pink glow', + trans: 'Soft trans pride palette', + pride: 'Rainbow signal colors with diffuse vectors', + 'high-contrast': 'WCAG AAA compliant for maximum readability', +}; + +const THEME_PREVIEW_OVERRIDES: Partial> = { + 'high-contrast': ['#000000', '#FFFFFF', '#0040FF'], +}; + +function getThemePalette(name: string, count?: number): string[] { + const preset = getThemePreset(name); + if (!preset?.hasVectors) return []; + + const colors = preset.colors.map((entry) => entry.color); + return count === undefined ? colors : colors.slice(0, count); +} + +export function getThemePreviewColors(name: string, count = 3): string[] { + return getThemePalette(name, count); +} + +export function getThemeVectorColors(name: string, count = 5): string[] { + return getThemePalette(name, count); +} + +export function getThemeCatalogEntry( + name: PackageThemeName, +): ThemeCatalogEntry | undefined { + const preset = getThemePreset(name); + if (!preset) return undefined; + + const previewColors = + THEME_PREVIEW_OVERRIDES[name] ?? getThemePreviewColors(name); + + return { + name, + label: preset.label, + description: THEME_DESCRIPTIONS[name], + hasVectors: preset.hasVectors, + colors: previewColors, + previewColors, + vectorColors: getThemeVectorColors(name), + source: 'tinyvectors', + }; +} + +export function getThemeCatalog(): ThemeCatalogEntry[] { + return PACKAGE_THEME_ORDER.map((name) => getThemeCatalogEntry(name)).filter( + (theme): theme is ThemeCatalogEntry => theme !== undefined, + ); +} + From 112a1162a6623fab87cc7bd0b7e792dc5f58b17a Mon Sep 17 00:00:00 2001 From: Jess Sullivan Date: Sun, 31 May 2026 02:11:03 -0400 Subject: [PATCH 2/2] fix(bazel): bump BUILD.bazel npm_package version to 0.3.1 (TIN-1746) The release-metadata verifier requires package.json + MODULE.bazel + BUILD.bazel npm_package versions to match; the catalog PR bumped the first two but not the npm_package rule. --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 030b481..51abc09 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -144,7 +144,7 @@ npm_package( ":tinyvectors", ], package = "@tummycrypt/tinyvectors", - version = "0.3.0", + version = "0.3.1", visibility = ["//visibility:public"], )