@redocly/theme 0.4.16 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/lib/ApiOnboarding/AppCustomAttributes.d.ts +5 -0
  2. package/lib/ApiOnboarding/AppCustomAttributes.js +8 -0
  3. package/lib/ColorModeSwitcher/ColorModeSwitcher.js +23 -10
  4. package/lib/EditPageButton/EditPageButton.d.ts +1 -1
  5. package/lib/EditPageButton/EditPageButton.js +5 -1
  6. package/lib/Footer/Footer.js +2 -2
  7. package/lib/Footer/FooterColumn.js +1 -1
  8. package/lib/LastUpdated/LastUpdated.js +30 -7
  9. package/lib/Markdown/Admonition.js +3 -0
  10. package/lib/Markdown/CodeSample/CodeSample.js +14 -14
  11. package/lib/Markdown/MarkdownLayout.d.ts +1 -1
  12. package/lib/Markdown/MarkdownLayout.js +5 -1
  13. package/lib/Navbar/Navbar.js +2 -2
  14. package/lib/Navbar/NavbarItem.js +1 -1
  15. package/lib/PageNavigation/NextPageLink.js +30 -7
  16. package/lib/PageNavigation/PageNavigation.js +8 -3
  17. package/lib/PageNavigation/PreviousPageLink.js +4 -4
  18. package/lib/Sidebar/MenuLink.d.ts +3 -4
  19. package/lib/Sidebar/MenuLink.js +2 -6
  20. package/lib/Sidebar/SidebarLayout.js +2 -2
  21. package/lib/Sidebar/types/MenuStyle.js +0 -1
  22. package/lib/TableOfContent/TableOfContent.d.ts +0 -1
  23. package/lib/TableOfContent/TableOfContent.js +5 -7
  24. package/lib/config.d.ts +385 -0
  25. package/lib/config.js +113 -0
  26. package/lib/globalStyle.js +3 -5
  27. package/lib/hooks/index.d.ts +1 -0
  28. package/lib/hooks/index.js +1 -0
  29. package/lib/hooks/useActiveHeading.js +1 -1
  30. package/lib/hooks/useActiveSectionId.js +1 -1
  31. package/lib/hooks/useThemeConfig.d.ts +1 -0
  32. package/lib/hooks/useThemeConfig.js +6 -0
  33. package/lib/icons/ColorModeIcon/ColorModeIcon.js +3 -3
  34. package/lib/index.d.ts +2 -0
  35. package/lib/index.js +2 -0
  36. package/lib/mocks/Link.js +12 -2
  37. package/lib/mocks/hooks/index.d.ts +2 -5
  38. package/lib/mocks/hooks/index.js +22 -6
  39. package/lib/mocks/types.d.ts +0 -11
  40. package/lib/mocks/types.js +1 -0
  41. package/lib/types/config.d.ts +5 -0
  42. package/lib/types/config.js +3 -0
  43. package/lib/ui/index.d.ts +0 -1
  44. package/lib/ui/index.js +0 -1
  45. package/lib/utils/args-typecheck.js +1 -1
  46. package/package.json +30 -34
  47. package/src/ApiOnboarding/AppCustomAttributes.tsx +6 -0
  48. package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +29 -12
  49. package/src/EditPageButton/EditPageButton.tsx +6 -2
  50. package/src/Footer/Footer.tsx +2 -2
  51. package/src/Footer/FooterColumn.tsx +7 -1
  52. package/src/LastUpdated/LastUpdated.tsx +8 -6
  53. package/src/Markdown/Admonition.tsx +3 -0
  54. package/src/Markdown/CodeSample/CodeSample.tsx +15 -16
  55. package/src/Markdown/MarkdownLayout.tsx +9 -3
  56. package/src/Navbar/Navbar.tsx +2 -2
  57. package/src/Navbar/NavbarItem.tsx +1 -1
  58. package/src/PageNavigation/NextPageLink.tsx +8 -5
  59. package/src/PageNavigation/PageNavigation.tsx +7 -3
  60. package/src/PageNavigation/PreviousPageLink.tsx +7 -4
  61. package/src/Sidebar/MenuLink.tsx +3 -8
  62. package/src/Sidebar/SidebarLayout.tsx +2 -2
  63. package/src/Sidebar/types/MenuStyle.ts +0 -1
  64. package/src/TableOfContent/TableOfContent.tsx +5 -7
  65. package/src/config.ts +130 -0
  66. package/src/globalStyle.ts +3 -5
  67. package/src/hooks/index.ts +1 -0
  68. package/src/hooks/useActiveHeading.ts +3 -1
  69. package/src/hooks/useActiveSectionId.ts +1 -1
  70. package/src/hooks/useThemeConfig.ts +1 -0
  71. package/src/icons/ColorModeIcon/ColorModeIcon.tsx +3 -3
  72. package/src/index.ts +3 -0
  73. package/src/mocks/Link.tsx +8 -2
  74. package/src/mocks/hooks/index.ts +22 -9
  75. package/src/mocks/types.ts +2 -11
  76. package/{settings.yaml → src/settings.yaml} +0 -0
  77. package/src/types/config.ts +5 -0
  78. package/src/types/portal/src/shared/constants.d.ts +0 -1
  79. package/src/types/portal/src/shared/types/nav.d.ts +3 -0
  80. package/src/ui/index.tsx +0 -1
  81. package/src/utils/args-typecheck.ts +1 -1
  82. package/lib/hooks/useDefaultThemeSettings.d.ts +0 -2
  83. package/lib/hooks/useDefaultThemeSettings.js +0 -10
  84. package/lib/ui/UniversalLink.d.ts +0 -17
  85. package/lib/ui/UniversalLink.js +0 -79
  86. package/src/hooks/useDefaultThemeSettings.ts +0 -7
  87. package/src/ui/UniversalLink.tsx +0 -97
