react-diff-viewer-continued 4.0.1 → 4.0.3
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/.github/workflows/release.yml +23 -4
- package/.idea/react-diff-viewer-continued.iml +3 -0
- package/CHANGELOG.md +14 -0
- package/LICENSE +1 -1
- package/README.md +5 -3
- package/example.jpg +0 -0
- package/lib/{src → cjs/src}/compute-lines.d.ts +2 -1
- package/lib/{src → cjs/src}/compute-lines.js +2 -1
- package/lib/cjs/src/expand.d.ts +1 -0
- package/lib/cjs/src/fold.d.ts +1 -0
- package/lib/{src → cjs/src}/index.d.ts +6 -6
- package/lib/{src → cjs/src}/index.js +61 -66
- package/lib/{src → cjs/src}/styles.d.ts +2 -0
- package/lib/{src → cjs/src}/styles.js +16 -12
- package/lib/esm/src/compute-hidden-blocks.js +35 -0
- package/lib/esm/src/compute-lines.js +203 -0
- package/lib/esm/src/expand.js +4 -0
- package/lib/esm/src/fold.js +4 -0
- package/lib/esm/src/index.js +345 -0
- package/lib/esm/src/styles.js +348 -0
- package/package.json +22 -52
- package/tsconfig.esm.json +11 -0
- package/tsconfig.json +5 -1
- package/vitest.config.ts +5 -0
- package/.eslintrc +0 -13
- package/.github/workflows/test.yml +0 -25
- package/.prettierrc +0 -4
- package/jest.config.js +0 -5
- package/lib/src/expand.d.ts +0 -1
- package/lib/src/fold.d.ts +0 -1
- package/webpack.config.js +0 -60
- /package/lib/{src → cjs/src}/compute-hidden-blocks.d.ts +0 -0
- /package/lib/{src → cjs/src}/compute-hidden-blocks.js +0 -0
- /package/lib/{src → cjs/src}/expand.js +0 -0
- /package/lib/{src → cjs/src}/fold.js +0 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import createEmotion from '@emotion/css/create-instance';
|
|
2
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
3
|
+
export default (styleOverride, useDarkTheme = false, nonce = '') => {
|
|
4
|
+
const { variables: overrideVariables = {}, ...styles } = styleOverride;
|
|
5
|
+
const themeVariables = {
|
|
6
|
+
light: {
|
|
7
|
+
...{
|
|
8
|
+
diffViewerBackground: '#fff',
|
|
9
|
+
diffViewerColor: '#212529',
|
|
10
|
+
addedBackground: '#e6ffed',
|
|
11
|
+
addedColor: '#24292e',
|
|
12
|
+
removedBackground: '#ffeef0',
|
|
13
|
+
removedColor: '#24292e',
|
|
14
|
+
changedBackground: '#fffbdd',
|
|
15
|
+
wordAddedBackground: '#acf2bd',
|
|
16
|
+
wordRemovedBackground: '#fdb8c0',
|
|
17
|
+
addedGutterBackground: '#cdffd8',
|
|
18
|
+
removedGutterBackground: '#ffdce0',
|
|
19
|
+
gutterBackground: '#f7f7f7',
|
|
20
|
+
gutterBackgroundDark: '#f3f1f1',
|
|
21
|
+
highlightBackground: '#fffbdd',
|
|
22
|
+
highlightGutterBackground: '#fff5b1',
|
|
23
|
+
codeFoldGutterBackground: '#dbedff',
|
|
24
|
+
codeFoldBackground: '#f1f8ff',
|
|
25
|
+
emptyLineBackground: '#fafbfc',
|
|
26
|
+
gutterColor: '#212529',
|
|
27
|
+
addedGutterColor: '#212529',
|
|
28
|
+
removedGutterColor: '#212529',
|
|
29
|
+
codeFoldContentColor: '#212529',
|
|
30
|
+
diffViewerTitleBackground: '#fafbfc',
|
|
31
|
+
diffViewerTitleColor: '#212529',
|
|
32
|
+
diffViewerTitleBorderColor: '#eee',
|
|
33
|
+
},
|
|
34
|
+
...(overrideVariables.light || {}),
|
|
35
|
+
},
|
|
36
|
+
dark: {
|
|
37
|
+
...{
|
|
38
|
+
diffViewerBackground: '#2e303c',
|
|
39
|
+
diffViewerColor: '#FFF',
|
|
40
|
+
addedBackground: '#044B53',
|
|
41
|
+
addedColor: 'white',
|
|
42
|
+
removedBackground: '#632F34',
|
|
43
|
+
removedColor: 'white',
|
|
44
|
+
changedBackground: '#3e302c',
|
|
45
|
+
wordAddedBackground: '#055d67',
|
|
46
|
+
wordRemovedBackground: '#7d383f',
|
|
47
|
+
addedGutterBackground: '#034148',
|
|
48
|
+
removedGutterBackground: '#632b30',
|
|
49
|
+
gutterBackground: '#2c2f3a',
|
|
50
|
+
gutterBackgroundDark: '#262933',
|
|
51
|
+
highlightBackground: '#2a3967',
|
|
52
|
+
highlightGutterBackground: '#2d4077',
|
|
53
|
+
codeFoldGutterBackground: '#262831',
|
|
54
|
+
codeFoldBackground: '#262831',
|
|
55
|
+
emptyLineBackground: '#363946',
|
|
56
|
+
gutterColor: '#666c87',
|
|
57
|
+
addedGutterColor: '#8c8c8c',
|
|
58
|
+
removedGutterColor: '#8c8c8c',
|
|
59
|
+
codeFoldContentColor: '#656a8b',
|
|
60
|
+
diffViewerTitleBackground: '#2f323e',
|
|
61
|
+
diffViewerTitleColor: '#757a9b',
|
|
62
|
+
diffViewerTitleBorderColor: '#353846',
|
|
63
|
+
},
|
|
64
|
+
...(overrideVariables.dark || {}),
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const variables = useDarkTheme ? themeVariables.dark : themeVariables.light;
|
|
68
|
+
const { css, cx } = createEmotion({ key: 'react-diff', nonce });
|
|
69
|
+
const content = css({
|
|
70
|
+
width: 'auto',
|
|
71
|
+
label: 'content',
|
|
72
|
+
});
|
|
73
|
+
const splitView = css({
|
|
74
|
+
label: 'split-view',
|
|
75
|
+
});
|
|
76
|
+
const summary = css({
|
|
77
|
+
background: variables.diffViewerTitleBackground,
|
|
78
|
+
color: variables.diffViewerTitleColor,
|
|
79
|
+
padding: '0.5em 1em',
|
|
80
|
+
display: 'flex',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
gap: '0.5em',
|
|
83
|
+
fontFamily: "monospace",
|
|
84
|
+
fill: variables.diffViewerTitleColor,
|
|
85
|
+
});
|
|
86
|
+
const diffContainer = css({
|
|
87
|
+
width: '100%',
|
|
88
|
+
minWidth: '1000px',
|
|
89
|
+
overflowX: 'auto',
|
|
90
|
+
tableLayout: 'fixed',
|
|
91
|
+
background: variables.diffViewerBackground,
|
|
92
|
+
pre: {
|
|
93
|
+
margin: 0,
|
|
94
|
+
whiteSpace: 'pre-wrap',
|
|
95
|
+
lineHeight: '1.6em',
|
|
96
|
+
width: 'fit-content'
|
|
97
|
+
},
|
|
98
|
+
label: 'diff-container',
|
|
99
|
+
borderCollapse: 'collapse',
|
|
100
|
+
});
|
|
101
|
+
const lineContent = css({
|
|
102
|
+
overflow: 'hidden',
|
|
103
|
+
width: '100%'
|
|
104
|
+
});
|
|
105
|
+
const contentText = css({
|
|
106
|
+
color: variables.diffViewerColor,
|
|
107
|
+
whiteSpace: 'pre-wrap',
|
|
108
|
+
fontFamily: 'monospace',
|
|
109
|
+
textDecoration: 'none',
|
|
110
|
+
label: 'content-text',
|
|
111
|
+
});
|
|
112
|
+
const unselectable = css({
|
|
113
|
+
userSelect: 'none',
|
|
114
|
+
label: 'unselectable',
|
|
115
|
+
});
|
|
116
|
+
const titleBlock = css({
|
|
117
|
+
background: variables.diffViewerTitleBackground,
|
|
118
|
+
padding: '0.5em',
|
|
119
|
+
lineHeight: '1.4em',
|
|
120
|
+
height: "2.4em",
|
|
121
|
+
overflow: 'hidden',
|
|
122
|
+
width: '50%',
|
|
123
|
+
borderBottom: `1px solid ${variables.diffViewerTitleBorderColor}`,
|
|
124
|
+
label: 'title-block',
|
|
125
|
+
':last-child': {
|
|
126
|
+
borderLeft: `1px solid ${variables.diffViewerTitleBorderColor}`,
|
|
127
|
+
},
|
|
128
|
+
[`.${contentText}`]: {
|
|
129
|
+
color: variables.diffViewerTitleColor,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
const lineNumber = css({
|
|
133
|
+
color: variables.gutterColor,
|
|
134
|
+
label: 'line-number',
|
|
135
|
+
});
|
|
136
|
+
const diffRemoved = css({
|
|
137
|
+
background: variables.removedBackground,
|
|
138
|
+
color: variables.removedColor,
|
|
139
|
+
pre: {
|
|
140
|
+
color: variables.removedColor,
|
|
141
|
+
},
|
|
142
|
+
[`.${lineNumber}`]: {
|
|
143
|
+
color: variables.removedGutterColor,
|
|
144
|
+
},
|
|
145
|
+
label: 'diff-removed',
|
|
146
|
+
});
|
|
147
|
+
const diffAdded = css({
|
|
148
|
+
background: variables.addedBackground,
|
|
149
|
+
color: variables.addedColor,
|
|
150
|
+
pre: {
|
|
151
|
+
color: variables.addedColor,
|
|
152
|
+
},
|
|
153
|
+
[`.${lineNumber}`]: {
|
|
154
|
+
color: variables.addedGutterColor,
|
|
155
|
+
},
|
|
156
|
+
label: 'diff-added',
|
|
157
|
+
});
|
|
158
|
+
const diffChanged = css({
|
|
159
|
+
background: variables.changedBackground,
|
|
160
|
+
[`.${lineNumber}`]: {
|
|
161
|
+
color: variables.gutterColor,
|
|
162
|
+
},
|
|
163
|
+
label: 'diff-changed',
|
|
164
|
+
});
|
|
165
|
+
const wordDiff = css({
|
|
166
|
+
padding: 2,
|
|
167
|
+
display: 'inline-flex',
|
|
168
|
+
borderRadius: 4,
|
|
169
|
+
wordBreak: 'break-all',
|
|
170
|
+
label: 'word-diff',
|
|
171
|
+
});
|
|
172
|
+
const wordAdded = css({
|
|
173
|
+
background: variables.wordAddedBackground,
|
|
174
|
+
textDecoration: 'none',
|
|
175
|
+
label: 'word-added',
|
|
176
|
+
});
|
|
177
|
+
const wordRemoved = css({
|
|
178
|
+
background: variables.wordRemovedBackground,
|
|
179
|
+
textDecoration: 'none',
|
|
180
|
+
label: 'word-removed',
|
|
181
|
+
});
|
|
182
|
+
const codeFoldGutter = css({
|
|
183
|
+
backgroundColor: variables.codeFoldGutterBackground,
|
|
184
|
+
label: 'code-fold-gutter',
|
|
185
|
+
minWidth: '50px',
|
|
186
|
+
width: '50px'
|
|
187
|
+
});
|
|
188
|
+
const codeFoldContentContainer = css({
|
|
189
|
+
padding: '8px 16px'
|
|
190
|
+
});
|
|
191
|
+
const codeFoldContent = css({
|
|
192
|
+
color: variables.codeFoldContentColor,
|
|
193
|
+
label: 'code-fold-content',
|
|
194
|
+
});
|
|
195
|
+
const block = css({
|
|
196
|
+
display: 'block',
|
|
197
|
+
width: '10px',
|
|
198
|
+
height: '10px',
|
|
199
|
+
backgroundColor: '#ddd',
|
|
200
|
+
borderWidth: '1px',
|
|
201
|
+
borderStyle: 'solid',
|
|
202
|
+
borderColor: variables.diffViewerTitleBorderColor
|
|
203
|
+
});
|
|
204
|
+
const blockAddition = css({
|
|
205
|
+
backgroundColor: variables.wordAddedBackground
|
|
206
|
+
});
|
|
207
|
+
const blockDeletion = css({
|
|
208
|
+
backgroundColor: variables.wordRemovedBackground
|
|
209
|
+
});
|
|
210
|
+
const codeFold = css({
|
|
211
|
+
backgroundColor: variables.codeFoldBackground,
|
|
212
|
+
height: 40,
|
|
213
|
+
fontSize: 14,
|
|
214
|
+
alignItems: 'center',
|
|
215
|
+
userSelect: 'none',
|
|
216
|
+
fontWeight: 700,
|
|
217
|
+
label: 'code-fold',
|
|
218
|
+
a: {
|
|
219
|
+
textDecoration: 'underline !important',
|
|
220
|
+
cursor: 'pointer',
|
|
221
|
+
pre: {
|
|
222
|
+
display: 'inline',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
const emptyLine = css({
|
|
227
|
+
backgroundColor: variables.emptyLineBackground,
|
|
228
|
+
label: 'empty-line',
|
|
229
|
+
});
|
|
230
|
+
const marker = css({
|
|
231
|
+
width: 28,
|
|
232
|
+
paddingLeft: 10,
|
|
233
|
+
paddingRight: 10,
|
|
234
|
+
userSelect: 'none',
|
|
235
|
+
label: 'marker',
|
|
236
|
+
[`&.${diffAdded}`]: {
|
|
237
|
+
pre: {
|
|
238
|
+
color: variables.addedColor,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
[`&.${diffRemoved}`]: {
|
|
242
|
+
pre: {
|
|
243
|
+
color: variables.removedColor,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
const highlightedLine = css({
|
|
248
|
+
background: variables.highlightBackground,
|
|
249
|
+
label: 'highlighted-line',
|
|
250
|
+
[`.${wordAdded}, .${wordRemoved}`]: {
|
|
251
|
+
backgroundColor: 'initial',
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
const highlightedGutter = css({
|
|
255
|
+
label: 'highlighted-gutter',
|
|
256
|
+
});
|
|
257
|
+
const gutter = css({
|
|
258
|
+
userSelect: 'none',
|
|
259
|
+
minWidth: 50,
|
|
260
|
+
width: '50px',
|
|
261
|
+
padding: '0 10px',
|
|
262
|
+
whiteSpace: 'nowrap',
|
|
263
|
+
label: 'gutter',
|
|
264
|
+
textAlign: 'right',
|
|
265
|
+
background: variables.gutterBackground,
|
|
266
|
+
'&:hover': {
|
|
267
|
+
cursor: 'pointer',
|
|
268
|
+
background: variables.gutterBackgroundDark,
|
|
269
|
+
pre: {
|
|
270
|
+
opacity: 1,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
pre: {
|
|
274
|
+
opacity: 0.5,
|
|
275
|
+
},
|
|
276
|
+
[`&.${diffAdded}`]: {
|
|
277
|
+
background: variables.addedGutterBackground,
|
|
278
|
+
},
|
|
279
|
+
[`&.${diffRemoved}`]: {
|
|
280
|
+
background: variables.removedGutterBackground,
|
|
281
|
+
},
|
|
282
|
+
[`&.${highlightedGutter}`]: {
|
|
283
|
+
background: variables.highlightGutterBackground,
|
|
284
|
+
'&:hover': {
|
|
285
|
+
background: variables.highlightGutterBackground,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
const emptyGutter = css({
|
|
290
|
+
'&:hover': {
|
|
291
|
+
background: variables.gutterBackground,
|
|
292
|
+
cursor: 'initial',
|
|
293
|
+
},
|
|
294
|
+
label: 'empty-gutter',
|
|
295
|
+
});
|
|
296
|
+
const line = css({
|
|
297
|
+
verticalAlign: 'baseline',
|
|
298
|
+
label: 'line',
|
|
299
|
+
textDecoration: 'none'
|
|
300
|
+
});
|
|
301
|
+
const column = css({});
|
|
302
|
+
const defaultStyles = {
|
|
303
|
+
diffContainer,
|
|
304
|
+
diffRemoved,
|
|
305
|
+
diffAdded,
|
|
306
|
+
diffChanged,
|
|
307
|
+
splitView,
|
|
308
|
+
marker,
|
|
309
|
+
highlightedGutter,
|
|
310
|
+
highlightedLine,
|
|
311
|
+
gutter,
|
|
312
|
+
line,
|
|
313
|
+
lineContent,
|
|
314
|
+
wordDiff,
|
|
315
|
+
wordAdded,
|
|
316
|
+
summary,
|
|
317
|
+
block,
|
|
318
|
+
blockAddition,
|
|
319
|
+
blockDeletion,
|
|
320
|
+
wordRemoved,
|
|
321
|
+
noSelect: unselectable,
|
|
322
|
+
codeFoldGutter,
|
|
323
|
+
codeFoldContentContainer,
|
|
324
|
+
codeFold,
|
|
325
|
+
emptyGutter,
|
|
326
|
+
emptyLine,
|
|
327
|
+
lineNumber,
|
|
328
|
+
contentText,
|
|
329
|
+
content,
|
|
330
|
+
column,
|
|
331
|
+
codeFoldContent,
|
|
332
|
+
titleBlock,
|
|
333
|
+
};
|
|
334
|
+
const computerOverrideStyles = Object.keys(styles).reduce((acc, key) => ({
|
|
335
|
+
...acc,
|
|
336
|
+
...{
|
|
337
|
+
[key]: css(styles[key]),
|
|
338
|
+
},
|
|
339
|
+
}), {});
|
|
340
|
+
return Object.keys(defaultStyles).reduce((acc, key) => ({
|
|
341
|
+
...acc,
|
|
342
|
+
...{
|
|
343
|
+
[key]: computerOverrideStyles[key]
|
|
344
|
+
? cx(defaultStyles[key], computerOverrideStyles[key])
|
|
345
|
+
: defaultStyles[key],
|
|
346
|
+
},
|
|
347
|
+
}), {});
|
|
348
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-diff-viewer-continued",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Continuation of a simple and beautiful text diff viewer component made with diff and React",
|
|
6
6
|
"keywords": [
|
|
@@ -19,76 +19,46 @@
|
|
|
19
19
|
"Pranesh Ravi<praneshpranesh@gmail.com>",
|
|
20
20
|
"Bart Riepe <bart@serial-experiments.com>"
|
|
21
21
|
],
|
|
22
|
-
"main": "lib/src/index",
|
|
23
|
-
"
|
|
22
|
+
"main": "lib/cjs/src/index",
|
|
23
|
+
"module": "lib/esm/src/index",
|
|
24
|
+
"typings": "lib/cjs/src/index",
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "tsc --
|
|
26
|
-
"build:examples": "
|
|
27
|
-
"build:watch": "tsc --outDir lib/ -w",
|
|
26
|
+
"build": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json",
|
|
27
|
+
"build:examples": "vite build examples",
|
|
28
28
|
"publish:examples": "NODE_ENV=production pnpm run build:examples && gh-pages -d examples/dist -r $GITHUB_REPO_URL",
|
|
29
29
|
"publish:examples:local": "NODE_ENV=production pnpm run build:examples && gh-pages -d examples/dist",
|
|
30
|
-
"start:examples": "
|
|
31
|
-
"test": "
|
|
32
|
-
"
|
|
33
|
-
"lint": "
|
|
34
|
-
"lint:fix": "eslint --fix src/ test/",
|
|
30
|
+
"start:examples": "vite examples",
|
|
31
|
+
"test": "vitest",
|
|
32
|
+
"lint": "biome lint src/ test/",
|
|
33
|
+
"lint:fix": "biome lint --apply-unsafe src/ test/",
|
|
35
34
|
"prettier": "prettier --write ."
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@emotion/css": "^11.11.2",
|
|
39
38
|
"classnames": "^2.3.2",
|
|
40
|
-
"diff": "^5.
|
|
41
|
-
"memoize-one": "^6.0.0"
|
|
42
|
-
"prop-types": "^15.8.1"
|
|
39
|
+
"diff": "^5.2.0",
|
|
40
|
+
"memoize-one": "^6.0.0"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@babel/preset-env": "^7.23.2",
|
|
47
|
-
"@babel/preset-react": "^7.22.15",
|
|
48
|
-
"@babel/preset-typescript": "^7.23.2",
|
|
43
|
+
"@biomejs/biome": "^1.5.3",
|
|
49
44
|
"@semantic-release/changelog": "6.0.1",
|
|
50
45
|
"@semantic-release/git": "10.0.1",
|
|
51
46
|
"@testing-library/react": "^13.4.0",
|
|
52
47
|
"@types/diff": "^5.0.6",
|
|
53
|
-
"@types/
|
|
54
|
-
"@types/
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"@types/react-dom": "^16.9.20",
|
|
60
|
-
"@types/webpack": "^4.41.34",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
62
|
-
"@typescript-eslint/parser": "^5.62.0",
|
|
63
|
-
"css-loader": "^6.8.1",
|
|
64
|
-
"eslint": "^8.51.0",
|
|
65
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
66
|
-
"eslint-plugin-import": "^2.28.1",
|
|
67
|
-
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
68
|
-
"eslint-plugin-react": "^7.33.2",
|
|
69
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
70
|
-
"expect": "^28.1.3",
|
|
71
|
-
"file-loader": "^6.2.0",
|
|
72
|
-
"gh-pages": "^4.0.0",
|
|
73
|
-
"html-webpack-plugin": "^5.5.3",
|
|
74
|
-
"jest": "^28.1.3",
|
|
75
|
-
"jest-environment-jsdom": "^28.1.3",
|
|
76
|
-
"mini-css-extract-plugin": "^2.7.6",
|
|
77
|
-
"mocha": "^10.2.0",
|
|
78
|
-
"prettier": "^2.8.8",
|
|
79
|
-
"raw-loader": "^4.0.2",
|
|
48
|
+
"@types/memoize-one": "^5.1.2",
|
|
49
|
+
"@types/node": "^20.11.17",
|
|
50
|
+
"@types/react": "^18.2.55",
|
|
51
|
+
"@types/react-dom": "^18.2.19",
|
|
52
|
+
"gh-pages": "^5.0.0",
|
|
53
|
+
"happy-dom": "^13.3.8",
|
|
80
54
|
"react": "^18.2.0",
|
|
81
55
|
"react-dom": "^18.2.0",
|
|
82
|
-
"sass": "^1.
|
|
83
|
-
"sass-loader": "^13.3.2",
|
|
56
|
+
"sass": "^1.70.0",
|
|
84
57
|
"semantic-release": "^19.0.5",
|
|
85
|
-
"spy": "^1.0.0",
|
|
86
|
-
"ts-loader": "^9.5.0",
|
|
87
58
|
"ts-node": "^10.9.1",
|
|
88
59
|
"typescript": "^5.2.2",
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"webpack-dev-server": "^4.15.1"
|
|
60
|
+
"vite": "^5.1.1",
|
|
61
|
+
"vitest": "^1.2.2"
|
|
92
62
|
},
|
|
93
63
|
"peerDependencies": {
|
|
94
64
|
"react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0",
|
package/tsconfig.json
CHANGED
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
"moduleResolution": "node",
|
|
7
7
|
"noImplicitAny": true,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
9
12
|
"target": "es2015",
|
|
10
13
|
"declaration": true,
|
|
11
14
|
"downlevelIteration": true,
|
|
12
15
|
"lib": ["es2017", "dom"],
|
|
13
|
-
"types": ["
|
|
16
|
+
"types": ["node"],
|
|
17
|
+
"outDir": "lib/cjs"
|
|
14
18
|
},
|
|
15
19
|
"include": ["src/", "examples/"],
|
|
16
20
|
"exclude": ["node_modules"]
|
package/vitest.config.ts
ADDED
package/.eslintrc
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended"],
|
|
3
|
-
"rules": {
|
|
4
|
-
"@typescript-eslint/indent": ["error", 2],
|
|
5
|
-
"arrow-body-style": "off",
|
|
6
|
-
"import/extensions": "off"
|
|
7
|
-
},
|
|
8
|
-
"env": {
|
|
9
|
-
"mocha": true,
|
|
10
|
-
"node": true,
|
|
11
|
-
"browser": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
name: Test
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
pull_request:
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
release:
|
|
8
|
-
name: Unit tests
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- name: Checkout
|
|
12
|
-
uses: actions/checkout@v3
|
|
13
|
-
with:
|
|
14
|
-
fetch-depth: 0
|
|
15
|
-
- name: Setup Node.js
|
|
16
|
-
uses: actions/setup-node@v3
|
|
17
|
-
with:
|
|
18
|
-
node-version: 'lts/*'
|
|
19
|
-
- uses: pnpm/action-setup@v2.2.4
|
|
20
|
-
with:
|
|
21
|
-
version: latest
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: pnpm i
|
|
24
|
-
- name: Run unit tests
|
|
25
|
-
run: pnpm run test
|
package/.prettierrc
DELETED
package/jest.config.js
DELETED
package/lib/src/expand.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function Expand(): JSX.Element;
|
package/lib/src/fold.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function Fold(): JSX.Element;
|
package/webpack.config.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
3
|
-
const Css = require('mini-css-extract-plugin');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
entry: {
|
|
7
|
-
main: './examples/src/index.tsx',
|
|
8
|
-
},
|
|
9
|
-
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
|
10
|
-
resolve: {
|
|
11
|
-
extensions: ['.jsx', '.tsx', '.ts', '.scss', '.css', '.js'],
|
|
12
|
-
},
|
|
13
|
-
output: {
|
|
14
|
-
path: path.resolve(__dirname, 'examples/dist'),
|
|
15
|
-
filename: '[name].js',
|
|
16
|
-
},
|
|
17
|
-
devServer: {
|
|
18
|
-
static: {
|
|
19
|
-
directory: path.resolve(__dirname, 'examples/dist'),
|
|
20
|
-
},
|
|
21
|
-
port: 8000,
|
|
22
|
-
hot: true,
|
|
23
|
-
},
|
|
24
|
-
module: {
|
|
25
|
-
rules: [
|
|
26
|
-
{
|
|
27
|
-
test: /\.tsx?$/,
|
|
28
|
-
use: [
|
|
29
|
-
{
|
|
30
|
-
loader: 'ts-loader',
|
|
31
|
-
options: {
|
|
32
|
-
configFile: 'tsconfig.json',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
exclude: /node_modules/,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
test: /\.s?css$/,
|
|
40
|
-
use: [Css.loader, 'css-loader', 'sass-loader'],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
test: /\.xml|.rjs|.java/,
|
|
44
|
-
use: 'raw-loader',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
test: /\.svg|.png/,
|
|
48
|
-
use: 'file-loader',
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
plugins: [
|
|
53
|
-
new HtmlWebpackPlugin({
|
|
54
|
-
template: './examples/src/index.ejs',
|
|
55
|
-
}),
|
|
56
|
-
new Css({
|
|
57
|
-
filename: 'main.css',
|
|
58
|
-
}),
|
|
59
|
-
],
|
|
60
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|