@redocly/theme 0.4.12 → 0.4.14
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/ColorModeSwitcher/ColorModeSwitcher.js +5 -2
- package/Sidebar/MenuGroup.js +62 -3
- package/globalStyle.js +2 -2
- package/hooks/useActiveHeading.js +6 -3
- package/hooks/useMobileMenu.js +1 -1
- package/package.json +2 -2
- package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +6 -1
- package/src/Sidebar/MenuGroup.tsx +26 -3
- package/src/globalStyle.ts +5 -1
- package/src/hooks/useActiveHeading.ts +8 -4
- package/src/hooks/useMobileMenu.ts +2 -2
- package/src/types/portal/index.d.ts +2 -4
- package/src/types/portal/src/shared/constants.d.ts +29 -3
- package/src/types/portal/src/shared/types/markdown.d.ts +5 -0
- package/src/types/portal/src/shared/{types.d.ts → types/nav.d.ts} +12 -1
- package/src/ui/UniversalLink.tsx +1 -1
- package/ui/UniversalLink.d.ts +1 -1
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +0 -42
- package/src/types/portal/src/server/constants.d.ts +0 -9
- package/src/types/portal/src/server/content/content-provider.d.ts +0 -51
- package/src/types/portal/src/server/content/versions-config.d.ts +0 -35
- package/src/types/portal/src/server/dev-server/types.d.ts +0 -22
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +0 -36
- package/src/types/portal/src/server/plugins/portal-config/get-frontmatter-keys-to-resolve.d.ts +0 -2
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +0 -24
- package/src/types/portal/src/server/plugins/reference-docs/utils.d.ts +0 -26
- package/src/types/portal/src/server/plugins/types.d.ts +0 -80
- package/src/types/portal/src/server/store.d.ts +0 -52
- package/src/types/portal/src/server/utils/async.d.ts +0 -1
- package/src/types/portal/src/server/utils/crypto.d.ts +0 -3
- package/src/types/portal/src/server/utils/fs.d.ts +0 -5
- package/src/types/portal/src/server/utils/index.d.ts +0 -6
- package/src/types/portal/src/server/utils/paths.d.ts +0 -17
- package/src/types/portal/src/server/utils/rbac.d.ts +0 -15
- package/src/types/portal/src/server/utils/reporter/formatter.d.ts +0 -12
- package/src/types/portal/src/server/utils/reporter/reporter.d.ts +0 -18
- package/src/types/portal/src/server/utils/yaml.d.ts +0 -1
- package/src/types/portal/src/shared/models/active-item.d.ts +0 -3
- package/src/types/portal/src/shared/models/config.d.ts +0 -40
- package/src/types/portal/src/shared/models/index.d.ts +0 -6
- package/src/types/portal/src/shared/models/json-index.d.ts +0 -5
- package/src/types/portal/src/shared/models/operation-parameter.d.ts +0 -6
- package/src/types/portal/src/shared/models/search-data.d.ts +0 -5
- package/src/types/portal/src/shared/models/search-document.d.ts +0 -11
- package/src/types/portal/src/shared/urls.d.ts +0 -10
- package/src/types/portal/src/shared/utils.d.ts +0 -18
|
@@ -69,11 +69,14 @@ function ColorModeSwitcher() {
|
|
|
69
69
|
: colorMode.modes[0];
|
|
70
70
|
setActiveColorMode(mode);
|
|
71
71
|
localStorage.setItem('colorSchema', mode);
|
|
72
|
-
document.documentElement.className = mode;
|
|
72
|
+
document.documentElement.className = "".concat(mode, " notransition");
|
|
73
|
+
window.requestAnimationFrame(function () {
|
|
74
|
+
document.documentElement.classList.remove('notransition');
|
|
75
|
+
});
|
|
73
76
|
};
|
|
74
77
|
return (react_1.default.createElement(Wrapper, { "data-component-name": "ColorModeSwitcher/ColorModeSwitcher", onClick: handelChangeColorMode },
|
|
75
78
|
react_1.default.createElement(ColorModeIcon_1.ColorModeIcon, { mode: activeColorMode })));
|
|
76
79
|
}
|
|
77
80
|
exports.ColorModeSwitcher = ColorModeSwitcher;
|
|
78
|
-
var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-left: var(--navbar-item-padding-horizontal);\n display: flex;\n align-items: center;\n cursor: pointer;\n"], ["\n margin-left: var(--navbar-item-padding-horizontal);\n display: flex;\n align-items: center;\n cursor: pointer;\n"])));
|
|
81
|
+
var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-left: var(--navbar-item-padding-horizontal);\n display: flex;\n align-items: center;\n cursor: pointer;\n user-select: none;\n"], ["\n margin-left: var(--navbar-item-padding-horizontal);\n display: flex;\n align-items: center;\n cursor: pointer;\n user-select: none;\n"])));
|
|
79
82
|
var templateObject_1;
|
package/Sidebar/MenuGroup.js
CHANGED
|
@@ -3,12 +3,51 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
30
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
31
|
+
if (!m) return o;
|
|
32
|
+
var i = m.call(o), r, ar = [], e;
|
|
33
|
+
try {
|
|
34
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
35
|
+
}
|
|
36
|
+
catch (error) { e = { error: error }; }
|
|
37
|
+
finally {
|
|
38
|
+
try {
|
|
39
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
40
|
+
}
|
|
41
|
+
finally { if (e) throw e.error; }
|
|
42
|
+
}
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
6
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
47
|
};
|
|
9
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
49
|
exports.MenuGroup = void 0;
|
|
11
|
-
var react_1 =
|
|
50
|
+
var react_1 = __importStar(require("react"));
|
|
12
51
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
13
52
|
var ArrowIcon_1 = require("../icons/ArrowIcon/ArrowIcon");
|
|
14
53
|
var MenuLinkItem_1 = require("../Sidebar/MenuLinkItem");
|
|
@@ -16,17 +55,37 @@ var MenuItemLabel_1 = require("../Sidebar/MenuItemLabel");
|
|
|
16
55
|
var SeparatorLine_1 = require("../Sidebar/SeparatorLine");
|
|
17
56
|
function MenuGroup(_a) {
|
|
18
57
|
var item = _a.item, isExpanded = _a.isExpanded, toggleExpanded = _a.toggleExpanded, children = _a.children;
|
|
58
|
+
var _b = __read((0, react_1.useState)(isExpanded), 2), showChildren = _b[0], setShowChildren = _b[1];
|
|
59
|
+
var timer = (0, react_1.useRef)(null);
|
|
60
|
+
(0, react_1.useEffect)(function () {
|
|
61
|
+
timer.current && clearTimeout(timer.current);
|
|
62
|
+
if (isExpanded) {
|
|
63
|
+
setShowChildren(true);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
timer.current = setTimeout(function () {
|
|
67
|
+
setShowChildren(false);
|
|
68
|
+
}, 800);
|
|
69
|
+
}
|
|
70
|
+
return function () {
|
|
71
|
+
timer.current && clearTimeout(timer.current);
|
|
72
|
+
};
|
|
73
|
+
}, [isExpanded]);
|
|
19
74
|
return (react_1.default.createElement(Wrapper, { "data-component-name": "Sidebar/MenuGroup" },
|
|
20
75
|
react_1.default.createElement(MenuLinkItem_1.MenuLinkItem, { item: item },
|
|
21
76
|
react_1.default.createElement(MenuGroupLabel, { onClick: toggleExpanded, isAlwaysExpanded: item.expanded === 'always', active: item.active },
|
|
22
77
|
react_1.default.createElement(MenuGroupArrow, { direction: isExpanded ? 'down' : 'right' }),
|
|
23
78
|
item.label)),
|
|
24
|
-
react_1.default.createElement(MenuWrapper,
|
|
79
|
+
react_1.default.createElement(MenuWrapper, { isExpanded: isExpanded }, showChildren ? children : null),
|
|
25
80
|
item.separatorLine ? react_1.default.createElement(SeparatorLine_1.SeparatorLine, null) : null));
|
|
26
81
|
}
|
|
27
82
|
exports.MenuGroup = MenuGroup;
|
|
28
83
|
var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
29
|
-
var MenuWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: var(--sidebar-item-nested-offset);\n"], ["\n padding-left: var(--sidebar-item-nested-offset);\n"])))
|
|
84
|
+
var MenuWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: var(--sidebar-item-nested-offset);\n overflow: hidden;\n ", ";\n"], ["\n padding-left: var(--sidebar-item-nested-offset);\n overflow: hidden;\n ", ";\n"])), function (props) {
|
|
85
|
+
return props.isExpanded
|
|
86
|
+
? "max-height: 9999px;\n transition: max-height .8s cubic-bezier(0.5, 0, 1, 0) 0s;"
|
|
87
|
+
: "max-height: 0px;\n\t transition: max-height .8s cubic-bezier(0, 1, 0, 1) -.1s;";
|
|
88
|
+
});
|
|
30
89
|
var MenuGroupLabel = (0, styled_components_1.default)(MenuItemLabel_1.MenuItemLabel)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-left: var(--sidebar-item-padding-horizontal);\n cursor: ", ";\n font-family: var(--sidebar-item-group-font-family);\n font-size: var(--sidebar-item-group-font-size);\n text-transform: var(--sidebar-text-group-transform);\n color: var(--sidebar-item-group-text-color);\n background: var(--sidebar-item-group-background-color);\n ", ";\n"], ["\n padding-left: var(--sidebar-item-padding-horizontal);\n cursor: ", ";\n font-family: var(--sidebar-item-group-font-family);\n font-size: var(--sidebar-item-group-font-size);\n text-transform: var(--sidebar-text-group-transform);\n color: var(--sidebar-item-group-text-color);\n background: var(--sidebar-item-group-background-color);\n ", ";\n"])), function (props) { return (props.isAlwaysExpanded ? 'default' : 'pointer'); }, function (props) {
|
|
31
90
|
return props.active
|
|
32
91
|
? "color: var(--sidebar-item-group-active-text-color);\n background-color: var(--sidebar-item-group-active-background-color);"
|
package/globalStyle.js
CHANGED
|
@@ -26,13 +26,13 @@ var footer = (0, styled_components_1.css)(templateObject_16 || (templateObject_1
|
|
|
26
26
|
var logo = (0, styled_components_1.css)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n /**\n * @tokens Logo\n */\n\n --navbar-logo-height: 2rem; // @presenter Spacing\n --navbar-logo-width: auto;\n --navbar-logo-margin: 16px; // @presenter Spacing\n --navbar-logo-max-width: 285px; // @presenter Spacing\n --navbar-logo-max-height: 285px; // @presenter Spacing\n\n // @tokens End\n"], ["\n /**\n * @tokens Logo\n */\n\n --navbar-logo-height: 2rem; // @presenter Spacing\n --navbar-logo-width: auto;\n --navbar-logo-margin: 16px; // @presenter Spacing\n --navbar-logo-max-width: 285px; // @presenter Spacing\n --navbar-logo-max-height: 285px; // @presenter Spacing\n\n // @tokens End\n"])));
|
|
27
27
|
var navbar = (0, styled_components_1.css)(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n /**\n * @tokens Navbar\n */\n --navbar-height: 60px; // @presenter Spacing\n --navbar-text-color: #fff; // @presenter Color\n --navbar-background-color: var(--color-primary-500); // @presenter Color\n --navbar-container-max-width: 100%;\n\n /**\n * @tokens Navbar Item\n * */\n --navbar-item-font-family: var(--font-family-base); // @presenter FontFamily\n --navbar-item-font-size: 16px; // @presenter FontSize\n --navbar-item-padding-horizontal: 16px; // @presenter Spacing\n --navbar-item-paddin-vertical: 8px; // @presenter Spacing\n --navbar-item-margin-horizontal: 7px;\n --navbar-item-border-radius: var(--border-radius); // @presenter BorderRadius\n --navbar-item-font-weight: var(--font-weight-bold); // @presenter FontWeight\n --navbar-item-hover-background-color: var(--color-primary-300);\n --navbar-item-active-background-color: var(--color-primary-300); // @presenter Color\n --navbar-item-hover-text-color: var(--navbar-text-color); // @presenter Color\n --navbar-item-hover-text-decoration: none;\n --navbar-item-active-text-color: var(--navbar-text-color); // @presenter Color\n --navbar-item-active-text-decoration: none;\n --navbar-item-separator-line-color: var(--border-color); // @presenter Color\n\n /**\n * @tokens Navbar dropdown\n * */\n\n --navbar-dropdown-shadow: 4px 4px 15px -2px rgba(0, 0, 0, 0.5); //should be variable\n --navbar-dropdown-background: var(--navbar-item-active-background-color);\n --navbar-dropdown-border: none;\n\n // @tokens End\n"], ["\n /**\n * @tokens Navbar\n */\n --navbar-height: 60px; // @presenter Spacing\n --navbar-text-color: #fff; // @presenter Color\n --navbar-background-color: var(--color-primary-500); // @presenter Color\n --navbar-container-max-width: 100%;\n\n /**\n * @tokens Navbar Item\n * */\n --navbar-item-font-family: var(--font-family-base); // @presenter FontFamily\n --navbar-item-font-size: 16px; // @presenter FontSize\n --navbar-item-padding-horizontal: 16px; // @presenter Spacing\n --navbar-item-paddin-vertical: 8px; // @presenter Spacing\n --navbar-item-margin-horizontal: 7px;\n --navbar-item-border-radius: var(--border-radius); // @presenter BorderRadius\n --navbar-item-font-weight: var(--font-weight-bold); // @presenter FontWeight\n --navbar-item-hover-background-color: var(--color-primary-300);\n --navbar-item-active-background-color: var(--color-primary-300); // @presenter Color\n --navbar-item-hover-text-color: var(--navbar-text-color); // @presenter Color\n --navbar-item-hover-text-decoration: none;\n --navbar-item-active-text-color: var(--navbar-text-color); // @presenter Color\n --navbar-item-active-text-decoration: none;\n --navbar-item-separator-line-color: var(--border-color); // @presenter Color\n\n /**\n * @tokens Navbar dropdown\n * */\n\n --navbar-dropdown-shadow: 4px 4px 15px -2px rgba(0, 0, 0, 0.5); //should be variable\n --navbar-dropdown-background: var(--navbar-item-active-background-color);\n --navbar-dropdown-border: none;\n\n // @tokens End\n"])));
|
|
28
28
|
var toc = (0, styled_components_1.css)(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n /**\n * @tokens TOC\n * */\n\n --toc-width: 240px;\n --toc-background-color: transparent;\n --toc-border-color: var(--border-color);\n\n --toc-spacing-unit: 8px;\n --toc-offset-top: calc(var(--toc-spacing-unit) * 2);\n\n /**\n * @tokens TOC item typography\n */\n --toc-item-font-family: var(--font-family-base); // @presenter FontFamily\n --toc-item-font-size: var(--font-size-base); // @presenter FontSize\n\n /**\n * @tokens TOC item\n */\n\n --toc-item-text-color: var(--text-color); // @presenter Color\n --toc-item-active-text-color: var(--text-color); // @presenter Color\n --toc-item-background-color: transparent; // @presenter Color\n --toc-item-active-background-color: var(--border-color); // @presenter Color\n --toc-item-nested-offset: calc(var(--toc-spacing-unit) * 2); // @presenter Spacing\n --toc-item-padding-vertical: var(--toc-spacing-unit); // @presenter Spacing\n --toc-item-padding-horizontal: calc(var(--toc-spacing-unit) * 2); // @presenter Spacing\n\n /**\n * @tokens TOC header\n */\n\n --toc-heading-font-size: var(--font-size-base); // @presenter FontSize\n --toc-heading-font-family: var(--font-family-base); // @presenter FontFamily\n --toc-heading-font-weight: bold; // @presenter FontWeight\n --toc-heading-text-color: var(--text-color); // @presenter Color\n\n // @tokens End\n"], ["\n /**\n * @tokens TOC\n * */\n\n --toc-width: 240px;\n --toc-background-color: transparent;\n --toc-border-color: var(--border-color);\n\n --toc-spacing-unit: 8px;\n --toc-offset-top: calc(var(--toc-spacing-unit) * 2);\n\n /**\n * @tokens TOC item typography\n */\n --toc-item-font-family: var(--font-family-base); // @presenter FontFamily\n --toc-item-font-size: var(--font-size-base); // @presenter FontSize\n\n /**\n * @tokens TOC item\n */\n\n --toc-item-text-color: var(--text-color); // @presenter Color\n --toc-item-active-text-color: var(--text-color); // @presenter Color\n --toc-item-background-color: transparent; // @presenter Color\n --toc-item-active-background-color: var(--border-color); // @presenter Color\n --toc-item-nested-offset: calc(var(--toc-spacing-unit) * 2); // @presenter Spacing\n --toc-item-padding-vertical: var(--toc-spacing-unit); // @presenter Spacing\n --toc-item-padding-horizontal: calc(var(--toc-spacing-unit) * 2); // @presenter Spacing\n\n /**\n * @tokens TOC header\n */\n\n --toc-heading-font-size: var(--font-size-base); // @presenter FontSize\n --toc-heading-font-family: var(--font-family-base); // @presenter FontFamily\n --toc-heading-font-weight: bold; // @presenter FontWeight\n --toc-heading-text-color: var(--text-color); // @presenter Color\n\n // @tokens End\n"])));
|
|
29
|
-
var loadProgressBar = (0, styled_components_1.css)(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n\n /**\n * @tokens Load progress bar\n */\n\n --load-progress-bar-color: var(--color-
|
|
29
|
+
var loadProgressBar = (0, styled_components_1.css)(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n\n /**\n * @tokens Load progress bar\n */\n\n --load-progress-bar-color: var(--color-secondary-500); // @presenter Color\n --load-progress-bar-shadow: 0 0 10px var(--load-progress-bar-color), 0 0 5px var(--load-progress-bar-color); // @presenter BoxShadow\n --load-progress-bar-height: 2px; // @presenter Height\n\n // @tokens End\n \n /* Make clicks pass-through */\n #nprogress {\n pointer-events: none;\n }\n\n #nprogress .bar {\n background: var(--load-progress-bar-color);\n\n position: fixed;\n z-index: 1031;\n top: 0;\n left: 0;\n\n width: 100%;\n height: var(--load-progress-bar-height);\n }\n\n #nprogress .peg {\n display: block;\n position: absolute;\n right: 0px;\n width: 100px;\n height: 100%;\n box-shadow: var(--load-progress-bar-shadow);\n opacity: 1.0;\n\n -webkit-transform: rotate(3deg) translate(0px, -4px);\n -ms-transform: rotate(3deg) translate(0px, -4px);\n transform: rotate(3deg) translate(0px, -4px);\n }\n\n .nprogress-custom-parent {\n overflow: hidden;\n position: relative;\n }\n\n .nprogress-custom-parent #nprogress .bar {\n position: absolute;\n }\n"], ["\n\n /**\n * @tokens Load progress bar\n */\n\n --load-progress-bar-color: var(--color-secondary-500); // @presenter Color\n --load-progress-bar-shadow: 0 0 10px var(--load-progress-bar-color), 0 0 5px var(--load-progress-bar-color); // @presenter BoxShadow\n --load-progress-bar-height: 2px; // @presenter Height\n\n // @tokens End\n \n /* Make clicks pass-through */\n #nprogress {\n pointer-events: none;\n }\n\n #nprogress .bar {\n background: var(--load-progress-bar-color);\n\n position: fixed;\n z-index: 1031;\n top: 0;\n left: 0;\n\n width: 100%;\n height: var(--load-progress-bar-height);\n }\n\n #nprogress .peg {\n display: block;\n position: absolute;\n right: 0px;\n width: 100px;\n height: 100%;\n box-shadow: var(--load-progress-bar-shadow);\n opacity: 1.0;\n\n -webkit-transform: rotate(3deg) translate(0px, -4px);\n -ms-transform: rotate(3deg) translate(0px, -4px);\n transform: rotate(3deg) translate(0px, -4px);\n }\n\n .nprogress-custom-parent {\n overflow: hidden;\n position: relative;\n }\n\n .nprogress-custom-parent #nprogress .bar {\n position: absolute;\n }\n"])));
|
|
30
30
|
var inputs = (0, styled_components_1.css)(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n /**\n * @tokens Inputs\n */\n --input-text-color: var(--text-color-inverse); // @presenter Color\n --input-border: none; // @presenter Border\n --input-border-radius: var(--border-radius); // @presenter BorderRadius\n --input-font-size: var(--font-size-base); // @presenter FontSize\n --input-font-family: var(--code-font-family); // @presenter FontFamily\n --input-line-height: 1.15em; // @presenter LineHeight\n --input-padding: 8px;\n\n --input-hover-text-color: var(--text-color-inverse); // @presenter Color\n --input-hover-border: none; // @presenter Border\n --input-focus-border: none; // @presenter Border\n --input-focus-text-color: var(--text-color-inverse); // @presenter Color\n --input-placeholder-text-color: var(--text-color-inverse); // @presenter Color\n\n // @tokens End\n"], ["\n /**\n * @tokens Inputs\n */\n --input-text-color: var(--text-color-inverse); // @presenter Color\n --input-border: none; // @presenter Border\n --input-border-radius: var(--border-radius); // @presenter BorderRadius\n --input-font-size: var(--font-size-base); // @presenter FontSize\n --input-font-family: var(--code-font-family); // @presenter FontFamily\n --input-line-height: 1.15em; // @presenter LineHeight\n --input-padding: 8px;\n\n --input-hover-text-color: var(--text-color-inverse); // @presenter Color\n --input-hover-border: none; // @presenter Border\n --input-focus-border: none; // @presenter Border\n --input-focus-text-color: var(--text-color-inverse); // @presenter Color\n --input-placeholder-text-color: var(--text-color-inverse); // @presenter Color\n\n // @tokens End\n"])));
|
|
31
31
|
var markdown = (0, styled_components_1.css)(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n /**\n * @tokens Markdown Container\n */\n\n --md-container-max-width: 910px;\n --md-container-padding-vertical: 25px; // @presenter Spacing\n --md-container-padding-horizontal: 0px; // @presenter Spacing\n\n /**\n * @tokens Markdown Blockquote\n */\n\n --md-blockquote-margin-vertical: 1.5em; // @presenter Spacing\n --md-blockquote-margin-horizontal: 0; // @presenter Spacing\n --md-blockquote-padding-vertical: 0; // @presenter Spacing\n --md-blockquote-padding-horizontal: calc(var(--spacing-unit) * 4); // @presenter Spacing\n --md-blockquote-border-color: var(--border-color); // @presenter Color\n --md-blockquote-background-color: transparent; // @presenter Color\n --md-blockquote-border-left: 4px solid var(--md-blockquote-border-color); // @presenter Border\n --md-blockquote-text-color: var(--text-color); // @presenter Color\n --md-blockquote-box-shadow: none; // @presenter Shadow\n\n /** \n * @tokens Markdown Paragraph\n */\n\n --md-paragraph-margin-vertical: 10px; // @presenter Spacing\n --md-paragraph-margin-horizontal: 0px; // @presenter Spacing\n\n /**\n * @tokens Markdown Table\n */\n\n --md-table-font-size: 14px; // @presenter FontSize\n --md-table-margin-vertical: 20px; // @presenter Spacing\n --md-table-background-color: transparent; // @presenter Color\n\n --md-table-border-radius: var(--border-radius-lg); // @presenter BorderRadius\n --md-table-border-width: 1px;\n --md-table-border-color: var(--border-color); // @presenter Color\n\n --md-table-stripe-background-color: var(--md-table-background-color); // @presenter Color\n\n --md-table-cell-text-color: var(--text-color); // @presenter Color\n --md-table-cell-padding: 12px; // @presenter Spacing\n\n --md-table-head-background-color: var(--color-secondary-200); // @presenter Color\n --md-table-head-text-color: var(--text-color); // @presenter Color\n --md-table-head-font-weight: var(--font-weight-bold); // @presenter FontWeight\n\n /**\n * @tokens Markdown Horizontal Rule\n */\n\n --md-hr-background-color: transparent; // @presenter Color\n --md-hr-border-color: var(--border-color); // @presenter Color\n --md-hr-height: unset;\n --md-hr-margin-vertical: 20px; // @presenter Spacing\n\n /** \n * @tokens Markdown List\n */\n\n --md-list-left-padding: 2rem; // @presenter Spacing\n --md-list-margin: 1rem; // @presenter Spacing\n --md-list-item-margin: 0.25rem; // @presenter Spacing\n --md-list-item-style: inherit;\n\n /** \n * @tokens Markdown Numbered List\n */\n\n --md-numbered-list-number-display: none;\n --md-numbered-list-item-style: var(--md-list-item-style);\n --md-numbered-list-number-text-color: var(--color-secondary-100); // @presenter Color\n --md-numbered-list-number-font-size: var(--font-size-base); // @presenter FontSize\n --md-numbered-list-number-font-family: var(--font-size-base); // @presenter FontFamily\n --md-numbered-list-number-font-weight: var(--font-weight-regular); // @presenter FontWeight\n --md-numbered-list-number-background-color: var(--color-secondary-800); // @presenter Color\n --md-numbered-list-number-border-radius: 10px; // @presenter BorderRadius\n --md-numbered-list-number-margin-right: 5px; // @presenter Spacing\n --md-numbered-list-number-padding: 0 5px; // @presenter Spacing\n\n // @tokens End\n"], ["\n /**\n * @tokens Markdown Container\n */\n\n --md-container-max-width: 910px;\n --md-container-padding-vertical: 25px; // @presenter Spacing\n --md-container-padding-horizontal: 0px; // @presenter Spacing\n\n /**\n * @tokens Markdown Blockquote\n */\n\n --md-blockquote-margin-vertical: 1.5em; // @presenter Spacing\n --md-blockquote-margin-horizontal: 0; // @presenter Spacing\n --md-blockquote-padding-vertical: 0; // @presenter Spacing\n --md-blockquote-padding-horizontal: calc(var(--spacing-unit) * 4); // @presenter Spacing\n --md-blockquote-border-color: var(--border-color); // @presenter Color\n --md-blockquote-background-color: transparent; // @presenter Color\n --md-blockquote-border-left: 4px solid var(--md-blockquote-border-color); // @presenter Border\n --md-blockquote-text-color: var(--text-color); // @presenter Color\n --md-blockquote-box-shadow: none; // @presenter Shadow\n\n /** \n * @tokens Markdown Paragraph\n */\n\n --md-paragraph-margin-vertical: 10px; // @presenter Spacing\n --md-paragraph-margin-horizontal: 0px; // @presenter Spacing\n\n /**\n * @tokens Markdown Table\n */\n\n --md-table-font-size: 14px; // @presenter FontSize\n --md-table-margin-vertical: 20px; // @presenter Spacing\n --md-table-background-color: transparent; // @presenter Color\n\n --md-table-border-radius: var(--border-radius-lg); // @presenter BorderRadius\n --md-table-border-width: 1px;\n --md-table-border-color: var(--border-color); // @presenter Color\n\n --md-table-stripe-background-color: var(--md-table-background-color); // @presenter Color\n\n --md-table-cell-text-color: var(--text-color); // @presenter Color\n --md-table-cell-padding: 12px; // @presenter Spacing\n\n --md-table-head-background-color: var(--color-secondary-200); // @presenter Color\n --md-table-head-text-color: var(--text-color); // @presenter Color\n --md-table-head-font-weight: var(--font-weight-bold); // @presenter FontWeight\n\n /**\n * @tokens Markdown Horizontal Rule\n */\n\n --md-hr-background-color: transparent; // @presenter Color\n --md-hr-border-color: var(--border-color); // @presenter Color\n --md-hr-height: unset;\n --md-hr-margin-vertical: 20px; // @presenter Spacing\n\n /** \n * @tokens Markdown List\n */\n\n --md-list-left-padding: 2rem; // @presenter Spacing\n --md-list-margin: 1rem; // @presenter Spacing\n --md-list-item-margin: 0.25rem; // @presenter Spacing\n --md-list-item-style: inherit;\n\n /** \n * @tokens Markdown Numbered List\n */\n\n --md-numbered-list-number-display: none;\n --md-numbered-list-item-style: var(--md-list-item-style);\n --md-numbered-list-number-text-color: var(--color-secondary-100); // @presenter Color\n --md-numbered-list-number-font-size: var(--font-size-base); // @presenter FontSize\n --md-numbered-list-number-font-family: var(--font-size-base); // @presenter FontFamily\n --md-numbered-list-number-font-weight: var(--font-weight-regular); // @presenter FontWeight\n --md-numbered-list-number-background-color: var(--color-secondary-800); // @presenter Color\n --md-numbered-list-number-border-radius: 10px; // @presenter BorderRadius\n --md-numbered-list-number-margin-right: 5px; // @presenter Spacing\n --md-numbered-list-number-padding: 0 5px; // @presenter Spacing\n\n // @tokens End\n"])));
|
|
32
32
|
var search = (0, styled_components_1.css)(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n /**\n * @tokens Search\n */\n\n --search-highlight-text-color: #ffff03; // @presenter Color\n\n /**\n * @tokens Portal Search\n */\n\n --search-input-background-color: rgba(255, 255, 255, 0.1); // @presenter Color\n --search-input-text-color: #fff; // @presenter Color\n\n --search-input-border: none;\n --search-input-border-radius: var(--border-radius); // @presenter BorderRadius\n --search-input-font-size: var(--navbar-item-font-size); // @presenter FontSize\n --search-input-font-family: var(--font-family-base); // @presenter FontFamily\n --search-input-line-height: 1.15em; // @presenter LineHeight\n\n --search-input-hover-background-color: rgba(255, 255, 255, 0.1); // @presenter Color\n --search-input-hover-border: none; // @presenter Color\n --search-input-placeholder-color: var(--search-input-text-color);\n\n --search-popover-background-color: var(--background-color); // @presenter Color\n --search-popover-border-radius: var(--search-input-border-radius); // @presenter BorderRadius\n --search-popover-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12),\n 0 8px 10px -5px rgba(0, 0, 0, 0.4); // @presenter BoxShadow\n --search-popover-border: none;\n\n --search-item-padding: 8px 24px;\n --search-item-text-color: var(--text-color-secondary); // @presenter Color\n --search-item-title-text-color: var(--text-color); // @presenter Color\n --search-item-background-color: transparent; // @presenter Color\n --search-item-active-text-color: var(--text-color-secondary); // @presenter Color\n --search-item-active-title-text-color: var(--text-color); // @presenter Color\n --search-item-active-background-color: rgba(0, 68, 212, 0.1); // @presenter Color\n\n /**\n * @tokens Sidebar Search\n */\n\n --sidebar-search-button-background-color: transparent; // @presenter Color\n --sidebar-search-button-text-color: var(--text-color); // @presenter Color\n --sidebar-search-button-border: var(--border-color);\n --sidebar-search-button-border-radius: none; // @presenter BorderRadius\n --sidebar-search-button-font-size: var(--font-size-small); // @presenter FontSize\n --sidebar-search-button-font-family: var(--font-family-base); // @presenter FontFamily\n --sidebar-search-button-line-height: 1.15em; // @presenter LineHeight\n --sidebar-search-button-hover-background-color: transparent; // @presenter Color\n --sidebar-search-button-hover-border: var(--border-color); // @presenter Color\n --sidebar-search-button-active-background-color: transparent; // @presenter Color\n --sidebar-search-button-active-border: var(--border-color); // @presenter Color\n\n /**\n * @tokens Search results modal\n * @presenter Color\n */\n\n --search-modal-background: var(--background-color);\n --search-modal-text-color: var(--text-color);\n --search-modal-border: none;\n --search-modal-box-shadow: none;\n\n --search-modal-header-border-radius: 8px;\n --search-modal-header-background-color: var(--color-secondary-100);\n --search-modal-clear-button-background-color: var(--color-secondary-300);\n --search-modal-clear-button-hover-background-color: var(--color-secondary-500);\n\n // @tokens End\n"], ["\n /**\n * @tokens Search\n */\n\n --search-highlight-text-color: #ffff03; // @presenter Color\n\n /**\n * @tokens Portal Search\n */\n\n --search-input-background-color: rgba(255, 255, 255, 0.1); // @presenter Color\n --search-input-text-color: #fff; // @presenter Color\n\n --search-input-border: none;\n --search-input-border-radius: var(--border-radius); // @presenter BorderRadius\n --search-input-font-size: var(--navbar-item-font-size); // @presenter FontSize\n --search-input-font-family: var(--font-family-base); // @presenter FontFamily\n --search-input-line-height: 1.15em; // @presenter LineHeight\n\n --search-input-hover-background-color: rgba(255, 255, 255, 0.1); // @presenter Color\n --search-input-hover-border: none; // @presenter Color\n --search-input-placeholder-color: var(--search-input-text-color);\n\n --search-popover-background-color: var(--background-color); // @presenter Color\n --search-popover-border-radius: var(--search-input-border-radius); // @presenter BorderRadius\n --search-popover-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12),\n 0 8px 10px -5px rgba(0, 0, 0, 0.4); // @presenter BoxShadow\n --search-popover-border: none;\n\n --search-item-padding: 8px 24px;\n --search-item-text-color: var(--text-color-secondary); // @presenter Color\n --search-item-title-text-color: var(--text-color); // @presenter Color\n --search-item-background-color: transparent; // @presenter Color\n --search-item-active-text-color: var(--text-color-secondary); // @presenter Color\n --search-item-active-title-text-color: var(--text-color); // @presenter Color\n --search-item-active-background-color: rgba(0, 68, 212, 0.1); // @presenter Color\n\n /**\n * @tokens Sidebar Search\n */\n\n --sidebar-search-button-background-color: transparent; // @presenter Color\n --sidebar-search-button-text-color: var(--text-color); // @presenter Color\n --sidebar-search-button-border: var(--border-color);\n --sidebar-search-button-border-radius: none; // @presenter BorderRadius\n --sidebar-search-button-font-size: var(--font-size-small); // @presenter FontSize\n --sidebar-search-button-font-family: var(--font-family-base); // @presenter FontFamily\n --sidebar-search-button-line-height: 1.15em; // @presenter LineHeight\n --sidebar-search-button-hover-background-color: transparent; // @presenter Color\n --sidebar-search-button-hover-border: var(--border-color); // @presenter Color\n --sidebar-search-button-active-background-color: transparent; // @presenter Color\n --sidebar-search-button-active-border: var(--border-color); // @presenter Color\n\n /**\n * @tokens Search results modal\n * @presenter Color\n */\n\n --search-modal-background: var(--background-color);\n --search-modal-text-color: var(--text-color);\n --search-modal-border: none;\n --search-modal-box-shadow: none;\n\n --search-modal-header-border-radius: 8px;\n --search-modal-header-background-color: var(--color-secondary-100);\n --search-modal-clear-button-background-color: var(--color-secondary-300);\n --search-modal-clear-button-hover-background-color: var(--color-secondary-500);\n\n // @tokens End\n"])));
|
|
33
33
|
var dropdown = (0, styled_components_1.css)(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n --dropdown-font-size: 14px;\n --dropdown-text-color: var(--text-color);\n\n --dropdown-padding-vertical: 8px;\n --dropdown-padding-left: 10px;\n --dropdown-padding-right: 26px;\n --dropdown-padding: var(--dropdown-padding-vertical) var(--dropdown-padding-right)\n var(--dropdown-padding-vertical) var(--dropdown-padding-left);\n\n --dropdown-border: none;\n"], ["\n --dropdown-font-size: 14px;\n --dropdown-text-color: var(--text-color);\n\n --dropdown-padding-vertical: 8px;\n --dropdown-padding-left: 10px;\n --dropdown-padding-right: 26px;\n --dropdown-padding: var(--dropdown-padding-vertical) var(--dropdown-padding-right)\n var(--dropdown-padding-vertical) var(--dropdown-padding-left);\n\n --dropdown-border: none;\n"])));
|
|
34
34
|
var lastUpdated = (0, styled_components_1.css)(templateObject_25 || (templateObject_25 = __makeTemplateObject(["\n --last-updated-text-color: var(--text-color);\n --last-updated-font-size: var(--font-size-small);\n --last-updated-font-family: var(--font-family-base);\n --last-updated-line-height: var(--line-height-base);\n"], ["\n --last-updated-text-color: var(--text-color);\n --last-updated-font-size: var(--font-size-small);\n --last-updated-font-family: var(--font-family-base);\n --last-updated-line-height: var(--line-height-base);\n"])));
|
|
35
35
|
var tile = (0, styled_components_1.css)(templateObject_26 || (templateObject_26 = __makeTemplateObject(["\n --wide-tile-background-color: var(--color-secondary-50);\n --thin-tile-background-color: var(--color-secondary-50);\n"], ["\n --wide-tile-background-color: var(--color-secondary-50);\n --thin-tile-background-color: var(--color-secondary-50);\n"])));
|
|
36
|
-
exports.styles = (0, styled_components_1.css)(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n :root {\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n\n :root.dark {\n ", ";\n }\n"], ["\n :root {\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n\n :root.dark {\n ", ";\n }\n"])), baseColors, httpColors, responsePanelColors, typography, headingsTypography, common, admonition, buttons, sidebar, navbar, footer, logo, badges, toc, inputs, tooltip, code, links, markdown, search, dropdown, apiReferencePanels, apiReferenceDocs, lastUpdated, tile, loadProgressBar, darkColors_1.darkMode);
|
|
36
|
+
exports.styles = (0, styled_components_1.css)(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n :root {\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n\n :root.dark {\n ", ";\n }\n\n :root.notransition * {\n transition: none !important; \n }\n"], ["\n :root {\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n }\n\n :root.dark {\n ", ";\n }\n\n :root.notransition * {\n transition: none !important; \n }\n"])), baseColors, httpColors, responsePanelColors, typography, headingsTypography, common, admonition, buttons, sidebar, navbar, footer, logo, badges, toc, inputs, tooltip, code, links, markdown, search, dropdown, apiReferencePanels, apiReferenceDocs, lastUpdated, tile, loadProgressBar, darkColors_1.darkMode);
|
|
37
37
|
exports.GlobalStyle = (0, styled_components_1.createGlobalStyle)(templateObject_28 || (templateObject_28 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), exports.styles);
|
|
38
38
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28;
|
|
@@ -23,7 +23,7 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
23
23
|
var _a = __read((0, react_1.useState)(undefined), 2), heading = _a[0], setHeading = _a[1];
|
|
24
24
|
var _b = __read((0, react_1.useState)([]), 2), headingElements = _b[0], setHeadingElements = _b[1];
|
|
25
25
|
var headingElementsRef = (0, react_1.useRef)({});
|
|
26
|
-
var
|
|
26
|
+
var history = (0, react_router_dom_1.useHistory)();
|
|
27
27
|
var getVisibleHeadings = function () {
|
|
28
28
|
var visibleHeadings = [];
|
|
29
29
|
for (var key in headingElementsRef.current) {
|
|
@@ -72,9 +72,12 @@ function useActiveHeading(contentElement, displayedHeaders) {
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
setHeadingElements(findHeaders(contentElement));
|
|
75
|
-
|
|
75
|
+
var unlisten = history.listen(function () {
|
|
76
|
+
setHeadingElements(findHeaders(contentElement));
|
|
77
|
+
});
|
|
78
|
+
return function () { return unlisten(); };
|
|
76
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77
|
-
}, [
|
|
80
|
+
}, [contentElement]);
|
|
78
81
|
(0, react_1.useEffect)(function () {
|
|
79
82
|
if (!(headingElements === null || headingElements === void 0 ? void 0 : headingElements.length)) {
|
|
80
83
|
return;
|
package/hooks/useMobileMenu.js
CHANGED
|
@@ -21,7 +21,7 @@ var react_1 = require("react");
|
|
|
21
21
|
var react_router_dom_1 = require("react-router-dom");
|
|
22
22
|
function useMobileMenu(initialState) {
|
|
23
23
|
if (initialState === void 0) { initialState = false; }
|
|
24
|
-
var location = (0, react_router_dom_1.
|
|
24
|
+
var location = (0, react_router_dom_1.useHistory)().location;
|
|
25
25
|
var _a = __read((0, react_1.useState)(initialState), 2), isOpen = _a[0], setIsOpen = _a[1];
|
|
26
26
|
(0, react_1.useEffect)(function () { return setIsOpen(false); }, [location.pathname]);
|
|
27
27
|
return [isOpen, setIsOpen];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
4
4
|
"description": "Shared UI components",
|
|
5
5
|
"author": "team@redocly.com",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prismjs": "^1.28.0",
|
|
12
12
|
"react": "^17.0.2",
|
|
13
13
|
"react-dom": "^17.0.2",
|
|
14
|
-
"react-router-dom": "^
|
|
14
|
+
"react-router-dom": "^5.3.0",
|
|
15
15
|
"styled-components": "^5.3.1",
|
|
16
16
|
"styled-system": "^5.1.5"
|
|
17
17
|
},
|
|
@@ -26,7 +26,11 @@ export function ColorModeSwitcher(): JSX.Element | null {
|
|
|
26
26
|
: colorMode.modes[0];
|
|
27
27
|
setActiveColorMode(mode);
|
|
28
28
|
localStorage.setItem('colorSchema', mode);
|
|
29
|
-
document.documentElement.className = mode
|
|
29
|
+
document.documentElement.className = `${mode} notransition`;
|
|
30
|
+
|
|
31
|
+
window.requestAnimationFrame(() => {
|
|
32
|
+
document.documentElement.classList.remove('notransition');
|
|
33
|
+
});
|
|
30
34
|
};
|
|
31
35
|
|
|
32
36
|
return (
|
|
@@ -44,4 +48,5 @@ const Wrapper = styled.div`
|
|
|
44
48
|
display: flex;
|
|
45
49
|
align-items: center;
|
|
46
50
|
cursor: pointer;
|
|
51
|
+
user-select: none;
|
|
47
52
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import type { ItemState } from '@theme/Sidebar/types/ItemState';
|
|
@@ -20,6 +20,22 @@ export function MenuGroup({
|
|
|
20
20
|
toggleExpanded,
|
|
21
21
|
children,
|
|
22
22
|
}: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
|
|
23
|
+
const [showChildren, setShowChildren] = useState<boolean>(isExpanded);
|
|
24
|
+
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
timer.current && clearTimeout(timer.current);
|
|
27
|
+
if (isExpanded) {
|
|
28
|
+
setShowChildren(true);
|
|
29
|
+
} else {
|
|
30
|
+
timer.current = setTimeout(() => {
|
|
31
|
+
setShowChildren(false);
|
|
32
|
+
}, 800);
|
|
33
|
+
}
|
|
34
|
+
return () => {
|
|
35
|
+
timer.current && clearTimeout(timer.current);
|
|
36
|
+
};
|
|
37
|
+
}, [isExpanded]);
|
|
38
|
+
|
|
23
39
|
return (
|
|
24
40
|
<Wrapper data-component-name="Sidebar/MenuGroup">
|
|
25
41
|
<MenuLinkItem item={item}>
|
|
@@ -33,7 +49,7 @@ export function MenuGroup({
|
|
|
33
49
|
</MenuGroupLabel>
|
|
34
50
|
</MenuLinkItem>
|
|
35
51
|
|
|
36
|
-
<MenuWrapper>{
|
|
52
|
+
<MenuWrapper isExpanded={isExpanded}>{showChildren ? children : null}</MenuWrapper>
|
|
37
53
|
|
|
38
54
|
{item.separatorLine ? <SeparatorLine /> : null}
|
|
39
55
|
</Wrapper>
|
|
@@ -42,8 +58,15 @@ export function MenuGroup({
|
|
|
42
58
|
|
|
43
59
|
const Wrapper = styled.div``;
|
|
44
60
|
|
|
45
|
-
const MenuWrapper = styled.div
|
|
61
|
+
const MenuWrapper = styled.div<{ isExpanded?: boolean }>`
|
|
46
62
|
padding-left: var(--sidebar-item-nested-offset);
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
${(props) =>
|
|
65
|
+
props.isExpanded
|
|
66
|
+
? `max-height: 9999px;
|
|
67
|
+
transition: max-height .8s cubic-bezier(0.5, 0, 1, 0) 0s;`
|
|
68
|
+
: `max-height: 0px;
|
|
69
|
+
transition: max-height .8s cubic-bezier(0, 1, 0, 1) -.1s;`};
|
|
47
70
|
`;
|
|
48
71
|
|
|
49
72
|
const MenuGroupLabel = styled(MenuItemLabel)<{ isAlwaysExpanded?: boolean }>`
|
package/src/globalStyle.ts
CHANGED
|
@@ -1653,7 +1653,7 @@ const loadProgressBar = css`
|
|
|
1653
1653
|
* @tokens Load progress bar
|
|
1654
1654
|
*/
|
|
1655
1655
|
|
|
1656
|
-
--load-progress-bar-color: var(--color-
|
|
1656
|
+
--load-progress-bar-color: var(--color-secondary-500); // @presenter Color
|
|
1657
1657
|
--load-progress-bar-shadow: 0 0 10px var(--load-progress-bar-color), 0 0 5px var(--load-progress-bar-color); // @presenter BoxShadow
|
|
1658
1658
|
--load-progress-bar-height: 2px; // @presenter Height
|
|
1659
1659
|
|
|
@@ -1938,6 +1938,10 @@ export const styles = css`
|
|
|
1938
1938
|
:root.dark {
|
|
1939
1939
|
${darkMode};
|
|
1940
1940
|
}
|
|
1941
|
+
|
|
1942
|
+
:root.notransition * {
|
|
1943
|
+
transition: none !important;
|
|
1944
|
+
}
|
|
1941
1945
|
`;
|
|
1942
1946
|
|
|
1943
1947
|
export const GlobalStyle = createGlobalStyle`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useHistory } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
export type UseActiveHeadingReturnType = string | undefined;
|
|
5
5
|
|
|
@@ -15,7 +15,7 @@ export function useActiveHeading(
|
|
|
15
15
|
const [headingElements, setHeadingElements] = useState<HTMLElement[]>([]);
|
|
16
16
|
const headingElementsRef = useRef<HeadingEntry>({});
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const history = useHistory();
|
|
19
19
|
|
|
20
20
|
const getVisibleHeadings = () => {
|
|
21
21
|
const visibleHeadings: IntersectionObserverEntry[] = [];
|
|
@@ -85,9 +85,13 @@ export function useActiveHeading(
|
|
|
85
85
|
}
|
|
86
86
|
setHeadingElements(findHeaders(contentElement));
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
const unlisten = history.listen(() => {
|
|
89
|
+
setHeadingElements(findHeaders(contentElement));
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return () => unlisten();
|
|
89
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
90
|
-
}, [
|
|
94
|
+
}, [contentElement]);
|
|
91
95
|
|
|
92
96
|
useEffect(() => {
|
|
93
97
|
if (!headingElements?.length) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useHistory } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
export function useMobileMenu(initialState = false): [boolean, Dispatch<SetStateAction<boolean>>] {
|
|
6
|
-
const location =
|
|
6
|
+
const { location } = useHistory();
|
|
7
7
|
const [isOpen, setIsOpen] = useState(initialState);
|
|
8
8
|
|
|
9
9
|
useEffect(() => setIsOpen(false), [location.pathname]);
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export * from './src/
|
|
2
|
-
export
|
|
3
|
-
export * from './src/shared/types';
|
|
4
|
-
export type { MdHeading } from './src/server/plugins/markdown/types';
|
|
1
|
+
export * from './src/shared/types/nav';
|
|
2
|
+
export type { MdHeading } from './src/shared/types/markdown';
|
|
@@ -7,10 +7,36 @@ export declare const CUSTOM_MARKDOC_TAGS_PATH = "tags";
|
|
|
7
7
|
export declare const USER_THEME_ALIAS = "@theme";
|
|
8
8
|
export declare const PUBLIC_ASSETS_FOLDER = "/assets";
|
|
9
9
|
export declare const PUBLIC_STATIC_FOLDER = "/static";
|
|
10
|
-
export declare const THEME_ASSETS_FOLDER = "theme-assets";
|
|
11
10
|
export declare const PERMISSION_PROP_NAME = "redocly::permission";
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
11
|
+
export declare const DEFAULT_PLACEHOLDER_PERMISSION = "redocly:default-permission";
|
|
12
|
+
export declare const DIRECTORY_PERMISSIONS_FILE_NAME = "permissions.rbac.yaml";
|
|
13
|
+
export declare const REQUIRED_OIDC_SCOPES: string[];
|
|
14
|
+
export declare const DEFAULT_COOKIE_EXPIRATION: number;
|
|
15
|
+
export declare const DEFAULT_AUTHENTICATED_ROLE = "AuthenticatedUser";
|
|
16
|
+
export declare const DEFAULT_AUTHENTICATED_PERMISSION = "redocly:authenticated-user";
|
|
17
|
+
export declare const SEARCH_LIMIT = 50;
|
|
18
|
+
export declare enum ServerRoutes {
|
|
19
|
+
EJECT_COMPONENT = "/eject-component/:componentName",
|
|
20
|
+
SHARED_PAGE_DATA = "/page-data/shared/*",
|
|
21
|
+
PAGE_DATA = "/page-data/*",
|
|
22
|
+
APP_DATA = "/app-data.json",
|
|
23
|
+
SEARCH_DATA = "/search-data.json",
|
|
24
|
+
SEARCH_INDEX = "/search-index.json",
|
|
25
|
+
AUTHORIZATION = "/authorize",
|
|
26
|
+
OIDC_CALLBACK = "/_auth/oidc",
|
|
27
|
+
SAML_CALLBACK = "/_auth/saml2",
|
|
28
|
+
BASIC_AUTH = "/_auth/basic",
|
|
29
|
+
REDOCLY_CALLBACK = "/_auth/redocly",
|
|
30
|
+
REDOCLY_LOGIN_CALLBACK = "/_auth/redocly/redocly-login",
|
|
31
|
+
SEARCH = "/_search",
|
|
32
|
+
LOGOUT = "/logout",
|
|
33
|
+
LOGIN = "/login",
|
|
34
|
+
IDP_LOGIN = "/_auth/idp-login"
|
|
35
|
+
}
|
|
36
|
+
export declare const DEV_LOGIN_SLUG = "/login/";
|
|
37
|
+
export declare enum ExternalRoutes {
|
|
38
|
+
AUTH0_PASS = "/auth/auth0-pass"
|
|
39
|
+
}
|
|
14
40
|
export declare enum FsErrors {
|
|
15
41
|
NotExist = "ENOENT"
|
|
16
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PERMISSION_PROP_NAME } from '
|
|
2
|
+
import type { PERMISSION_PROP_NAME } from '../constants';
|
|
3
3
|
export declare type ResolvedNavLinkItem = {
|
|
4
4
|
type: 'link';
|
|
5
5
|
link: string;
|
|
@@ -20,6 +20,7 @@ export declare type ResolvedNavGroupItem = {
|
|
|
20
20
|
link?: string;
|
|
21
21
|
label?: string;
|
|
22
22
|
items?: ResolvedNavItem[];
|
|
23
|
+
expanded?: string;
|
|
23
24
|
version?: string;
|
|
24
25
|
isDefault?: boolean;
|
|
25
26
|
versionFolderId?: string;
|
|
@@ -60,17 +61,26 @@ export interface PageProps {
|
|
|
60
61
|
frontmatter?: Omit<PageProps, 'frontmatter'> & {
|
|
61
62
|
settings?: any;
|
|
62
63
|
};
|
|
64
|
+
disableAutoScroll?: boolean;
|
|
65
|
+
lastModified?: string | null;
|
|
63
66
|
[k: string]: any;
|
|
64
67
|
}
|
|
65
68
|
export interface PageStaticData {
|
|
66
69
|
props?: PageProps;
|
|
67
70
|
[k: string]: unknown;
|
|
68
71
|
}
|
|
72
|
+
export declare type UserData = {
|
|
73
|
+
isAuthorized: boolean;
|
|
74
|
+
name: string;
|
|
75
|
+
picture: string;
|
|
76
|
+
logoutDisabled?: boolean;
|
|
77
|
+
};
|
|
69
78
|
export interface PageData {
|
|
70
79
|
templateId: string;
|
|
71
80
|
sharedDataIds: Record<string, string>;
|
|
72
81
|
props: PageProps;
|
|
73
82
|
versions?: Version[];
|
|
83
|
+
userData: UserData;
|
|
74
84
|
}
|
|
75
85
|
export interface CachedPageData extends PageData {
|
|
76
86
|
Template: React.ComponentType<{
|
|
@@ -97,6 +107,7 @@ export declare type NavItem = {
|
|
|
97
107
|
version?: string;
|
|
98
108
|
menuStyle?: MenuStyle;
|
|
99
109
|
external?: boolean;
|
|
110
|
+
expanded?: boolean | 'always';
|
|
100
111
|
};
|
|
101
112
|
export declare type RawNavItem = string | NavItem;
|
|
102
113
|
export interface LogoConfig {
|
package/src/ui/UniversalLink.tsx
CHANGED
|
@@ -52,7 +52,7 @@ export const withPropsFilter =
|
|
|
52
52
|
return <WrappedComponent {...filteredProps} />;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export interface PortalLinkProps<TState> extends LinkProps {
|
|
55
|
+
export interface PortalLinkProps<TState> extends LinkProps<TState> {
|
|
56
56
|
activeClassName?: string;
|
|
57
57
|
activeStyle?: object;
|
|
58
58
|
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
package/ui/UniversalLink.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { LinkProps } from 'react-router-dom';
|
|
3
3
|
export declare const withPropsFilter: (filterList: string[]) => (WrappedComponent: React.FunctionComponent) => (props: React.PropsWithChildren<object>) => JSX.Element;
|
|
4
|
-
export interface PortalLinkProps<TState> extends LinkProps {
|
|
4
|
+
export interface PortalLinkProps<TState> extends LinkProps<TState> {
|
|
5
5
|
activeClassName?: string;
|
|
6
6
|
activeStyle?: object;
|
|
7
7
|
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { PERMISSION_PROP_NAME } from '../../../shared/constants';
|
|
2
|
-
import { MenuStyle } from '../../../shared/types';
|
|
3
|
-
export interface SidebarNavItem {
|
|
4
|
-
label?: string;
|
|
5
|
-
sublabel?: string;
|
|
6
|
-
icon?: string;
|
|
7
|
-
link?: string;
|
|
8
|
-
type?: string;
|
|
9
|
-
httpVerb?: string;
|
|
10
|
-
expanded?: string;
|
|
11
|
-
selectFirstItemOnExpand?: boolean;
|
|
12
|
-
pageId?: string;
|
|
13
|
-
redocPrevLink?: string;
|
|
14
|
-
redocPrevLabel?: string;
|
|
15
|
-
redocNextLink?: string;
|
|
16
|
-
redocNextLabel?: string;
|
|
17
|
-
redocFakePage?: boolean;
|
|
18
|
-
redocInfoPageId?: string;
|
|
19
|
-
target?: string;
|
|
20
|
-
external?: boolean;
|
|
21
|
-
items?: SidebarNavItem[];
|
|
22
|
-
[PERMISSION_PROP_NAME]?: string;
|
|
23
|
-
menuStyle?: MenuStyle;
|
|
24
|
-
separatorLine?: boolean;
|
|
25
|
-
version?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ItemState extends SidebarNavItem {
|
|
28
|
-
items: ItemState[];
|
|
29
|
-
active: boolean;
|
|
30
|
-
hasActiveSubItem: boolean;
|
|
31
|
-
menuStyle?: MenuStyle;
|
|
32
|
-
}
|
|
33
|
-
export declare enum MenuType {
|
|
34
|
-
Separator = "separator",
|
|
35
|
-
DrillDown = "drilldown",
|
|
36
|
-
Group = "group",
|
|
37
|
-
Operation = "operation"
|
|
38
|
-
}
|
|
39
|
-
export interface MenuItemProps {
|
|
40
|
-
item: ItemState;
|
|
41
|
-
activeItem?: ItemState;
|
|
42
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare enum cliCommandNames {
|
|
2
|
-
BUILD = "build",
|
|
3
|
-
DEVELOP = "develop"
|
|
4
|
-
}
|
|
5
|
-
export declare const VERSION_SEPARATOR = "@";
|
|
6
|
-
export declare const DEFAULT_VERSION_NAME = "default";
|
|
7
|
-
export declare const VERSIONED_FOLDER_REGEXP_MATCH: RegExp;
|
|
8
|
-
export declare const PORTAL_CONFIG_FILE_NAME = "portal.yaml";
|
|
9
|
-
export declare const JWT_SECRET_KEY: string;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import * as chokidar from 'chokidar';
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import { PathVersionInfo } from '../plugins/types.js';
|
|
5
|
-
import { VersionsConfig } from './versions-config.js';
|
|
6
|
-
declare type WatchCb = (event: 'add' | 'change' | 'unlink', path: string, stats?: fs.Stats) => Promise<void>;
|
|
7
|
-
export interface ContentRecord {
|
|
8
|
-
content: string;
|
|
9
|
-
contentHash: string;
|
|
10
|
-
relativePath: string;
|
|
11
|
-
parsed?: any;
|
|
12
|
-
}
|
|
13
|
-
export interface ParsedContentRecord<T = unknown> extends ContentRecord {
|
|
14
|
-
parsed: T;
|
|
15
|
-
}
|
|
16
|
-
export interface ContentProvider {
|
|
17
|
-
cwd: string;
|
|
18
|
-
filesList: Set<string>;
|
|
19
|
-
versions: VersionsConfig;
|
|
20
|
-
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
21
|
-
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
22
|
-
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
23
|
-
content: string;
|
|
24
|
-
data: Record<string, any>;
|
|
25
|
-
}>;
|
|
26
|
-
loadContent(relativePath: string, parse: 'yaml' | 'frontmatter' | undefined): ParsedContentRecord;
|
|
27
|
-
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo | undefined;
|
|
28
|
-
has(relativePath: string): boolean;
|
|
29
|
-
}
|
|
30
|
-
export declare class FsContentProvider implements ContentProvider {
|
|
31
|
-
#private;
|
|
32
|
-
cwd: string;
|
|
33
|
-
private initialContentLoaded;
|
|
34
|
-
filesList: Set<string>;
|
|
35
|
-
versions: VersionsConfig;
|
|
36
|
-
constructor(cwd: string, initialCache?: Map<string, ContentRecord>);
|
|
37
|
-
private emit;
|
|
38
|
-
has(relativePath: string): boolean;
|
|
39
|
-
getVersionInfoByFsPath(relativePath: string): PathVersionInfo | undefined;
|
|
40
|
-
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
41
|
-
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
42
|
-
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
43
|
-
content: string;
|
|
44
|
-
data: Record<string, any>;
|
|
45
|
-
}>;
|
|
46
|
-
watch(test: RegExp, cb: WatchCb): void;
|
|
47
|
-
stop(): Promise<void>;
|
|
48
|
-
start(): void;
|
|
49
|
-
ready(): Promise<chokidar.FSWatcher | undefined>;
|
|
50
|
-
}
|
|
51
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Version } from '../../shared/types';
|
|
2
|
-
import { PathVersionInfo } from '../plugins/types';
|
|
3
|
-
import type { ContentProvider } from './content-provider';
|
|
4
|
-
export declare class VersionsConfig {
|
|
5
|
-
contentProvider: ContentProvider;
|
|
6
|
-
private config;
|
|
7
|
-
constructor(contentProvider: ContentProvider);
|
|
8
|
-
private parsePath;
|
|
9
|
-
/**
|
|
10
|
-
* Goes through config and makes sure each folder has a default version set
|
|
11
|
-
* By default, versions are sorted alphabetically and last one becomes default
|
|
12
|
-
*/
|
|
13
|
-
private setDefaultVersions;
|
|
14
|
-
/**
|
|
15
|
-
* Checks for nested versions and files in the root of versioned folder
|
|
16
|
-
* @param allFiles relative paths of all files
|
|
17
|
-
*/
|
|
18
|
-
private validateVersionsStructure;
|
|
19
|
-
/**
|
|
20
|
-
* Read config and store it in the state and mark folder with hasVersionsConfig = true
|
|
21
|
-
* to prevent versions list from being deducted automatically.
|
|
22
|
-
* This means that if file strucutre has 3 versions, but config only specifies 2, the list will only have 2
|
|
23
|
-
* @param versionsFilePath path to versions.yaml
|
|
24
|
-
*/
|
|
25
|
-
private parseVersionsFile;
|
|
26
|
-
/**
|
|
27
|
-
* Reads and validates versions config.
|
|
28
|
-
* TODO: takes ~200-400ms on tests/starter. Consider partial updates instead of rebuilding if this is becoming a bottleneck
|
|
29
|
-
* @param allFilePaths
|
|
30
|
-
*/
|
|
31
|
-
resolveConfig(allFilePaths: Set<string>): void;
|
|
32
|
-
getPageVersions(pagePath: string, suffix?: string): Version[] | undefined;
|
|
33
|
-
getDefaultByPath(path: string): string | null | undefined;
|
|
34
|
-
getVersionInfoByFsPath(path: string): PathVersionInfo | undefined;
|
|
35
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import http from 'http';
|
|
3
|
-
import { MatchFunction } from 'path-to-regexp';
|
|
4
|
-
import { BuildIncremental } from 'esbuild';
|
|
5
|
-
export interface DevServerOptions {
|
|
6
|
-
clientEsbuild: BuildIncremental;
|
|
7
|
-
serverEsbuild: BuildIncremental;
|
|
8
|
-
port?: number;
|
|
9
|
-
}
|
|
10
|
-
export interface EnhancedIncomingMessage extends http.IncomingMessage {
|
|
11
|
-
pathname: string;
|
|
12
|
-
params: Record<string, string>;
|
|
13
|
-
body: string;
|
|
14
|
-
}
|
|
15
|
-
export interface Route {
|
|
16
|
-
matchPath: MatchFunction<EnhancedIncomingMessage['params']>;
|
|
17
|
-
handler(req: EnhancedIncomingMessage, res: http.ServerResponse): void;
|
|
18
|
-
}
|
|
19
|
-
export interface Server {
|
|
20
|
-
httpServer: http.Server;
|
|
21
|
-
addRoute(path: string, handler: Route['handler']): void;
|
|
22
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Config, Node, RenderableTreeNode } from '@markdoc/markdoc/dist/src/types';
|
|
2
|
-
import type { PageStaticData } from '../../../shared/types.js';
|
|
3
|
-
import type { ContentProvider, ContentRecord } from '../../content/content-provider.js';
|
|
4
|
-
import { PluginDefaultOptions } from '../types.js';
|
|
5
|
-
import type { RouteDetails } from '../types.js';
|
|
6
|
-
export interface MdHeading {
|
|
7
|
-
id: string;
|
|
8
|
-
value: string;
|
|
9
|
-
depth: number;
|
|
10
|
-
}
|
|
11
|
-
export declare type RoutesInfoActions = {
|
|
12
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
13
|
-
getRouteBySlug?: (slug: string) => RouteDetails | undefined;
|
|
14
|
-
};
|
|
15
|
-
export interface MdOptions {
|
|
16
|
-
partials: Record<string, Node>;
|
|
17
|
-
variables?: Record<string, any>;
|
|
18
|
-
}
|
|
19
|
-
export declare type MdRenderContext = ContentRecord & PluginDefaultOptions & MdOptions;
|
|
20
|
-
export declare type MdCompilationContext = MdRenderContext & RoutesInfoActions & {
|
|
21
|
-
contentProvider: ContentProvider;
|
|
22
|
-
};
|
|
23
|
-
export declare type MdProcessContext = PluginDefaultOptions & RoutesInfoActions & {
|
|
24
|
-
contentProvider: ContentProvider;
|
|
25
|
-
} & MdOptions;
|
|
26
|
-
export interface MdCompilationResult {
|
|
27
|
-
result: RenderableTreeNode;
|
|
28
|
-
headings: MdHeading[];
|
|
29
|
-
}
|
|
30
|
-
export interface ExtendedMarkdocConfig extends Config {
|
|
31
|
-
currentProcessedPage?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface MdPageStaticData extends PageStaticData {
|
|
34
|
-
ast: string;
|
|
35
|
-
frontmatter: Record<string, unknown>;
|
|
36
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ResolvedConfigLinks } from '../../../shared/types.js';
|
|
2
|
-
import { AuthConfig, PortalConfig, RawTheme } from '../../../shared/models/config.js';
|
|
3
|
-
import { Redirect } from '../types';
|
|
4
|
-
export interface GlobalData {
|
|
5
|
-
nav?: ResolvedConfigLinks;
|
|
6
|
-
logo?: PortalConfig['logo'];
|
|
7
|
-
footer?: ResolvedConfigLinks;
|
|
8
|
-
themeSettings?: PortalConfig['themes'];
|
|
9
|
-
}
|
|
10
|
-
export interface GlobalConfig {
|
|
11
|
-
themes: RawTheme[];
|
|
12
|
-
scripts?: string;
|
|
13
|
-
stylesheets?: string;
|
|
14
|
-
redirects: Record<string, Redirect>;
|
|
15
|
-
fileName: string;
|
|
16
|
-
rbac: RbacConfig;
|
|
17
|
-
[k: string]: unknown;
|
|
18
|
-
}
|
|
19
|
-
export declare type RbacConfig = {
|
|
20
|
-
roles: Record<string, string[]>;
|
|
21
|
-
auth?: AuthConfig;
|
|
22
|
-
};
|
|
23
|
-
export declare type CustomEntryPropertyType = Record<string, string | boolean>;
|
|
24
|
-
export declare type ScriptOrStylesheetConfig = string | CustomEntryPropertyType;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Pagination as PaginationType, IMenuItem, OpenAPIDefinition as IOpenAPIDefinition, MenuItemType } from '@redocly/reference-docs';
|
|
2
|
-
import { RedocProRawOptions } from '@redocly/reference-docs';
|
|
3
|
-
import type { ResolvedNavItem } from '../../../shared/types.js';
|
|
4
|
-
import type { ParsedContentRecord } from '../../content/content-provider.js';
|
|
5
|
-
export interface IMenuItemExtended extends IMenuItem {
|
|
6
|
-
httpVerb?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function loadDefinition(content: ParsedContentRecord): Promise<IOpenAPIDefinition | undefined>;
|
|
9
|
-
export declare function convertRedocToSidebar(data: {
|
|
10
|
-
redocItems: IMenuItemExtended[];
|
|
11
|
-
sidebarItems: ResolvedNavItem[];
|
|
12
|
-
parentId?: string;
|
|
13
|
-
routeSlug: string;
|
|
14
|
-
pagination: PaginationType;
|
|
15
|
-
}): void;
|
|
16
|
-
export declare const shouldAddPage: ({ pagination, type, }: {
|
|
17
|
-
pagination: PaginationType;
|
|
18
|
-
type: MenuItemType;
|
|
19
|
-
}) => boolean;
|
|
20
|
-
export declare const removeMarkdownLinks: (text: string) => string;
|
|
21
|
-
export declare function getConfigByPath(apis: {
|
|
22
|
-
[x: string]: {
|
|
23
|
-
root: string;
|
|
24
|
-
'features.openapi': RedocProRawOptions;
|
|
25
|
-
};
|
|
26
|
-
} | undefined, path: string): RedocProRawOptions;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { PageProps, PageStaticData, ResolvedNavItem, Version } from '../../shared/types.js';
|
|
2
|
-
import type { ContentProvider } from '../content/content-provider.js';
|
|
3
|
-
import { SearchData, SearchDocument } from '../../shared/models';
|
|
4
|
-
import { PERMISSION_PROP_NAME } from '@shared/constants.js';
|
|
5
|
-
import { Store } from '../store.js';
|
|
6
|
-
import type { GlobalData, GlobalConfig } from './portal-config/types.js';
|
|
7
|
-
import { MdOptions } from './markdown/types.js';
|
|
8
|
-
export declare type GetStaticDataContext = {
|
|
9
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
10
|
-
getRouteBySlug: (relativePath: string) => RouteDetails | undefined;
|
|
11
|
-
getGlobalConfig<T = unknown>(key: string): T | undefined;
|
|
12
|
-
getAllRoutes: () => RouteDetails[];
|
|
13
|
-
contentDir: string;
|
|
14
|
-
outdir: string;
|
|
15
|
-
};
|
|
16
|
-
export declare type RbacContext = {
|
|
17
|
-
roles: string[];
|
|
18
|
-
permissions: string[];
|
|
19
|
-
};
|
|
20
|
-
export declare type GetStaticDataFn<TData extends PageStaticData = PageStaticData, TProps extends PageProps = PageProps> = (route: RouteDetails<TData, TProps>, contentProvider: ContentProvider, context: GetStaticDataContext) => Promise<TData>;
|
|
21
|
-
export declare type GetServerPropsContext = {
|
|
22
|
-
getGlobalConfig<T = unknown>(key: string): T | undefined;
|
|
23
|
-
getRbacPermissionsByRole: Store['getRbacPermissionsByRole'];
|
|
24
|
-
};
|
|
25
|
-
export declare type GetServerPropsFn<TData extends PageStaticData = PageStaticData, TProps extends PageProps = PageProps> = (route: RouteDetails<TData, TProps>, data: TData, mdOptions: MdOptions) => Promise<TProps>;
|
|
26
|
-
export interface RouteDetails<TData extends PageStaticData = PageStaticData, TProps extends PageProps = PageProps> {
|
|
27
|
-
slug: string;
|
|
28
|
-
fsPath: string;
|
|
29
|
-
templateId: string;
|
|
30
|
-
[PERMISSION_PROP_NAME]?: string;
|
|
31
|
-
versions?: Version[];
|
|
32
|
-
getNavText?: () => Promise<string>;
|
|
33
|
-
getSidebar?(): ResolvedNavItem[];
|
|
34
|
-
getSearchDocuments?(): Promise<SearchDocument[]>;
|
|
35
|
-
getStaticData?: GetStaticDataFn<TData, TProps>;
|
|
36
|
-
serverPropsGetterIds?: string[];
|
|
37
|
-
}
|
|
38
|
-
export interface Redirect {
|
|
39
|
-
to: string;
|
|
40
|
-
type: number;
|
|
41
|
-
}
|
|
42
|
-
export interface PathVersionInfo {
|
|
43
|
-
version: string;
|
|
44
|
-
isDefault: boolean;
|
|
45
|
-
versionFolderId: string;
|
|
46
|
-
}
|
|
47
|
-
export interface ProcessContentActions {
|
|
48
|
-
createSharedData(id: string, data: unknown): string;
|
|
49
|
-
addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
|
|
50
|
-
setGlobalConfig: (data: Partial<GlobalConfig>) => void;
|
|
51
|
-
addRoute: (route: RouteDetails) => void;
|
|
52
|
-
createTemplate: (id: string, importPath: string) => string;
|
|
53
|
-
registerServerPropsGetter: (id: string, importPath: string) => string;
|
|
54
|
-
}
|
|
55
|
-
export interface AfterRoutesCreatedActions {
|
|
56
|
-
createSharedData(id: string, data: unknown): string;
|
|
57
|
-
addRouteSharedData(routeSlug: string, dataKey: string, dataId: string): void;
|
|
58
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
59
|
-
getRouteBySlug: (relativePath: string) => RouteDetails | undefined;
|
|
60
|
-
getAllRoutes: () => RouteDetails[];
|
|
61
|
-
setGlobalData: (data: GlobalData) => void;
|
|
62
|
-
setGlobalConfig: (data: Partial<GlobalConfig>) => void;
|
|
63
|
-
setSearchData: (data: SearchData) => void;
|
|
64
|
-
addRedirect: (from: string, to: Redirect) => void;
|
|
65
|
-
contentDir: string;
|
|
66
|
-
outdir: string;
|
|
67
|
-
}
|
|
68
|
-
export interface PluginInstance {
|
|
69
|
-
watch?: RegExp;
|
|
70
|
-
processContent?: (content: ContentProvider, actions: ProcessContentActions) => Promise<void>;
|
|
71
|
-
afterRoutesCreated?: (content: ContentProvider, actions: AfterRoutesCreatedActions) => Promise<void>;
|
|
72
|
-
}
|
|
73
|
-
export interface PluginDefaultOptions {
|
|
74
|
-
contentDir: string;
|
|
75
|
-
outdir: string;
|
|
76
|
-
}
|
|
77
|
-
export interface PluginOptions extends PluginDefaultOptions {
|
|
78
|
-
[k: string]: unknown;
|
|
79
|
-
}
|
|
80
|
-
export declare type Plugin = (opts: PluginOptions) => PluginInstance;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'esbuild';
|
|
2
|
-
import { JSONIndex, SearchDocument, SearchData } from '../shared/models';
|
|
3
|
-
import type { PageStaticData } from '../shared/types.js';
|
|
4
|
-
import type { RouteDetails, Redirect } from './plugins/types.js';
|
|
5
|
-
import type { GlobalData, GlobalConfig } from './plugins/portal-config/types';
|
|
6
|
-
import type { ContentProvider } from './content/content-provider';
|
|
7
|
-
export declare class Store {
|
|
8
|
-
contentDir: string;
|
|
9
|
-
outdir: string;
|
|
10
|
-
renderMode: 'thread_worker' | 'main';
|
|
11
|
-
routesBySlug: Map<string, RouteDetails>;
|
|
12
|
-
routesByFsPath: Map<string, RouteDetails>;
|
|
13
|
-
routesSharedData: Map<string, Record<string, string>>;
|
|
14
|
-
searchDocuments: SearchDocument[];
|
|
15
|
-
searchIndex: JSONIndex;
|
|
16
|
-
sharedData: Map<string, unknown>;
|
|
17
|
-
routesStaticDataCache: Map<string, PageStaticData>;
|
|
18
|
-
templates: Map<string, string>;
|
|
19
|
-
serverPropsGetters: Map<string, string>;
|
|
20
|
-
esbuildPlugins: Plugin[];
|
|
21
|
-
listeners: Map<string, Set<Function>>;
|
|
22
|
-
globalData: GlobalData;
|
|
23
|
-
cliOptions: Record<string, string>;
|
|
24
|
-
globalConfig: GlobalConfig;
|
|
25
|
-
constructor(contentDir: string, outdir?: string, renderMode?: 'thread_worker' | 'main');
|
|
26
|
-
on(type: 'routes-updated', cb: () => void): void;
|
|
27
|
-
on(type: 'template-updated', cb: () => void): void;
|
|
28
|
-
on(type: 'build-updated', cb: () => void): void;
|
|
29
|
-
on(type: 'shared-data-updated', cb: (id: string, data: unknown) => void): void;
|
|
30
|
-
on(type: 'search-data-updated', cb: (data: SearchData) => void): void;
|
|
31
|
-
on(type: 'global-data-updated', cb: (pathname: string, data: Record<string, unknown>) => void): void;
|
|
32
|
-
runListeners<T extends Array<unknown>>(type: 'template-updated' | 'global-data-updated' | 'shared-data-updated' | 'search-data-updated' | 'routes-updated' | 'build-updated', ...args: T): void;
|
|
33
|
-
addEsbuildPlugin(plugin: Plugin): void;
|
|
34
|
-
setGlobalData: (data: GlobalData) => void;
|
|
35
|
-
setSearchData(data: SearchData): void;
|
|
36
|
-
setCliOptions(data: Record<string, string>): void;
|
|
37
|
-
setGlobalConfig(data: Partial<GlobalConfig>): void;
|
|
38
|
-
getRbacPermissionsByRole(role: string): string[] | undefined;
|
|
39
|
-
getGlobalConfig<T = unknown>(key: string): T;
|
|
40
|
-
addRedirect(from: string, to: Redirect): void;
|
|
41
|
-
createSharedData: (id: string, data: unknown) => string;
|
|
42
|
-
addRouteSharedData: (routeSlug: string, dataKey: string, dataId: string) => void;
|
|
43
|
-
addRoute: (route: RouteDetails) => void;
|
|
44
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails<PageStaticData, import("../shared/types.js").PageProps> | undefined;
|
|
45
|
-
getRouteBySlug: (slug: string) => RouteDetails<PageStaticData, import("../shared/types.js").PageProps> | undefined;
|
|
46
|
-
getAllRoutes: () => RouteDetails<PageStaticData, import("../shared/types.js").PageProps>[];
|
|
47
|
-
getTemplate: (id: string) => string | undefined;
|
|
48
|
-
createTemplate: (id: string, importPath: string) => string;
|
|
49
|
-
registerServerPropsGetter: (id: string, importPath: string) => string;
|
|
50
|
-
resolveRouteStaticData(route: RouteDetails, contentProvider: ContentProvider): Promise<{}>;
|
|
51
|
-
clear: () => void;
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function promiseMapLimit<T, P>(array: T[], poolLimit: number, iteratorFn: (arg: T, array: T[]) => Promise<P>): Promise<P[]>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function readFileAsStringSync(filePath: string): string | null | undefined;
|
|
2
|
-
export declare function readFileNames(dir: string): string[];
|
|
3
|
-
export declare function copyStaticFile(absolutePath: string, outdir: string): string | undefined;
|
|
4
|
-
export declare function copyFolderRecursiveSync(source: string, target: string): void;
|
|
5
|
-
export declare function ensureDir(path: string): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { OpenAPIDefinition } from '@redocly/reference-docs';
|
|
2
|
-
import type { ContentProvider } from '../content/content-provider.js';
|
|
3
|
-
import { Route } from '../dev-server/types';
|
|
4
|
-
export declare function getDataFromRelativePath(relativePath: string): {
|
|
5
|
-
pathVersion: string | null;
|
|
6
|
-
basePath: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function generatePagePathname(currentVersion?: string | null, defaultVersion?: string | null, ...combineParts: string[]): string;
|
|
9
|
-
export declare function slugFromRelativePath(relativePath: string, contentProvider: ContentProvider): string;
|
|
10
|
-
export declare function slug(str: string): string;
|
|
11
|
-
export declare function fromCurrentDir(moduleUrl: string, path: string): string;
|
|
12
|
-
export declare function excludeVersion<T extends string[] | string>(arg: T): {
|
|
13
|
-
version?: string;
|
|
14
|
-
data: T;
|
|
15
|
-
};
|
|
16
|
-
export declare function getParamsFromPath(path: string, route: Route): Record<string, string>;
|
|
17
|
-
export declare function getDefinitionFiles(contentProvider: ContentProvider): Promise<Map<string, OpenAPIDefinition>>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Store } from '../store';
|
|
2
|
-
import { PERMISSION_PROP_NAME } from '../../shared/constants.js';
|
|
3
|
-
export declare function canAccessResource<T extends {
|
|
4
|
-
[PERMISSION_PROP_NAME]?: string;
|
|
5
|
-
}>(resource: T, permissions: Set<string>): boolean;
|
|
6
|
-
export declare function getPermissionsForRoles(store: Pick<Store, 'getRbacPermissionsByRole'>, roles: string[]): Set<string>;
|
|
7
|
-
export declare function getUserRolesFromCookies(cookies?: string): string[];
|
|
8
|
-
/**
|
|
9
|
-
* Maps the input deep and removes objects that have a 'permission' prop
|
|
10
|
-
* but do not match the input permissions list
|
|
11
|
-
* @param input can be object, array, string or any other value
|
|
12
|
-
* @param permissions
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export declare function filterDataByAccessDeep(input: any, permissions: Set<string>): any;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Reporter } from './reporter';
|
|
2
|
-
declare const formatter: {
|
|
3
|
-
success(message: string, ...args: any[]): string;
|
|
4
|
-
info(message: string, ...args: any[]): string;
|
|
5
|
-
warn(message: string, ...args: any[]): string;
|
|
6
|
-
error(message: string, ...args: any[]): string;
|
|
7
|
-
verbose(message: string, ...args: any[]): string;
|
|
8
|
-
formatMs(ms: number): string;
|
|
9
|
-
withTime(message: string, reporter: Reporter): string;
|
|
10
|
-
format(pattern: string, ...args: any[]): string;
|
|
11
|
-
};
|
|
12
|
-
export default formatter;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const reporter: {
|
|
2
|
-
now(): number;
|
|
3
|
-
startTiming(): void;
|
|
4
|
-
getTimeSpan(): number | undefined;
|
|
5
|
-
success(message: string, ...args: any[]): void;
|
|
6
|
-
successTime(message: string, ...args: any[]): void;
|
|
7
|
-
info(message: string, ...args: any[]): void;
|
|
8
|
-
infoTime(message: string, ...args: any[]): void;
|
|
9
|
-
warn(message: string, ...args: any[]): void;
|
|
10
|
-
warnTime(message: string, ...args: any[]): void;
|
|
11
|
-
error(message: string, ...args: any[]): void;
|
|
12
|
-
verbose(message: string, ...args: any[]): void;
|
|
13
|
-
verboseTime(message: string, ...args: any[]): void;
|
|
14
|
-
panic(message: string, ...args: any[]): never;
|
|
15
|
-
panicOnBuild(message: string, ...args: any[]): void;
|
|
16
|
-
flushErrors(): void;
|
|
17
|
-
};
|
|
18
|
-
export declare type Reporter = typeof reporter;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function parseYaml<T = unknown>(raw: string): T;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { RawNavItem, LogoConfig } from '../types';
|
|
2
|
-
declare type RawNavConfig = RawNavItem[] | Record<string, RawNavItem[] | {
|
|
3
|
-
items: RawNavItem[];
|
|
4
|
-
} | string>;
|
|
5
|
-
export declare type AuthProviderConfig = {
|
|
6
|
-
type: string;
|
|
7
|
-
configurationUrl: string;
|
|
8
|
-
clientId: string;
|
|
9
|
-
clientSecret: string;
|
|
10
|
-
rolesClaimName: string;
|
|
11
|
-
scopes?: Array<string>;
|
|
12
|
-
};
|
|
13
|
-
export declare type AuthIdpsConfig = {
|
|
14
|
-
main: AuthProviderConfig;
|
|
15
|
-
};
|
|
16
|
-
export declare type AuthConfig = {
|
|
17
|
-
idps: AuthIdpsConfig;
|
|
18
|
-
};
|
|
19
|
-
export interface PortalConfig extends Record<string, any> {
|
|
20
|
-
nav?: RawNavConfig;
|
|
21
|
-
logo?: LogoConfig;
|
|
22
|
-
themes?: RawTheme[];
|
|
23
|
-
footer?: RawNavConfig;
|
|
24
|
-
auth?: AuthConfig;
|
|
25
|
-
frontmatterKeysToResolve?: string[];
|
|
26
|
-
}
|
|
27
|
-
export interface RawTheme {
|
|
28
|
-
name: string;
|
|
29
|
-
settings?: any;
|
|
30
|
-
}
|
|
31
|
-
export interface ResolvedTheme extends RawTheme {
|
|
32
|
-
stylesFile?: string;
|
|
33
|
-
path: string;
|
|
34
|
-
markdoc: {
|
|
35
|
-
nodesFiles: string[];
|
|
36
|
-
tagsFiles: string[];
|
|
37
|
-
componentsFile?: string;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { OperationParameter } from './operation-parameter';
|
|
2
|
-
export interface SearchDocument {
|
|
3
|
-
id: string;
|
|
4
|
-
url: string;
|
|
5
|
-
title: string | string[];
|
|
6
|
-
text: string | string[];
|
|
7
|
-
path?: string[];
|
|
8
|
-
httpVerb?: string;
|
|
9
|
-
pathName?: string | string[];
|
|
10
|
-
parameters?: OperationParameter[];
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function getPageDataUrl(normalizedRoute: string): string;
|
|
2
|
-
export declare function getClientPageDataUrl(normalizedRoute: string): string;
|
|
3
|
-
export declare function getSharedDataUrl(id: string): string;
|
|
4
|
-
export declare const GLOBAL_DATA_URL = "/app-data.json";
|
|
5
|
-
export declare const SEARCH_DATA_URL = "/search-data.json";
|
|
6
|
-
export declare const SEARCH_INDEX_URL = "/search-index.json";
|
|
7
|
-
export declare const EJECT_COMPONENT_URL = "/eject-component";
|
|
8
|
-
export declare function combineUrls(baseURL: string, ...relativeURLs: string[]): string;
|
|
9
|
-
export declare function withPathPrefix(url: string): string;
|
|
10
|
-
export declare function withoutHash(url: string): string;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import picomatch from 'picomatch';
|
|
2
|
-
import type { Tag, Node } from '@markdoc/markdoc';
|
|
3
|
-
export declare const isLocalLink: (path: string | null | undefined) => boolean;
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @returns url with leading and without trailing slash or empty string, e.g. '/prefix'
|
|
7
|
-
*/
|
|
8
|
-
export declare function getPathPrefix(): string;
|
|
9
|
-
export declare function normalizePathPrefix(prefix: string): string;
|
|
10
|
-
export declare function addLeadingSlash(url: string): string;
|
|
11
|
-
export declare function removeTrailingSlash(url: string): string;
|
|
12
|
-
export declare type Glob = picomatch.Glob;
|
|
13
|
-
export declare function getGlobMatcher(glob: Glob, options?: {}): (file: string) => boolean;
|
|
14
|
-
export declare function isTag(value?: any): value is Tag;
|
|
15
|
-
export declare function isNode(value?: any): value is Node;
|
|
16
|
-
export declare const getCssPropertyValue: (name: string) => string;
|
|
17
|
-
export declare function normalizeRoute(route: string): string;
|
|
18
|
-
export declare function isPrimitive(arg: any): arg is string | boolean | number;
|