@x-otto/ui-token 0.0.0-stage → 0.3.0-beta.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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 1,
3
+ "revision": "8a42f74bbc3aab6cb38a65616505b6c0"
4
+ }
@@ -0,0 +1,224 @@
1
+ //#region src/ladder.d.ts
2
+ type ColorMode = 'light' | 'dark';
3
+ type RampName = 'neon' | 'violet' | 'navy' | 'ink' | 'grass' | 'amber' | 'red';
4
+ type RampStep = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
5
+ type RampSteps = Readonly<Partial<Record<RampStep, string>>>;
6
+ interface RampDefinition {
7
+ readonly light: RampSteps;
8
+ readonly dark: RampSteps;
9
+ }
10
+ declare const RAMP_NAMES: readonly ["neon", "violet", "navy", "ink", "grass", "amber", "red"];
11
+ declare const RAMPS: Readonly<Record<RampName, RampDefinition>>;
12
+ declare const SEMANTIC_SURFACES: Readonly<Record<ColorMode, Readonly<Record<string, string>>>>;
13
+ declare const SPECTRUM: Readonly<Record<ColorMode, readonly string[]>>;
14
+ declare function rampStepColor(ramp: RampName, step: RampStep, mode: ColorMode): string;
15
+ declare function rampStepsOf(ramp: RampName, mode: ColorMode): readonly RampStep[];
16
+ //#endregion
17
+ //#region src/roles.d.ts
18
+ interface RampReference {
19
+ readonly ramp: RampName;
20
+ readonly step: RampStep;
21
+ }
22
+ interface LiteralValue {
23
+ readonly literal: string;
24
+ }
25
+ interface SurfaceReference {
26
+ readonly surface: 'grass' | 'amber' | 'red';
27
+ }
28
+ type RoleValue = RampReference | LiteralValue | SurfaceReference;
29
+ interface RoleDefinition {
30
+ readonly light: RoleValue;
31
+ readonly dark: RoleValue;
32
+ }
33
+ declare const ROLE_NAMES: readonly ["surface.page", "surface.card", "surface.subtle", "surface.pillSubtle", "surface.dark", "surface.userMessage", "surface.navGlass", "surface.scrim", "surface.success", "surface.warning", "surface.danger", "text.primary", "text.secondary", "text.muted", "text.onDark", "text.onAccent", "text.onAccentSecondary", "text.onNeon", "brand.primary", "brand.primaryHover", "brand.primarySoft", "brand.primarySolid", "brand.primarySolidHover", "brand.decor", "brand.mark", "brand.dim", "brand.neon", "brand.neonText", "brand.navy", "brand.navyDeep", "brand.ink", "brand.peri", "brand.periSoft", "brand.cream", "brand.coverGrid", "focus.ring", "selection.text", "link.active", "status.success", "status.successStrong", "status.successSurface", "status.warning", "status.warningStrong", "status.warningSurface", "status.danger", "status.dangerStrong", "status.dangerSurface", "status.info", "icon.search", "icon.file", "icon.write", "icon.browse", "icon.bash", "icon.dotTertiary", "border.defaultColor", "border.subtleColor", "border.timeline", "diff.addedBackground", "diff.addedSign", "diff.removedBackground", "diff.removedSign", "diff.content", "scrollbar.track", "scrollbar.thumb", "tag.background", "overlay.background", "overlay.text", "syntax.builtin", "button.filledText", "line.default", "paper.base", "paper.raise", "tool.execute", "tool.read", "tool.write", "tool.edit", "tool.search", "tool.network", "tool.plan", "tool.memory", "tool.inspect", "tool.misc"];
34
+ type RoleName = (typeof ROLE_NAMES)[number];
35
+ declare const ROLE_TABLE: Readonly<Record<RoleName, RoleDefinition>>;
36
+ type ContrastLevel = 'text' | 'graphic';
37
+ interface RoleContrastRule {
38
+ readonly level: ContrastLevel;
39
+ readonly surfaces: readonly RoleName[];
40
+ }
41
+ declare const CONTRAST_THRESHOLDS: Readonly<Record<ContrastLevel, number>>;
42
+ declare const ROLE_CONTRAST: Readonly<Partial<Record<RoleName, RoleContrastRule>>>;
43
+ declare function resolveRole(name: RoleName, mode: ColorMode): string;
44
+ declare function roleVariableName(name: RoleName): string;
45
+ //#endregion
46
+ //#region src/contrast.d.ts
47
+ interface RgbChannels {
48
+ readonly red: number;
49
+ readonly green: number;
50
+ readonly blue: number;
51
+ }
52
+ declare function parseHexColor(color: string): RgbChannels | undefined;
53
+ declare function relativeLuminance(color: string): number;
54
+ declare function contrastRatio(first: string, second: string): number;
55
+ //#endregion
56
+ //#region src/theme-colors.d.ts
57
+ interface ThemeColors {
58
+ text: string | undefined;
59
+ accent: string;
60
+ muted: string;
61
+ border: string;
62
+ borderSuppressed: string;
63
+ success: string;
64
+ error: string;
65
+ dangerSurface: string;
66
+ warning: string;
67
+ info: string;
68
+ brand: string;
69
+ brandHighlight: string;
70
+ brandDim: string;
71
+ selectedText: string;
72
+ selectionText: string;
73
+ focusIndicator: string;
74
+ linkActive: string;
75
+ syntaxBuiltin: string;
76
+ overlayBackground: string;
77
+ overlayText: string;
78
+ track: string;
79
+ thumb: string;
80
+ buttonFilledText: string;
81
+ tagBackground: string;
82
+ syntaxTheme: string;
83
+ diffAddedBackground: string;
84
+ diffRemovedBackground: string;
85
+ diffAddedSign: string;
86
+ diffRemovedSign: string;
87
+ diffContent: string;
88
+ }
89
+ type ThemeName = 'light' | 'dark' | (string & {});
90
+ declare function themeNamesOf(themes: Readonly<Record<string, ThemeColors>>): readonly ThemeName[];
91
+ //#endregion
92
+ //#region src/projections/tui.d.ts
93
+ declare const TUI_COLOR_KEYS: readonly ["text", "accent", "muted", "border", "borderSuppressed", "success", "error", "dangerSurface", "warning", "info", "brand", "brandHighlight", "brandDim", "selectedText", "selectionText", "focusIndicator", "linkActive", "syntaxBuiltin", "overlayBackground", "overlayText", "track", "thumb", "buttonFilledText", "tagBackground", "syntaxTheme", "diffAddedBackground", "diffRemovedBackground", "diffAddedSign", "diffRemovedSign", "diffContent"];
94
+ type TuiColorKey = (typeof TUI_COLOR_KEYS)[number];
95
+ interface TuiColorBinding {
96
+ readonly role: RoleName | undefined;
97
+ readonly frozen?: string | null;
98
+ readonly literal?: string;
99
+ }
100
+ declare const TUI_COLOR_BINDINGS: Readonly<Record<TuiColorKey, TuiColorBinding>>;
101
+ declare const TUI_DARK_OVERRIDES: Readonly<Partial<Record<TuiColorKey, TuiColorBinding>>>;
102
+ declare function tuiColorValue(key: TuiColorKey, mode: ColorMode): string | undefined;
103
+ declare function tuiThemeColors(mode: ColorMode): ThemeColors;
104
+ //#endregion
105
+ //#region src/projections/inline.d.ts
106
+ interface InlinePalette {
107
+ readonly pageBackground: string;
108
+ readonly cardBackground: string;
109
+ readonly ink: string;
110
+ readonly inkMuted: string;
111
+ readonly wordmarkBase: string;
112
+ readonly wordmarkHighlight: string;
113
+ readonly rainbow: readonly string[];
114
+ readonly success: string;
115
+ readonly successBackground: string;
116
+ readonly danger: string;
117
+ readonly dangerBackground: string;
118
+ readonly shadow: string;
119
+ }
120
+ declare function inlinePalette(mode: ColorMode): InlinePalette;
121
+ declare function inlineDeclarations(mode: ColorMode): string;
122
+ //#endregion
123
+ //#region src/projections/web.d.ts
124
+ declare const LEGACY_RAMP_PREFIXES: Readonly<Partial<Record<RampName, string>>>;
125
+ declare const LEGACY_ALIASES: Readonly<Record<string, RoleName>>;
126
+ declare const WEB_LITERALS: Readonly<Record<ColorMode, Readonly<Record<string, string>>>>;
127
+ declare function rampVariableName(rampName: RampName, step: number): string;
128
+ interface WebProjectionOptions {
129
+ readonly includeLegacyAliases?: boolean;
130
+ }
131
+ declare function webTokenDeclarations(mode: ColorMode, options?: WebProjectionOptions): readonly string[];
132
+ declare function webTokensCss(options?: WebProjectionOptions): string;
133
+ //#endregion
134
+ //#region src/tool-roles.d.ts
135
+ declare const TOOL_ROLE_NAMES: readonly ["tool.execute", "tool.read", "tool.write", "tool.edit", "tool.search", "tool.network", "tool.plan", "tool.memory", "tool.inspect", "tool.misc"];
136
+ type ToolRole = (typeof TOOL_ROLE_NAMES)[number];
137
+ declare const TOOL_ROLE_TABLE: Readonly<Record<ToolRole, RoleDefinition>>;
138
+ declare function isToolRole(value: string): value is ToolRole;
139
+ declare function toolRoleOf(toolName: string): ToolRole;
140
+ //#endregion
141
+ //#region src/scalars.d.ts
142
+ interface ScalarToken {
143
+ readonly light: string;
144
+ readonly dark?: string;
145
+ }
146
+ declare const SCALAR_TOKENS: Readonly<Record<string, ScalarToken>>;
147
+ declare function scalarValue(name: string, mode: ColorMode): string;
148
+ declare function scalarDeclarations(mode: ColorMode): readonly string[];
149
+ //#endregion
150
+ //#region src/themes/base.d.ts
151
+ declare const BASE_TOKENS: Readonly<Record<string, string>>;
152
+ declare const DERIVED_TOKENS: Readonly<Record<string, string>>;
153
+ //#endregion
154
+ //#region src/themes/types.d.ts
155
+ type ThemeBase = 'dark' | 'light';
156
+ type ThemeValue = string | number;
157
+ type ThemeValues = Readonly<Record<string, ThemeValue>>;
158
+ type ThemeTokenType = 'color' | 'rgba' | 'font' | 'size' | 'number' | 'select';
159
+ type ThemeTokenGroup = 'color' | 'font' | 'shape' | 'effect';
160
+ interface ThemeTokenDefinition {
161
+ readonly key: string;
162
+ readonly css: string | null;
163
+ readonly group: ThemeTokenGroup;
164
+ readonly section: string;
165
+ readonly label: string;
166
+ readonly type: ThemeTokenType;
167
+ readonly min?: number;
168
+ readonly max?: number;
169
+ readonly step?: number;
170
+ readonly unit?: string;
171
+ readonly options?: readonly (readonly [string, string])[];
172
+ }
173
+ interface ThemeDefinition {
174
+ readonly id: string;
175
+ readonly name: string;
176
+ readonly base: ThemeBase;
177
+ readonly tokens: ThemeValues;
178
+ readonly extends?: string;
179
+ }
180
+ interface ThemeContrastPair {
181
+ readonly foreground: string;
182
+ readonly background: string;
183
+ readonly minimum: number;
184
+ readonly label: string;
185
+ }
186
+ interface ThemeContrastResult extends ThemeContrastPair {
187
+ readonly ratio: number | undefined;
188
+ readonly passes: boolean | undefined;
189
+ }
190
+ //#endregion
191
+ //#region src/themes/builtin.d.ts
192
+ declare const BASE_THEME_VALUES: ThemeValues;
193
+ declare const BUILTIN_THEMES: readonly ThemeDefinition[];
194
+ //#endregion
195
+ //#region src/themes/contrast-pairs.d.ts
196
+ declare const THEME_CONTRAST_PAIRS: readonly ThemeContrastPair[];
197
+ //#endregion
198
+ //#region src/themes/density.d.ts
199
+ declare const DENSITY: Readonly<Record<string, ThemeValues>>;
200
+ //#endregion
201
+ //#region src/themes/effects.d.ts
202
+ declare const ELEVATION: Readonly<Record<string, readonly [string, string, string, string]>>;
203
+ declare const ICON_WEIGHT: Readonly<Record<string, string>>;
204
+ declare const GLOW: Readonly<Record<string, string>>;
205
+ declare const GLOW_TEXT: Readonly<Record<string, string>>;
206
+ declare const GRID_PATTERN: string;
207
+ //#endregion
208
+ //#region src/themes/resolve.d.ts
209
+ type ThemeLookup = (id: string) => ThemeDefinition | undefined;
210
+ declare const DEFAULT_THEME_ID = "otto-dark";
211
+ declare const DEFAULT_DENSITY = "comfortable";
212
+ declare function builtinThemeLookup(id: string): ThemeDefinition | undefined;
213
+ declare function resolveTheme(theme: ThemeDefinition, lookup?: ThemeLookup, visited?: ReadonlySet<string>): ThemeValues;
214
+ declare function themeValueText(token: ThemeTokenDefinition, value: ThemeValue): string;
215
+ declare function themeDeclarations(theme: ThemeDefinition, values: ThemeValues): Readonly<Record<string, string>>;
216
+ declare function resolveThemeDeclarations(theme: ThemeDefinition, density?: string, lookup?: ThemeLookup): Readonly<Record<string, string>>;
217
+ //#endregion
218
+ //#region src/themes/tokens.d.ts
219
+ declare const THEME_TOKENS: readonly ThemeTokenDefinition[];
220
+ //#endregion
221
+ //#region src/themes/workbench-css.d.ts
222
+ declare function workbenchTokensCss(themes?: readonly ThemeDefinition[]): string;
223
+ //#endregion
224
+ export { BASE_THEME_VALUES, BASE_TOKENS, BUILTIN_THEMES, CONTRAST_THRESHOLDS, type ColorMode, DEFAULT_DENSITY, DEFAULT_THEME_ID, DENSITY, DERIVED_TOKENS, ELEVATION, GLOW, GLOW_TEXT, GRID_PATTERN, ICON_WEIGHT, type InlinePalette, LEGACY_ALIASES, LEGACY_RAMP_PREFIXES, type LiteralValue, RAMPS, RAMP_NAMES, ROLE_CONTRAST, ROLE_NAMES, ROLE_TABLE, type RampDefinition, type RampName, type RampReference, type RampStep, type RampSteps, type RgbChannels, type RoleDefinition, type RoleName, type RoleValue, SCALAR_TOKENS, SEMANTIC_SURFACES, SPECTRUM, type ScalarToken, type SurfaceReference, THEME_CONTRAST_PAIRS, THEME_TOKENS, TOOL_ROLE_NAMES, TOOL_ROLE_TABLE, TUI_COLOR_BINDINGS, TUI_COLOR_KEYS, TUI_DARK_OVERRIDES, type ThemeBase, type ThemeColors, type ThemeContrastPair, type ThemeContrastResult, type ThemeDefinition, type ThemeLookup, type ThemeName, type ThemeTokenDefinition, type ThemeTokenGroup, type ThemeTokenType, type ThemeValue, type ThemeValues, type ToolRole, type TuiColorBinding, type TuiColorKey, WEB_LITERALS, type WebProjectionOptions, builtinThemeLookup, contrastRatio, inlineDeclarations, inlinePalette, isToolRole, parseHexColor, rampStepColor, rampStepsOf, rampVariableName, relativeLuminance, resolveRole, resolveTheme, resolveThemeDeclarations, roleVariableName, scalarDeclarations, scalarValue, themeDeclarations, themeNamesOf, themeValueText, toolRoleOf, tuiColorValue, tuiThemeColors, webTokenDeclarations, webTokensCss, workbenchTokensCss };