@omniviewdev/base-ui 0.2.1 → 0.3.0

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/dist/index.d.ts CHANGED
@@ -69,6 +69,7 @@ import { Ref } from 'react';
69
69
  import { RefAttributes } from 'react';
70
70
  import { RefCallback } from 'react';
71
71
  import { RefObject } from 'react';
72
+ import { Row } from '@tanstack/react-table';
72
73
  import { RowSelectionState } from '@tanstack/react-table';
73
74
  import { Select as Select_2 } from '@base-ui/react/select';
74
75
  import { SelectArrowProps } from '@base-ui/react';
@@ -622,10 +623,13 @@ export declare interface BuildSectionsOptions {
622
623
  value?: Date | null;
623
624
  }
624
625
 
625
- export declare const BUILT_IN_THEME_MODES: readonly BuiltInThemeMode[];
626
+ export declare const BUILT_IN_THEME_IDS: ReadonlySet<BuiltInThemeId>;
626
627
 
627
- /** The built-in modes that a custom theme can inherit from. */
628
- export declare type BuiltInThemeMode = 'dark' | 'light' | 'high-contrast-dark' | 'high-contrast-light' | 'obsidian' | 'carbon' | 'void';
628
+ export declare const BUILT_IN_THEME_MODES: readonly ["void", "dark", "light", "obsidian", "carbon", "solarized-dark", "solarized-light", "high-contrast-dark", "high-contrast-light"];
629
+
630
+ export declare const BUILT_IN_THEMES: readonly Readonly<ThemeSummary>[];
631
+
632
+ export declare type BuiltInThemeId = 'void' | 'dark' | 'light' | 'obsidian' | 'carbon' | 'solarized-dark' | 'solarized-light' | 'high-contrast-dark' | 'high-contrast-light';
629
633
 
630
634
  export declare const Button: ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLElement>>;
631
635
 
@@ -993,8 +997,6 @@ export declare interface CollapsibleTriggerProps extends HTMLAttributes<HTMLButt
993
997
  children: ReactNode;
994
998
  }
995
999
 
