@opencode/theme 2.0.7 → 2.0.9
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/tui/categorical.d.ts +1 -0
- package/dist/tui/categorical.js +1 -0
- package/dist/tui/expand.js +8 -10
- package/dist/tui/index.d.ts +3 -3
- package/dist/tui/index.js +2 -2
- package/dist/tui/resolve.d.ts +2 -2
- package/dist/tui/resolve.js +49 -43
- package/dist/tui/schema.d.ts +1150 -4536
- package/dist/tui/schema.js +90 -52
- package/dist/tui/select.d.ts +3 -8
- package/dist/tui/select.js +2 -20
- package/dist/tui/syntax.d.ts +2 -2
- package/dist/tui/syntax.js +19 -19
- package/dist/tui/types.d.ts +20 -22
- package/dist/tui/v1-migrate.js +86 -59
- package/package.json +1 -1
- package/dist/tui/defaults.d.ts +0 -578
- package/dist/tui/defaults.js +0 -453
- package/dist/tui/fallback.d.ts +0 -2
- package/dist/tui/fallback.js +0 -56
package/dist/tui/schema.js
CHANGED
|
@@ -4,6 +4,7 @@ export const BaseHue = Schema.Literals(["gray", "red", "orange", "yellow", "gree
|
|
|
4
4
|
export const HueAlias = Schema.Literals(["accent", "interactive", "neutral"]);
|
|
5
5
|
export const ActionVariant = Schema.Literals(["primary", "secondary", "destructive"]);
|
|
6
6
|
export const ActionState = Schema.Literals(["disabled", "pressed", "focused", "selected", "hovered"]);
|
|
7
|
+
export const SurfaceName = Schema.Literal("dialog");
|
|
7
8
|
export const FormfieldState = ActionState;
|
|
8
9
|
export const FeedbackKind = Schema.Literals(["error", "warning", "success", "info"]);
|
|
9
10
|
const Mode = Schema.Literals(["light", "dark"]);
|
|
@@ -16,7 +17,6 @@ const ColorValue = Schema.Union([
|
|
|
16
17
|
export const HueName = Schema.Union([BaseHue, HueAlias]);
|
|
17
18
|
export const CategoricalDefinition = Schema.Array(HueName).check(Schema.isMinLength(1));
|
|
18
19
|
const HueColorValue = Schema.Union([HexColor, Schema.TemplateLiteral(["$hue.", HueName, ".", HueStep])]);
|
|
19
|
-
const ContextKey = Schema.Literals(["@context:elevated", "@context:overlay"]);
|
|
20
20
|
const HueScaleDefinition = Schema.Record(HueStep, HexColor);
|
|
21
21
|
const HueValueDefinition = Schema.Union([Schema.TemplateLiteral(["$hue.", HueName]), HueScaleDefinition]);
|
|
22
22
|
const HueDefinition = Schema.Struct({
|
|
@@ -32,21 +32,8 @@ const HueDefinition = Schema.Struct({
|
|
|
32
32
|
interactive: HueValueDefinition,
|
|
33
33
|
neutral: HueValueDefinition,
|
|
34
34
|
});
|
|
35
|
-
const HueOverrideDefinition = Schema.Struct({
|
|
36
|
-
gray: Schema.optional(HueValueDefinition),
|
|
37
|
-
red: Schema.optional(HueValueDefinition),
|
|
38
|
-
orange: Schema.optional(HueValueDefinition),
|
|
39
|
-
yellow: Schema.optional(HueValueDefinition),
|
|
40
|
-
green: Schema.optional(HueValueDefinition),
|
|
41
|
-
cyan: Schema.optional(HueValueDefinition),
|
|
42
|
-
blue: Schema.optional(HueValueDefinition),
|
|
43
|
-
purple: Schema.optional(HueValueDefinition),
|
|
44
|
-
accent: Schema.optional(HueValueDefinition),
|
|
45
|
-
interactive: Schema.optional(HueValueDefinition),
|
|
46
|
-
neutral: Schema.optional(HueValueDefinition),
|
|
47
|
-
});
|
|
48
35
|
const StatefulColorDefinition = Schema.Struct({
|
|
49
|
-
|
|
36
|
+
base: Schema.optional(ColorValue),
|
|
50
37
|
$hovered: Schema.optional(ColorValue),
|
|
51
38
|
$focused: Schema.optional(ColorValue),
|
|
52
39
|
$pressed: Schema.optional(ColorValue),
|
|
@@ -59,23 +46,17 @@ const ActionColorDefinition = Schema.Struct({
|
|
|
59
46
|
destructive: Schema.optional(StatefulColorDefinition),
|
|
60
47
|
});
|
|
61
48
|
const TextFeedbackDefinition = Schema.Struct({
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
base: Schema.optional(ColorValue),
|
|
50
|
+
muted: Schema.optional(ColorValue),
|
|
64
51
|
});
|
|
65
52
|
const BackgroundFeedbackDefinition = Schema.Struct({
|
|
66
|
-
|
|
53
|
+
base: Schema.optional(ColorValue),
|
|
67
54
|
});
|
|
68
55
|
const TextDefinition = Schema.Struct({
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
base: Schema.optional(ColorValue),
|
|
57
|
+
muted: Schema.optional(ColorValue),
|
|
71
58
|
action: Schema.optional(ActionColorDefinition),
|
|
72
59
|
formfield: Schema.optional(StatefulColorDefinition),
|
|
73
|
-
status: Schema.optional(Schema.Struct({
|
|
74
|
-
running: Schema.optional(ColorValue),
|
|
75
|
-
question: Schema.optional(ColorValue),
|
|
76
|
-
permission: Schema.optional(ColorValue),
|
|
77
|
-
unread: Schema.optional(ColorValue),
|
|
78
|
-
})),
|
|
79
60
|
feedback: Schema.optional(Schema.Struct({
|
|
80
61
|
error: Schema.optional(TextFeedbackDefinition),
|
|
81
62
|
warning: Schema.optional(TextFeedbackDefinition),
|
|
@@ -84,10 +65,11 @@ const TextDefinition = Schema.Struct({
|
|
|
84
65
|
})),
|
|
85
66
|
});
|
|
86
67
|
const BackgroundDefinition = Schema.Struct({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
68
|
+
base: Schema.optional(ColorValue),
|
|
69
|
+
raised: Schema.optional(Schema.Struct({
|
|
70
|
+
base: Schema.optional(ColorValue),
|
|
71
|
+
high: Schema.optional(ColorValue),
|
|
72
|
+
max: Schema.optional(ColorValue),
|
|
91
73
|
})),
|
|
92
74
|
action: Schema.optional(ActionColorDefinition),
|
|
93
75
|
formfield: Schema.optional(StatefulColorDefinition),
|
|
@@ -148,42 +130,98 @@ const DiffDefinition = Schema.Struct({
|
|
|
148
130
|
const ThemeTokensDefinition = Schema.Struct({
|
|
149
131
|
text: Schema.optional(TextDefinition),
|
|
150
132
|
background: Schema.optional(BackgroundDefinition),
|
|
151
|
-
border: Schema.optional(Schema.Struct({
|
|
152
|
-
scrollbar: Schema.optional(Schema.Struct({
|
|
133
|
+
border: Schema.optional(Schema.Struct({ base: Schema.optional(ColorValue) })),
|
|
134
|
+
scrollbar: Schema.optional(Schema.Struct({ base: Schema.optional(ColorValue) })),
|
|
153
135
|
diff: Schema.optional(DiffDefinition),
|
|
154
136
|
syntax: Schema.optional(SyntaxDefinition),
|
|
155
137
|
markdown: Schema.optional(MarkdownDefinition),
|
|
156
138
|
});
|
|
139
|
+
const CompleteStatefulColorDefinition = Schema.Struct({
|
|
140
|
+
base: ColorValue,
|
|
141
|
+
$hovered: Schema.optional(ColorValue),
|
|
142
|
+
$focused: Schema.optional(ColorValue),
|
|
143
|
+
$pressed: Schema.optional(ColorValue),
|
|
144
|
+
$selected: Schema.optional(ColorValue),
|
|
145
|
+
$disabled: Schema.optional(ColorValue),
|
|
146
|
+
});
|
|
147
|
+
const CompleteActionColorDefinition = Schema.Struct({
|
|
148
|
+
primary: CompleteStatefulColorDefinition,
|
|
149
|
+
secondary: CompleteStatefulColorDefinition,
|
|
150
|
+
destructive: CompleteStatefulColorDefinition,
|
|
151
|
+
});
|
|
152
|
+
const CompleteTextFeedbackDefinition = Schema.Struct({ base: ColorValue, muted: Schema.optional(ColorValue) });
|
|
153
|
+
const CompleteBackgroundFeedbackDefinition = Schema.Struct({ base: ColorValue });
|
|
154
|
+
const CompleteThemeTokensDefinition = Schema.Struct({
|
|
155
|
+
text: Schema.Struct({
|
|
156
|
+
base: ColorValue,
|
|
157
|
+
muted: ColorValue,
|
|
158
|
+
action: CompleteActionColorDefinition,
|
|
159
|
+
formfield: CompleteStatefulColorDefinition,
|
|
160
|
+
feedback: Schema.Struct({
|
|
161
|
+
error: CompleteTextFeedbackDefinition,
|
|
162
|
+
warning: CompleteTextFeedbackDefinition,
|
|
163
|
+
success: CompleteTextFeedbackDefinition,
|
|
164
|
+
info: CompleteTextFeedbackDefinition,
|
|
165
|
+
}),
|
|
166
|
+
}),
|
|
167
|
+
background: Schema.Struct({
|
|
168
|
+
base: ColorValue,
|
|
169
|
+
raised: Schema.Struct({ base: ColorValue, high: ColorValue, max: ColorValue }),
|
|
170
|
+
action: CompleteActionColorDefinition,
|
|
171
|
+
formfield: CompleteStatefulColorDefinition,
|
|
172
|
+
feedback: Schema.Struct({
|
|
173
|
+
error: CompleteBackgroundFeedbackDefinition,
|
|
174
|
+
warning: CompleteBackgroundFeedbackDefinition,
|
|
175
|
+
success: CompleteBackgroundFeedbackDefinition,
|
|
176
|
+
info: CompleteBackgroundFeedbackDefinition,
|
|
177
|
+
}),
|
|
178
|
+
}),
|
|
179
|
+
border: Schema.Struct({ base: ColorValue }),
|
|
180
|
+
scrollbar: Schema.Struct({ base: ColorValue }),
|
|
181
|
+
diff: Schema.Struct({
|
|
182
|
+
text: Schema.Struct({ added: ColorValue, removed: ColorValue, context: ColorValue, hunkHeader: ColorValue }),
|
|
183
|
+
background: Schema.Struct({ added: ColorValue, removed: ColorValue, context: ColorValue }),
|
|
184
|
+
highlight: Schema.Struct({ added: ColorValue, removed: ColorValue }),
|
|
185
|
+
lineNumber: Schema.Struct({
|
|
186
|
+
text: ColorValue,
|
|
187
|
+
background: Schema.Struct({ added: ColorValue, removed: ColorValue }),
|
|
188
|
+
}),
|
|
189
|
+
}),
|
|
190
|
+
syntax: Schema.Record(SyntaxToken, HueColorValue),
|
|
191
|
+
markdown: Schema.Record(MarkdownToken, HueColorValue),
|
|
192
|
+
});
|
|
157
193
|
const ThemeDefinitionFields = Schema.Struct({
|
|
158
194
|
hue: HueDefinition,
|
|
159
|
-
categorical:
|
|
160
|
-
...
|
|
161
|
-
"@
|
|
162
|
-
"@context:overlay": Schema.optional(ThemeTokensDefinition),
|
|
195
|
+
categorical: CategoricalDefinition,
|
|
196
|
+
...CompleteThemeTokensDefinition.fields,
|
|
197
|
+
"@dialog": Schema.optional(ThemeTokensDefinition),
|
|
163
198
|
});
|
|
164
199
|
export const ThemeDefinition = ThemeDefinitionFields;
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
"@context:elevated": Schema.optional(ThemeTokensDefinition),
|
|
170
|
-
"@context:overlay": Schema.optional(ThemeTokensDefinition),
|
|
200
|
+
export const BaseThemeDefinition = Schema.Struct({
|
|
201
|
+
categorical: CategoricalDefinition,
|
|
202
|
+
...CompleteThemeTokensDefinition.fields,
|
|
203
|
+
"@dialog": Schema.optional(ThemeTokensDefinition),
|
|
171
204
|
});
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
hue: Schema.optional(HueOverrideDefinition),
|
|
205
|
+
export const ModeDefinition = Schema.Struct({
|
|
206
|
+
hue: HueDefinition,
|
|
175
207
|
categorical: Schema.optional(CategoricalDefinition),
|
|
176
208
|
...ThemeTokensDefinition.fields,
|
|
177
|
-
"@
|
|
178
|
-
"@context:overlay": Schema.optional(ThemeTokensDefinition),
|
|
209
|
+
"@dialog": Schema.optional(ThemeTokensDefinition),
|
|
179
210
|
});
|
|
180
|
-
export const ModeDefinition = Schema.Union([MergeModeDefinition, FileThemeDefinition]);
|
|
181
211
|
const FileMetadata = {
|
|
182
212
|
$schema: Schema.optional(Schema.String),
|
|
183
|
-
version: Schema.Literal(2),
|
|
184
|
-
standalone: Schema.optional(Schema.Boolean),
|
|
185
213
|
};
|
|
186
214
|
export const ThemeDocument = Schema.Union([
|
|
187
|
-
Schema.Struct({
|
|
188
|
-
|
|
215
|
+
Schema.Struct({
|
|
216
|
+
...FileMetadata,
|
|
217
|
+
base: BaseThemeDefinition,
|
|
218
|
+
light: ModeDefinition,
|
|
219
|
+
dark: Schema.optional(ModeDefinition),
|
|
220
|
+
}),
|
|
221
|
+
Schema.Struct({
|
|
222
|
+
...FileMetadata,
|
|
223
|
+
base: BaseThemeDefinition,
|
|
224
|
+
light: Schema.optional(ModeDefinition),
|
|
225
|
+
dark: ModeDefinition,
|
|
226
|
+
}),
|
|
189
227
|
]);
|
package/dist/tui/select.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function selectTheme(document: ThemeDocument
|
|
3
|
-
light: ThemeDefinition;
|
|
4
|
-
dark: ThemeDefinition;
|
|
5
|
-
}, mode?: Mode): ThemeDefinition;
|
|
6
|
-
export declare function selectTheme(document: ThemeDocument, mode?: Mode): FileThemeDefinition;
|
|
1
|
+
import type { Mode, ThemeDefinition, ThemeDocument } from "./index.js";
|
|
2
|
+
export declare function selectTheme(document: ThemeDocument, mode?: Mode): ThemeDefinition;
|
|
7
3
|
export declare function selectThemeMode(document: ThemeDocument, mode?: Mode): {
|
|
8
|
-
theme:
|
|
4
|
+
theme: ThemeDefinition;
|
|
9
5
|
mode: Mode;
|
|
10
|
-
expanded: boolean;
|
|
11
6
|
};
|
|
12
7
|
export declare function themeModes(document: ThemeDocument): readonly Mode[];
|
|
13
8
|
export declare function supportsThemeMode(document: ThemeDocument, mode: Mode): boolean;
|
package/dist/tui/select.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mergeTheme } from "./expand.js";
|
|
2
2
|
export function selectTheme(document, mode) {
|
|
3
3
|
return selectThemeMode(document, mode).theme;
|
|
4
4
|
}
|
|
@@ -8,29 +8,11 @@ export function selectThemeMode(document, mode = "light") {
|
|
|
8
8
|
const selected = document[selectedMode];
|
|
9
9
|
if (!selected)
|
|
10
10
|
throw new Error("Theme must provide at least one mode");
|
|
11
|
-
|
|
12
|
-
throw new Error("Light and dark themes cannot both merge modes");
|
|
13
|
-
if (!merges(selected))
|
|
14
|
-
return { theme: selected, mode: selectedMode, expanded: false };
|
|
15
|
-
const otherMode = selectedMode === "light" ? "dark" : "light";
|
|
16
|
-
const other = document[otherMode];
|
|
17
|
-
if (!other)
|
|
18
|
-
throw new Error(`The ${selectedMode} theme cannot merge without a ${otherMode} theme`);
|
|
19
|
-
const merged = mergeTheme(expandTheme(other), expandTheme(selected));
|
|
20
|
-
if (!merged["hue"])
|
|
21
|
-
throw new Error(`The ${otherMode} theme must provide hues when ${selectedMode} merges modes`);
|
|
22
|
-
return { theme: merged, mode: selectedMode, expanded: true };
|
|
11
|
+
return { theme: mergeTheme(document.base, selected), mode: selectedMode };
|
|
23
12
|
}
|
|
24
13
|
export function themeModes(document) {
|
|
25
|
-
if (merges(document.light) && !document.dark)
|
|
26
|
-
throw new Error("The light theme cannot merge without a dark theme");
|
|
27
|
-
if (merges(document.dark) && !document.light)
|
|
28
|
-
throw new Error("The dark theme cannot merge without a light theme");
|
|
29
14
|
return ["light", "dark"].filter((mode) => document[mode] !== undefined);
|
|
30
15
|
}
|
|
31
16
|
export function supportsThemeMode(document, mode) {
|
|
32
17
|
return themeModes(document).includes(mode);
|
|
33
18
|
}
|
|
34
|
-
function merges(definition) {
|
|
35
|
-
return definition !== undefined && "mergeMode" in definition && definition.mergeMode === true;
|
|
36
|
-
}
|
package/dist/tui/syntax.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SyntaxStyle } from "@opentui/core";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function generateSyntax(theme: ResolvedThemeTokens
|
|
2
|
+
import type { ResolvedThemeTokens } from "./index.js";
|
|
3
|
+
export declare function generateSyntax(theme: ResolvedThemeTokens): SyntaxStyle;
|
package/dist/tui/syntax.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { SyntaxStyle } from "@opentui/core";
|
|
2
|
-
export function generateSyntax(theme
|
|
3
|
-
const step =
|
|
2
|
+
export function generateSyntax(theme) {
|
|
3
|
+
const step = 200;
|
|
4
4
|
const syntax = theme.syntax;
|
|
5
5
|
const markdown = theme.markdown;
|
|
6
6
|
const feedback = theme.text.feedback;
|
|
7
7
|
return SyntaxStyle.fromTheme([
|
|
8
|
-
rule(["default"], theme.text.
|
|
8
|
+
rule(["default"], theme.text.base),
|
|
9
9
|
rule(["prompt"], theme.hue.accent[step]),
|
|
10
|
-
rule(["extmark.file"], feedback.warning.
|
|
10
|
+
rule(["extmark.file"], feedback.warning.base, { bold: true }),
|
|
11
11
|
rule(["extmark.agent"], theme.categorical[0][step], { bold: true }),
|
|
12
12
|
rule(["extmark.skill"], (theme.categorical[1] ?? theme.categorical[0])[step], { bold: true }),
|
|
13
13
|
// V1 migration preserves its selected/inverse foreground in this action state.
|
|
14
14
|
rule(["extmark.paste"], theme.text.action.primary.focused, {
|
|
15
|
-
background: feedback.warning.
|
|
15
|
+
background: feedback.warning.base,
|
|
16
16
|
bold: true,
|
|
17
17
|
}),
|
|
18
18
|
rule(["comment", "comment.documentation"], syntax.comment, { italic: true }),
|
|
@@ -31,7 +31,7 @@ export function generateSyntax(theme, mode) {
|
|
|
31
31
|
rule(["type", "module", "class", "namespace"], syntax.type),
|
|
32
32
|
rule(["type.definition"], syntax.type, { bold: true }),
|
|
33
33
|
rule(["punctuation", "punctuation.bracket"], syntax.punctuation),
|
|
34
|
-
rule(["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin", "variable.super"], feedback.error.
|
|
34
|
+
rule(["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin", "variable.super"], feedback.error.base),
|
|
35
35
|
rule(["keyword.directive", "keyword.modifier", "keyword.exception"], syntax.keyword, { italic: true }),
|
|
36
36
|
rule(["punctuation.special", "tag.delimiter"], syntax.operator),
|
|
37
37
|
rule([
|
|
@@ -48,27 +48,27 @@ export function generateSyntax(theme, mode) {
|
|
|
48
48
|
rule(["markup.list"], markdown.listItem),
|
|
49
49
|
rule(["markup.quote"], markdown.blockQuote, { italic: true }),
|
|
50
50
|
rule(["markup.raw", "markup.raw.block"], markdown.code),
|
|
51
|
-
rule(["markup.raw.inline"], markdown.code, { background: theme.background.
|
|
51
|
+
rule(["markup.raw.inline"], markdown.code, { background: theme.background.base }),
|
|
52
52
|
rule(["markup.link", "markup.link.url", "string.special", "string.special.url"], markdown.link, {
|
|
53
53
|
underline: true,
|
|
54
54
|
}),
|
|
55
55
|
rule(["markup.link.label"], markdown.linkText, { underline: true }),
|
|
56
56
|
rule(["label"], markdown.linkText),
|
|
57
|
-
rule(["spell", "nospell"], theme.text.
|
|
58
|
-
rule(["markup.underline"], theme.text.
|
|
59
|
-
rule(["comment.error"], feedback.error.
|
|
60
|
-
rule(["comment.warning"], feedback.warning.
|
|
61
|
-
rule(["comment.todo", "comment.note"], feedback.info.
|
|
62
|
-
rule(["attribute", "annotation"], feedback.warning.
|
|
63
|
-
rule(["tag"], feedback.error.
|
|
64
|
-
rule(["markup.strikethrough", "markup.list.unchecked", "debug"], theme.text.
|
|
65
|
-
rule(["markup.list.checked"], feedback.success.
|
|
57
|
+
rule(["spell", "nospell"], theme.text.base),
|
|
58
|
+
rule(["markup.underline"], theme.text.base, { underline: true }),
|
|
59
|
+
rule(["comment.error"], feedback.error.base, { italic: true, bold: true }),
|
|
60
|
+
rule(["comment.warning"], feedback.warning.base, { italic: true, bold: true }),
|
|
61
|
+
rule(["comment.todo", "comment.note"], feedback.info.base, { italic: true, bold: true }),
|
|
62
|
+
rule(["attribute", "annotation"], feedback.warning.base),
|
|
63
|
+
rule(["tag"], feedback.error.base),
|
|
64
|
+
rule(["markup.strikethrough", "markup.list.unchecked", "debug"], theme.text.muted),
|
|
65
|
+
rule(["markup.list.checked"], feedback.success.base),
|
|
66
66
|
rule(["diff.plus"], theme.diff.text.added, { background: theme.diff.background.added }),
|
|
67
67
|
rule(["diff.minus"], theme.diff.text.removed, { background: theme.diff.background.removed }),
|
|
68
68
|
rule(["diff.delta"], theme.diff.text.context, { background: theme.diff.background.context }),
|
|
69
|
-
rule(["error"], feedback.error.
|
|
70
|
-
rule(["warning"], feedback.warning.
|
|
71
|
-
rule(["info"], feedback.info.
|
|
69
|
+
rule(["error"], feedback.error.base, { bold: true }),
|
|
70
|
+
rule(["warning"], feedback.warning.base, { bold: true }),
|
|
71
|
+
rule(["info"], feedback.info.base),
|
|
72
72
|
]);
|
|
73
73
|
}
|
|
74
74
|
function rule(scope, foreground, style = {}) {
|
package/dist/tui/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RGBA } from "@opentui/core";
|
|
2
|
-
import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, SyntaxToken } from "./schema.js";
|
|
3
|
-
export type ResolvedActionState = "
|
|
2
|
+
import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, SurfaceName, SyntaxToken } from "./schema.js";
|
|
3
|
+
export type ResolvedActionState = "base" | ActionState;
|
|
4
4
|
export type ResolvedFormfieldState = ResolvedActionState;
|
|
5
5
|
export type HueScale = Readonly<Record<HueStep, RGBA>>;
|
|
6
6
|
export type Hue = Readonly<Record<BaseHue | HueAlias, HueScale>>;
|
|
@@ -9,7 +9,10 @@ export type HueSource = Readonly<{
|
|
|
9
9
|
step: HueStep;
|
|
10
10
|
}>;
|
|
11
11
|
export type Categorical = readonly HueScale[];
|
|
12
|
-
export type
|
|
12
|
+
export type ActionStates = Readonly<Partial<Record<ActionState, boolean>>>;
|
|
13
|
+
export type StatefulColor = Readonly<Record<ResolvedActionState, RGBA>> & {
|
|
14
|
+
readonly state: (states: ActionStates) => RGBA;
|
|
15
|
+
};
|
|
13
16
|
export type FormfieldColor = StatefulColor;
|
|
14
17
|
export type ResolvedThemeTokens = {
|
|
15
18
|
readonly hue: Hue;
|
|
@@ -18,38 +21,33 @@ export type ResolvedThemeTokens = {
|
|
|
18
21
|
readonly increase: (color: RGBA, amount?: number) => RGBA;
|
|
19
22
|
readonly decrease: (color: RGBA, amount?: number) => RGBA;
|
|
20
23
|
readonly text: {
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
24
|
+
readonly base: RGBA;
|
|
25
|
+
readonly muted: RGBA;
|
|
23
26
|
readonly action: Readonly<Record<ActionVariant, StatefulColor>>;
|
|
24
27
|
readonly formfield: FormfieldColor;
|
|
25
|
-
readonly status: {
|
|
26
|
-
readonly running: RGBA;
|
|
27
|
-
readonly question: RGBA;
|
|
28
|
-
readonly permission: RGBA;
|
|
29
|
-
readonly unread: RGBA;
|
|
30
|
-
};
|
|
31
28
|
readonly feedback: Readonly<Record<FeedbackKind, {
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
29
|
+
readonly base: RGBA;
|
|
30
|
+
readonly muted: RGBA;
|
|
34
31
|
}>>;
|
|
35
32
|
};
|
|
36
33
|
readonly background: {
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
34
|
+
readonly base: RGBA;
|
|
35
|
+
readonly raised: {
|
|
36
|
+
readonly base: RGBA;
|
|
37
|
+
readonly high: RGBA;
|
|
38
|
+
readonly max: RGBA;
|
|
41
39
|
};
|
|
42
40
|
readonly action: Readonly<Record<ActionVariant, StatefulColor>>;
|
|
43
41
|
readonly formfield: FormfieldColor;
|
|
44
42
|
readonly feedback: Readonly<Record<FeedbackKind, {
|
|
45
|
-
readonly
|
|
43
|
+
readonly base: RGBA;
|
|
46
44
|
}>>;
|
|
47
45
|
};
|
|
48
46
|
readonly border: {
|
|
49
|
-
readonly
|
|
47
|
+
readonly base: RGBA;
|
|
50
48
|
};
|
|
51
49
|
readonly scrollbar: {
|
|
52
|
-
readonly
|
|
50
|
+
readonly base: RGBA;
|
|
53
51
|
};
|
|
54
52
|
readonly diff: {
|
|
55
53
|
readonly text: {
|
|
@@ -78,7 +76,7 @@ export type ResolvedThemeTokens = {
|
|
|
78
76
|
readonly syntax: Readonly<Record<SyntaxToken, RGBA>>;
|
|
79
77
|
readonly markdown: Readonly<Record<MarkdownToken, RGBA>>;
|
|
80
78
|
};
|
|
81
|
-
export type ContextName = "elevated" | "overlay";
|
|
82
79
|
export type ResolvedTheme = ResolvedThemeTokens & {
|
|
83
|
-
|
|
80
|
+
/** The same theme re-resolved on a raised surface. Absolute: every view's surfaces are the base theme's. */
|
|
81
|
+
readonly surface: (name: SurfaceName) => ResolvedTheme;
|
|
84
82
|
};
|