@xh/hoist 79.0.0-SNAPSHOT.1765818732757 → 79.0.0-SNAPSHOT.1765824728801

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.
@@ -0,0 +1,23 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { HighlightStyle } from '@codemirror/language';
3
+ export declare const color: {
4
+ chalky: string;
5
+ coral: string;
6
+ cyan: string;
7
+ invalid: string;
8
+ ivory: string;
9
+ stone: string;
10
+ malibu: string;
11
+ sage: string;
12
+ whiskey: string;
13
+ violet: string;
14
+ darkBackground: string;
15
+ highlightBackground: string;
16
+ background: string;
17
+ tooltipBackground: string;
18
+ selection: string;
19
+ cursor: string;
20
+ };
21
+ export declare const oneDarkTheme: Extension;
22
+ export declare const oneDarkHighlightStyle: HighlightStyle;
23
+ export declare const oneDark: Extension;
@@ -36,7 +36,7 @@ import {
36
36
  ViewPlugin,
37
37
  ViewUpdate
38
38
  } from '@codemirror/view';
39
- import {githubLight, githubDark} from '@uiw/codemirror-theme-github';
39
+ import {oneDark} from './impl/one-dark';
40
40
  import {HoistInputModel, HoistInputProps, useHoistInputModel} from '@xh/hoist/cmp/input';
41
41
  import {box, div, filler, fragment, frame, hbox, label, span, vbox} from '@xh/hoist/cmp/layout';
42
42
  import {hoistCmp, HoistProps, LayoutProps, managed, PlainObject, XH} from '@xh/hoist/core';
@@ -478,8 +478,10 @@ class CodeInputModel extends HoistInputModel {
478
478
 
479
479
  return extensions.filter(it => !isEmpty(it));
480
480
  }
481
+
481
482
  private getThemeExtension() {
482
- return XH.darkTheme ? githubDark : githubLight;
483
+ const lightTheme = EditorView.theme({}, {dark: false});
484
+ return XH.darkTheme ? oneDark : lightTheme;
483
485
  }
484
486
 