@@ -0,0 +1,385 @@
1
+ import { z } from 'zod';
2
+ export declare const ThemeConfig: z.ZodDefault<z.ZodObject<{
3
+ imports: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
4
+ logo: z.ZodOptional<z.ZodObject<{
5
+ image: z.ZodOptional<z.ZodString>;
6
+ altText: z.ZodOptional<z.ZodString>;
7
+ link: z.ZodOptional<z.ZodString>;
8
+ favicon: z.ZodOptional<z.ZodString>;
9
+ }, "strict", z.ZodTypeAny, {
10
+ image?: string | undefined;
11
+ altText?: string | undefined;
12
+ link?: string | undefined;
13
+ favicon?: string | undefined;
14
+ }, {
15
+ image?: string | undefined;
16
+ altText?: string | undefined;
17
+ link?: string | undefined;
18
+ favicon?: string | undefined;
19
+ }>>;
20
+ navbar: z.ZodOptional<z.ZodObject<{
21
+ hide: z.ZodOptional<z.ZodBoolean>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ hide?: boolean | undefined;
24
+ }, {
25
+ hide?: boolean | undefined;
26
+ }>>;
27
+ footer: z.ZodOptional<z.ZodObject<{
28
+ hide: z.ZodOptional<z.ZodBoolean>;
29
+ }, "strict", z.ZodTypeAny, {
30
+ hide?: boolean | undefined;
31
+ }, {
32
+ hide?: boolean | undefined;
33
+ }>>;
34
+ sidebar: z.ZodOptional<z.ZodObject<{
35
+ hide: z.ZodOptional<z.ZodBoolean>;
36
+ }, "strict", z.ZodTypeAny, {
37
+ hide?: boolean | undefined;
38
+ }, {
39
+ hide?: boolean | undefined;
40
+ }>>;
41
+ navbarItems: z.ZodOptional<z.ZodAny>;
42
+ footerItems: z.ZodOptional<z.ZodAny>;
43
+ scripts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>]>, "many">>;
44
+ postBodyScripts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>]>, "many">>;
45
+ styles: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>]>, "many">>;
46
+ search: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
47
+ placement: z.ZodOptional<z.ZodDefault<z.ZodString>>;
48
+ }, {
49
+ hide: z.ZodOptional<z.ZodBoolean>;
50
+ }>, "strict", z.ZodTypeAny, {
51
+ hide?: boolean | undefined;
52
+ placement?: string | undefined;
53
+ }, {
54
+ hide?: boolean | undefined;
55
+ placement?: string | undefined;
56
+ }>>>;
57
+ colorMode: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
58
+ disableDetect: z.ZodOptional<z.ZodBoolean>;
59
+ default: z.ZodOptional<z.ZodString>;
60
+ modes: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
61
+ }, {
62
+ hide: z.ZodOptional<z.ZodBoolean>;
63
+ }>, "strict", z.ZodTypeAny, {
64
+ hide?: boolean | undefined;
65
+ disableDetect?: boolean | undefined;
66
+ default?: string | undefined;
67
+ modes?: string[] | undefined;
68
+ }, {
69
+ hide?: boolean | undefined;
70
+ disableDetect?: boolean | undefined;
71
+ default?: string | undefined;
72
+ modes?: string[] | undefined;
73
+ }>>>;
74
+ navigation: z.ZodDefault<z.ZodOptional<z.ZodObject<{
75
+ nextPageLink: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
76
+ label: z.ZodDefault<z.ZodString>;
77
+ }, {
78
+ hide: z.ZodOptional<z.ZodBoolean>;
79
+ }>, "strip", z.ZodTypeAny, {
80
+ hide?: boolean | undefined;
81
+ label: string;
82
+ }, {
83
+ hide?: boolean | undefined;
84
+ label?: string | undefined;
85
+ }>>>;
86
+ prevPageLink: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
87
+ label: z.ZodDefault<z.ZodString>;
88
+ }, {
89
+ hide: z.ZodOptional<z.ZodBoolean>;
90
+ }>, "strip", z.ZodTypeAny, {
91
+ hide?: boolean | undefined;
92
+ label: string;
93
+ }, {
94
+ hide?: boolean | undefined;
95
+ label?: string | undefined;
96
+ }>>>;
97
+ }, "strict", z.ZodTypeAny, {
98
+ nextPageLink: {
99
+ hide?: boolean | undefined;
100
+ label: string;
101
+ };
102
+ prevPageLink: {
103
+ hide?: boolean | undefined;
104
+ label: string;
105
+ };
106
+ }, {
107
+ nextPageLink?: {
108
+ hide?: boolean | undefined;
109
+ label?: string | undefined;
110
+ } | undefined;
111
+ prevPageLink?: {
112
+ hide?: boolean | undefined;
113
+ label?: string | undefined;
114
+ } | undefined;
115
+ }>>>;
116
+ markdown: z.ZodOptional<z.ZodDefault<z.ZodObject<{
117
+ frontmatterKeysToResolve: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
118
+ lastUpdatedBlock: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
119
+ format: z.ZodOptional<z.ZodDefault<z.ZodEnum<["timeago", "iso", "long", "short"]>>>;
120
+ locale: z.ZodOptional<z.ZodDefault<z.ZodString>>;
121
+ }, {
122
+ hide: z.ZodOptional<z.ZodBoolean>;
123
+ }>, "strip", z.ZodTypeAny, {
124
+ hide?: boolean | undefined;
125
+ format?: "timeago" | "iso" | "long" | "short" | undefined;
126
+ locale?: string | undefined;
127
+ }, {
128
+ hide?: boolean | undefined;
129
+ format?: "timeago" | "iso" | "long" | "short" | undefined;
130
+ locale?: string | undefined;
131
+ }>>>;
132
+ toc: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
133
+ header: z.ZodOptional<z.ZodDefault<z.ZodString>>;
134
+ maxDepth: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
135
+ }, {
136
+ hide: z.ZodOptional<z.ZodBoolean>;
137
+ }>, "strip", z.ZodTypeAny, {
138
+ hide?: boolean | undefined;
139
+ header?: string | undefined;
140
+ maxDepth?: number | undefined;
141
+ }, {
142
+ hide?: boolean | undefined;
143
+ header?: string | undefined;
144
+ maxDepth?: number | undefined;
145
+ }>>>;
146
+ editPage: z.ZodOptional<z.ZodDefault<z.ZodObject<z.extendShape<{
147
+ baseUrl: z.ZodOptional<z.ZodString>;
148
+ icon: z.ZodOptional<z.ZodString>;
149
+ text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
150
+ }, {
151
+ hide: z.ZodOptional<z.ZodBoolean>;
152
+ }>, "strip", z.ZodTypeAny, {
153
+ hide?: boolean | undefined;
154
+ baseUrl?: string | undefined;
155
+ icon?: string | undefined;
156
+ text: string;
157
+ }, {
158
+ hide?: boolean | undefined;
159
+ baseUrl?: string | undefined;
160
+ icon?: string | undefined;
161
+ text?: string | undefined;
162
+ }>>>;
163
+ copyCodeSnippet: z.ZodDefault<z.ZodOptional<z.ZodObject<z.extendShape<{
164
+ buttonText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
165
+ tooltipText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
166
+ toasterText: z.ZodOptional<z.ZodDefault<z.ZodString>>;
167
+ toasterDuration: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
168
+ }, {
169
+ hide: z.ZodOptional<z.ZodBoolean>;
170
+ }>, "strip", z.ZodTypeAny, {
171
+ hide?: boolean | undefined;
172
+ buttonText?: string | undefined;
173
+ tooltipText?: string | undefined;
174
+ toasterText?: string | undefined;
175
+ toasterDuration?: number | undefined;
176
+ }, {
177
+ hide?: boolean | undefined;
178
+ buttonText?: string | undefined;
179
+ tooltipText?: string | undefined;
180
+ toasterText?: string | undefined;
181
+ toasterDuration?: number | undefined;
182
+ }>>>;
183
+ }, "strict", z.ZodTypeAny, {
184
+ frontmatterKeysToResolve?: string[] | undefined;
185
+ lastUpdatedBlock?: {
186
+ hide?: boolean | undefined;
187
+ format?: "timeago" | "iso" | "long" | "short" | undefined;
188
+ locale?: string | undefined;
189
+ } | undefined;
190
+ editPage?: {
191
+ hide?: boolean | undefined;
192
+ baseUrl?: string | undefined;
193
+ icon?: string | undefined;
194
+ text: string;
195
+ } | undefined;
196
+ toc: {
197
+ hide?: boolean | undefined;
198
+ header?: string | undefined;
199
+ maxDepth?: number | undefined;
200
+ };
201
+ copyCodeSnippet: {
202
+ hide?: boolean | undefined;
203
+ buttonText?: string | undefined;
204
+ tooltipText?: string | undefined;
205
+ toasterText?: string | undefined;
206
+ toasterDuration?: number | undefined;
207
+ };
208
+ }, {
209
+ frontmatterKeysToResolve?: string[] | undefined;
210
+ lastUpdatedBlock?: {
211
+ hide?: boolean | undefined;
212
+ format?: "timeago" | "iso" | "long" | "short" | undefined;
213
+ locale?: string | undefined;
214
+ } | undefined;
215
+ toc?: {
216
+ hide?: boolean | undefined;
217
+ header?: string | undefined;
218
+ maxDepth?: number | undefined;
219
+ } | undefined;
220
+ editPage?: {
221
+ hide?: boolean | undefined;
222
+ baseUrl?: string | undefined;
223
+ icon?: string | undefined;
224
+ text?: string | undefined;
225
+ } | undefined;
226
+ copyCodeSnippet?: {
227
+ hide?: boolean | undefined;
228
+ buttonText?: string | undefined;
229
+ tooltipText?: string | undefined;
230
+ toasterText?: string | undefined;
231
+ toasterDuration?: number | undefined;
232
+ } | undefined;
233
+ }>>>;
234
+ openapi: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
235
+ graphql: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, {}, {}>>;
236
+ }, "passthrough", z.ZodTypeAny, {
237
+ imports?: string[] | undefined;
238
+ logo?: {
239
+ image?: string | undefined;
240
+ altText?: string | undefined;
241
+ link?: string | undefined;
242
+ favicon?: string | undefined;
243
+ } | undefined;
244
+ navbar?: {
245
+ hide?: boolean | undefined;
246
+ } | undefined;
247
+ footer?: {
248
+ hide?: boolean | undefined;
249
+ } | undefined;
250
+ sidebar?: {
251
+ hide?: boolean | undefined;
252
+ } | undefined;
253
+ navbarItems?: any;
254
+ footerItems?: any;
255
+ scripts?: (string | Record<string, string | boolean>)[] | undefined;
256
+ postBodyScripts?: (string | Record<string, string | boolean>)[] | undefined;
257
+ styles?: (string | Record<string, string | boolean>)[] | undefined;
258
+ search?: {
259
+ hide?: boolean | undefined;
260
+ placement?: string | undefined;
261
+ } | undefined;
262
+ markdown?: {
263
+ frontmatterKeysToResolve?: string[] | undefined;
264
+ lastUpdatedBlock?: {
265
+ hide?: boolean | undefined;
266
+ format?: "timeago" | "iso" | "long" | "short" | undefined;
267
+ locale?: string | undefined;
268
+ } | undefined;
269
+ editPage?: {
270
+ hide?: boolean | undefined;
271
+ baseUrl?: string | undefined;
272
+ icon?: string | undefined;
273
+ text: string;
274
+ } | undefined;
275
+ toc: {
276
+ hide?: boolean | undefined;
277
+ header?: string | undefined;
278
+ maxDepth?: number | undefined;
279
+ };
280
+ copyCodeSnippet: {
281
+ hide?: boolean | undefined;
282
+ buttonText?: string | undefined;
283
+ tooltipText?: string | undefined;
284
+ toasterText?: string | undefined;
285
+ toasterDuration?: number | undefined;
286
+ };
287
+ } | undefined;
288
+ openapi?: {} | undefined;
289
+ graphql?: {} | undefined;
290
+ colorMode: {
291
+ hide?: boolean | undefined;
292
+ disableDetect?: boolean | undefined;
293
+ default?: string | undefined;
294
+ modes?: string[] | undefined;
295
+ };
296
+ navigation: {
297
+ nextPageLink: {
298
+ hide?: boolean | undefined;
299
+ label: string;
300
+ };
301
+ prevPageLink: {
302
+ hide?: boolean | undefined;
303
+ label: string;
304
+ };
305
+ };
306
+ }, {
307
+ imports?: string[] | undefined;
308
+ logo?: {
309
+ image?: string | undefined;
310
+ altText?: string | undefined;
311
+ link?: string | undefined;
312
+ favicon?: string | undefined;
313
+ } | undefined;
314
+ navbar?: {
315
+ hide?: boolean | undefined;
316
+ } | undefined;
317
+ footer?: {
318
+ hide?: boolean | undefined;
319
+ } | undefined;
320
+ sidebar?: {
321
+ hide?: boolean | undefined;
322
+ } | undefined;
323
+ navbarItems?: any;
324
+ footerItems?: any;
325
+ scripts?: (string | Record<string, string | boolean>)[] | undefined;
326
+ postBodyScripts?: (string | Record<string, string | boolean>)[] | undefined;
327
+ styles?: (string | Record<string, string | boolean>)[] | undefined;
328
+ search?: {
329
+ hide?: boolean | undefined;
330
+ placement?: string | undefined;
331
+ } | undefined;
332
+ colorMode?: {
333
+ hide?: boolean | undefined;
334
+ disableDetect?: boolean | undefined;
335
+ default?: string | undefined;
336
+ modes?: string[] | undefined;
337
+ } | undefined;
338
+ navigation?: {
339
+ nextPageLink?: {
340
+ hide?: boolean | undefined;
341
+ label?: string | undefined;
342
+ } | undefined;
343
+ prevPageLink?: {
344
+ hide?: boolean | undefined;
345
+ label?: string | undefined;
346
+ } | undefined;
347
+ } | undefined;
348
+ markdown?: {
349
+ frontmatterKeysToResolve?: string[] | undefined;
350
+ lastUpdatedBlock?: {
351
+ hide?: boolean | undefined;
352
+ format?: "timeago" | "iso" | "long" | "short" | undefined;
353
+ locale?: string | undefined;
354
+ } | undefined;
355
+ toc?: {
356
+ hide?: boolean | undefined;
357
+ header?: string | undefined;
358
+ maxDepth?: number | undefined;
359
+ } | undefined;
360
+ editPage?: {
361
+ hide?: boolean | undefined;
362
+ baseUrl?: string | undefined;
363
+ icon?: string | undefined;
364
+ text?: string | undefined;
365
+ } | undefined;
366
+ copyCodeSnippet?: {
367
+ hide?: boolean | undefined;
368
+ buttonText?: string | undefined;
369
+ tooltipText?: string | undefined;
370
+ toasterText?: string | undefined;
371
+ toasterDuration?: number | undefined;
372
+ } | undefined;
373
+ } | undefined;
374
+ openapi?: {} | undefined;
375
+ graphql?: {} | undefined;
376
+ }>>;
377
+ export declare type ThemeConfig = z.infer<typeof ThemeConfig>;
378
+ export declare type ThemeUIConfig = Omit<ThemeConfig, 'navbarItems' | 'footerItems' | 'styles' | 'scripts' | 'postBodyScripts'> & {
379
+ navbarItems?: any;
380
+ footerItems?: any;
381
+ auth?: {
382
+ idpIds?: string[];
383
+ devLogin?: boolean;
384
+ };
385
+ };
package/lib/config.js ADDED
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThemeConfig = void 0;
4
+ const zod_1 = require("zod");
5
+ const LogoConfig = zod_1.z
6
+ .object({
7
+ image: zod_1.z.string().optional(),
8
+ altText: zod_1.z.string().optional(),
9
+ link: zod_1.z.string().optional(),
10
+ favicon: zod_1.z.string().optional(),
11
+ })
12
+ .strict();
13
+ const HideConfig = zod_1.z.object({
14
+ hide: zod_1.z.boolean().optional(),
15
+ });
16
+ exports.ThemeConfig = zod_1.z
17
+ .object({
18
+ imports: zod_1.z.array(zod_1.z.string()).default([]).optional(),
19
+ logo: LogoConfig.optional(),
20
+ navbar: HideConfig.strict().optional(),
21
+ footer: HideConfig.strict().optional(),
22
+ sidebar: HideConfig.strict().optional(),
23
+ navbarItems: zod_1.z.any().optional(),
24
+ footerItems: zod_1.z.any().optional(),
25
+ scripts: zod_1.z
26
+ .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()]))]))
27
+ .optional(),
28
+ postBodyScripts: zod_1.z
29
+ .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()]))]))
30
+ .optional(),
31
+ styles: zod_1.z.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()]))])).optional(),
32
+ search: zod_1.z
33
+ .object({
34
+ placement: zod_1.z.string().default('navbar').optional(),
35
+ })
36
+ .extend(HideConfig.shape)
37
+ .strict()
38
+ .default({})
39
+ .optional(),
40
+ colorMode: zod_1.z
41
+ .object({
42
+ disableDetect: zod_1.z.boolean().optional(),
43
+ default: zod_1.z.string().optional(),
44
+ modes: zod_1.z.array(zod_1.z.string()).default(['light', 'dark']).optional(),
45
+ })
46
+ .extend(HideConfig.shape)
47
+ .strict()
48
+ .optional()
49
+ .default({}),
50
+ navigation: zod_1.z
51
+ .object({
52
+ nextPageLink: zod_1.z
53
+ .object({ label: zod_1.z.string().default('Next to {label}') })
54
+ .extend(HideConfig.shape)
55
+ .optional()
56
+ .default({}),
57
+ prevPageLink: zod_1.z
58
+ .object({ label: zod_1.z.string().default('Back to {label}') })
59
+ .extend(HideConfig.shape)
60
+ .optional()
61
+ .default({}),
62
+ })
63
+ .strict()
64
+ .optional()
65
+ .default({}),
66
+ markdown: zod_1.z
67
+ .object({
68
+ frontmatterKeysToResolve: zod_1.z.array(zod_1.z.string()).default(['image', 'links']).optional(),
69
+ lastUpdatedBlock: zod_1.z
70
+ .object({
71
+ format: zod_1.z.enum(['timeago', 'iso', 'long', 'short']).default('timeago').optional(),
72
+ locale: zod_1.z.string().default('en-US').optional(),
73
+ })
74
+ .extend(HideConfig.shape)
75
+ .default({})
76
+ .optional(),
77
+ toc: zod_1.z
78
+ .object({
79
+ header: zod_1.z.string().default('On this page').optional(),
80
+ maxDepth: zod_1.z.number().default(3).optional(),
81
+ })
82
+ .extend(HideConfig.shape)
83
+ .optional()
84
+ .default({}),
85
+ editPage: zod_1.z
86
+ .object({
87
+ baseUrl: zod_1.z.string().optional(),
88
+ icon: zod_1.z.string().optional(),
89
+ text: zod_1.z.string().optional().default('Edit this page'),
90
+ })
91
+ .extend(HideConfig.shape)
92
+ .default({})
93
+ .optional(),
94
+ copyCodeSnippet: zod_1.z
95
+ .object({
96
+ buttonText: zod_1.z.string().default('Copy').optional(),
97
+ tooltipText: zod_1.z.string().default('Copy to clipboard').optional(),
98
+ toasterText: zod_1.z.string().default('Copied').optional(),
99
+ toasterDuration: zod_1.z.number().default(1500).optional(),
100
+ })
101
+ .extend(HideConfig.shape)
102
+ .optional()
103
+ .default({}),
104
+ })
105
+ .strict()
106
+ .default({})
107
+ .optional(),
108
+ openapi: zod_1.z.object({}).passthrough().optional(),
109
+ graphql: zod_1.z.object({}).passthrough().optional(),
110
+ })
111
+ .passthrough()
112
+ .default({});
113
+ //# sourceMappingURL=config.js.map
@@ -180,7 +180,7 @@ const headingsTypography = (0, styled_components_1.css) `
180
180
  --heading-anchor-color: var(--color-primary-500); // @presenter Color
181
181
  --heading-anchor-icon: none;
182
182
 
183
- // TODO: implement a theme setting for heading-anchor-location: left right
183
+ // TODO: implement a theme config for heading-anchor-location: left right
184
184
 
185
185
  /**
186
186
  * @tokens Heading level 1
@@ -312,7 +312,6 @@ const buttons = (0, styled_components_1.css) `
312
312
  --button-active-background-color: var(--color-emphasis-600); // @presenter Color
313
313
  --button-active-border-color: var(--color-emphasis-600); // @presenter Color
314
314
 
315
- /* TODO more styles for disabled state ??? */
316
315
  --button-disabled-color: var(--button-color); // @presenter Color
317
316
  --button-disabled-background-color: var(--color-emphasis-200); // @presenter Color
318
317
 
@@ -490,8 +489,8 @@ const sidebar = (0, styled_components_1.css) `
490
489
  --sidebar-item-group-active-text-color: var(--sidebar-item-active-color);
491
490
  --sidebar-item-group-active-background-color: var(--sidebar-item-active-background-color);
492
491
 
493
- // we need a theme setting for chevron-location: left (default), right-compact, right, none
494
- // we need another theme setting for chevron-style: up-down, down-up, right-down, down-right
492
+ // we need a theme config for chevron-location: left (default), right-compact, right, none
493
+ // we need another theme config for chevron-style: up-down, down-up, right-down, down-right
495
494
 
496
495
  --sidebar-group-item-chevron-size: var(--sidebar-spacing-unit);
497
496
  --sidebar-group-item-chevron-color: var(--sidebar-item-text-color);
@@ -550,7 +549,6 @@ const admonition = (0, styled_components_1.css) `
550
549
  --admonition-padding-vertical: calc(var(--spacing-unit) * 4);
