@mui/docs 6.0.0-alpha.9 → 6.0.0-beta.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/CHANGELOG.md +331 -3
- package/HighlightedCode/HighlightedCode.d.ts +1 -1
- package/HighlightedCode/HighlightedCode.js +5 -2
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +29 -0
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +353 -0
- package/HighlightedCodeWithTabs/index.d.ts +2 -0
- package/HighlightedCodeWithTabs/index.js +2 -0
- package/HighlightedCodeWithTabs/package.json +6 -0
- package/Link/Link.js +0 -2
- package/MarkdownElement/MarkdownElement.js +129 -104
- package/branding/BrandingProvider.d.ts +1 -1
- package/branding/brandingTheme.js +57 -24
- package/i18n/i18n.js +9 -6
- package/node/HighlightedCode/HighlightedCode.js +5 -2
- package/node/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +363 -0
- package/node/HighlightedCodeWithTabs/index.js +24 -0
- package/node/Link/Link.js +0 -2
- package/node/MarkdownElement/MarkdownElement.js +129 -104
- package/node/branding/brandingTheme.js +57 -24
- package/node/i18n/i18n.js +9 -6
- package/node/translations/translations.json +1 -1
- package/package.json +4 -3
- package/translations/translations.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { alpha, darken, styled } from '@mui/material/styles';
|
|
4
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
4
5
|
import { brandingDarkTheme as darkTheme, brandingLightTheme as lightTheme } from '../branding';
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
const Root = styled('div')(({
|
|
7
8
|
theme
|
|
8
9
|
}) => ({
|
|
9
10
|
...lightTheme.typography.body1,
|
|
10
|
-
lineHeight: 1.
|
|
11
|
-
//
|
|
11
|
+
lineHeight: 1.625,
|
|
12
|
+
// Rounds up to 26px-increased compared to the 1.5 default to make the docs easier to read.
|
|
12
13
|
color: `var(--muidocs-palette-text-primary, ${lightTheme.palette.text.primary})`,
|
|
13
14
|
'& :focus-visible': {
|
|
14
15
|
outline: `3px solid ${alpha(lightTheme.palette.primary[500], 0.5)}`,
|
|
@@ -23,7 +24,7 @@ const Root = styled('div')(({
|
|
|
23
24
|
// Developers like when the code is dense.
|
|
24
25
|
margin: theme.spacing(2, 'auto'),
|
|
25
26
|
padding: theme.spacing(2),
|
|
26
|
-
backgroundColor: 'hsl(210,
|
|
27
|
+
backgroundColor: 'hsl(210, 25%, 9%)',
|
|
27
28
|
// a special, one-off, color tailored for the code blocks using MUI's branding theme blue palette as the starting point. It has a less saturaded color but still maintaining a bit of the blue tint.
|
|
28
29
|
color: 'hsl(60, 30%, 96%)',
|
|
29
30
|
colorScheme: 'dark',
|
|
@@ -122,6 +123,44 @@ const Root = styled('div')(({
|
|
|
122
123
|
marginBottom: 6
|
|
123
124
|
}
|
|
124
125
|
},
|
|
126
|
+
'& a[target="_blank"]::after': {
|
|
127
|
+
content: '""',
|
|
128
|
+
maskImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' focusable='false' aria-hidden='true' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z'%3E%3C/path%3E%3C/svg%3E")`,
|
|
129
|
+
display: 'inline-flex',
|
|
130
|
+
width: '1em',
|
|
131
|
+
height: '1em',
|
|
132
|
+
color: 'inherit',
|
|
133
|
+
backgroundColor: 'currentColor',
|
|
134
|
+
transform: 'translate(0, 2px)',
|
|
135
|
+
transition: 'transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1)',
|
|
136
|
+
// bounce effect
|
|
137
|
+
opacity: 0.8
|
|
138
|
+
},
|
|
139
|
+
'& a[target="_blank"]:hover::after': {
|
|
140
|
+
opacity: 1,
|
|
141
|
+
transform: 'translate(1px, 0)'
|
|
142
|
+
},
|
|
143
|
+
'& a.remove-link-arrow::after': {
|
|
144
|
+
// Allows to remove link arrows for images
|
|
145
|
+
display: 'none'
|
|
146
|
+
},
|
|
147
|
+
'& .Ad-root a::after': {
|
|
148
|
+
// Remove link arrow for ads
|
|
149
|
+
display: 'none'
|
|
150
|
+
},
|
|
151
|
+
'& a': {
|
|
152
|
+
// Style taken from the Link component
|
|
153
|
+
color: `var(--muidocs-palette-primary-600, ${lightTheme.palette.primary[600]})`,
|
|
154
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
155
|
+
textDecoration: 'underline',
|
|
156
|
+
textDecorationColor: alpha(lightTheme.palette.primary.main, 0.4),
|
|
157
|
+
'&:hover': {
|
|
158
|
+
textDecorationColor: 'inherit'
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
'& a code': {
|
|
162
|
+
color: darken(lightTheme.palette.primary.main, 0.2)
|
|
163
|
+
},
|
|
125
164
|
'& h1, & h2, & h3, & h4': {
|
|
126
165
|
display: 'flex',
|
|
127
166
|
alignItems: 'center',
|
|
@@ -135,9 +174,12 @@ const Root = styled('div')(({
|
|
|
135
174
|
'& .title-link-to-anchor': {
|
|
136
175
|
color: 'inherit',
|
|
137
176
|
textDecoration: 'none',
|
|
177
|
+
boxShadow: 'none',
|
|
178
|
+
fontWeight: 'inherit',
|
|
138
179
|
position: 'relative',
|
|
139
180
|
display: 'flex',
|
|
140
|
-
alignItems: 'center'
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
userSelect: 'text'
|
|
141
183
|
},
|
|
142
184
|
'& .anchor-icon': {
|
|
143
185
|
// To prevent the link to get the focus.
|
|
@@ -145,12 +187,6 @@ const Root = styled('div')(({
|
|
|
145
187
|
alignItems: 'center',
|
|
146
188
|
visibility: 'hidden'
|
|
147
189
|
},
|
|
148
|
-
'& a:not(.title-link-to-anchor):hover': {
|
|
149
|
-
color: 'currentColor',
|
|
150
|
-
border: 'none',
|
|
151
|
-
boxShadow: '0 1px 0 0 currentColor',
|
|
152
|
-
textDecoration: 'none'
|
|
153
|
-
},
|
|
154
190
|
'& .anchor-icon, & .comment-link': {
|
|
155
191
|
padding: 0,
|
|
156
192
|
cursor: 'pointer',
|
|
@@ -161,11 +197,13 @@ const Root = styled('div')(({
|
|
|
161
197
|
marginLeft: 8,
|
|
162
198
|
height: 26,
|
|
163
199
|
width: 26,
|
|
164
|
-
backgroundColor: `var(--muidocs-palette-primary-50, ${lightTheme.palette.grey[50]})`,
|
|
165
200
|
color: `var(--muidocs-palette-grey-600, ${lightTheme.palette.grey[600]})`,
|
|
166
|
-
|
|
167
|
-
|
|
201
|
+
backgroundColor: 'transparent',
|
|
202
|
+
border: '1px solid transparent',
|
|
168
203
|
borderRadius: 8,
|
|
204
|
+
transition: theme.transitions.create(['visibility', 'background-color', 'color', 'border-color'], {
|
|
205
|
+
duration: theme.transitions.duration.shortest
|
|
206
|
+
}),
|
|
169
207
|
'&:hover': {
|
|
170
208
|
backgroundColor: alpha(lightTheme.palette.primary[100], 0.4),
|
|
171
209
|
borderColor: `var(--muidocs-palette-primary-100, ${lightTheme.palette.primary[100]})`,
|
|
@@ -186,7 +224,7 @@ const Root = styled('div')(({
|
|
|
186
224
|
display: 'none',
|
|
187
225
|
// So we can have the comment button opt-in.
|
|
188
226
|
marginLeft: 'auto',
|
|
189
|
-
transition: theme.transitions.create('
|
|
227
|
+
transition: theme.transitions.create(['background-color', 'color', 'border-color'], {
|
|
190
228
|
duration: theme.transitions.duration.shortest
|
|
191
229
|
}),
|
|
192
230
|
'& svg': {
|
|
@@ -284,44 +322,58 @@ const Root = styled('div')(({
|
|
|
284
322
|
},
|
|
285
323
|
'& .MuiCallout-root': {
|
|
286
324
|
display: 'flex',
|
|
287
|
-
gap:
|
|
288
|
-
padding: '
|
|
325
|
+
gap: '8px',
|
|
326
|
+
padding: '12px',
|
|
289
327
|
margin: '16px 0',
|
|
290
328
|
border: '1px solid',
|
|
291
329
|
color: `var(--muidocs-palette-text-secondary, ${lightTheme.palette.text.secondary})`,
|
|
292
330
|
borderColor: `var(--muidocs-palette-grey-100, ${lightTheme.palette.grey[100]})`,
|
|
293
331
|
borderRadius: `var(--muidocs-shape-borderRadius, ${theme.shape?.borderRadius ?? lightTheme.shape.borderRadius}px)`,
|
|
294
|
-
'&
|
|
332
|
+
'& .MuiCallout-content': {
|
|
333
|
+
minWidth: 0,
|
|
334
|
+
// Allows content to shrink. Useful when callout contains code block
|
|
335
|
+
flexGrow: 1
|
|
336
|
+
},
|
|
337
|
+
'& code': {
|
|
295
338
|
height: 'fit-content',
|
|
296
339
|
backgroundColor: `var(--muidocs-palette-grey-100, ${lightTheme.palette.grey[100]})`,
|
|
297
340
|
borderColor: `var(--muidocs-palette-grey-300, ${lightTheme.palette.grey[300]})`
|
|
298
341
|
},
|
|
299
|
-
'&
|
|
300
|
-
|
|
301
|
-
// Allows content to shrink. Useful when callout contains code block
|
|
302
|
-
flexGrow: 1,
|
|
342
|
+
'& p': {
|
|
343
|
+
marginBottom: '8px',
|
|
303
344
|
'& > p:last-child, & > ul:last-child': {
|
|
304
345
|
// Avoid margin on last child
|
|
305
346
|
marginBottom: 0
|
|
306
347
|
},
|
|
307
|
-
'& .MuiCode-root': {
|
|
308
|
-
'& > pre': {
|
|
309
|
-
margin: 0,
|
|
310
|
-
marginTop: 4
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
348
|
'& > ul': {
|
|
314
349
|
// Because of the gap left by the icon, we visually need less padding
|
|
315
350
|
paddingLeft: 22
|
|
316
351
|
}
|
|
317
352
|
},
|
|
318
|
-
'&
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
353
|
+
'& .MuiCode-root': {
|
|
354
|
+
'& pre': {
|
|
355
|
+
margin: '4px 0 0 0',
|
|
356
|
+
borderRadius: '12px 12px 6px 12px',
|
|
357
|
+
borderColor: alpha(lightTheme.palette.primaryDark[600], 0.6),
|
|
358
|
+
'& code': {
|
|
359
|
+
backgroundColor: 'transparent'
|
|
360
|
+
}
|
|
361
|
+
}
|
|
323
362
|
},
|
|
324
|
-
'&
|
|
363
|
+
'& .MuiCallout-icon-container': {
|
|
364
|
+
width: 26,
|
|
365
|
+
// to match text's line-height
|
|
366
|
+
height: 26,
|
|
367
|
+
display: 'flex',
|
|
368
|
+
alignItems: 'center',
|
|
369
|
+
justifyContent: 'center',
|
|
370
|
+
flexShrink: 0,
|
|
371
|
+
'& svg': {
|
|
372
|
+
width: 18,
|
|
373
|
+
height: 18
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
'& ul, & p': {
|
|
325
377
|
'&:last-child': {
|
|
326
378
|
margin: 0
|
|
327
379
|
}
|
|
@@ -336,7 +388,7 @@ const Root = styled('div')(({
|
|
|
336
388
|
'& strong': {
|
|
337
389
|
color: `var(--muidocs-palette-error-800, ${lightTheme.palette.error[800]})`
|
|
338
390
|
},
|
|
339
|
-
'&
|
|
391
|
+
'& svg': {
|
|
340
392
|
fill: `var(--muidocs-palette-error-500, ${lightTheme.palette.error[600]})`
|
|
341
393
|
},
|
|
342
394
|
'& a': {
|
|
@@ -354,7 +406,7 @@ const Root = styled('div')(({
|
|
|
354
406
|
'& strong': {
|
|
355
407
|
color: `var(--muidocs-palette-primary-800, ${lightTheme.palette.primary[800]})`
|
|
356
408
|
},
|
|
357
|
-
'&
|
|
409
|
+
'& svg': {
|
|
358
410
|
fill: `var(--muidocs-palette-grey-600, ${lightTheme.palette.grey[600]})`
|
|
359
411
|
}
|
|
360
412
|
},
|
|
@@ -365,7 +417,7 @@ const Root = styled('div')(({
|
|
|
365
417
|
'& strong': {
|
|
366
418
|
color: `var(--muidocs-palette-success-900, ${lightTheme.palette.success[900]})`
|
|
367
419
|
},
|
|
368
|
-
'&
|
|
420
|
+
'& svg': {
|
|
369
421
|
fill: `var(--muidocs-palette-success-600, ${lightTheme.palette.success[600]})`
|
|
370
422
|
},
|
|
371
423
|
'& a': {
|
|
@@ -383,7 +435,7 @@ const Root = styled('div')(({
|
|
|
383
435
|
'& strong': {
|
|
384
436
|
color: `var(--muidocs-palette-warning-800, ${lightTheme.palette.warning[800]})`
|
|
385
437
|
},
|
|
386
|
-
'&
|
|
438
|
+
'& svg': {
|
|
387
439
|
fill: `var(--muidocs-palette-warning-600, ${lightTheme.palette.warning[600]})`
|
|
388
440
|
},
|
|
389
441
|
'& a': {
|
|
@@ -395,47 +447,6 @@ const Root = styled('div')(({
|
|
|
395
447
|
}
|
|
396
448
|
}
|
|
397
449
|
},
|
|
398
|
-
'& a[target="_blank"]::after': {
|
|
399
|
-
content: '""',
|
|
400
|
-
maskImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' focusable='false' aria-hidden='true' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z'%3E%3C/path%3E%3C/svg%3E")`,
|
|
401
|
-
display: 'inline-flex',
|
|
402
|
-
width: '1em',
|
|
403
|
-
height: '1em',
|
|
404
|
-
color: 'inherit',
|
|
405
|
-
backgroundColor: 'currentColor',
|
|
406
|
-
transform: 'translate(0, 2px)',
|
|
407
|
-
transition: 'transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1)',
|
|
408
|
-
// bounce effect
|
|
409
|
-
opacity: 0.8
|
|
410
|
-
},
|
|
411
|
-
'& a[target="_blank"]:hover::after': {
|
|
412
|
-
opacity: 1,
|
|
413
|
-
transform: 'translate(1px, 0)'
|
|
414
|
-
},
|
|
415
|
-
'& a.remove-link-arrow::after': {
|
|
416
|
-
// Allows to remove link arrows for images
|
|
417
|
-
display: 'none'
|
|
418
|
-
},
|
|
419
|
-
'& .Ad-root a::after': {
|
|
420
|
-
// Remove link arrow for ads
|
|
421
|
-
display: 'none'
|
|
422
|
-
},
|
|
423
|
-
'& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': {
|
|
424
|
-
// Style taken from the Link component
|
|
425
|
-
color: `var(--muidocs-palette-primary-600, ${lightTheme.palette.primary[600]})`,
|
|
426
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
427
|
-
textDecoration: 'underline',
|
|
428
|
-
textDecorationColor: alpha(lightTheme.palette.primary.main, 0.4),
|
|
429
|
-
'&:hover': {
|
|
430
|
-
textDecorationColor: 'inherit'
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
'& a code': {
|
|
434
|
-
color: darken(lightTheme.palette.primary.main, 0.04)
|
|
435
|
-
},
|
|
436
|
-
'& a:not(.title-link-to-anchor) code': {
|
|
437
|
-
color: darken(lightTheme.palette.primary.main, 0.2)
|
|
438
|
-
},
|
|
439
450
|
'& img, & video': {
|
|
440
451
|
// Use !important so that inline style on <img> or <video> can't win.
|
|
441
452
|
// This avoid horizontal overflows on mobile.
|
|
@@ -539,7 +550,6 @@ const Root = styled('div')(({
|
|
|
539
550
|
display: 'inline-flex',
|
|
540
551
|
flexDirection: 'row-reverse',
|
|
541
552
|
alignItems: 'center',
|
|
542
|
-
height: 24,
|
|
543
553
|
padding: theme.spacing(0.5),
|
|
544
554
|
paddingBottom: '5px',
|
|
545
555
|
// optical alignment
|
|
@@ -550,7 +560,7 @@ const Root = styled('div')(({
|
|
|
550
560
|
border: '1px solid',
|
|
551
561
|
borderColor: alpha(lightTheme.palette.primaryDark[600], 0.5),
|
|
552
562
|
backgroundColor: alpha(lightTheme.palette.primaryDark[800], 0.5),
|
|
553
|
-
color: `var(--muidocs-palette-grey-
|
|
563
|
+
color: `var(--muidocs-palette-grey-300, ${lightTheme.palette.grey[300]})`,
|
|
554
564
|
transition: theme.transitions.create(['background', 'borderColor', 'display'], {
|
|
555
565
|
duration: theme.transitions.duration.shortest
|
|
556
566
|
}),
|
|
@@ -663,24 +673,26 @@ const Root = styled('div')(({
|
|
|
663
673
|
'& hr': {
|
|
664
674
|
backgroundColor: `var(--muidocs-palette-divider, ${darkTheme.palette.divider})`
|
|
665
675
|
},
|
|
666
|
-
'&
|
|
667
|
-
color: `var(--muidocs-palette-
|
|
676
|
+
'& a': {
|
|
677
|
+
color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primary[300]})`
|
|
668
678
|
},
|
|
669
|
-
'&
|
|
670
|
-
color: `var(--muidocs-palette-
|
|
679
|
+
'& a code': {
|
|
680
|
+
color: `var(--muidocs-palette-primary-light, ${darkTheme.palette.primary.light})`
|
|
671
681
|
},
|
|
672
|
-
'& h1, & h2, & h3, & h4': {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
backgroundColor: alpha(darkTheme.palette.primaryDark[700], 0.5),
|
|
682
|
+
'& h1, & h2, & h3, & h4, & h5': {
|
|
683
|
+
color: `var(--muidocs-palette-grey-50, ${darkTheme.palette.grey[50]})`,
|
|
684
|
+
'& .anchor-icon, & .comment-link': {
|
|
685
|
+
color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primaryDark[400]})`,
|
|
677
686
|
'&:hover': {
|
|
687
|
+
color: `var(--muidocs-palette-primary-100, ${darkTheme.palette.primary[100]})`,
|
|
678
688
|
borderColor: `var(--muidocs-palette-primary-900, ${darkTheme.palette.primary[900]})`,
|
|
679
|
-
backgroundColor: alpha(darkTheme.palette.primary[900], 0.6)
|
|
680
|
-
color: `var(--muidocs-palette-primary-100, ${darkTheme.palette.primary[100]})`
|
|
689
|
+
backgroundColor: alpha(darkTheme.palette.primary[900], 0.6)
|
|
681
690
|
}
|
|
682
691
|
}
|
|
683
692
|
},
|
|
693
|
+
'& p, & ul, & ol': {
|
|
694
|
+
color: `var(--muidocs-palette-grey-400, ${darkTheme.palette.grey[400]})`
|
|
695
|
+
},
|
|
684
696
|
'& h1 code, & h2 code, & h3 code': {
|
|
685
697
|
color: `var(--muidocs-palette-grey-100, ${darkTheme.palette.grey[100]})`
|
|
686
698
|
},
|
|
@@ -714,8 +726,7 @@ const Root = styled('div')(({
|
|
|
714
726
|
},
|
|
715
727
|
'& .MuiCallout-root': {
|
|
716
728
|
borderColor: `var(--muidocs-palette-primaryDark-700, ${darkTheme.palette.primaryDark[700]})`,
|
|
717
|
-
'&
|
|
718
|
-
height: 'fit-content',
|
|
729
|
+
'& code': {
|
|
719
730
|
backgroundColor: `var(--muidocs-palette-primaryDark-600, ${darkTheme.palette.primaryDark[600]})`,
|
|
720
731
|
borderColor: `var(--muidocs-palette-primaryDark-500, ${darkTheme.palette.primaryDark[500]})`
|
|
721
732
|
},
|
|
@@ -726,7 +737,7 @@ const Root = styled('div')(({
|
|
|
726
737
|
'& strong': {
|
|
727
738
|
color: `var(--muidocs-palette-error-300, ${darkTheme.palette.error[300]})`
|
|
728
739
|
},
|
|
729
|
-
'&
|
|
740
|
+
'& svg': {
|
|
730
741
|
fill: `var(--muidocs-palette-error-500, ${darkTheme.palette.error[500]})`
|
|
731
742
|
},
|
|
732
743
|
'& a': {
|
|
@@ -740,7 +751,7 @@ const Root = styled('div')(({
|
|
|
740
751
|
'& strong': {
|
|
741
752
|
color: `var(--muidocs-palette-primary-200, ${darkTheme.palette.primary[200]})`
|
|
742
753
|
},
|
|
743
|
-
'&
|
|
754
|
+
'& svg': {
|
|
744
755
|
fill: `var(--muidocs-palette-grey-400, ${darkTheme.palette.grey[400]})`
|
|
745
756
|
}
|
|
746
757
|
},
|
|
@@ -751,7 +762,7 @@ const Root = styled('div')(({
|
|
|
751
762
|
'& strong': {
|
|
752
763
|
color: `var(--muidocs-palette-success-200, ${darkTheme.palette.success[200]})`
|
|
753
764
|
},
|
|
754
|
-
'&
|
|
765
|
+
'& svg': {
|
|
755
766
|
fill: `var(--muidocs-palette-success-500, ${darkTheme.palette.success[500]})`
|
|
756
767
|
},
|
|
757
768
|
'& a': {
|
|
@@ -765,7 +776,7 @@ const Root = styled('div')(({
|
|
|
765
776
|
'& strong': {
|
|
766
777
|
color: `var(--muidocs-palette-warning-200, ${darkTheme.palette.warning[200]})`
|
|
767
778
|
},
|
|
768
|
-
'&
|
|
779
|
+
'& svg': {
|
|
769
780
|
fill: `var(--muidocs-palette-warning-400, ${darkTheme.palette.warning[400]})`
|
|
770
781
|
},
|
|
771
782
|
'& a': {
|
|
@@ -773,12 +784,6 @@ const Root = styled('div')(({
|
|
|
773
784
|
}
|
|
774
785
|
}
|
|
775
786
|
},
|
|
776
|
-
'& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': {
|
|
777
|
-
color: `var(--muidocs-palette-primary-300, ${darkTheme.palette.primary[300]})`
|
|
778
|
-
},
|
|
779
|
-
'& a:not(.title-link-to-anchor) code': {
|
|
780
|
-
color: `var(--muidocs-palette-primary-light, ${darkTheme.palette.primary.light})`
|
|
781
|
-
},
|
|
782
787
|
'& kbd.key': {
|
|
783
788
|
color: `var(--muidocs-palette-text-primary, ${darkTheme.palette.text.primary})`,
|
|
784
789
|
backgroundColor: `var(--muidocs-palette-primaryDark-800, ${darkTheme.palette.primaryDark[800]})`,
|
|
@@ -802,12 +807,32 @@ const Root = styled('div')(({
|
|
|
802
807
|
}
|
|
803
808
|
}
|
|
804
809
|
}));
|
|
810
|
+
function handleHeaderClick(event) {
|
|
811
|
+
const selection = document.getSelection();
|
|
812
|
+
if (selection === null) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (selection.type === 'Range') {
|
|
816
|
+
// Disable the <a> behavior to be able to select text.
|
|
817
|
+
event.preventDefault();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
805
820
|
export const MarkdownElement = /*#__PURE__*/React.forwardRef(function MarkdownElement(props, ref) {
|
|
806
821
|
const {
|
|
807
822
|
className,
|
|
808
823
|
renderedMarkdown,
|
|
809
824
|
...other
|
|
810
825
|
} = props;
|
|
826
|
+
const rootRef = React.useRef(null);
|
|
827
|
+
const handleRef = useForkRef(rootRef, ref);
|
|
828
|
+
React.useEffect(() => {
|
|
829
|
+
const elements = rootRef.current.getElementsByClassName('title-link-to-anchor');
|
|
830
|
+
for (let i = 0; i < elements.length; i += 1) {
|
|
831
|
+
// More reliable than `-webkit-user-drag` (https://caniuse.com/webkit-user-drag)
|
|
832
|
+
elements[i].setAttribute('draggable', 'false');
|
|
833
|
+
elements[i].addEventListener('click', handleHeaderClick);
|
|
834
|
+
}
|
|
835
|
+
}, []);
|
|
811
836
|
const more = {};
|
|
812
837
|
if (typeof renderedMarkdown === 'string') {
|
|
813
838
|
// workaround for https://github.com/facebook/react/issues/17170
|
|
@@ -820,6 +845,6 @@ export const MarkdownElement = /*#__PURE__*/React.forwardRef(function MarkdownEl
|
|
|
820
845
|
className: clsx('markdown-body', className),
|
|
821
846
|
...more,
|
|
822
847
|
...other,
|
|
823
|
-
ref:
|
|
848
|
+
ref: handleRef
|
|
824
849
|
});
|
|
825
850
|
});
|
|
@@ -4,6 +4,6 @@ export interface BrandingProviderProps {
|
|
|
4
4
|
/**
|
|
5
5
|
* If not `undefined`, the provider is considered nesting and does not render NextNProgressBar & CssBaseline
|
|
6
6
|
*/
|
|
7
|
-
mode
|
|
7
|
+
mode?: 'light' | 'dark';
|
|
8
8
|
}
|
|
9
9
|
export declare function BrandingProvider(props: BrandingProviderProps): React.JSX.Element;
|
|
@@ -440,7 +440,7 @@ export function getThemedComponents() {
|
|
|
440
440
|
...theme.typography.body1,
|
|
441
441
|
lineHeight: 21 / 16,
|
|
442
442
|
padding: theme.spacing('8px', '10px', '10px', '12px'),
|
|
443
|
-
fontWeight: theme.typography.
|
|
443
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
444
444
|
borderRadius: 10,
|
|
445
445
|
'& > span': {
|
|
446
446
|
transition: '0.2s',
|
|
@@ -453,7 +453,7 @@ export function getThemedComponents() {
|
|
|
453
453
|
...(ownerState.size === 'medium' && {
|
|
454
454
|
fontSize: defaultTheme.typography.pxToRem(15),
|
|
455
455
|
padding: theme.spacing('8px', '12px', '8px', '14px'),
|
|
456
|
-
fontWeight: theme.typography.
|
|
456
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
457
457
|
borderRadius: 8,
|
|
458
458
|
'& > span': {
|
|
459
459
|
transition: '0.2s',
|
|
@@ -464,10 +464,10 @@ export function getThemedComponents() {
|
|
|
464
464
|
}
|
|
465
465
|
}),
|
|
466
466
|
...(ownerState.size === 'small' && {
|
|
467
|
-
padding:
|
|
467
|
+
padding: '6px 8px',
|
|
468
468
|
fontFamily: theme.typography.fontFamily,
|
|
469
469
|
fontSize: defaultTheme.typography.pxToRem(13),
|
|
470
|
-
fontWeight: theme.typography.
|
|
470
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
471
471
|
borderRadius: 8,
|
|
472
472
|
'& .MuiButton-startIcon': {
|
|
473
473
|
transition: '0.15s',
|
|
@@ -704,6 +704,15 @@ export function getThemedComponents() {
|
|
|
704
704
|
ownerState
|
|
705
705
|
}) => ({
|
|
706
706
|
borderRadius: theme.shape.borderRadius,
|
|
707
|
+
transition: 'all 100ms ease-in',
|
|
708
|
+
'&:hover': {
|
|
709
|
+
borderColor: (theme.vars || theme).palette.grey[300],
|
|
710
|
+
background: (theme.vars || theme).palette.grey[50],
|
|
711
|
+
...theme.applyDarkStyles({
|
|
712
|
+
borderColor: (theme.vars || theme).palette.primaryDark[600],
|
|
713
|
+
background: alpha(theme.palette.primaryDark[700], 0.8)
|
|
714
|
+
})
|
|
715
|
+
},
|
|
707
716
|
...(ownerState.size === 'small' && {
|
|
708
717
|
height: 32,
|
|
709
718
|
width: 32,
|
|
@@ -720,11 +729,10 @@ export function getThemedComponents() {
|
|
|
720
729
|
style: ({
|
|
721
730
|
theme
|
|
722
731
|
}) => [{
|
|
723
|
-
border: `1px solid`,
|
|
724
732
|
color: (theme.vars || theme).palette.primary.main,
|
|
725
733
|
backgroundColor: alpha(theme.palette.primaryDark[50], 0.1),
|
|
726
|
-
|
|
727
|
-
boxShadow:
|
|
734
|
+
border: `1px solid ${(theme.vars || theme).palette.primaryDark[100]}`,
|
|
735
|
+
boxShadow: `#FFF 0 1px 0 inset, ${alpha(theme.palette.grey[200], 0.4)} 0 -1px 0 inset, ${alpha(theme.palette.grey[200], 0.5)} 0 1px 2px 0`,
|
|
728
736
|
'&:hover': {
|
|
729
737
|
borderColor: (theme.vars || theme).palette.grey[300],
|
|
730
738
|
background: (theme.vars || theme).palette.grey[50]
|
|
@@ -746,25 +754,22 @@ export function getThemedComponents() {
|
|
|
746
754
|
style: ({
|
|
747
755
|
theme
|
|
748
756
|
}) => [{
|
|
749
|
-
color: (theme.vars || theme).palette.text.
|
|
750
|
-
borderRadius: theme.shape.borderRadius,
|
|
751
|
-
border: `1px solid`,
|
|
757
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
752
758
|
backgroundColor: alpha(theme.palette.primaryDark[50], 0.1),
|
|
753
|
-
|
|
754
|
-
boxShadow:
|
|
759
|
+
border: `1px solid ${(theme.vars || theme).palette.primaryDark[100]}`,
|
|
760
|
+
boxShadow: `#FFF 0 1px 0 inset, ${alpha(theme.palette.grey[200], 0.4)} 0 -1px 0 inset, ${alpha(theme.palette.grey[200], 0.5)} 0 1px 2px 0`,
|
|
755
761
|
'&:hover': {
|
|
756
|
-
color: (theme.vars || theme).palette.primary
|
|
762
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
757
763
|
borderColor: (theme.vars || theme).palette.grey[300],
|
|
758
764
|
background: (theme.vars || theme).palette.grey[50]
|
|
759
765
|
}
|
|
760
766
|
}, theme.applyDarkStyles({
|
|
761
767
|
borderColor: alpha(theme.palette.primaryDark[600], 0.5),
|
|
762
768
|
backgroundColor: alpha(theme.palette.primaryDark[700], 0.2),
|
|
763
|
-
boxShadow: `${alpha(theme.palette.primaryDark[600], 0.
|
|
769
|
+
boxShadow: `${alpha(theme.palette.primaryDark[600], 0.3)} 0 1px 0 inset, ${(theme.vars || theme).palette.common.black} 0 -1px 0 inset, ${(theme.vars || theme).palette.common.black} 0 1px 2px 0`,
|
|
764
770
|
'&:hover': {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
background: alpha(theme.palette.primaryDark[700], 0.4)
|
|
771
|
+
borderColor: (theme.vars || theme).palette.primaryDark[600],
|
|
772
|
+
background: alpha(theme.palette.primaryDark[700], 0.8)
|
|
768
773
|
}
|
|
769
774
|
})]
|
|
770
775
|
}]
|
|
@@ -790,11 +795,11 @@ export function getThemedComponents() {
|
|
|
790
795
|
}
|
|
791
796
|
},
|
|
792
797
|
'& .MuiMenuItem-root': {
|
|
793
|
-
padding: '6px
|
|
798
|
+
padding: '6px 8px',
|
|
794
799
|
borderRadius: '6px',
|
|
795
800
|
fontSize: theme.typography.pxToRem(14),
|
|
796
801
|
fontWeight: theme.typography.fontWeightMedium,
|
|
797
|
-
'&:hover
|
|
802
|
+
'&:hover': {
|
|
798
803
|
backgroundColor: (theme.vars || theme).palette.grey[100],
|
|
799
804
|
color: (theme.vars || theme).palette.text.primary
|
|
800
805
|
},
|
|
@@ -811,7 +816,7 @@ export function getThemedComponents() {
|
|
|
811
816
|
backgroundColor: (theme.vars || theme).palette.primaryDark[900],
|
|
812
817
|
borderColor: (theme.vars || theme).palette.primaryDark[700],
|
|
813
818
|
'& .MuiMenuItem-root': {
|
|
814
|
-
'&:hover
|
|
819
|
+
'&:hover': {
|
|
815
820
|
backgroundColor: (theme.vars || theme).palette.primaryDark[700]
|
|
816
821
|
},
|
|
817
822
|
'&.Mui-selected': {
|
|
@@ -1209,11 +1214,20 @@ export function getThemedComponents() {
|
|
|
1209
1214
|
}
|
|
1210
1215
|
},
|
|
1211
1216
|
MuiTooltip: {
|
|
1217
|
+
defaultProps: {
|
|
1218
|
+
arrow: true
|
|
1219
|
+
},
|
|
1212
1220
|
styleOverrides: {
|
|
1213
|
-
tooltip: {
|
|
1221
|
+
tooltip: ({
|
|
1222
|
+
theme
|
|
1223
|
+
}) => ({
|
|
1224
|
+
padding: '6px 8px',
|
|
1214
1225
|
borderRadius: 6,
|
|
1215
|
-
|
|
1216
|
-
|
|
1226
|
+
backgroundColor: (theme.vars || theme).palette.grey[800],
|
|
1227
|
+
'& .MuiTooltip-arrow': {
|
|
1228
|
+
color: (theme.vars || theme).palette.grey[800]
|
|
1229
|
+
}
|
|
1230
|
+
})
|
|
1217
1231
|
}
|
|
1218
1232
|
},
|
|
1219
1233
|
MuiSwitch: {
|
|
@@ -1224,7 +1238,7 @@ export function getThemedComponents() {
|
|
|
1224
1238
|
padding: 0,
|
|
1225
1239
|
'& .MuiSwitch-switchBase': {
|
|
1226
1240
|
'&.Mui-checked': {
|
|
1227
|
-
transform: 'translateX(
|
|
1241
|
+
transform: 'translateX(12px)',
|
|
1228
1242
|
color: '#fff'
|
|
1229
1243
|
}
|
|
1230
1244
|
}
|
|
@@ -1255,6 +1269,25 @@ export function getThemedComponents() {
|
|
|
1255
1269
|
}
|
|
1256
1270
|
}
|
|
1257
1271
|
},
|
|
1272
|
+
MuiSnackbar: {
|
|
1273
|
+
styleOverrides: {
|
|
1274
|
+
root: ({
|
|
1275
|
+
theme
|
|
1276
|
+
}) => ({
|
|
1277
|
+
'& .MuiSnackbarContent-root': {
|
|
1278
|
+
backgroundColor: '#FFF',
|
|
1279
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
1280
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
1281
|
+
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
1282
|
+
boxShadow: `0 4px 16px ${alpha(theme.palette.grey[400], 0.2)}`,
|
|
1283
|
+
...theme.applyDarkStyles({
|
|
1284
|
+
backgroundColor: (theme.vars || theme).palette.primaryDark[800],
|
|
1285
|
+
boxShadow: '0 4px 16px hsl(0, 100%, 1%)'
|
|
1286
|
+
})
|
|
1287
|
+
}
|
|
1288
|
+
})
|
|
1289
|
+
}
|
|
1290
|
+
},
|
|
1258
1291
|
MuiPaginationItem: {
|
|
1259
1292
|
styleOverrides: {
|
|
1260
1293
|
root: ({
|
package/i18n/i18n.js
CHANGED
|
@@ -60,6 +60,14 @@ export function useSetUserLanguage() {
|
|
|
60
60
|
return React.useContext(UserLanguageContext).setUserLanguage;
|
|
61
61
|
}
|
|
62
62
|
const warnedOnce = {};
|
|
63
|
+
const warn = (userLanguage, key, ignoreWarning) => {
|
|
64
|
+
const fullKey = `${userLanguage}:${key}`;
|
|
65
|
+
// No warnings in CI env
|
|
66
|
+
if (!ignoreWarning && !warnedOnce[fullKey] && typeof window !== 'undefined') {
|
|
67
|
+
console.warn(`Missing translation for ${fullKey}`);
|
|
68
|
+
warnedOnce[fullKey] = true;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
63
71
|
export function useTranslate() {
|
|
64
72
|
const userLanguage = useUserLanguage();
|
|
65
73
|
const translations = React.useContext(TranslationsContext);
|
|
@@ -74,12 +82,7 @@ export function useTranslate() {
|
|
|
74
82
|
}
|
|
75
83
|
const translation = getPath(wordings, key);
|
|
76
84
|
if (!translation) {
|
|
77
|
-
|
|
78
|
-
// No warnings in CI env
|
|
79
|
-
if (!ignoreWarning && !warnedOnce[fullKey] && typeof window !== 'undefined') {
|
|
80
|
-
console.error(`Missing translation for ${fullKey}`);
|
|
81
|
-
warnedOnce[fullKey] = true;
|
|
82
|
-
}
|
|
85
|
+
warn(userLanguage, key, ignoreWarning);
|
|
83
86
|
return getPath(translations.en, key);
|
|
84
87
|
}
|
|
85
88
|
return translation;
|
|
@@ -38,12 +38,12 @@ const Pre = (0, _styles.styled)('pre')(({
|
|
|
38
38
|
}));
|
|
39
39
|
const HighlightedCode = exports.HighlightedCode = /*#__PURE__*/React.forwardRef(function HighlightedCode(props, ref) {
|
|
40
40
|
const {
|
|
41
|
+
code,
|
|
41
42
|
copyButtonHidden = false,
|
|
42
43
|
copyButtonProps,
|
|
43
|
-
code,
|
|
44
44
|
language,
|
|
45
45
|
plainStyle,
|
|
46
|
-
parentComponent: Component = plainStyle ?
|
|
46
|
+
parentComponent: Component = plainStyle ? React.Fragment : _MarkdownElement.MarkdownElement,
|
|
47
47
|
preComponent: PreComponent = plainStyle ? Pre : 'pre',
|
|
48
48
|
...other
|
|
49
49
|
} = props;
|
|
@@ -57,6 +57,9 @@ const HighlightedCode = exports.HighlightedCode = /*#__PURE__*/React.forwardRef(
|
|
|
57
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
58
58
|
className: "MuiCode-root",
|
|
59
59
|
...handlers,
|
|
60
|
+
style: {
|
|
61
|
+
height: '100%'
|
|
62
|
+
},
|
|
60
63
|
children: [copyButtonHidden ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoSsr.NoSsr, {
|
|
61
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CodeCopy.CodeCopyButton, {
|
|
62
65
|
code: code,
|