@mui/docs 9.0.0-alpha.2 → 9.0.0-alpha.4
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.js +33 -42
- package/Ad/AdCarbon.js +18 -27
- package/Ad/AdDisplay.js +22 -29
- package/Ad/AdGuest.js +8 -15
- package/Ad/AdInHouse.js +4 -11
- package/Ad/AdManager.js +8 -17
- package/Ad/AdProvider.js +5 -13
- package/Ad/ad.styles.js +5 -13
- package/Ad/index.js +6 -62
- package/CHANGELOG.md +191 -0
- package/CodeCopy/CodeCopy.js +10 -19
- package/CodeCopy/CodeCopyButton.js +9 -16
- package/CodeCopy/index.js +3 -40
- package/CodeCopy/useClipboardCopy.js +4 -12
- package/ComponentLinkHeader/ComponentLinkHeader.js +46 -54
- package/ComponentLinkHeader/index.js +2 -24
- 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 +225 -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 +19 -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 +11 -0
- package/DocsApp/reportWebVitals.d.ts +13 -0
- package/DocsApp/reportWebVitals.js +24 -0
- package/DocsApp/serviceWorker.d.ts +1 -0
- package/DocsApp/serviceWorker.js +61 -0
- package/DocsProvider/DocsProvider.js +9 -17
- package/DocsProvider/index.js +1 -16
- package/Document/Document.d.ts +16 -0
- package/Document/Document.js +147 -0
- package/Document/getInitialProps.d.ts +18 -0
- package/Document/getInitialProps.js +62 -0
- package/Document/index.d.ts +2 -0
- package/Document/index.js +2 -0
- package/HighlightedCode/HighlightedCode.js +18 -26
- package/HighlightedCode/index.js +1 -16
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +22 -31
- package/HighlightedCodeWithTabs/index.js +2 -24
- package/IconImage/IconImage.js +13 -21
- package/IconImage/index.js +1 -13
- package/InfoCard/InfoCard.js +20 -29
- package/InfoCard/index.js +1 -16
- package/Link/Link.js +17 -25
- package/Link/MarkdownLinks.d.ts +2 -0
- package/Link/MarkdownLinks.js +84 -0
- package/Link/SkipLink.d.ts +1 -0
- package/Link/SkipLink.js +66 -0
- package/Link/index.d.ts +3 -1
- package/Link/index.js +3 -16
- package/MarkdownElement/MarkdownElement.js +178 -186
- package/MarkdownElement/index.js +1 -16
- 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/NextNProgressBar.d.ts +1 -0
- package/NextNProgressBar/NextNProgressBar.js +44 -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/SectionHeadline/SectionHeadline.js +9 -17
- package/SectionHeadline/index.js +2 -25
- package/SectionTitle/SectionTitle.js +7 -13
- package/SectionTitle/index.js +1 -16
- package/ThemeContext/ThemeContext.js +26 -38
- package/ThemeContext/index.js +1 -42
- package/branding/BrandingCssVarsProvider.d.ts +27 -0
- package/branding/BrandingCssVarsProvider.js +170 -0
- package/branding/BrandingProvider.js +8 -15
- package/branding/brandingTheme.js +184 -188
- package/branding/index.d.ts +2 -1
- package/branding/index.js +3 -27
- 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.js +17 -29
- package/i18n/index.js +1 -16
- 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/index.js +8 -15
- package/package.json +217 -132
- package/svgIcons/BundleSizeIcon.js +5 -11
- package/svgIcons/FigmaIcon.js +8 -14
- package/svgIcons/FileDownload.js +5 -12
- package/svgIcons/JavaScript.js +5 -12
- package/svgIcons/MarkdownIcon.js +7 -14
- package/svgIcons/MaterialDesignIcon.js +6 -12
- package/svgIcons/SketchIcon.js +10 -16
- package/svgIcons/TypeScript.js +5 -12
- package/svgIcons/W3CIcon.js +6 -12
- package/translations/index.js +3 -10
- package/translations/translations.json +0 -1
- package/useLazyCSS/index.js +1 -13
- package/useLazyCSS/useLazyCSS.js +5 -11
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -0
- package/utils/loadScript.js +1 -7
- package/webpack/index.d.ts +17 -0
- package/webpack/index.js +1 -0
- package/Ad/Ad.d.mts +0 -5
- package/Ad/Ad.mjs +0 -226
- package/Ad/AdCarbon.d.mts +0 -2
- package/Ad/AdCarbon.mjs +0 -125
- package/Ad/AdDisplay.d.mts +0 -16
- package/Ad/AdDisplay.mjs +0 -86
- package/Ad/AdGuest.d.mts +0 -10
- package/Ad/AdGuest.mjs +0 -29
- package/Ad/AdInHouse.d.mts +0 -4
- package/Ad/AdInHouse.mjs +0 -14
- package/Ad/AdManager.d.mts +0 -19
- package/Ad/AdManager.mjs +0 -36
- package/Ad/AdProvider.d.mts +0 -15
- package/Ad/AdProvider.mjs +0 -24
- package/Ad/ad.styles.d.mts +0 -4512
- package/Ad/ad.styles.mjs +0 -91
- package/Ad/index.d.mts +0 -5
- package/Ad/index.mjs +0 -7
- package/CodeCopy/CodeCopy.d.mts +0 -22
- package/CodeCopy/CodeCopy.mjs +0 -172
- package/CodeCopy/CodeCopyButton.d.mts +0 -4
- package/CodeCopy/CodeCopyButton.mjs +0 -40
- package/CodeCopy/index.d.mts +0 -3
- package/CodeCopy/index.mjs +0 -3
- package/CodeCopy/useClipboardCopy.d.mts +0 -4
- package/CodeCopy/useClipboardCopy.mjs +0 -21
- package/ComponentLinkHeader/ComponentLinkHeader.d.mts +0 -8
- package/ComponentLinkHeader/ComponentLinkHeader.mjs +0 -197
- package/ComponentLinkHeader/index.d.mts +0 -2
- package/ComponentLinkHeader/index.mjs +0 -2
- package/DocsProvider/DocsProvider.d.mts +0 -24
- package/DocsProvider/DocsProvider.mjs +0 -31
- package/DocsProvider/index.d.mts +0 -1
- package/DocsProvider/index.mjs +0 -1
- package/HighlightedCode/HighlightedCode.d.mts +0 -14
- package/HighlightedCode/HighlightedCode.mjs +0 -67
- package/HighlightedCode/index.d.mts +0 -1
- package/HighlightedCode/index.mjs +0 -1
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.mts +0 -28
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.mjs +0 -362
- package/HighlightedCodeWithTabs/index.d.mts +0 -2
- package/HighlightedCodeWithTabs/index.mjs +0 -2
- package/IconImage/IconImage.d.mts +0 -11
- package/IconImage/IconImage.mjs +0 -83
- package/IconImage/index.d.mts +0 -1
- package/IconImage/index.mjs +0 -1
- package/InfoCard/InfoCard.d.mts +0 -22
- package/InfoCard/InfoCard.mjs +0 -87
- package/InfoCard/index.d.mts +0 -1
- package/InfoCard/index.mjs +0 -1
- package/Link/Link.d.mts +0 -25
- package/Link/Link.mjs +0 -75
- package/Link/index.d.mts +0 -1
- package/Link/index.mjs +0 -1
- package/MarkdownElement/MarkdownElement.d.mts +0 -7
- package/MarkdownElement/MarkdownElement.mjs +0 -847
- package/MarkdownElement/index.d.mts +0 -1
- package/MarkdownElement/index.mjs +0 -1
- package/NProgressBar/NProgressBar.d.mts +0 -6
- package/NProgressBar/NProgressBar.js +0 -98
- package/NProgressBar/index.d.mts +0 -2
- package/NProgressBar/index.d.ts +0 -2
- package/NProgressBar/index.js +0 -13
- package/NProgressBar/index.mjs +0 -1
- package/SectionHeadline/SectionHeadline.d.mts +0 -13
- package/SectionHeadline/SectionHeadline.mjs +0 -81
- package/SectionHeadline/index.d.mts +0 -2
- package/SectionHeadline/index.mjs +0 -2
- package/SectionTitle/SectionTitle.d.mts +0 -6
- package/SectionTitle/SectionTitle.mjs +0 -29
- package/SectionTitle/index.d.mts +0 -1
- package/SectionTitle/index.mjs +0 -1
- package/ThemeContext/ThemeContext.d.mts +0 -92
- package/ThemeContext/ThemeContext.mjs +0 -200
- package/ThemeContext/index.d.mts +0 -1
- package/ThemeContext/index.mjs +0 -1
- package/branding/BrandingProvider.d.mts +0 -9
- package/branding/BrandingProvider.mjs +0 -17
- package/branding/brandingTheme.d.mts +0 -147
- package/branding/brandingTheme.mjs +0 -1527
- package/branding/index.d.mts +0 -2
- package/branding/index.mjs +0 -2
- package/i18n/i18n.d.mts +0 -27
- package/i18n/i18n.mjs +0 -111
- package/i18n/index.d.mts +0 -1
- package/i18n/index.mjs +0 -1
- package/nextFonts/index.d.mts +0 -6
- package/nextFonts/index.mjs +0 -59
- package/svgIcons/BundleSizeIcon.d.mts +0 -4
- package/svgIcons/BundleSizeIcon.mjs +0 -13
- package/svgIcons/FigmaIcon.d.mts +0 -4
- package/svgIcons/FigmaIcon.mjs +0 -22
- package/svgIcons/FileDownload.d.mts +0 -6
- package/svgIcons/FileDownload.mjs +0 -13
- package/svgIcons/JavaScript.d.mts +0 -6
- package/svgIcons/JavaScript.mjs +0 -13
- package/svgIcons/MarkdownIcon.d.mts +0 -2
- package/svgIcons/MarkdownIcon.mjs +0 -22
- package/svgIcons/MaterialDesignIcon.d.mts +0 -4
- package/svgIcons/MaterialDesignIcon.mjs +0 -18
- package/svgIcons/SketchIcon.d.mts +0 -4
- package/svgIcons/SketchIcon.mjs +0 -27
- package/svgIcons/TypeScript.d.mts +0 -6
- package/svgIcons/TypeScript.mjs +0 -13
- package/svgIcons/W3CIcon.d.mts +0 -4
- package/svgIcons/W3CIcon.mjs +0 -15
- package/translations/index.d.mts +0 -3
- package/translations/index.mjs +0 -4
- package/useLazyCSS/index.d.mts +0 -1
- package/useLazyCSS/index.mjs +0 -1
- package/useLazyCSS/useLazyCSS.d.mts +0 -11
- package/useLazyCSS/useLazyCSS.mjs +0 -70
- package/utils/loadScript.d.mts +0 -1
- package/utils/loadScript.mjs +0 -7
- /package/{NProgressBar → NextNProgressBar}/NProgressBar.d.ts +0 -0
- /package/{NProgressBar/NProgressBar.mjs → NextNProgressBar/NProgressBar.js} +0 -0
package/Ad/AdCarbon.mjs
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
var _AdCarbonImage;
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { styled } from '@mui/material/styles';
|
|
4
|
-
import loadScript from "../utils/loadScript.mjs";
|
|
5
|
-
import AdDisplay from "./AdDisplay.mjs";
|
|
6
|
-
import { adBodyImageStyles } from "./ad.styles.mjs";
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const CarbonRoot = styled('span')(({
|
|
9
|
-
theme
|
|
10
|
-
}) => {
|
|
11
|
-
const styles = adBodyImageStyles(theme);
|
|
12
|
-
return {
|
|
13
|
-
width: '100%',
|
|
14
|
-
'& > div': {
|
|
15
|
-
// The isolation logic of carbonads is broken.
|
|
16
|
-
// Once the script starts loading, it will asynchronous resolve, with no way to stop it.
|
|
17
|
-
// This leads to duplication of the ad.
|
|
18
|
-
//
|
|
19
|
-
// To solve the issue, we only display the #carbonads div
|
|
20
|
-
display: 'none'
|
|
21
|
-
},
|
|
22
|
-
'& #carbonads': {
|
|
23
|
-
...styles.root,
|
|
24
|
-
'& .carbon-img': styles.imgWrapper,
|
|
25
|
-
'& img': styles.img,
|
|
26
|
-
'& a, & a:hover': styles.a,
|
|
27
|
-
'& .carbon-text': styles.description,
|
|
28
|
-
'& .carbon-poweredby': styles.poweredby
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
function AdCarbonImage() {
|
|
33
|
-
const ref = React.useRef(null);
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
// The isolation logic of carbonads is broken.
|
|
36
|
-
// Once the script starts loading, it will asynchronous resolve, with no way to stop it.
|
|
37
|
-
// This leads to duplication of the ad.
|
|
38
|
-
//
|
|
39
|
-
// To solve the issue, for example StrictModel double effect execution, we debounce the load action.
|
|
40
|
-
const load = setTimeout(() => {
|
|
41
|
-
// The DOM node could have unmounted at this point.
|
|
42
|
-
if (!ref.current) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const script = loadScript('https://cdn.carbonads.com/carbon.js?serve=CKYIL27L&placement=material-uicom', ref.current);
|
|
46
|
-
script.id = '_carbonads_js';
|
|
47
|
-
});
|
|
48
|
-
return () => {
|
|
49
|
-
clearTimeout(load);
|
|
50
|
-
};
|
|
51
|
-
}, []);
|
|
52
|
-
return /*#__PURE__*/_jsx(CarbonRoot, {
|
|
53
|
-
ref: ref
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
export function AdCarbonInline() {
|
|
57
|
-
const [ad, setAd] = React.useState(null);
|
|
58
|
-
React.useEffect(() => {
|
|
59
|
-
let active = true;
|
|
60
|
-
let attempt = 0;
|
|
61
|
-
(async () => {
|
|
62
|
-
async function tryFetch() {
|
|
63
|
-
if (attempt >= 10 || !active) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
attempt += 1;
|
|
67
|
-
let response;
|
|
68
|
-
try {
|
|
69
|
-
response = await fetch('https://srv.buysellads.com/ads/CE7DC23W.json');
|
|
70
|
-
} catch (err) {
|
|
71
|
-
// Ad blocker crashes this request
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
const data = await response.json();
|
|
75
|
-
// Inspired by https://github.com/Semantic-Org/Semantic-UI-React/blob/2c7134128925dd831de85011e3eb0ec382ba7f73/docs/src/components/CarbonAd/CarbonAdNative.js#L9
|
|
76
|
-
const sanitizedAd = data.ads.filter(item => Object.keys(item).length > 0).filter(item => item.statlink).filter(Boolean)[0];
|
|
77
|
-
if (!sanitizedAd) {
|
|
78
|
-
return tryFetch();
|
|
79
|
-
}
|
|
80
|
-
return sanitizedAd;
|
|
81
|
-
}
|
|
82
|
-
const sanitizedAd = await tryFetch();
|
|
83
|
-
if (active) {
|
|
84
|
-
setAd(sanitizedAd);
|
|
85
|
-
}
|
|
86
|
-
})();
|
|
87
|
-
return () => {
|
|
88
|
-
active = false;
|
|
89
|
-
};
|
|
90
|
-
}, []);
|
|
91
|
-
return ad ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
92
|
-
children: [/*#__PURE__*/_jsx("img", {
|
|
93
|
-
src: ad.statimp,
|
|
94
|
-
alt: "",
|
|
95
|
-
style: {
|
|
96
|
-
display: 'none'
|
|
97
|
-
}
|
|
98
|
-
}), ad.pixel && ad.pixel.split('||').map((pixel, i) => /*#__PURE__*/_jsx("img", {
|
|
99
|
-
src: `${pixel.replace('[timestamp]', ad.timestamp)}`,
|
|
100
|
-
style: {
|
|
101
|
-
display: 'none'
|
|
102
|
-
},
|
|
103
|
-
alt: ""
|
|
104
|
-
}, i)), /*#__PURE__*/_jsx(AdDisplay, {
|
|
105
|
-
className: "carbonads",
|
|
106
|
-
shape: "inline",
|
|
107
|
-
ad: {
|
|
108
|
-
link: ad.statlink,
|
|
109
|
-
img: ad.image,
|
|
110
|
-
name: ad.company,
|
|
111
|
-
descriptionHeader: ad.company,
|
|
112
|
-
description: ad.description,
|
|
113
|
-
poweredby: 'Carbon',
|
|
114
|
-
label: 'carbon-demo-inline'
|
|
115
|
-
}
|
|
116
|
-
})]
|
|
117
|
-
}) : /*#__PURE__*/_jsx("div", {
|
|
118
|
-
style: {
|
|
119
|
-
minHeight: 52
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
export default function AdCarbon() {
|
|
124
|
-
return _AdCarbonImage || (_AdCarbonImage = /*#__PURE__*/_jsx(AdCarbonImage, {}));
|
|
125
|
-
}
|
package/Ad/AdDisplay.d.mts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface AdParameters {
|
|
2
|
-
name: string;
|
|
3
|
-
link: string;
|
|
4
|
-
img?: string;
|
|
5
|
-
descriptionHeader: string;
|
|
6
|
-
description: string;
|
|
7
|
-
poweredby: string;
|
|
8
|
-
label: string;
|
|
9
|
-
}
|
|
10
|
-
interface AdDisplayProps {
|
|
11
|
-
ad: AdParameters;
|
|
12
|
-
className?: string;
|
|
13
|
-
shape?: 'auto' | 'inline' | 'image';
|
|
14
|
-
}
|
|
15
|
-
export default function AdDisplay(props: AdDisplayProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
package/Ad/AdDisplay.mjs
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
import { useTranslate } from "../i18n/index.mjs";
|
|
4
|
-
import { adShape } from "./AdManager.mjs";
|
|
5
|
-
import { adBodyImageStyles, adBodyInlineStyles } from "./ad.styles.mjs";
|
|
6
|
-
import { useAdConfig } from "./AdProvider.mjs";
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const InlineShape = styled('span')(({
|
|
9
|
-
theme
|
|
10
|
-
}) => {
|
|
11
|
-
const styles = adBodyInlineStyles(theme);
|
|
12
|
-
return {
|
|
13
|
-
...styles.root,
|
|
14
|
-
'& img': styles.img,
|
|
15
|
-
'& a, & a:hover': styles.a,
|
|
16
|
-
'& .AdDisplay-imageWrapper': styles.imgWrapper,
|
|
17
|
-
'& .AdDisplay-description': styles.description,
|
|
18
|
-
'& .AdDisplay-poweredby': styles.poweredby
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
const ImageShape = styled('span')(({
|
|
22
|
-
theme
|
|
23
|
-
}) => {
|
|
24
|
-
const styles = adBodyImageStyles(theme);
|
|
25
|
-
return {
|
|
26
|
-
...styles.root,
|
|
27
|
-
'& img': styles.img,
|
|
28
|
-
'& a, & a:hover': styles.a,
|
|
29
|
-
'& .AdDisplay-imageWrapper': styles.imgWrapper,
|
|
30
|
-
'& .AdDisplay-description': styles.description,
|
|
31
|
-
'& .AdDisplay-poweredby': styles.poweredby
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
export default function AdDisplay(props) {
|
|
35
|
-
const {
|
|
36
|
-
ad,
|
|
37
|
-
className,
|
|
38
|
-
shape: shapeProp = 'auto'
|
|
39
|
-
} = props;
|
|
40
|
-
const t = useTranslate();
|
|
41
|
-
const {
|
|
42
|
-
GADisplayRatio
|
|
43
|
-
} = useAdConfig();
|
|
44
|
-
React.useEffect(() => {
|
|
45
|
-
// Avoid an exceed on the Google Analytics quotas.
|
|
46
|
-
if (Math.random() > (GADisplayRatio ?? 0.1) || !ad.label) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
window.gtag('event', 'ad', {
|
|
50
|
-
eventAction: 'display',
|
|
51
|
-
eventLabel: ad.label
|
|
52
|
-
});
|
|
53
|
-
}, [GADisplayRatio, ad.label]);
|
|
54
|
-
const shape = shapeProp === 'auto' ? adShape : shapeProp;
|
|
55
|
-
const Root = shape === 'image' ? ImageShape : InlineShape;
|
|
56
|
-
return /*#__PURE__*/_jsxs(Root, {
|
|
57
|
-
className: className,
|
|
58
|
-
children: [/*#__PURE__*/_jsxs("a", {
|
|
59
|
-
href: ad.link,
|
|
60
|
-
target: "_blank",
|
|
61
|
-
rel: "noopener sponsored",
|
|
62
|
-
...(ad.label ? {
|
|
63
|
-
'data-ga-event-category': 'ad',
|
|
64
|
-
'data-ga-event-action': 'click',
|
|
65
|
-
'data-ga-event-label': ad.label
|
|
66
|
-
} : {}),
|
|
67
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
68
|
-
className: "AdDisplay-imageWrapper",
|
|
69
|
-
children: /*#__PURE__*/_jsx("img", {
|
|
70
|
-
height: "100",
|
|
71
|
-
width: "130",
|
|
72
|
-
src: ad.img,
|
|
73
|
-
alt: ad.name
|
|
74
|
-
})
|
|
75
|
-
}), /*#__PURE__*/_jsxs("span", {
|
|
76
|
-
className: "AdDisplay-description",
|
|
77
|
-
children: [/*#__PURE__*/_jsx("strong", {
|
|
78
|
-
children: ad.descriptionHeader
|
|
79
|
-
}), " - ", ad.description]
|
|
80
|
-
})]
|
|
81
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
82
|
-
className: "AdDisplay-poweredby",
|
|
83
|
-
children: t('adPublisher').replace('{{publisher}}', ad.poweredby)
|
|
84
|
-
})]
|
|
85
|
-
});
|
|
86
|
-
}
|
package/Ad/AdGuest.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface AdGuestProps {
|
|
3
|
-
/**
|
|
4
|
-
* The querySelector use to target the element which will include the ad.
|
|
5
|
-
*/
|
|
6
|
-
classSelector?: string;
|
|
7
|
-
children?: React.ReactNode | undefined;
|
|
8
|
-
}
|
|
9
|
-
declare function AdGuest(props: AdGuestProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
-
export { AdGuest };
|
package/Ad/AdGuest.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import Portal from '@mui/material/Portal';
|
|
3
|
-
import { AdContext } from "./AdManager.mjs";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
function AdGuest(props) {
|
|
6
|
-
const {
|
|
7
|
-
classSelector = '.description',
|
|
8
|
-
children
|
|
9
|
-
} = props;
|
|
10
|
-
const ad = React.useContext(AdContext);
|
|
11
|
-
if (!ad.element) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
return /*#__PURE__*/_jsx(Portal, {
|
|
15
|
-
container: () => {
|
|
16
|
-
const element = document.querySelector(classSelector);
|
|
17
|
-
if (element) {
|
|
18
|
-
if (ad.element === element) {
|
|
19
|
-
element.classList.add('ad');
|
|
20
|
-
} else {
|
|
21
|
-
element.classList.remove('ad');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return ad.element;
|
|
25
|
-
},
|
|
26
|
-
children: children
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export { AdGuest };
|
package/Ad/AdInHouse.d.mts
DELETED
package/Ad/AdInHouse.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import AdDisplay from "./AdDisplay.mjs";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
export default function AdInHouse(props) {
|
|
4
|
-
const {
|
|
5
|
-
ad
|
|
6
|
-
} = props;
|
|
7
|
-
return /*#__PURE__*/_jsx(AdDisplay, {
|
|
8
|
-
ad: {
|
|
9
|
-
poweredby: 'MUI',
|
|
10
|
-
label: `in-house-${ad.name}`,
|
|
11
|
-
...ad
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
package/Ad/AdManager.d.mts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
type AdPortal = {
|
|
3
|
-
placement: 'body-top';
|
|
4
|
-
element: Element | null;
|
|
5
|
-
};
|
|
6
|
-
interface AdManagerProps {
|
|
7
|
-
/**
|
|
8
|
-
* The querySelector use to target the element which will include the ad.
|
|
9
|
-
*/
|
|
10
|
-
classSelector?: string;
|
|
11
|
-
children?: React.ReactNode | undefined;
|
|
12
|
-
}
|
|
13
|
-
export declare const AdContext: React.Context<AdPortal>;
|
|
14
|
-
export declare const adShape: string;
|
|
15
|
-
export declare function AdManager({
|
|
16
|
-
classSelector,
|
|
17
|
-
children
|
|
18
|
-
}: AdManagerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export {};
|
package/Ad/AdManager.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
export const AdContext = /*#__PURE__*/React.createContext({
|
|
5
|
-
placement: 'body-top',
|
|
6
|
-
element: null
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// Persisted for the whole session.
|
|
10
|
-
// The state is used to use different ad placements.
|
|
11
|
-
const randomSession = Math.random();
|
|
12
|
-
|
|
13
|
-
// Distribution profile:
|
|
14
|
-
// 20% body-inline
|
|
15
|
-
// 80% body-image
|
|
16
|
-
export const adShape = randomSession < 0.2 ? 'inline' : 'image';
|
|
17
|
-
export function AdManager({
|
|
18
|
-
classSelector = '.description',
|
|
19
|
-
children
|
|
20
|
-
}) {
|
|
21
|
-
const [portal, setPortal] = React.useState({
|
|
22
|
-
placement: 'body-top',
|
|
23
|
-
element: null
|
|
24
|
-
});
|
|
25
|
-
useEnhancedEffect(() => {
|
|
26
|
-
const container = document.querySelector(classSelector);
|
|
27
|
-
setPortal({
|
|
28
|
-
placement: 'body-top',
|
|
29
|
-
element: container
|
|
30
|
-
});
|
|
31
|
-
}, [classSelector]);
|
|
32
|
-
return /*#__PURE__*/_jsx(AdContext.Provider, {
|
|
33
|
-
value: portal,
|
|
34
|
-
children: children
|
|
35
|
-
});
|
|
36
|
-
}
|
package/Ad/AdProvider.d.mts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface AdConfig {
|
|
3
|
-
/**
|
|
4
|
-
* The ratio of "ad display" event sent to Google Analytics.
|
|
5
|
-
* Used to avoid an exceed on the Google Analytics quotas.
|
|
6
|
-
* @default 0.1
|
|
7
|
-
*/
|
|
8
|
-
GADisplayRatio: number;
|
|
9
|
-
}
|
|
10
|
-
export interface AdProviderProps {
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
config?: Partial<AdConfig>;
|
|
13
|
-
}
|
|
14
|
-
export declare function AdProvider(props: AdProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare function useAdConfig(): AdConfig;
|
package/Ad/AdProvider.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
const AdConfigContext = /*#__PURE__*/React.createContext(null);
|
|
4
|
-
export function AdProvider(props) {
|
|
5
|
-
const {
|
|
6
|
-
children,
|
|
7
|
-
config
|
|
8
|
-
} = props;
|
|
9
|
-
const value = React.useMemo(() => ({
|
|
10
|
-
GADisplayRatio: 0.1,
|
|
11
|
-
...config
|
|
12
|
-
}), [config]);
|
|
13
|
-
return /*#__PURE__*/_jsx(AdConfigContext.Provider, {
|
|
14
|
-
value: value,
|
|
15
|
-
children: children
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export function useAdConfig() {
|
|
19
|
-
const config = React.useContext(AdConfigContext);
|
|
20
|
-
if (!config) {
|
|
21
|
-
throw new Error('Could not find docs ad config context value; please ensure the component is wrapped in a <AdProvider>');
|
|
22
|
-
}
|
|
23
|
-
return config;
|
|
24
|
-
}
|