Skip to content

Commit affc260

Browse files
committedAug 25, 2023
feat(solarized): add package exports field.
1 parent 8bfc8a5 commit affc260

File tree

7 files changed

+277
-238
lines changed

7 files changed

+277
-238
lines changed
 

‎themes/solarized/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ npm install @uiw/codemirror-theme-solarized --save
2424

2525
```jsx
2626
import { solarizedLight, solarizedLightInit, solarizedDark, solarizedDarkInit } from '@uiw/codemirror-theme-solarized';
27+
// Or
28+
import { solarizedDark, solarizedDarkInit } from '@uiw/codemirror-theme-solarized/dark';
29+
import { solarizedLight, solarizedLightInit } from '@uiw/codemirror-theme-solarized/light';
2730

2831
<CodeMirror theme={solarizedLight} />
2932
<CodeMirror

‎themes/solarized/dark.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module '@uiw/codemirror-theme-solarized/dark' {
2+
import { CreateThemeOptions } from '@uiw/codemirror-themes';
3+
export const defaultSettingsSolarizedDark: CreateThemeOptions['settings'];
4+
export const solarizedDarkInit: (options?: Partial<CreateThemeOptions>) => import('@codemirror/state').Extension;
5+
export const solarizedDark: import('@codemirror/state').Extension;
6+
}

‎themes/solarized/light.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module '@uiw/codemirror-theme-solarized/light' {
2+
import { CreateThemeOptions } from '@uiw/codemirror-themes';
3+
export const defaultSettingsSolarizedLight: CreateThemeOptions['settings'];
4+
export const solarizedLightInit: (options?: Partial<CreateThemeOptions>) => import('@codemirror/state').Extension;
5+
export const solarizedLight: import('@codemirror/state').Extension;
6+
}

‎themes/solarized/package.json

+20
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@
77
"license": "MIT",
88
"main": "./cjs/index.js",
99
"module": "./esm/index.js",
10+
"exports": {
11+
"./README.md": "./README.md",
12+
".": {
13+
"import": "./esm/index.js",
14+
"types": "./cjs/index.d.ts",
15+
"require": "./cjs/index.js"
16+
},
17+
"./light": {
18+
"import": "./esm/light.js",
19+
"types": "./cjs/light.d.ts",
20+
"require": "./cjs/light.js"
21+
},
22+
"./dark": {
23+
"import": "./esm/dark.js",
24+
"types": "./cjs/dark.d.ts",
25+
"require": "./cjs/dark.js"
26+
}
27+
},
1028
"scripts": {
1129
"watch": "tsbb watch src/*.ts --use-babel",
1230
"build": "tsbb build src/*.ts --use-babel"
@@ -16,6 +34,8 @@
1634
"url": "https://github.com/uiwjs/react-codemirror.git"
1735
},
1836
"files": [
37+
"dark.d.ts",
38+
"light.d.ts",
1939
"src",
2040
"esm",
2141
"cjs"

‎themes/solarized/src/dark.ts

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { tags as t } from '@lezer/highlight';
2+
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes';
3+
4+
export const defaultSettingsSolarizedDark: CreateThemeOptions['settings'] = {
5+
background: '#002b36',
6+
foreground: '#93a1a1',
7+
caret: '#839496',
8+
selection: '#173541',
9+
selectionMatch: '#aafe661a',
10+
gutterBackground: '#00252f',
11+
gutterForeground: '#839496',
12+
lineHighlight: '#173541',
13+
};
14+
15+
export const solarizedDarkInit = (options?: Partial<CreateThemeOptions>) => {
16+
const { theme = 'dark', settings = {}, styles = [] } = options || {};
17+
return createTheme({
18+
theme: theme,
19+
settings: {
20+
...defaultSettingsSolarizedDark,
21+
...settings,
22+
},
23+
styles: [
24+
{ tag: t.keyword, color: '#859900' },
25+
{
26+
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
27+
color: '#2aa198',
28+
},
29+
{ tag: [t.variableName], color: '#93a1a1' },
30+
{ tag: [t.function(t.variableName)], color: '#268bd2' },
31+
{ tag: [t.labelName], color: '#d33682' },
32+
{
33+
tag: [t.color, t.constant(t.name), t.standard(t.name)],
34+
color: '#b58900',
35+
},
36+
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' },
37+
{ tag: [t.brace], color: '#d33682' },
38+
{
39+
tag: [t.annotation],
40+
color: '#d30102',
41+
},
42+
{
43+
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
44+
color: '#d33682',
45+
},
46+
{
47+
tag: [t.typeName, t.className],
48+
color: '#cb4b16',
49+
},
50+
{
51+
tag: [t.operator, t.operatorKeyword],
52+
color: '#6c71c4',
53+
},
54+
{
55+
tag: [t.tagName],
56+
color: '#268bd2',
57+
},
58+
{
59+
tag: [t.squareBracket],
60+
color: '#dc322f',
61+
},
62+
{
63+
tag: [t.angleBracket],
64+
color: '#586e75',
65+
},
66+
{
67+
tag: [t.attributeName],
68+
color: '#93a1a1',
69+
},
70+
{
71+
tag: [t.regexp],
72+
color: '#d30102',
73+
},
74+
{
75+
tag: [t.quote],
76+
color: '#859900',
77+
},
78+
{ tag: [t.string], color: '#b58900' },
79+
{
80+
tag: t.link,
81+
color: '#2aa198',
82+
textDecoration: 'underline',
83+
textUnderlinePosition: 'under',
84+
},
85+
{
86+
tag: [t.url, t.escape, t.special(t.string)],
87+
color: '#b58900',
88+
},
89+
{ tag: [t.meta], color: '#dc322f' },
90+
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' },
91+
{ tag: t.strong, fontWeight: 'bold', color: '#eee8d5' },
92+
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' },
93+
{ tag: t.strikethrough, textDecoration: 'line-through' },
94+
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' },
95+
{ tag: t.heading1, fontWeight: 'bold', color: '#fdf6e3' },
96+
{
97+
tag: [t.heading2, t.heading3, t.heading4],
98+
fontWeight: 'bold',
99+
color: '#eee8d5',
100+
},
101+
{
102+
tag: [t.heading5, t.heading6],
103+
color: '#eee8d5',
104+
},
105+
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' },
106+
{
107+
tag: [t.processingInstruction, t.inserted, t.contentSeparator],
108+
color: '#dc322f',
109+
},
110+
{
111+
tag: [t.contentSeparator],
112+
color: '#b58900',
113+
},
114+
{ tag: t.invalid, color: '#586e75', borderBottom: `1px dotted #dc322f` },
115+
...styles,
116+
],
117+
});
118+
};
119+
120+
export const solarizedDark = solarizedDarkInit();

