Files

100 lines
2.7 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 07:54:37 -04:00
// "@pterodactyl/sdk/theme": what a theme needs on its critical path, without the full SDK closure.
2026-10-12 19:14:14 -04:00
import { cn as mergeClasses } from '@/lib/cn';
2026-10-12 07:54:37 -04:00
import * as tokens from '@/lib/theme';
export {
defineTheme,
useTheme,
useThemeSettings,
type ThemeDefinition,
type ThemeIcon,
type ThemeIcons,
type ThemeScheme,
2026-10-12 19:14:14 -04:00
type ThemeSchemePreference,
2026-10-12 07:54:37 -04:00
type ThemeSettings,
type ThemeSettingValue,
type ThemeState,
} from '@/views/theme';
2026-10-12 09:04:03 -04:00
export {
skin,
useSkin,
2026-10-12 21:26:31 -04:00
UI_PRIMITIVE_PARTS,
2026-10-12 09:04:03 -04:00
type CompleteSkin,
type CompleteSkins,
type NoState,
type PrimitiveName,
type PrimitiveProps,
type PrimitiveState,
type ReplaceableName,
type Skin,
2026-10-12 20:14:18 -04:00
type SkinBelow,
2026-10-12 09:04:03 -04:00
type SkinBinding,
type SkinClassName,
type SkinCompoundVariant,
type SkinPart,
type SkinPartProps,
type SkinRecipe,
type SkinRecipeConfig,
type SkinStateMap,
type SkinStateValue,
type ThemeSkins,
type UiPrimitives,
type UiTone,
} from '@/themes/skins';
2026-10-12 21:44:55 -04:00
export { View, type ViewElementProps } from '@/views/View';
2026-10-12 07:54:37 -04:00
export { lazyView } from '@/views/lazy';
export { Main } from '@/views/a11y';
2026-10-12 19:14:14 -04:00
export { usePageTitle } from '@/views/pageTitle';
2026-10-12 08:48:20 -04:00
export {
Navigation,
NavigationLink,
useActiveNavItem,
useNavigation,
type NavArea,
type NavigationLinkProps,
type NavigationModel,
type NavigationProps,
type NavigationRenderer,
type NavItem,
type NavItemState,
} from '@/views/navigation';
2026-10-12 07:54:37 -04:00
export { default as Slot } from '@/extensions/Slot';
export type {
DefaultViewProps,
ThemeViews,
ViewComponent,
ViewContext,
ViewImporter,
ViewInput,
ViewInputs,
ViewModel,
ViewModels,
ViewName,
ViewOverride,
ViewProps,
} from '@/views/registry';
export type * from '@/views/models';
2026-10-05 18:10:18 -04:00
/**
* Calls `listener`, at most once a frame, after a stylesheet or an `<html>` attribute changes.
* It is a hint, not a diff: compare the values you read. Returns the unsubscribe function.
*/
export function onThemeChange(listener: () => void): () => void {
2026-10-12 07:54:37 -04:00
return tokens.onThemeChange(listener);
2026-10-05 18:10:18 -04:00
}
/** Report a token change the DOM cannot reveal (CSSOM rule edits, adopted stylesheets). */
export function notifyThemeChange(): void {
2026-10-12 07:54:37 -04:00
tokens.notifyThemeChange();
2026-10-05 18:10:18 -04:00
}
/** The current value of a token on `<html>`, e.g. `readThemeToken('--chart-1')`; '' when unset. */
export function readThemeToken(name: `--${string}`): string {
2026-10-12 07:54:37 -04:00
return tokens.readThemeToken(name);
2026-10-05 18:10:18 -04:00
}
2026-10-12 19:14:14 -04:00
/** Joins class names; a later Tailwind utility replaces an earlier one of the same kind: `cn('px-3', 'px-4')` is `px-4`. */
export function cn(...classes: (string | false | null | undefined)[]): string {
return mergeClasses(...classes);
}