@fsegurai/codemirror-theme-palenight 6.2.0-beta.4 → 6.2.0-beta.5

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/dist/index.cjs CHANGED
@@ -3,7 +3,107 @@
3
3
  var view = require('@codemirror/view');
4
4
  var language = require('@codemirror/language');
5
5
  var highlight = require('@lezer/highlight');
6
- var codemirrorThemeUtils = require('@fsegurai/codemirror-theme-utils');
6
+
7
+ // Helper module for styling options
8
+ const generalContent = {
9
+ fontSize: '14px',
10
+ fontFamily: 'JetBrains Mono, Consolas, monospace',
11
+ lineHeight: '1.6',
12
+ };
13
+ const generalCursor = {
14
+ borderLeftWidth: '2px',
15
+ };
16
+ const generalDiff = {
17
+ insertedTextDecoration: 'none',
18
+ deletedTextDecoration: 'line-through',
19
+ insertedLinePadding: '1px 3px',
20
+ borderRadious: '3px'};
21
+ const generalGutter = {
22
+ border: 'none',
23
+ paddingRight: '8px',
24
+ fontSize: '0.9em',
25
+ fontWeight: '500',
26
+ };
27
+ const generalPanel = {
28
+ border: 'none',
29
+ borderRadius: '4px',
30
+ padding: '2px 10px',
31
+ };
32
+ const generalLine = {
33
+ borderRadius: '2px',
34
+ };
35
+ const generalMatching = {
36
+ borderRadius: '2px',
37
+ };
38
+ const generalPlaceholder = {
39
+ borderRadius: '4px',
40
+ padding: '0 5px',
41
+ margin: '0 2px',
42
+ };
43
+ const generalScroller = {
44
+ width: '12px',
45
+ height: '12px',
46
+ borderRadius: '6px',
47
+ };
48
+ const generalSearchField = {
49
+ borderRadius: '4px',
50
+ padding: '2px 6px',
51
+ };
52
+ const generalTooltip = {
53
+ borderRadius: '4px',
54
+ borderRadiusSelected: '3px',
55
+ lineHeight: '1.3',
56
+ padding: '4px 8px',
57
+ paddingRight: '8px',
58
+ };
59
+ /**
60
+ * Function to apply merge revert styles for a theme
61
+ * @param styles Styles for the merge revert buttons
62
+ * @param styles.backgroundColor Background color of the revert area
63
+ * @param styles.borderColor Border color of the revert area
64
+ * @param styles.buttonColor Color of the revert buttons
65
+ * @param styles.buttonHoverColor Hover color of the revert buttons
66
+ */
67
+ function applyMergeRevertStyles(styles) {
68
+ // Create a stylesheet
69
+ const styleEl = document.createElement('style');
70
+ styleEl.id = 'cm-merge-revert-styles';
71
+ // Define CSS with the theme-specific values
72
+ styleEl.textContent = `
73
+ .cm-merge-revert {
74
+ display: flex;
75
+ flex-direction: column;
76
+ align-items: center;
77
+ justify-content: flex-start;
78
+ padding: 4px;
79
+ background-color: ${styles.backgroundColor};
80
+ border-left: 1px solid ${styles.borderColor};
81
+ border-right: 1px solid ${styles.borderColor};
82
+ width: 32px;
83
+ }
84
+
85
+ .cm-merge-revert button {
86
+ width: 100%;
87
+ height: auto;
88
+ background-color: transparent;
89
+ border: none;
90
+ color: ${styles.buttonColor};
91
+ cursor: pointer;
92
+ margin: 0 auto;
93
+ font-size: 20px;
94
+ }
95
+
96
+ .cm-merge-revert button:hover {
97
+ background-color: ${styles.buttonHoverColor};
98
+ }
99
+ `;
100
+ // Remove any existing merge styles
101
+ const existingStyle = document.getElementById('cm-merge-revert-styles');
102
+ if (existingStyle)
103
+ existingStyle.remove();
104
+ // Add the new styles
105
+ document.head.appendChild(styleEl);
106
+ }
7
107
 
8
108
  /**
9
109
  * Enhanced Palenight theme color definitions
@@ -11,35 +111,40 @@ var codemirrorThemeUtils = require('@fsegurai/codemirror-theme-utils');
11
111
  * Colors organized by function with visual color blocks
12
112
  */
13
113
  // Base colors
