@carlesandres/house 0.3.0
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/CHANGELOG.md +179 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/package.json +67 -0
- package/src/Browser.tsx +472 -0
- package/src/Footer.tsx +151 -0
- package/src/HelpOverlay.tsx +130 -0
- package/src/cli/argv.ts +106 -0
- package/src/discovery/filter.ts +56 -0
- package/src/discovery/walk.ts +143 -0
- package/src/index.tsx +265 -0
- package/src/io/readFile.ts +14 -0
- package/src/keymap/browser.ts +229 -0
- package/src/keymap/keymap.ts +86 -0
- package/src/serve/css.ts +120 -0
- package/src/serve/openBrowser.ts +19 -0
- package/src/serve/render.ts +56 -0
- package/src/serve/server.ts +163 -0
- package/src/theme/atom.ts +23 -0
- package/src/theme/colors.ts +79 -0
- package/src/theme/loader.ts +110 -0
- package/src/theme/registry.ts +12 -0
- package/src/theme/resolve.ts +168 -0
- package/src/theme/themes/aura.json +58 -0
- package/src/theme/themes/ayu.json +69 -0
- package/src/theme/themes/carbonfox.json +201 -0
- package/src/theme/themes/catppuccin-frappe.json +186 -0
- package/src/theme/themes/catppuccin-macchiato.json +186 -0
- package/src/theme/themes/catppuccin.json +212 -0
- package/src/theme/themes/cobalt2.json +181 -0
- package/src/theme/themes/cursor.json +202 -0
- package/src/theme/themes/dracula.json +172 -0
- package/src/theme/themes/everforest.json +194 -0
- package/src/theme/themes/flexoki.json +190 -0
- package/src/theme/themes/github.json +186 -0
- package/src/theme/themes/gruvbox.json +195 -0
- package/src/theme/themes/kanagawa.json +180 -0
- package/src/theme/themes/lucent-orng.json +186 -0
- package/src/theme/themes/material.json +188 -0
- package/src/theme/themes/matrix.json +180 -0
- package/src/theme/themes/mercury.json +198 -0
- package/src/theme/themes/monokai.json +174 -0
- package/src/theme/themes/nightowl.json +174 -0
- package/src/theme/themes/nord.json +176 -0
- package/src/theme/themes/one-dark.json +184 -0
- package/src/theme/themes/opencode.json +198 -0
- package/src/theme/themes/orng.json +202 -0
- package/src/theme/themes/osaka-jade.json +193 -0
- package/src/theme/themes/palenight.json +175 -0
- package/src/theme/themes/rosepine.json +187 -0
- package/src/theme/themes/solarized.json +176 -0
- package/src/theme/themes/synthwave84.json +179 -0
- package/src/theme/themes/tokyonight.json +196 -0
- package/src/theme/themes/vercel.json +198 -0
- package/src/theme/themes/vesper.json +171 -0
- package/src/theme/themes/zenburn.json +176 -0
- package/src/theme/types.ts +109 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defs": {
|
|
3
|
+
"bg": "#3f3f3f",
|
|
4
|
+
"bgAlt": "#4f4f4f",
|
|
5
|
+
"bgPanel": "#5f5f5f",
|
|
6
|
+
"fg": "#dcdccc",
|
|
7
|
+
"fgMuted": "#9f9f9f",
|
|
8
|
+
"red": "#cc9393",
|
|
9
|
+
"redBright": "#dca3a3",
|
|
10
|
+
"green": "#7f9f7f",
|
|
11
|
+
"greenBright": "#8fb28f",
|
|
12
|
+
"yellow": "#f0dfaf",
|
|
13
|
+
"yellowDim": "#e0cf9f",
|
|
14
|
+
"blue": "#8cd0d3",
|
|
15
|
+
"blueDim": "#7cb8bb",
|
|
16
|
+
"magenta": "#dc8cc3",
|
|
17
|
+
"cyan": "#93e0e3",
|
|
18
|
+
"orange": "#dfaf8f"
|
|
19
|
+
},
|
|
20
|
+
"theme": {
|
|
21
|
+
"primary": {
|
|
22
|
+
"dark": "blue",
|
|
23
|
+
"light": "#5f7f8f"
|
|
24
|
+
},
|
|
25
|
+
"secondary": {
|
|
26
|
+
"dark": "magenta",
|
|
27
|
+
"light": "#8f5f8f"
|
|
28
|
+
},
|
|
29
|
+
"accent": {
|
|
30
|
+
"dark": "cyan",
|
|
31
|
+
"light": "#5f8f8f"
|
|
32
|
+
},
|
|
33
|
+
"error": {
|
|
34
|
+
"dark": "red",
|
|
35
|
+
"light": "#8f5f5f"
|
|
36
|
+
},
|
|
37
|
+
"warning": {
|
|
38
|
+
"dark": "yellow",
|
|
39
|
+
"light": "#8f8f5f"
|
|
40
|
+
},
|
|
41
|
+
"success": {
|
|
42
|
+
"dark": "green",
|
|
43
|
+
"light": "#5f8f5f"
|
|
44
|
+
},
|
|
45
|
+
"info": {
|
|
46
|
+
"dark": "orange",
|
|
47
|
+
"light": "#8f7f5f"
|
|
48
|
+
},
|
|
49
|
+
"text": {
|
|
50
|
+
"dark": "fg",
|
|
51
|
+
"light": "#3f3f3f"
|
|
52
|
+
},
|
|
53
|
+
"textMuted": {
|
|
54
|
+
"dark": "fgMuted",
|
|
55
|
+
"light": "#6f6f6f"
|
|
56
|
+
},
|
|
57
|
+
"background": {
|
|
58
|
+
"dark": "bg",
|
|
59
|
+
"light": "#ffffef"
|
|
60
|
+
},
|
|
61
|
+
"backgroundPanel": {
|
|
62
|
+
"dark": "bgAlt",
|
|
63
|
+
"light": "#f5f5e5"
|
|
64
|
+
},
|
|
65
|
+
"backgroundElement": {
|
|
66
|
+
"dark": "bgPanel",
|
|
67
|
+
"light": "#ebebdb"
|
|
68
|
+
},
|
|
69
|
+
"border": {
|
|
70
|
+
"dark": "#5f5f5f",
|
|
71
|
+
"light": "#d0d0c0"
|
|
72
|
+
},
|
|
73
|
+
"borderActive": {
|
|
74
|
+
"dark": "blue",
|
|
75
|
+
"light": "#5f7f8f"
|
|
76
|
+
},
|
|
77
|
+
"borderSubtle": {
|
|
78
|
+
"dark": "#4f4f4f",
|
|
79
|
+
"light": "#e0e0d0"
|
|
80
|
+
},
|
|
81
|
+
"markdownText": {
|
|
82
|
+
"dark": "fg",
|
|
83
|
+
"light": "#3f3f3f"
|
|
84
|
+
},
|
|
85
|
+
"markdownHeading": {
|
|
86
|
+
"dark": "yellow",
|
|
87
|
+
"light": "#8f8f5f"
|
|
88
|
+
},
|
|
89
|
+
"markdownLink": {
|
|
90
|
+
"dark": "blue",
|
|
91
|
+
"light": "#5f7f8f"
|
|
92
|
+
},
|
|
93
|
+
"markdownLinkText": {
|
|
94
|
+
"dark": "cyan",
|
|
95
|
+
"light": "#5f8f8f"
|
|
96
|
+
},
|
|
97
|
+
"markdownCode": {
|
|
98
|
+
"dark": "green",
|
|
99
|
+
"light": "#5f8f5f"
|
|
100
|
+
},
|
|
101
|
+
"markdownBlockQuote": {
|
|
102
|
+
"dark": "fgMuted",
|
|
103
|
+
"light": "#6f6f6f"
|
|
104
|
+
},
|
|
105
|
+
"markdownEmph": {
|
|
106
|
+
"dark": "yellowDim",
|
|
107
|
+
"light": "#8f8f5f"
|
|
108
|
+
},
|
|
109
|
+
"markdownStrong": {
|
|
110
|
+
"dark": "orange",
|
|
111
|
+
"light": "#8f7f5f"
|
|
112
|
+
},
|
|
113
|
+
"markdownHorizontalRule": {
|
|
114
|
+
"dark": "fgMuted",
|
|
115
|
+
"light": "#6f6f6f"
|
|
116
|
+
},
|
|
117
|
+
"markdownListItem": {
|
|
118
|
+
"dark": "blue",
|
|
119
|
+
"light": "#5f7f8f"
|
|
120
|
+
},
|
|
121
|
+
"markdownListEnumeration": {
|
|
122
|
+
"dark": "cyan",
|
|
123
|
+
"light": "#5f8f8f"
|
|
124
|
+
},
|
|
125
|
+
"markdownImage": {
|
|
126
|
+
"dark": "blue",
|
|
127
|
+
"light": "#5f7f8f"
|
|
128
|
+
},
|
|
129
|
+
"markdownImageText": {
|
|
130
|
+
"dark": "cyan",
|
|
131
|
+
"light": "#5f8f8f"
|
|
132
|
+
},
|
|
133
|
+
"markdownCodeBlock": {
|
|
134
|
+
"dark": "fg",
|
|
135
|
+
"light": "#3f3f3f"
|
|
136
|
+
},
|
|
137
|
+
"syntaxComment": {
|
|
138
|
+
"dark": "#7f9f7f",
|
|
139
|
+
"light": "#5f7f5f"
|
|
140
|
+
},
|
|
141
|
+
"syntaxKeyword": {
|
|
142
|
+
"dark": "yellow",
|
|
143
|
+
"light": "#8f8f5f"
|
|
144
|
+
},
|
|
145
|
+
"syntaxFunction": {
|
|
146
|
+
"dark": "blue",
|
|
147
|
+
"light": "#5f7f8f"
|
|
148
|
+
},
|
|
149
|
+
"syntaxVariable": {
|
|
150
|
+
"dark": "fg",
|
|
151
|
+
"light": "#3f3f3f"
|
|
152
|
+
},
|
|
153
|
+
"syntaxString": {
|
|
154
|
+
"dark": "red",
|
|
155
|
+
"light": "#8f5f5f"
|
|
156
|
+
},
|
|
157
|
+
"syntaxNumber": {
|
|
158
|
+
"dark": "greenBright",
|
|
159
|
+
"light": "#5f8f5f"
|
|
160
|
+
},
|
|
161
|
+
"syntaxType": {
|
|
162
|
+
"dark": "cyan",
|
|
163
|
+
"light": "#5f8f8f"
|
|
164
|
+
},
|
|
165
|
+
"syntaxOperator": {
|
|
166
|
+
"dark": "yellow",
|
|
167
|
+
"light": "#8f8f5f"
|
|
168
|
+
},
|
|
169
|
+
"syntaxPunctuation": {
|
|
170
|
+
"dark": "fg",
|
|
171
|
+
"light": "#3f3f3f"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"name": "Zenburn",
|
|
175
|
+
"$schema": "../../../schema/house-theme.schema.json"
|
|
176
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { StyleDefinitionInput } from "@opentui/core"
|
|
2
|
+
|
|
3
|
+
export type HexColor = `#${string}`
|
|
4
|
+
export type RefName = string
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A token's value. Either a literal hex (`"#abcdef"`), a reference to an
|
|
8
|
+
* entry in the theme's `defs` block (`"nord8"`), or a `{dark, light}`
|
|
9
|
+
* variant where each side is itself a hex or a defs ref.
|
|
10
|
+
*/
|
|
11
|
+
export type ColorValue = HexColor | RefName | { readonly dark: string; readonly light: string }
|
|
12
|
+
|
|
13
|
+
/** Light or dark mode selector. Each theme JSON pairs both. */
|
|
14
|
+
export type Tone = "dark" | "light"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The complete house token surface. Adapted from opencode's TUI theme
|
|
18
|
+
* (see reference/opencode/.../tui/context/theme/) by dropping the `diff*`
|
|
19
|
+
* cluster, `backgroundMenu`, and `thinkingOpacity` (none of which are
|
|
20
|
+
* reachable in a markdown reader).
|
|
21
|
+
*/
|
|
22
|
+
export interface ThemeTokens {
|
|
23
|
+
// UI semantics
|
|
24
|
+
readonly primary: ColorValue
|
|
25
|
+
readonly secondary: ColorValue
|
|
26
|
+
readonly accent: ColorValue
|
|
27
|
+
readonly error: ColorValue
|
|
28
|
+
readonly warning: ColorValue
|
|
29
|
+
readonly success: ColorValue
|
|
30
|
+
readonly info: ColorValue
|
|
31
|
+
readonly text: ColorValue
|
|
32
|
+
readonly textMuted: ColorValue
|
|
33
|
+
readonly selectedListItemText?: ColorValue
|
|
34
|
+
readonly background: ColorValue
|
|
35
|
+
readonly backgroundPanel: ColorValue
|
|
36
|
+
readonly backgroundElement: ColorValue
|
|
37
|
+
readonly border: ColorValue
|
|
38
|
+
readonly borderActive: ColorValue
|
|
39
|
+
readonly borderSubtle: ColorValue
|
|
40
|
+
// Markdown rendering
|
|
41
|
+
readonly markdownText: ColorValue
|
|
42
|
+
readonly markdownHeading: ColorValue
|
|
43
|
+
readonly markdownLink: ColorValue
|
|
44
|
+
readonly markdownLinkText: ColorValue
|
|
45
|
+
readonly markdownCode: ColorValue
|
|
46
|
+
readonly markdownBlockQuote: ColorValue
|
|
47
|
+
readonly markdownEmph: ColorValue
|
|
48
|
+
readonly markdownStrong: ColorValue
|
|
49
|
+
readonly markdownHorizontalRule: ColorValue
|
|
50
|
+
readonly markdownListItem: ColorValue
|
|
51
|
+
readonly markdownListEnumeration: ColorValue
|
|
52
|
+
readonly markdownImage: ColorValue
|
|
53
|
+
readonly markdownImageText: ColorValue
|
|
54
|
+
readonly markdownCodeBlock: ColorValue
|
|
55
|
+
// Fenced-code syntax
|
|
56
|
+
readonly syntaxComment: ColorValue
|
|
57
|
+
readonly syntaxKeyword: ColorValue
|
|
58
|
+
readonly syntaxFunction: ColorValue
|
|
59
|
+
readonly syntaxVariable: ColorValue
|
|
60
|
+
readonly syntaxString: ColorValue
|
|
61
|
+
readonly syntaxNumber: ColorValue
|
|
62
|
+
readonly syntaxType: ColorValue
|
|
63
|
+
readonly syntaxOperator: ColorValue
|
|
64
|
+
readonly syntaxPunctuation: ColorValue
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Raw on-disk shape for a theme JSON file. */
|
|
68
|
+
export interface ThemeJson {
|
|
69
|
+
readonly $schema?: string
|
|
70
|
+
readonly name?: string
|
|
71
|
+
readonly defs?: Record<string, string>
|
|
72
|
+
readonly theme: Partial<ThemeTokens>
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Token names that consumers may reference. */
|
|
76
|
+
export type TokenName = keyof ThemeTokens
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Flat record after `resolveTheme`: every token has a concrete `#rrggbb`
|
|
80
|
+
* value with the requested tone applied and defs refs resolved.
|
|
81
|
+
*/
|
|
82
|
+
export type ResolvedTheme = Readonly<Record<TokenName, HexColor>>
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The flat color object consumed by Browser/HelpOverlay/index. Keeps the
|
|
86
|
+
* existing names (`background`, `surface`, `text`, `syntax`, …) so the
|
|
87
|
+
* UI files don't all have to change. Values come from
|
|
88
|
+
* `colors.ts`'s adapter, which maps `ResolvedTheme` → this shape.
|
|
89
|
+
*/
|
|
90
|
+
export interface ColorPalette {
|
|
91
|
+
readonly background: string
|
|
92
|
+
readonly surface: string
|
|
93
|
+
readonly text: string
|
|
94
|
+
readonly textStrong: string
|
|
95
|
+
readonly textMuted: string
|
|
96
|
+
readonly border: string
|
|
97
|
+
readonly borderActive: string
|
|
98
|
+
readonly selectedBg: string
|
|
99
|
+
readonly selectedBgInactive: string
|
|
100
|
+
readonly error: string
|
|
101
|
+
readonly syntax: Record<string, StyleDefinitionInput>
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Registry entry for a theme; what the loader returns. */
|
|
105
|
+
export interface ThemeDefinition {
|
|
106
|
+
readonly id: string
|
|
107
|
+
readonly name: string
|
|
108
|
+
readonly source: ThemeJson
|
|
109
|
+
}
|