996
- declare type ColorTokenKey = 'color.accent.soft' | 'color.accent.strong' | 'color.ansi.black' | 'color.ansi.blue' | 'color.ansi.bright.black' | 'color.ansi.bright.blue' | 'color.ansi.bright.cyan' | 'color.ansi.bright.green' | 'color.ansi.bright.magenta' | 'color.ansi.bright.red' | 'color.ansi.bright.white' | 'color.ansi.bright.yellow' | 'color.ansi.cyan' | 'color.ansi.green' | 'color.ansi.magenta' | 'color.ansi.red' | 'color.ansi.white' | 'color.ansi.yellow' | 'color.bg.base' | 'color.bg.elevated' | 'color.bg.inset' | 'color.bg.surface' | 'color.bg.surface.overlay' | 'color.bg.surface.raised' | 'color.border.default' | 'color.border.focus' | 'color.border.muted' | 'color.border.strong' | 'color.brand.300' | 'color.brand.400' | 'color.brand.500' | 'color.danger' | 'color.danger.soft' | 'color.datepicker.cell.bg' | 'color.datepicker.cell.bg.hover' | 'color.datepicker.cell.bg.selected' | 'color.datepicker.cell.bg.today' | 'color.datepicker.cell.fg' | 'color.datepicker.cell.fg.disabled' | 'color.datepicker.cell.fg.other.month' | 'color.datepicker.cell.fg.selected' | 'color.datepicker.cell.fg.today' | 'color.datepicker.header.bg' | 'color.diff.insert.bg' | 'color.diff.remove.bg' | 'color.discovery' | 'color.discovery.soft' | 'color.drawer.handle' | 'color.drawer.handle.hover' | 'color.editor.bg' | 'color.editor.bracket.1' | 'color.editor.bracket.2' | 'color.editor.bracket.3' | 'color.editor.bracket.4' | 'color.editor.bracket.5' | 'color.editor.bracket.6' | 'color.editor.bracket.match.bg' | 'color.editor.bracket.match.border' | 'color.editor.cursor' | 'color.editor.fg' | 'color.editor.find.match.bg' | 'color.editor.find.match.border' | 'color.editor.find.range.bg' | 'color.editor.group.bg' | 'color.editor.group.border' | 'color.editor.group.drop.border' | 'color.editor.group.header.bg' | 'color.editor.indent.guide' | 'color.editor.indent.guide.active' | 'color.editor.line.highlight.bg' | 'color.editor.line.highlight.border' | 'color.editor.line.number' | 'color.editor.line.number.active' | 'color.editor.link' | 'color.editor.ruler' | 'color.editor.selection.bg' | 'color.editor.selection.inactive.bg' | 'color.editor.whitespace' | 'color.fg.default' | 'color.fg.disabled' | 'color.fg.inverse' | 'color.fg.muted' | 'color.fg.subtle' | 'color.gutter.added' | 'color.gutter.bg' | 'color.gutter.deleted' | 'color.gutter.modified' | 'color.info' | 'color.info.soft' | 'color.minimap.bg' | 'color.minimap.error' | 'color.minimap.find.match' | 'color.minimap.selection' | 'color.minimap.warning' | 'color.progress.fill' | 'color.progress.track' | 'color.scrollarea.thumb' | 'color.scrollarea.thumb.hover' | 'color.scrollarea.track' | 'color.secondary' | 'color.secondary.soft' | 'color.state.focus.ring' | 'color.state.hover' | 'color.state.pressed' | 'color.state.selected' | 'color.success' | 'color.success.soft' | 'color.tab.active.bg' | 'color.tab.active.border' | 'color.tab.active.fg' | 'color.tab.bg' | 'color.tab.border' | 'color.tab.fg' | 'color.tab.hover.bg' | 'color.tab.hover.fg' | 'color.tab.inactive.bg' | 'color.tab.inactive.fg' | 'color.tab.modified.border' | 'color.terminal.bg' | 'color.terminal.border' | 'color.terminal.cursor' | 'color.terminal.fg' | 'color.terminal.selection.bg' | 'color.terminal.selection.fg' | 'color.warning' | 'color.warning.soft';
997
-
998
1000
  export declare interface ColumnDef {
999
1001
  /** Unique column identifier, used for Cell matching and sort callbacks */
1000
1002
  id: string;
@@ -1375,6 +1377,8 @@ export declare interface ContextMenuTriggerProps extends Omit<ComponentPropsWith
1375
1377
 
1376
1378
  export declare function createThemeRegistry(): ThemeRegistry;
1377
1379
 
1380
+ export declare function createThemeRootApplier(root: HTMLElement): ThemeRootApplier;
1381
+
1378
1382
  export declare const DataTable: DataTableCompound;
1379
1383
 
1380
1384
  declare const DataTableBody: ForwardRefExoticComponent<DataTableBodyProps & RefAttributes<HTMLTableSectionElement>>;
@@ -1482,6 +1486,14 @@ export declare interface DataTableVirtualBodyProps extends HTMLAttributes<HTMLTa
1482
1486
  * to avoid forced reflow on mount — a significant perf win for large tables.
1483
1487
  */
1484
1488
  fixedRowHeight?: boolean;
1489
+ /** Called when a row is clicked. Not called if a `getRowProps` onClick prevents default. */
1490
+ onRowClick?: (row: Row<any>, event: MouseEvent_2<HTMLTableRowElement>) => void;
1491
+ /**
1492
+ * Extra props for each `<tr>` (className, aria/data attributes, handlers).
1493
+ * Positioning styles and data attributes owned by the table take precedence.
1494
+ * Memoize it (e.g. `useCallback`): a new function re-renders every row.
1495
+ */
1496
+ getRowProps?: (row: Row<any>) => HTMLAttributes<HTMLTableRowElement>;
1485
1497
  }
1486
1498
 
1487
1499
  /**
@@ -2337,6 +2349,8 @@ declare const InputRoot: ForwardRefExoticComponent<Omit<InputRootProps, "ref"> &
2337
2349
  export declare interface InputRootProps extends Field.Root.Props, StyledComponentProps {
2338
2350
  }
2339
2351
 
2352
+ export declare function isBuiltInThemeId(id: string): id is BuiltInThemeId;
2353
+
2340
2354
  /** True if the `year` is a leap year (Gregorian calendar). */
