@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.
@@ -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
- "@context:elevated": Schema.optional(ThemeTokensDefinition),
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
- "@context:elevated": Schema.optional(ThemeTokensDefinition),
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
- "@context:elevated": Schema.optional(ThemeTokensDefinition),
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 = {
@@ -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
- readonly contextual: Readonly<Record<ContextName, ResolvedThemeTokens>>;
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
  };
@@ -160,13 +160,12 @@ function migrateMode(theme, mode) {
160
160
  imageText: color("markdownImageText"),
161
161
  codeBlock: color("markdownCodeBlock"),
162
162
  },
163
- "@context:elevated": {
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) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/theme",
4
- "version": "0.0.0-dev-19788",
4
+ "version": "0.0.0-dev-19793",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {