@redocly/theme 0.6.1 → 0.6.2-beta.3
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/README.md +1 -1
- package/lib/Sidebar/ArrowBack.js +2 -2
- package/lib/Sidebar/SidebarLayout.d.ts +5 -1
- package/lib/Sidebar/SidebarLayout.js +26 -1
- package/lib/Sidebar/types/NavItem.d.ts +1 -1
- package/lib/config.d.ts +275 -11
- package/lib/config.js +39 -7
- package/lib/globalStyle.js +1 -1
- package/package.json +1 -1
- package/src/Sidebar/ArrowBack.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +38 -1
- package/src/Sidebar/types/NavItem.ts +1 -1
- package/src/config.ts +48 -12
- package/src/globalStyle.ts +1 -1
- package/src/types/portal/src/shared/types/nav.d.ts +1 -2
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
For more details, contact team@redocly.com
|
|
1
|
+
For more details, contact team@redocly.com.
|
package/lib/Sidebar/ArrowBack.js
CHANGED
|
@@ -7,12 +7,12 @@ exports.ArrowBack = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Arrow = ({ className }) => (react_1.default.createElement("span", { "data-component-name": "Sidebar/ArrowBack" },
|
|
10
|
-
react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 10", width: "
|
|
10
|
+
react_1.default.createElement("svg", { fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 12 10", width: "10px", height: "10px", className: className },
|
|
11
11
|
react_1.default.createElement("path", { d: "M2.414 5l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L2.414 5z" }),
|
|
12
12
|
react_1.default.createElement("path", { d: "M2 5a1 1 0 011-1h8a1 1 0 110 2H3a1 1 0 01-1-1z" }))));
|
|
13
13
|
exports.ArrowBack = (0, styled_components_1.default)(Arrow) `
|
|
14
14
|
fill: var(--sidebar-back-button-icon-color);
|
|
15
|
-
margin-right: calc(var(--sidebar-spacing-unit)
|
|
15
|
+
margin-right: calc(var(--sidebar-spacing-unit));
|
|
16
16
|
|
|
17
17
|
background-image: var(--sidebar-back-button-icon);
|
|
18
18
|
background-repeat: no-repeat;
|
|
@@ -2,6 +2,10 @@ import React from 'react';
|
|
|
2
2
|
interface SidebarLayoutProps {
|
|
3
3
|
versions: React.ReactNode;
|
|
4
4
|
menu: React.ReactNode;
|
|
5
|
+
backLink?: {
|
|
6
|
+
label: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
};
|
|
5
9
|
}
|
|
6
|
-
export declare function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element | null;
|
|
10
|
+
export declare function SidebarLayout({ versions, menu, backLink, }: SidebarLayoutProps): JSX.Element | null;
|
|
7
11
|
export {};
|
|
@@ -12,7 +12,9 @@ const MobileSidebarButton_1 = require("../Sidebar/MobileSidebarButton");
|
|
|
12
12
|
const MenuContainer_1 = require("../Sidebar/MenuContainer");
|
|
13
13
|
const SidebarSearch_1 = require("../Search/SidebarSearch");
|
|
14
14
|
const useThemeConfig_1 = require("../hooks/useThemeConfig");
|
|
15
|
-
|
|
15
|
+
const ArrowBack_1 = require("../Sidebar/ArrowBack");
|
|
16
|
+
const Link_1 = require("../mocks/Link");
|
|
17
|
+
function SidebarLayout({ versions, menu, backLink, }) {
|
|
16
18
|
const [isOpen, setIsOpen] = (0, useMobileMenu_1.useMobileMenu)();
|
|
17
19
|
const toggleMenu = () => setIsOpen(!isOpen);
|
|
18
20
|
const { search, sidebar } = (0, useThemeConfig_1.useThemeConfig)();
|
|
@@ -23,9 +25,32 @@ function SidebarLayout({ versions, menu }) {
|
|
|
23
25
|
react_1.default.createElement(MobileSidebarButton_1.MobileSidebarButton, { opened: isOpen, onClick: toggleMenu }),
|
|
24
26
|
!(search === null || search === void 0 ? void 0 : search.hide) && (search === null || search === void 0 ? void 0 : search.placement) === 'sidebar' ? react_1.default.createElement(SidebarSearch_1.SidebarSearch, null) : null,
|
|
25
27
|
react_1.default.createElement(Sidebar_1.Sidebar, { animate: true, opened: isOpen },
|
|
28
|
+
(backLink && (react_1.default.createElement(BackLinkWrapper, null,
|
|
29
|
+
react_1.default.createElement(Link_1.Link, { to: backLink.slug },
|
|
30
|
+
react_1.default.createElement(ArrowBack_1.ArrowBack, null),
|
|
31
|
+
"Back to ",
|
|
32
|
+
backLink.label)))) ||
|
|
33
|
+
null,
|
|
26
34
|
versions,
|
|
27
35
|
react_1.default.createElement(MenuContainer_1.MenuContainer, null, menu))));
|
|
28
36
|
}
|
|
29
37
|
exports.SidebarLayout = SidebarLayout;
|
|
38
|
+
const BackLinkWrapper = styled_components_1.default.div `
|
|
39
|
+
padding: var(--sidebar-offset-top) var(--sidebar-item-padding-horizontal)
|
|
40
|
+
var(--sidebar-item-padding-horizontal)
|
|
41
|
+
calc(var(--sidebar-offset-left) + var(--sidebar-item-padding-horizontal));
|
|
42
|
+
|
|
43
|
+
a {
|
|
44
|
+
color: var(--sidebar-back-button-text-color);
|
|
45
|
+
font-size: var(--sidebar-back-button-font-size);
|
|
46
|
+
font-family: var(--sidebar-back-button-font-family);
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
&:hover {
|
|
49
|
+
color: var(--sidebar-back-button-hover-text-color);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
border-bottom: 1px solid var(--sidebar-border-color);
|
|
54
|
+
`;
|
|
30
55
|
const Wrapper = styled_components_1.default.div ``;
|
|
31
56
|
//# sourceMappingURL=SidebarLayout.js.map
|
package/lib/config.d.ts
CHANGED
|
@@ -49,9 +49,185 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
49
49
|
}, {
|
|
50
50
|
hide?: boolean | undefined;
|
|
51
51
|
}>>;
|
|
52
|
-
scripts: z.ZodOptional<z.
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
scripts: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
head: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
src: z.ZodString;
|
|
55
|
+
async: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
crossorigin: z.ZodOptional<z.ZodString>;
|
|
57
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
fetchpriority: z.ZodOptional<z.ZodString>;
|
|
59
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
60
|
+
module: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
nomodule: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
63
|
+
referrerpolicy: z.ZodOptional<z.ZodString>;
|
|
64
|
+
type: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "passthrough", z.ZodTypeAny, {
|
|
66
|
+
async?: boolean | undefined;
|
|
67
|
+
type?: string | undefined;
|
|
68
|
+
crossorigin?: string | undefined;
|
|
69
|
+
defer?: boolean | undefined;
|
|
70
|
+
fetchpriority?: string | undefined;
|
|
71
|
+
integrity?: string | undefined;
|
|
72
|
+
module?: boolean | undefined;
|
|
73
|
+
nomodule?: boolean | undefined;
|
|
74
|
+
nonce?: string | undefined;
|
|
75
|
+
referrerpolicy?: string | undefined;
|
|
76
|
+
src: string;
|
|
77
|
+
}, {
|
|
78
|
+
async?: boolean | undefined;
|
|
79
|
+
type?: string | undefined;
|
|
80
|
+
crossorigin?: string | undefined;
|
|
81
|
+
defer?: boolean | undefined;
|
|
82
|
+
fetchpriority?: string | undefined;
|
|
83
|
+
integrity?: string | undefined;
|
|
84
|
+
module?: boolean | undefined;
|
|
85
|
+
nomodule?: boolean | undefined;
|
|
86
|
+
nonce?: string | undefined;
|
|
87
|
+
referrerpolicy?: string | undefined;
|
|
88
|
+
src: string;
|
|
89
|
+
}>, "many">>;
|
|
90
|
+
body: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
|
+
src: z.ZodString;
|
|
92
|
+
async: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
crossorigin: z.ZodOptional<z.ZodString>;
|
|
94
|
+
defer: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
fetchpriority: z.ZodOptional<z.ZodString>;
|
|
96
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
97
|
+
module: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
nomodule: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
100
|
+
referrerpolicy: z.ZodOptional<z.ZodString>;
|
|
101
|
+
type: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, "passthrough", z.ZodTypeAny, {
|
|
103
|
+
async?: boolean | undefined;
|
|
104
|
+
type?: string | undefined;
|
|
105
|
+
crossorigin?: string | undefined;
|
|
106
|
+
defer?: boolean | undefined;
|
|
107
|
+
fetchpriority?: string | undefined;
|
|
108
|
+
integrity?: string | undefined;
|
|
109
|
+
module?: boolean | undefined;
|
|
110
|
+
nomodule?: boolean | undefined;
|
|
111
|
+
nonce?: string | undefined;
|
|
112
|
+
referrerpolicy?: string | undefined;
|
|
113
|
+
src: string;
|
|
114
|
+
}, {
|
|
115
|
+
async?: boolean | undefined;
|
|
116
|
+
type?: string | undefined;
|
|
117
|
+
crossorigin?: string | undefined;
|
|
118
|
+
defer?: boolean | undefined;
|
|
119
|
+
fetchpriority?: string | undefined;
|
|
120
|
+
integrity?: string | undefined;
|
|
121
|
+
module?: boolean | undefined;
|
|
122
|
+
nomodule?: boolean | undefined;
|
|
123
|
+
nonce?: string | undefined;
|
|
124
|
+
referrerpolicy?: string | undefined;
|
|
125
|
+
src: string;
|
|
126
|
+
}>, "many">>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
head?: {
|
|
129
|
+
async?: boolean | undefined;
|
|
130
|
+
type?: string | undefined;
|
|
131
|
+
crossorigin?: string | undefined;
|
|
132
|
+
defer?: boolean | undefined;
|
|
133
|
+
fetchpriority?: string | undefined;
|
|
134
|
+
integrity?: string | undefined;
|
|
135
|
+
module?: boolean | undefined;
|
|
136
|
+
nomodule?: boolean | undefined;
|
|
137
|
+
nonce?: string | undefined;
|
|
138
|
+
referrerpolicy?: string | undefined;
|
|
139
|
+
src: string;
|
|
140
|
+
}[] | undefined;
|
|
141
|
+
body?: {
|
|
142
|
+
async?: boolean | undefined;
|
|
143
|
+
type?: string | undefined;
|
|
144
|
+
crossorigin?: string | undefined;
|
|
145
|
+
defer?: boolean | undefined;
|
|
146
|
+
fetchpriority?: string | undefined;
|
|
147
|
+
integrity?: string | undefined;
|
|
148
|
+
module?: boolean | undefined;
|
|
149
|
+
nomodule?: boolean | undefined;
|
|
150
|
+
nonce?: string | undefined;
|
|
151
|
+
referrerpolicy?: string | undefined;
|
|
152
|
+
src: string;
|
|
153
|
+
}[] | undefined;
|
|
154
|
+
}, {
|
|
155
|
+
head?: {
|
|
156
|
+
async?: boolean | undefined;
|
|
157
|
+
type?: string | undefined;
|
|
158
|
+
crossorigin?: string | undefined;
|
|
159
|
+
defer?: boolean | undefined;
|
|
160
|
+
fetchpriority?: string | undefined;
|
|
161
|
+
integrity?: string | undefined;
|
|
162
|
+
module?: boolean | undefined;
|
|
163
|
+
nomodule?: boolean | undefined;
|
|
164
|
+
nonce?: string | undefined;
|
|
165
|
+
referrerpolicy?: string | undefined;
|
|
166
|
+
src: string;
|
|
167
|
+
}[] | undefined;
|
|
168
|
+
body?: {
|
|
169
|
+
async?: boolean | undefined;
|
|
170
|
+
type?: string | undefined;
|
|
171
|
+
crossorigin?: string | undefined;
|
|
172
|
+
defer?: boolean | undefined;
|
|
173
|
+
fetchpriority?: string | undefined;
|
|
174
|
+
integrity?: string | undefined;
|
|
175
|
+
module?: boolean | undefined;
|
|
176
|
+
nomodule?: boolean | undefined;
|
|
177
|
+
nonce?: string | undefined;
|
|
178
|
+
referrerpolicy?: string | undefined;
|
|
179
|
+
src: string;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
}>>;
|
|
182
|
+
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
183
|
+
href: z.ZodString;
|
|
184
|
+
as: z.ZodOptional<z.ZodString>;
|
|
185
|
+
crossorigin: z.ZodOptional<z.ZodString>;
|
|
186
|
+
fetchpriority: z.ZodOptional<z.ZodString>;
|
|
187
|
+
hreflang: z.ZodOptional<z.ZodString>;
|
|
188
|
+
imagesizes: z.ZodOptional<z.ZodString>;
|
|
189
|
+
imagesrcset: z.ZodOptional<z.ZodString>;
|
|
190
|
+
integrity: z.ZodOptional<z.ZodString>;
|
|
191
|
+
media: z.ZodOptional<z.ZodString>;
|
|
192
|
+
prefetch: z.ZodOptional<z.ZodString>;
|
|
193
|
+
referrerpolicy: z.ZodOptional<z.ZodString>;
|
|
194
|
+
rel: z.ZodOptional<z.ZodString>;
|
|
195
|
+
sizes: z.ZodOptional<z.ZodString>;
|
|
196
|
+
title: z.ZodOptional<z.ZodString>;
|
|
197
|
+
type: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, "passthrough", z.ZodTypeAny, {
|
|
199
|
+
type?: string | undefined;
|
|
200
|
+
crossorigin?: string | undefined;
|
|
201
|
+
fetchpriority?: string | undefined;
|
|
202
|
+
integrity?: string | undefined;
|
|
203
|
+
referrerpolicy?: string | undefined;
|
|
204
|
+
as?: string | undefined;
|
|
205
|
+
hreflang?: string | undefined;
|
|
206
|
+
imagesizes?: string | undefined;
|
|
207
|
+
imagesrcset?: string | undefined;
|
|
208
|
+
media?: string | undefined;
|
|
209
|
+
prefetch?: string | undefined;
|
|
210
|
+
rel?: string | undefined;
|
|
211
|
+
sizes?: string | undefined;
|
|
212
|
+
title?: string | undefined;
|
|
213
|
+
href: string;
|
|
214
|
+
}, {
|
|
215
|
+
type?: string | undefined;
|
|
216
|
+
crossorigin?: string | undefined;
|
|
217
|
+
fetchpriority?: string | undefined;
|
|
218
|
+
integrity?: string | undefined;
|
|
219
|
+
referrerpolicy?: string | undefined;
|
|
220
|
+
as?: string | undefined;
|
|
221
|
+
hreflang?: string | undefined;
|
|
222
|
+
imagesizes?: string | undefined;
|
|
223
|
+
imagesrcset?: string | undefined;
|
|
224
|
+
media?: string | undefined;
|
|
225
|
+
prefetch?: string | undefined;
|
|
226
|
+
rel?: string | undefined;
|
|
227
|
+
sizes?: string | undefined;
|
|
228
|
+
title?: string | undefined;
|
|
229
|
+
href: string;
|
|
230
|
+
}>, "many">>;
|
|
55
231
|
search: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
|
|
56
232
|
placement: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
57
233
|
}, {
|
|
@@ -259,9 +435,51 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
259
435
|
sidebar?: {
|
|
260
436
|
hide?: boolean | undefined;
|
|
261
437
|
} | undefined;
|
|
262
|
-
scripts?:
|
|
263
|
-
|
|
264
|
-
|
|
438
|
+
scripts?: {
|
|
439
|
+
head?: {
|
|
440
|
+
async?: boolean | undefined;
|
|
441
|
+
type?: string | undefined;
|
|
442
|
+
crossorigin?: string | undefined;
|
|
443
|
+
defer?: boolean | undefined;
|
|
444
|
+
fetchpriority?: string | undefined;
|
|
445
|
+
integrity?: string | undefined;
|
|
446
|
+
module?: boolean | undefined;
|
|
447
|
+
nomodule?: boolean | undefined;
|
|
448
|
+
nonce?: string | undefined;
|
|
449
|
+
referrerpolicy?: string | undefined;
|
|
450
|
+
src: string;
|
|
451
|
+
}[] | undefined;
|
|
452
|
+
body?: {
|
|
453
|
+
async?: boolean | undefined;
|
|
454
|
+
type?: string | undefined;
|
|
455
|
+
crossorigin?: string | undefined;
|
|
456
|
+
defer?: boolean | undefined;
|
|
457
|
+
fetchpriority?: string | undefined;
|
|
458
|
+
integrity?: string | undefined;
|
|
459
|
+
module?: boolean | undefined;
|
|
460
|
+
nomodule?: boolean | undefined;
|
|
461
|
+
nonce?: string | undefined;
|
|
462
|
+
referrerpolicy?: string | undefined;
|
|
463
|
+
src: string;
|
|
464
|
+
}[] | undefined;
|
|
465
|
+
} | undefined;
|
|
466
|
+
links?: {
|
|
467
|
+
type?: string | undefined;
|
|
468
|
+
crossorigin?: string | undefined;
|
|
469
|
+
fetchpriority?: string | undefined;
|
|
470
|
+
integrity?: string | undefined;
|
|
471
|
+
referrerpolicy?: string | undefined;
|
|
472
|
+
as?: string | undefined;
|
|
473
|
+
hreflang?: string | undefined;
|
|
474
|
+
imagesizes?: string | undefined;
|
|
475
|
+
imagesrcset?: string | undefined;
|
|
476
|
+
media?: string | undefined;
|
|
477
|
+
prefetch?: string | undefined;
|
|
478
|
+
rel?: string | undefined;
|
|
479
|
+
sizes?: string | undefined;
|
|
480
|
+
title?: string | undefined;
|
|
481
|
+
href: string;
|
|
482
|
+
}[] | undefined;
|
|
265
483
|
search?: {
|
|
266
484
|
hide?: boolean | undefined;
|
|
267
485
|
placement?: string | undefined;
|
|
@@ -329,9 +547,51 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
329
547
|
sidebar?: {
|
|
330
548
|
hide?: boolean | undefined;
|
|
331
549
|
} | undefined;
|
|
332
|
-
scripts?:
|
|
333
|
-
|
|
334
|
-
|
|
550
|
+
scripts?: {
|
|
551
|
+
head?: {
|
|
552
|
+
async?: boolean | undefined;
|
|
553
|
+
type?: string | undefined;
|
|
554
|
+
crossorigin?: string | undefined;
|
|
555
|
+
defer?: boolean | undefined;
|
|
556
|
+
fetchpriority?: string | undefined;
|
|
557
|
+
integrity?: string | undefined;
|
|
558
|
+
module?: boolean | undefined;
|
|
559
|
+
nomodule?: boolean | undefined;
|
|
560
|
+
nonce?: string | undefined;
|
|
561
|
+
referrerpolicy?: string | undefined;
|
|
562
|
+
src: string;
|
|
563
|
+
}[] | undefined;
|
|
564
|
+
body?: {
|
|
565
|
+
async?: boolean | undefined;
|
|
566
|
+
type?: string | undefined;
|
|
567
|
+
crossorigin?: string | undefined;
|
|
568
|
+
defer?: boolean | undefined;
|
|
569
|
+
fetchpriority?: string | undefined;
|
|
570
|
+
integrity?: string | undefined;
|
|
571
|
+
module?: boolean | undefined;
|
|
572
|
+
nomodule?: boolean | undefined;
|
|
573
|
+
nonce?: string | undefined;
|
|
574
|
+
referrerpolicy?: string | undefined;
|
|
575
|
+
src: string;
|
|
576
|
+
}[] | undefined;
|
|
577
|
+
} | undefined;
|
|
578
|
+
links?: {
|
|
579
|
+
type?: string | undefined;
|
|
580
|
+
crossorigin?: string | undefined;
|
|
581
|
+
fetchpriority?: string | undefined;
|
|
582
|
+
integrity?: string | undefined;
|
|
583
|
+
referrerpolicy?: string | undefined;
|
|
584
|
+
as?: string | undefined;
|
|
585
|
+
hreflang?: string | undefined;
|
|
586
|
+
imagesizes?: string | undefined;
|
|
587
|
+
imagesrcset?: string | undefined;
|
|
588
|
+
media?: string | undefined;
|
|
589
|
+
prefetch?: string | undefined;
|
|
590
|
+
rel?: string | undefined;
|
|
591
|
+
sizes?: string | undefined;
|
|
592
|
+
title?: string | undefined;
|
|
593
|
+
href: string;
|
|
594
|
+
}[] | undefined;
|
|
335
595
|
search?: {
|
|
336
596
|
hide?: boolean | undefined;
|
|
337
597
|
placement?: string | undefined;
|
|
@@ -381,11 +641,15 @@ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
|
|
|
381
641
|
graphql?: {} | undefined;
|
|
382
642
|
}>>;
|
|
383
643
|
export declare type ThemeConfig = z.infer<typeof ThemeConfig>;
|
|
384
|
-
export declare type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | '
|
|
644
|
+
export declare type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 'scripts'> & {
|
|
385
645
|
navbar?: any;
|
|
386
646
|
footer?: any;
|
|
387
647
|
auth?: {
|
|
388
|
-
|
|
648
|
+
idpsInfo?: {
|
|
649
|
+
idpId: string;
|
|
650
|
+
type: string;
|
|
651
|
+
title: string | undefined;
|
|
652
|
+
}[];
|
|
389
653
|
devLogin?: boolean;
|
|
390
654
|
};
|
|
391
655
|
};
|
package/lib/config.js
CHANGED
|
@@ -13,6 +13,40 @@ const LogoConfig = zod_1.z
|
|
|
13
13
|
const HideConfig = zod_1.z.object({
|
|
14
14
|
hide: zod_1.z.boolean().optional(),
|
|
15
15
|
});
|
|
16
|
+
const ScriptConfig = zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
src: zod_1.z.string(),
|
|
19
|
+
async: zod_1.z.boolean().optional(),
|
|
20
|
+
crossorigin: zod_1.z.string().optional(),
|
|
21
|
+
defer: zod_1.z.boolean().optional(),
|
|
22
|
+
fetchpriority: zod_1.z.string().optional(),
|
|
23
|
+
integrity: zod_1.z.string().optional(),
|
|
24
|
+
module: zod_1.z.boolean().optional(),
|
|
25
|
+
nomodule: zod_1.z.boolean().optional(),
|
|
26
|
+
nonce: zod_1.z.string().optional(),
|
|
27
|
+
referrerpolicy: zod_1.z.string().optional(),
|
|
28
|
+
type: zod_1.z.string().optional(),
|
|
29
|
+
})
|
|
30
|
+
.passthrough();
|
|
31
|
+
const LinksConfig = zod_1.z
|
|
32
|
+
.object({
|
|
33
|
+
href: zod_1.z.string(),
|
|
34
|
+
as: zod_1.z.string().optional(),
|
|
35
|
+
crossorigin: zod_1.z.string().optional(),
|
|
36
|
+
fetchpriority: zod_1.z.string().optional(),
|
|
37
|
+
hreflang: zod_1.z.string().optional(),
|
|
38
|
+
imagesizes: zod_1.z.string().optional(),
|
|
39
|
+
imagesrcset: zod_1.z.string().optional(),
|
|
40
|
+
integrity: zod_1.z.string().optional(),
|
|
41
|
+
media: zod_1.z.string().optional(),
|
|
42
|
+
prefetch: zod_1.z.string().optional(),
|
|
43
|
+
referrerpolicy: zod_1.z.string().optional(),
|
|
44
|
+
rel: zod_1.z.string().optional(),
|
|
45
|
+
sizes: zod_1.z.string().optional(),
|
|
46
|
+
title: zod_1.z.string().optional(),
|
|
47
|
+
type: zod_1.z.string().optional(),
|
|
48
|
+
})
|
|
49
|
+
.passthrough();
|
|
16
50
|
exports.ThemeConfig = zod_1.z
|
|
17
51
|
.object({
|
|
18
52
|
imports: zod_1.z.array(zod_1.z.string()).default([]).optional(),
|
|
@@ -34,14 +68,12 @@ exports.ThemeConfig = zod_1.z
|
|
|
34
68
|
.optional(),
|
|
35
69
|
sidebar: HideConfig.strict().optional(),
|
|
36
70
|
scripts: zod_1.z
|
|
37
|
-
.
|
|
38
|
-
.optional(),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.optional(),
|
|
42
|
-
stylesheets: zod_1.z
|
|
43
|
-
.array(zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.union([zod_1.z.boolean(), zod_1.z.string()]))]))
|
|
71
|
+
.object({
|
|
72
|
+
head: zod_1.z.array(ScriptConfig).optional(),
|
|
73
|
+
body: zod_1.z.array(ScriptConfig).optional(),
|
|
74
|
+
})
|
|
44
75
|
.optional(),
|
|
76
|
+
links: zod_1.z.array(LinksConfig).optional(),
|
|
45
77
|
search: zod_1.z
|
|
46
78
|
.object({
|
|
47
79
|
placement: zod_1.z.string().default('navbar').optional(),
|
package/lib/globalStyle.js
CHANGED
|
@@ -512,7 +512,7 @@ const sidebar = (0, styled_components_1.css) `
|
|
|
512
512
|
--sidebar-back-button-font-family: var(--sidebar-item-font-family);
|
|
513
513
|
--sidebar-back-button-font-size: var(--sidebar-item-font-size);
|
|
514
514
|
--sidebar-back-button-transform: inherit;
|
|
515
|
-
--sidebar-back-button-text-color: var(--
|
|
515
|
+
--sidebar-back-button-text-color: var(--link-text-color);
|
|
516
516
|
--sidebar-back-button-background-color: transparent;
|
|
517
517
|
--sidebar-back-button-hover-text-color: var(--sidebar-item-active-color);
|
|
518
518
|
--sidebar-back-button-hover-background-color: transparent;
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ const Arrow = ({ className }: { className?: string }): JSX.Element => (
|
|
|
7
7
|
fill="none"
|
|
8
8
|
xmlns="http://www.w3.org/2000/svg"
|
|
9
9
|
viewBox="0 0 12 10"
|
|
10
|
-
width="
|
|
10
|
+
width="10px"
|
|
11
11
|
height="10px"
|
|
12
12
|
className={className}
|
|
13
13
|
>
|
|
@@ -19,7 +19,7 @@ const Arrow = ({ className }: { className?: string }): JSX.Element => (
|
|
|
19
19
|
|
|
20
20
|
export const ArrowBack = styled(Arrow)`
|
|
21
21
|
fill: var(--sidebar-back-button-icon-color);
|
|
22
|
-
margin-right: calc(var(--sidebar-spacing-unit)
|
|
22
|
+
margin-right: calc(var(--sidebar-spacing-unit));
|
|
23
23
|
|
|
24
24
|
background-image: var(--sidebar-back-button-icon);
|
|
25
25
|
background-repeat: no-repeat;
|
|
@@ -7,13 +7,23 @@ import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
|
|
|
7
7
|
import { MenuContainer } from '@theme/Sidebar/MenuContainer';
|
|
8
8
|
import { SidebarSearch } from '@theme/Search/SidebarSearch';
|
|
9
9
|
import { useThemeConfig } from '@theme/hooks/useThemeConfig';
|
|
10
|
+
import { ArrowBack } from '@theme/Sidebar/ArrowBack';
|
|
11
|
+
import { Link } from '@portal/Link';
|
|
10
12
|
|
|
11
13
|
interface SidebarLayoutProps {
|
|
12
14
|
versions: React.ReactNode;
|
|
13
15
|
menu: React.ReactNode;
|
|
16
|
+
backLink?: {
|
|
17
|
+
label: string;
|
|
18
|
+
slug: string;
|
|
19
|
+
};
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
export function SidebarLayout({
|
|
22
|
+
export function SidebarLayout({
|
|
23
|
+
versions,
|
|
24
|
+
menu,
|
|
25
|
+
backLink,
|
|
26
|
+
}: SidebarLayoutProps): JSX.Element | null {
|
|
17
27
|
const [isOpen, setIsOpen] = useMobileMenu();
|
|
18
28
|
const toggleMenu = () => setIsOpen(!isOpen);
|
|
19
29
|
const { search, sidebar } = useThemeConfig();
|
|
@@ -28,6 +38,15 @@ export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Eleme
|
|
|
28
38
|
|
|
29
39
|
{!search?.hide && search?.placement === 'sidebar' ? <SidebarSearch /> : null}
|
|
30
40
|
<Sidebar animate={true} opened={isOpen}>
|
|
41
|
+
{(backLink && (
|
|
42
|
+
<BackLinkWrapper>
|
|
43
|
+
<Link to={backLink.slug}>
|
|
44
|
+
<ArrowBack />
|
|
45
|
+
Back to {backLink.label}
|
|
46
|
+
</Link>
|
|
47
|
+
</BackLinkWrapper>
|
|
48
|
+
)) ||
|
|
49
|
+
null}
|
|
31
50
|
{versions}
|
|
32
51
|
<MenuContainer>{menu}</MenuContainer>
|
|
33
52
|
</Sidebar>
|
|
@@ -35,4 +54,22 @@ export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Eleme
|
|
|
35
54
|
);
|
|
36
55
|
}
|
|
37
56
|
|
|
57
|
+
const BackLinkWrapper = styled.div`
|
|
58
|
+
padding: var(--sidebar-offset-top) var(--sidebar-item-padding-horizontal)
|
|
59
|
+
var(--sidebar-item-padding-horizontal)
|
|
60
|
+
calc(var(--sidebar-offset-left) + var(--sidebar-item-padding-horizontal));
|
|
61
|
+
|
|
62
|
+
a {
|
|
63
|
+
color: var(--sidebar-back-button-text-color);
|
|
64
|
+
font-size: var(--sidebar-back-button-font-size);
|
|
65
|
+
font-family: var(--sidebar-back-button-font-family);
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
&:hover {
|
|
68
|
+
color: var(--sidebar-back-button-hover-text-color);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
border-bottom: 1px solid var(--sidebar-border-color);
|
|
73
|
+
`;
|
|
74
|
+
|
|
38
75
|
const Wrapper = styled.div``;
|
package/src/config.ts
CHANGED
|
@@ -13,6 +13,43 @@ const HideConfig = z.object({
|
|
|
13
13
|
hide: z.boolean().optional(),
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
+
const ScriptConfig = z
|
|
17
|
+
.object({
|
|
18
|
+
src: z.string(),
|
|
19
|
+
async: z.boolean().optional(),
|
|
20
|
+
crossorigin: z.string().optional(),
|
|
21
|
+
defer: z.boolean().optional(),
|
|
22
|
+
fetchpriority: z.string().optional(),
|
|
23
|
+
integrity: z.string().optional(),
|
|
24
|
+
module: z.boolean().optional(),
|
|
25
|
+
nomodule: z.boolean().optional(),
|
|
26
|
+
nonce: z.string().optional(),
|
|
27
|
+
referrerpolicy: z.string().optional(),
|
|
28
|
+
type: z.string().optional(),
|
|
29
|
+
})
|
|
30
|
+
.passthrough();
|
|
31
|
+
|
|
32
|
+
const LinksConfig = z
|
|
33
|
+
.object({
|
|
34
|
+
href: z.string(),
|
|
35
|
+
|
|
36
|
+
as: z.string().optional(),
|
|
37
|
+
crossorigin: z.string().optional(),
|
|
38
|
+
fetchpriority: z.string().optional(),
|
|
39
|
+
hreflang: z.string().optional(),
|
|
40
|
+
imagesizes: z.string().optional(),
|
|
41
|
+
imagesrcset: z.string().optional(),
|
|
42
|
+
integrity: z.string().optional(),
|
|
43
|
+
media: z.string().optional(),
|
|
44
|
+
prefetch: z.string().optional(),
|
|
45
|
+
referrerpolicy: z.string().optional(),
|
|
46
|
+
rel: z.string().optional(),
|
|
47
|
+
sizes: z.string().optional(),
|
|
48
|
+
title: z.string().optional(),
|
|
49
|
+
type: z.string().optional(),
|
|
50
|
+
})
|
|
51
|
+
.passthrough();
|
|
52
|
+
|
|
16
53
|
export const ThemeConfig = z
|
|
17
54
|
.object({
|
|
18
55
|
imports: z.array(z.string()).default([]).optional(),
|
|
@@ -37,14 +74,12 @@ export const ThemeConfig = z
|
|
|
37
74
|
sidebar: HideConfig.strict().optional(),
|
|
38
75
|
|
|
39
76
|
scripts: z
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.optional(),
|
|
45
|
-
stylesheets: z
|
|
46
|
-
.array(z.union([z.string(), z.record(z.union([z.boolean(), z.string()]))]))
|
|
77
|
+
.object({
|
|
78
|
+
head: z.array(ScriptConfig).optional(),
|
|
79
|
+
body: z.array(ScriptConfig).optional(),
|
|
80
|
+
})
|
|
47
81
|
.optional(),
|
|
82
|
+
links: z.array(LinksConfig).optional(),
|
|
48
83
|
|
|
49
84
|
search: z
|
|
50
85
|
.object({
|
|
@@ -129,15 +164,16 @@ export const ThemeConfig = z
|
|
|
129
164
|
.default({});
|
|
130
165
|
|
|
131
166
|
export type ThemeConfig = z.infer<typeof ThemeConfig>;
|
|
132
|
-
export type ThemeUIConfig = Omit<
|
|
133
|
-
ThemeConfig,
|
|
134
|
-
'navbar' | 'footer' | 'styles' | 'scripts' | 'postBodyScripts'
|
|
135
|
-
> & {
|
|
167
|
+
export type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 'scripts'> & {
|
|
136
168
|
navbar?: any; // TODO
|
|
137
169
|
footer?: any; // TODO
|
|
138
170
|
auth?: {
|
|
139
171
|
// used by portal dev login emulator
|
|
140
|
-
|
|
172
|
+
idpsInfo?: {
|
|
173
|
+
idpId: string;
|
|
174
|
+
type: string; // AuthProviderType
|
|
175
|
+
title: string | undefined;
|
|
176
|
+
}[];
|
|
141
177
|
devLogin?: boolean;
|
|
142
178
|
};
|
|
143
179
|
};
|
package/src/globalStyle.ts
CHANGED
|
@@ -517,7 +517,7 @@ const sidebar = css`
|
|
|
517
517
|
--sidebar-back-button-font-family: var(--sidebar-item-font-family);
|
|
518
518
|
--sidebar-back-button-font-size: var(--sidebar-item-font-size);
|
|
519
519
|
--sidebar-back-button-transform: inherit;
|
|
520
|
-
--sidebar-back-button-text-color: var(--
|
|
520
|
+
--sidebar-back-button-text-color: var(--link-text-color);
|
|
521
521
|
--sidebar-back-button-background-color: transparent;
|
|
522
522
|
--sidebar-back-button-hover-text-color: var(--sidebar-item-active-color);
|
|
523
523
|
--sidebar-back-button-hover-background-color: transparent;
|
|
@@ -77,10 +77,9 @@ export interface PageStaticData {
|
|
|
77
77
|
[k: string]: unknown;
|
|
78
78
|
}
|
|
79
79
|
export declare type UserData = {
|
|
80
|
-
|
|
80
|
+
isAuthenticated: boolean;
|
|
81
81
|
name: string;
|
|
82
82
|
picture: string;
|
|
83
|
-
logoutDisabled?: boolean;
|
|
84
83
|
};
|
|
85
84
|
export interface PageData {
|
|
86
85
|
templateId: string;
|