@tiagojct/subsub 0.20.0 → 0.22.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 +21 -0
- package/README.md +8 -1
- package/dist/chrome.js +171 -0
- package/dist/cli.js +10 -0
- package/dist/config.js +2 -0
- package/dist/dialogs.js +81 -0
- package/dist/files.js +66 -0
- package/dist/look.js +36 -17
- package/dist/rpc.js +185 -0
- package/dist/screens.js +425 -0
- package/dist/skin.js +37 -0
- package/dist/subsub.js +198 -31
- package/dist/tui-view.js +228 -0
- package/dist/tui.js +651 -0
- package/dist/web.js +16 -216
- package/dist/words.js +26 -0
- package/package.json +1 -1
- package/scripts/make-themes.mjs +112 -0
- package/scripts/plate.json +35 -0
- package/src/chrome.ts +208 -0
- package/src/cli.ts +9 -0
- package/src/config.ts +4 -0
- package/src/dialogs.ts +107 -0
- package/src/files.ts +66 -0
- package/src/look.ts +45 -18
- package/src/rpc.ts +198 -0
- package/src/screens.ts +530 -0
- package/src/skin.ts +65 -0
- package/src/subsub.ts +214 -36
- package/src/tui-view.ts +270 -0
- package/src/tui.ts +710 -0
- package/src/web.ts +14 -209
- package/src/words.ts +40 -0
- package/themes/subsub-glauca-dark-256.json +80 -0
- package/themes/subsub-glauca-dark.json +73 -77
- package/themes/subsub-glauca-light-256.json +80 -0
- package/themes/subsub-glauca-light.json +73 -77
- package/themes/subsub-try-works-dark-256.json +80 -0
- package/themes/subsub-try-works-dark.json +73 -77
- package/themes/subsub-try-works-light-256.json +80 -0
- package/themes/subsub-try-works-light.json +73 -77
- package/scripts/make-themes.py +0 -116
package/scripts/make-themes.py
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Write pi themes for Sub-Sub from Gam design-system sources.
|
|
3
|
-
|
|
4
|
-
python3 scripts/make-themes.py NAME SOURCE.json VSCODE-DARK.json VSCODE-LIGHT.json
|
|
5
|
-
|
|
6
|
-
SOURCE.json is the design system's single source (modes, palette). The VS Code
|
|
7
|
-
themes that Gam generates supply the syntax colours per mode. Output:
|
|
8
|
-
themes/subsub-NAME-dark.json and themes/subsub-NAME-light.json.
|
|
9
|
-
|
|
10
|
-
The accent (the design system's one mark) is kept for the few places that need a
|
|
11
|
-
mark: the banner, the active border, bash mode and the highest thinking level.
|
|
12
|
-
Headings, bullets and borders use the cool tones.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
import json
|
|
16
|
-
import sys
|
|
17
|
-
from pathlib import Path
|
|
18
|
-
|
|
19
|
-
OUT = Path(__file__).resolve().parent.parent / "themes"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def hexrgb(h):
|
|
23
|
-
h = h.lstrip("#")
|
|
24
|
-
return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4))
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def mix(a, b, t):
|
|
28
|
-
"""t = 0 gives a, t = 1 gives b."""
|
|
29
|
-
ra, rb = hexrgb(a), hexrgb(b)
|
|
30
|
-
return "#" + "".join(f"{round(x + (y - x) * t):02x}" for x, y in zip(ra, rb))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def token(vs, scope):
|
|
34
|
-
for tc in vs.get("tokenColors", []):
|
|
35
|
-
sc = tc.get("scope")
|
|
36
|
-
scopes = [sc] if isinstance(sc, str) else sc
|
|
37
|
-
if scope in scopes:
|
|
38
|
-
return tc["settings"]["foreground"].lower()
|
|
39
|
-
raise KeyError(scope)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def tone(m, part):
|
|
43
|
-
"""try-works calls the cool tones sea-*, Glauca tint-*."""
|
|
44
|
-
for prefix in ("sea", "tint"):
|
|
45
|
-
k = f"{prefix}{'-' + part if part else ''}"
|
|
46
|
-
if k in m:
|
|
47
|
-
return m[k].lower()
|
|
48
|
-
raise KeyError(part)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def theme(name, scheme, m, vs):
|
|
52
|
-
dark = scheme == "dark"
|
|
53
|
-
c = vs["colors"]
|
|
54
|
-
v = {
|
|
55
|
-
"bg": m["bg"], "surface": m["surface"], "raised": m["surface-raised"],
|
|
56
|
-
"text": m["text"], "muted": m["text-muted"], "line": m["border"],
|
|
57
|
-
"mark": m["accent"], "markBright": m["accent-bright"], "markDeep": m["accent-deep"],
|
|
58
|
-
"toneDeep": tone(m, "deep"), "tone": tone(m, ""), "toneBright": tone(m, "bright"), "tonePale": tone(m, "pale"),
|
|
59
|
-
"green": token(vs, "markup.inserted"), "red": c["terminal.ansiRed"].lower(),
|
|
60
|
-
"yellow": c["terminal.ansiYellow"].lower(), "violet": token(vs, "constant.numeric"),
|
|
61
|
-
"link": token(vs, "entity.name.function"),
|
|
62
|
-
}
|
|
63
|
-
v = {k: val.lower() for k, val in v.items()}
|
|
64
|
-
v["dim"] = mix(v["muted"], v["bg"], 0.35)
|
|
65
|
-
v["select"] = c["list.activeSelectionBackground"].lower()
|
|
66
|
-
v["okBg"] = mix(v["surface"], v["green"], 0.14)
|
|
67
|
-
v["errBg"] = mix(v["surface"], v["red"], 0.16)
|
|
68
|
-
heading = "tonePale" if dark else "tone"
|
|
69
|
-
colors = {
|
|
70
|
-
"accent": "mark", "border": "toneBright", "borderAccent": "mark", "borderMuted": "line",
|
|
71
|
-
"success": "green", "error": "red", "warning": "yellow",
|
|
72
|
-
"muted": "muted", "dim": "dim", "text": "text", "thinkingText": "muted",
|
|
73
|
-
"selectedBg": "select", "scrollbarTrack": "line", "scrollbarThumb": "muted",
|
|
74
|
-
"searchMatchBg": "select", "searchMatchText": "text",
|
|
75
|
-
"userMessageBg": "raised", "userMessageText": "text",
|
|
76
|
-
"customMessageBg": "surface", "customMessageText": "text", "customMessageLabel": heading,
|
|
77
|
-
"toolPendingBg": "surface", "toolSuccessBg": "okBg", "toolErrorBg": "errBg",
|
|
78
|
-
"toolTitle": "text", "toolOutput": "muted",
|
|
79
|
-
"mdHeading": heading, "mdLink": "link", "mdLinkUrl": "dim", "mdCode": "green",
|
|
80
|
-
"mdCodeBlock": "text", "mdCodeBlockBorder": "line", "mdQuote": "muted", "mdQuoteBorder": "toneBright",
|
|
81
|
-
"mdHr": "line", "mdListBullet": "toneBright",
|
|
82
|
-
"toolDiffAdded": "green", "toolDiffRemoved": "red", "toolDiffContext": "muted",
|
|
83
|
-
"syntaxComment": token(vs, "comment"), "syntaxKeyword": token(vs, "keyword"),
|
|
84
|
-
"syntaxFunction": token(vs, "entity.name.function"), "syntaxVariable": token(vs, "variable"),
|
|
85
|
-
"syntaxString": token(vs, "string"), "syntaxNumber": token(vs, "constant.numeric"),
|
|
86
|
-
"syntaxType": token(vs, "entity.name.type"), "syntaxOperator": token(vs, "keyword.operator"),
|
|
87
|
-
"syntaxPunctuation": token(vs, "punctuation"),
|
|
88
|
-
"thinkingOff": "line", "thinkingMinimal": "dim", "thinkingLow": "toneBright", "thinkingMedium": heading,
|
|
89
|
-
"thinkingHigh": "violet", "thinkingXhigh": "markBright", "thinkingMax": "mark",
|
|
90
|
-
"bashMode": "mark",
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
94
|
-
"name": name,
|
|
95
|
-
"vars": v,
|
|
96
|
-
"colors": colors,
|
|
97
|
-
"export": {"pageBg": v["bg"], "cardBg": v["surface"], "infoBg": v["raised"]},
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def main():
|
|
102
|
-
name, source, vs_dark, vs_light = sys.argv[1:5]
|
|
103
|
-
src = json.loads(Path(source).read_text())
|
|
104
|
-
modes = src["modes"]
|
|
105
|
-
by_scheme = {m["scheme"]: m for m in modes.values()}
|
|
106
|
-
OUT.mkdir(exist_ok=True)
|
|
107
|
-
for scheme, vs_path in (("dark", vs_dark), ("light", vs_light)):
|
|
108
|
-
vs = json.loads(Path(vs_path).read_text())
|
|
109
|
-
tname = f"subsub-{name}-{scheme}"
|
|
110
|
-
t = theme(tname, scheme, by_scheme[scheme], vs)
|
|
111
|
-
(OUT / f"{tname}.json").write_text(json.dumps(t, indent="\t") + "\n")
|
|
112
|
-
print(OUT / f"{tname}.json", f"({by_scheme[scheme].get('label', scheme)})")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if __name__ == "__main__":
|
|
116
|
-
main()
|