@opencode-ai/theme 0.0.0-next-16420 → 0.0.0-next-16473
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 +11 -7
- package/dist/tui/syntax.d.ts +2 -2
- package/dist/tui/types.d.ts +5 -4
- 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, SyntaxDefinition, SyntaxToken, ThemeDefinition, ThemeDocument, type BackgroundDefinition, type DiffDefinition, type FileThemeDefinition, type FormfieldColorDefinition, type HueDefinition, type HueOverrideDefinition, type MergeModeDefinition, type Mode, type StatefulColorDefinition, type ContextKey, type TextDefinition, type ThemeTokensDefinition, } from "./schema.js";
|
|
2
|
-
export type { Categorical, FormfieldColor, Hue, HueSource, HueScale, ResolvedActionState, ResolvedFormfieldState, ResolvedTheme,
|
|
2
|
+
export type { Categorical, ContextName, 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 { migrateV1 } from "./v1-migrate.js";
|
|
5
5
|
export { resolveTheme, resolveThemeDocument, themeDecodeError } from "./resolve.js";
|
package/dist/tui/resolve.js
CHANGED
|
@@ -41,13 +41,17 @@ function resolveExpandedTheme(definition) {
|
|
|
41
41
|
const hueSteps = compileHueSteps(hue);
|
|
42
42
|
const base = tokens(definition);
|
|
43
43
|
const resolved = resolveView(base, hue, categorical, hueSteps);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
44
|
+
const context = (name) => {
|
|
45
|
+
const override = definition[`@context:${name}`];
|
|
46
|
+
if (!override)
|
|
47
|
+
return resolved;
|
|
48
|
+
return resolveView(contextualize(base, override), hue, categorical, hueSteps);
|
|
49
|
+
};
|
|
50
|
+
const contextual = {
|
|
51
|
+
elevated: context("elevated"),
|
|
52
|
+
overlay: context("overlay"),
|
|
53
|
+
};
|
|
54
|
+
return { ...resolved, contextual };
|
|
51
55
|
}
|
|
52
56
|
function tokens(definition) {
|
|
53
57
|
return {
|
package/dist/tui/syntax.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SyntaxStyle } from "@opentui/core";
|
|
2
|
-
import type { Mode,
|
|
3
|
-
export declare function generateSyntax(theme:
|
|
2
|
+
import type { Mode, ResolvedThemeTokens } from "./index.js";
|
|
3
|
+
export declare function generateSyntax(theme: ResolvedThemeTokens, mode: Mode): SyntaxStyle;
|
package/dist/tui/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RGBA } from "@opentui/core";
|
|
2
|
-
import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken,
|
|
2
|
+
import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, SyntaxToken } from "./schema.js";
|
|
3
3
|
export type ResolvedActionState = "default" | ActionState;
|
|
4
4
|
export type ResolvedFormfieldState = ResolvedActionState;
|
|
5
5
|
export type HueScale = Readonly<Record<HueStep, RGBA>>;
|
|
@@ -11,7 +11,7 @@ export type HueSource = Readonly<{
|
|
|
11
11
|
export type Categorical = readonly HueScale[];
|
|
12
12
|
export type StatefulColor = Readonly<Record<ResolvedActionState, RGBA>>;
|
|
13
13
|
export type FormfieldColor = StatefulColor;
|
|
14
|
-
export type
|
|
14
|
+
export type ResolvedThemeTokens = {
|
|
15
15
|
readonly hue: Hue;
|
|
16
16
|
readonly categorical: Categorical;
|
|
17
17
|
readonly source: (color: RGBA) => HueSource | undefined;
|
|
@@ -72,6 +72,7 @@ export type ResolvedThemeView = {
|
|
|
72
72
|
readonly syntax: Readonly<Record<SyntaxToken, RGBA>>;
|
|
73
73
|
readonly markdown: Readonly<Record<MarkdownToken, RGBA>>;
|
|
74
74
|
};
|
|
75
|
-
export type
|
|
76
|
-
|
|
75
|
+
export type ContextName = "elevated" | "overlay";
|
|
76
|
+
export type ResolvedTheme = ResolvedThemeTokens & {
|
|
77
|
+
readonly contextual: Readonly<Record<ContextName, ResolvedThemeTokens>>;
|
|
77
78
|
};
|