react-diff-viewer-continued 3.2.5 → 3.3.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/lib/styles.js DELETED
@@ -1,287 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- const emotion_1 = require("emotion");
15
- // eslint-disable-next-line import/no-anonymous-default-export
16
- exports.default = (styleOverride, useDarkTheme = false) => {
17
- const { variables: overrideVariables = {} } = styleOverride, styles = __rest(styleOverride, ["variables"]);
18
- const themeVariables = {
19
- light: Object.assign({
20
- diffViewerBackground: '#fff',
21
- diffViewerColor: '#212529',
22
- addedBackground: '#e6ffed',
23
- addedColor: '#24292e',
24
- removedBackground: '#ffeef0',
25
- removedColor: '#24292e',
26
- changedBackground: '#fffbdd',
27
- wordAddedBackground: '#acf2bd',
28
- wordRemovedBackground: '#fdb8c0',
29
- addedGutterBackground: '#cdffd8',
30
- removedGutterBackground: '#ffdce0',
31
- gutterBackground: '#f7f7f7',
32
- gutterBackgroundDark: '#f3f1f1',
33
- highlightBackground: '#fffbdd',
34
- highlightGutterBackground: '#fff5b1',
35
- codeFoldGutterBackground: '#dbedff',
36
- codeFoldBackground: '#f1f8ff',
37
- emptyLineBackground: '#fafbfc',
38
- gutterColor: '#212529',
39
- addedGutterColor: '#212529',
40
- removedGutterColor: '#212529',
41
- codeFoldContentColor: '#212529',
42
- diffViewerTitleBackground: '#fafbfc',
43
- diffViewerTitleColor: '#212529',
44
- diffViewerTitleBorderColor: '#eee',
45
- }, (overrideVariables.light || {})),
46
- dark: Object.assign({
47
- diffViewerBackground: '#2e303c',
48
- diffViewerColor: '#FFF',
49
- addedBackground: '#044B53',
50
- addedColor: 'white',
51
- removedBackground: '#632F34',
52
- removedColor: 'white',
53
- changedBackground: '#3e302c',
54
- wordAddedBackground: '#055d67',
55
- wordRemovedBackground: '#7d383f',
56
- addedGutterBackground: '#034148',
57
- removedGutterBackground: '#632b30',
58
- gutterBackground: '#2c2f3a',
59
- gutterBackgroundDark: '#262933',
60
- highlightBackground: '#2a3967',
61
- highlightGutterBackground: '#2d4077',
62
- codeFoldGutterBackground: '#21232b',
63
- codeFoldBackground: '#262831',
64
- emptyLineBackground: '#363946',
65
- gutterColor: '#666c87',
66
- addedGutterColor: '#8c8c8c',
67
- removedGutterColor: '#8c8c8c',
68
- codeFoldContentColor: '#656a8b',
69
- diffViewerTitleBackground: '#2f323e',
70
- diffViewerTitleColor: '#555a7b',
71
- diffViewerTitleBorderColor: '#353846',
72
- }, (overrideVariables.dark || {})),
73
- };
74
- const variables = useDarkTheme ? themeVariables.dark : themeVariables.light;
75
- const content = (0, emotion_1.css)({
76
- width: '100%',
77
- label: 'content',
78
- });
79
- const splitView = (0, emotion_1.css)({
80
- [`.${content}`]: {
81
- width: '50%',
82
- },
83
- label: 'split-view',
84
- });
85
- const diffContainer = (0, emotion_1.css)({
86
- width: '100%',
87
- background: variables.diffViewerBackground,
88
- pre: {
89
- margin: 0,
90
- whiteSpace: 'pre-wrap',
91
- lineHeight: '25px',
92
- },
93
- label: 'diff-container',
94
- borderCollapse: 'collapse',
95
- });
96
- const codeFoldContent = (0, emotion_1.css)({
97
- color: variables.codeFoldContentColor,
98
- label: 'code-fold-content',
99
- });
100
- const contentText = (0, emotion_1.css)({
101
- color: variables.diffViewerColor,
102
- label: 'content-text',
103
- });
104
- const titleBlock = (0, emotion_1.css)({
105
- background: variables.diffViewerTitleBackground,
106
- padding: 10,
107
- borderBottom: `1px solid ${variables.diffViewerTitleBorderColor}`,
108
- label: 'title-block',
109
- ':last-child': {
110
- borderLeft: `1px solid ${variables.diffViewerTitleBorderColor}`,
111
- },
112
- [`.${contentText}`]: {
113
- color: variables.diffViewerTitleColor,
114
- },
115
- });
116
- const lineNumber = (0, emotion_1.css)({
117
- color: variables.gutterColor,
118
- label: 'line-number',
119
- });
120
- const diffRemoved = (0, emotion_1.css)({
121
- background: variables.removedBackground,
122
- color: variables.removedColor,
123
- pre: {
124
- color: variables.removedColor,
125
- },
126
- [`.${lineNumber}`]: {
127
- color: variables.removedGutterColor,
128
- },
129
- label: 'diff-removed',
130
- });
131
- const diffAdded = (0, emotion_1.css)({
132
- background: variables.addedBackground,
133
- color: variables.addedColor,
134
- pre: {
135
- color: variables.addedColor,
136
- },
137
- [`.${lineNumber}`]: {
138
- color: variables.addedGutterColor,
139
- },
140
- label: 'diff-added',
141
- });
142
- const diffChanged = (0, emotion_1.css)({
143
- background: variables.changedBackground,
144
- [`.${lineNumber}`]: {
145
- color: variables.gutterColor,
146
- },
147
- label: 'diff-changed',
148
- });
149
- const wordDiff = (0, emotion_1.css)({
150
- padding: 2,
151
- display: 'inline-flex',
152
- borderRadius: 4,
153
- wordBreak: 'break-all',
154
- label: 'word-diff',
155
- });
156
- const wordAdded = (0, emotion_1.css)({
157
- background: variables.wordAddedBackground,
158
- label: 'word-added',
159
- });
160
- const wordRemoved = (0, emotion_1.css)({
161
- background: variables.wordRemovedBackground,
162
- label: 'word-removed',
163
- });
164
- const codeFoldGutter = (0, emotion_1.css)({
165
- backgroundColor: variables.codeFoldGutterBackground,
166
- label: 'code-fold-gutter',
167
- });
168
- const codeFold = (0, emotion_1.css)({
169
- backgroundColor: variables.codeFoldBackground,
170
- height: 40,
171
- fontSize: 14,
172
- fontWeight: 700,
173
- label: 'code-fold',
174
- a: {
175
- textDecoration: 'underline !important',
176
- cursor: 'pointer',
177
- pre: {
178
- display: 'inline',
179
- },
180
- },
181
- });
182
- const emptyLine = (0, emotion_1.css)({
183
- backgroundColor: variables.emptyLineBackground,
184
- label: 'empty-line',
185
- });
186
- const marker = (0, emotion_1.css)({
187
- width: 25,
188
- paddingLeft: 10,
189
- paddingRight: 10,
190
- userSelect: 'none',
191
- label: 'marker',
192
- [`&.${diffAdded}`]: {
193
- pre: {
194
- color: variables.addedColor,
195
- },
196
- },
197
- [`&.${diffRemoved}`]: {
198
- pre: {
199
- color: variables.removedColor,
200
- },
201
- },
202
- });
203
- const highlightedLine = (0, emotion_1.css)({
204
- background: variables.highlightBackground,
205
- label: 'highlighted-line',
206
- [`.${wordAdded}, .${wordRemoved}`]: {
207
- backgroundColor: 'initial',
208
- },
209
- });
210
- const highlightedGutter = (0, emotion_1.css)({
211
- label: 'highlighted-gutter',
212
- });
213
- const gutter = (0, emotion_1.css)({
214
- userSelect: 'none',
215
- minWidth: 50,
216
- padding: '0 10px',
217
- whiteSpace: 'nowrap',
218
- label: 'gutter',
219
- textAlign: 'right',
220
- background: variables.gutterBackground,
221
- '&:hover': {
222
- cursor: 'pointer',
223
- background: variables.gutterBackgroundDark,
224
- pre: {
225
- opacity: 1,
226
- },
227
- },
228
- pre: {
229
- opacity: 0.5,
230
- },
231
- [`&.${diffAdded}`]: {
232
- background: variables.addedGutterBackground,
233
- },
234
- [`&.${diffRemoved}`]: {
235
- background: variables.removedGutterBackground,
236
- },
237
- [`&.${highlightedGutter}`]: {
238
- background: variables.highlightGutterBackground,
239
- '&:hover': {
240
- background: variables.highlightGutterBackground,
241
- },
242
- },
243
- });
244
- const emptyGutter = (0, emotion_1.css)({
245
- '&:hover': {
246
- background: variables.gutterBackground,
247
- cursor: 'initial',
248
- },
249
- label: 'empty-gutter',
250
- });
251
- const line = (0, emotion_1.css)({
252
- verticalAlign: 'baseline',
253
- label: 'line',
254
- });
255
- const defaultStyles = {
256
- diffContainer,
257
- diffRemoved,
258
- diffAdded,
259
- diffChanged,
260
- splitView,
261
- marker,
262
- highlightedGutter,
263
- highlightedLine,
264
- gutter,
265
- line,
266
- wordDiff,
267
- wordAdded,
268
- wordRemoved,
269
- codeFoldGutter,
270
- codeFold,
271
- emptyGutter,
272
- emptyLine,
273
- lineNumber,
274
- contentText,
275
- content,
276
- codeFoldContent,
277
- titleBlock,
278
- };
279
- const computerOverrideStyles = Object.keys(styles).reduce((acc, key) => (Object.assign(Object.assign({}, acc), {
280
- [key]: (0, emotion_1.css)(styles[key]),
281
- })), {});
282
- return Object.keys(defaultStyles).reduce((acc, key) => (Object.assign(Object.assign({}, acc), {
283
- [key]: computerOverrideStyles[key]
284
- ? (0, emotion_1.cx)(defaultStyles[key], computerOverrideStyles[key])
285
- : defaultStyles[key],
286
- })), {});
287
- };
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "experimentalDecorators": true,
4
- "jsx": "react-jsx",
5
- "module": "es6",
6
- "moduleResolution": "node",
7
- "allowSyntheticDefaultImports": true,
8
- "noImplicitAny": true,
9
- "target": "es5",
10
- "downlevelIteration": true,
11
- "lib": ["es2017", "dom"]
12
- },
13
- "exclude": ["node_modules"]
14
- }