@tongfun/ui 0.0.0-alpha.3 → 0.0.1-alpha.10

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.
Files changed (36) hide show
  1. package/README.md +110 -0
  2. package/dist/agent-schema/index.d.ts +12 -0
  3. package/dist/agent-schema/index.js +33 -0
  4. package/dist/agent-schema/types.d.ts +27 -0
  5. package/dist/formula/index.d.ts +17 -0
  6. package/dist/formula/types.d.ts +136 -0
  7. package/dist/html2canvas.esm-Bfw1xMTR.js +4886 -0
  8. package/dist/index-C0rb4BPV.js +482 -0
  9. package/dist/index-Ci3-2oB_.js +323459 -0
  10. package/dist/index.d.ts +719 -0
  11. package/dist/index.es-CoCAKfeh.js +5790 -0
  12. package/dist/index.js +842 -0
  13. package/dist/jspdf.es.min-B9-wXZ_S.js +10769 -0
  14. package/dist/lowcode-agent/icons.d.ts +12 -0
  15. package/dist/lowcode-agent/icons.js +229 -0
  16. package/dist/lowcode-agent/index.d.ts +27 -0
  17. package/dist/lowcode-agent/index.js +79577 -0
  18. package/dist/lowcode-agent/types.d.ts +471 -0
  19. package/dist/skill/golden-examples/dashboard-workbench.md +224 -0
  20. package/dist/skill/golden-examples/form-create.md +227 -0
  21. package/dist/skill/golden-examples/management-list.md +264 -0
  22. package/dist/skill/golden-examples/new-document.md +748 -0
  23. package/dist/skill/tongfun-ui-skill.json +470 -0
  24. package/dist/skill/tongfun-ui-skill.md +297 -0
  25. package/dist/style.css +10 -0
  26. package/package.json +113 -38
  27. package/Button/button-props.d.ts +0 -9
  28. package/Button/button-variants.d.ts +0 -5
  29. package/Button/index.d.ts +0 -20
  30. package/Button/index.js +0 -111
  31. package/index.css +0 -596
  32. package/index.d.ts +0 -15
  33. package/index.js +0 -19
  34. package/utils/forward-attrs.d.ts +0 -6
  35. package/utils/install.d.ts +0 -6
  36. package/utils/utils.d.ts +0 -2
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # Tongfang UI Kit - 砼方云鲲鹏基础前端组件库
2
+
3
+ > 面向砼方云鲲鹏产品的基础前端组件库,为低代码拖拽生成页面提供通用、参数化、可配置的 UI / 表单 / 布局 / AI 增强能力。
4
+
5
+ ## 项目定位
6
+
7
+ | 层级 | 定位 | 复用范围 |
8
+ |------|------|----------|
9
+ | 组件库 | 砼方云鲲鹏产品基础前端组件库 | 鲲鹏产品与低代码搭建场景 |
10
+ | 低代码基础设施 | 拖拽生成页面的组件物料与元数据 | Playground 演示、业务页面搭建、`lowcode-agent` 消费 |
11
+
12
+ 核心原则:组件必须通用、参数化、可配置,不服务单一页面硬编码;业务差异通过 props、slots、composables、Design Tokens 和低代码元数据表达。
13
+
14
+ ## 技术栈
15
+
16
+ | 类别 | 选型 | 说明 |
17
+ |------|------|------|
18
+ | 框架 | Vue 3 + TypeScript | 与鲲鹏产品前端技术栈对齐 |
19
+ | 构建工具 | Vite 5 | 组件库与 Playground 构建 |
20
+ | 样式方案 | Tailwind CSS + CSS Variables / Design Tokens | 原子化样式 + 可配置主题令牌 |
21
+ | 单元测试 | Vitest + @vue/test-utils | 组件与 composables 稳定性保障 |
22
+ | 文档/演示 | Playground (Vite) | 组件演示、开发沙箱、低代码验证入口 |
23
+ | 低代码元数据 | `@tongfun/ui/lowcode-agent` | 独立入口导出组件注册表,供低代码/AI 生成链路消费 |
24
+
25
+ ## 当前规模(扫描口径)
26
+
27
+ - 约 **90+ 组件/模块**:包含表单体系、通用 UI、布局、导航、AI 增强组件与 composables。
28
+ - 约 **70+ Playground 演示路由/页面**:用于组件示例、组合场景和低代码物料验证。
29
+ - 组件数量会随扫描口径变化,文档避免使用固定旧口径。
30
+
31
+ ## 安装与使用
32
+
33
+ ```ts
34
+ import { TfButton, useAiStateMachine } from '@tongfun/ui'
35
+ import '@tongfun/ui/style.css'
36
+ import registry from '@tongfun/ui/lowcode-agent'
37
+
38
+ console.log(registry.components)
39
+ ```
40
+
41
+ ```vue
42
+ <template>
43
+ <TfButton type="primary">提交</TfButton>
44
+ </template>
45
+ ```
46
+
47
+ ## 目录结构
48
+
49
+ ```
50
+ tongfang-ui-kit/
51
+ ├── packages/
52
+ │ └── ui/
53
+ │ ├── components/ # 约 90+ 组件/模块(当前扫描口径)
54
+ │ │ ├── form/ # 表单核心、基础控件、复合项、容器
55
+ │ │ ├── layout/ # 页面、网格、分栏、侧栏等布局组件
56
+ │ │ ├── ai-overlay/ # 字段级 AI 浮层
57
+ │ │ ├── form-ai-status/# 表单级 AI 状态汇总
58
+ │ │ ├── form-ai-toolbar/# 表单级 AI 工具栏
59
+ │ │ └── ai-state-flow/ # AI 状态流程可视化
60
+ │ ├── src/ # composables + 共享类型
61
+ │ ├── lowcode-agent/ # 低代码/AI 生成元数据独立入口
62
+ │ ├── styles/ # Tailwind + Design Tokens
63
+ │ └── index.ts
64
+ ├── playground/ # 约 70+ 演示路由/页面
65
+ ├── docs/ # 项目文档与扫描分析
66
+ ├── scripts/ # 构建/发布脚本
67
+ └── package.json
68
+ ```
69
+
70
+ ## AI 增强能力
71
+
72
+ AI API 按基础控件、复合表单项、表单级编排分为三层,完整协议见 [docs/ai-api-layering.md](docs/ai-api-layering.md)。核心边界:基础控件使用 `ai?: AiConfig`,复合表单项使用 `ai?: boolean` + resolver/prompt 等字段级 props,表单级 AI 通过 toolbar/status/registry 聚合编排。
73
+
74
+ | 层级 | 模块 | 职责 |
75
+ |------|------|------|
76
+ | 基础控件 AI | `TfInput` / `TfTextArea` / `TfSelect` 等 | 独立控件 AI,API 为 `ai?: AiConfig`,仅对象形态启用;不接收 FormItem/FormField 的 boolean `ai` 透传。 |
77
+ | 字段级 AI | `useAiStateMachine` / `useFormAi` / `TfAiOverlay` | 字段旁触发 AI 生成、识别、检查、润色、翻译等动作,resolver 由业务注入,组件不绑定具体模型或业务接口。 |
78
+ | 表单级 AI | `TfFormAiToolbar` / `TfFormAiStatus` / `useFormAiRegistry` | 通过 Registry 聚合字段状态,支持一键识别、批量应用、确认、检查、拒绝等表单级操作。 |
79
+ | 可视化 | `TfAiStateFlow` | 展示 AI 状态流转,便于演示、调试与解释生成过程。 |
80
+ | 低代码/AI 元数据 | `@tongfun/ui/lowcode-agent` | 独立入口导出组件注册表,描述组件、props、slots、AI 能力和容器关系。 |
81
+
82
+ 顶层导出包含 `useAiStateMachine`、`useFormAi`、`useFormAiRegistry`,可按需在业务或低代码运行时中直接引用。
83
+
84
+ 字段级示例:
85
+
86
+ ```vue
87
+ <TfFormInput
88
+ v-model="form.title"
89
+ label="标题"
90
+ ai
91
+ :ai-resolver="callAiApi"
92
+ ai-prompt="改写为正式公文风格"
93
+ />
94
+ ```
95
+
96
+ ## 开发原则
97
+
98
+ 1. **通用优先**:组件面向低代码拖拽生成页面,避免为单一页面写死结构、文案或数据。
99
+ 2. **参数化配置**:业务差异优先通过 props、slots、事件、composables 和 Design Tokens 表达。
100
+ 3. **类型优先**:全量 TypeScript,公开 API 尽量提供类型定义。
101
+ 4. **主题可定制**:Tailwind CSS 与 CSS Variables / Design Tokens 协同,支持品牌与场景定制。
102
+ 5. **AI 解耦**:AI 能力只定义交互、状态和扩展点,真实推理通过 resolver / registry / lowcode-agent 注入。
103
+
104
+ ## 当前能力概览
105
+
106
+ - 基础 UI、表单、布局、导航、反馈、数据展示等组件物料。
107
+ - 表单字段级 AI 与表单级 AI Toolbar / Status / Registry。
108
+ - `AiOverlay`、`AiStateFlow`、`useAiStateMachine` 等 AI 交互基础设施。
109
+ - `lowcode-agent` 独立入口,为低代码拖拽与 AI 生成页面提供组件元数据。
110
+ - Playground 覆盖约 70+ 演示路由/页面,用于验证组件用法与组合能力。
@@ -0,0 +1,12 @@
1
+ import type { TongfunAgentSchema, TongfunAgentSchemaComponent } from './types'
2
+
3
+ export declare const tongfunAgentSchema: TongfunAgentSchema
4
+
5
+ export declare const documentFormShellAgentSchema: TongfunAgentSchemaComponent | undefined
6
+
7
+ export default tongfunAgentSchema
8
+
9
+ export type {
10
+ TongfunAgentSchema,
11
+ TongfunAgentSchemaComponent
12
+ } from './types'
@@ -0,0 +1,33 @@
1
+ import e from "../lowcode-agent/index.js";
2
+ function s(o) {
3
+ const t = o.lowcode;
4
+ return {
5
+ name: o.name,
6
+ importName: o.source.exportName,
7
+ title: o.title,
8
+ category: o.category,
9
+ group: o.group,
10
+ importPath: o.source.importPath,
11
+ props: t.props,
12
+ composition: t.composition ?? {
13
+ childMode: t.slots.length > 0 ? "slots" : "none",
14
+ slots: t.slots,
15
+ dynamicSlots: t.dynamicSlots ?? []
16
+ },
17
+ triggers: t.triggers ?? [],
18
+ actions: t.actions ?? [],
19
+ metadata: o.agent
20
+ };
21
+ }
22
+ const r = {
23
+ schemaVersion: e.schemaVersion,
24
+ library: e.library,
25
+ components: e.components.map(s)
26
+ }, n = r.components.find(
27
+ (o) => o.name === "TfDocumentFormShell"
28
+ );
29
+ export {
30
+ r as default,
31
+ n as documentFormShellAgentSchema,
32
+ r as tongfunAgentSchema
33
+ };
@@ -0,0 +1,27 @@
1
+ export interface TongfunAgentSchemaComponent {
2
+ name: string
3
+ importName: string
4
+ title: string
5
+ category: string
6
+ group: string
7
+ importPath: string
8
+ props: unknown[]
9
+ composition: {
10
+ childMode: 'none' | 'slots' | 'children'
11
+ slots: unknown[]
12
+ dynamicSlots: unknown[]
13
+ }
14
+ triggers: unknown[]
15
+ actions: unknown[]
16
+ metadata?: Record<string, unknown>
17
+ }
18
+
19
+ export interface TongfunAgentSchema {
20
+ schemaVersion: string
21
+ library: {
22
+ name: string
23
+ importPath: string
24
+ framework: string
25
+ }
26
+ components: TongfunAgentSchemaComponent[]
27
+ }
@@ -0,0 +1,17 @@
1
+ export * from './types'
2
+
3
+ import type {
4
+ FormulaDependencyInput,
5
+ FormulaDependencyResult,
6
+ FormulaEvaluationInput,
7
+ FormulaEvaluationResult,
8
+ FormulaTokenNormalizeInput,
9
+ FormulaTokenNormalizeResult,
10
+ FormulaValidationInput,
11
+ FormulaValidationResult
12
+ } from './types'
13
+
14
+ export declare function evaluateFormula(input: FormulaEvaluationInput): FormulaEvaluationResult
15
+ export declare function extractFormulaDependencies(input: FormulaDependencyInput): FormulaDependencyResult
16
+ export declare function normalizeFormulaTokens(input: FormulaTokenNormalizeInput): FormulaTokenNormalizeResult
17
+ export declare function validateFormula(input: FormulaValidationInput): FormulaValidationResult
@@ -0,0 +1,136 @@
1
+ export type FormulaMode = 'header' | 'row' | 'body-aggregate'
2
+ export type FormulaEmptyValueMode = 'zero' | 'skip' | 'clear'
3
+ export type FormulaFailureStrategy = 'continue' | 'stop'
4
+ export type FormulaAggregateFunction = 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'COUNT'
5
+
6
+ export type FormulaToken =
7
+ | {
8
+ type: 'field'
9
+ field: string
10
+ label: string
11
+ fieldType?: string
12
+ scope?: 'header' | 'row'
13
+ }
14
+ | { type: 'operator'; value: string }
15
+ | { type: 'function'; name: string; args: FormulaToken[][] }
16
+ | { type: 'constant'; value: string | number }
17
+
18
+ export interface FormulaCondition {
19
+ field?: string
20
+ operator?: string
21
+ value?: unknown
22
+ expression?: string
23
+ expressionTokens?: FormulaToken[]
24
+ }
25
+
26
+ export interface FormulaActionConfig {
27
+ formulaMode?: FormulaMode
28
+ resultField?: string
29
+ targetField?: string
30
+ targetFieldType?: string
31
+ dependencies?: string[]
32
+ expressionTokens?: FormulaToken[]
33
+ expression?: string
34
+ sourceBodyId?: string
35
+ sourceField?: string
36
+ aggregateFunction?: FormulaAggregateFunction
37
+ aggregate?: FormulaAggregateFunction
38
+ function?: FormulaAggregateFunction
39
+ emptyValueMode?: FormulaEmptyValueMode
40
+ precision?: number | null
41
+ failureStrategy?: FormulaFailureStrategy
42
+ condition?: FormulaCondition | string | Record<string, unknown>
43
+ when?: FormulaCondition | string | Record<string, unknown>
44
+ [key: string]: unknown
45
+ }
46
+
47
+ export interface FormulaAction {
48
+ id?: string
49
+ type: 'formula'
50
+ name?: string
51
+ enabled?: boolean
52
+ config: FormulaActionConfig
53
+ }
54
+
55
+ export interface FormulaFieldMetadata {
56
+ field: string
57
+ label?: string
58
+ fieldType?: string
59
+ scope?: 'header' | 'row'
60
+ }
61
+
62
+ export interface FormulaError {
63
+ code: string
64
+ message: string
65
+ path?: string
66
+ field?: string
67
+ tokenIndex?: number
68
+ }
69
+
70
+ export interface FormulaValidationInput {
71
+ action?: FormulaAction | FormulaActionConfig
72
+ config?: FormulaActionConfig
73
+ targetField?: string
74
+ targetFieldType?: string
75
+ fields?: FormulaFieldMetadata[]
76
+ fieldTypes?: Record<string, string | undefined>
77
+ sourceFieldType?: string
78
+ }
79
+
80
+ export interface FormulaValidationResult {
81
+ valid: boolean
82
+ errors: FormulaError[]
83
+ dependencies: string[]
84
+ expression?: string
85
+ expressionTokens?: FormulaToken[]
86
+ }
87
+
88
+ export interface FormulaExecutionContext {
89
+ values?: Record<string, unknown>
90
+ row?: Record<string, unknown>
91
+ rows?: Record<string, unknown>[]
92
+ fieldTypes?: Record<string, string | undefined>
93
+ targetField?: string
94
+ targetFieldType?: string
95
+ sourceFieldType?: string
96
+ sourceBodyId?: string
97
+ }
98
+
99
+ export interface FormulaEvaluationInput extends FormulaValidationInput {
100
+ context: FormulaExecutionContext
101
+ }
102
+
103
+ export interface FormulaEvaluationResult {
104
+ valid: boolean
105
+ value?: unknown
106
+ skipped?: boolean
107
+ errors: FormulaError[]
108
+ dependencies: string[]
109
+ expression?: string
110
+ expressionTokens?: FormulaToken[]
111
+ }
112
+
113
+ export interface FormulaTokenNormalizeInput {
114
+ tokens?: FormulaToken[] | unknown[]
115
+ expression?: string
116
+ }
117
+
118
+ export interface FormulaTokenNormalizeResult {
119
+ valid: boolean
120
+ expressionTokens: FormulaToken[]
121
+ expression: string
122
+ errors: FormulaError[]
123
+ }
124
+
125
+ export interface FormulaDependencyInput {
126
+ action?: FormulaAction | FormulaActionConfig
127
+ config?: FormulaActionConfig
128
+ expressionTokens?: FormulaToken[] | unknown[]
129
+ expression?: string
130
+ }
131
+
132
+ export interface FormulaDependencyResult {
133
+ valid: boolean
134
+ dependencies: string[]
135
+ errors: FormulaError[]
136
+ }