1313 * inline and skip the TLA-gated import entirely.
1414 */
1515
16- import type { LoraQueryTheme } from "@loradb/lora-query" ;
16+ import type { LoraJsonTheme , LoraQueryTheme } from "@loradb/lora-query" ;
1717
1818import type { Tokens } from "./tokens" ;
1919import { hexA } from "./util" ;
2020
21+ /**
22+ * Derive a `LoraJsonTheme` from our token set. Mirrors
23+ * {@link deriveEditorTheme} but uses the JSON-specific token slots
24+ * (`key`, `string`, `number`, `bool`, `null`, `punct`).
25+ */
26+ export function deriveJsonEditorTheme ( tokens : Tokens ) : LoraJsonTheme {
27+ const identifier = tokens . syntax . identifier ;
28+ return {
29+ background : tokens . bg . editor ,
30+ foreground : tokens . fg . primary ,
31+ border : tokens . border . subtle ,
32+ muted : tokens . fg . muted ,
33+ accent : tokens . accent . primary ,
34+ activeLine : hexA ( tokens . fg . primary , 0.06 ) ,
35+ gutterBackground : tokens . bg . editor ,
36+ gutterForeground : tokens . fg . subtle ,
37+ cursor : tokens . fg . primary ,
38+ selectionBackground : hexA ( tokens . accent . primary , 0.28 ) ,
39+
40+ fontFamily : tokens . font . ui ,
41+ monoFontFamily : tokens . font . mono ,
42+ fontSize : "13px" ,
43+ popupFontSize : "12px" ,
44+
45+ key : identifier ,
46+ string : tokens . syntax . string ,
47+ number : tokens . syntax . number ,
48+ bool : tokens . syntax . keyword ,
49+ null : tokens . syntax . keyword ,
50+ // `punct` left to fall through to the shared `--lq-color-punct`
51+ // default (inherited text colour with 0.7 opacity).
52+
53+ popupBackground : tokens . bg . panel ,
54+ popupForeground : tokens . fg . primary ,
55+ popupBorder : tokens . border . subtle ,
56+ popupSelectedBackground : tokens . accent . primary ,
57+ popupSelectedForeground : tokens . fg . inverse ,
58+ popupShadow : `0 6px 16px ${ hexA ( "#000000" , 0.35 ) } ` ,
59+
60+ errorAccent : tokens . accent . danger ,
61+ warningAccent : tokens . accent . warning ,
62+ infoAccent : tokens . accent . info ,
63+
64+ scrollbarTrack : tokens . bg . editor ,
65+ scrollbarThumb : tokens . border . strong ,
66+ scrollbarThumbHover : tokens . fg . subtle ,
67+ scrollbarWidth : "auto" ,
68+ scrollbarSize : "10px" ,
69+ } ;
70+ }
71+
2172/** Derive a `LoraQueryTheme` from our token set. */
2273export function deriveEditorTheme ( tokens : Tokens ) : LoraQueryTheme {
2374 const keyword = tokens . syntax . keyword ;
@@ -42,10 +93,10 @@ export function deriveEditorTheme(tokens: Tokens): LoraQueryTheme {
4293 popupFontSize : "12px" ,
4394
4495 keyword,
45- variable : identifier ,
46- parameter : identifier ,
47- label : type ,
48- relType : type ,
96+ variable : tokens . category . variable ,
97+ parameter : tokens . category . parameter ,
98+ label : tokens . category . label ,
99+ relType : tokens . category . relType ,
49100 property : identifier ,
50101 functionName : type ,
51102 namespace : type ,
0 commit comments