@mui/docs 6.0.0-alpha.10 → 6.0.0-alpha.12
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 +145 -0
- package/Link/Link.js +0 -2
- package/MarkdownElement/MarkdownElement.js +121 -95
- package/branding/brandingTheme.js +20 -21
- package/node/Link/Link.js +0 -2
- package/node/MarkdownElement/MarkdownElement.js +121 -95
- package/node/branding/brandingTheme.js +20 -21
- package/package.json +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -130,7 +130,7 @@ export const getDesignTokens = mode => ({
|
|
|
130
130
|
tertiary: grey[700]
|
|
131
131
|
}),
|
|
132
132
|
...(mode === 'dark' && {
|
|
133
|
-
primary: '
|
|
133
|
+
primary: 'hsl(0, 0%, 100%)',
|
|
134
134
|
secondary: grey[400],
|
|
135
135
|
tertiary: grey[500]
|
|
136
136
|
})
|
|
@@ -264,10 +264,10 @@ export const getDesignTokens = mode => ({
|
|
|
264
264
|
* ...theme.vars ? {
|
|
265
265
|
* color: theme.vars.palette.primary.main,
|
|
266
266
|
* [theme.getColorScheme('dark')]: {
|
|
267
|
-
* color: '
|
|
267
|
+
* color: 'hsl(0, 0%, 100%)',
|
|
268
268
|
* }
|
|
269
269
|
* } : {
|
|
270
|
-
* color: theme.palette.mode === 'dark' ? '
|
|
270
|
+
* color: theme.palette.mode === 'dark' ? 'hsl(0, 0%, 100%)' : theme.palette.primary.main,
|
|
271
271
|
* }
|
|
272
272
|
* }
|
|
273
273
|
*
|
|
@@ -275,7 +275,7 @@ export const getDesignTokens = mode => ({
|
|
|
275
275
|
* {
|
|
276
276
|
* color: (theme.vars || theme).palette.primary.main,
|
|
277
277
|
* ...theme.applyDarkStyles({
|
|
278
|
-
* color: '
|
|
278
|
+
* color: 'hsl(0, 0%, 100%)',
|
|
279
279
|
* }),
|
|
280
280
|
* }
|
|
281
281
|
*
|
|
@@ -491,7 +491,7 @@ export function getThemedComponents() {
|
|
|
491
491
|
color: (theme.vars || theme).palette.text.primary,
|
|
492
492
|
backgroundColor: alpha(theme.palette.primaryDark[50], 0.1),
|
|
493
493
|
borderColor: (theme.vars || theme).palette.primaryDark[100],
|
|
494
|
-
boxShadow:
|
|
494
|
+
boxShadow: `hsl(0, 0%, 100%) 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`,
|
|
495
495
|
'&:hover': {
|
|
496
496
|
backgroundColor: (theme.vars || theme).palette.grey[50]
|
|
497
497
|
},
|
|
@@ -527,7 +527,7 @@ export function getThemedComponents() {
|
|
|
527
527
|
})
|
|
528
528
|
}),
|
|
529
529
|
...(ownerState.variant === 'contained' && ownerState.color === 'primary' && {
|
|
530
|
-
color: '
|
|
530
|
+
color: 'hsl(0, 0%, 100%)',
|
|
531
531
|
textShadow: `0 1px 1px ${alpha(theme.palette.common.black, 0.6)}`,
|
|
532
532
|
backgroundColor: (theme.vars || theme).palette.primary[500],
|
|
533
533
|
backgroundImage: `linear-gradient(180deg, ${alpha(theme.palette.primary[500], 0.6)} 0%, ${theme.palette.primary[600]} 100%)`,
|
|
@@ -732,7 +732,7 @@ export function getThemedComponents() {
|
|
|
732
732
|
color: (theme.vars || theme).palette.primary.main,
|
|
733
733
|
backgroundColor: alpha(theme.palette.primaryDark[50], 0.1),
|
|
734
734
|
border: `1px solid ${(theme.vars || theme).palette.primaryDark[100]}`,
|
|
735
|
-
boxShadow:
|
|
735
|
+
boxShadow: `hsl(0, 0%, 100%) 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`,
|
|
736
736
|
'&:hover': {
|
|
737
737
|
borderColor: (theme.vars || theme).palette.grey[300],
|
|
738
738
|
background: (theme.vars || theme).palette.grey[50]
|
|
@@ -757,7 +757,7 @@ export function getThemedComponents() {
|
|
|
757
757
|
color: (theme.vars || theme).palette.text.secondary,
|
|
758
758
|
backgroundColor: alpha(theme.palette.primaryDark[50], 0.1),
|
|
759
759
|
border: `1px solid ${(theme.vars || theme).palette.primaryDark[100]}`,
|
|
760
|
-
boxShadow:
|
|
760
|
+
boxShadow: `hsl(0, 0%, 100%) 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`,
|
|
761
761
|
'&:hover': {
|
|
762
762
|
color: (theme.vars || theme).palette.text.primary,
|
|
763
763
|
borderColor: (theme.vars || theme).palette.grey[300],
|
|
@@ -858,7 +858,7 @@ export function getThemedComponents() {
|
|
|
858
858
|
}) => ({
|
|
859
859
|
display: 'inline-flex',
|
|
860
860
|
alignItems: 'center',
|
|
861
|
-
fontWeight: theme.typography.
|
|
861
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
862
862
|
'&.MuiTypography-body1 > svg': {
|
|
863
863
|
marginTop: 2
|
|
864
864
|
},
|
|
@@ -957,7 +957,7 @@ export function getThemedComponents() {
|
|
|
957
957
|
backgroundColor: (theme.vars || theme).palette.primary[100]
|
|
958
958
|
},
|
|
959
959
|
...theme.applyDarkStyles({
|
|
960
|
-
color: '
|
|
960
|
+
color: 'hsl(0, 0%, 100%)',
|
|
961
961
|
backgroundColor: alpha(theme.palette.primaryDark[500], 0.8),
|
|
962
962
|
'&:hover': {
|
|
963
963
|
backgroundColor: (theme.vars || theme).palette.primaryDark[600]
|
|
@@ -1009,7 +1009,7 @@ export function getThemedComponents() {
|
|
|
1009
1009
|
color: (theme.vars || theme).palette.warning[900],
|
|
1010
1010
|
backgroundColor: (theme.vars || theme).palette.warning[100],
|
|
1011
1011
|
...theme.applyDarkStyles({
|
|
1012
|
-
color: '
|
|
1012
|
+
color: 'hsl(0, 0%, 100%)',
|
|
1013
1013
|
backgroundColor: (theme.vars || theme).palette.warning[900]
|
|
1014
1014
|
})
|
|
1015
1015
|
}),
|
|
@@ -1017,7 +1017,7 @@ export function getThemedComponents() {
|
|
|
1017
1017
|
color: (theme.vars || theme).palette.success[900],
|
|
1018
1018
|
backgroundColor: (theme.vars || theme).palette.success[100],
|
|
1019
1019
|
...theme.applyDarkStyles({
|
|
1020
|
-
color: '
|
|
1020
|
+
color: 'hsl(0, 0%, 100%)',
|
|
1021
1021
|
backgroundColor: (theme.vars || theme).palette.success[900]
|
|
1022
1022
|
})
|
|
1023
1023
|
})
|
|
@@ -1062,7 +1062,7 @@ export function getThemedComponents() {
|
|
|
1062
1062
|
backgroundColor: alpha(theme.palette.primaryDark[700], 0.4)
|
|
1063
1063
|
},
|
|
1064
1064
|
'&.Mui-selected': {
|
|
1065
|
-
color: '
|
|
1065
|
+
color: 'hsl(0, 0%, 100%)',
|
|
1066
1066
|
borderColor: `${(theme.vars || theme).palette.primary[700]} !important`,
|
|
1067
1067
|
backgroundColor: (theme.vars || theme).palette.primaryDark[700],
|
|
1068
1068
|
'&:hover': {
|
|
@@ -1094,7 +1094,7 @@ export function getThemedComponents() {
|
|
|
1094
1094
|
ownerState
|
|
1095
1095
|
}) => [{
|
|
1096
1096
|
backgroundImage: 'none',
|
|
1097
|
-
backgroundColor: '
|
|
1097
|
+
backgroundColor: 'hsl(0, 0%, 100%)',
|
|
1098
1098
|
'&[href]': {
|
|
1099
1099
|
textDecorationLine: 'none'
|
|
1100
1100
|
},
|
|
@@ -1106,7 +1106,7 @@ export function getThemedComponents() {
|
|
|
1106
1106
|
borderColor: (theme.vars || theme).palette.grey[100],
|
|
1107
1107
|
'&[href]': {
|
|
1108
1108
|
textDecorationLine: 'none',
|
|
1109
|
-
boxShadow: `hsl(
|
|
1109
|
+
boxShadow: `hsl(0, 0%, 100%) 0 2px 0 inset, ${alpha(theme.palette.primary[100], 0.3)} 0 -2px 0 inset, ${alpha(theme.palette.grey[200], 0.5)} 0 1px 2px 0`,
|
|
1110
1110
|
'&:hover': {
|
|
1111
1111
|
borderColor: (theme.vars || theme).palette.primary[200],
|
|
1112
1112
|
boxShadow: `0px 2px 8px ${(theme.vars || theme).palette.primary[100]}`
|
|
@@ -1129,8 +1129,7 @@ export function getThemedComponents() {
|
|
|
1129
1129
|
borderColor: (theme.vars || theme).palette.primaryDark[700],
|
|
1130
1130
|
backgroundColor: alpha(theme.palette.primaryDark[800], 0.6),
|
|
1131
1131
|
'&[href]': {
|
|
1132
|
-
|
|
1133
|
-
boxShadow: `${alpha(theme.palette.primaryDark[700], 0.4)} 0 2px 0 inset, ${(theme.vars || theme).palette.common.black} 0 -2px 0 inset, ${(theme.vars || theme).palette.common.black} 0 1px 2px 0`,
|
|
1132
|
+
boxShadow: `${alpha(theme.palette.primaryDark[600], 0.1)} 0 2px 0 inset, ${(theme.vars || theme).palette.common.black} 0 -2px 0 inset, ${(theme.vars || theme).palette.common.black} 0 1px 2px 0`,
|
|
1134
1133
|
'&:hover': {
|
|
1135
1134
|
borderColor: alpha(theme.palette.primary[600], 0.5),
|
|
1136
1135
|
boxShadow: `0px 2px 8px ${alpha(theme.palette.primary[900], 0.6)}`
|
|
@@ -1168,7 +1167,7 @@ export function getThemedComponents() {
|
|
|
1168
1167
|
root: ({
|
|
1169
1168
|
theme
|
|
1170
1169
|
}) => ({
|
|
1171
|
-
backgroundColor: '
|
|
1170
|
+
backgroundColor: 'hsl(0, 0%, 100%)',
|
|
1172
1171
|
...theme.applyDarkStyles({
|
|
1173
1172
|
backgroundColor: (theme.vars || theme).palette.primaryDark[900]
|
|
1174
1173
|
})
|
|
@@ -1239,7 +1238,7 @@ export function getThemedComponents() {
|
|
|
1239
1238
|
'& .MuiSwitch-switchBase': {
|
|
1240
1239
|
'&.Mui-checked': {
|
|
1241
1240
|
transform: 'translateX(11px)',
|
|
1242
|
-
color: '
|
|
1241
|
+
color: 'hsl(0, 0%, 100%)'
|
|
1243
1242
|
}
|
|
1244
1243
|
}
|
|
1245
1244
|
},
|
|
@@ -1247,7 +1246,7 @@ export function getThemedComponents() {
|
|
|
1247
1246
|
height: 20,
|
|
1248
1247
|
width: 20,
|
|
1249
1248
|
padding: 0,
|
|
1250
|
-
color: '
|
|
1249
|
+
color: 'hsl(0, 0%, 100%)',
|
|
1251
1250
|
'&.Mui-checked + .MuiSwitch-track': {
|
|
1252
1251
|
opacity: 1
|
|
1253
1252
|
}
|
|
@@ -1275,7 +1274,7 @@ export function getThemedComponents() {
|
|
|
1275
1274
|
theme
|
|
1276
1275
|
}) => ({
|
|
1277
1276
|
'& .MuiSnackbarContent-root': {
|
|
1278
|
-
backgroundColor: '
|
|
1277
|
+
backgroundColor: 'hsl(0, 0%, 100%)',
|
|
1279
1278
|
color: (theme.vars || theme).palette.text.primary,
|
|
1280
1279
|
fontWeight: theme.typography.fontWeightMedium,
|
|
1281
1280
|
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
package/node/Link/Link.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.MarkdownElement = void 0;
|
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
11
12
|
var _branding = require("../branding");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -18,8 +19,8 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
18
19
|
var _theme$shape$borderRa, _theme$shape, _theme$shape$borderRa2, _theme$shape2, _theme$shape$borderRa3, _theme$shape3;
|
|
19
20
|
return {
|
|
20
21
|
..._branding.brandingLightTheme.typography.body1,
|
|
21
|
-
lineHeight: 1.
|
|
22
|
-
//
|
|
22
|
+
lineHeight: 1.625,
|
|
23
|
+
// Rounds up to 26px-increased compared to the 1.5 default to make the docs easier to read.
|
|
23
24
|
color: `var(--muidocs-palette-text-primary, ${_branding.brandingLightTheme.palette.text.primary})`,
|
|
24
25
|
'& :focus-visible': {
|
|
25
26
|
outline: `3px solid ${(0, _styles.alpha)(_branding.brandingLightTheme.palette.primary[500], 0.5)}`,
|
|
@@ -34,7 +35,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
34
35
|
// Developers like when the code is dense.
|
|
35
36
|
margin: theme.spacing(2, 'auto'),
|
|
36
37
|
padding: theme.spacing(2),
|
|
37
|
-
backgroundColor: 'hsl(210,
|
|
38
|
+
backgroundColor: 'hsl(210, 25%, 9%)',
|
|
38
39
|
// 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.
|
|
39
40
|
color: 'hsl(60, 30%, 96%)',
|
|
40
41
|
colorScheme: 'dark',
|
|
@@ -133,6 +134,44 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
133
134
|
marginBottom: 6
|
|
134
135
|
}
|
|
135
136
|
},
|
|
137
|
+
'& a[target="_blank"]::after': {
|
|
138
|
+
content: '""',
|
|
139
|
+
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")`,
|
|
140
|
+
display: 'inline-flex',
|
|
141
|
+
width: '1em',
|
|
142
|
+
height: '1em',
|
|
143
|
+
color: 'inherit',
|
|
144
|
+
backgroundColor: 'currentColor',
|
|
145
|
+
transform: 'translate(0, 2px)',
|
|
146
|
+
transition: 'transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1)',
|
|
147
|
+
// bounce effect
|
|
148
|
+
opacity: 0.8
|
|
149
|
+
},
|
|
150
|
+
'& a[target="_blank"]:hover::after': {
|
|
151
|
+
opacity: 1,
|
|
152
|
+
transform: 'translate(1px, 0)'
|
|
153
|
+
},
|
|
154
|
+
'& a.remove-link-arrow::after': {
|
|
155
|
+
// Allows to remove link arrows for images
|
|
156
|
+
display: 'none'
|
|
157
|
+
},
|
|
158
|
+
'& .Ad-root a::after': {
|
|
159
|
+
// Remove link arrow for ads
|
|
160
|
+
display: 'none'
|
|
161
|
+
},
|
|
162
|
+
'& a': {
|
|
163
|
+
// Style taken from the Link component
|
|
164
|
+
color: `var(--muidocs-palette-primary-600, ${_branding.brandingLightTheme.palette.primary[600]})`,
|
|
165
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
166
|
+
textDecoration: 'underline',
|
|
167
|
+
textDecorationColor: (0, _styles.alpha)(_branding.brandingLightTheme.palette.primary.main, 0.4),
|
|
168
|
+
'&:hover': {
|
|
169
|
+
textDecorationColor: 'inherit'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
'& a code': {
|
|
173
|
+
color: (0, _styles.darken)(_branding.brandingLightTheme.palette.primary.main, 0.2)
|
|
174
|
+
},
|
|
136
175
|
'& h1, & h2, & h3, & h4': {
|
|
137
176
|
display: 'flex',
|
|
138
177
|
alignItems: 'center',
|
|
@@ -146,9 +185,12 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
146
185
|
'& .title-link-to-anchor': {
|
|
147
186
|
color: 'inherit',
|
|
148
187
|
textDecoration: 'none',
|
|
188
|
+
boxShadow: 'none',
|
|
189
|
+
fontWeight: 'inherit',
|
|
149
190
|
position: 'relative',
|
|
150
191
|
display: 'flex',
|
|
151
|
-
alignItems: 'center'
|
|
192
|
+
alignItems: 'center',
|
|
193
|
+
userSelect: 'text'
|
|
152
194
|
},
|
|
153
195
|
'& .anchor-icon': {
|
|
154
196
|
// To prevent the link to get the focus.
|
|
@@ -156,12 +198,6 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
156
198
|
alignItems: 'center',
|
|
157
199
|
visibility: 'hidden'
|
|
158
200
|
},
|
|
159
|
-
'& a:not(.title-link-to-anchor):hover': {
|
|
160
|
-
color: 'currentColor',
|
|
161
|
-
border: 'none',
|
|
162
|
-
boxShadow: '0 1px 0 0 currentColor',
|
|
163
|
-
textDecoration: 'none'
|
|
164
|
-
},
|
|
165
201
|
'& .anchor-icon, & .comment-link': {
|
|
166
202
|
padding: 0,
|
|
167
203
|
cursor: 'pointer',
|
|
@@ -295,44 +331,58 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
295
331
|
},
|
|
296
332
|
'& .MuiCallout-root': {
|
|
297
333
|
display: 'flex',
|
|
298
|
-
gap:
|
|
299
|
-
padding: '
|
|
334
|
+
gap: '8px',
|
|
335
|
+
padding: '12px',
|
|
300
336
|
margin: '16px 0',
|
|
301
337
|
border: '1px solid',
|
|
302
338
|
color: `var(--muidocs-palette-text-secondary, ${_branding.brandingLightTheme.palette.text.secondary})`,
|
|
303
339
|
borderColor: `var(--muidocs-palette-grey-100, ${_branding.brandingLightTheme.palette.grey[100]})`,
|
|
304
340
|
borderRadius: `var(--muidocs-shape-borderRadius, ${(_theme$shape$borderRa2 = (_theme$shape2 = theme.shape) == null ? void 0 : _theme$shape2.borderRadius) != null ? _theme$shape$borderRa2 : _branding.brandingLightTheme.shape.borderRadius}px)`,
|
|
305
|
-
'&
|
|
341
|
+
'& .MuiCallout-content': {
|
|
342
|
+
minWidth: 0,
|
|
343
|
+
// Allows content to shrink. Useful when callout contains code block
|
|
344
|
+
flexGrow: 1
|
|
345
|
+
},
|
|
346
|
+
'& code': {
|
|
306
347
|
height: 'fit-content',
|
|
307
348
|
backgroundColor: `var(--muidocs-palette-grey-100, ${_branding.brandingLightTheme.palette.grey[100]})`,
|
|
308
349
|
borderColor: `var(--muidocs-palette-grey-300, ${_branding.brandingLightTheme.palette.grey[300]})`
|
|
309
350
|
},
|
|
310
|
-
'&
|
|
311
|
-
|
|
312
|
-
// Allows content to shrink. Useful when callout contains code block
|
|
313
|
-
flexGrow: 1,
|
|
351
|
+
'& p': {
|
|
352
|
+
marginBottom: '8px',
|
|
314
353
|
'& > p:last-child, & > ul:last-child': {
|
|
315
354
|
// Avoid margin on last child
|
|
316
355
|
marginBottom: 0
|
|
317
356
|
},
|
|
318
|
-
'& .MuiCode-root': {
|
|
319
|
-
'& > pre': {
|
|
320
|
-
margin: 0,
|
|
321
|
-
marginTop: 4
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
357
|
'& > ul': {
|
|
325
358
|
// Because of the gap left by the icon, we visually need less padding
|
|
326
359
|
paddingLeft: 22
|
|
327
360
|
}
|
|
328
361
|
},
|
|
329
|
-
'&
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
362
|
+
'& .MuiCode-root': {
|
|
363
|
+
'& pre': {
|
|
364
|
+
margin: '4px 0 0 0',
|
|
365
|
+
borderRadius: '12px 12px 6px 12px',
|
|
366
|
+
borderColor: (0, _styles.alpha)(_branding.brandingLightTheme.palette.primaryDark[600], 0.6),
|
|
367
|
+
'& code': {
|
|
368
|
+
backgroundColor: 'transparent'
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
'& .MuiCallout-icon-container': {
|
|
373
|
+
width: 26,
|
|
374
|
+
// to match text's line-height
|
|
375
|
+
height: 26,
|
|
376
|
+
display: 'flex',
|
|
377
|
+
alignItems: 'center',
|
|
378
|
+
justifyContent: 'center',
|
|
379
|
+
flexShrink: 0,
|
|
380
|
+
'& svg': {
|
|
381
|
+
width: 18,
|
|
382
|
+
height: 18
|
|
383
|
+
}
|
|
334
384
|
},
|
|
335
|
-
'&
|
|
385
|
+
'& ul, & p': {
|
|
336
386
|
'&:last-child': {
|
|
337
387
|
margin: 0
|
|
338
388
|
}
|
|
@@ -347,7 +397,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
347
397
|
'& strong': {
|
|
348
398
|
color: `var(--muidocs-palette-error-800, ${_branding.brandingLightTheme.palette.error[800]})`
|
|
349
399
|
},
|
|
350
|
-
'&
|
|
400
|
+
'& svg': {
|
|
351
401
|
fill: `var(--muidocs-palette-error-500, ${_branding.brandingLightTheme.palette.error[600]})`
|
|
352
402
|
},
|
|
353
403
|
'& a': {
|
|
@@ -365,7 +415,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
365
415
|
'& strong': {
|
|
366
416
|
color: `var(--muidocs-palette-primary-800, ${_branding.brandingLightTheme.palette.primary[800]})`
|
|
367
417
|
},
|
|
368
|
-
'&
|
|
418
|
+
'& svg': {
|
|
369
419
|
fill: `var(--muidocs-palette-grey-600, ${_branding.brandingLightTheme.palette.grey[600]})`
|
|
370
420
|
}
|
|
371
421
|
},
|
|
@@ -376,7 +426,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
376
426
|
'& strong': {
|
|
377
427
|
color: `var(--muidocs-palette-success-900, ${_branding.brandingLightTheme.palette.success[900]})`
|
|
378
428
|
},
|
|
379
|
-
'&
|
|
429
|
+
'& svg': {
|
|
380
430
|
fill: `var(--muidocs-palette-success-600, ${_branding.brandingLightTheme.palette.success[600]})`
|
|
381
431
|
},
|
|
382
432
|
'& a': {
|
|
@@ -394,7 +444,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
394
444
|
'& strong': {
|
|
395
445
|
color: `var(--muidocs-palette-warning-800, ${_branding.brandingLightTheme.palette.warning[800]})`
|
|
396
446
|
},
|
|
397
|
-
'&
|
|
447
|
+
'& svg': {
|
|
398
448
|
fill: `var(--muidocs-palette-warning-600, ${_branding.brandingLightTheme.palette.warning[600]})`
|
|
399
449
|
},
|
|
400
450
|
'& a': {
|
|
@@ -406,47 +456,6 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
406
456
|
}
|
|
407
457
|
}
|
|
408
458
|
},
|
|
409
|
-
'& a[target="_blank"]::after': {
|
|
410
|
-
content: '""',
|
|
411
|
-
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")`,
|
|
412
|
-
display: 'inline-flex',
|
|
413
|
-
width: '1em',
|
|
414
|
-
height: '1em',
|
|
415
|
-
color: 'inherit',
|
|
416
|
-
backgroundColor: 'currentColor',
|
|
417
|
-
transform: 'translate(0, 2px)',
|
|
418
|
-
transition: 'transform 0.3s cubic-bezier(0.1, 0.8, 0.3, 1)',
|
|
419
|
-
// bounce effect
|
|
420
|
-
opacity: 0.8
|
|
421
|
-
},
|
|
422
|
-
'& a[target="_blank"]:hover::after': {
|
|
423
|
-
opacity: 1,
|
|
424
|
-
transform: 'translate(1px, 0)'
|
|
425
|
-
},
|
|
426
|
-
'& a.remove-link-arrow::after': {
|
|
427
|
-
// Allows to remove link arrows for images
|
|
428
|
-
display: 'none'
|
|
429
|
-
},
|
|
430
|
-
'& .Ad-root a::after': {
|
|
431
|
-
// Remove link arrow for ads
|
|
432
|
-
display: 'none'
|
|
433
|
-
},
|
|
434
|
-
'& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': {
|
|
435
|
-
// Style taken from the Link component
|
|
436
|
-
color: `var(--muidocs-palette-primary-600, ${_branding.brandingLightTheme.palette.primary[600]})`,
|
|
437
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
438
|
-
textDecoration: 'underline',
|
|
439
|
-
textDecorationColor: (0, _styles.alpha)(_branding.brandingLightTheme.palette.primary.main, 0.4),
|
|
440
|
-
'&:hover': {
|
|
441
|
-
textDecorationColor: 'inherit'
|
|
442
|
-
}
|
|
443
|
-
},
|
|
444
|
-
'& a code': {
|
|
445
|
-
color: (0, _styles.darken)(_branding.brandingLightTheme.palette.primary.main, 0.04)
|
|
446
|
-
},
|
|
447
|
-
'& a:not(.title-link-to-anchor) code': {
|
|
448
|
-
color: (0, _styles.darken)(_branding.brandingLightTheme.palette.primary.main, 0.2)
|
|
449
|
-
},
|
|
450
459
|
'& img, & video': {
|
|
451
460
|
// Use !important so that inline style on <img> or <video> can't win.
|
|
452
461
|
// This avoid horizontal overflows on mobile.
|
|
@@ -675,24 +684,28 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
675
684
|
'& hr': {
|
|
676
685
|
backgroundColor: `var(--muidocs-palette-divider, ${_branding.brandingDarkTheme.palette.divider})`
|
|
677
686
|
},
|
|
678
|
-
'&
|
|
679
|
-
color: `var(--muidocs-palette-
|
|
687
|
+
'& a': {
|
|
688
|
+
color: `var(--muidocs-palette-primary-300, ${_branding.brandingDarkTheme.palette.primary[300]})`
|
|
680
689
|
},
|
|
681
|
-
'&
|
|
682
|
-
color: `var(--muidocs-palette-
|
|
690
|
+
'& a code': {
|
|
691
|
+
color: `var(--muidocs-palette-primary-light, ${_branding.brandingDarkTheme.palette.primary.light})`
|
|
683
692
|
},
|
|
684
|
-
'& h1, & h2, & h3, & h4': {
|
|
685
|
-
|
|
693
|
+
'& h1, & h2, & h3, & h4, & h5': {
|
|
694
|
+
color: `var(--muidocs-palette-grey-50, ${_branding.brandingDarkTheme.palette.grey[50]})`,
|
|
695
|
+
'& .anchor-icon, & .comment-link': {
|
|
686
696
|
color: `var(--muidocs-palette-primary-300, ${_branding.brandingDarkTheme.palette.primaryDark[300]})`,
|
|
687
697
|
borderColor: `var(--muidocs-palette-divider, ${_branding.brandingDarkTheme.palette.divider})`,
|
|
688
698
|
backgroundColor: (0, _styles.alpha)(_branding.brandingDarkTheme.palette.primaryDark[700], 0.5),
|
|
689
699
|
'&:hover': {
|
|
700
|
+
color: `var(--muidocs-palette-primary-100, ${_branding.brandingDarkTheme.palette.primary[100]})`,
|
|
690
701
|
borderColor: `var(--muidocs-palette-primary-900, ${_branding.brandingDarkTheme.palette.primary[900]})`,
|
|
691
|
-
backgroundColor: (0, _styles.alpha)(_branding.brandingDarkTheme.palette.primary[900], 0.6)
|
|
692
|
-
color: `var(--muidocs-palette-primary-100, ${_branding.brandingDarkTheme.palette.primary[100]})`
|
|
702
|
+
backgroundColor: (0, _styles.alpha)(_branding.brandingDarkTheme.palette.primary[900], 0.6)
|
|
693
703
|
}
|
|
694
704
|
}
|
|
695
705
|
},
|
|
706
|
+
'& p, & ul, & ol': {
|
|
707
|
+
color: `var(--muidocs-palette-grey-400, ${_branding.brandingDarkTheme.palette.grey[400]})`
|
|
708
|
+
},
|
|
696
709
|
'& h1 code, & h2 code, & h3 code': {
|
|
697
710
|
color: `var(--muidocs-palette-grey-100, ${_branding.brandingDarkTheme.palette.grey[100]})`
|
|
698
711
|
},
|
|
@@ -726,8 +739,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
726
739
|
},
|
|
727
740
|
'& .MuiCallout-root': {
|
|
728
741
|
borderColor: `var(--muidocs-palette-primaryDark-700, ${_branding.brandingDarkTheme.palette.primaryDark[700]})`,
|
|
729
|
-
'&
|
|
730
|
-
height: 'fit-content',
|
|
742
|
+
'& code': {
|
|
731
743
|
backgroundColor: `var(--muidocs-palette-primaryDark-600, ${_branding.brandingDarkTheme.palette.primaryDark[600]})`,
|
|
732
744
|
borderColor: `var(--muidocs-palette-primaryDark-500, ${_branding.brandingDarkTheme.palette.primaryDark[500]})`
|
|
733
745
|
},
|
|
@@ -738,7 +750,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
738
750
|
'& strong': {
|
|
739
751
|
color: `var(--muidocs-palette-error-300, ${_branding.brandingDarkTheme.palette.error[300]})`
|
|
740
752
|
},
|
|
741
|
-
'&
|
|
753
|
+
'& svg': {
|
|
742
754
|
fill: `var(--muidocs-palette-error-500, ${_branding.brandingDarkTheme.palette.error[500]})`
|
|
743
755
|
},
|
|
744
756
|
'& a': {
|
|
@@ -752,7 +764,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
752
764
|
'& strong': {
|
|
753
765
|
color: `var(--muidocs-palette-primary-200, ${_branding.brandingDarkTheme.palette.primary[200]})`
|
|
754
766
|
},
|
|
755
|
-
'&
|
|
767
|
+
'& svg': {
|
|
756
768
|
fill: `var(--muidocs-palette-grey-400, ${_branding.brandingDarkTheme.palette.grey[400]})`
|
|
757
769
|
}
|
|
758
770
|
},
|
|
@@ -763,7 +775,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
763
775
|
'& strong': {
|
|
764
776
|
color: `var(--muidocs-palette-success-200, ${_branding.brandingDarkTheme.palette.success[200]})`
|
|
765
777
|
},
|
|
766
|
-
'&
|
|
778
|
+
'& svg': {
|
|
767
779
|
fill: `var(--muidocs-palette-success-500, ${_branding.brandingDarkTheme.palette.success[500]})`
|
|
768
780
|
},
|
|
769
781
|
'& a': {
|
|
@@ -777,7 +789,7 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
777
789
|
'& strong': {
|
|
778
790
|
color: `var(--muidocs-palette-warning-200, ${_branding.brandingDarkTheme.palette.warning[200]})`
|
|
779
791
|
},
|
|
780
|
-
'&
|
|
792
|
+
'& svg': {
|
|
781
793
|
fill: `var(--muidocs-palette-warning-400, ${_branding.brandingDarkTheme.palette.warning[400]})`
|
|
782
794
|
},
|
|
783
795
|
'& a': {
|
|
@@ -785,12 +797,6 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
785
797
|
}
|
|
786
798
|
}
|
|
787
799
|
},
|
|
788
|
-
'& a:not(.title-link-to-anchor), & a:not(.title-link-to-anchor) code': {
|
|
789
|
-
color: `var(--muidocs-palette-primary-300, ${_branding.brandingDarkTheme.palette.primary[300]})`
|
|
790
|
-
},
|
|
791
|
-
'& a:not(.title-link-to-anchor) code': {
|
|
792
|
-
color: `var(--muidocs-palette-primary-light, ${_branding.brandingDarkTheme.palette.primary.light})`
|
|
793
|
-
},
|
|
794
800
|
'& kbd.key': {
|
|
795
801
|
color: `var(--muidocs-palette-text-primary, ${_branding.brandingDarkTheme.palette.text.primary})`,
|
|
796
802
|
backgroundColor: `var(--muidocs-palette-primaryDark-800, ${_branding.brandingDarkTheme.palette.primaryDark[800]})`,
|
|
@@ -814,12 +820,32 @@ const Root = (0, _styles.styled)('div')(({
|
|
|
814
820
|
}
|
|
815
821
|
}
|
|
816
822
|
}));
|
|
823
|
+
function handleHeaderClick(event) {
|
|
824
|
+
const selection = document.getSelection();
|
|
825
|
+
if (selection === null) {
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
if (selection.type === 'Range') {
|
|
829
|
+
// Disable the <a> behavior to be able to select text.
|
|
830
|
+
event.preventDefault();
|
|
831
|
+
}
|
|
832
|
+
}
|
|
817
833
|
const MarkdownElement = exports.MarkdownElement = /*#__PURE__*/React.forwardRef(function MarkdownElement(props, ref) {
|
|
818
834
|
const {
|
|
819
835
|
className,
|
|
820
836
|
renderedMarkdown,
|
|
821
837
|
...other
|
|
822
838
|
} = props;
|
|
839
|
+
const rootRef = React.useRef(null);
|
|
840
|
+
const handleRef = (0, _useForkRef.default)(rootRef, ref);
|
|
841
|
+
React.useEffect(() => {
|
|
842
|
+
const elements = rootRef.current.getElementsByClassName('title-link-to-anchor');
|
|
843
|
+
for (let i = 0; i < elements.length; i += 1) {
|
|
844
|
+
// More reliable than `-webkit-user-drag` (https://caniuse.com/webkit-user-drag)
|
|
845
|
+
elements[i].setAttribute('draggable', 'false');
|
|
846
|
+
elements[i].addEventListener('click', handleHeaderClick);
|
|
847
|
+
}
|
|
848
|
+
}, []);
|
|
823
849
|
const more = {};
|
|
824
850
|
if (typeof renderedMarkdown === 'string') {
|
|
825
851
|
// workaround for https://github.com/facebook/react/issues/17170
|
|
@@ -832,6 +858,6 @@ const MarkdownElement = exports.MarkdownElement = /*#__PURE__*/React.forwardRef(
|
|
|
832
858
|
className: (0, _clsx.default)('markdown-body', className),
|
|
833
859
|
...more,
|
|
834
860
|
...other,
|
|
835
|
-
ref:
|
|
861
|
+
ref: handleRef
|
|
836
862
|
});
|
|
837
863
|
});
|