‎themes/solarized/src/index.ts

+2-238
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,2 @@
1-
import { tags as t } from '@lezer/highlight';
2-
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes';
3-
4-
export const defaultSettingsSolarizedLight: CreateThemeOptions['settings'] = {
5-
background: '#fdf6e3',
6-
foreground: '#657b83',
7-
caret: '#586e75',
8-
selection: '#dfd9c8',
9-
selectionMatch: '#dfd9c8',
10-
gutterBackground: '#00000010',
11-
gutterForeground: '#657b83',
12-
lineHighlight: '#dfd9c8',
13-
};
14-
15-
export const solarizedLightInit = (options?: Partial<CreateThemeOptions>) => {
16-
const { theme = 'light', settings = {}, styles = [] } = options || {};
17-
return createTheme({
18-
theme: theme,
19-
settings: {
20-
...defaultSettingsSolarizedLight,
21-
...settings,
22-
},
23-
styles: [
24-
{ tag: t.keyword, color: '#859900' },
25-
{
26-
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
27-
color: '#2aa198',
28-
},
29-
{ tag: [t.variableName], color: '#268bd2' },
30-
{ tag: [t.function(t.variableName)], color: '#268bd2' },
31-
{ tag: [t.labelName], color: '#d33682' },
32-
{
33-
tag: [t.color, t.constant(t.name), t.standard(t.name)],
34-
color: '#b58900',
35-
},
36-
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' },
37-
{ tag: [t.brace], color: '#d33682' },
38-
{
39-
tag: [t.annotation],
40-
color: '#d30102',
41-
},
42-
{
43-
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
44-
color: '#d33682',
45-
},
46-
{
47-
tag: [t.typeName, t.className],
48-
color: '#cb4b16',
49-
},
50-
{
51-
tag: [t.operator, t.operatorKeyword],
52-
color: '#6c71c4',
53-
},
54-
{
55-
tag: [t.tagName],
56-
color: '#268bd2',
57-
},
58-
{
59-
tag: [t.squareBracket],
60-
color: '#dc322f',
61-
},
62-
{
63-
tag: [t.angleBracket],
64-
color: '#073642',
65-
},
66-
{
67-
tag: [t.attributeName],
68-
color: '#93a1a1',
69-
},
70-
{
71-
tag: [t.regexp],
72-
color: '#d30102',
73-
},
74-
{
75-
tag: [t.quote],
76-
color: '#859900',
77-
},
78-
{ tag: [t.string], color: '#b58900' },
79-
{
80-
tag: t.link,
81-
color: '#2aa198',
82-
textDecoration: 'underline',
83-
textUnderlinePosition: 'under',
84-
},
85-
{
86-
tag: [t.url, t.escape, t.special(t.string)],
87-
color: '#b58900',
88-
},
89-
{ tag: [t.meta], color: '#dc322f' },
90-
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' },
91-
{ tag: t.strong, fontWeight: 'bold', color: '#586e75' },
92-
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' },
93-
{ tag: t.strikethrough, textDecoration: 'line-through' },
94-
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' },
95-
{ tag: t.heading1, fontWeight: 'bold', color: '#002b36' },
96-
{
97-
tag: [t.heading2, t.heading3, t.heading4],
98-
fontWeight: 'bold',
99-
color: '#002b36',
100-
},
101-
{
102-
tag: [t.heading5, t.heading6],
103-
color: '#002b36',
104-
},
105-
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' },
106-
{
107-
tag: [t.processingInstruction, t.inserted, t.contentSeparator],
108-
color: '#dc322f',
109-
},
110-
{
111-
tag: [t.contentSeparator],
112-
color: '#b58900',
113-
},
114-
{ tag: t.invalid, color: '#073642', borderBottom: `1px dotted #dc322f` },
115-
...styles,
116-
],
117-
});
118-
};
119-
120-
export const solarizedLight = solarizedLightInit();
121-
122-
export const defaultSettingsSolarizedDark: CreateThemeOptions['settings'] = {
123-
background: '#002b36',
124-
foreground: '#93a1a1',
125-
caret: '#839496',
126-
selection: '#173541',
127-
selectionMatch: '#aafe661a',
128-
gutterBackground: '#00252f',
129-
gutterForeground: '#839496',
130-
lineHighlight: '#173541',
131-
};
132-
133-
export const solarizedDarkInit = (options?: Partial<CreateThemeOptions>) => {
134-
const { theme = 'dark', settings = {}, styles = [] } = options || {};
135-
return createTheme({
136-
theme: theme,
137-
settings: {
138-
...defaultSettingsSolarizedDark,
139-
...settings,
140-
},
141-
styles: [
142-
{ tag: t.keyword, color: '#859900' },
143-
{
144-
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
145-
color: '#2aa198',
146-
},
147-
{ tag: [t.variableName], color: '#93a1a1' },
148-
{ tag: [t.function(t.variableName)], color: '#268bd2' },
149-
{ tag: [t.labelName], color: '#d33682' },
150-
{
151-
tag: [t.color, t.constant(t.name), t.standard(t.name)],
152-
color: '#b58900',
153-
},
154-
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' },
155-
{ tag: [t.brace], color: '#d33682' },
156-
{
157-
tag: [t.annotation],
158-
color: '#d30102',
159-
},
160-
{
161-
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
162-
color: '#d33682',
163-
},
164-
{
165-
tag: [t.typeName, t.className],
166-
color: '#cb4b16',
167-
},
168-
{
169-
tag: [t.operator, t.operatorKeyword],
170-
color: '#6c71c4',
171-
},
172-
{
173-
tag: [t.tagName],
174-
color: '#268bd2',
175-
},
176-
{
177-
tag: [t.squareBracket],
178-
color: '#dc322f',
179-
},
180-
{
181-
tag: [t.angleBracket],
182-
color: '#586e75',
183-
},
184-
{
185-
tag: [t.attributeName],
186-
color: '#93a1a1',
187-
},
188-
{
189-
tag: [t.regexp],
190-
color: '#d30102',
191-
},
192-
{
193-
tag: [t.quote],
194-
color: '#859900',
195-
},
196-
{ tag: [t.string], color: '#b58900' },
197-
{
198-
tag: t.link,
199-
color: '#2aa198',
200-
textDecoration: 'underline',
201-
textUnderlinePosition: 'under',
202-
},
203-
{
204-
tag: [t.url, t.escape, t.special(t.string)],
205-
color: '#b58900',
206-
},
207-
{ tag: [t.meta], color: '#dc322f' },
208-
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' },
209-
{ tag: t.strong, fontWeight: 'bold', color: '#eee8d5' },
210-
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' },
211-
{ tag: t.strikethrough, textDecoration: 'line-through' },
212-
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' },
213-
{ tag: t.heading1, fontWeight: 'bold', color: '#fdf6e3' },
214-
{
215-
tag: [t.heading2, t.heading3, t.heading4],
216-
fontWeight: 'bold',
217-
color: '#eee8d5',
218-
},
219-
{
220-
tag: [t.heading5, t.heading6],
221-
color: '#eee8d5',
222-
},
223-
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' },
224-
{
225-
tag: [t.processingInstruction, t.inserted, t.contentSeparator],
226-
color: '#dc322f',
227-
},
228-
{
229-
tag: [t.contentSeparator],
230-
color: '#b58900',
231-
},
232-
{ tag: t.invalid, color: '#586e75', borderBottom: `1px dotted #dc322f` },
233-
...styles,
234-
],
235-
});
236-
};
237-
238-
export const solarizedDark = solarizedDarkInit();
1+
export * from './dark';
2+
export * from './light';