2341
2355
  export declare function isLeapYear(year: number): boolean;
2342
2356
 
@@ -2934,6 +2948,10 @@ export declare interface RadioRootProps extends Omit<ComponentPropsWithoutRef<ty
2934
2948
  value: string;
2935
2949
  }
2936
2950
 
2951
+ export declare interface RegisteredTheme extends ThemeSummary {
2952
+ definition: ThemeDefinition;
2953
+ }
2954
+
2937
2955
  export declare type ReorderMeta = {
2938
2956
  id: TabId;
2939
2957
  from: number;
@@ -3661,6 +3679,8 @@ export declare interface StyledComponentProps {
3661
3679
  size?: ComponentSize;
3662
3680
  }
3663
3681
 
3682
+ declare type SupportsColor = (value: string) => boolean;
3683
+
3664
3684
  export declare type SurfaceElevation = 0 | 1 | 2 | 3;
3665
3685
 
3666
3686
  export declare type SurfaceType = 'base' | 'default' | 'raised' | 'overlay' | 'inset' | 'elevated';
@@ -3708,8 +3728,6 @@ declare const SwitchThumb: ForwardRefExoticComponent<SwitchThumbProps & RefAttri
3708
3728
  export declare interface SwitchThumbProps extends Omit<ComponentPropsWithoutRef<typeof Switch_2.Thumb>, 'color'>, StyledComponentProps {
3709
3729
  }
3710
3730
 
3711
- declare type SyntaxTokenKey = 'syntax.class' | 'syntax.comment' | 'syntax.decorator' | 'syntax.function' | 'syntax.interface' | 'syntax.keyword' | 'syntax.keyword.control' | 'syntax.keyword.operator' | 'syntax.method' | 'syntax.namespace' | 'syntax.number' | 'syntax.operator' | 'syntax.parameter' | 'syntax.property' | 'syntax.punctuation' | 'syntax.regexp' | 'syntax.string' | 'syntax.string.escape' | 'syntax.style.comment' | 'syntax.style.function' | 'syntax.style.keyword' | 'syntax.style.type' | 'syntax.type' | 'syntax.variable';
3712
-
3713
3731
  export declare type TabDescriptor = {
3714
3732
  id: TabId;
3715
3733
  title: string;
@@ -3911,8 +3929,6 @@ export declare interface TagInputProps extends Omit<HTMLAttributes<HTMLDivElemen
3911
3929
  inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
3912
3930
  }
3913
3931
 
3914
- declare type TerminalTokenKey = never;
3915
-
3916
3932
  declare const Text_2: TextComponent;
3917
3933
  export { Text_2 as Text }
3918
3934
 
@@ -3995,95 +4011,114 @@ declare interface TextOwnProps extends TypographyBaseProps, TruncationProps {
3995
4011
  export declare type TextProps<C extends TextElement = TextElement> = PolymorphicComponentProps<C, TextOwnProps>;
3996
4012
 
3997
4013
  export declare interface ThemeContextValue extends ThemeState {
3998
- setTheme: (theme: ThemeMode) => void;
4014
+ setTheme: (themeId: ThemeMode) => void;
3999
4015
  setDensity: (density: ThemeDensity) => void;
4000
4016
  setMotion: (motion: ThemeMotion) => void;
4001
4017
  }
4002
4018
 
4003
- export declare interface ThemeDefinition {
4004
- /** Stable identifier, used for persistence and activation. */
4019
+ export declare type ThemeDefinition = ThemeDefinitionV1;
4020
+
4021
+ export declare interface ThemeDefinitionV1 {
4022
+ schemaVersion: 1;
4005
4023
  id: string;
4006
- /** Human-readable display name. */
4007
4024
  name: string;
4008
- /** The built-in mode this theme inherits from. */
4009
- base: BuiltInThemeMode;
4010
- /** Optional author metadata. */
4025
+ base: BuiltInThemeId;
4011
4026
  author?: string;
4012
- /** Optional version string. */
4013
4027
  version?: string;
4014
- /** UI chrome color overrides, keyed by dotted token path. */
4015
- colors?: Partial<Record<ColorTokenKey, string>>;
4016
- /** Syntax highlighting overrides. */
4017
- syntax?: Partial<Record<SyntaxTokenKey, string>>;
4018
- /** Terminal ANSI palette overrides. */
4019
- terminal?: Partial<Record<TerminalTokenKey, string>>;
4028
+ description?: string;
4029
+ tokens: Partial<Record<ThemeTokenKey, string>>;
4020
4030
  }
4021
4031
 
4022
4032
  export declare type ThemeDensity = 'compact' | 'comfortable';
4023
4033
 
4024
- export declare interface ThemeInfo {
4025
- id: string;
4026
- name: string;
4027
- base: BuiltInThemeMode;
4028
- builtIn: boolean;
4029
- }
4030
-
4031
4034
  /**
4032
4035
  * A theme identifier. Built-in mode ids autocomplete; any registered custom
4033
4036
  * theme id is also accepted.
4034
4037
  */
4035
- export declare type ThemeMode = BuiltInThemeMode | (string & {});
4038
+ export declare type ThemeMode = BuiltInThemeId | (string & {});
4036
4039
 
4037
4040
  export declare type ThemeMotion = 'normal' | 'reduced';
4038
4041
 
4039
- export declare function ThemeProvider({ children, initialTheme, initialDensity, initialMotion, persist, }: ThemeProviderProps): JSX.Element;
4042
+ export declare type ThemeOwner = {
4043
+ kind: 'builtin';
4044
+ id: 'base-ui';
4045
+ } | {
4046
+ kind: 'plugin';
4047
+ id: string;
4048
+ } | {
4049
+ kind: 'user';
4050
+ id: string;
4051
+ };
4052
+
4053
+ export declare function ThemeProvider({ children, themeId, onThemeChange, fallbackThemeId, initialDensity, initialMotion, registry, root, }: ThemeProviderProps): JSX.Element;
4040
4054
 
4041
4055
  export declare interface ThemeProviderProps extends PropsWithChildren {
4042
- initialTheme?: ThemeMode;
4056
+ themeId: string;
4057
+ onThemeChange?: (themeId: string) => void;
4058
+ fallbackThemeId?: string;
4043
4059
  initialDensity?: ThemeDensity;
4044
4060
  initialMotion?: ThemeMotion;
4045
- persist?: boolean;
4061
+ registry?: ThemeRegistry;
4062
+ root?: HTMLElement | null;
4046
4063
  }
4047
4064
 
4048
4065
  export declare interface ThemeRegistry {
4049
- register(theme: ThemeDefinition): void;
4050
- unregister(id: string): void;
4051
- get(id: string): ThemeDefinition | undefined;
4052
- list(): ThemeInfo[];
4066
+ register(theme: ThemeDefinition, owner: ThemeOwner): () => void;
4067
+ unregister(id: string, owner: ThemeOwner): boolean;
4068
+ unregisterOwner(owner: ThemeOwner): number;
4069
+ get(id: string): Readonly<RegisteredTheme> | undefined;
4053
4070
  has(id: string): boolean;
4054
- apply(id: string): void;
4055
- active(): string | null;
4071
+ getSnapshot(): ThemeRegistrySnapshot;
4056
4072
  subscribe(listener: ThemeRegistryListener): () => void;
4057
4073
  }
4058
4074
 
4059
- /** Module-level singleton. */
4060
4075
  export declare const themeRegistry: ThemeRegistry;
4061
4076
 
4062
- export declare type ThemeRegistryEvent = {
4063
- type: 'registered';
4064
- id: string;
4065
- } | {
4066
- type: 'unregistered';
4067
- id: string;
4068
- } | {
4069
- type: 'applied';
4070
- id: string;
4071
- };
4077
+ export declare type ThemeRegistryListener = () => void;
4078
+
4079
+ export declare interface ThemeRegistrySnapshot {
4080
+ readonly themes: readonly Readonly<ThemeSummary>[];
4081
+ }
4072
4082
 
4073
- export declare type ThemeRegistryListener = (event: ThemeRegistryEvent) => void;
4083
+ export declare interface ThemeRootApplier {
4084
+ apply(theme: Readonly<RegisteredTheme>): void;
4085
+ cleanup(): void;
4086
+ }
4074
4087
 
4075
4088
  export declare interface ThemeState {
4076
- theme: ThemeMode;
4089
+ requestedThemeId: string;
4090
+ activeTheme: Readonly<ThemeSummary>;
4091
+ isFallback: boolean;
4077
4092
  density: ThemeDensity;
4078
4093
  motion: ThemeMotion;
4079
4094
  }
4080
4095
 
4096
+ export declare interface ThemeSummary {
4097
+ id: string;
4098
+ name: string;
4099
+ base: BuiltInThemeId;
4100
+ appearance: 'dark' | 'light';
4101
+ description?: string;
4102
+ builtIn: boolean;
4103
+ owner: ThemeOwner;
4104
+ }
4105
+
4081
4106
  export declare const ThemeSwitcher: NamedExoticComponent<ThemeSwitcherProps>;
4082
4107
 
4083
4108
  export declare interface ThemeSwitcherProps {
4084
4109
  className?: string;
4085
4110
  }
4086
4111
 
4112
+ declare type ThemeTokenKey = 'color.accent.soft' | 'color.accent.strong' | 'color.ansi.black' | 'color.ansi.blue' | 'color.ansi.bright.black' | 'color.ansi.bright.blue' | 'color.ansi.bright.cyan' | 'color.ansi.bright.green' | 'color.ansi.bright.magenta' | 'color.ansi.bright.red' | 'color.ansi.bright.white' | 'color.ansi.bright.yellow' | 'color.ansi.cyan' | 'color.ansi.green' | 'color.ansi.magenta' | 'color.ansi.red' | 'color.ansi.white' | 'color.ansi.yellow' | 'color.bg.base' | 'color.bg.elevated' | 'color.bg.inset' | 'color.bg.surface' | 'color.bg.surface.overlay' | 'color.bg.surface.raised' | 'color.border.default' | 'color.border.focus' | 'color.border.muted' | 'color.border.strong' | 'color.brand.300' | 'color.brand.400' | 'color.brand.500' | 'color.danger' | 'color.danger.soft' | 'color.datepicker.cell.bg' | 'color.datepicker.cell.bg.hover' | 'color.datepicker.cell.bg.selected' | 'color.datepicker.cell.bg.today' | 'color.datepicker.cell.fg' | 'color.datepicker.cell.fg.disabled' | 'color.datepicker.cell.fg.other.month' | 'color.datepicker.cell.fg.selected' | 'color.datepicker.cell.fg.today' | 'color.datepicker.header.bg' | 'color.diff.insert.bg' | 'color.diff.remove.bg' | 'color.discovery' | 'color.discovery.soft' | 'color.drawer.handle' | 'color.drawer.handle.hover' | 'color.editor.bg' | 'color.editor.bracket.1' | 'color.editor.bracket.2' | 'color.editor.bracket.3' | 'color.editor.bracket.4' | 'color.editor.bracket.5' | 'color.editor.bracket.6' | 'color.editor.bracket.match.bg' | 'color.editor.bracket.match.border' | 'color.editor.cursor' | 'color.editor.fg' | 'color.editor.find.match.bg' | 'color.editor.find.match.border' | 'color.editor.find.range.bg' | 'color.editor.group.bg' | 'color.editor.group.border' | 'color.editor.group.drop.border' | 'color.editor.group.header.bg' | 'color.editor.indent.guide' | 'color.editor.indent.guide.active' | 'color.editor.line.highlight.bg' | 'color.editor.line.highlight.border' | 'color.editor.line.number' | 'color.editor.line.number.active' | 'color.editor.link' | 'color.editor.ruler' | 'color.editor.selection.bg' | 'color.editor.selection.inactive.bg' | 'color.editor.whitespace' | 'color.fg.default' | 'color.fg.disabled' | 'color.fg.inverse' | 'color.fg.muted' | 'color.fg.subtle' | 'color.gutter.added' | 'color.gutter.bg' | 'color.gutter.deleted' | 'color.gutter.modified' | 'color.info' | 'color.info.soft' | 'color.minimap.bg' | 'color.minimap.error' | 'color.minimap.find.match' | 'color.minimap.selection' | 'color.minimap.warning' | 'color.progress.fill' | 'color.progress.track' | 'color.scrollarea.thumb' | 'color.scrollarea.thumb.hover' | 'color.scrollarea.track' | 'color.secondary' | 'color.secondary.soft' | 'color.state.focus.ring' | 'color.state.hover' | 'color.state.pressed' | 'color.state.selected' | 'color.success' | 'color.success.soft' | 'color.tab.active.bg' | 'color.tab.active.border' | 'color.tab.active.fg' | 'color.tab.bg' | 'color.tab.border' | 'color.tab.fg' | 'color.tab.hover.bg' | 'color.tab.hover.fg' | 'color.tab.inactive.bg' | 'color.tab.inactive.fg' | 'color.tab.modified.border' | 'color.terminal.bg' | 'color.terminal.border' | 'color.terminal.cursor' | 'color.terminal.fg' | 'color.terminal.selection.bg' | 'color.terminal.selection.fg' | 'color.warning' | 'color.warning.soft' | 'syntax.class' | 'syntax.comment' | 'syntax.decorator' | 'syntax.function' | 'syntax.interface' | 'syntax.keyword' | 'syntax.keyword.control' | 'syntax.keyword.operator' | 'syntax.method' | 'syntax.namespace' | 'syntax.number' | 'syntax.operator' | 'syntax.parameter' | 'syntax.property' | 'syntax.punctuation' | 'syntax.regexp' | 'syntax.string' | 'syntax.string.escape' | 'syntax.style.comment' | 'syntax.style.function' | 'syntax.style.keyword' | 'syntax.style.type' | 'syntax.type' | 'syntax.variable';
4113
+
4114
+ export declare class ThemeValidationError extends Error {
4115
+ readonly code: ThemeValidationErrorCode;
4116
+ readonly path: string;
4117
+ constructor(code: ThemeValidationErrorCode, path: string, message: string);
4118
+ }
4119
+
4120
+ export declare type ThemeValidationErrorCode = 'unsupported_schema' | 'invalid_id' | 'invalid_metadata' | 'unknown_base' | 'unknown_token' | 'invalid_value' | 'duplicate_id' | 'reserved_id' | 'owner_mismatch';
4121
+
4087
4122
  export declare function TimeColumns({ value, onChange, hourCycle, showSeconds, minuteStep, disabled, readOnly, className, }: TimeColumnsProps): JSX.Element;
4088
4123
 
4089
4124
  export declare interface TimeColumnsProps {
@@ -4741,12 +4776,7 @@ export declare function useTabDragBroker(): TabDragBrokerValue | null;
4741
4776
 
4742
4777
  export declare function useTheme(): ThemeContextValue;
4743
4778
 
4744
- /**
4745
- * React hook that returns the current list of registered themes (built-in +
4746
- * custom) and re-renders the calling component whenever a theme is
4747
- * registered or unregistered.
4748
- */
4749
- export declare function useThemeList(): readonly ThemeInfo[];
4779
+ export declare function useThemeList(registry?: ThemeRegistry): readonly Readonly<ThemeSummary>[];
4750
4780
 
4751
4781
  /** Returns the module-level theme registry singleton. */
4752
4782
  export declare function useThemeRegistry(): ThemeRegistry;
@@ -4787,6 +4817,8 @@ export declare interface ValidateSectionsResult {
4787
4817
  incomplete: boolean;
4788
4818
  }
4789
4819
 
4820
+ export declare function validateThemeDefinition(input: unknown, supportsColor?: SupportsColor): ThemeDefinition;
4821
+
4790
4822
  declare type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
4791
4823
 
4792
4824
  export { }