485
487
  private async getLanguageExtensionAsync(lang: string): Promise<LanguageSupport> {
@@ -0,0 +1,163 @@
1
+ import {EditorView} from '@codemirror/view';
2
+ import {Extension} from '@codemirror/state';
3
+ import {HighlightStyle, syntaxHighlighting} from '@codemirror/language';
4
+ import {tags as t} from '@lezer/highlight';
5
+
6
+ // Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
7
+
8
+ const chalky = '#e5c07b',
9
+ coral = '#e06c75',
10
+ cyan = '#56b6c2',
11
+ invalid = '#ffffff',
12
+ ivory = '#abb2bf',
13
+ stone = '#7d8799', // Brightened compared to original to increase contrast
14
+ malibu = '#61afef',
15
+ sage = '#98c379',
16
+ whiskey = '#d19a66',
17
+ violet = '#c678dd',
18
+ darkBackground = '#21252b',
19
+ highlightBackground = '#2c313a',
20
+ background = '#282c34',
21
+ tooltipBackground = '#353a42',
22
+ selection = '#3E4451',
23
+ cursor = '#528bff';
24
+
25
+ /// The colors used in the theme, as CSS color strings.
26
+ export const color = {
27
+ chalky,
28
+ coral,
29
+ cyan,
30
+ invalid,
31
+ ivory,
32
+ stone,
33
+ malibu,
34
+ sage,
35
+ whiskey,
36
+ violet,
37
+ darkBackground,
38
+ highlightBackground,
39
+ background,
40
+ tooltipBackground,
41
+ selection,
42
+ cursor
43
+ };
44
+
45
+ /// The editor theme styles for One Dark.
46
+ export const oneDarkTheme = EditorView.theme(
47
+ {
48
+ '&': {
49
+ color: ivory,
50
+ backgroundColor: background
51
+ },
52
+
53
+ '.cm-content': {
54
+ caretColor: cursor
55
+ },
56
+
57
+ '.cm-cursor, .cm-dropCursor': {borderLeftColor: cursor},
58
+ '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection':
59
+ {backgroundColor: selection},
60
+
61
+ '.cm-panels': {backgroundColor: darkBackground, color: ivory},
62
+ '.cm-panels.cm-panels-top': {borderBottom: '2px solid black'},
63
+ '.cm-panels.cm-panels-bottom': {borderTop: '2px solid black'},
64
+
65
+ '.cm-searchMatch': {
66
+ backgroundColor: '#72a1ff59',
67
+ outline: '1px solid #457dff'
68
+ },
69
+ '.cm-searchMatch.cm-searchMatch-selected': {
70
+ backgroundColor: '#6199ff2f'
71
+ },
72
+
73
+ '.cm-activeLine': {backgroundColor: '#6699ff0b'},
74
+ '.cm-selectionMatch': {backgroundColor: '#aafe661a'},
75
+
76
+ '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
77
+ backgroundColor: '#bad0f847'
78
+ },
79
+
80
+ '.cm-gutters': {
81
+ backgroundColor: background,
82
+ color: stone,
83
+ border: 'none'
84
+ },
85
+
86
+ '.cm-activeLineGutter': {
87
+ backgroundColor: highlightBackground
88
+ },
89
+
90
+ '.cm-foldPlaceholder': {
91
+ backgroundColor: 'transparent',
92
+ border: 'none',
93
+ color: '#ddd'
94
+ },
95
+
96
+ '.cm-tooltip': {
97
+ border: 'none',
98
+ backgroundColor: tooltipBackground
99
+ },
100
+ '.cm-tooltip .cm-tooltip-arrow:before': {
101
+ borderTopColor: 'transparent',
102
+ borderBottomColor: 'transparent'
103
+ },
104
+ '.cm-tooltip .cm-tooltip-arrow:after': {
105
+ borderTopColor: tooltipBackground,
106
+ borderBottomColor: tooltipBackground
107
+ },
108
+ '.cm-tooltip-autocomplete': {
109
+ '& > ul > li[aria-selected]': {
110
+ backgroundColor: highlightBackground,
111
+ color: ivory
112
+ }
113
+ }
114
+ },
115
+ {dark: true}
116
+ );
117
+
118
+ /// The highlighting style for code in the One Dark theme.
119
+ export const oneDarkHighlightStyle = HighlightStyle.define([
120
+ {tag: t.keyword, color: violet},
121
+ {tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], color: coral},
122
+ {tag: [t.function(t.variableName), t.labelName], color: malibu},
123
+ {tag: [t.color, t.constant(t.name), t.standard(t.name)], color: whiskey},
124
+ {tag: [t.definition(t.name), t.separator], color: ivory},
125
+ {
126
+ tag: [
127
+ t.typeName,
128
+ t.className,
129
+ t.number,
130
+ t.changed,
131
+ t.annotation,
132
+ t.modifier,
133
+ t.self,
134
+ t.namespace
135
+ ],
136
+ color: chalky
137
+ },
138
+ {
139
+ tag: [
140
+ t.operator,
141
+ t.operatorKeyword,
142
+ t.url,
143
+ t.escape,
144
+ t.regexp,
145
+ t.link,
146
+ t.special(t.string)
147
+ ],
148
+ color: cyan
149
+ },
150
+ {tag: [t.meta, t.comment], color: stone},
151
+ {tag: t.strong, fontWeight: 'bold'},
152
+ {tag: t.emphasis, fontStyle: 'italic'},
153
+ {tag: t.strikethrough, textDecoration: 'line-through'},
154
+ {tag: t.link, color: stone, textDecoration: 'underline'},
155
+ {tag: t.heading, fontWeight: 'bold', color: coral},
156
+ {tag: [t.atom, t.bool, t.special(t.variableName)], color: whiskey},
157
+ {tag: [t.processingInstruction, t.string, t.inserted], color: sage},
158
+ {tag: t.invalid, color: invalid}
159
+ ]);
160
+
161
+ /// Extension to enable the One Dark theme (both the editor theme and
162
+ /// the highlight style).
163
+ export const oneDark: Extension = [oneDarkTheme, syntaxHighlighting(oneDarkHighlightStyle)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "79.0.0-SNAPSHOT.1765818732757",
3
+ "version": "79.0.0-SNAPSHOT.1765824728801",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",
@@ -49,7 +49,6 @@
49
49
  "@onsenui/fastclick": "~1.1.1",
50
50
  "@popperjs/core": "~2.11.0",
51
51
  "@seznam/compose-react-refs": "~1.0.5",
52
- "@uiw/codemirror-theme-github": "^4.25.4",
53
52
  "ajv": "~8.17.1",
54
53
  "classnames": "~2.5.1",
55
54
  "clipboard-copy": "~4.0.1",