14
- const base00 = '#292D3E'; // Background - deep indigo
15
- const base01 = '#A6ACCD'; // Foreground - lavender blue
16
- const base02 = '#444267'; // Selection background - muted indigo
17
- const base03 = '#676E95'; // Comments, invisible - steel blue
18
- const base04 = '#BFC7D5'; // Cursor - lighter lavender
114
+ const base00 = '#292D3E', // Background - deep indigo
115
+ base01 = '#A6ACCD', // Foreground - lavender blue
116
+ base02 = '#444267', // Selection background - muted indigo
117
+ base03 = '#676E95', // Comments, invisible - steel blue
118
+ base04 = '#BFC7D5', // Cursor - lighter lavender
19
119
  // Accent colors
20
- const base05 = '#C3E88D'; // Strings - light green
21
- const base06 = '#82AAFF'; // Keywords, Functions - sky blue
22
- const base07 = '#C792EA'; // Classes, Types - purple
23
- const base08 = '#F78C6C'; // Numbers, Constants - orange
24
- const base09 = '#FFCB6B'; // Classes, Attributes - yellow
25
- const base0A = '#89DDFF'; // Punctuation, Operators - light blue
26
- const base0B = '#FF5370'; // Tags, Errors - red
27
- const base0C = '#BB80B3'; // Special elements - mauve
28
- const base0D = '#80CBC4'; // Properties - seafoam
120
+ base05 = '#C3E88D', // Strings - light green
121
+ base06 = '#82AAFF', // Keywords, Functions - sky blue
122
+ base07 = '#C792EA', // Classes, Types - purple
123
+ base08 = '#F78C6C', // Numbers, Constants - orange
124
+ base09 = '#FFCB6B', // Classes, Attributes - yellow
125
+ base0A = '#89DDFF', // Punctuation, Operators - light blue
126
+ base0B = '#FF5370', // Tags, Errors - red
127
+ base0C = '#BB80B3', // Special elements - mauve
128
+ base0D = '#80CBC4'; // Properties - seafoam
29
129
  // UI specific colors
30
- const invalid = '#FF5370'; // Error color - red
31
- const darkBackground = '#202331'; // Darker background for panels and gutter
32
- const highlightBackground = '#2e324817'; // Active line background
33
- const background = base00; // Main editor background
34
- const tooltipBackground = '#343A50'; // Tooltip background
35
- const selection = base02; // Selection background
36
- const selectionMatch = '#444267AA'; // Selection match with opacity
37
- const cursor = base04; // Cursor color
38
- const activeBracketBg = '#2E3248'; // Active bracket background
39
- const activeBracketBorder = base06; // Active bracket border - sky blue
40
- const diagnosticWarning = base09; // Warning color - yellow
41
- const linkColor = base06; // Link color - sky blue
42
- const visitedLinkColor = base07; // Visited link color - purple
130
+ const invalid = '#FF5370', // Error color - red
131
+ darkBackground = '#202331', // Darker background for panels and gutter
132
+ highlightBackground = '#2e324817', // Active line background
133
+ background = base00, // Main editor background
134
+ tooltipBackground = '#343A50', // Tooltip background
135
+ selection = base02, // Selection background
136
+ selectionMatch = '#444267AA', // Selection match with opacity
137
+ cursor = base04, // Cursor color
138
+ activeBracketBg = '#2E3248', // Active bracket background
139
+ activeBracketBorder = base06, // Active bracket border - sky blue
140
+ diagnosticWarning = base09, // Warning color - yellow
141
+ linkColor = base06, // Link color - sky blue
142
+ visitedLinkColor = base07; // Visited link color - purple
143
+ // Diff/merge specific colors
144
+ const addedBackground = '#2c3c2e80', // Dark green with transparency for insertions
145
+ removedBackground = '#3e2e3180', // Dark red with transparency for deletions
146
+ addedText = '#C3E88D', // Palenight green for added text
147
+ removedText = '#FF5370'; // Palenight red for removed text
43
148
  /**
44
149
  * Enhanced editor theme styles for Palenight
45
150
  */