551
550
  --admonition-icon-size: 25px;
552
551
 
553
- // TODO this is should be changed to --border-radius-lg
554
552
  /**
555
553
  * @tokens Admonition border
556
554
  */
@@ -1,3 +1,4 @@
1
+ export * from '../hooks/useThemeConfig';
1
2
  export * from '../hooks/useControl';
2
3
  export * from '../hooks/useMount';
3
4
  export * from '../hooks/useUnmount';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../hooks/useThemeConfig"), exports);
17
18
  __exportStar(require("../hooks/useControl"), exports);
18
19
  __exportStar(require("../hooks/useMount"), exports);
19
20
  __exportStar(require("../hooks/useUnmount"), exports);
@@ -4,7 +4,7 @@ exports.useActiveHeading = void 0;
4
4
  const react_1 = require("react");
5
5
  const react_router_dom_1 = require("react-router-dom");
6
6
  function useActiveHeading(contentElement, displayedHeaders) {
7
- const [heading, setHeading] = (0, react_1.useState)(undefined);
7
+ const [heading, setHeading] = (0, react_1.useState)(displayedHeaders.length > 1 ? displayedHeaders[0] : undefined);
8
8
  const [headingElements, setHeadingElements] = (0, react_1.useState)([]);
9
9
  const headingElementsRef = (0, react_1.useRef)({});
10
10
  const history = (0, react_router_dom_1.useHistory)();
@@ -38,7 +38,7 @@ function useActiveSectionId(location, hasOverviewPage = false) {
38
38
  scrollListener();
39
39
  }, 0);
