Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
16c9fbf
Add `lintJavascriptDemoFocus` eslint plugin
dav-is Apr 11, 2026
e8eff01
Add `@focus-start`, `@focus-end`
dav-is Apr 15, 2026
da68d0a
handle interplay between focus and highlighted portions
dav-is Apr 15, 2026
f3f0047
Add emphasis config
dav-is Apr 16, 2026
807ab40
Allow `@padding` and `@min` override
dav-is Apr 16, 2026
7ed37da
Always return some focus
dav-is Apr 16, 2026
1e22879
Update focusFramesMaxSize to 18
dav-is Apr 16, 2026
b10a420
Merge branch 'master' into docs-infra/add-linter
dav-is Apr 16, 2026
4bb784d
pnpm dedupe
dav-is Apr 16, 2026
717d5b8
Use `<mark>` for `@highlight-text`
dav-is Apr 16, 2026
fd28123
Update docs
dav-is Apr 16, 2026
66edfb8
Reorder sections
dav-is Apr 16, 2026
908392b
Improve cases where of `@highlight @focus`
dav-is Apr 16, 2026
efcc298
Automatically add appropriate padding
dav-is Apr 16, 2026
6645f23
Fix bug where data-hl provided on frame based highlight
dav-is Apr 16, 2026
0b8fdc2
Fix codeblock styles
dav-is Apr 16, 2026
772de1b
Fix background css
dav-is Apr 16, 2026
c7d11e8
Fix max height
dav-is Apr 16, 2026
88e3f74
Code review
dav-is Apr 16, 2026
0aa152c
Code review
dav-is Apr 16, 2026
0a74df3
Code review
dav-is Apr 16, 2026
5cc9c02
Fix framing on unknown languages
dav-is Apr 16, 2026
b9d537c
Add collapsible indicator
dav-is Apr 16, 2026
0fb4832
Maintain max frame size
dav-is Apr 17, 2026
e5a1e00
Take care of CSS for the example toggle
dav-is Apr 17, 2026
af29f6f
Improve expand and collapse animation
dav-is Apr 17, 2026
f6fc98e
Update doc
dav-is Apr 17, 2026
33c0cb8
Add note
dav-is Apr 17, 2026
dc4aa5f
Fix tab switch animation
dav-is Apr 17, 2026
fe3d9bd
Improve scroll experience
dav-is Apr 18, 2026
6529001
Fix scrollbar animation
dav-is Apr 18, 2026
60c7011
Remove inline styles
dav-is Apr 18, 2026
dbc50ae
Anchor scroll for large blocks
dav-is Apr 18, 2026
428a795
Update comment
dav-is Apr 18, 2026
ab64da0
Merge branch 'master' into docs-infra/add-linter
dav-is Apr 20, 2026
2a85eda
Merge branch 'docs-infra/add-linter' of github.com:mui/mui-public int…
dav-is Apr 20, 2026
9289526
Fix scroll jumping
dav-is Apr 20, 2026
fbeacfd
Improve scroll anchor performance
dav-is Apr 20, 2026
26f0a0c
Fix horizontal scroll animation
dav-is Apr 20, 2026
650727f
Fix truncated fade css
dav-is Apr 20, 2026
cc673ce
Fix first render
dav-is Apr 20, 2026
95a8b6a
Merge branch 'master' into docs-infra/add-linter
dav-is Apr 21, 2026
c89941d
Add emphasis options for code blocks
dav-is Apr 21, 2026
759a5ad
Merge branch 'docs-infra/add-linter' of github.com:mui/mui-public int…
dav-is Apr 21, 2026
0b84ea1
Update page index and types.md
dav-is Apr 21, 2026
79f786a
Fix type export
dav-is Apr 21, 2026
62f565b
Merge branch 'master' into docs-infra/add-linter
dav-is Apr 22, 2026
4e7fd55
bump version
dav-is Apr 22, 2026
07fc497
Code Review
dav-is Apr 22, 2026
2a0ecc4
Hide visibility when collapsed
dav-is Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/orbs/code-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ commands:
eslint:
description: 'Runs ESLint on the codebase'
steps:
- run:
name: Build docs-infra for ESLint plugins
command: pnpm run docs:lib
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eslint plugins go in code-infra package: packages/code-infra/src/eslint/docsConfig.mjs
For now they're authored in plain javascript. We want to avoid making docs-infra a dependency of code-infra

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is in the wrong place, no? It breaks all the other repositories's CI. But it looks specific to mui/mui-public.

