# @hkyhy/marsun-components-core 中文文档

规范地址：https://npmcn.com/package/%40hkyhy/marsun-components-core/

版本：0\.1\.144
npm 元数据更新时间：2026-11-01T07:23:29.251Z
中文译文更新时间：2026-11-01T08:34:41.611Z
软件包许可：未声明

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40hkyhy/marsun-components-core
原文对照：https://npmcn.com/package/%40hkyhy/marsun-components-core/?lang=original
项目主页：https://hkyhy.github.io/MARSUN_components-core/
源码仓库：https://github.com/hkyhy/MARSUN_components-core

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：5.7 MB，1749 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：33 个
- peer 依赖：antd ^6\.0\.0，axios ^1\.7\.0，dayjs ^1\.11\.0，react ^19\.0\.0，react-dom ^19\.0\.0，react-router-dom ^6\.28\.0 \|\| ^7\.0\.0，@ant-design/charts ^2\.6\.0
- 首次发布：2026-06-26T10:00:37.225Z
- 最新版本发布：2026-11-01T07:23:28.944Z
- 已发布版本数：101（近 12 个月 101 个）

## 中文简介

Marsun纯UI组件库

## 安装

```sh
npm install @hkyhy/marsun-components-core
```

也可以使用：`pnpm add @hkyhy/marsun-components-core`、`yarn add @hkyhy/marsun-components-core`、`bun add @hkyhy/marsun-components-core`

## README

# @hkyhy / marsun-components-core

马森公司（react19 +和6）。从 `maoyang_data-asset-system` Common / AgentHub；**不含业务数据**。