40
40
  return () => {
41
- window.removeEventListener('scroll', scrollListener); // TODO: add throttle
41
+ window.removeEventListener('scroll', scrollListener);
42
42
  };
43
43
  }, [location, navbarHeight, scrollListener]);
44
44
  return itemId;
@@ -0,0 +1 @@
1
+ export { useThemeConfig } from '../mocks/hooks';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useThemeConfig = void 0;
4
+ var hooks_1 = require("../mocks/hooks");
5
+ Object.defineProperty(exports, "useThemeConfig", { enumerable: true, get: function () { return hooks_1.useThemeConfig; } });
6
+ //# sourceMappingURL=useThemeConfig.js.map
@@ -9,13 +9,13 @@ const styled_components_1 = __importDefault(require("styled-components"));
9
9
  function Icon({ mode, className }) {
10
10
  switch (mode) {
11
11
  case 'dark':
12
- return (react_1.default.createElement("svg", { className: className, "data-testid": "dark", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
12
+ return (react_1.default.createElement("svg", { className: className + ' dark', "data-testid": "dark", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
13
13
  react_1.default.createElement("path", { d: "M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z" })));
14
14
  case 'light':
15
- return (react_1.default.createElement("svg", { "data-testid": "light", className: className, viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
15
+ return (react_1.default.createElement("svg", { "data-testid": "light", className: className + ' light', viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
16
16
  react_1.default.createElement("path", { d: "M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z" })));
17
17
  default:
18
- return (react_1.default.createElement("svg", { "data-testid": "custom", className: className, viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
18
+ return (react_1.default.createElement("svg", { "data-testid": "custom", className: className + (mode ? ' ' + mode : ''), viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg" },
19
19
  react_1.default.createElement("path", { d: "M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm0 13V2a6 6 0 1 1 0 12z" })));
20
20
  }
21
21
  }
package/lib/index.d.ts CHANGED
@@ -17,3 +17,5 @@ export * from './OperationBadge';
17
17
  export * from './TableOfContent';
18
18
  export * from './Profile';
19
19
  export * from './ColorModeSwitcher';
20
+ export * from './types/config';
21
+ export * from './config';
package/lib/index.js CHANGED
@@ -33,4 +33,6 @@ __exportStar(require("./OperationBadge"), exports);
33
33
  __exportStar(require("./TableOfContent"), exports);
34
34
  __exportStar(require("./Profile"), exports);
35
35
  __exportStar(require("./ColorModeSwitcher"), exports);
36
+ __exportStar(require("./types/config"), exports);
37
+ __exportStar(require("./config"), exports);
36
38
  //# sourceMappingURL=index.js.map
package/lib/mocks/Link.js CHANGED
@@ -1,16 +1,26 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.Link = void 0;
7
18
  const react_1 = __importDefault(require("react"));
8
- const lodash_1 = require("lodash");
9
19
  // TODO: use real typings here
10
20
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
11
21
  function Link(props) {
22
+ const { active: _, httpVerb: _1, hasActiveSubItem: _2, routeSlug: _3, external: _4 } = props, filteredProps = __rest(props, ["active", "httpVerb", "hasActiveSubItem", "routeSlug", "external"]);
12
23
  // We omit "active" property to avoid "Warning: Received `false` for a non-boolean attribute `active`."
13
- const filteredProps = (0, lodash_1.omit)(props, ['active', 'httpVerb', 'hasActiveSubItem']);
14
24
  return react_1.default.createElement("a", Object.assign({ href: filteredProps.to }, filteredProps));
15
25
  }
16
26
  exports.Link = Link;
@@ -1,13 +1,10 @@
1
- interface RawTheme {
2
- name: string;
3
- settings?: any;
4
- }
1
+ import type { ThemeUIConfig } from '../../config';
5
2
  interface PageLink {
6
3
  label: string;
7
4
  link: string;
8
5
  type: 'link';
9
6
  }
10
- export declare function useThemeSettings(_: string): RawTheme['settings'];
7
+ export declare function useThemeConfig<T extends Record<string, unknown>>(): T & ThemeUIConfig;
11
8
  export declare function useSidebarSiblingsData(): {
12
9
  nextPage: PageLink | null;
13
10
  prevPage: PageLink | null;