@mintlify/validation 0.1.905 → 0.1.907
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/editor-navigation/conversion/docsjson-to-tree.js +13 -0
- package/dist/editor-navigation/conversion/tree-to-docsjson.js +7 -2
- package/dist/editor-navigation/types.d.ts +8 -2
- package/dist/editor-navigation/types.js +1 -1
- package/dist/mint-config/schemas/v2/index.d.ts +26 -26376
- package/dist/mint-config/schemas/v2/properties/navigation/divisionNav.d.ts +2 -1
- package/dist/mint-config/schemas/v2/properties/navigation/index.d.ts +4 -4
- package/dist/mint-config/schemas/v2/properties/navigation/pages.d.ts +8 -2
- package/dist/mint-config/schemas/v2/properties/navigation/pages.js +12 -2
- package/dist/mint-config/schemas/v2/themes/almond.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/aspen.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/linden.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/luma.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/maple.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/mint.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/palm.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/reusable/index.d.ts +4 -4
- package/dist/mint-config/schemas/v2/themes/sequoia.d.ts +6 -6
- package/dist/mint-config/schemas/v2/themes/willow.d.ts +6 -6
- package/dist/mint-config/validateConfig.d.ts +18 -18
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import traverse from 'neotraverse';
|
|
2
|
+
import { navigationLinkSchema } from '../../mint-config/schemas/v2/properties/navigation/pages.js';
|
|
2
3
|
import { compareNodes, generateKeyBetween, generateNKeysBetween } from '../order.js';
|
|
3
4
|
import { isGlobalNode } from '../schema.js';
|
|
4
5
|
import { createIdGenerator, isProductConfig, isLanguageConfig, isVersionConfig, isTabConfig, isMenuItemConfig, isDropdownConfig, isAnchorConfig, isGroupConfig, readSdkConfig, } from './common.js';
|
|
@@ -350,6 +351,18 @@ export function docsConfigToNavigationTree(navigation) {
|
|
|
350
351
|
return;
|
|
351
352
|
}
|
|
352
353
|
if (parentKey === 'pages') {
|
|
354
|
+
const link = navigationLinkSchema.safeParse(value);
|
|
355
|
+
if (link.success) {
|
|
356
|
+
nodes.push({
|
|
357
|
+
id: generateId(),
|
|
358
|
+
parent: currentParent.id,
|
|
359
|
+
order: getNextOrder(currentParent.id),
|
|
360
|
+
type: 'link',
|
|
361
|
+
text: link.data.title,
|
|
362
|
+
data: { title: link.data.title, href: link.data.href },
|
|
363
|
+
});
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
353
366
|
if (typeof value === 'string') {
|
|
354
367
|
const nodeId = generateId();
|
|
355
368
|
const text = value.split('/').pop() || value;
|
|
@@ -22,6 +22,9 @@ function nodesToPages(nodes, childrenMap) {
|
|
|
22
22
|
}
|
|
23
23
|
return Object.assign(Object.assign({}, baseConfig), { group: node.data.group, pages: nodesToPages(groupChildren, childrenMap) });
|
|
24
24
|
}
|
|
25
|
+
if (node.type === 'link') {
|
|
26
|
+
return { type: 'link', title: node.data.title, href: node.data.href };
|
|
27
|
+
}
|
|
25
28
|
if (node.type === 'page') {
|
|
26
29
|
return node.data.href;
|
|
27
30
|
}
|
|
@@ -109,11 +112,12 @@ function buildChildNavigation(node, childrenMap) {
|
|
|
109
112
|
if (firstChild.data.fromPages) {
|
|
110
113
|
return { pages: nodesToPages(children, childrenMap) };
|
|
111
114
|
}
|
|
112
|
-
const hasPageSibling = children.some((child) => child.type === 'page');
|
|
115
|
+
const hasPageSibling = children.some((child) => child.type === 'page' || child.type === 'link');
|
|
113
116
|
if (hasPageSibling) {
|
|
114
117
|
return { pages: nodesToPages(children, childrenMap) };
|
|
115
118
|
}
|
|
116
119
|
return { groups: nodesToGroups(children, childrenMap) };
|
|
120
|
+
case 'link':
|
|
117
121
|
case 'page':
|
|
118
122
|
return { pages: nodesToPages(children, childrenMap) };
|
|
119
123
|
default:
|
|
@@ -252,7 +256,7 @@ export function navigationTreeToDocsConfig(tree) {
|
|
|
252
256
|
result = { anchors: nodesToAnchors(rootRegularChildren, childrenMap) };
|
|
253
257
|
break;
|
|
254
258
|
case 'group': {
|
|
255
|
-
const hasPageSibling = rootRegularChildren.some((child) => child.type === 'page');
|
|
259
|
+
const hasPageSibling = rootRegularChildren.some((child) => child.type === 'page' || child.type === 'link');
|
|
256
260
|
if (hasPageSibling || firstChild.data.fromPages) {
|
|
257
261
|
result = { pages: nodesToPages(rootRegularChildren, childrenMap) };
|
|
258
262
|
}
|
|
@@ -261,6 +265,7 @@ export function navigationTreeToDocsConfig(tree) {
|
|
|
261
265
|
}
|
|
262
266
|
break;
|
|
263
267
|
}
|
|
268
|
+
case 'link':
|
|
264
269
|
case 'page':
|
|
265
270
|
result = { pages: nodesToPages(rootRegularChildren, childrenMap) };
|
|
266
271
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconType } from '@mintlify/models';
|
|
2
2
|
import { DecoratedPageConfig, BaseDropdownSchema, BaseLanguageSchema, BaseProductSchema, BaseTabSchema, BaseVersionSchema, BaseGroupSchema, BaseAnchorSchema, MenuItemConfig, AsyncApiConfig, OpenApiConfig, IconConfig, SdkConfig, ThumbnailOverride, type DivisionType } from '../mint-config/schemas/v2/properties/index.js';
|
|
3
3
|
export { DIVISION_TYPES, type DivisionType } from '../mint-config/schemas/v2/properties/index.js';
|
|
4
|
-
export declare const CONTENT_TYPES: readonly ["page", "group"];
|
|
4
|
+
export declare const CONTENT_TYPES: readonly ["page", "group", "link"];
|
|
5
5
|
export declare const FILESYSTEM_TYPES: readonly ["file", "file_directory"];
|
|
6
6
|
export type ContentType = (typeof CONTENT_TYPES)[number];
|
|
7
7
|
export type FilesystemType = (typeof FILESYSTEM_TYPES)[number];
|
|
@@ -65,6 +65,12 @@ export interface GroupNode extends BaseNavigationNode<Omit<BaseGroupSchema, 'sdk
|
|
|
65
65
|
}> {
|
|
66
66
|
type: 'group';
|
|
67
67
|
}
|
|
68
|
+
export interface LinkNode extends BaseNavigationNode<{
|
|
69
|
+
title: string;
|
|
70
|
+
href: string;
|
|
71
|
+
}> {
|
|
72
|
+
type: 'link';
|
|
73
|
+
}
|
|
68
74
|
export interface PageNode extends BaseNavigationNode<DecoratedPageConfig & {
|
|
69
75
|
pageId?: string;
|
|
70
76
|
ogImageUrl?: string;
|
|
@@ -92,7 +98,7 @@ export interface FileDirectoryNode extends BaseNavigationNode<{
|
|
|
92
98
|
}
|
|
93
99
|
export type DivisionNode = DropdownNode | VersionNode | LanguageNode | TabNode | ProductNode | AnchorNode | MenuItemNode;
|
|
94
100
|
export type FilesystemNode = FileNode | FileDirectoryNode;
|
|
95
|
-
export type NavigationNode = DivisionNode | GroupNode | PageNode | FilesystemNode;
|
|
101
|
+
export type NavigationNode = DivisionNode | GroupNode | LinkNode | PageNode | FilesystemNode;
|
|
96
102
|
export type NavigationTree = NavigationNode[];
|
|
97
103
|
export type NodeDataUpdates = {
|
|
98
104
|
title?: DecoratedPageConfig['title'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DIVISION_TYPES } from '../mint-config/schemas/v2/properties/index.js';
|
|
2
|
-
export const CONTENT_TYPES = ['page', 'group'];
|
|
2
|
+
export const CONTENT_TYPES = ['page', 'group', 'link'];
|
|
3
3
|
export const FILESYSTEM_TYPES = ['file', 'file_directory'];
|
|
4
4
|
export const ROOT_NODE = 'root';
|
|
5
5
|
export const PAGE_ROLES = ['viewer', 'editor', 'manager'];
|