‎themes/solarized/src/light.ts

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { tags as t } from '@lezer/highlight';
2+
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes';
3+
4+
export const defaultSettingsSolarizedLight: CreateThemeOptions['settings'] = {
5+
background: '#fdf6e3',
6+
foreground: '#657b83',
7+
caret: '#586e75',
8+
selection: '#dfd9c8',
9+
selectionMatch: '#dfd9c8',
10+
gutterBackground: '#00000010',
11+
gutterForeground: '#657b83',
12+
lineHighlight: '#dfd9c8',
13+
};
14+
15+
export const solarizedLightInit = (options?: Partial<CreateThemeOptions>) => {
16+
const { theme = 'light', settings = {}, styles = [] } = options || {};
17+
return createTheme({
18+
theme: theme,
19+
settings: {
20+
...defaultSettingsSolarizedLight,
21+
...settings,
22+
},
23+
styles: [
24+
{ tag: t.keyword, color: '#859900' },
25+
{
26+
tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName],
27+
color: '#2aa198',
28+
},
29+
{ tag: [t.variableName], color: '#268bd2' },
30+
{ tag: [t.function(t.variableName)], color: '#268bd2' },
31+
{ tag: [t.labelName], color: '#d33682' },
32+
{
33+
tag: [t.color, t.constant(t.name), t.standard(t.name)],
34+
color: '#b58900',
35+
},
36+
{ tag: [t.definition(t.name), t.separator], color: '#2aa198' },
37+
{ tag: [t.brace], color: '#d33682' },
38+
{
39+
tag: [t.annotation],
40+
color: '#d30102',
41+
},
42+
{
43+
tag: [t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace],
44+
color: '#d33682',
45+
},
46+
{
47+
tag: [t.typeName, t.className],
48+
color: '#cb4b16',
49+
},
50+
{
51+
tag: [t.operator, t.operatorKeyword],
52+
color: '#6c71c4',
53+
},
54+
{
55+
tag: [t.tagName],
56+
color: '#268bd2',
57+
},
58+
{
59+
tag: [t.squareBracket],
60+
color: '#dc322f',
61+
},
62+
{
63+
tag: [t.angleBracket],
64+
color: '#073642',
65+
},
66+
{
67+
tag: [t.attributeName],
68+
color: '#93a1a1',
69+
},
70+
{
71+
tag: [t.regexp],
72+
color: '#d30102',
73+
},
74+
{
75+
tag: [t.quote],
76+
color: '#859900',
77+
},
78+
{ tag: [t.string], color: '#b58900' },
79+
{
80+
tag: t.link,
81+
color: '#2aa198',
82+
textDecoration: 'underline',
83+
textUnderlinePosition: 'under',
84+
},
85+
{
86+
tag: [t.url, t.escape, t.special(t.string)],
87+
color: '#b58900',
88+
},
89+
{ tag: [t.meta], color: '#dc322f' },
90+
{ tag: [t.comment], color: '#586e75', fontStyle: 'italic' },
91+
{ tag: t.strong, fontWeight: 'bold', color: '#586e75' },
92+
{ tag: t.emphasis, fontStyle: 'italic', color: '#859900' },
93+
{ tag: t.strikethrough, textDecoration: 'line-through' },
94+
{ tag: t.heading, fontWeight: 'bold', color: '#b58900' },
95+
{ tag: t.heading1, fontWeight: 'bold', color: '#002b36' },
96+
{
97+
tag: [t.heading2, t.heading3, t.heading4],
98+
fontWeight: 'bold',
99+
color: '#002b36',
100+
},
101+
{
102+
tag: [t.heading5, t.heading6],
103+
color: '#002b36',
104+
},
105+
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: '#d33682' },
106+
{
107+
tag: [t.processingInstruction, t.inserted, t.contentSeparator],
108+
color: '#dc322f',
109+
},
110+
{
111+
tag: [t.contentSeparator],
112+
color: '#b58900',
113+
},
114+
{ tag: t.invalid, color: '#073642', borderBottom: `1px dotted #dc322f` },
115+
...styles,
116+
],
117+
});
118+
};
119+
120+
export const solarizedLight = solarizedLightInit();

0 commit comments

Comments
 (0)
Please sign in to comment.