@redocly/theme 0.6.1 → 0.6.2

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 CHANGED
@@ -1 +1 @@
1
- For more details, contact team@redocly.com
1
+ For more details, contact team@redocly.com.
@@ -18,7 +18,7 @@ export interface NavItem {
18
18
  target?: string;
19
19
  external?: boolean;
20
20
  items?: NavItem[];
21
- permission?: string;
21
+ requiredPermission?: string;
22
22
  menuStyle?: MenuStyle;
23
23
  separatorLine?: boolean;
24
24
  version?: string;
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.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>]>, "many">>;
53
- postBodyScripts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>]>, "many">>;
54
- stylesheets: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodBoolean, z.ZodString]>>]>, "many">>;
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?: (string | Record<string, string | boolean>)[] | undefined;
263
- postBodyScripts?: (string | Record<string, string | boolean>)[] | undefined;
264
- stylesheets?: (string | Record<string, string | boolean>)[] | undefined;
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?: (string | Record<string, string | boolean>)[] | undefined;
333
- postBodyScripts?: (string | Record<string, string | boolean>)[] | undefined;
334
- stylesheets?: (string | Record<string, string | boolean>)[] | undefined;
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' | 'styles' | 'scripts' | 'postBodyScripts'> & {
644
+ export declare type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 'scripts'> & {
385
645
  navbar?: any;
386
646
  footer?: any;
387
647
  auth?: {
388
- idpIds?: string[];
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
- .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()]))]))
38
- .optional(),
39
- postBodyScripts: zod_1.z
40
- .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()]))]))
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Shared UI components",
5
5
  "author": "team@redocly.com",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -19,7 +19,7 @@ export interface NavItem {
19
19
  target?: string;
20
20
  external?: boolean;
21
21
  items?: NavItem[];
22
- permission?: string;
22
+ requiredPermission?: string;
23
23
  menuStyle?: MenuStyle;
24
24
  separatorLine?: boolean;
25
25
  version?: string;
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
- .array(z.union([z.string(), z.record(z.union([z.boolean(), z.string()]))]))
41
- .optional(),
42
- postBodyScripts: z
43
- .array(z.union([z.string(), z.record(z.union([z.boolean(), z.string()]))]))
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
- idpIds?: string[];
172
+ idpsInfo?: {
173
+ idpId: string;
174
+ type: string; // AuthProviderType
175
+ title: string | undefined;
176
+ }[];
141
177
  devLogin?: boolean;
142
178
  };
143
179
  };
@@ -80,7 +80,6 @@ export declare type UserData = {
80
80
  isAuthorized: boolean;
81
81
  name: string;
82
82
  picture: string;
83
- logoutDisabled?: boolean;
84
83
  };
85
84
  export interface PageData {
86
85
  templateId: string;