[![CI](https://github.com/hkyhy/MARSUN_components-core/actions/workflows/ci.yml/badge.svg)](https://github.com/hkyhy/MARSUN_components-core/actions/workflows/ci.yml) [![GitHub Pages](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://hkyhy.github.io/MARSUN_components-core/)

**远程仓库**：`git@github.com:hkyhy/MARSUN_components-core.git`

**演奏厅**: https://hkyhy.github.io/MARSUN\_components-core/

## 安装

```bash
npm install @hkyhy/marsun-components-core antd react react-dom
```

> 发布至 [npm](https://www.npmjs.com/package/@hkyhy/marsun-components-core)(GitHub秘密 `HKYHY_PACKAGE_PUBLISH` +标签 `v*` 触发，见「发布版本」）。

## 快速开始

```tsx
import '@hkyhy/marsun-components-core/styles';
import '@hkyhy/marsun-components-core/tokens';

import {
  MarsunCoreProvider,
  SemanticTag,
  ChatPanel,
  SessionSidebar,
  applyThemeToCssVariables,
  generateTheme,
} from '@hkyhy/marsun-components-core';

const primaryColor = '#1677ff';
applyThemeToCssVariables(primaryColor);

<MarsunCoreProvider
  auth={{
    isAuthenticated: true,
    hasPermission: (p) => permissions.includes(p),
    hasAnyRole: (roles) => roles.some((r) => userRoles.includes(r)),
  }}
  fetch={{ baseUrl: '/api', headers: { Authorization: `Bearer ${token}` } }}
  primaryColor={primaryColor}
  themeConfig={generateTheme(primaryColor)}
>
  <SemanticTag color="primary">标签</SemanticTag>
  <ChatPanel messages={[]} inputValue="" onInputChange={() => {}} onSend={() => {}} />
</MarsunCoreProvider>;
```

### Token

| 导入路径 | 用途 |
| --- | --- |
| `@hkyhy/marsun-components-core/tokens` | 【中文翻译】 |
| `@hkyhy/marsun-components-core/theme` | `generateTheme`， `applyThemeToCssVariables`， `PALETTE`， `LAYOUT_TOKENS` |
| `@hkyhy/marsun-components-core/styles` | 组件库打包样式 |

### （v0.1.53+）

agthub / File / Llm：

| 导入路径 | 用途 |
| --- | --- |
| `@hkyhy/marsun-components-core/agent-hub` | 聊天，知识，引文，代理，ub守卫 |
| `@hkyhy/marsun-components-core/file` | FilePreview, FileItem， FileLink等 |
| `@hkyhy/marsun-components-core/llm` | LlmFormattedText |

再出口2级 `@deprecated`）；新代码请用子路径。

### 布局(v0.1.57 +)

`AgentAppShell` 中文名称：；`UserProfileCard` / brand / brand叠

> 0.1.54/0.1.55全类型检查；**0.1.57** PermissionBindPanel

### HTTP (v0.1.58 +)

`createMarsunRequest`：马森；`getResponseError`；`passThroughEnvelopeError`。**0.1.60** `isMarsunEnvelope`（拒绝 `{code:200,results}` )+ FormData . JSON Content-Type。

项目可在 `src/styles/tokens.css` 展示；展示；展示 `frontend-dev-spec` → `theme.md`。

## 设计原则

-   **零业务依赖**：无 `departmentPath`、`personOption` 等领域工具；`transformData` 由消费方实现
-   **双模式数据**:道具传 `data`/`treeData`/`options` 优先；或 `fetchUrl` + `transformData`
-   **也许吧**：`display` / `hidden` / `disabled` 等支持 `boolean | (ctx) => boolean`
-   **模拟**：各组件 `doc/*.mock.json`NPM展示

## 目录

```
src/components/
  Auth/ Filter/ Form/ File/ Tag/ Icons/ ...   # Common 拍平
  AgentHub/                                    # Chat + KnowledgeBase
```

## Dev

```bash
npm install
npm run dev              # 本地 showcase :5175
npm run build            # 库产物 dist/
npm run build:showcase   # 静态 showcase → dist-showcase/（GitHub Pages）
npm run preview:showcase # 预览 showcase 构建结果
npm run typecheck
```

### GitHub页面

**部署金融时报404**:说明仓库尚未启用页面,按下列步骤操作(仅需一次):

1.  打开 [https://github.com/hkyhy/MARSUN\_components-core/settings/pages](https://github.com/hkyhy/MARSUN_components-core/settings/pages)
2.  **构建和部署→源代码** 选择 **GitHub的行为**（从分支部署）
3.  保存后，到 **操作→部署GitHub页面→重新运行所有作业**

-   推送 `main` 后由 `.github/workflows/pages.yml` 自动部署
-   基准路径：`/MARSUN_components-core/`
-   【翻译】`VITE_BASE_PATH=/MARSUN_components-core/ npm run build:showcase && npm run preview:showcase`

### （npm）

包名为 **`@hkyhy/marsun-components-core`**(npm scope . GitHub `hkyhy` 对齐）。

1.  ★★★★★★★★ **设置→秘密→操作** 配置 `HKYHY_PACKAGE_PUBLISH`npm自动化令牌 `@hkyhy` 【翻译】
2.  **顺号**：日常 `package.json` = NPM最新 `npm pack` **不要**磕碰。发版前 `node scripts/version-check.mjs --apply`(= npm + 1;**0.1.98**）
3.  **发版**2 . push push push push `chore(release): vX.Y.Z …` 的提交;`release.yml` →标签→ `npm publish`（www.zuezu.com）

```bash
# 当前 npm latest=0.1.98 时
node scripts/version-check.mjs --apply   # → 0.1.99
# 再 commit chore(release): v0.1.99 … 并 push main
```

动作 **发布npm**1、中文：

-   2026-10-29：`v0.1.141` - InboxBell标签，标签，标签 `#f8fbff`（npm publish）
    
-   2026-10-29：`v0.1.140` -表：http://www.chinac.chinac.com/ `fixed` 【中文翻译
    
-   2026-10-23：`v0.1.138` - CreateActionForm:`allocatorDisabled` / `defaultAssigneeUserId`(相关s3 - 1523)
    
-   2026-10-22：`v0.1.137` - InboxBell:`action_assigned_ack` ；相关S3-1721
    
-   2026-10-21：`v0.1.136` —messagcenter `levelOptions`（l1 / l2 / l3; s3 l2 +）
    
-   2026-10-16：`v0.1.135` — 新建跟踪任务分配人/执行人必填星与任务类型同为 `is-req`（去掉 `marsun-form-info-is-req`）
    
-   2026-10-14：`v0.1.134` -收件铃抽屉 `markAllRead`;演示/急速地
    
-   2026-10-12：`v0.1.133` ——DispositionBar短徽章;模板来源标签;ActionList去壳/铃铛摘要色;执行门禁SSOT;轻快地外部子路径防双反应(壮举分支曾误标0.1.135未进,顺号回正)
    
-   2026-10-11：`v0.1.132` - 0.1.131 CI
    
-   2026-10-11：`v0.1.131` -中国生物科技有限公司（中国生物科技有限公司）
    
-   2026-10-11：`v0.1.130` - InboxBell `selected` 标签：标签：标签：标签
    
-   2026-10-10：`v0.1.129` - InboxBell吐司 `createPortal` 渲.（蚂蚁通知）
    
-   2026-10-09：`v0.1.124` - CreateAction FormInfo DatePicker . scopeMode=none（token token）
    
-   2026-09-23：`v0.1.122` ——ActionListTable默认scrollX对齐长状态列(0.1.121已发后补发)
    

## 毛阳

【中文】 `maoyang_data-asset-system` 批量替换：

```ts
import { SemanticTag, FetchTreeSelect } from '@hkyhy/marsun-components-core';
// 业务 wrapper 留在 maoyang
import { DepartmentSelect } from '@/components/Common/Form/DepartmentSelect';
```

## 常见问题

### @hkyhy/marsun-components-core 是什么？

Marsun纯UI组件库

### 如何安装 @hkyhy/marsun-components-core？

在项目目录运行 npm install @hkyhy/marsun-components-core，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：antd（^6\.0\.0）、axios（^1\.7\.0）、dayjs（^1\.11\.0）、react（^19\.0\.0）、react-dom（^19\.0\.0）、react-router-dom（^6\.28\.0 \|\| ^7\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @hkyhy/marsun-components-core 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @hkyhy/marsun-components-core 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @hkyhy/marsun-components-core 可以商用吗？

@hkyhy/marsun-components-core 使用 未声明 许可。package\.json 没有声明许可证。没有许可证的代码默认保留全部权利，商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括，不构成法律意见，请以许可原文为准。

### @hkyhy/marsun-components-core 还在维护吗？

最新版本 0\.1\.144 发布于 2026/11/01（2 天前）；至今共发布 101 个版本，其中过去 12 个月发布了 101 个；首次发布于 2026/06/26。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