- restore_cache:
keys:
- eslint-cache-{{ checksum "pnpm-lock.yaml" }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import styles from './CodeContent.module.css';
import '../../../../../docs-infra/components/code-highlighter/demos/syntax.css';

export function CodeContent(props: ContentProps<{}>) {
// @focus-start @padding 1
const code = useCode(props, { preClassName: styles.codeBlock });

return <div className={styles.code}>{code.selectedFile}</div>;
// @focus-end
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import '../../../../../docs-infra/components/code-highlighter/demos/syntax.css';
export function CodeContentLoading(props: ContentLoadingProps<{}>) {
return (
<div>
{/* @focus-start */}
<div className={styles.code}>
<pre className={styles.codeBlock}>{props.source}</pre>
</div>
{/* @focus-end */}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const sourceParser = createParseSource();

export default function Page() {
return (
// @focus-start
<CodeHighlighter
Content={CodeContent}
ContentLoading={CodeContentLoading}
Expand All @@ -19,5 +20,6 @@ export default function Page() {
>
{code}
</CodeHighlighter>
// @focus-end
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import { CodeControllerContext } from '@mui/internal-docs-infra/CodeControllerCo
import type { ControlledCode } from '@mui/internal-docs-infra/CodeHighlighter/types';

export function CodeController({ children }: { children: React.ReactNode }) {
// @focus-start @padding 1
const [code, setCode] = React.useState<ControlledCode | undefined>(undefined);

const contextValue = React.useMemo(() => ({ code, setCode }), [code, setCode]);

return (
<CodeControllerContext.Provider value={contextValue}>{children}</CodeControllerContext.Provider>
);
// @focus-end
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function greet(name) {

export function CodeEditor() {
return (
// @focus-start
<CodeProvider>
<CodeController>
<CodeHighlighter
Expand All @@ -31,5 +32,6 @@ export function CodeEditor() {
/>
</CodeController>
</CodeProvider>
// @focus-end
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,26 @@
display: flex;
}
.code {
padding: 6px;
padding: 6px 0;
}

.codeBlock {
margin: 0;
padding: 6px;
padding: 6px 0;
overflow-x: auto;
}

/* Code element inside pre — block so frames stretch to the widest line */
.codeBlock :global(code) {
display: block;
min-width: fit-content;
}

.codeBlock :global(.frame) {
display: block;
padding: 0 12px;
}

.codeBlock:focus-visible {
outline: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import styles from './CodeEditorContent.module.css';
import '../../../code-highlighter/demos/syntax.css';

export function CodeEditorContent(props: ContentProps<object>) {
// @focus-start @padding 1
const preRef = React.useRef<HTMLPreElement | null>(null);
const code = useCode(props, { preClassName: styles.codeBlock, preRef });

Expand Down Expand Up @@ -47,4 +48,5 @@ export function CodeEditorContent(props: ContentProps<object>) {
<div className={styles.code}>{code.selectedFile}</div>
</div>
);
// @focus-end
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function Runner({ code }: { code: string }) {
}

export function DemoController({ children }: { children: React.ReactNode }) {
// @focus-start @padding 1
const [code, setCode] = React.useState<ControlledCode | undefined>(undefined);

const components = React.useMemo(
Expand Down Expand Up @@ -56,4 +57,5 @@ export function DemoController({ children }: { children: React.ReactNode }) {
return (
<CodeControllerContext.Provider value={contextValue}>{children}</CodeControllerContext.Provider>
);
// @focus-end
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { DemoCheckboxBasic } from './demo-basic';

export function DemoLive() {
return (
// @focus-start
<CodeProvider>
<DemoController>
<DemoCheckboxBasic />
</DemoController>
</CodeProvider>
// @focus-end
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,26 @@
}

.code {
padding: 10px 6px;
padding: 10px 0;
}

.codeBlock {
margin: 0;
padding: 6px;
padding: 6px 0;
overflow-x: auto;
}

/* Code element inside pre — block so frames stretch to the widest line */
.codeBlock :global(code) {
display: block;
min-width: fit-content;
}

.codeBlock :global(.frame) {
display: block;
padding: 0 12px;
}

.codeBlock:focus-visible {
outline: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const variantNames: Record<string, string | undefined> = {
};

export function DemoLiveContent(props: ContentProps<object>) {
// @focus-start @padding 1
const preRef = React.useRef<HTMLPreElement | null>(null);
const demo = useDemo(props, { preClassName: styles.codeBlock, preRef });

Expand Down Expand Up @@ -85,4 +86,5 @@ export function DemoLiveContent(props: ContentProps<object>) {
</div>
</div>
);
// @focus-end
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { Checkbox } from '@/components/Checkbox';
export default function CheckboxBasic() {
return (
<div>
{/* @focus-start */}
<Checkbox defaultChecked />
<p style={{ color: '#CA244D' }}>Type Whatever You Want Below</p>
{/* @focus-end */}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import styles from '../code-editor/CodeEditorContent.module.css';
import '../../../code-highlighter/demos/syntax.css';

export function MultiFileContent(props: ContentProps<object>) {
// @focus-start @padding 1
const preRef = React.useRef<HTMLPreElement | null>(null);
const code = useCode(props, { preClassName: styles.codeBlock, preRef });

Expand Down Expand Up @@ -43,4 +44,5 @@ export function MultiFileContent(props: ContentProps<object>) {
<div className={styles.code}>{code.selectedFile}</div>
</div>
);
// @focus-end
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ p {

export function MultiFileEditor() {
return (
// @focus-start
<CodeProvider>
<CodeController>
<CodeHighlighter
Expand All @@ -54,5 +55,6 @@ export function MultiFileEditor() {
/>
</CodeController>
</CodeProvider>
// @focus-end
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function Code({
fileName?: string;
}) {
return (
// @focus-start
<CodeHighlighter
language={language}
fileName={fileName}
Expand All @@ -27,5 +28,6 @@ export function Code({
>
{children}
</CodeHighlighter>
// @focus-end
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,26 @@
}

.code {
padding: 10px 6px;
padding: 10px 0;
}

.codeBlock {
margin: 0;
padding: 6px;
padding: 6px 0;
overflow-x: auto;
}

/* Code element inside pre — block so frames stretch to the widest line */
.codeBlock :global(code) {
display: block;
min-width: fit-content;
}

.codeBlock :global(.frame) {
display: block;
padding: 0 12px;
}

.codeBlock :global(.frame[data-lined]) {
display: block;
white-space: normal;
Expand All @@ -75,27 +86,55 @@
white-space: pre;
}

/* Highlighted frames get rounded corners and background */
.codeBlock :global(.frame[data-frame-type='highlighted']),
.codeBlock :global(.frame[data-frame-type='highlighted-unfocused']) {
background: #ebe4ff;
border-radius: 8px;
margin: 0 6px;
padding: 0 6px;
}

/* Line-level highlight inside a frame (nested emphasis) */
.codeBlock :global(.line[data-hl]) {
background: #ebe4ff;
margin: 0 -6px;
padding: 0 6px;
}

.codeBlock :global(:not(.line)[data-hl]) {
background: #e1d9ff;
.codeBlock :global(mark) {
background: #ebe4ff;
border-radius: 4px;
}

.codeBlock :global(mark[data-hl]) {
background: #e1d9ff;
}

.codeBlock :global(mark[data-hl='strong']) {
background: #d4c8ff;
}

.codeBlock :global(mark[data-hl-part='start']) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

.codeBlock :global(mark[data-hl-part='middle']) {
border-radius: 0;
}

.codeBlock :global(mark[data-hl-part='end']) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

.codeBlock :global(.line[data-hl='strong']) {
background: #e1d9ff;
margin: 0 -6px;
padding: 0 6px;
}

.codeBlock :global(.line[data-hl='strong'][data-hl-position='end']) {
position: relative;
}

.codeBlock :global(.line[data-hl-position='single']) {
border-radius: 8px;
}
Expand All @@ -110,16 +149,6 @@
border-bottom-right-radius: 8px;
}

.codeBlock :global(.line[data-hl]:has(+ .line[data-hl='strong'][data-hl-position='start'])) {
margin-bottom: -8px;
padding-bottom: 8px;
}

.codeBlock :global(.line[data-hl='strong'][data-hl-position='end']) + :global(.line[data-hl]) {
margin-top: -8px;
padding-top: 8px;
}

.codeBlock :global(.line[data-hl-description])::after {
content: attr(data-hl-description);
float: right;
Expand All @@ -129,3 +158,21 @@
padding: 2px 4px;
margin-right: -6px;
}

.codeBlock :global(.frame[data-frame-description])::before {
content: attr(data-frame-description);
float: right;
background: #8145b5;
border-radius: 8px;
color: white;
padding: 2px 4px;
}

/* Truncated frames: adjust rounding so visible/hidden halves connect */
.codeBlock :global(.frame[data-frame-truncated='visible']) {
border-radius: 8px 8px 0 0;
}

.codeBlock :global(.frame[data-frame-truncated='hidden']) {
border-radius: 0 0 8px 8px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const variantNames: Record<string, string | undefined> = {
};

export function CodeContent(props: ContentProps<object>) {
// @focus-start
const code = useCode(props, { preClassName: styles.codeBlock });

const hasJsTransform = code.availableTransforms.includes('js');
Expand Down Expand Up @@ -85,4 +86,5 @@ export function CodeContent(props: ContentProps<object>) {
</div>
</div>
);
// @focus-end
}
Loading
Loading