@tenyokjs/devdevian-cli 0.4.1-alpha.1 → 0.5.1-alpha.1

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/lib/theme.mjs CHANGED
@@ -1,13 +1,66 @@
1
- // One palette for the workspace, file picker and review panes.
2
- export const colors = Object.freeze({
3
- bg: "#0b1020",
4
- panel: "#11182b",
5
- line: "#303d60",
6
- muted: "#8e9ab8",
7
- text: "#e5eaff",
8
- blue: "#86baff",
9
- purple: "#b5a0ff",
10
- green: "#7bdcbd",
11
- red: "#ffa0b4",
12
- selected: "#29365b",
13
- });
1
+ import { createContext, useContext } from "react";
2
+ import { normalizeAppearance } from "./appearance.mjs";
3
+ const presets = {
4
+ midnight: {
5
+ bg: "#0b1020",
6
+ panel: "#11182b",
7
+ line: "#303d60",
8
+ muted: "#96a3c1",
9
+ text: "#e5eaff",
10
+ green: "#7bdcbd",
11
+ red: "#ffa0b4",
12
+ selected: "#29365b",
13
+ },
14
+ nebula: {
15
+ bg: "#100d20",
16
+ panel: "#1a1530",
17
+ line: "#4a3b68",
18
+ muted: "#a49ab9",
19
+ text: "#f0eaff",
20
+ green: "#86ddc3",
21
+ red: "#ffa6bd",
22
+ selected: "#3c2c59",
23
+ },
24
+ daylight: {
25
+ bg: "#f2f5ff",
26
+ panel: "#ffffff",
27
+ line: "#b4c0dc",
28
+ muted: "#53617a",
29
+ text: "#1b2440",
30
+ green: "#16634d",
31
+ red: "#a12444",
32
+ selected: "#dce5ff",
33
+ },
34
+ contrast: {
35
+ bg: "#000000",
36
+ panel: "#080e1c",
37
+ line: "#899cc6",
38
+ muted: "#becae2",
39
+ text: "#ffffff",
40
+ green: "#8cf4c7",
41
+ red: "#ffb0c4",
42
+ selected: "#24345c",
43
+ },
44
+ };
45
+ export function themeFor(value = {}) {
46
+ const settings = normalizeAppearance(value),
47
+ light = settings.theme === "daylight";
48
+ const accents = light
49
+ ? {
50
+ blue: ["#3154b8", "#6b36b6"],
51
+ violet: ["#6b36b6", "#3154b8"],
52
+ cyan: ["#006b80", "#6b36b6"],
53
+ rose: ["#9b246c", "#3154b8"],
54
+ }
55
+ : {
56
+ blue: ["#86baff", "#b5a0ff"],
57
+ violet: ["#c0a6ff", "#86baff"],
58
+ cyan: ["#74d5ed", "#b5a0ff"],
59
+ rose: ["#f4a6cf", "#86baff"],
60
+ };
61
+ const [blue, purple] = accents[settings.accent];
62
+ return { ...presets[settings.theme], blue, purple, frame: settings.frame };
63
+ }
64
+ export const colors = Object.freeze(themeFor());
65
+ export const ThemeContext = createContext(colors);
66
+ export const useTheme = () => useContext(ThemeContext);
package/lib/tui-data.mjs CHANGED
@@ -19,6 +19,7 @@ export const navigation = [
19
19
  ["communities", "Communities", "Your private spaces"],
20
20
  ["search", "Search", "Find a conversation"],
21
21
  ["devices", "Connected terminals", "Manage CLI access"],
22
+ ["appearance", "Appearance", "Themes & layout"],
22
23
  ["help", "Help", "Keys & commands"],
23
24
  ];
24
25
  export async function notificationRoute(api, item) {
@@ -238,6 +239,7 @@ export function contentLines(route, data) {
238
239
  "Ctrl+S Preview the current form",
239
240
  "Ctrl+O / Ctrl+G Select a code file / Git diff in a review form",
240
241
  "/drafts Restore locally saved drafts for this account/project",
242
+ "/appearance Preview and save local themes and layout",
241
243
  "Ctrl+C Exit and restore the original terminal",
242
244
  "",
243
245
  "Commands: /feed /inbox /search words /open 142",
package/lib/tui-model.mjs CHANGED
@@ -129,6 +129,7 @@ export function parseCommand(text) {
129
129
  "help",
130
130
  "devices",
131
131
  "drafts",
132
+ "appearance",
132
133
  ].includes(cmd)
133
134
  )
134
135
  return { command: cmd, arg };
@@ -140,7 +141,7 @@ export function parseCommand(text) {
140
141
  return { command: cmd, arg: Number(arg) };
141
142
  if (["quit", "logout"].includes(cmd)) return { command: cmd };
142
143
  throw Error(
143
- "Use /feed, /inbox, /search words, /open ID, /ask, /review, /communities, /devices, /drafts, /help or /quit.",
144
+ "Use /feed, /inbox, /search words, /open ID, /ask, /review, /communities, /devices, /drafts, /appearance, /help or /quit.",
144
145
  );
145
146
  }
146
147
  export class PageCache {