@mintlify/validation 0.1.120 → 0.1.122
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/dist/index.d.ts +333 -8
- package/dist/index.js +18 -54
- package/dist/mint-config/flattenNavigationVersions.d.ts +2 -0
- package/dist/mint-config/flattenNavigationVersions.js +10 -0
- package/dist/mint-config/refinements/refineMissingVersions.d.ts +6 -0
- package/dist/mint-config/refinements/refineMissingVersions.js +13 -0
- package/dist/mint-config/schemas/anchorColors.js +5 -20
- package/dist/mint-config/schemas/anchors.d.ts +4 -4
- package/dist/mint-config/schemas/colors.js +6 -25
- package/dist/mint-config/schemas/config.d.ts +16 -11
- package/dist/mint-config/schemas/config.js +1 -1
- package/dist/mint-config/schemas/hexColor.d.ts +2 -0
- package/dist/mint-config/schemas/hexColor.js +5 -0
- package/dist/mint-config/schemas/navigation.d.ts +2 -2
- package/dist/mint-config/schemas/tabs.d.ts +3 -0
- package/dist/mint-config/schemas/tabs.js +5 -0
- package/dist/mint-config/warnings/aggregateWarnings.d.ts +4 -0
- package/dist/mint-config/warnings/aggregateWarnings.js +4 -0
- package/dist/mint-config/warnings/warnAnchorUrls.d.ts +2 -0
- package/dist/mint-config/warnings/warnAnchorUrls.js +20 -0
- package/dist/mint-config/warnings/warnUnusedVersions.d.ts +2 -0
- package/dist/mint-config/warnings/warnUnusedVersions.js +17 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/any.d.ts +0 -20
- package/dist/any.js +0 -27
- package/dist/mint-config/common.d.ts +0 -6
- package/dist/mint-config/common.js +0 -7
- package/dist/mint-config/hexadecimalPattern.d.ts +0 -1
- package/dist/mint-config/hexadecimalPattern.js +0 -1
- package/dist/mint-config/validateAnchorsWarnings.d.ts +0 -3
- package/dist/mint-config/validateAnchorsWarnings.js +0 -35
- package/dist/mint-config/validateVersionsInNavigation.d.ts +0 -4
- package/dist/mint-config/validateVersionsInNavigation.js +0 -52
- package/dist/sort.d.ts +0 -47
- package/dist/sort.js +0 -72
- package/dist/sortable/Sortable.d.ts +0 -28
- package/dist/sortable/Sortable.js +0 -117
- package/dist/sortable/isSortable.d.ts +0 -2
- package/dist/sortable/isSortable.js +0 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,337 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
export declare function validateMintConfig(value: unknown): import("zod").SafeParseError<{
|
|
2
|
+
navigation: import("@mintlify/models").NavigationGroup[];
|
|
3
|
+
name: string;
|
|
4
|
+
favicon: string;
|
|
5
|
+
colors: {
|
|
6
|
+
primary: string;
|
|
7
|
+
light?: string | undefined;
|
|
8
|
+
dark?: string | undefined;
|
|
9
|
+
background?: {
|
|
10
|
+
light?: string | undefined;
|
|
11
|
+
dark?: string | undefined;
|
|
12
|
+
} | undefined;
|
|
13
|
+
anchors?: string | {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
via?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
ultraLight?: any;
|
|
19
|
+
ultraDark?: any;
|
|
20
|
+
};
|
|
21
|
+
$schema?: string | undefined;
|
|
22
|
+
mintlify?: string | undefined;
|
|
23
|
+
logo?: string | {
|
|
24
|
+
light: string;
|
|
25
|
+
dark: string;
|
|
26
|
+
href?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
openapi?: string | string[] | undefined;
|
|
29
|
+
api?: {
|
|
30
|
+
baseUrl?: string | string[] | undefined;
|
|
31
|
+
auth?: {
|
|
32
|
+
method?: "bearer" | "basic" | "key" | "cobo" | undefined;
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
inputPrefix?: string | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
playground?: {
|
|
37
|
+
mode?: "show" | "simple" | "hide" | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
request?: {
|
|
40
|
+
example?: {
|
|
41
|
+
showOptionalParams?: boolean | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
maintainOrder?: boolean | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
modeToggle?: {
|
|
47
|
+
default?: "light" | "dark" | undefined;
|
|
48
|
+
isHidden?: boolean | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
versions?: (string | {
|
|
51
|
+
name: string;
|
|
52
|
+
url: string;
|
|
53
|
+
})[] | undefined;
|
|
54
|
+
metadata?: Record<string, string> | undefined;
|
|
55
|
+
topbarCtaButton?: {
|
|
56
|
+
name: string;
|
|
57
|
+
url: string;
|
|
58
|
+
type?: "link" | undefined;
|
|
59
|
+
} | {
|
|
60
|
+
type: "github";
|
|
61
|
+
url: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
topbarLinks?: ({
|
|
64
|
+
name: string;
|
|
65
|
+
url: string;
|
|
66
|
+
type?: "link" | undefined;
|
|
67
|
+
} | {
|
|
68
|
+
type: "github";
|
|
69
|
+
url: string;
|
|
70
|
+
})[] | undefined;
|
|
71
|
+
primaryTab?: {
|
|
72
|
+
name: string;
|
|
73
|
+
} | undefined;
|
|
74
|
+
topAnchor?: {
|
|
75
|
+
name: string;
|
|
76
|
+
icon?: string | undefined;
|
|
77
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
anchors?: {
|
|
80
|
+
name: string;
|
|
81
|
+
url: string;
|
|
82
|
+
icon?: string | undefined;
|
|
83
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
84
|
+
color?: string | {
|
|
85
|
+
from: string;
|
|
86
|
+
to: string;
|
|
87
|
+
via?: string | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
isDefaultHidden?: boolean | undefined;
|
|
90
|
+
version?: string | undefined;
|
|
91
|
+
}[] | undefined;
|
|
92
|
+
tabs?: {
|
|
93
|
+
name: string;
|
|
94
|
+
url: string;
|
|
95
|
+
version?: string | undefined;
|
|
96
|
+
}[] | undefined;
|
|
97
|
+
footerSocials?: {
|
|
98
|
+
type: string;
|
|
99
|
+
url: string;
|
|
100
|
+
}[] | Record<string, string> | undefined;
|
|
101
|
+
backgroundImage?: string | undefined;
|
|
102
|
+
feedback?: {
|
|
103
|
+
thumbsRating?: boolean | undefined;
|
|
104
|
+
suggestEdit?: boolean | undefined;
|
|
105
|
+
raiseIssue?: boolean | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
analytics?: {
|
|
108
|
+
amplitude?: {
|
|
109
|
+
apiKey: string;
|
|
110
|
+
} | undefined;
|
|
111
|
+
clearbit?: {
|
|
112
|
+
publicApiKey: string;
|
|
113
|
+
} | undefined;
|
|
114
|
+
fathom?: {
|
|
115
|
+
siteId: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
ga4?: {
|
|
118
|
+
measurementId: string;
|
|
119
|
+
} | undefined;
|
|
120
|
+
gtm?: {
|
|
121
|
+
tagId: string;
|
|
122
|
+
} | undefined;
|
|
123
|
+
hotjar?: {
|
|
124
|
+
hjid: string;
|
|
125
|
+
hjsv: string;
|
|
126
|
+
} | undefined;
|
|
127
|
+
koala?: {
|
|
128
|
+
publicApiKey: string;
|
|
129
|
+
} | undefined;
|
|
130
|
+
logrocket?: {
|
|
131
|
+
appId: string;
|
|
132
|
+
} | undefined;
|
|
133
|
+
mixpanel?: {
|
|
134
|
+
projectToken: string;
|
|
135
|
+
} | undefined;
|
|
136
|
+
pirsch?: {
|
|
137
|
+
id: string;
|
|
138
|
+
} | undefined;
|
|
139
|
+
posthog?: {
|
|
140
|
+
apiKey: string;
|
|
141
|
+
apiHost?: string | undefined;
|
|
142
|
+
} | undefined;
|
|
143
|
+
plausible?: {
|
|
144
|
+
domain: string;
|
|
145
|
+
} | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
integrations?: {
|
|
148
|
+
intercom?: string | undefined;
|
|
149
|
+
frontchat?: string | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
isWhiteLabeled?: boolean | undefined;
|
|
152
|
+
search?: {
|
|
153
|
+
prompt?: string | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
redirects?: {
|
|
156
|
+
source: string;
|
|
157
|
+
destination: string;
|
|
158
|
+
}[] | undefined;
|
|
159
|
+
seo?: {
|
|
160
|
+
indexHiddenPages?: boolean | undefined;
|
|
161
|
+
} | undefined;
|
|
162
|
+
}> | {
|
|
163
|
+
warnings: import("zod").ZodIssue[];
|
|
164
|
+
success: true;
|
|
165
|
+
data: {
|
|
166
|
+
navigation: import("@mintlify/models").NavigationGroup[];
|
|
167
|
+
name: string;
|
|
168
|
+
$schema: string;
|
|
169
|
+
favicon: string;
|
|
170
|
+
colors: {
|
|
171
|
+
primary: string;
|
|
172
|
+
light?: string | undefined;
|
|
173
|
+
dark?: string | undefined;
|
|
174
|
+
background?: {
|
|
175
|
+
light?: string | undefined;
|
|
176
|
+
dark?: string | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
anchors?: string | {
|
|
179
|
+
from: string;
|
|
180
|
+
to: string;
|
|
181
|
+
via?: string | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
ultraLight?: any;
|
|
184
|
+
ultraDark?: any;
|
|
185
|
+
};
|
|
186
|
+
mintlify?: string | undefined;
|
|
187
|
+
logo?: string | {
|
|
188
|
+
light: string;
|
|
189
|
+
dark: string;
|
|
190
|
+
href?: string | undefined;
|
|
191
|
+
} | undefined;
|
|
192
|
+
openapi?: string | string[] | undefined;
|
|
193
|
+
api?: {
|
|
194
|
+
baseUrl?: string | string[] | undefined;
|
|
195
|
+
auth?: {
|
|
196
|
+
method?: "bearer" | "basic" | "key" | "cobo" | undefined;
|
|
197
|
+
name?: string | undefined;
|
|
198
|
+
inputPrefix?: string | undefined;
|
|
199
|
+
} | undefined;
|
|
200
|
+
playground?: {
|
|
201
|
+
mode: "show" | "simple" | "hide";
|
|
202
|
+
} | undefined;
|
|
203
|
+
request?: {
|
|
204
|
+
example?: {
|
|
205
|
+
showOptionalParams: boolean;
|
|
206
|
+
} | undefined;
|
|
207
|
+
} | undefined;
|
|
208
|
+
maintainOrder?: boolean | undefined;
|
|
209
|
+
} | undefined;
|
|
210
|
+
modeToggle?: {
|
|
211
|
+
default?: "light" | "dark" | undefined;
|
|
212
|
+
isHidden?: boolean | undefined;
|
|
213
|
+
} | undefined;
|
|
214
|
+
versions?: (string | {
|
|
215
|
+
name: string;
|
|
216
|
+
url: string;
|
|
217
|
+
})[] | undefined;
|
|
218
|
+
metadata?: Record<string, string> | undefined;
|
|
219
|
+
topbarCtaButton?: {
|
|
220
|
+
name: string;
|
|
221
|
+
url: string;
|
|
222
|
+
type?: "link" | undefined;
|
|
223
|
+
} | {
|
|
224
|
+
type: "github";
|
|
225
|
+
url: string;
|
|
226
|
+
} | undefined;
|
|
227
|
+
topbarLinks?: ({
|
|
228
|
+
name: string;
|
|
229
|
+
url: string;
|
|
230
|
+
type?: "link" | undefined;
|
|
231
|
+
} | {
|
|
232
|
+
type: "github";
|
|
233
|
+
url: string;
|
|
234
|
+
})[] | undefined;
|
|
235
|
+
primaryTab?: {
|
|
236
|
+
name: string;
|
|
237
|
+
} | undefined;
|
|
238
|
+
topAnchor?: {
|
|
239
|
+
name: string;
|
|
240
|
+
icon?: string | undefined;
|
|
241
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
242
|
+
} | undefined;
|
|
243
|
+
anchors?: {
|
|
244
|
+
name: string;
|
|
245
|
+
url: string;
|
|
246
|
+
icon?: string | undefined;
|
|
247
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
248
|
+
color?: string | {
|
|
249
|
+
from: string;
|
|
250
|
+
to: string;
|
|
251
|
+
via?: string | undefined;
|
|
252
|
+
} | undefined;
|
|
253
|
+
isDefaultHidden?: boolean | undefined;
|
|
254
|
+
version?: string | undefined;
|
|
255
|
+
}[] | undefined;
|
|
256
|
+
tabs?: {
|
|
257
|
+
name: string;
|
|
258
|
+
url: string;
|
|
259
|
+
version?: string | undefined;
|
|
260
|
+
}[] | undefined;
|
|
261
|
+
footerSocials?: {
|
|
262
|
+
type: string;
|
|
263
|
+
url: string;
|
|
264
|
+
}[] | Record<string, string> | undefined;
|
|
265
|
+
backgroundImage?: string | undefined;
|
|
266
|
+
feedback?: {
|
|
267
|
+
thumbsRating?: boolean | undefined;
|
|
268
|
+
suggestEdit?: boolean | undefined;
|
|
269
|
+
raiseIssue?: boolean | undefined;
|
|
270
|
+
} | undefined;
|
|
271
|
+
analytics?: {
|
|
272
|
+
amplitude?: {
|
|
273
|
+
apiKey: string;
|
|
274
|
+
} | undefined;
|
|
275
|
+
clearbit?: {
|
|
276
|
+
publicApiKey: string;
|
|
277
|
+
} | undefined;
|
|
278
|
+
fathom?: {
|
|
279
|
+
siteId: string;
|
|
280
|
+
} | undefined;
|
|
281
|
+
ga4?: {
|
|
282
|
+
measurementId: string;
|
|
283
|
+
} | undefined;
|
|
284
|
+
gtm?: {
|
|
285
|
+
tagId: string;
|
|
286
|
+
} | undefined;
|
|
287
|
+
hotjar?: {
|
|
288
|
+
hjid: string;
|
|
289
|
+
hjsv: string;
|
|
290
|
+
} | undefined;
|
|
291
|
+
koala?: {
|
|
292
|
+
publicApiKey: string;
|
|
293
|
+
} | undefined;
|
|
294
|
+
logrocket?: {
|
|
295
|
+
appId: string;
|
|
296
|
+
} | undefined;
|
|
297
|
+
mixpanel?: {
|
|
298
|
+
projectToken: string;
|
|
299
|
+
} | undefined;
|
|
300
|
+
pirsch?: {
|
|
301
|
+
id: string;
|
|
302
|
+
} | undefined;
|
|
303
|
+
posthog?: {
|
|
304
|
+
apiKey: string;
|
|
305
|
+
apiHost?: string | undefined;
|
|
306
|
+
} | undefined;
|
|
307
|
+
plausible?: {
|
|
308
|
+
domain: string;
|
|
309
|
+
} | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
integrations?: {
|
|
312
|
+
intercom?: string | undefined;
|
|
313
|
+
frontchat?: string | undefined;
|
|
314
|
+
} | undefined;
|
|
315
|
+
isWhiteLabeled?: boolean | undefined;
|
|
316
|
+
search?: {
|
|
317
|
+
prompt?: string | undefined;
|
|
318
|
+
} | undefined;
|
|
319
|
+
redirects?: {
|
|
320
|
+
source: string;
|
|
321
|
+
destination: string;
|
|
322
|
+
}[] | undefined;
|
|
323
|
+
seo?: {
|
|
324
|
+
indexHiddenPages?: boolean | undefined;
|
|
325
|
+
} | undefined;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
4
328
|
export * from './openapi/types/endpoint.js';
|
|
5
329
|
export { OpenApiToEndpointConverter } from './openapi/OpenApiToEndpointConverter.js';
|
|
6
330
|
export { SchemaConverter } from './openapi/SchemaConverter.js';
|
|
7
331
|
export { generateExampleFromSchema } from './openapi/generateExampleFromSchema.js';
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
332
|
+
export declare const mintConfigJsonSchema: import("zod-to-json-schema/src/parseDef.js").JsonSchema7Type & {
|
|
333
|
+
$schema?: string | undefined;
|
|
334
|
+
definitions?: {
|
|
335
|
+
[key: string]: import("zod-to-json-schema/src/parseDef.js").JsonSchema7Type;
|
|
336
|
+
} | undefined;
|
|
337
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,61 +1,25 @@
|
|
|
1
1
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
results.status = 'error';
|
|
13
|
-
return results;
|
|
14
|
-
}
|
|
15
|
-
// Specific warnings and errors
|
|
16
|
-
const validateAnchorsWarningResult = validateAnchorsWarnings(config.anchors, config.navigation);
|
|
17
|
-
const validateVersionsInNavigationResult = validateVersionsInNavigation(config.navigation, (_a = config.versions) !== null && _a !== void 0 ? _a : []);
|
|
18
|
-
results.errors = [...results.errors, ...validateVersionsInNavigationResult.errors];
|
|
19
|
-
results.warnings = [
|
|
20
|
-
...results.warnings,
|
|
21
|
-
...validateVersionsInNavigationResult.warnings,
|
|
22
|
-
...validateAnchorsWarningResult.warnings,
|
|
23
|
-
];
|
|
24
|
-
// Global check
|
|
25
|
-
const validateConfigResult = configSchema.safeParse(config);
|
|
26
|
-
if (validateConfigResult.success == false) {
|
|
27
|
-
const errors = validateConfigResult.error.issues;
|
|
28
|
-
errors.forEach((e) => {
|
|
29
|
-
var _a;
|
|
30
|
-
if (e.code === 'invalid_union' && ((_a = e.unionErrors) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
31
|
-
results.errors.push(...flattenUnionErrorMessages(e.unionErrors));
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
let message = e.message;
|
|
35
|
-
// Fallback if we forget to set a required_error
|
|
36
|
-
if (message === 'Required') {
|
|
37
|
-
message = 'Missing required field: ' + e.path.join('.');
|
|
38
|
-
}
|
|
39
|
-
results.errors.push(message);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
results.status = results.errors.length ? 'error' : 'success';
|
|
44
|
-
return results;
|
|
2
|
+
import { refineMissingVersions } from './mint-config/refinements/refineMissingVersions.js';
|
|
3
|
+
import { colorsSchema } from './mint-config/schemas/colors.js';
|
|
4
|
+
import { mintConfigSchema } from './mint-config/schemas/config.js';
|
|
5
|
+
import { aggregateWarnings } from './mint-config/warnings/aggregateWarnings.js';
|
|
6
|
+
export function validateMintConfig(value) {
|
|
7
|
+
const refinedSchema = mintConfigSchema.superRefine(refineMissingVersions);
|
|
8
|
+
const validationResults = refinedSchema.safeParse(value);
|
|
9
|
+
if (!validationResults.success)
|
|
10
|
+
return validationResults;
|
|
11
|
+
return Object.assign(Object.assign({}, validationResults), { warnings: aggregateWarnings(validationResults.data) });
|
|
45
12
|
}
|
|
46
13
|
export * from './openapi/types/endpoint.js';
|
|
47
14
|
export { OpenApiToEndpointConverter } from './openapi/OpenApiToEndpointConverter.js';
|
|
48
15
|
export { SchemaConverter } from './openapi/SchemaConverter.js';
|
|
49
16
|
export { generateExampleFromSchema } from './openapi/generateExampleFromSchema.js';
|
|
50
|
-
export const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
17
|
+
export const mintConfigJsonSchema = (() => {
|
|
18
|
+
const cleanedSchema = mintConfigSchema.extend({
|
|
19
|
+
colors: colorsSchema.omit({
|
|
20
|
+
ultraDark: true,
|
|
21
|
+
ultraLight: true,
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
return zodToJsonSchema(cleanedSchema, 'Schema');
|
|
57
25
|
})();
|
|
58
|
-
export { sort } from './sort.js';
|
|
59
|
-
export { Sortable } from './sortable/Sortable.js';
|
|
60
|
-
export { any } from './any.js';
|
|
61
|
-
export { isSortable } from './sortable/isSortable.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function flattenNavigationVersions(nav) {
|
|
2
|
+
return nav.flatMap((val) => {
|
|
3
|
+
if (typeof val === 'string')
|
|
4
|
+
return [];
|
|
5
|
+
const versions = flattenNavigationVersions(val.pages);
|
|
6
|
+
if (val.version !== undefined)
|
|
7
|
+
versions.push(val.version);
|
|
8
|
+
return versions;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { flattenNavigationVersions } from '../flattenNavigationVersions.js';
|
|
3
|
+
export function refineMissingVersions({ navigation, versions = [], }, ctx) {
|
|
4
|
+
const versionsFromNavigation = flattenNavigationVersions(navigation);
|
|
5
|
+
versionsFromNavigation.forEach((v) => {
|
|
6
|
+
if (!versions.includes(v)) {
|
|
7
|
+
ctx.addIssue({
|
|
8
|
+
code: z.ZodIssueCode.custom,
|
|
9
|
+
message: `Version ${v} is not included in the versions array, but is used in the navigation. Please add ${v} to the versions array.`,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { hexColor } from './hexColor.js';
|
|
3
3
|
export const gradientSchema = z.object({
|
|
4
|
-
from:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
.regex(hexadecimalPattern, 'Anchor color.from must be a hexadecimal color.'),
|
|
9
|
-
via: z
|
|
10
|
-
.string({
|
|
11
|
-
invalid_type_error: 'Anchor color.via must be a string.',
|
|
12
|
-
})
|
|
13
|
-
.regex(hexadecimalPattern, 'Anchor color.via must be undefined or a hexadecimal color.')
|
|
14
|
-
.optional(),
|
|
15
|
-
to: z
|
|
16
|
-
.string({
|
|
17
|
-
invalid_type_error: 'Anchor color.to must be a string.',
|
|
18
|
-
})
|
|
19
|
-
.regex(hexadecimalPattern, 'Anchor color.to must be a hexadecimal color.'),
|
|
4
|
+
from: hexColor('Anchor color.from'),
|
|
5
|
+
via: hexColor('Anchor color.via').optional(),
|
|
6
|
+
to: hexColor('Anchor color.to'),
|
|
20
7
|
});
|
|
21
8
|
export const anchorColorSchema = z.union([
|
|
22
|
-
|
|
23
|
-
.string({ invalid_type_error: 'Anchor color must be a string.' })
|
|
24
|
-
.regex(hexadecimalPattern, 'Anchor color must be a hexadecimal color.'),
|
|
9
|
+
hexColor('Anchor color'),
|
|
25
10
|
gradientSchema.strict('Anchors with gradient colors can only have properties from, via, and to with valid hexadecimal colors.'),
|
|
26
11
|
], {
|
|
27
12
|
invalid_type_error: 'Anchor color must be a string or an object with from and to properties.',
|
|
@@ -23,7 +23,7 @@ export declare const anchorSchema: z.ZodObject<{
|
|
|
23
23
|
name: string;
|
|
24
24
|
url: string;
|
|
25
25
|
icon?: string | undefined;
|
|
26
|
-
iconType?: "
|
|
26
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
27
27
|
color?: string | {
|
|
28
28
|
from: string;
|
|
29
29
|
to: string;
|
|
@@ -35,7 +35,7 @@ export declare const anchorSchema: z.ZodObject<{
|
|
|
35
35
|
name: string;
|
|
36
36
|
url: string;
|
|
37
37
|
icon?: string | undefined;
|
|
38
|
-
iconType?: "
|
|
38
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
39
39
|
color?: string | {
|
|
40
40
|
from: string;
|
|
41
41
|
to: string;
|
|
@@ -51,9 +51,9 @@ export declare const topAnchorSchema: z.ZodObject<{
|
|
|
51
51
|
}, "strict", z.ZodTypeAny, {
|
|
52
52
|
name: string;
|
|
53
53
|
icon?: string | undefined;
|
|
54
|
-
iconType?: "
|
|
54
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
55
55
|
}, {
|
|
56
56
|
name: string;
|
|
57
57
|
icon?: string | undefined;
|
|
58
|
-
iconType?: "
|
|
58
|
+
iconType?: "light" | "brands" | "duotone" | "regular" | "sharp-solid" | "solid" | "thin" | undefined;
|
|
59
59
|
}>;
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { hexadecimalPattern } from '../hexadecimalPattern.js';
|
|
3
2
|
import { anchorColorSchema } from './anchorColors.js';
|
|
3
|
+
import { hexColor } from './hexColor.js';
|
|
4
4
|
export const colorsSchema = z
|
|
5
5
|
.object({
|
|
6
|
-
primary:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.regex(hexadecimalPattern, 'Primary color must be a hexadecimal color including the # at the start.'),
|
|
10
|
-
light: z
|
|
11
|
-
.string({ invalid_type_error: 'Light color must be a string.' })
|
|
12
|
-
.regex(hexadecimalPattern, 'Light color must be a hexadecimal color including the # at the start.')
|
|
13
|
-
.optional(),
|
|
14
|
-
dark: z
|
|
15
|
-
.string({ invalid_type_error: 'Dark color must be a string.' })
|
|
16
|
-
.regex(hexadecimalPattern, 'Dark color must be a hexadecimal color including the # at the start.')
|
|
17
|
-
.optional(),
|
|
6
|
+
primary: hexColor('Primary color'),
|
|
7
|
+
light: hexColor('Light color').optional(),
|
|
8
|
+
dark: hexColor('Dark color').optional(),
|
|
18
9
|
background: z
|
|
19
10
|
.object({
|
|
20
|
-
light:
|
|
21
|
-
|
|
22
|
-
invalid_type_error: 'Background light color must be a string.',
|
|
23
|
-
})
|
|
24
|
-
.regex(hexadecimalPattern, 'Background light color must be a hexadecimal color including the # at the start.')
|
|
25
|
-
.optional(),
|
|
26
|
-
dark: z
|
|
27
|
-
.string({
|
|
28
|
-
invalid_type_error: 'Background dark color must be a string.',
|
|
29
|
-
})
|
|
30
|
-
.regex(hexadecimalPattern, 'Background dark color must be a hexadecimal color including the # at the start.')
|
|
31
|
-
.optional(),
|
|
11
|
+
light: hexColor('Background light color').optional(),
|
|
12
|
+
dark: hexColor('Background dark color').optional(),
|
|
32
13
|
})
|
|
33
14
|
.optional(),
|
|
34
15
|
anchors: anchorColorSchema.optional(),
|