@@ -48,17 +153,17 @@ const palenightTheme = view.EditorView.theme({
48
153
  '&': {
49
154
  color: base01,
50
155
  backgroundColor: background,
51
- fontSize: codemirrorThemeUtils.generalContent.fontSize,
52
- fontFamily: codemirrorThemeUtils.generalContent.fontFamily,
156
+ fontSize: generalContent.fontSize,
157
+ fontFamily: generalContent.fontFamily,
53
158
  },
54
159
  // Content and cursor
55
160
  '.cm-content': {
56
161
  caretColor: cursor,
57
- lineHeight: codemirrorThemeUtils.generalContent.lineHeight,
162
+ lineHeight: generalContent.lineHeight,
58
163
  },
59
164
  '.cm-cursor, .cm-dropCursor': {
60
165
  borderLeftColor: cursor,
61
- borderLeftWidth: codemirrorThemeUtils.generalCursor.borderLeftWidth,
166
+ borderLeftWidth: generalCursor.borderLeftWidth,
62
167
  },
63
168
  '.cm-fat-cursor': {
64
169
  backgroundColor: `${cursor}99`,
@@ -77,7 +182,7 @@ const palenightTheme = view.EditorView.theme({
77
182
  backgroundColor: '#444267CC',
78
183
  outline: `1px solid ${base06}`,
79
184
  color: base01,
80
- borderRadius: codemirrorThemeUtils.generalSearchField.borderRadius,
185
+ borderRadius: generalSearchField.borderRadius,
81
186
  '& span': {
82
187
  color: base01,
83
188
  },
@@ -85,15 +190,15 @@ const palenightTheme = view.EditorView.theme({
85
190
  '.cm-searchMatch.cm-searchMatch-selected': {
86
191
  backgroundColor: base06,
87
192
  color: background,
88
- padding: codemirrorThemeUtils.generalSearchField.padding,
193
+ padding: generalSearchField.padding,
89
194
  '& span': {
90
195
  color: background,
91
196
  },
92
197
  },
93
198
  '.cm-search.cm-panel.cm-textfield': {
94
199
  color: base01,
95
- borderRadius: codemirrorThemeUtils.generalSearchField.borderRadius,
96
- padding: codemirrorThemeUtils.generalSearchField.padding,
200
+ borderRadius: generalSearchField.borderRadius,
201
+ padding: generalSearchField.padding,
97
202
  },
98
203
  // Panels
99
204
  '.cm-panels': {
@@ -110,9 +215,9 @@ const palenightTheme = view.EditorView.theme({
110
215
  '.cm-panel button': {
111
216
  backgroundColor: tooltipBackground,
112
217
  color: base01,
113
- border: codemirrorThemeUtils.generalPanel.border,
114
- borderRadius: codemirrorThemeUtils.generalPanel.borderRadius,
115
- padding: codemirrorThemeUtils.generalPanel.padding,
218
+ border: generalPanel.border,
219
+ borderRadius: generalPanel.borderRadius,
220
+ padding: generalPanel.padding,
116
221
  },
117
222
  '.cm-panel button:hover': {
118
223
  backgroundColor: '#3A4058',
@@ -120,27 +225,27 @@ const palenightTheme = view.EditorView.theme({
120
225
  // Line highlighting
121
226
  '.cm-activeLine': {
122
227
  backgroundColor: highlightBackground,
123
- borderRadius: codemirrorThemeUtils.generalLine.borderRadius,
228
+ borderRadius: generalLine.borderRadius,
124
229
  zIndex: 1,
125
230
  },
126
231
  // Gutters
127
232
  '.cm-gutters': {
128
233
  backgroundColor: darkBackground,
129
234
  color: base03,
130
- border: codemirrorThemeUtils.generalGutter.border,
235
+ border: generalGutter.border,
131
236
  borderRight: '1px solid #3A405880',
132
- paddingRight: codemirrorThemeUtils.generalGutter.paddingRight,
237
+ paddingRight: generalGutter.paddingRight,
133
238
  },
134
239
  '.cm-activeLineGutter': {
135
240
  backgroundColor: '#2A2D40',
136
241
  color: base01,
137
- fontWeight: codemirrorThemeUtils.generalGutter.fontWeight,
242
+ fontWeight: generalGutter.fontWeight,
138
243
  },
139
244
  '.cm-lineNumbers': {
140
- fontSize: codemirrorThemeUtils.generalGutter.fontSize,
245
+ fontSize: generalGutter.fontSize,
141
246
  },
142
247
  '.cm-foldGutter': {
143
- fontSize: codemirrorThemeUtils.generalGutter.fontSize,
248
+ fontSize: generalGutter.fontSize,
144
249
  },
145
250
  '.cm-foldGutter .cm-gutterElement': {
146
251
  color: base03,
@@ -149,12 +254,51 @@ const palenightTheme = view.EditorView.theme({
149
254
  '.cm-foldGutter .cm-gutterElement:hover': {
150
255
  color: base01,
151
256
  },
257
+ // Diff/Merge View Styles
258
+ // Inserted/Added Content
259
+ '.cm-insertedLine': {
260
+ textDecoration: generalDiff.insertedTextDecoration,
261
+ backgroundColor: addedBackground,
262
+ color: addedText,
263
+ padding: generalDiff.insertedLinePadding,
264
+ borderRadius: generalDiff.borderRadious,
265
+ },
266
+ 'ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))': {
267
+ textDecoration: generalDiff.insertedTextDecoration,
268
+ backgroundColor: `${addedBackground} !important`,
269
+ color: addedText,
270
+ padding: generalDiff.insertedLinePadding,
271
+ borderRadius: generalDiff.borderRadious,
272
+ border: `1px solid ${addedText}40`,
273
+ },
274
+ 'ins.cm-insertedLine .cm-changedText': {
275
+ background: 'transparent !important',
276
+ },
277
+ // Deleted/Removed Content
278
+ '.cm-deletedLine': {
279
+ textDecoration: generalDiff.deletedTextDecoration,
280
+ backgroundColor: removedBackground,
281
+ color: removedText,
282
+ padding: generalDiff.insertedLinePadding,
283
+ borderRadius: generalDiff.borderRadious,
284
+ },
285
+ 'del.cm-deletedLine, del, del:not(:has(.cm-deletedText))': {
286
+ textDecoration: generalDiff.deletedTextDecoration,
287
+ backgroundColor: `${removedBackground} !important`,
288
+ color: removedText,
289
+ padding: generalDiff.insertedLinePadding,
290
+ borderRadius: generalDiff.borderRadious,
291
+ border: `1px solid ${removedText}40`,
292
+ },
293
+ 'del .cm-deletedText, del .cm-changedText': {
294
+ background: 'transparent !important',
295
+ },
152
296
  // Tooltips and autocomplete
153
297
  '.cm-tooltip': {
154
298
  backgroundColor: tooltipBackground,
155
299
  border: '1px solid #3A4058',
156
- borderRadius: codemirrorThemeUtils.generalTooltip.borderRadius,
157
- padding: codemirrorThemeUtils.generalTooltip.padding,
300
+ borderRadius: generalTooltip.borderRadius,
301
+ padding: generalTooltip.padding,
158
302
  boxShadow: '0 2px 8px rgba(0, 0, 0, 0.4)',
159
303
  },
160
304
  '.cm-tooltip-autocomplete': {
@@ -163,17 +307,17 @@ const palenightTheme = view.EditorView.theme({
163
307
  border: 'none',
164
308
  },
165
309
  '& > ul > li': {
166
- padding: codemirrorThemeUtils.generalTooltip.padding,
167
- lineHeight: codemirrorThemeUtils.generalTooltip.lineHeight,
310
+ padding: generalTooltip.padding,
311
+ lineHeight: generalTooltip.lineHeight,
168
312
  },
169
313
  '& > ul > li[aria-selected]': {
170
314
  backgroundColor: selection,
171
315
  color: base04,
172
- borderRadius: codemirrorThemeUtils.generalTooltip.borderRadiusSelected,
316
+ borderRadius: generalTooltip.borderRadiusSelected,
173
317
  },
174
318
  '& > ul > li > span.cm-completionIcon': {
175
319
  color: base03,
176
- paddingRight: codemirrorThemeUtils.generalTooltip.paddingRight,
320
+ paddingRight: generalTooltip.paddingRight,
177
321
  },
178
322
  '& > ul > li > span.cm-completionDetail': {
179
323
  color: base03,
@@ -210,27 +354,27 @@ const palenightTheme = view.EditorView.theme({
210
354
  '.cm-matchingBracket': {
211
355
  backgroundColor: activeBracketBg,
212
356
  outline: `1px solid ${activeBracketBorder}`,
213
- borderRadius: codemirrorThemeUtils.generalMatching.borderRadius,
357
+ borderRadius: generalMatching.borderRadius,
214
358
  },
215
359
  '.cm-nonmatchingBracket': {
216
360
  backgroundColor: `${invalid}40`,
217
361
  outline: `1px solid ${invalid}`,
218
- borderRadius: codemirrorThemeUtils.generalMatching.borderRadius,
362
+ borderRadius: generalMatching.borderRadius,
219
363
  },
220
364
  // Selection matches
221
365
  '.cm-selectionMatch': {
222
366
  backgroundColor: selectionMatch,
223
367
  outline: `1px solid ${base03}50`,
224
- borderRadius: codemirrorThemeUtils.generalMatching.borderRadius,
368
+ borderRadius: generalMatching.borderRadius,
225
369
  },
226
370
  // Fold placeholder
227
371
  '.cm-foldPlaceholder': {
228
372
  backgroundColor: tooltipBackground,
229
373
  color: base03,
230
374
  border: `1px dotted ${base03}70`,
231
- borderRadius: codemirrorThemeUtils.generalPlaceholder.borderRadius,
232
- padding: codemirrorThemeUtils.generalPlaceholder.padding,
233
- margin: codemirrorThemeUtils.generalPlaceholder.margin,
375
+ borderRadius: generalPlaceholder.borderRadius,
376
+ padding: generalPlaceholder.padding,
377
+ margin: generalPlaceholder.margin,
234
378
  },
235
379
  // Focus outline
236
380
  '&.cm-focused': {
@@ -239,15 +383,15 @@ const palenightTheme = view.EditorView.theme({
239
383
  },
240
384
  // Scrollbars
241
385
  '& .cm-scroller::-webkit-scrollbar': {
242
- width: codemirrorThemeUtils.generalScroller.width,
243
- height: codemirrorThemeUtils.generalScroller.height,
386
+ width: generalScroller.width,
387
+ height: generalScroller.height,
244
388
  },
245
389
  '& .cm-scroller::-webkit-scrollbar-track': {
246
390
  background: darkBackground,
247
391
  },
248
392
  '& .cm-scroller::-webkit-scrollbar-thumb': {
249
393
  backgroundColor: base02,
250
- borderRadius: codemirrorThemeUtils.generalScroller.borderRadius,
394
+ borderRadius: generalScroller.borderRadius,
251
395
  border: `3px solid ${darkBackground}`,
252
396
  },
253
397
  '& .cm-scroller::-webkit-scrollbar-thumb:hover': {
@@ -349,7 +493,16 @@ const palenight = [
349
493
  palenightTheme,
350
494
  language.syntaxHighlighting(palenightHighlightStyle),
351
495
  ];
496
+ /**
497
+ * Palenight merge revert styles configuration
498
+ */
499
+ const palenightMergeStyles = {
500
+ backgroundColor: darkBackground,
501
+ borderColor: '#3A4058',
502
+ buttonColor: base01,
503
+ buttonHoverColor: '#3A4058',
504
+ };
352
505
 
506
+ exports.applyMergeRevertStyles = applyMergeRevertStyles;
353
507
  exports.palenight = palenight;
354
- exports.palenightHighlightStyle = palenightHighlightStyle;
355
- exports.palenightTheme = palenightTheme;
508
+ exports.palenightMergeStyles = palenightMergeStyles;
package/dist/index.d.cts CHANGED
@@ -1,17 +1,28 @@
1
1
  import { Extension } from '@codemirror/state';
2
- import { HighlightStyle } from '@codemirror/language';
3
2
 
3
+ interface IMergeRevertStyles {
4
+ backgroundColor: string;
5
+ borderColor: string;
6
+ buttonColor: string;
7
+ buttonHoverColor: string;
8
+ }
4
9
  /**
5
- * Enhanced editor theme styles for Palenight
10
+ * Function to apply merge revert styles for a theme
11
+ * @param styles Styles for the merge revert buttons
12
+ * @param styles.backgroundColor Background color of the revert area
13
+ * @param styles.borderColor Border color of the revert area
14
+ * @param styles.buttonColor Color of the revert buttons
15
+ * @param styles.buttonHoverColor Hover color of the revert buttons
6
16
  */
7
- declare const palenightTheme: Extension;
8
- /**
9
- * Enhanced syntax highlighting for Palenight theme
10
- */
11
- declare const palenightHighlightStyle: HighlightStyle;
17
+ declare function applyMergeRevertStyles(styles: IMergeRevertStyles): void;
18
+
12
19
  /**
13
20
  * Combined Palenight theme extension
14
21
  */
15
22
  declare const palenight: Extension;
23
+ /**
24
+ * Palenight merge revert styles configuration
25
+ */
26
+ declare const palenightMergeStyles: IMergeRevertStyles;
16
27
 
17
- export { palenight, palenightHighlightStyle, palenightTheme };
28
+ export { applyMergeRevertStyles, palenight, palenightMergeStyles };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,28 @@
1
1
  import { Extension } from '@codemirror/state';
2
- import { HighlightStyle } from '@codemirror/language';
3
2
 
3
+ interface IMergeRevertStyles {
4
+ backgroundColor: string;
5
+ borderColor: string;
6
+ buttonColor: string;
7
+ buttonHoverColor: string;
8
+ }
4
9
  /**
5
- * Enhanced editor theme styles for Palenight
10
+ * Function to apply merge revert styles for a theme
11
+ * @param styles Styles for the merge revert buttons
12
+ * @param styles.backgroundColor Background color of the revert area
13
+ * @param styles.borderColor Border color of the revert area
14
+ * @param styles.buttonColor Color of the revert buttons
15
+ * @param styles.buttonHoverColor Hover color of the revert buttons
6
16
  */
7
- declare const palenightTheme: Extension;
8
- /**
9
- * Enhanced syntax highlighting for Palenight theme
10
- */
11
- declare const palenightHighlightStyle: HighlightStyle;
17
+ declare function applyMergeRevertStyles(styles: IMergeRevertStyles): void;
18
+
12
19
  /**
13
20
  * Combined Palenight theme extension
14
21
  */
15
22
  declare const palenight: Extension;
23
+ /**
24
+ * Palenight merge revert styles configuration
25
+ */
26
+ declare const palenightMergeStyles: IMergeRevertStyles;
16
27
 
17
- export { palenight, palenightHighlightStyle, palenightTheme };
28
+ export { applyMergeRevertStyles, palenight, palenightMergeStyles };
package/dist/index.js CHANGED
@@ -1,7 +1,107 @@
1
1
  import { EditorView } from '@codemirror/view';
2
2
  import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
3
3
  import { tags } from '@lezer/highlight';
4
- import { generalScroller, generalPlaceholder, generalMatching, generalTooltip, generalGutter, generalLine, generalPanel, generalSearchField, generalCursor, generalContent } from '@fsegurai/codemirror-theme-utils';
4
+
5
+ // Helper module for styling options
6
+ const generalContent = {
7
+ fontSize: '14px',
8
+ fontFamily: 'JetBrains Mono, Consolas, monospace',
9
+ lineHeight: '1.6',
10
+ };
11
+ const generalCursor = {
12
+ borderLeftWidth: '2px',
13
+ };
14
+ const generalDiff = {
15
+ insertedTextDecoration: 'none',
16
+ deletedTextDecoration: 'line-through',
17
+ insertedLinePadding: '1px 3px',
18
+ borderRadious: '3px'};
19
+ const generalGutter = {
20
+ border: 'none',
21
+ paddingRight: '8px',
22
+ fontSize: '0.9em',
23
+ fontWeight: '500',
24
+ };
25
+ const generalPanel = {
26
+ border: 'none',
27
+ borderRadius: '4px',
28
+ padding: '2px 10px',
29
+ };
30
+ const generalLine = {
31
+ borderRadius: '2px',
32
+ };
33
+ const generalMatching = {
34
+ borderRadius: '2px',
35
+ };
36
+ const generalPlaceholder = {
37
+ borderRadius: '4px',
38
+ padding: '0 5px',
39
+ margin: '0 2px',
40
+ };
41
+ const generalScroller = {
42
+ width: '12px',
43
+ height: '12px',
44
+ borderRadius: '6px',
45
+ };
46
+ const generalSearchField = {
47
+ borderRadius: '4px',
48
+ padding: '2px 6px',
49
+ };
50
+ const generalTooltip = {
51
+ borderRadius: '4px',
52
+ borderRadiusSelected: '3px',
53
+ lineHeight: '1.3',
54
+ padding: '4px 8px',
55
+ paddingRight: '8px',
56
+ };
57
+ /**
58
+ * Function to apply merge revert styles for a theme
59
+ * @param styles Styles for the merge revert buttons
60
+ * @param styles.backgroundColor Background color of the revert area
61
+ * @param styles.borderColor Border color of the revert area
62
+ * @param styles.buttonColor Color of the revert buttons
63
+ * @param styles.buttonHoverColor Hover color of the revert buttons
64
+ */
65
+ function applyMergeRevertStyles(styles) {
66
+ // Create a stylesheet
67
+ const styleEl = document.createElement('style');
68
+ styleEl.id = 'cm-merge-revert-styles';
69
+ // Define CSS with the theme-specific values
70
+ styleEl.textContent = `
71
+ .cm-merge-revert {
72
+ display: flex;
73
+ flex-direction: column;
74
+ align-items: center;
75
+ justify-content: flex-start;
76
+ padding: 4px;
77
+ background-color: ${styles.backgroundColor};
78
+ border-left: 1px solid ${styles.borderColor};
79
+ border-right: 1px solid ${styles.borderColor};
80
+ width: 32px;
81
+ }
82
+
83
+ .cm-merge-revert button {
84
+ width: 100%;
85
+ height: auto;
86
+ background-color: transparent;
87
+ border: none;
88
+ color: ${styles.buttonColor};
89
+ cursor: pointer;
90
+ margin: 0 auto;
91
+ font-size: 20px;
92
+ }
93
+
94
+ .cm-merge-revert button:hover {
95
+ background-color: ${styles.buttonHoverColor};
96
+ }
97
+ `;
98
+ // Remove any existing merge styles
99
+ const existingStyle = document.getElementById('cm-merge-revert-styles');
100
+ if (existingStyle)
101
+ existingStyle.remove();
102
+ // Add the new styles
103
+ document.head.appendChild(styleEl);
104
+ }
5
105
 
6
106
  /**
7
107
  * Enhanced Palenight theme color definitions
@@ -9,35 +109,40 @@ import { generalScroller, generalPlaceholder, generalMatching, generalTooltip, g
9
109
  * Colors organized by function with visual color blocks
10
110
  */
11
111
  // Base colors
12
- const base00 = '#292D3E'; // Background - deep indigo
13
- const base01 = '#A6ACCD'; // Foreground - lavender blue
14
- const base02 = '#444267'; // Selection background - muted indigo
15
- const base03 = '#676E95'; // Comments, invisible - steel blue
16
- const base04 = '#BFC7D5'; // Cursor - lighter lavender
112
+ const base00 = '#292D3E', // Background - deep indigo
113
+ base01 = '#A6ACCD', // Foreground - lavender blue
114
+ base02 = '#444267', // Selection background - muted indigo
115
+ base03 = '#676E95', // Comments, invisible - steel blue
116
+ base04 = '#BFC7D5', // Cursor - lighter lavender
17
117
  // Accent colors
18
- const base05 = '#C3E88D'; // Strings - light green
19
- const base06 = '#82AAFF'; // Keywords, Functions - sky blue
20
- const base07 = '#C792EA'; // Classes, Types - purple
21
- const base08 = '#F78C6C'; // Numbers, Constants - orange
22
- const base09 = '#FFCB6B'; // Classes, Attributes - yellow
23
- const base0A = '#89DDFF'; // Punctuation, Operators - light blue
24
- const base0B = '#FF5370'; // Tags, Errors - red
25
- const base0C = '#BB80B3'; // Special elements - mauve
26
- const base0D = '#80CBC4'; // Properties - seafoam
118
+ base05 = '#C3E88D', // Strings - light green
119
+ base06 = '#82AAFF', // Keywords, Functions - sky blue
120
+ base07 = '#C792EA', // Classes, Types - purple
121
+ base08 = '#F78C6C', // Numbers, Constants - orange
122
+ base09 = '#FFCB6B', // Classes, Attributes - yellow
123
+ base0A = '#89DDFF', // Punctuation, Operators - light blue
124
+ base0B = '#FF5370', // Tags, Errors - red
125
+ base0C = '#BB80B3', // Special elements - mauve
126
+ base0D = '#80CBC4'; // Properties - seafoam
27
127
  // UI specific colors
28
- const invalid = '#FF5370'; // Error color - red
29
- const darkBackground = '#202331'; // Darker background for panels and gutter
30
- const highlightBackground = '#2e324817'; // Active line background
31
- const background = base00; // Main editor background
32
- const tooltipBackground = '#343A50'; // Tooltip background
33
- const selection = base02; // Selection background
34
- const selectionMatch = '#444267AA'; // Selection match with opacity
35
- const cursor = base04; // Cursor color
36
- const activeBracketBg = '#2E3248'; // Active bracket background
37
- const activeBracketBorder = base06; // Active bracket border - sky blue
38
- const diagnosticWarning = base09; // Warning color - yellow
39
- const linkColor = base06; // Link color - sky blue
40
- const visitedLinkColor = base07; // Visited link color - purple
128
+ const invalid = '#FF5370', // Error color - red
129
+ darkBackground = '#202331', // Darker background for panels and gutter
130
+ highlightBackground = '#2e324817', // Active line background
131
+ background = base00, // Main editor background
132
+ tooltipBackground = '#343A50', // Tooltip background
133
+ selection = base02, // Selection background
134
+ selectionMatch = '#444267AA', // Selection match with opacity
135
+ cursor = base04, // Cursor color
136
+ activeBracketBg = '#2E3248', // Active bracket background
137
+ activeBracketBorder = base06, // Active bracket border - sky blue
138
+ diagnosticWarning = base09, // Warning color - yellow
139
+ linkColor = base06, // Link color - sky blue
140
+ visitedLinkColor = base07; // Visited link color - purple
141
+ // Diff/merge specific colors
142
+ const addedBackground = '#2c3c2e80', // Dark green with transparency for insertions
143
+ removedBackground = '#3e2e3180', // Dark red with transparency for deletions
144
+ addedText = '#C3E88D', // Palenight green for added text
145
+ removedText = '#FF5370'; // Palenight red for removed text
41
146
  /**
42
147
  * Enhanced editor theme styles for Palenight
43
148
  */
@@ -147,6 +252,45 @@ const palenightTheme = /*@__PURE__*/EditorView.theme({
147
252
  '.cm-foldGutter .cm-gutterElement:hover': {
148
253
  color: base01,
149
254
  },
255
+ // Diff/Merge View Styles
256
+ // Inserted/Added Content
257
+ '.cm-insertedLine': {
258
+ textDecoration: generalDiff.insertedTextDecoration,
259
+ backgroundColor: addedBackground,
260
+ color: addedText,
261
+ padding: generalDiff.insertedLinePadding,
262
+ borderRadius: generalDiff.borderRadious,
263
+ },
264
+ 'ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))': {
265
+ textDecoration: generalDiff.insertedTextDecoration,
266
+ backgroundColor: `${addedBackground} !important`,
267
+ color: addedText,
268
+ padding: generalDiff.insertedLinePadding,
269
+ borderRadius: generalDiff.borderRadious,
270
+ border: `1px solid ${addedText}40`,
271
+ },
272
+ 'ins.cm-insertedLine .cm-changedText': {
273
+ background: 'transparent !important',
274
+ },
275
+ // Deleted/Removed Content
276
+ '.cm-deletedLine': {
277
+ textDecoration: generalDiff.deletedTextDecoration,
278
+ backgroundColor: removedBackground,
279
+ color: removedText,
280
+ padding: generalDiff.insertedLinePadding,
281
+ borderRadius: generalDiff.borderRadious,
282
+ },
283
+ 'del.cm-deletedLine, del, del:not(:has(.cm-deletedText))': {
284
+ textDecoration: generalDiff.deletedTextDecoration,
285
+ backgroundColor: `${removedBackground} !important`,
286
+ color: removedText,
287
+ padding: generalDiff.insertedLinePadding,
288
+ borderRadius: generalDiff.borderRadious,
289
+ border: `1px solid ${removedText}40`,
290
+ },
291
+ 'del .cm-deletedText, del .cm-changedText': {
292
+ background: 'transparent !important',
293
+ },
150
294
  // Tooltips and autocomplete
151
295
  '.cm-tooltip': {
152
296
  backgroundColor: tooltipBackground,
@@ -347,5 +491,14 @@ const palenight = [
347
491
  palenightTheme,
348
492
  /*@__PURE__*/syntaxHighlighting(palenightHighlightStyle),
349
493
  ];
494
+ /**
495
+ * Palenight merge revert styles configuration
496
+ */
497
+ const palenightMergeStyles = {
498
+ backgroundColor: darkBackground,
499
+ borderColor: '#3A4058',
500
+ buttonColor: base01,
501
+ buttonHoverColor: '#3A4058',
502
+ };
350
503
 
351
- export { palenight, palenightHighlightStyle, palenightTheme };
504
+ export { applyMergeRevertStyles, palenight, palenightMergeStyles };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fsegurai/codemirror-theme-palenight",
3
3
  "description": "Palenight theme for the CodeMirror code editor",
4
- "version": "6.2.0-beta.4",
4
+ "version": "6.2.0-beta.5",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "exports": {
@@ -34,8 +34,7 @@
34
34
  "@lezer/highlight": "^1.0.0",
35
35
  "@codemirror/language": "^6.0.0",
36
36
  "@codemirror/state": "^6.0.0",
37
- "@codemirror/view": "^6.0.0",
38
- "@fsegurai/codemirror-theme-utils": "6.2.0-beta.3"
37
+ "@codemirror/view": "^6.0.0"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@codemirror/buildhelper": "^1.0.2"