@mui/docs 7.0.0-alpha.0 → 7.0.0-alpha.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 +1 -1
- package/Ad/Ad.js +42 -33
- package/Ad/AdCarbon.d.ts +1 -1
- package/Ad/AdCarbon.js +31 -18
- package/Ad/AdDisplay.d.ts +10 -10
- package/Ad/AdDisplay.js +28 -21
- package/Ad/AdGuest.d.ts +6 -6
- package/Ad/AdGuest.js +15 -8
- package/Ad/AdInHouse.d.ts +3 -3
- package/Ad/AdInHouse.js +13 -5
- package/Ad/AdManager.d.ts +12 -9
- package/Ad/AdManager.js +17 -8
- package/Ad/AdProvider.d.ts +9 -9
- package/Ad/AdProvider.js +13 -5
- package/Ad/ad.styles.d.ts +4322 -4322
- package/Ad/ad.styles.js +13 -5
- package/Ad/index.d.ts +5 -5
- package/Ad/index.js +62 -6
- package/CHANGELOG.md +61 -0
- package/CodeCopy/CodeCopy.d.ts +5 -3
- package/CodeCopy/CodeCopy.js +19 -10
- package/CodeCopy/CodeCopyButton.d.ts +2 -2
- package/CodeCopy/CodeCopyButton.js +18 -10
- package/CodeCopy/index.d.ts +3 -3
- package/CodeCopy/index.js +40 -3
- package/CodeCopy/useClipboardCopy.d.ts +3 -3
- package/CodeCopy/useClipboardCopy.js +12 -4
- package/ComponentLinkHeader/ComponentLinkHeader.d.ts +5 -5
- package/ComponentLinkHeader/ComponentLinkHeader.js +48 -40
- package/ComponentLinkHeader/index.d.ts +2 -2
- package/ComponentLinkHeader/index.js +24 -2
- package/DocsProvider/DocsProvider.d.ts +19 -13
- package/DocsProvider/DocsProvider.js +17 -9
- package/DocsProvider/index.d.ts +1 -1
- package/DocsProvider/index.js +16 -1
- package/HighlightedCode/HighlightedCode.d.ts +9 -9
- package/HighlightedCode/HighlightedCode.js +26 -18
- package/HighlightedCode/index.d.ts +1 -1
- package/HighlightedCode/index.js +16 -1
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +18 -18
- package/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +31 -22
- package/HighlightedCodeWithTabs/index.d.ts +2 -2
- package/HighlightedCodeWithTabs/index.js +24 -2
- package/InfoCard/InfoCard.d.ts +15 -13
- package/InfoCard/InfoCard.js +29 -20
- package/InfoCard/index.d.ts +1 -1
- package/InfoCard/index.js +16 -1
- package/Link/Link.d.ts +14 -8
- package/Link/Link.js +26 -29
- package/Link/index.d.ts +1 -1
- package/Link/index.js +16 -1
- package/MarkdownElement/MarkdownElement.d.ts +4 -4
- package/MarkdownElement/MarkdownElement.js +186 -178
- package/MarkdownElement/index.d.ts +1 -1
- package/MarkdownElement/index.js +16 -1
- package/NProgressBar/NProgressBar.d.ts +1 -3
- package/NProgressBar/NProgressBar.js +23 -15
- package/NProgressBar/index.d.ts +2 -2
- package/NProgressBar/index.js +13 -1
- package/README.md +2 -2
- package/SectionTitle/SectionTitle.d.ts +4 -4
- package/SectionTitle/SectionTitle.js +15 -8
- package/SectionTitle/index.d.ts +1 -1
- package/SectionTitle/index.js +16 -1
- package/branding/BrandingProvider.d.ts +6 -6
- package/branding/BrandingProvider.js +15 -8
- package/branding/brandingTheme.d.ts +118 -119
- package/branding/brandingTheme.js +126 -115
- package/branding/index.d.ts +2 -2
- package/branding/index.js +27 -2
- package/esm/Ad/Ad.d.ts +6 -0
- package/{node → esm}/Ad/Ad.js +33 -42
- package/esm/Ad/AdCarbon.d.ts +3 -0
- package/{node → esm}/Ad/AdCarbon.js +22 -27
- package/esm/Ad/AdDisplay.d.ts +16 -0
- package/{node → esm}/Ad/AdDisplay.js +21 -28
- package/esm/Ad/AdGuest.d.ts +10 -0
- package/esm/Ad/AdGuest.js +29 -0
- package/esm/Ad/AdInHouse.d.ts +5 -0
- package/esm/Ad/AdInHouse.js +15 -0
- package/esm/Ad/AdManager.d.ts +19 -0
- package/esm/Ad/AdManager.js +36 -0
- package/esm/Ad/AdProvider.d.ts +15 -0
- package/esm/Ad/AdProvider.js +24 -0
- package/esm/Ad/ad.styles.d.ts +4329 -0
- package/{node → esm}/Ad/ad.styles.js +5 -13
- package/esm/Ad/index.d.ts +5 -0
- package/esm/Ad/index.js +7 -0
- package/esm/CodeCopy/CodeCopy.d.ts +22 -0
- package/{node → esm}/CodeCopy/CodeCopy.js +10 -19
- package/esm/CodeCopy/CodeCopyButton.d.ts +5 -0
- package/esm/CodeCopy/CodeCopyButton.js +41 -0
- package/esm/CodeCopy/index.d.ts +3 -0
- package/esm/CodeCopy/index.js +3 -0
- package/esm/CodeCopy/useClipboardCopy.d.ts +4 -0
- package/esm/CodeCopy/useClipboardCopy.js +21 -0
- package/esm/ComponentLinkHeader/ComponentLinkHeader.d.ts +9 -0
- package/{node → esm}/ComponentLinkHeader/ComponentLinkHeader.js +40 -48
- package/esm/ComponentLinkHeader/index.d.ts +2 -0
- package/esm/ComponentLinkHeader/index.js +2 -0
- package/esm/DocsProvider/DocsProvider.d.ts +24 -0
- package/esm/DocsProvider/DocsProvider.js +31 -0
- package/esm/DocsProvider/index.d.ts +1 -0
- package/esm/DocsProvider/index.js +1 -0
- package/esm/HighlightedCode/HighlightedCode.d.ts +14 -0
- package/esm/HighlightedCode/HighlightedCode.js +67 -0
- package/esm/HighlightedCode/index.d.ts +1 -0
- package/esm/HighlightedCode/index.js +1 -0
- package/esm/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +29 -0
- package/{node → esm}/HighlightedCodeWithTabs/HighlightedCodeWithTabs.js +22 -31
- package/esm/HighlightedCodeWithTabs/index.d.ts +2 -0
- package/esm/HighlightedCodeWithTabs/index.js +2 -0
- package/esm/InfoCard/InfoCard.d.ts +22 -0
- package/esm/InfoCard/InfoCard.js +87 -0
- package/esm/InfoCard/index.d.ts +1 -0
- package/esm/InfoCard/index.js +1 -0
- package/esm/Link/Link.d.ts +22 -0
- package/{node → esm}/Link/Link.js +19 -37
- package/esm/Link/index.d.ts +1 -0
- package/esm/Link/index.js +1 -0
- package/esm/MarkdownElement/MarkdownElement.d.ts +7 -0
- package/{node → esm}/MarkdownElement/MarkdownElement.js +178 -186
- package/esm/MarkdownElement/index.d.ts +1 -0
- package/esm/MarkdownElement/index.js +1 -0
- package/esm/NProgressBar/NProgressBar.d.ts +6 -0
- package/{node → esm}/NProgressBar/NProgressBar.js +15 -23
- package/esm/NProgressBar/index.d.ts +2 -0
- package/esm/NProgressBar/index.js +1 -0
- package/esm/SectionTitle/SectionTitle.d.ts +7 -0
- package/esm/SectionTitle/SectionTitle.js +30 -0
- package/esm/SectionTitle/index.d.ts +1 -0
- package/esm/SectionTitle/index.js +1 -0
- package/esm/branding/BrandingProvider.d.ts +9 -0
- package/esm/branding/BrandingProvider.js +17 -0
- package/esm/branding/brandingTheme.d.ts +151 -0
- package/{node → esm}/branding/brandingTheme.js +115 -126
- package/esm/branding/index.d.ts +2 -0
- package/esm/branding/index.js +2 -0
- package/esm/i18n/i18n.d.ts +27 -0
- package/{node → esm}/i18n/i18n.js +17 -29
- package/esm/i18n/index.d.ts +1 -0
- package/esm/i18n/index.js +1 -0
- package/esm/package.json +1 -0
- package/esm/svgIcons/BundleSizeIcon.d.ts +4 -0
- package/esm/svgIcons/BundleSizeIcon.js +14 -0
- package/esm/svgIcons/FigmaIcon.d.ts +4 -0
- package/esm/svgIcons/FigmaIcon.js +23 -0
- package/esm/svgIcons/FileDownload.d.ts +7 -0
- package/esm/svgIcons/FileDownload.js +14 -0
- package/esm/svgIcons/JavaScript.d.ts +7 -0
- package/{node → esm}/svgIcons/JavaScript.js +6 -14
- package/esm/svgIcons/MaterialDesignIcon.d.ts +4 -0
- package/esm/svgIcons/MaterialDesignIcon.js +19 -0
- package/esm/svgIcons/SketchIcon.d.ts +4 -0
- package/esm/svgIcons/SketchIcon.js +28 -0
- package/esm/svgIcons/TypeScript.d.ts +7 -0
- package/esm/svgIcons/TypeScript.js +14 -0
- package/esm/svgIcons/W3CIcon.d.ts +4 -0
- package/{node → esm}/svgIcons/W3CIcon.js +7 -14
- package/esm/translations/index.d.ts +3 -0
- package/esm/translations/index.js +4 -0
- package/esm/utils/loadScript.d.ts +1 -0
- package/esm/utils/loadScript.js +7 -0
- package/i18n/i18n.d.ts +12 -14
- package/i18n/i18n.js +29 -17
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +16 -1
- package/modern/Ad/Ad.d.ts +6 -0
- package/modern/Ad/AdCarbon.d.ts +3 -0
- package/modern/Ad/AdDisplay.d.ts +16 -0
- package/modern/Ad/AdGuest.d.ts +10 -0
- package/modern/Ad/AdInHouse.d.ts +5 -0
- package/modern/Ad/AdManager.d.ts +19 -0
- package/modern/Ad/AdProvider.d.ts +15 -0
- package/modern/Ad/ad.styles.d.ts +4329 -0
- package/modern/Ad/index.d.ts +5 -0
- package/modern/CodeCopy/CodeCopy.d.ts +22 -0
- package/modern/CodeCopy/CodeCopyButton.d.ts +5 -0
- package/modern/CodeCopy/index.d.ts +3 -0
- package/modern/CodeCopy/useClipboardCopy.d.ts +4 -0
- package/modern/ComponentLinkHeader/ComponentLinkHeader.d.ts +9 -0
- package/modern/ComponentLinkHeader/index.d.ts +2 -0
- package/modern/DocsProvider/DocsProvider.d.ts +24 -0
- package/modern/DocsProvider/index.d.ts +1 -0
- package/modern/HighlightedCode/HighlightedCode.d.ts +14 -0
- package/modern/HighlightedCode/index.d.ts +1 -0
- package/modern/HighlightedCodeWithTabs/HighlightedCodeWithTabs.d.ts +29 -0
- package/modern/HighlightedCodeWithTabs/index.d.ts +2 -0
- package/modern/InfoCard/InfoCard.d.ts +22 -0
- package/modern/InfoCard/index.d.ts +1 -0
- package/modern/Link/Link.d.ts +22 -0
- package/modern/Link/index.d.ts +1 -0
- package/modern/MarkdownElement/MarkdownElement.d.ts +7 -0
- package/modern/MarkdownElement/index.d.ts +1 -0
- package/modern/NProgressBar/NProgressBar.d.ts +6 -0
- package/modern/NProgressBar/index.d.ts +2 -0
- package/modern/SectionTitle/SectionTitle.d.ts +7 -0
- package/modern/SectionTitle/index.d.ts +1 -0
- package/modern/branding/BrandingProvider.d.ts +9 -0
- package/modern/branding/brandingTheme.d.ts +151 -0
- package/modern/branding/index.d.ts +2 -0
- package/modern/i18n/i18n.d.ts +27 -0
- package/modern/i18n/index.d.ts +1 -0
- package/modern/svgIcons/BundleSizeIcon.d.ts +4 -0
- package/modern/svgIcons/FigmaIcon.d.ts +4 -0
- package/modern/svgIcons/FileDownload.d.ts +7 -0
- package/modern/svgIcons/JavaScript.d.ts +7 -0
- package/modern/svgIcons/MaterialDesignIcon.d.ts +4 -0
- package/modern/svgIcons/SketchIcon.d.ts +4 -0
- package/modern/svgIcons/TypeScript.d.ts +7 -0
- package/modern/svgIcons/W3CIcon.d.ts +4 -0
- package/modern/translations/index.d.ts +3 -0
- package/modern/utils/loadScript.d.ts +1 -0
- package/package.json +32 -2
- package/svgIcons/BundleSizeIcon.d.ts +2 -2
- package/svgIcons/BundleSizeIcon.js +13 -6
- package/svgIcons/FigmaIcon.d.ts +2 -2
- package/svgIcons/FigmaIcon.js +16 -9
- package/svgIcons/FileDownload.d.ts +2 -2
- package/svgIcons/FileDownload.js +14 -6
- package/svgIcons/JavaScript.d.ts +2 -2
- package/svgIcons/JavaScript.js +14 -6
- package/svgIcons/MaterialDesignIcon.d.ts +2 -2
- package/svgIcons/MaterialDesignIcon.js +14 -7
- package/svgIcons/SketchIcon.d.ts +2 -2
- package/svgIcons/SketchIcon.js +18 -11
- package/svgIcons/TypeScript.d.ts +2 -2
- package/svgIcons/TypeScript.js +14 -6
- package/svgIcons/W3CIcon.d.ts +2 -2
- package/svgIcons/W3CIcon.js +14 -7
- package/translations/index.d.ts +2 -2
- package/translations/index.js +10 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/loadScript.d.ts +1 -1
- package/utils/loadScript.js +8 -4
- package/Ad/package.json +0 -6
- package/CodeCopy/package.json +0 -6
- package/ComponentLinkHeader/package.json +0 -6
- package/DocsProvider/package.json +0 -6
- package/HighlightedCode/package.json +0 -6
- package/HighlightedCodeWithTabs/package.json +0 -6
- package/InfoCard/package.json +0 -6
- package/Link/package.json +0 -6
- package/MarkdownElement/package.json +0 -6
- package/NProgressBar/package.json +0 -6
- package/SectionTitle/package.json +0 -6
- package/branding/package.json +0 -6
- package/i18n/package.json +0 -6
- package/node/Ad/AdGuest.js +0 -36
- package/node/Ad/AdInHouse.js +0 -23
- package/node/Ad/AdManager.js +0 -45
- package/node/Ad/AdProvider.js +0 -32
- package/node/Ad/index.js +0 -63
- package/node/CodeCopy/CodeCopyButton.js +0 -49
- package/node/CodeCopy/index.js +0 -40
- package/node/CodeCopy/useClipboardCopy.js +0 -29
- package/node/ComponentLinkHeader/index.js +0 -24
- package/node/DocsProvider/DocsProvider.js +0 -39
- package/node/DocsProvider/index.js +0 -16
- package/node/HighlightedCode/HighlightedCode.js +0 -75
- package/node/HighlightedCode/index.js +0 -16
- package/node/HighlightedCodeWithTabs/index.js +0 -24
- package/node/InfoCard/InfoCard.js +0 -96
- package/node/InfoCard/index.js +0 -16
- package/node/Link/index.js +0 -16
- package/node/MarkdownElement/index.js +0 -16
- package/node/NProgressBar/index.js +0 -13
- package/node/SectionTitle/SectionTitle.js +0 -37
- package/node/SectionTitle/index.js +0 -16
- package/node/branding/BrandingProvider.js +0 -24
- package/node/branding/index.js +0 -27
- package/node/i18n/index.js +0 -16
- package/node/svgIcons/BundleSizeIcon.js +0 -21
- package/node/svgIcons/FigmaIcon.js +0 -30
- package/node/svgIcons/FileDownload.js +0 -22
- package/node/svgIcons/MaterialDesignIcon.js +0 -26
- package/node/svgIcons/SketchIcon.js +0 -35
- package/node/svgIcons/TypeScript.js +0 -22
- package/node/translations/index.js +0 -11
- package/node/utils/loadScript.js +0 -15
- package/translations/package.json +0 -6
package/branding/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./brandingTheme.js";
|
|
2
|
+
export * from "./BrandingProvider.js";
|
package/branding/index.js
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _brandingTheme = require("./brandingTheme");
|
|
7
|
+
Object.keys(_brandingTheme).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _brandingTheme[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _brandingTheme[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _BrandingProvider = require("./BrandingProvider");
|
|
18
|
+
Object.keys(_BrandingProvider).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _BrandingProvider[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _BrandingProvider[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
package/esm/Ad/Ad.d.ts
ADDED
package/{node → esm}/Ad/Ad.js
RENAMED
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.AD_MARGIN_TOP = exports.AD_MARGIN_BOTTOM = exports.AD_HEIGHT_MOBILE = exports.AD_HEIGHT = void 0;
|
|
9
|
-
exports.Ad = Ad;
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
|
-
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
-
var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
|
|
14
|
-
var _i18n = require("../i18n");
|
|
15
|
-
var _AdCarbon2 = _interopRequireDefault(require("./AdCarbon"));
|
|
16
|
-
var _AdInHouse = _interopRequireDefault(require("./AdInHouse"));
|
|
17
|
-
var _AdManager = require("./AdManager");
|
|
18
|
-
var _AdProvider = require("./AdProvider");
|
|
19
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
1
|
var _span, _PleaseDisableAdblock, _AdCarbon;
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import Paper from '@mui/material/Paper';
|
|
6
|
+
import { useTranslate } from "../i18n/index.js";
|
|
7
|
+
import AdCarbon from "./AdCarbon.js";
|
|
8
|
+
import AdInHouse from "./AdInHouse.js";
|
|
9
|
+
import { AdContext, adShape } from "./AdManager.js";
|
|
10
|
+
import { useAdConfig } from "./AdProvider.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
12
|
function PleaseDisableAdblock() {
|
|
22
|
-
const t =
|
|
23
|
-
return /*#__PURE__*/(
|
|
13
|
+
const t = useTranslate();
|
|
14
|
+
return /*#__PURE__*/_jsxs(Paper, {
|
|
24
15
|
component: "span",
|
|
25
16
|
elevation: 0,
|
|
26
17
|
sx: {
|
|
@@ -29,7 +20,7 @@ function PleaseDisableAdblock() {
|
|
|
29
20
|
border: '2px solid',
|
|
30
21
|
borderColor: 'primary.main'
|
|
31
22
|
},
|
|
32
|
-
children: [/*#__PURE__*/(
|
|
23
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
33
24
|
variant: "body2",
|
|
34
25
|
component: "span",
|
|
35
26
|
gutterBottom: true,
|
|
@@ -37,7 +28,7 @@ function PleaseDisableAdblock() {
|
|
|
37
28
|
display: 'block'
|
|
38
29
|
},
|
|
39
30
|
children: t('likeMui')
|
|
40
|
-
}), /*#__PURE__*/(
|
|
31
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
41
32
|
variant: "body2",
|
|
42
33
|
component: "span",
|
|
43
34
|
gutterBottom: true,
|
|
@@ -45,13 +36,13 @@ function PleaseDisableAdblock() {
|
|
|
45
36
|
display: 'block'
|
|
46
37
|
},
|
|
47
38
|
children: t('adblock')
|
|
48
|
-
}), /*#__PURE__*/(
|
|
39
|
+
}), /*#__PURE__*/_jsxs(Typography, {
|
|
49
40
|
variant: "body2",
|
|
50
41
|
component: "span",
|
|
51
42
|
sx: {
|
|
52
43
|
display: 'block'
|
|
53
44
|
},
|
|
54
|
-
children: [t('thanks'), ' ', /*#__PURE__*/(
|
|
45
|
+
children: [t('thanks'), ' ', /*#__PURE__*/_jsx("span", {
|
|
55
46
|
role: "img",
|
|
56
47
|
"aria-label": t('emojiLove'),
|
|
57
48
|
children: "\u2764\uFE0F"
|
|
@@ -118,17 +109,17 @@ class AdErrorBoundary extends React.Component {
|
|
|
118
109
|
return children;
|
|
119
110
|
}
|
|
120
111
|
}
|
|
121
|
-
const AD_MARGIN_TOP =
|
|
122
|
-
const AD_MARGIN_BOTTOM =
|
|
123
|
-
const AD_HEIGHT =
|
|
112
|
+
export const AD_MARGIN_TOP = 3;
|
|
113
|
+
export const AD_MARGIN_BOTTOM = 3;
|
|
114
|
+
export const AD_HEIGHT = 126;
|
|
124
115
|
// Add more height on mobile as the text tends to wrap beyond the image height.
|
|
125
|
-
const AD_HEIGHT_MOBILE =
|
|
116
|
+
export const AD_HEIGHT_MOBILE = 126 + 16;
|
|
126
117
|
|
|
127
118
|
// https://stackoverflow.com/a/20084661
|
|
128
119
|
function isBot() {
|
|
129
120
|
return /bot|googlebot|crawler|spider|robot|crawling/i.test(navigator.userAgent);
|
|
130
121
|
}
|
|
131
|
-
function Ad() {
|
|
122
|
+
export function Ad() {
|
|
132
123
|
const [adblock, setAdblock] = React.useState(null);
|
|
133
124
|
const [carbonOut, setCarbonOut] = React.useState(null);
|
|
134
125
|
const {
|
|
@@ -141,28 +132,28 @@ function Ad() {
|
|
|
141
132
|
let label;
|
|
142
133
|
// Hide the content to google bot to avoid its indexation.
|
|
143
134
|
if (typeof window !== 'undefined' && isBot() || disableAd) {
|
|
144
|
-
children = _span || (_span = /*#__PURE__*/(
|
|
135
|
+
children = _span || (_span = /*#__PURE__*/_jsx("span", {}));
|
|
145
136
|
} else if (adblock) {
|
|
146
137
|
if (randomAdblock < 0.2) {
|
|
147
|
-
children = _PleaseDisableAdblock || (_PleaseDisableAdblock = /*#__PURE__*/(
|
|
138
|
+
children = _PleaseDisableAdblock || (_PleaseDisableAdblock = /*#__PURE__*/_jsx(PleaseDisableAdblock, {}));
|
|
148
139
|
label = 'in-house-adblock';
|
|
149
140
|
} else {
|
|
150
|
-
children = /*#__PURE__*/(
|
|
141
|
+
children = /*#__PURE__*/_jsx(AdInHouse, {
|
|
151
142
|
ad: inHouseAds[Math.floor(inHouseAds.length * randomInHouse)]
|
|
152
143
|
});
|
|
153
144
|
label = 'in-house';
|
|
154
145
|
}
|
|
155
146
|
} else if (carbonOut) {
|
|
156
|
-
children = /*#__PURE__*/(
|
|
147
|
+
children = /*#__PURE__*/_jsx(AdInHouse, {
|
|
157
148
|
ad: inHouseAds[Math.floor(inHouseAds.length * randomInHouse)]
|
|
158
149
|
});
|
|
159
150
|
label = 'in-house-carbon';
|
|
160
151
|
} else {
|
|
161
|
-
children = _AdCarbon || (_AdCarbon = /*#__PURE__*/(
|
|
152
|
+
children = _AdCarbon || (_AdCarbon = /*#__PURE__*/_jsx(AdCarbon, {}));
|
|
162
153
|
label = 'carbon';
|
|
163
154
|
}
|
|
164
|
-
const ad = React.useContext(
|
|
165
|
-
const eventLabel = label ? `${label}-${ad.placement}-${
|
|
155
|
+
const ad = React.useContext(AdContext);
|
|
156
|
+
const eventLabel = label ? `${label}-${ad.placement}-${adShape}` : null;
|
|
166
157
|
const timerAdblock = React.useRef(undefined);
|
|
167
158
|
const checkAdblock = React.useCallback((attempt = 1) => {
|
|
168
159
|
if (document.querySelector('.ea-placement') || document.querySelector('#carbonads') || document.querySelector('.carbonads') || carbonOut) {
|
|
@@ -192,7 +183,7 @@ function Ad() {
|
|
|
192
183
|
}, [checkAdblock]);
|
|
193
184
|
const {
|
|
194
185
|
GADisplayRatio
|
|
195
|
-
} =
|
|
186
|
+
} = useAdConfig();
|
|
196
187
|
React.useEffect(() => {
|
|
197
188
|
// Avoid an exceed on the Google Analytics quotas.
|
|
198
189
|
if (Math.random() > (GADisplayRatio ?? 0.1) || !eventLabel) {
|
|
@@ -208,7 +199,7 @@ function Ad() {
|
|
|
208
199
|
clearTimeout(delay);
|
|
209
200
|
};
|
|
210
201
|
}, [GADisplayRatio, eventLabel]);
|
|
211
|
-
return /*#__PURE__*/(
|
|
202
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
212
203
|
component: "span",
|
|
213
204
|
sx: theme => ({
|
|
214
205
|
position: 'relative',
|
|
@@ -219,8 +210,8 @@ function Ad() {
|
|
|
219
210
|
[theme.breakpoints.up('sm')]: {
|
|
220
211
|
minHeight: AD_HEIGHT
|
|
221
212
|
},
|
|
222
|
-
...(
|
|
223
|
-
...(
|
|
213
|
+
...(adShape === 'image' && {}),
|
|
214
|
+
...(adShape === 'inline' && {
|
|
224
215
|
display: 'flex',
|
|
225
216
|
alignItems: 'flex-end'
|
|
226
217
|
})
|
|
@@ -228,7 +219,7 @@ function Ad() {
|
|
|
228
219
|
"data-ga-event-category": "ad",
|
|
229
220
|
"data-ga-event-action": "click",
|
|
230
221
|
"data-ga-event-label": eventLabel,
|
|
231
|
-
children: /*#__PURE__*/(
|
|
222
|
+
children: /*#__PURE__*/_jsx(AdErrorBoundary, {
|
|
232
223
|
eventLabel: eventLabel,
|
|
233
224
|
children: children
|
|
234
225
|
})
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.AdCarbonInline = AdCarbonInline;
|
|
9
|
-
exports.default = AdCarbon;
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _styles = require("@mui/material/styles");
|
|
12
|
-
var _loadScript = _interopRequireDefault(require("../utils/loadScript"));
|
|
13
|
-
var _AdDisplay = _interopRequireDefault(require("./AdDisplay"));
|
|
14
|
-
var _ad = require("./ad.styles");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
1
|
var _AdCarbonImage;
|
|
17
|
-
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import loadScript from "../utils/loadScript.js";
|
|
5
|
+
import AdDisplay from "./AdDisplay.js";
|
|
6
|
+
import { adBodyImageStyles } from "./ad.styles.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const CarbonRoot = styled('span')(({
|
|
18
9
|
theme
|
|
19
10
|
}) => {
|
|
20
|
-
const styles =
|
|
11
|
+
const styles = adBodyImageStyles(theme);
|
|
21
12
|
return {
|
|
22
13
|
width: '100%',
|
|
23
14
|
'& > div': {
|
|
@@ -47,18 +38,22 @@ function AdCarbonImage() {
|
|
|
47
38
|
//
|
|
48
39
|
// To solve the issue, for example StrictModel double effect execution, we debounce the load action.
|
|
49
40
|
const load = setTimeout(() => {
|
|
50
|
-
|
|
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);
|
|
51
46
|
script.id = '_carbonads_js';
|
|
52
47
|
});
|
|
53
48
|
return () => {
|
|
54
49
|
clearTimeout(load);
|
|
55
50
|
};
|
|
56
51
|
}, []);
|
|
57
|
-
return /*#__PURE__*/(
|
|
52
|
+
return /*#__PURE__*/_jsx(CarbonRoot, {
|
|
58
53
|
ref: ref
|
|
59
54
|
});
|
|
60
55
|
}
|
|
61
|
-
function AdCarbonInline() {
|
|
56
|
+
export function AdCarbonInline() {
|
|
62
57
|
const [ad, setAd] = React.useState(null);
|
|
63
58
|
React.useEffect(() => {
|
|
64
59
|
let active = true;
|
|
@@ -93,20 +88,20 @@ function AdCarbonInline() {
|
|
|
93
88
|
active = false;
|
|
94
89
|
};
|
|
95
90
|
}, []);
|
|
96
|
-
return ad ? /*#__PURE__*/(
|
|
97
|
-
children: [/*#__PURE__*/(
|
|
91
|
+
return ad ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
92
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
98
93
|
src: ad.statimp,
|
|
99
94
|
alt: "",
|
|
100
95
|
style: {
|
|
101
96
|
display: 'none'
|
|
102
97
|
}
|
|
103
|
-
}), ad.pixel && ad.pixel.split('||').map((pixel, i) => /*#__PURE__*/(
|
|
98
|
+
}), ad.pixel && ad.pixel.split('||').map((pixel, i) => /*#__PURE__*/_jsx("img", {
|
|
104
99
|
src: `${pixel.replace('[timestamp]', ad.timestamp)}`,
|
|
105
100
|
style: {
|
|
106
101
|
display: 'none'
|
|
107
102
|
},
|
|
108
103
|
alt: ""
|
|
109
|
-
}, i)), /*#__PURE__*/(
|
|
104
|
+
}, i)), /*#__PURE__*/_jsx(AdDisplay, {
|
|
110
105
|
className: "carbonads",
|
|
111
106
|
shape: "inline",
|
|
112
107
|
ad: {
|
|
@@ -118,12 +113,12 @@ function AdCarbonInline() {
|
|
|
118
113
|
label: 'carbon-demo-inline'
|
|
119
114
|
}
|
|
120
115
|
})]
|
|
121
|
-
}) : /*#__PURE__*/(
|
|
116
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
122
117
|
style: {
|
|
123
118
|
minHeight: 52
|
|
124
119
|
}
|
|
125
120
|
});
|
|
126
121
|
}
|
|
127
|
-
function AdCarbon() {
|
|
128
|
-
return _AdCarbonImage || (_AdCarbonImage = /*#__PURE__*/(
|
|
122
|
+
export default function AdCarbon() {
|
|
123
|
+
return _AdCarbonImage || (_AdCarbonImage = /*#__PURE__*/_jsx(AdCarbonImage, {}));
|
|
129
124
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface AdParameters {
|
|
3
|
+
name: string;
|
|
4
|
+
link: string;
|
|
5
|
+
img?: 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): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _styles = require("@mui/material/styles");
|
|
10
|
-
var _i18n = require("../i18n");
|
|
11
|
-
var _AdManager = require("./AdManager");
|
|
12
|
-
var _ad = require("./ad.styles");
|
|
13
|
-
var _AdProvider = require("./AdProvider");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
const InlineShape = (0, _styles.styled)('span')(({
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { useTranslate } from "../i18n/index.js";
|
|
4
|
+
import { adShape } from "./AdManager.js";
|
|
5
|
+
import { adBodyImageStyles, adBodyInlineStyles } from "./ad.styles.js";
|
|
6
|
+
import { useAdConfig } from "./AdProvider.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const InlineShape = styled('span')(({
|
|
16
9
|
theme
|
|
17
10
|
}) => {
|
|
18
|
-
const styles =
|
|
11
|
+
const styles = adBodyInlineStyles(theme);
|
|
19
12
|
return {
|
|
20
13
|
...styles.root,
|
|
21
14
|
'& img': styles.img,
|
|
@@ -25,10 +18,10 @@ const InlineShape = (0, _styles.styled)('span')(({
|
|
|
25
18
|
'& .AdDisplay-poweredby': styles.poweredby
|
|
26
19
|
};
|
|
27
20
|
});
|
|
28
|
-
const ImageShape =
|
|
21
|
+
const ImageShape = styled('span')(({
|
|
29
22
|
theme
|
|
30
23
|
}) => {
|
|
31
|
-
const styles =
|
|
24
|
+
const styles = adBodyImageStyles(theme);
|
|
32
25
|
return {
|
|
33
26
|
...styles.root,
|
|
34
27
|
'& img': styles.img,
|
|
@@ -38,16 +31,16 @@ const ImageShape = (0, _styles.styled)('span')(({
|
|
|
38
31
|
'& .AdDisplay-poweredby': styles.poweredby
|
|
39
32
|
};
|
|
40
33
|
});
|
|
41
|
-
function AdDisplay(props) {
|
|
34
|
+
export default function AdDisplay(props) {
|
|
42
35
|
const {
|
|
43
36
|
ad,
|
|
44
37
|
className,
|
|
45
38
|
shape: shapeProp = 'auto'
|
|
46
39
|
} = props;
|
|
47
|
-
const t =
|
|
40
|
+
const t = useTranslate();
|
|
48
41
|
const {
|
|
49
42
|
GADisplayRatio
|
|
50
|
-
} =
|
|
43
|
+
} = useAdConfig();
|
|
51
44
|
React.useEffect(() => {
|
|
52
45
|
// Avoid an exceed on the Google Analytics quotas.
|
|
53
46
|
if (Math.random() > (GADisplayRatio ?? 0.1) || !ad.label) {
|
|
@@ -58,13 +51,13 @@ function AdDisplay(props) {
|
|
|
58
51
|
eventLabel: ad.label
|
|
59
52
|
});
|
|
60
53
|
}, [GADisplayRatio, ad.label]);
|
|
61
|
-
const shape = shapeProp === 'auto' ?
|
|
54
|
+
const shape = shapeProp === 'auto' ? adShape : shapeProp;
|
|
62
55
|
const Root = shape === 'image' ? ImageShape : InlineShape;
|
|
63
56
|
|
|
64
57
|
/* eslint-disable react/no-danger */
|
|
65
|
-
return /*#__PURE__*/(
|
|
58
|
+
return /*#__PURE__*/_jsxs(Root, {
|
|
66
59
|
className: className,
|
|
67
|
-
children: [/*#__PURE__*/(
|
|
60
|
+
children: [/*#__PURE__*/_jsxs("a", {
|
|
68
61
|
href: ad.link,
|
|
69
62
|
target: "_blank",
|
|
70
63
|
rel: "noopener sponsored",
|
|
@@ -73,21 +66,21 @@ function AdDisplay(props) {
|
|
|
73
66
|
'data-ga-event-action': 'click',
|
|
74
67
|
'data-ga-event-label': ad.label
|
|
75
68
|
} : {}),
|
|
76
|
-
children: [/*#__PURE__*/(
|
|
69
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
77
70
|
className: "AdDisplay-imageWrapper",
|
|
78
|
-
children: /*#__PURE__*/(
|
|
71
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
79
72
|
height: "100",
|
|
80
73
|
width: "130",
|
|
81
74
|
src: ad.img,
|
|
82
75
|
alt: ad.name
|
|
83
76
|
})
|
|
84
|
-
}), /*#__PURE__*/(
|
|
77
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
85
78
|
className: "AdDisplay-description",
|
|
86
79
|
dangerouslySetInnerHTML: {
|
|
87
80
|
__html: ad.description
|
|
88
81
|
}
|
|
89
82
|
})]
|
|
90
|
-
}), /*#__PURE__*/(
|
|
83
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
91
84
|
className: "AdDisplay-poweredby",
|
|
92
85
|
children: t('adPublisher').replace('{{publisher}}', ad.poweredby)
|
|
93
86
|
})]
|
|
@@ -0,0 +1,10 @@
|
|
|
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): React.JSX.Element | null;
|
|
10
|
+
export { AdGuest };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Portal from '@mui/material/Portal';
|
|
3
|
+
import { AdContext } from "./AdManager.js";
|
|
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 };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import AdDisplay from "./AdDisplay.js";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function AdInHouse(props) {
|
|
5
|
+
const {
|
|
6
|
+
ad
|
|
7
|
+
} = props;
|
|
8
|
+
return /*#__PURE__*/_jsx(AdDisplay, {
|
|
9
|
+
ad: {
|
|
10
|
+
poweredby: 'MUI',
|
|
11
|
+
label: `in-house-${ad.name}`,
|
|
12
|
+
...ad
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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): React.JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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): React.JSX.Element;
|
|
15
|
+
export declare function useAdConfig(): AdConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
}
|