ai-front-base 0.1.0

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 ADDED
@@ -0,0 +1,63 @@
1
+ # AI Front Base
2
+
3
+ 企业级PC端AI组件库
4
+
5
+ ## 🤖 AI开发者必读
6
+
7
+ ### 开发前必读文档(按顺序)
8
+
9
+ 1. **[前端规范](src/standards/README.md)** - 必读,了解命名、代码风格、Git规范
10
+ 2. **[布局规则](src/layouts/README.md)** - 必读,确定业务系统遵守的布局规则
11
+ 3. **[样式主题](src/styles/README.md)** - 必读,选择并配置主题
12
+
13
+ ### 按需阅读
14
+
15
+ 4. **[组件库](src/components/README.md)** - 查看组件列表,按需查看各组件的types.ts了解用法
16
+
17
+ ### AI开发流程
18
+
19
+ **重要:在开发新页面前,AI必须主动完成以下确认步骤**
20
+
21
+ 1. 阅读上述必读文档,了解项目规范
22
+ 2. 根据用户需求,明确以下配置:
23
+ - **布局规则**:政务系统 / 工会系统 / 其他
24
+ - **主题方案**:默认主题 / 自定义主题
25
+ 3. 向用户反馈确认信息,格式如下:
26
+ ```
27
+ 📋 开发配置确认
28
+ - 布局规则:政务系统布局
29
+ - 主题方案:默认主题
30
+
31
+ 请确认以上配置是否正确?
32
+ ```
33
+ 4. 等待用户确认后,再开始页面开发
34
+
35
+ ## 安装
36
+
37
+ ```bash
38
+ npm install ai-front-base
39
+ ```
40
+
41
+ ## 快速开始
42
+
43
+ ```js
44
+ // 1. 引入样式
45
+ import 'ai-front-base/styles'
46
+
47
+ // 2. 引入组件
48
+ import { AiForm, AiTable } from 'ai-front-base'
49
+ ```
50
+
51
+ ## 技术栈
52
+
53
+ - Vue 3 + Composition API
54
+ - Element Plus
55
+ - TypeScript
56
+ - Vite
57
+
58
+ ## 开发
59
+
60
+ ```bash
61
+ pnpm install
62
+ pnpm build
63
+ ```
package/dist/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # AI Front Base
2
+
3
+ 企业级PC端AI组件库
4
+
5
+ ## 🤖 AI开发者必读
6
+
7
+ ### 开发前必读文档(按顺序)
8
+
9
+ 1. **[前端规范](standards/README.md)** - 必读,了解命名、代码风格、Git规范
10
+ 2. **[布局规则](layouts/README.md)** - 必读,确定业务系统遵守的布局规则
11
+ 3. **[样式主题](styles/README.md)** - 必读,选择并配置主题
12
+
13
+ ### 按需阅读
14
+
15
+ 4. **[组件库](components/README.md)** - 查看组件列表,按需查看各组件的types.ts了解用法
16
+
17
+ ### AI开发流程
18
+
19
+ **重要:在开发新页面前,AI必须主动完成以下确认步骤**
20
+
21
+ 1. 阅读上述必读文档,了解项目规范
22
+ 2. 根据用户需求,明确以下配置:
23
+ - **布局规则**:政务系统 / 工会系统 / 其他
24
+ - **主题方案**:默认主题 / 自定义主题
25
+ 3. 向用户反馈确认信息,格式如下:
26
+ ```
27
+ 📋 开发配置确认
28
+ - 布局规则:政务系统布局
29
+ - 主题方案:默认主题
30
+
31
+ 请确认以上配置是否正确?
32
+ ```
33
+ 4. 等待用户确认后,再开始页面开发
34
+
35
+ ## 安装
36
+
37
+ ```bash
38
+ npm install ai-front-base
39
+ ```
40
+
41
+ ## 快速开始
42
+
43
+ ```js
44
+ // 1. 引入样式
45
+ import 'ai-front-base/styles'
46
+
47
+ // 2. 引入组件
48
+ import { AiForm, AiTable } from 'ai-front-base'
49
+ ```
50
+
51
+ ## 技术栈
52
+
53
+ - Vue 3 + Composition API
54
+ - Element Plus
55
+ - TypeScript
56
+ - Vite
57
+
58
+ ## 开发
59
+
60
+ ```bash
61
+ pnpm install
62
+ pnpm build
63
+ ```
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,45 @@
1
+ import { defineComponent as f, computed as h, openBlock as o, createElementBlock as t, withModifiers as V, Fragment as p, renderList as d, createElementVNode as _, toDisplayString as c, withDirectives as s, vModelText as b, vModelSelect as y, createCommentVNode as k } from "vue";
2
+ const g = ["onUpdate:modelValue", "placeholder"], x = ["onUpdate:modelValue"], S = ["value"], M = /* @__PURE__ */ f({
3
+ __name: "index",
4
+ props: {
5
+ config: {},
6
+ modelValue: {}
7
+ },
8
+ emits: ["update:modelValue", "submit"],
9
+ setup(n, { emit: i }) {
10
+ const m = n, u = i, a = h({
11
+ get: () => m.modelValue,
12
+ set: (r) => u("update:modelValue", r)
13
+ }), v = () => u("submit", a.value);
14
+ return (r, U) => (o(), t("form", {
15
+ onSubmit: V(v, ["prevent"])
16
+ }, [
17
+ (o(!0), t(p, null, d(n.config, (e) => (o(), t("div", {
18
+ key: e.prop,
19
+ class: "form-item"
20
+ }, [
21
+ _("label", null, c(e.label), 1),
22
+ e.type === "input" ? s((o(), t("input", {
23
+ key: 0,
24
+ "onUpdate:modelValue": (l) => a.value[e.prop] = l,
25
+ placeholder: e.placeholder
26
+ }, null, 8, g)), [
27
+ [b, a.value[e.prop]]
28
+ ]) : e.type === "select" ? s((o(), t("select", {
29
+ key: 1,
30
+ "onUpdate:modelValue": (l) => a.value[e.prop] = l
31
+ }, [
32
+ (o(!0), t(p, null, d(e.options, (l) => (o(), t("option", {
33
+ key: l.value,
34
+ value: l.value
35
+ }, c(l.label), 9, S))), 128))
36
+ ], 8, x)), [
37
+ [y, a.value[e.prop]]
38
+ ]) : k("", !0)
39
+ ]))), 128))
40
+ ], 32));
41
+ }
42
+ });
43
+ export {
44
+ M as default
45
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * AiForm - 表单组件
3
+ *
4
+ * 用法示例:
5
+ * <AiForm v-model="formData" :config="formConfig" @submit="handleSubmit" />
6
+ *
7
+ * 配置示例:
8
+ * const formConfig = [
9
+ * { prop: 'name', label: '姓名', type: 'input', required: true },
10
+ * { prop: 'age', label: '年龄', type: 'input' },
11
+ * { prop: 'gender', label: '性别', type: 'select', options: [
12
+ * { label: '男', value: 'male' },
13
+ * { label: '女', value: 'female' }
14
+ * ]}
15
+ * ]
16
+ */
17
+
18
+ export interface IFormItem {
19
+ prop: string // 字段名
20
+ label: string // 标签文本
21
+ type: 'input' | 'select' | 'textarea' // 表单项类型
22
+ placeholder?: string // 占位符
23
+ required?: boolean // 是否必填
24
+ options?: Array<{ label: string; value: any }> // select选项
25
+ }
26
+
27
+ export interface IAiFormProps {
28
+ config: IFormItem[] // 表单配置数组
29
+ modelValue: Record<string, any> // 表单数据对象
30
+ }
31
+
32
+ export interface IAiFormEmits {
33
+ (e: 'update:modelValue', value: Record<string, any>): void // 数据更新
34
+ (e: 'submit', value: Record<string, any>): void // 表单提交
35
+ }
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,21 @@
1
+ import { defineComponent as n, openBlock as u, createElementBlock as d } from "vue";
2
+ const r = ["value", "placeholder"], c = /* @__PURE__ */ n({
3
+ __name: "index",
4
+ props: {
5
+ modelValue: {},
6
+ placeholder: {},
7
+ clearable: { type: Boolean, default: !0 }
8
+ },
9
+ emits: ["update:modelValue"],
10
+ setup(e, { emit: t }) {
11
+ const o = t;
12
+ return (p, l) => (u(), d("input", {
13
+ value: e.modelValue,
14
+ placeholder: e.placeholder,
15
+ onInput: l[0] || (l[0] = (a) => o("update:modelValue", a.target.value))
16
+ }, null, 40, r));
17
+ }
18
+ });
19
+ export {
20
+ c as default
21
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * AiInput - 输入框组件
3
+ *
4
+ * 用法示例:
5
+ * <AiInput v-model="value" placeholder="请输入" />
6
+ */
7
+
8
+ export interface IAiInputProps {
9
+ modelValue: string // 输入值
10
+ placeholder?: string // 占位符
11
+ clearable?: boolean // 是否可清空(默认true)
12
+ }
13
+
14
+ export interface IAiInputEmits {
15
+ (e: 'update:modelValue', value: string): void // 值更新事件
16
+ }
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,27 @@
1
+ import { defineComponent as r, openBlock as l, createElementBlock as o, createElementVNode as i, Fragment as d, renderList as m, toDisplayString as s } from "vue";
2
+ const p = ["value"], v = ["value"], V = /* @__PURE__ */ r({
3
+ __name: "index",
4
+ props: {
5
+ modelValue: {},
6
+ options: {},
7
+ clearable: { type: Boolean, default: !0 },
8
+ filterable: { type: Boolean, default: !0 }
9
+ },
10
+ emits: ["update:modelValue"],
11
+ setup(a, { emit: n }) {
12
+ const u = n;
13
+ return (f, t) => (l(), o("select", {
14
+ value: a.modelValue,
15
+ onChange: t[0] || (t[0] = (e) => u("update:modelValue", e.target.value))
16
+ }, [
17
+ t[1] || (t[1] = i("option", { value: "" }, "请选择", -1)),
18
+ (l(!0), o(d, null, m(a.options, (e) => (l(), o("option", {
19
+ key: e.value,
20
+ value: e.value
21
+ }, s(e.label), 9, v))), 128))
22
+ ], 40, p));
23
+ }
24
+ });
25
+ export {
26
+ V as default
27
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * AiSelect - 选择器组件
3
+ *
4
+ * 用法示例:
5
+ * <AiSelect v-model="value" :options="options" />
6
+ *
7
+ * 配置示例:
8
+ * const options = [
9
+ * { label: '选项1', value: 1 },
10
+ * { label: '选项2', value: 2 }
11
+ * ]
12
+ */
13
+
14
+ export interface ISelectOption {
15
+ label: string // 选项文本
16
+ value: any // 选项值
17
+ }
18
+
19
+ export interface IAiSelectProps {
20
+ modelValue: any // 选中值
21
+ options: ISelectOption[] // 选项数组
22
+ clearable?: boolean // 是否可清空(默认true)
23
+ filterable?: boolean // 是否可过滤(默认true)
24
+ }
25
+
26
+ export interface IAiSelectEmits {
27
+ (e: 'update:modelValue', value: any): void // 值更新事件
28
+ }
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,30 @@
1
+ import { defineComponent as i, openBlock as e, createElementBlock as t, createElementVNode as l, Fragment as a, renderList as u, normalizeStyle as m, toDisplayString as d } from "vue";
2
+ const c = { class: "ai-table" }, k = /* @__PURE__ */ i({
3
+ __name: "index",
4
+ props: {
5
+ columns: {},
6
+ data: {}
7
+ },
8
+ setup(r) {
9
+ return (p, y) => (e(), t("table", c, [
10
+ l("thead", null, [
11
+ l("tr", null, [
12
+ (e(!0), t(a, null, u(r.columns, (n) => (e(), t("th", {
13
+ key: n.prop,
14
+ style: m({ width: n.width })
15
+ }, d(n.label), 5))), 128))
16
+ ])
17
+ ]),
18
+ l("tbody", null, [
19
+ (e(!0), t(a, null, u(r.data, (n, s) => (e(), t("tr", { key: s }, [
20
+ (e(!0), t(a, null, u(r.columns, (o) => (e(), t("td", {
21
+ key: o.prop
22
+ }, d(n[o.prop]), 1))), 128))
23
+ ]))), 128))
24
+ ])
25
+ ]));
26
+ }
27
+ });
28
+ export {
29
+ k as default
30
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * AiTable - 表格组件
3
+ *
4
+ * 用法示例:
5
+ * <AiTable :columns="columns" :data="tableData" />
6
+ *
7
+ * 配置示例:
8
+ * const columns = [
9
+ * { prop: 'name', label: '姓名', width: '100px' },
10
+ * { prop: 'age', label: '年龄' },
11
+ * { prop: 'address', label: '地址', width: '200px' }
12
+ * ]
13
+ * const tableData = [
14
+ * { name: '张三', age: 18, address: '北京' }
15
+ * ]
16
+ */
17
+
18
+ export interface ITableColumn {
19
+ prop: string // 列字段名
20
+ label: string // 列标题
21
+ width?: string // 列宽度
22
+ }
23
+
24
+ export interface IAiTableProps {
25
+ columns: ITableColumn[] // 列配置数组
26
+ data: Record<string, any>[] // 表格数据数组
27
+ }
@@ -0,0 +1,63 @@
1
+ # Components组件库
2
+
3
+ AI组件库 - 基于Vue3的可复用组件
4
+
5
+ ## 如何使用组件库
6
+
7
+ ### 步骤1:查看组件列表
8
+ 浏览下方组件列表,找到需要的组件
9
+
10
+ ### 步骤2:查看类型文件
11
+ 点击组件的 `types.ts` 链接,查看:
12
+ - Props定义(组件接收的参数)
13
+ - Emits定义(组件触发的事件)
14
+ - 使用示例代码
15
+
16
+ ### 步骤3:导入使用
17
+ ```vue
18
+ <script setup>
19
+ import { AiForm } from 'ai-front-base'
20
+ </script>
21
+
22
+ <template>
23
+ <AiForm :config="config" v-model="formData" />
24
+ </template>
25
+ ```
26
+
27
+ ## 组件列表
28
+
29
+ ### AiForm - 表单组件
30
+ **适用场景:** 数据录入、编辑页面
31
+
32
+ **特点:** JSON配置驱动,快速构建表单
33
+
34
+ **快速了解:** 查看 [AiForm/types.ts](AiForm/types.ts) 了解配置结构
35
+
36
+ ### AiTable - 表格组件
37
+ **适用场景:** 数据列表展示
38
+
39
+ **特点:** JSON配置列定义
40
+
41
+ **快速了解:** 查看 [AiTable/types.ts](AiTable/types.ts) 了解配置结构
42
+
43
+ ### AiInput - 输入框
44
+ **适用场景:** 文本输入
45
+
46
+ **特点:** 默认可清空
47
+
48
+ **快速了解:** 查看 [AiInput/types.ts](AiInput/types.ts)
49
+
50
+ ### AiSelect - 选择器
51
+ **适用场景:** 下拉选择
52
+
53
+ **特点:** 默认可清空、可过滤
54
+
55
+ **快速了解:** 查看 [AiSelect/types.ts](AiSelect/types.ts)
56
+
57
+ ## AI使用指引
58
+
59
+ **如何快速了解组件?**
60
+
61
+ 1. 查看对应组件的 `types.ts` 文件
62
+ 2. 类型文件包含完整的Props、Emits定义
63
+ 3. 根据类型定义即可知道如何使用
package/dist/index.mjs ADDED
@@ -0,0 +1,10 @@
1
+ import { default as a } from "./components/AiForm/index.vue.mjs";
2
+ import { default as r } from "./components/AiTable/index.vue.mjs";
3
+ import { default as l } from "./components/AiInput/index.vue.mjs";
4
+ import { default as p } from "./components/AiSelect/index.vue.mjs";
5
+ export {
6
+ a as AiForm,
7
+ l as AiInput,
8
+ p as AiSelect,
9
+ r as AiTable
10
+ };
@@ -0,0 +1,23 @@
1
+ # Layouts布局规则
2
+
3
+ AI组件库布局规则库
4
+
5
+ ## 使用
6
+
7
+ ### 确定布局规则(必须)
8
+
9
+ **这是UI/UX的关键前置步骤**,必须先确定业务系统遵守的布局规则:
10
+
11
+ ### 可选布局规则
12
+ - **government** - 政务服务布局规则(详见 [government.md](government.md))**【默认】**
13
+ - **union** - 工会系统布局规则(详见 [union.md](union.md))
14
+
15
+ **默认规则:** 如未指定布局规则,默认使用政务服务布局规则(government)
16
+
17
+ ## 行业布局规则说明
18
+
19
+ 行业布局规则以Markdown格式提供,包含:
20
+ - 场景概述和适用范围
21
+ - 主题配色方案
22
+ - 页面类型的详细布局指导
23
+ - 推荐组件列表
@@ -0,0 +1,78 @@
1
+ # 政务服务布局规则(PC端)
2
+
3
+ ## 场景概述
4
+
5
+ **适用场景**:政务服务平台、行政审批系统、公共服务门户
6
+ **平台**:PC端
7
+ **核心特点**:现代专业、清晰透明、高效便捷
8
+
9
+ ## 颜色方案
10
+
11
+ **默认主题**:`blue`
12
+
13
+ **推荐主题**:
14
+ - `blue` - 蓝色专业主题
15
+ - `minimal` - 极简庄重主题
16
+ - `tech` - 科技创新主题
17
+
18
+ ## 页面类型布局指导
19
+
20
+ ### 1. 列表检索页
21
+
22
+ **布局准则**:
23
+ - 搜索框使用高透明度(0.15-0.2)
24
+ - 列表项使用低透明度(0.05-0.1)
25
+ - 悬停时增加模糊度和透明度
26
+ - 使用细边框(1px)增强层次
27
+
28
+ **推荐组件**:
29
+ - 组件库: `AiSearchBar`, `AiTable`, `AiListItem`
30
+ - 备选: `ElInput`, `ElTable`, `ElCard`
31
+
32
+ ### 2. 详情页
33
+
34
+ **布局准则**:
35
+ - 主卡片使用中等透明度(0.1)
36
+ - 信息分组使用更低透明度(0.05)
37
+ - 重要信息区域增加模糊度(blur 20px)
38
+ - 图片/头像使用圆角+边框
39
+
40
+ **推荐组件**:
41
+ - 组件库: `AiCard`, `AiAvatar`, `AiDescriptions`
42
+ - 备选: `ElCard`, `ElDescriptions`, `ElAvatar`
43
+
44
+ ### 3. 编辑页/表单页
45
+
46
+ **布局准则**:
47
+ - 表单容器使用中等透明度(0.1)
48
+ - 输入框使用低透明度(0.05)
49
+ - 聚焦时增加边框亮度
50
+ - 提交按钮使用实色+玻璃效果叠加
51
+
52
+ **推荐组件**:
53
+ - 组件库: `AiForm`, `AiInput`, `AiButton`
54
+ - 备选: `ElForm`, `ElInput`, `ElButton`
55
+
56
+ ### 4. 看板页/仪表盘
57
+
58
+ **布局准则**:
59
+ - 统计卡片使用渐变背景+玻璃效果
60
+ - 图表容器使用深色透明背景(0.2)
61
+ - 卡片间距适中(16px)
62
+ - 使用彩色边框区分不同数据类型
63
+
64
+ **推荐组件**:
65
+ - 组件库: `AiStatistic`, `AiChart`, `AiGrid`
66
+ - 备选: `ElCard`, `ElStatistic`, `ElRow`/`ElCol`
67
+
68
+ ### 5. 弹窗/对话框
69
+
70
+ **布局准则**:
71
+ - 遮罩层使用深色半透明(0.4-0.6)
72
+ - 弹窗使用高透明度+强模糊(blur 30px)
73
+ - 关闭按钮使用圆形+边框高亮
74
+ - 内容区域可嵌套更低透明度
75
+
76
+ **推荐组件**:
77
+ - 组件库: `AiDialog`, `AiDrawer`, `AiModal`
78
+ - 备选: `ElDialog`, `ElDrawer`
@@ -0,0 +1,78 @@
1
+ # 工会系统布局规则(PC端)
2
+
3
+ ## 场景概述
4
+
5
+ **适用场景**:工会管理系统、职工服务平台、工会活动管理
6
+ **平台**:PC端
7
+ **核心特点**:柔和友好、易用性强、温馨服务导向
8
+
9
+ ## 颜色方案
10
+
11
+ **默认主题**:`light-blue`
12
+
13
+ **推荐主题**:
14
+ - `light-blue` - 浅蓝温馨主题
15
+ - `blue` - 蓝色专业主题
16
+ - `minimal` - 极简清爽主题
17
+
18
+ ## 页面类型布局指导
19
+
20
+ ### 1. 列表检索页
21
+
22
+ **布局准则**:
23
+ - 搜索框使用凹陷效果(inset shadow)
24
+ - 列表项使用轻微凸起效果
25
+ - 筛选按钮组使用分段控制器样式
26
+ - 避免使用传统边框,用阴影区分区域
27
+
28
+ **推荐组件**:
29
+ - 组件库: `AiSearchBar`, `AiListItem`, `AiFilterGroup`
30
+ - 备选: `ElInput`, `ElCard`, `ElSegmented`
31
+
32
+ ### 2. 详情页
33
+
34
+ **布局准则**:
35
+ - 主内容卡片使用大圆角(20-24px)
36
+ - 信息分组使用轻微凸起的卡片
37
+ - 操作按钮使用凸起效果,点击时切换为凹陷
38
+ - 头像/图片使用圆形+双层阴影
39
+
40
+ **推荐组件**:
41
+ - 组件库: `AiCard`, `AiAvatar`, `AiDescriptions`
42
+ - 备选: `ElCard`, `ElDescriptions`, `ElButton`
43
+
44
+ ### 3. 编辑页/表单页
45
+
46
+ **布局准则**:
47
+ - 输入框使用凹陷效果
48
+ - 表单容器使用轻微凸起
49
+ - 提交按钮使用明显凸起,取消按钮使用平面
50
+ - 表单项间距加大(20-24px)
51
+
52
+ **推荐组件**:
53
+ - 组件库: `AiForm`, `AiInput`, `AiButton`
54
+ - 备选: `ElForm`, `ElInput`, `ElButton`
55
+
56
+ ### 4. 看板页/仪表盘
57
+
58
+ **布局准则**:
59
+ - 统计卡片使用中等凸起效果
60
+ - 图表容器使用轻微凹陷(内嵌感)
61
+ - 卡片间距统一(16-20px)
62
+ - 避免过多层级,最多2层阴影
63
+
64
+ **推荐组件**:
65
+ - 组件库: `AiStatistic`, `AiChart`, `AiGrid`
66
+ - 备选: `ElCard`, `ElStatistic`, `ElRow`/`ElCol`
67
+
68
+ ### 5. 弹窗/对话框
69
+
70
+ **布局准则**:
71
+ - 弹窗背景使用主色调
72
+ - 弹窗本身使用强凸起效果
73
+ - 关闭按钮使用圆形凸起
74
+ - 避免使用传统边框和分割线
75
+
76
+ **推荐组件**:
77
+ - 组件库: `AiDialog`, `AiDrawer`, `AiModal`
78
+ - 备选: `ElDialog`, `ElDrawer`
@@ -0,0 +1,103 @@
1
+ # AI前端开发规范
2
+
3
+ ## 命名规范
4
+
5
+ ### 文件命名
6
+ - 组件文件:PascalCase(如 `UserProfile.vue`)
7
+ - 工具文件:camelCase(如 `formatDate.ts`)
8
+ - 样式文件:kebab-case(如 `user-profile.scss`)
9
+
10
+ ### 变量命名
11
+ - 常量:UPPER_SNAKE_CASE(如 `MAX_COUNT`)
12
+ - 变量/函数:camelCase(如 `userName`, `getUserInfo`)
13
+ - 组件名:PascalCase(如 `UserCard`)
14
+ - 布尔值:is/has前缀(如 `isVisible`, `hasPermission`)
15
+
16
+ ## 代码风格
17
+
18
+ ### Prettier配置
19
+ - 无分号
20
+ - 单引号
21
+ - 无尾逗号
22
+ - 缩进:2空格
23
+
24
+ ### ESLint规则
25
+ - 禁止使用var
26
+ - 警告console使用
27
+ - 警告any类型
28
+ - 要求组件名多单词
29
+
30
+ ## Vue开发规范
31
+
32
+ ### 组件结构
33
+ - 使用Composition API
34
+ - script setup优先
35
+ - 单文件组件顺序:template > script > style
36
+
37
+ ### Props定义
38
+ - 必须定义类型
39
+ - 必须设置默认值
40
+ - 使用defineProps
41
+
42
+ ### 事件命名
43
+ - 使用kebab-case(如 `@update-value`)
44
+ - 使用动词开头(如 `@click`, `@change`)
45
+
46
+ ## TypeScript规范
47
+
48
+ ### 类型定义
49
+ - 严格模式开启
50
+ - 避免使用any
51
+ - 接口命名:I前缀(如 `IUser`)
52
+ - 类型命名:T前缀(如 `TStatus`)
53
+
54
+ ### 类型导出
55
+ - 统一在types目录
56
+ - 按模块分文件
57
+
58
+ ## Git提交规范
59
+
60
+ ### 提交格式
61
+ ```
62
+ <type>: <subject>
63
+ ```
64
+
65
+ ### Type类型
66
+ - feat: 新功能
67
+ - fix: 修复bug
68
+ - docs: 文档更新
69
+ - style: 代码格式
70
+ - refactor: 重构
71
+ - test: 测试
72
+ - chore: 构建/工具
73
+
74
+ ## 接口规范
75
+
76
+ ### 请求格式
77
+ ```typescript
78
+ {
79
+ url: string
80
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE'
81
+ params?: object // URL参数
82
+ data?: object // 请求体
83
+ }
84
+ ```
85
+
86
+ ### 响应格式
87
+ ```typescript
88
+ {
89
+ code: number // 200成功,其他失败
90
+ data: any // 业务数据
91
+ message: string // 提示信息
92
+ }
93
+ ```
94
+
95
+ ### 接口命名
96
+ - RESTful风格
97
+ - 使用复数名词(如 `/users`, `/orders`)
98
+ - 动作用HTTP方法表示
99
+
100
+ ## TypeScript
101
+ - 严格模式
102
+ - ES2020目标
103
+ - ESNext模块
@@ -0,0 +1,51 @@
1
+ # Styles样式主题
2
+
3
+ AI组件库样式主题库
4
+
5
+ ## 使用前必读
6
+
7
+ **选择主题是UI开发的第一步**,必须根据业务场景选择并配置合适的主题。
8
+
9
+ ## 可选主题
10
+
11
+ - **blue** - 蓝色专业主题(政务、企业)
12
+ - **light-blue** - 浅蓝温馨主题(工会、服务)
13
+ - **dark** - 深色主题(科技、数据)
14
+
15
+ ## 使用方式
16
+
17
+ **步骤1:引入样式**
18
+ ```js
19
+ import 'ai-front-base/styles'
20
+ ```
21
+
22
+ **默认主题:** `blue`(蓝色专业主题,每个业务系统MUST设置)
23
+
24
+ **步骤2:切换主题(可选)**
25
+ ```vue
26
+ <template>
27
+ <body :data-theme="theme">
28
+ <div>内容</div>
29
+ </body>
30
+ </template>
31
+
32
+ <script setup>
33
+ import { ref } from 'vue'
34
+ const theme = ref('light-blue')
35
+ </script>
36
+ ```
37
+
38
+ **可选主题值:**
39
+ - `blue` - 蓝色专业主题
40
+ - `light-blue` - 浅蓝温馨主题
41
+ - `dark` - 深色主题
42
+
43
+
44
+ ## 主题变量
45
+
46
+ 所有主题提供统一的CSS变量:
47
+ - `--ai-primary` - 主色调
48
+ - `--ai-bg` - 背景色
49
+ - `--ai-text` - 文字色
50
+ - `--ai-border` - 边框色
51
+ - `--ai-radius` - 圆角
@@ -0,0 +1,7 @@
1
+ body[data-theme="blue"] {
2
+ --ai-primary: #1890ff;
3
+ --ai-bg: #ffffff;
4
+ --ai-text: #333333;
5
+ --ai-border: #d9d9d9;
6
+ --ai-radius: 4px;
7
+ }
@@ -0,0 +1,7 @@
1
+ body[data-theme="dark"] {
2
+ --ai-primary: #177ddc;
3
+ --ai-bg: #141414;
4
+ --ai-text: #ffffff;
5
+ --ai-border: #434343;
6
+ --ai-radius: 4px;
7
+ }
@@ -0,0 +1,7 @@
1
+ @import './blue.scss';
2
+ @import './light-blue.scss';
3
+ @import './dark.scss';
4
+
5
+ * {
6
+ box-sizing: border-box;
7
+ }
@@ -0,0 +1,7 @@
1
+ body[data-theme="light-blue"] {
2
+ --ai-primary: #40a9ff;
3
+ --ai-bg: #f0f8ff;
4
+ --ai-text: #595959;
5
+ --ai-border: #d9e9f7;
6
+ --ai-radius: 8px;
7
+ }
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "ai-front-base",
3
+ "version": "0.1.0",
4
+ "description": "企业级PC端AI组件库 - 基于Vue3和Element Plus",
5
+ "license": "ISC",
6
+ "type": "module",
7
+ "main": "./dist/index.mjs",
8
+ "module": "./dist/index.mjs",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.mjs"
12
+ },
13
+ "./styles": "./dist/styles/index.css"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "vite build && node scripts/post-build.mjs",
21
+ "prepublishOnly": "pnpm build"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/zycprivate888/ai-components.git"
26
+ },
27
+ "keywords": [
28
+ "vue3",
29
+ "element-plus",
30
+ "components",
31
+ "ai",
32
+ "typescript",
33
+ "ui-library"
34
+ ],
35
+ "author": "zycprivate888",
36
+ "bugs": {
37
+ "url": "https://github.com/zycprivate888/ai-components/issues"
38
+ },
39
+ "homepage": "https://github.com/zycprivate888/ai-components#readme",
40
+ "peerDependencies": {
41
+ "element-plus": "^2.5.0",
42
+ "vue": "^3.4.0"
43
+ },
44
+ "devDependencies": {
45
+ "@vitejs/plugin-vue": "^5.0.0",
46
+ "element-plus": "^2.5.0",
47
+ "sass": "^1.70.0",
48
+ "typescript": "^5.3.0",
49
+ "unbuild": "^3.6.1",
50
+ "vite": "^5.0.0",
51
+ "vite-plugin-dts": "^4.5.4",
52
+ "vue": "^3.4.0",
53
+ "vue-tsc": "^1.8.0"
54
+ }
55
+ }