@mui/internal-core-docs 0.0.1 → 9.0.0-canary.1
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/Ad/Ad.d.ts +5 -0
- package/Ad/Ad.js +226 -0
- package/Ad/AdCarbon.d.ts +2 -0
- package/Ad/AdCarbon.js +125 -0
- package/Ad/AdDisplay.d.ts +16 -0
- package/Ad/AdDisplay.js +86 -0
- package/Ad/AdGuest.d.ts +10 -0
- package/Ad/AdGuest.js +29 -0
- package/Ad/AdInHouse.d.ts +4 -0
- package/Ad/AdInHouse.js +14 -0
- package/Ad/AdManager.d.ts +19 -0
- package/Ad/AdManager.js +36 -0
- package/Ad/AdProvider.d.ts +15 -0
- package/Ad/AdProvider.js +24 -0
- package/Ad/ad.styles.d.ts +4 -0
- package/Ad/ad.styles.js +91 -0
- package/Ad/index.d.ts +5 -0
- package/Ad/index.js +7 -0
- package/ApiPage/ApiWarningAlert.d.ts +10 -0
- package/ApiPage/ApiWarningAlert.js +22 -0
- package/ApiPage/definitions/classes.d.ts +18 -0
- package/ApiPage/definitions/classes.js +54 -0
- package/ApiPage/definitions/index.d.ts +4 -0
- package/ApiPage/definitions/index.js +4 -0
- package/ApiPage/definitions/properties.d.ts +58 -0
- package/ApiPage/definitions/properties.js +110 -0
- package/ApiPage/definitions/slots.d.ts +16 -0
- package/ApiPage/definitions/slots.js +39 -0
- package/ApiPage/definitions/types.d.ts +53 -0
- package/ApiPage/definitions/types.js +1 -0
- package/ApiPage/index.d.ts +2 -0
- package/ApiPage/index.js +2 -0
- package/ApiPage/list/ClassesList.d.ts +11 -0
- package/ApiPage/list/ClassesList.js +103 -0
- package/ApiPage/list/ExpandableApiItem.d.ts +18 -0
- package/ApiPage/list/ExpandableApiItem.js +241 -0
- package/ApiPage/list/PropertiesList.d.ts +7 -0
- package/ApiPage/list/PropertiesList.js +263 -0
- package/ApiPage/list/SlotsList.d.ts +7 -0
- package/ApiPage/list/SlotsList.js +93 -0
- package/ApiPage/list/index.d.ts +1 -0
- package/ApiPage/list/index.js +1 -0
- package/ApiPage/private.d.ts +3 -0
- package/ApiPage/private.js +3 -0
- package/ApiPage/sections/ClassesSection.d.ts +34 -0
- package/ApiPage/sections/ClassesSection.js +76 -0
- package/ApiPage/sections/PropertiesSection.d.ts +45 -0
- package/ApiPage/sections/PropertiesSection.js +59 -0
- package/ApiPage/sections/SlotsSection.d.ts +24 -0
- package/ApiPage/sections/SlotsSection.js +61 -0
- package/ApiPage/sections/ToggleDisplayOption.d.ts +17 -0
- package/ApiPage/sections/ToggleDisplayOption.js +161 -0
- package/ApiPage/sections/index.d.ts +4 -0
- package/ApiPage/sections/index.js +4 -0
- package/ApiPage/table/ClassesTable.d.ts +7 -0
- package/ApiPage/table/ClassesTable.js +116 -0
- package/ApiPage/table/PropertiesTable.d.ts +6 -0
- package/ApiPage/table/PropertiesTable.js +286 -0
- package/ApiPage/table/SlotsTable.d.ts +6 -0
- package/ApiPage/table/SlotsTable.js +126 -0
- package/ApiPage/table/StyledTableContainer.d.ts +1 -0
- package/ApiPage/table/StyledTableContainer.js +42 -0
- package/ApiPage/types.d.ts +11 -0
- package/ApiPage/types.js +1 -0
- package/CHANGELOG.md +1651 -0
- package/CodeCopy/CodeCopy.d.ts +22 -0
- package/CodeCopy/CodeCopy.js +172 -0
- package/CodeCopy/CodeCopyButton.d.ts +4 -0
- package/CodeCopy/CodeCopyButton.js +40 -0
- package/CodeCopy/index.d.ts +3 -0
- package/CodeCopy/index.js +3 -0
- package/CodeCopy/useClipboardCopy.d.ts +4 -0
- package/CodeCopy/useClipboardCopy.js +21 -0
- package/ComponentLinkHeader/ComponentLinkHeader.d.ts +8 -0
- package/ComponentLinkHeader/ComponentLinkHeader.js +197 -0
- package/ComponentLinkHeader/index.d.ts +2 -0
- package/ComponentLinkHeader/index.js +2 -0
- package/DemoContext/DemoContext.d.ts +86 -0
- package/DemoContext/DemoContext.js +13 -0
- package/DemoContext/index.d.ts +2 -0
- package/DemoContext/index.js +1 -0
- package/DocsApp/AnalyticsProvider.d.ts +17 -0
- package/DocsApp/AnalyticsProvider.js +229 -0
- package/DocsApp/DocsApp.d.ts +79 -0
- package/DocsApp/DocsApp.js +105 -0
- package/DocsApp/GoogleAnalytics.d.ts +9 -0
- package/DocsApp/GoogleAnalytics.js +129 -0
- package/DocsApp/StyledEngineProvider.d.ts +8 -0
- package/DocsApp/StyledEngineProvider.js +38 -0
- package/DocsApp/consoleBanner.d.ts +1 -0
- package/DocsApp/consoleBanner.js +18 -0
- package/DocsApp/createEmotionCache.d.ts +1 -0
- package/DocsApp/createEmotionCache.js +12 -0
- package/DocsApp/createGetInitialProps.d.ts +30 -0
- package/DocsApp/createGetInitialProps.js +29 -0
- package/DocsApp/index.d.ts +5 -0
- package/DocsApp/index.js +4 -0
- package/DocsApp/loadDependencies.d.ts +1 -0
- package/DocsApp/loadDependencies.js +9 -0
- package/DocsApp/reportWebVitals.d.ts +13 -0
- package/DocsApp/reportWebVitals.js +22 -0
- package/DocsApp/serviceWorker.d.ts +1 -0
- package/DocsApp/serviceWorker.js +59 -0
- package/DocsProvider/DocsProvider.d.ts +24 -0
- package/DocsProvider/DocsProvider.js +31 -0
- package/DocsProvider/index.d.ts +1 -0
- package/DocsProvider/index.js +1 -0
- package/Document/Document.d.ts +16 -0
- package/Document/Document.js +147 -0
- package/Document/getInitialProps.d.ts +18 -0
- package/Document/getInitialProps.js +60 -0
- package/Document/index.d.ts +2 -0
- package/Document/index.js +2 -0
- package/HighlightedCode/HighlightedCode.d.ts +14 -0
- package/HighlightedCode/HighlightedCode.js +67 -0
- package/HighlightedCode/index.d.ts +1 -0
- package/HighlightedCode/index.js +1 -0
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +28 -0
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +362 -0
- package/HighlightedCodeWithTabs/index.d.ts +2 -0
- package/HighlightedCodeWithTabs/index.js +2 -0
- package/IconImage/IconImage.d.ts +11 -0
- package/IconImage/IconImage.js +83 -0
- package/IconImage/index.d.ts +1 -0
- package/IconImage/index.js +1 -0
- package/InfoCard/InfoCard.d.ts +22 -0
- package/InfoCard/InfoCard.js +91 -0
- package/InfoCard/index.d.ts +1 -0
- package/InfoCard/index.js +1 -0
- package/LICENSE +21 -0
- package/Link/Link.d.ts +25 -0
- package/Link/Link.js +75 -0
- package/Link/MarkdownLinks.d.ts +2 -0
- package/Link/MarkdownLinks.js +84 -0
- package/Link/SkipLink.d.ts +1 -0
- package/Link/SkipLink.js +64 -0
- package/Link/index.d.ts +3 -0
- package/Link/index.js +3 -0
- package/MarkdownElement/MarkdownElement.d.ts +7 -0
- package/MarkdownElement/MarkdownElement.js +847 -0
- package/MarkdownElement/index.d.ts +1 -0
- package/MarkdownElement/index.js +1 -0
- package/MuiPage/MuiPage.d.ts +67 -0
- package/MuiPage/MuiPage.js +1 -0
- package/MuiPage/index.d.ts +1 -0
- package/MuiPage/index.js +1 -0
- package/NextNProgressBar/NProgressBar.d.ts +6 -0
- package/NextNProgressBar/NProgressBar.js +91 -0
- package/NextNProgressBar/NextNProgressBar.d.ts +1 -0
- package/NextNProgressBar/NextNProgressBar.js +42 -0
- package/NextNProgressBar/index.d.ts +1 -0
- package/NextNProgressBar/index.js +1 -0
- package/PageContext/PageContext.d.ts +32 -0
- package/PageContext/PageContext.js +6 -0
- package/PageContext/index.d.ts +2 -0
- package/PageContext/index.js +1 -0
- package/README.md +26 -0
- package/SectionHeadline/SectionHeadline.d.ts +13 -0
- package/SectionHeadline/SectionHeadline.js +81 -0
- package/SectionHeadline/index.d.ts +2 -0
- package/SectionHeadline/index.js +2 -0
- package/SectionTitle/SectionTitle.d.ts +6 -0
- package/SectionTitle/SectionTitle.js +29 -0
- package/SectionTitle/index.d.ts +1 -0
- package/SectionTitle/index.js +1 -0
- package/ThemeContext/ThemeContext.d.ts +92 -0
- package/ThemeContext/ThemeContext.js +200 -0
- package/ThemeContext/index.d.ts +1 -0
- package/ThemeContext/index.js +1 -0
- package/branding/BrandingCssVarsProvider.d.ts +27 -0
- package/branding/BrandingCssVarsProvider.js +170 -0
- package/branding/BrandingProvider.d.ts +9 -0
- package/branding/BrandingProvider.js +17 -0
- package/branding/brandingTheme.d.ts +147 -0
- package/branding/brandingTheme.js +1534 -0
- package/branding/index.d.ts +3 -0
- package/branding/index.js +3 -0
- package/codeStyling/codeStyling.d.ts +7 -0
- package/codeStyling/codeStyling.js +80 -0
- package/codeStyling/index.d.ts +1 -0
- package/codeStyling/index.js +1 -0
- package/codeVariant/codeVariant.d.ts +7 -0
- package/codeVariant/codeVariant.js +69 -0
- package/codeVariant/index.d.ts +1 -0
- package/codeVariant/index.js +1 -0
- package/constants/constants.d.ts +13 -0
- package/constants/constants.js +15 -0
- package/constants/index.d.ts +1 -0
- package/constants/index.js +1 -0
- package/findActivePage/findActivePage.d.ts +5 -0
- package/findActivePage/findActivePage.js +35 -0
- package/findActivePage/index.d.ts +1 -0
- package/findActivePage/index.js +1 -0
- package/getProductInfoFromUrl/getProductInfoFromUrl.d.ts +8 -0
- package/getProductInfoFromUrl/getProductInfoFromUrl.js +50 -0
- package/getProductInfoFromUrl/index.d.ts +2 -0
- package/getProductInfoFromUrl/index.js +1 -0
- package/globalSelector/globalSelector.d.ts +2 -0
- package/globalSelector/globalSelector.js +17 -0
- package/globalSelector/index.d.ts +1 -0
- package/globalSelector/index.js +1 -0
- package/helpers/helpers.d.ts +31 -0
- package/helpers/helpers.js +87 -0
- package/helpers/index.d.ts +2 -0
- package/helpers/index.js +1 -0
- package/i18n/i18n.d.ts +27 -0
- package/i18n/i18n.js +111 -0
- package/i18n/index.d.ts +1 -0
- package/i18n/index.js +1 -0
- package/mapApiPageTranslations/index.d.ts +1 -0
- package/mapApiPageTranslations/index.js +1 -0
- package/mapApiPageTranslations/mapApiPageTranslations.d.ts +11 -0
- package/mapApiPageTranslations/mapApiPageTranslations.js +46 -0
- package/nextFonts/fonts/GeneralSans-Bold.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Bold.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Medium.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Medium.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Regular.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Regular.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Semibold-subset.woff2 +0 -0
- package/nextFonts/fonts/GeneralSans-Semibold.ttf +0 -0
- package/nextFonts/fonts/GeneralSans-Semibold.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Bold.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-Bold.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-Bold.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Medium.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-Medium.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-Medium.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular-subset.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-Regular.woff2 +0 -0
- package/nextFonts/fonts/IBMPlexSans-SemiBold.ttf +0 -0
- package/nextFonts/fonts/IBMPlexSans-SemiBold.woff +0 -0
- package/nextFonts/fonts/IBMPlexSans-SemiBold.woff2 +0 -0
- package/nextFonts/index.d.ts +6 -0
- package/nextFonts/index.js +59 -0
- package/package.json +426 -3
- package/svgIcons/BundleSizeIcon.d.ts +4 -0
- package/svgIcons/BundleSizeIcon.js +13 -0
- package/svgIcons/FigmaIcon.d.ts +4 -0
- package/svgIcons/FigmaIcon.js +22 -0
- package/svgIcons/FileDownload.d.ts +6 -0
- package/svgIcons/FileDownload.js +13 -0
- package/svgIcons/JavaScript.d.ts +6 -0
- package/svgIcons/JavaScript.js +13 -0
- package/svgIcons/MarkdownIcon.d.ts +2 -0
- package/svgIcons/MarkdownIcon.js +22 -0
- package/svgIcons/MaterialDesignIcon.d.ts +4 -0
- package/svgIcons/MaterialDesignIcon.js +18 -0
- package/svgIcons/SketchIcon.d.ts +4 -0
- package/svgIcons/SketchIcon.js +27 -0
- package/svgIcons/TypeScript.d.ts +6 -0
- package/svgIcons/TypeScript.js +13 -0
- package/svgIcons/W3CIcon.d.ts +4 -0
- package/svgIcons/W3CIcon.js +15 -0
- package/translations/index.d.ts +3 -0
- package/translations/index.js +4 -0
- package/translations/translations.json +222 -0
- package/useLazyCSS/index.d.ts +1 -0
- package/useLazyCSS/index.js +1 -0
- package/useLazyCSS/useLazyCSS.d.ts +11 -0
- package/useLazyCSS/useLazyCSS.js +70 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/loadScript.d.ts +1 -0
- package/utils/loadScript.js +7 -0
- package/webpack/index.d.ts +17 -0
- package/webpack/index.js +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { mapTranslations } from "../i18n/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Factory to create MyApp.getInitialProps.
|
|
4
|
+
* Follows the same pattern as `@mui/internal-core-docs/Document`'s `createGetInitialProps`.
|
|
5
|
+
*
|
|
6
|
+
* @param options.translationsContext - A webpack require.context pointing at translation JSON files.
|
|
7
|
+
* e.g. `require.context('docs/translations', false, /\.\/translations.*\.json$/)`
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export function createGetInitialProps(options) {
|
|
11
|
+
async function getInitialPropsApp({
|
|
12
|
+
ctx,
|
|
13
|
+
Component
|
|
14
|
+
}) {
|
|
15
|
+
let pageProps = {};
|
|
16
|
+
const translations = mapTranslations(options.translationsContext);
|
|
17
|
+
if (Component.getInitialProps) {
|
|
18
|
+
pageProps = await Component.getInitialProps(ctx);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
pageProps: {
|
|
22
|
+
userLanguage: ctx.query.userLanguage || 'en',
|
|
23
|
+
translations,
|
|
24
|
+
...pageProps
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return getInitialPropsApp;
|
|
29
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DocsApp } from "./DocsApp.js";
|
|
2
|
+
export type { DocsAppProps } from "./DocsApp.js";
|
|
3
|
+
export { createGetInitialProps } from "./createGetInitialProps.js";
|
|
4
|
+
export { printConsoleBanner } from "./consoleBanner.js";
|
|
5
|
+
export { reportWebVitals } from "./reportWebVitals.js";
|
package/DocsApp/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadDependencies(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { loadCSS } from 'fg-loadcss';
|
|
2
|
+
let dependenciesLoaded = false;
|
|
3
|
+
export function loadDependencies() {
|
|
4
|
+
if (dependenciesLoaded) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
dependenciesLoaded = true;
|
|
8
|
+
loadCSS('https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Two+Tone', document.querySelector('#material-icon-font') ?? undefined);
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Track fraction of actual events to prevent exceeding event quota.
|
|
2
|
+
// Filter sessions instead of individual events so that we can track multiple metrics per device.
|
|
3
|
+
// See https://github.com/GoogleChromeLabs/web-vitals-report to use this data
|
|
4
|
+
const disableWebVitalsReporting = Math.random() > 0.0001;
|
|
5
|
+
export function reportWebVitals({
|
|
6
|
+
id,
|
|
7
|
+
name,
|
|
8
|
+
label,
|
|
9
|
+
delta,
|
|
10
|
+
value
|
|
11
|
+
}) {
|
|
12
|
+
if (disableWebVitalsReporting) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
window.gtag('event', name, {
|
|
16
|
+
value: delta,
|
|
17
|
+
metric_label: label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
|
|
18
|
+
metric_value: value,
|
|
19
|
+
metric_delta: delta,
|
|
20
|
+
metric_id: id // id unique to current page load
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function registerServiceWorker(swPath: string): Promise<void>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
let reloadInterval;
|
|
2
|
+
|
|
3
|
+
// Avoid infinite loop when "Update on reload" is set in the Chrome sw dev tools.
|
|
4
|
+
function lazyReload() {
|
|
5
|
+
clearInterval(reloadInterval);
|
|
6
|
+
reloadInterval = setInterval(() => {
|
|
7
|
+
if (document.hasFocus()) {
|
|
8
|
+
window.location.reload();
|
|
9
|
+
}
|
|
10
|
+
}, 100);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Inspired by
|
|
14
|
+
// https://developers.google.com/web/tools/workbox/guides/advanced-recipes#offer_a_page_reload_for_users
|
|
15
|
+
function forcePageReload(registration) {
|
|
16
|
+
// console.log('already controlled?', Boolean(navigator.serviceWorker.controller));
|
|
17
|
+
|
|
18
|
+
if (!navigator.serviceWorker.controller) {
|
|
19
|
+
// The window client isn't currently controlled so it's a new service
|
|
20
|
+
// worker that will activate immediately.
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// console.log('registration waiting?', Boolean(registration.waiting));
|
|
25
|
+
if (registration.waiting) {
|
|
26
|
+
// SW is waiting to activate. Can occur if multiple clients open and
|
|
27
|
+
// one of the clients is refreshed.
|
|
28
|
+
registration.waiting.postMessage('skipWaiting');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
function listenInstalledStateChange() {
|
|
32
|
+
registration.installing.addEventListener('statechange', event => {
|
|
33
|
+
// console.log('statechange', event.target.state);
|
|
34
|
+
if (event.target.state === 'installed' && registration.waiting) {
|
|
35
|
+
// A new service worker is available, inform the user
|
|
36
|
+
registration.waiting.postMessage('skipWaiting');
|
|
37
|
+
} else if (event.target.state === 'activated') {
|
|
38
|
+
// Force the control of the page by the activated service worker.
|
|
39
|
+
lazyReload();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (registration.installing) {
|
|
44
|
+
listenInstalledStateChange();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// We are currently controlled so a new SW may be found...
|
|
49
|
+
// Add a listener in case a new SW is found,
|
|
50
|
+
registration.addEventListener('updatefound', listenInstalledStateChange);
|
|
51
|
+
}
|
|
52
|
+
export async function registerServiceWorker(swPath) {
|
|
53
|
+
if ('serviceWorker' in navigator && process.env.NODE_ENV === 'production' && window.location.host.includes('mui.com')) {
|
|
54
|
+
// register() automatically attempts to refresh the sw.js.
|
|
55
|
+
const registration = await navigator.serviceWorker.register(swPath);
|
|
56
|
+
// Force the page reload for users.
|
|
57
|
+
forcePageReload(registration);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Translations } from "../i18n/index.js";
|
|
3
|
+
import { AdConfig } from "../Ad/index.js";
|
|
4
|
+
export interface DocsConfig {
|
|
5
|
+
LANGUAGES: string[];
|
|
6
|
+
LANGUAGES_SSR: string[];
|
|
7
|
+
LANGUAGES_IN_PROGRESS: string[];
|
|
8
|
+
LANGUAGES_IGNORE_PAGES: (pathname: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DocsProviderProps {
|
|
11
|
+
config: DocsConfig;
|
|
12
|
+
adConfig?: Partial<AdConfig>;
|
|
13
|
+
defaultUserLanguage: string;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
translations?: Translations;
|
|
16
|
+
}
|
|
17
|
+
export declare function DocsProvider({
|
|
18
|
+
config,
|
|
19
|
+
adConfig,
|
|
20
|
+
defaultUserLanguage,
|
|
21
|
+
translations,
|
|
22
|
+
children
|
|
23
|
+
}: DocsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function useDocsConfig(): DocsConfig;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UserLanguageProvider } from "../i18n/index.js";
|
|
3
|
+
import { AdProvider } from "../Ad/index.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const DocsConfigContext = /*#__PURE__*/React.createContext(null);
|
|
6
|
+
export function DocsProvider({
|
|
7
|
+
config,
|
|
8
|
+
adConfig,
|
|
9
|
+
defaultUserLanguage,
|
|
10
|
+
translations,
|
|
11
|
+
children
|
|
12
|
+
}) {
|
|
13
|
+
return /*#__PURE__*/_jsx(DocsConfigContext.Provider, {
|
|
14
|
+
value: config,
|
|
15
|
+
children: /*#__PURE__*/_jsx(AdProvider, {
|
|
16
|
+
config: adConfig,
|
|
17
|
+
children: /*#__PURE__*/_jsx(UserLanguageProvider, {
|
|
18
|
+
defaultUserLanguage: defaultUserLanguage,
|
|
19
|
+
translations: translations,
|
|
20
|
+
children: children
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function useDocsConfig() {
|
|
26
|
+
const config = React.useContext(DocsConfigContext);
|
|
27
|
+
if (!config) {
|
|
28
|
+
throw new Error('Could not find docs config context value; please ensure the component is wrapped in a <DocsProvider>');
|
|
29
|
+
}
|
|
30
|
+
return config;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DocsProvider.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DocsProvider.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type DocumentProps = {
|
|
3
|
+
canonicalAsServer: string;
|
|
4
|
+
analytics: {
|
|
5
|
+
google: string;
|
|
6
|
+
apollo: string;
|
|
7
|
+
};
|
|
8
|
+
userLanguage: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare function Document({
|
|
12
|
+
canonicalAsServer,
|
|
13
|
+
userLanguage,
|
|
14
|
+
analytics,
|
|
15
|
+
children
|
|
16
|
+
}: DocumentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
var _link, _link2, _link3, _MuiInitColorSchemeSc, _Main, _NextScript;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Script from 'next/script';
|
|
4
|
+
import { Html, Head, Main, NextScript } from 'next/document';
|
|
5
|
+
import GlobalStyles from '@mui/material/GlobalStyles';
|
|
6
|
+
import MuiInitColorSchemeScript from '@mui/material/InitColorSchemeScript';
|
|
7
|
+
import { getMetaThemeColor } from "../branding/index.js";
|
|
8
|
+
import { fontClasses } from "../nextFonts/index.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export function Document({
|
|
11
|
+
canonicalAsServer,
|
|
12
|
+
userLanguage,
|
|
13
|
+
analytics,
|
|
14
|
+
children
|
|
15
|
+
}) {
|
|
16
|
+
return /*#__PURE__*/_jsxs(Html, {
|
|
17
|
+
lang: userLanguage,
|
|
18
|
+
"data-mui-color-scheme": "light",
|
|
19
|
+
children: [/*#__PURE__*/_jsxs(Head, {
|
|
20
|
+
children: [_link || (_link = /*#__PURE__*/_jsx("link", {
|
|
21
|
+
rel: "manifest",
|
|
22
|
+
href: "/static/manifest.json"
|
|
23
|
+
})), /*#__PURE__*/_jsx("meta", {
|
|
24
|
+
name: "theme-color",
|
|
25
|
+
content: getMetaThemeColor('light'),
|
|
26
|
+
media: "(prefers-color-scheme: light)"
|
|
27
|
+
}), /*#__PURE__*/_jsx("meta", {
|
|
28
|
+
name: "theme-color",
|
|
29
|
+
content: getMetaThemeColor('dark'),
|
|
30
|
+
media: "(prefers-color-scheme: dark)"
|
|
31
|
+
}), _link2 || (_link2 = /*#__PURE__*/_jsx("link", {
|
|
32
|
+
rel: "icon",
|
|
33
|
+
href: "/static/favicon.ico"
|
|
34
|
+
})), _link3 || (_link3 = /*#__PURE__*/_jsx("link", {
|
|
35
|
+
rel: "apple-touch-icon",
|
|
36
|
+
sizes: "180x180",
|
|
37
|
+
href: "/static/icons/180x180.png"
|
|
38
|
+
})), /*#__PURE__*/_jsx("link", {
|
|
39
|
+
rel: "canonical",
|
|
40
|
+
href: `https://mui.com${userLanguage === 'en' ? '' : `/${userLanguage}`}${canonicalAsServer}`
|
|
41
|
+
}), /*#__PURE__*/_jsx("link", {
|
|
42
|
+
rel: "alternate",
|
|
43
|
+
href: `https://mui.com${canonicalAsServer}`,
|
|
44
|
+
hrefLang: "x-default"
|
|
45
|
+
}), /*#__PURE__*/_jsx(GlobalStyles, {
|
|
46
|
+
styles: {
|
|
47
|
+
// First SSR paint
|
|
48
|
+
'.only-light-mode': {
|
|
49
|
+
display: 'block'
|
|
50
|
+
},
|
|
51
|
+
'.only-dark-mode': {
|
|
52
|
+
display: 'none'
|
|
53
|
+
},
|
|
54
|
+
// Post SSR Hydration
|
|
55
|
+
'.mode-dark .only-light-mode': {
|
|
56
|
+
display: 'none'
|
|
57
|
+
},
|
|
58
|
+
'.mode-dark .only-dark-mode': {
|
|
59
|
+
display: 'block'
|
|
60
|
+
},
|
|
61
|
+
// TODO migrate to .only-dark-mode to .only-dark-mode-v2
|
|
62
|
+
'[data-mui-color-scheme="light"] .only-dark-mode-v2': {
|
|
63
|
+
display: 'none'
|
|
64
|
+
},
|
|
65
|
+
'[data-mui-color-scheme="dark"] .only-light-mode-v2': {
|
|
66
|
+
display: 'none'
|
|
67
|
+
},
|
|
68
|
+
'.plan-pro, .plan-premium': {
|
|
69
|
+
display: 'inline-block',
|
|
70
|
+
height: '0.9em',
|
|
71
|
+
width: '1em',
|
|
72
|
+
verticalAlign: 'middle',
|
|
73
|
+
marginLeft: '0.3em',
|
|
74
|
+
marginBottom: '0.08em',
|
|
75
|
+
backgroundSize: 'contain',
|
|
76
|
+
backgroundRepeat: 'no-repeat',
|
|
77
|
+
flexShrink: 0
|
|
78
|
+
},
|
|
79
|
+
'.plan-pro': {
|
|
80
|
+
backgroundImage: 'url(/static/x/pro.svg)'
|
|
81
|
+
},
|
|
82
|
+
'.plan-premium': {
|
|
83
|
+
backgroundImage: 'url(/static/x/premium.svg)'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})]
|
|
87
|
+
}), /*#__PURE__*/_jsxs("body", {
|
|
88
|
+
className: fontClasses,
|
|
89
|
+
children: [_MuiInitColorSchemeSc || (_MuiInitColorSchemeSc = /*#__PURE__*/_jsx(MuiInitColorSchemeScript, {
|
|
90
|
+
defaultMode: "system"
|
|
91
|
+
})), children, _Main || (_Main = /*#__PURE__*/_jsx(Main, {})), /*#__PURE__*/_jsx("script", {
|
|
92
|
+
// eslint-disable-next-line react/no-danger
|
|
93
|
+
dangerouslySetInnerHTML: {
|
|
94
|
+
__html: `
|
|
95
|
+
window.dataLayer = window.dataLayer || [];
|
|
96
|
+
function gtag(){dataLayer.push(arguments);}
|
|
97
|
+
window.gtag = gtag;
|
|
98
|
+
|
|
99
|
+
${ /* Set default consent to denied (Google Consent Mode v2) */''}
|
|
100
|
+
gtag('consent', 'default', {
|
|
101
|
+
'ad_storage': 'denied',
|
|
102
|
+
'ad_user_data': 'denied',
|
|
103
|
+
'ad_personalization': 'denied',
|
|
104
|
+
'analytics_storage': 'denied',
|
|
105
|
+
'wait_for_update': 500
|
|
106
|
+
});
|
|
107
|
+
gtag('set', 'ads_data_redaction', true);
|
|
108
|
+
gtag('set', 'url_passthrough', true);
|
|
109
|
+
|
|
110
|
+
gtag('js', new Date());
|
|
111
|
+
gtag('config', '${analytics.google}', {
|
|
112
|
+
send_page_view: false,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
${ /* Apollo initialization - called by AnalyticsProvider when consent is granted */''}
|
|
116
|
+
window.initApollo = function() {
|
|
117
|
+
if (window.apolloInitialized) return;
|
|
118
|
+
window.apolloInitialized = true;
|
|
119
|
+
var n = Math.random().toString(36).substring(7),
|
|
120
|
+
o = document.createElement('script');
|
|
121
|
+
o.src = 'https://assets.apollo.io/micro/website-tracker/tracker.iife.js?nocache=' + n;
|
|
122
|
+
o.async = true;
|
|
123
|
+
o.defer = true;
|
|
124
|
+
o.onload = function () {
|
|
125
|
+
window.trackingFunctions.onLoad({ appId: '${analytics.apollo}' });
|
|
126
|
+
};
|
|
127
|
+
document.head.appendChild(o);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
${ /* Check localStorage for existing consent and initialize if already granted */''}
|
|
131
|
+
(function() {
|
|
132
|
+
try {
|
|
133
|
+
var consent = localStorage.getItem('docs-cookie-consent');
|
|
134
|
+
if (consent === 'analytics') {
|
|
135
|
+
window.initApollo();
|
|
136
|
+
}
|
|
137
|
+
} catch (e) {}
|
|
138
|
+
})();
|
|
139
|
+
`
|
|
140
|
+
}
|
|
141
|
+
}), /*#__PURE__*/_jsx(Script, {
|
|
142
|
+
strategy: "afterInteractive",
|
|
143
|
+
src: `https://www.googletagmanager.com/gtag/js?id=${analytics.google}`
|
|
144
|
+
}), _NextScript || (_NextScript = /*#__PURE__*/_jsx(NextScript, {}))]
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { DocumentContext } from 'next/document';
|
|
3
|
+
export declare function createGetInitialProps({
|
|
4
|
+
setupStyledComponents
|
|
5
|
+
}: {
|
|
6
|
+
setupStyledComponents: boolean;
|
|
7
|
+
}): (ctx: DocumentContext) => Promise<{
|
|
8
|
+
canonicalAsServer: string;
|
|
9
|
+
analytics: {
|
|
10
|
+
google: string;
|
|
11
|
+
apollo: string;
|
|
12
|
+
};
|
|
13
|
+
userLanguage: string | string[];
|
|
14
|
+
styles: (string | number | bigint | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element)[];
|
|
15
|
+
html: string;
|
|
16
|
+
head?: Array<React.JSX.Element | null>;
|
|
17
|
+
emotionStyleTags: React.ReactElement<unknown>[];
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var _style, _style2, _style3, _style4;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { documentGetInitialProps } from '@mui/material-nextjs/v13-pagesRouter';
|
|
4
|
+
import createEmotionCache from "../DocsApp/createEmotionCache.js";
|
|
5
|
+
import { pathnameToLanguage } from "../helpers/helpers.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function createGetInitialProps({
|
|
8
|
+
setupStyledComponents = false
|
|
9
|
+
}) {
|
|
10
|
+
async function getInitialPropsDocument(ctx) {
|
|
11
|
+
const styledComponentsSheet = setupStyledComponents ? new (await import('styled-components')).ServerStyleSheet() : null;
|
|
12
|
+
try {
|
|
13
|
+
const finalProps = await documentGetInitialProps(ctx, {
|
|
14
|
+
emotionCache: createEmotionCache(),
|
|
15
|
+
plugins: styledComponentsSheet ? [{
|
|
16
|
+
enhanceApp: App => props => styledComponentsSheet.collectStyles(/*#__PURE__*/_jsx(App, {
|
|
17
|
+
...props
|
|
18
|
+
})),
|
|
19
|
+
resolveProps: async initialProps => ({
|
|
20
|
+
...initialProps,
|
|
21
|
+
styles: [styledComponentsSheet.getStyleElement(), ...React.Children.toArray(initialProps.styles)]
|
|
22
|
+
})
|
|
23
|
+
}] : []
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// All the URLs should have a leading /.
|
|
27
|
+
// This is missing in the Next.js static export.
|
|
28
|
+
let url = ctx.req?.url;
|
|
29
|
+
if (url && url[url.length - 1] !== '/') {
|
|
30
|
+
url += '/';
|
|
31
|
+
}
|
|
32
|
+
const isProd = process.env.DEPLOY_ENV === 'production' || process.env.DEPLOY_ENV === 'staging';
|
|
33
|
+
const google = isProd ? 'G-5NXDQLC2ZK' : 'G-XJ83JQEK7J';
|
|
34
|
+
const apollo = isProd ? '691c2e920c5e20000d7801b6' : 'dev-id';
|
|
35
|
+
return {
|
|
36
|
+
...finalProps,
|
|
37
|
+
canonicalAsServer: pathnameToLanguage(url ?? '').canonicalAsServer,
|
|
38
|
+
analytics: {
|
|
39
|
+
google,
|
|
40
|
+
apollo
|
|
41
|
+
},
|
|
42
|
+
userLanguage: ctx.query.userLanguage || 'en',
|
|
43
|
+
styles: [_style || (_style = /*#__PURE__*/_jsx("style", {
|
|
44
|
+
id: "material-icon-font"
|
|
45
|
+
}, "material-icon-font")), _style2 || (_style2 = /*#__PURE__*/_jsx("style", {
|
|
46
|
+
id: "font-awesome-css"
|
|
47
|
+
}, "font-awesome-css")), ...finalProps.emotionStyleTags, _style3 || (_style3 = /*#__PURE__*/_jsx("style", {
|
|
48
|
+
id: "app-search"
|
|
49
|
+
}, "app-search")), _style4 || (_style4 = /*#__PURE__*/_jsx("style", {
|
|
50
|
+
id: "prismjs"
|
|
51
|
+
}, "prismjs")), ...React.Children.toArray(finalProps.styles)]
|
|
52
|
+
};
|
|
53
|
+
} finally {
|
|
54
|
+
if (styledComponentsSheet) {
|
|
55
|
+
styledComponentsSheet.seal();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return getInitialPropsDocument;
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
+
import { SxProps } from '@mui/material/styles';
|
|
4
|
+
export interface HighlightedCodeProps {
|
|
5
|
+
code: string;
|
|
6
|
+
copyButtonHidden?: boolean;
|
|
7
|
+
copyButtonProps?: ButtonProps;
|
|
8
|
+
language: string;
|
|
9
|
+
parentComponent?: React.ElementType;
|
|
10
|
+
plainStyle?: boolean;
|
|
11
|
+
preComponent?: React.ElementType;
|
|
12
|
+
sx?: SxProps;
|
|
13
|
+
}
|
|
14
|
+
export declare function HighlightedCode(props: HighlightedCodeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import prism from '@mui/internal-markdown/prism';
|
|
3
|
+
import { NoSsr } from '@mui/base/NoSsr';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { useCodeCopy, CodeCopyButton } from "../CodeCopy/index.js";
|
|
6
|
+
import { MarkdownElement } from "../MarkdownElement/index.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const Pre = styled('pre')(({
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
margin: 0,
|
|
12
|
+
color: 'hsl(60deg 30% 96.08%)',
|
|
13
|
+
// fallback color until Prism's theme is loaded
|
|
14
|
+
WebkitOverflowScrolling: 'touch',
|
|
15
|
+
// iOS momentum scrolling.
|
|
16
|
+
'& code': {
|
|
17
|
+
// Avoid layout jump after hydration (style injected by Prism)
|
|
18
|
+
...theme.typography.caption,
|
|
19
|
+
fontFamily: theme.typography.fontFamilyCode,
|
|
20
|
+
fontWeight: 400,
|
|
21
|
+
WebkitFontSmoothing: 'subpixel-antialiased'
|
|
22
|
+
// Reset for Safari
|
|
23
|
+
// https://github.com/necolas/normalize.css/blob/master/normalize.css#L102
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
export function HighlightedCode(props) {
|
|
27
|
+
const {
|
|
28
|
+
code,
|
|
29
|
+
copyButtonHidden = false,
|
|
30
|
+
copyButtonProps,
|
|
31
|
+
language,
|
|
32
|
+
plainStyle,
|
|
33
|
+
parentComponent: Component = plainStyle ? React.Fragment : MarkdownElement,
|
|
34
|
+
preComponent: PreComponent = plainStyle ? Pre : 'pre',
|
|
35
|
+
...other
|
|
36
|
+
} = props;
|
|
37
|
+
const renderedCode = React.useMemo(() => {
|
|
38
|
+
return prism(code.trim(), language);
|
|
39
|
+
}, [code, language]);
|
|
40
|
+
const handlers = useCodeCopy();
|
|
41
|
+
const componentProps = !plainStyle ? other : undefined;
|
|
42
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
43
|
+
...componentProps,
|
|
44
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
45
|
+
className: "MuiCode-root",
|
|
46
|
+
...handlers,
|
|
47
|
+
style: {
|
|
48
|
+
height: '100%'
|
|
49
|
+
},
|
|
50
|
+
children: [copyButtonHidden ? null : /*#__PURE__*/_jsx(NoSsr, {
|
|
51
|
+
children: /*#__PURE__*/_jsx(CodeCopyButton, {
|
|
52
|
+
code: code,
|
|
53
|
+
...copyButtonProps
|
|
54
|
+
})
|
|
55
|
+
}), /*#__PURE__*/_jsx(PreComponent, {
|
|
56
|
+
children: /*#__PURE__*/_jsx("code", {
|
|
57
|
+
className: `language-${language}`
|
|
58
|
+
// eslint-disable-next-line react/no-danger
|
|
59
|
+
,
|
|
60
|
+
dangerouslySetInnerHTML: {
|
|
61
|
+
__html: renderedCode
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
})]
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./HighlightedCode.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./HighlightedCode.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const CodeTabList: import("@emotion/styled").StyledComponent<import("@mui/base/TabsList").TabsListOwnProps & Omit<any, keyof import("@mui/base/TabsList").TabsListOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
2
|
+
ownerState: {
|
|
3
|
+
mounted: boolean;
|
|
4
|
+
contained?: boolean;
|
|
5
|
+
};
|
|
6
|
+
}, {}, {}>;
|
|
7
|
+
export declare const CodeTabPanel: import("@emotion/styled").StyledComponent<import("@mui/base/TabPanel").TabPanelOwnProps & Omit<any, keyof import("@mui/base/TabPanel").TabPanelOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
8
|
+
ownerState: {
|
|
9
|
+
mounted: boolean;
|
|
10
|
+
contained?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}, {}, {}>;
|
|
13
|
+
export declare const CodeTab: import("@emotion/styled").StyledComponent<import("@mui/base/Tab").TabOwnProps & Omit<any, keyof import("@mui/base/Tab").TabOwnProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
14
|
+
ownerState: {
|
|
15
|
+
mounted: boolean;
|
|
16
|
+
contained?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}, {}, {}>;
|
|
19
|
+
type TabsConfig = {
|
|
20
|
+
code: string | ((tab: string) => string);
|
|
21
|
+
language: string;
|
|
22
|
+
tab: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function HighlightedCodeWithTabs(props: {
|
|
25
|
+
tabs: Array<TabsConfig>;
|
|
26
|
+
storageKey?: string;
|
|
27
|
+
} & Record<string, any>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|