@opencode/theme 0.0.0-dev-19793 → 0.0.0-dev-19794
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/index.d.ts +1 -1
- package/dist/tui/resolve.js +26 -1
- package/dist/tui/types.d.ts +4 -1
- package/package.json +1 -1
package/dist/tui/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ActionState, type ActionStateKey, ActionVariant, BaseHue, CategoricalDefinition, FeedbackKind, FormfieldState, type FormfieldStateKey, HueAlias, HueName, HueStep, MarkdownDefinition, MarkdownToken, ModeDefinition, SurfaceName, SyntaxDefinition, SyntaxToken, ThemeDefinition, ThemeDocument, type BackgroundDefinition, type DiffDefinition, type FileThemeDefinition, type FormfieldColorDefinition, type HueDefinition, type HueOverrideDefinition, type MergeModeDefinition, type Mode, type StatefulColorDefinition, type TextDefinition, type ThemeTokensDefinition, } from "./schema.js";
|
|
2
|
-
export type { Categorical, FormfieldColor, Hue, HueSource, HueScale, ResolvedActionState, ResolvedFormfieldState, ResolvedTheme, ResolvedThemeTokens, StatefulColor, } from "./types.js";
|
|
2
|
+
export type { ActionStates, Categorical, FormfieldColor, Hue, HueSource, HueScale, ResolvedActionState, ResolvedFormfieldState, ResolvedTheme, ResolvedThemeTokens, StatefulColor, } from "./types.js";
|
|
3
3
|
export { DEFAULT_CATEGORICAL, DEFAULT_THEME } from "./defaults.js";
|
|
4
4
|
export { expandTheme } from "./expand.js";
|
|
5
5
|
export { migrateV1 } from "./v1-migrate.js";
|
package/dist/tui/resolve.js
CHANGED
|
@@ -92,7 +92,32 @@ function contextualActions(base, surface) {
|
|
|
92
92
|
}
|
|
93
93
|
function resolveView(definition, hue, categorical, hueSteps) {
|
|
94
94
|
const source = { hue, ...definition };
|
|
95
|
-
|
|
95
|
+
const resolved = createResolver(source)(source, "theme");
|
|
96
|
+
return {
|
|
97
|
+
...resolved,
|
|
98
|
+
hue,
|
|
99
|
+
categorical,
|
|
100
|
+
text: {
|
|
101
|
+
...resolved.text,
|
|
102
|
+
action: statefulActions(resolved.text.action),
|
|
103
|
+
formfield: statefulColor(resolved.text.formfield),
|
|
104
|
+
},
|
|
105
|
+
background: {
|
|
106
|
+
...resolved.background,
|
|
107
|
+
action: statefulActions(resolved.background.action),
|
|
108
|
+
formfield: statefulColor(resolved.background.formfield),
|
|
109
|
+
},
|
|
110
|
+
...hueSteps,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function statefulActions(actions) {
|
|
114
|
+
return Object.fromEntries(ActionVariant.literals.map((variant) => [variant, statefulColor(actions[variant])]));
|
|
115
|
+
}
|
|
116
|
+
function statefulColor(color) {
|
|
117
|
+
return {
|
|
118
|
+
...color,
|
|
119
|
+
state: (states) => color[ActionState.literals.find((state) => states[state]) ?? "default"],
|
|
120
|
+
};
|
|
96
121
|
}
|
|
97
122
|
function compileHueSteps(hue) {
|
|
98
123
|
const index = new WeakMap();
|
package/dist/tui/types.d.ts
CHANGED
|
@@ -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;
|