395 lines
8.7 KiB
TypeScript
395 lines
8.7 KiB
TypeScript
/** Local manifest in pinned HeroUI meta.json order. Only real Vue pages belong here.
|
||
* Sidebar, overview, breadcrumbs, previous/next and tests share this data. */
|
||
export interface DocsItem {
|
||
title: string;
|
||
url: string;
|
||
category?: string;
|
||
}
|
||
export interface DocsGroup {
|
||
title: string;
|
||
items: DocsItem[];
|
||
}
|
||
export const componentItems: DocsItem[] = [
|
||
{
|
||
title: "Accordion 手风琴",
|
||
url: "/components/accordion",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "Alert 警告",
|
||
url: "/components/alert",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "AlertDialog 警告对话框",
|
||
url: "/components/alert-dialog",
|
||
category: "overlays",
|
||
},
|
||
{
|
||
title: "Autocomplete 自动完成",
|
||
url: "/components/autocomplete",
|
||
category: "pickers",
|
||
},
|
||
{
|
||
title: "Avatar 头像",
|
||
url: "/components/avatar",
|
||
category: "media",
|
||
},
|
||
{
|
||
title: "AvatarGroup 头像组",
|
||
url: "/components/avatar-group",
|
||
category: "media",
|
||
},
|
||
{
|
||
title: "Badge 徽章",
|
||
url: "/components/badge",
|
||
category: "data-display",
|
||
},
|
||
{
|
||
title: "Breadcrumbs 面包屑",
|
||
url: "/components/breadcrumbs",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "Button 按钮",
|
||
url: "/components/button",
|
||
category: "buttons",
|
||
},
|
||
{
|
||
title: "ButtonGroup 按钮组",
|
||
url: "/components/button-group",
|
||
category: "buttons",
|
||
},
|
||
{
|
||
title: "Calendar 日历",
|
||
url: "/components/calendar",
|
||
category: "date-and-time",
|
||
},
|
||
{
|
||
title: "Card 卡片",
|
||
url: "/components/card",
|
||
category: "layout",
|
||
},
|
||
{
|
||
title: "Checkbox 复选框",
|
||
url: "/components/checkbox",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "CheckboxGroup 复选框组",
|
||
url: "/components/checkbox-group",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Chip 标签",
|
||
url: "/components/chip",
|
||
category: "data-display",
|
||
},
|
||
{
|
||
title: "CloseButton 关闭按钮",
|
||
url: "/components/close-button",
|
||
category: "buttons",
|
||
},
|
||
{
|
||
title: "ColorSwatch 颜色色块",
|
||
url: "/components/color-swatch",
|
||
category: "colors",
|
||
},
|
||
{
|
||
title: "ComboBox 组合框",
|
||
url: "/components/combo-box",
|
||
category: "pickers",
|
||
},
|
||
{
|
||
title: "DateField 日期字段",
|
||
url: "/components/date-field",
|
||
category: "date-and-time",
|
||
},
|
||
{
|
||
title: "Description 描述",
|
||
url: "/components/description",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Disclosure 折叠面板",
|
||
url: "/components/disclosure",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "DisclosureGroup 折叠面板组",
|
||
url: "/components/disclosure-group",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "Drawer 抽屉",
|
||
url: "/components/drawer",
|
||
category: "overlays",
|
||
},
|
||
{
|
||
title: "EmptyState 空状态",
|
||
url: "/components/empty-state",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "ErrorMessage 错误消息",
|
||
url: "/components/error-message",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "FieldError 字段错误",
|
||
url: "/components/field-error",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Fieldset 字段组",
|
||
url: "/components/fieldset",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Header 标题",
|
||
url: "/components/header",
|
||
category: "typography",
|
||
},
|
||
{
|
||
title: "Input 输入框",
|
||
url: "/components/input",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "InputGroup 输入框组",
|
||
url: "/components/input-group",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "InputOTP 验证码输入",
|
||
url: "/components/input-otp",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Kbd 键盘按键",
|
||
url: "/components/kbd",
|
||
category: "typography",
|
||
},
|
||
{
|
||
title: "Label 标签",
|
||
url: "/components/label",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Link 链接",
|
||
url: "/components/link",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "Dropdown 下拉菜单",
|
||
url: "/components/dropdown",
|
||
category: "collections",
|
||
},
|
||
{
|
||
title: "ListBox 列表框",
|
||
url: "/components/list-box",
|
||
category: "collections",
|
||
},
|
||
{
|
||
title: "Meter 计量条",
|
||
url: "/components/meter",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "Modal 模态框",
|
||
url: "/components/modal",
|
||
category: "overlays",
|
||
},
|
||
{
|
||
title: "NumberField 数字输入框",
|
||
url: "/components/number-field",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Pagination 分页",
|
||
url: "/components/pagination",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "Popover 弹出框",
|
||
url: "/components/popover",
|
||
category: "overlays",
|
||
},
|
||
{
|
||
title: "ProgressBar 进度条",
|
||
url: "/components/progress-bar",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "ProgressCircle 环形进度条",
|
||
url: "/components/progress-circle",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "RadioGroup 单选框组",
|
||
url: "/components/radio-group",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "ScrollShadow 滚动阴影",
|
||
url: "/components/scroll-shadow",
|
||
category: "utilities",
|
||
},
|
||
{
|
||
title: "SearchField 搜索框",
|
||
url: "/components/search-field",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Select 选择器",
|
||
url: "/components/select",
|
||
category: "pickers",
|
||
},
|
||
{
|
||
title: "Separator 分隔符",
|
||
url: "/components/separator",
|
||
category: "layout",
|
||
},
|
||
{
|
||
title: "Skeleton 骨架屏",
|
||
url: "/components/skeleton",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "Slider 滑块",
|
||
url: "/components/slider",
|
||
category: "controls",
|
||
},
|
||
{
|
||
title: "Spinner 加载指示器",
|
||
url: "/components/spinner",
|
||
category: "feedback",
|
||
},
|
||
{
|
||
title: "Surface 表面",
|
||
url: "/components/surface",
|
||
category: "layout",
|
||
},
|
||
{
|
||
title: "Switch 开关",
|
||
url: "/components/switch",
|
||
category: "controls",
|
||
},
|
||
{
|
||
title: "Table 表格",
|
||
url: "/components/table",
|
||
category: "data-display",
|
||
},
|
||
{
|
||
title: "Tabs 标签页",
|
||
url: "/components/tabs",
|
||
category: "navigation",
|
||
},
|
||
{
|
||
title: "TagGroup 标签组",
|
||
url: "/components/tag-group",
|
||
category: "collections",
|
||
},
|
||
{
|
||
title: "TextArea 多行文本框",
|
||
url: "/components/textarea",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "TextField 文本输入框",
|
||
url: "/components/text-field",
|
||
category: "forms",
|
||
},
|
||
{
|
||
title: "Toast 轻提示",
|
||
url: "/components/toast",
|
||
category: "overlays",
|
||
},
|
||
{
|
||
title: "ToggleButton 切换按钮",
|
||
url: "/components/toggle-button",
|
||
category: "buttons",
|
||
},
|
||
{
|
||
title: "ToggleButtonGroup 切换按钮组",
|
||
url: "/components/toggle-button-group",
|
||
category: "buttons",
|
||
},
|
||
{
|
||
title: "Toolbar 工具栏",
|
||
url: "/components/toolbar",
|
||
category: "layout",
|
||
},
|
||
{
|
||
title: "Tooltip 工具提示",
|
||
url: "/components/tooltip",
|
||
category: "overlays",
|
||
},
|
||
{
|
||
title: "Typography 排版",
|
||
url: "/components/typography",
|
||
category: "typography",
|
||
},
|
||
];
|
||
export const guideGroups: DocsGroup[] = [
|
||
{
|
||
title: "概述",
|
||
items: [
|
||
{ title: "介绍", url: "/introduction" },
|
||
{ title: "快速开始", url: "/guide" },
|
||
],
|
||
},
|
||
{
|
||
title: "手册",
|
||
items: [
|
||
{ title: "主题", url: "/themes" },
|
||
{ title: "字段与表单基础", url: "/fields" },
|
||
],
|
||
},
|
||
];
|
||
export const componentGroups: DocsGroup[] = [
|
||
{ title: "概述", items: [{ title: "所有组件(Vue)", url: "/components" }] },
|
||
{ title: "组件", items: componentItems },
|
||
];
|
||
export const categories = [
|
||
["buttons", "按钮"],
|
||
["collections", "集合"],
|
||
["colors", "颜色"],
|
||
["controls", "控件"],
|
||
["data-display", "数据展示"],
|
||
["date-and-time", "日期与时间"],
|
||
["feedback", "反馈"],
|
||
["forms", "表单"],
|
||
["layout", "布局"],
|
||
["media", "媒体"],
|
||
["navigation", "导航"],
|
||
["overlays", "浮层"],
|
||
["pickers", "选择器"],
|
||
["typography", "排版"],
|
||
["utilities", "工具"],
|
||
] as const;
|
||
export function docsPath(path: string, base = "/") {
|
||
let value = path.split(/[?#]/)[0];
|
||
if (base !== "/" && value === base.replace(/\/$/, "")) value = "/";
|
||
if (base !== "/" && value.startsWith(base))
|
||
value = "/" + value.slice(base.length);
|
||
value = value.replace(/\.html$/, "").replace(/\/$/, "");
|
||
return !value || value === "/index" ? "/introduction" : value;
|
||
}
|
||
export function docsSection(path: string, base = "/"): "guide" | "components" {
|
||
const normalized = docsPath(path, base);
|
||
return normalized === "/components" || normalized.startsWith("/components/")
|
||
? "components"
|
||
: "guide";
|
||
}
|
||
export function adjacentPages(path: string, base = "/") {
|
||
const groups =
|
||
docsSection(path, base) === "components" ? componentGroups : guideGroups;
|
||
const items = groups.flatMap((group) => group.items);
|
||
const index = items.findIndex((item) => item.url === docsPath(path, base));
|
||
return {
|
||
previous: index > 0 ? items[index - 1] : undefined,
|
||
next: index >= 0 ? items[index + 1] : undefined,
|
||
};
|
||
}
|