@opencode/theme 0.0.0-dev-19788 → 0.0.0-dev-19793
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/defaults.d.ts +2 -36
- package/dist/tui/defaults.js +2 -16
- package/dist/tui/expand.js +1 -3
- package/dist/tui/index.d.ts +2 -2
- package/dist/tui/index.js +1 -1
- package/dist/tui/resolve.d.ts +3 -3
- package/dist/tui/resolve.js +20 -27
- package/dist/tui/schema.d.ts +1132 -3108
- package/dist/tui/schema.js +4 -7
- package/dist/tui/types.d.ts +5 -3
- package/dist/tui/v1-migrate.js +1 -2
- package/package.json +1 -1
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({
|
|
@@ -159,24 +159,21 @@ const ThemeDefinitionFields = Schema.Struct({
|
|
|
159
159
|
hue: HueDefinition,
|
|
160
160
|
categorical: Schema.optional(CategoricalDefinition),
|
|
161
161
|
...ThemeTokensDefinition.fields,
|
|
162
|
-
"@
|
|
163
|
-
"@context:overlay": Schema.optional(ThemeTokensDefinition),
|
|
162
|
+
"@dialog": Schema.optional(ThemeTokensDefinition),
|
|
164
163
|
});
|
|
165
164
|
export const ThemeDefinition = ThemeDefinitionFields;
|
|
166
165
|
const FileThemeDefinition = Schema.Struct({
|
|
167
166
|
hue: Schema.optional(HueOverrideDefinition),
|
|
168
167
|
categorical: Schema.optional(CategoricalDefinition),
|
|
169
168
|
...ThemeTokensDefinition.fields,
|
|
170
|
-
"@
|
|
171
|
-
"@context:overlay": Schema.optional(ThemeTokensDefinition),
|
|
169
|
+
"@dialog": Schema.optional(ThemeTokensDefinition),
|
|
172
170
|
});
|
|
173
171
|
const MergeModeDefinition = Schema.Struct({
|
|
174
172
|
mergeMode: Schema.Literal(true),
|
|
175
173
|
hue: Schema.optional(HueOverrideDefinition),
|
|
176
174
|
categorical: Schema.optional(CategoricalDefinition),
|
|
177
175
|
...ThemeTokensDefinition.fields,
|
|
178
|
-
"@
|
|
179
|
-
"@context:overlay": Schema.optional(ThemeTokensDefinition),
|
|
176
|
+
"@dialog": Schema.optional(ThemeTokensDefinition),
|
|
180
177
|
});
|
|
181
178
|
export const ModeDefinition = Schema.Union([MergeModeDefinition, FileThemeDefinition]);
|
|
182
179
|
const FileMetadata = {
|
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, SyntaxToken } from "./schema.js";
|
|
2
|
+
import type { ActionState, ActionVariant, BaseHue, FeedbackKind, HueAlias, HueStep, MarkdownToken, SurfaceName, 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>>;
|
|
@@ -79,7 +79,9 @@ export type ResolvedThemeTokens = {
|
|
|
79
79
|
readonly syntax: Readonly<Record<SyntaxToken, RGBA>>;
|
|
80
80
|
readonly markdown: Readonly<Record<MarkdownToken, RGBA>>;
|
|
81
81
|
};
|
|
82
|
-
export type ContextName = "elevated" | "overlay";
|
|
83
82
|
export type ResolvedTheme = ResolvedThemeTokens & {
|
|
84
|
-
|
|
83
|
+
/** Lift a ramp color one step away from the background: lighter in light mode, darker in dark mode. */
|
|
84
|
+
readonly raise: (color: RGBA) => RGBA;
|
|
85
|
+
/** The same theme re-resolved on a raised surface. Absolute: every view's surfaces are the base theme's. */
|
|
86
|
+
readonly surface: (name: SurfaceName) => ResolvedTheme;
|
|
85
87
|
};
|
package/dist/tui/v1-migrate.js
CHANGED
|
@@ -160,13 +160,12 @@ function migrateMode(theme, mode) {
|
|
|
160
160
|
imageText: color("markdownImageText"),
|
|
161
161
|
codeBlock: color("markdownCodeBlock"),
|
|
162
162
|
},
|
|
163
|
-
"@
|
|
163
|
+
"@dialog": {
|
|
164
164
|
background: {
|
|
165
165
|
default: "$background.raised.base",
|
|
166
166
|
action: { primary: { $hovered: "$background.raised.high" } },
|
|
167
167
|
},
|
|
168
168
|
},
|
|
169
|
-
"@context:overlay": { background: { default: "$background.raised.high" } },
|
|
170
169
|
});
|
|
171
170
|
}
|
|
172
171
|
function referenceHues(theme) {
|