@yh-ui/yh-ui-skill 1.0.30
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 +40 -0
- package/assets/llms-full.txt +38 -0
- package/assets/llms.txt +22 -0
- package/assets/metadata.json +4 -0
- package/assets/skills/yh-ui/LICENSE.txt +21 -0
- package/assets/skills/yh-ui/README.md +53 -0
- package/assets/skills/yh-ui/SKILL.md +179 -0
- package/assets/skills/yh-ui/evals/model-eval-2026-05-16.md +47 -0
- package/assets/skills/yh-ui/references/agent-workflows.md +53 -0
- package/assets/skills/yh-ui/references/ai-components.md +82 -0
- package/assets/skills/yh-ui/references/api-cheatsheet.md +203 -0
- package/assets/skills/yh-ui/references/codegen-rubric.md +36 -0
- package/assets/skills/yh-ui/references/component-map.md +70 -0
- package/assets/skills/yh-ui/references/eval-scenarios.md +92 -0
- package/assets/skills/yh-ui/references/flow.md +54 -0
- package/assets/skills/yh-ui/references/nuxt.md +50 -0
- package/assets/skills/yh-ui/references/recipes-ai.md +58 -0
- package/assets/skills/yh-ui/references/recipes-flow.md +56 -0
- package/assets/skills/yh-ui/references/recipes-form-schema.md +82 -0
- package/assets/skills/yh-ui/references/recipes-table.md +83 -0
- package/assets/skills/yh-ui/references/request.md +70 -0
- package/assets/skills/yh-ui/references/source-truth.md +205 -0
- package/assets/skills/yh-ui/references/usage-patterns.md +111 -0
- package/assets/skills/yh-ui/references/vue-component-practices.md +84 -0
- package/dist/args.d.ts +2 -0
- package/dist/args.mjs +76 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.mjs +153 -0
- package/dist/fs.d.ts +5 -0
- package/dist/fs.mjs +23 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +10 -0
- package/dist/install.d.ts +4 -0
- package/dist/install.mjs +117 -0
- package/dist/targets.d.ts +6 -0
- package/dist/targets.mjs +64 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.mjs +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Deep Recipe: YhFormSchema
|
|
2
|
+
|
|
3
|
+
Use this recipe for schema-driven forms, dynamic business forms, generated forms, and admin create/edit pages with conditional fields.
|
|
4
|
+
|
|
5
|
+
## Default Choice
|
|
6
|
+
|
|
7
|
+
Use `YhFormSchema` when fields are generated from configuration or when the form needs dynamic visibility, async options, grouped fields, list fields, or custom field rendering.
|
|
8
|
+
|
|
9
|
+
Use `YhForm` + `YhFormItem` for small hand-written forms.
|
|
10
|
+
|
|
11
|
+
## Source-Aligned API Highlights
|
|
12
|
+
|
|
13
|
+
- Props: `modelValue`, `schema`, `formProps`, `gutter`.
|
|
14
|
+
- Events: `update:modelValue`, `submit`, `change`, `validate`.
|
|
15
|
+
- Schema item capabilities: `field`, `label`, `type`, `component`, `props`, `formItemProps`, `rules`, `required`, `hidden`, `disabled`, `slots`, `col`, `span`, `render`, `asyncOptions`, `optionProp`, `defaultValue`, `tooltip`.
|
|
16
|
+
- Special item types: `divider`, `text`, `list`.
|
|
17
|
+
- Expose: `validate`, `resetFields`, `clearValidate`, `scrollToField`, `getModel`, `setFieldValue`, `formRef`.
|
|
18
|
+
|
|
19
|
+
## Pattern: Dynamic Form
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { ref } from 'vue'
|
|
24
|
+
import { YhButton, YhFormSchema, YhMessage } from '@yh-ui/components'
|
|
25
|
+
import type { FormSchema } from '@yh-ui/components'
|
|
26
|
+
|
|
27
|
+
const model = ref({
|
|
28
|
+
name: '',
|
|
29
|
+
role: '',
|
|
30
|
+
enabled: true
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const schema: FormSchema = [
|
|
34
|
+
{
|
|
35
|
+
field: 'name',
|
|
36
|
+
label: 'Name',
|
|
37
|
+
component: 'input',
|
|
38
|
+
required: true,
|
|
39
|
+
props: { clearable: true, placeholder: 'User name' }
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
field: 'role',
|
|
43
|
+
label: 'Role',
|
|
44
|
+
component: 'select',
|
|
45
|
+
required: true,
|
|
46
|
+
asyncOptions: async () => [
|
|
47
|
+
{ label: 'Admin', value: 'admin' },
|
|
48
|
+
{ label: 'Editor', value: 'editor' }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
field: 'enabled',
|
|
53
|
+
label: 'Enabled',
|
|
54
|
+
component: 'switch',
|
|
55
|
+
defaultValue: true
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
function submit() {
|
|
60
|
+
YhMessage.success('Saved')
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<YhFormSchema
|
|
66
|
+
v-model="model"
|
|
67
|
+
:schema="schema"
|
|
68
|
+
:form-props="{ labelWidth: 120 }"
|
|
69
|
+
@submit="submit"
|
|
70
|
+
/>
|
|
71
|
+
<YhButton type="primary" @click="submit">Save</YhButton>
|
|
72
|
+
</template>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Agent Rules
|
|
76
|
+
|
|
77
|
+
- Use `v-model` with `modelValue`.
|
|
78
|
+
- Use `required` for simple required rules and `rules` for custom validation.
|
|
79
|
+
- Use `hidden`/`disabled` functions for dynamic behavior.
|
|
80
|
+
- Use `asyncOptions` for remote options instead of manually wiring loading state for each field.
|
|
81
|
+
- Use `type: 'list'` for repeatable field groups.
|
|
82
|
+
- Do not use `YhFormSchema` for a tiny static form unless schema generation is useful.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Deep Recipe: YhTable
|
|
2
|
+
|
|
3
|
+
Use this recipe when the user asks for data tables, admin list pages, exports, selection, pagination, or large datasets.
|
|
4
|
+
|
|
5
|
+
## Default Choice
|
|
6
|
+
|
|
7
|
+
Use `YhTable` with a stable `columns` array and typed row data. Add `YhPagination` only when pagination is not handled through `YhTable`'s `pagination` prop.
|
|
8
|
+
|
|
9
|
+
## Source-Aligned API Highlights
|
|
10
|
+
|
|
11
|
+
- Props: `data`, `columns`, `rowKey`, `loading`, `pagination`, `selectionConfig`, `sortConfig`, `filterConfig`, `virtualConfig`, `toolbarConfig`, `emptyConfig`, `height`, `maxHeight`, `border`, `stripe`, `showIndex`.
|
|
12
|
+
- Events: `sort-change`, `filter-change`, `page-change`, `selection-change`, `row-click`, `cell-click`, `scroll`, `update:data`.
|
|
13
|
+
- Expose: `refresh`, `clearSelection`, `getSelectionRows`, `sort`, `clearSort`, `filter`, `clearFilter`, `exportData`, `print`, `scrollTo`, `doLayout`.
|
|
14
|
+
|
|
15
|
+
## Pattern: Request-Driven Table
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { computed, ref } from 'vue'
|
|
20
|
+
import { YhButton, YhEmpty, YhForm, YhFormItem, YhInput, YhTable } from '@yh-ui/components'
|
|
21
|
+
import { createRequest, useRequest } from '@yh-ui/request'
|
|
22
|
+
|
|
23
|
+
interface UserRow {
|
|
24
|
+
id: number
|
|
25
|
+
name: string
|
|
26
|
+
email: string
|
|
27
|
+
status: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const api = createRequest({ baseURL: '/api' })
|
|
31
|
+
const keyword = ref('')
|
|
32
|
+
const page = ref({ currentPage: 1, pageSize: 20, total: 0 })
|
|
33
|
+
|
|
34
|
+
const columns = [
|
|
35
|
+
{ prop: 'name', label: 'Name', minWidth: 160 },
|
|
36
|
+
{ prop: 'email', label: 'Email', minWidth: 220 },
|
|
37
|
+
{ prop: 'status', label: 'Status', width: 120 }
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
const { data, loading, error, refresh } = useRequest(async () => {
|
|
41
|
+
const result = await api.get<{ list: UserRow[]; total: number }>('/users', {
|
|
42
|
+
params: { keyword: keyword.value, page: page.value.currentPage, pageSize: page.value.pageSize }
|
|
43
|
+
})
|
|
44
|
+
page.value.total = result.total
|
|
45
|
+
return result.list
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const rows = computed(() => data.value || [])
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<YhForm inline>
|
|
53
|
+
<YhFormItem label="Keyword">
|
|
54
|
+
<YhInput v-model="keyword" clearable placeholder="Search users" />
|
|
55
|
+
</YhFormItem>
|
|
56
|
+
<YhFormItem>
|
|
57
|
+
<YhButton type="primary" :loading="loading" @click="refresh">Search</YhButton>
|
|
58
|
+
</YhFormItem>
|
|
59
|
+
</YhForm>
|
|
60
|
+
|
|
61
|
+
<YhTable
|
|
62
|
+
row-key="id"
|
|
63
|
+
:data="rows"
|
|
64
|
+
:columns="columns"
|
|
65
|
+
:loading="loading"
|
|
66
|
+
:pagination="page"
|
|
67
|
+
border
|
|
68
|
+
stripe
|
|
69
|
+
@page-change="refresh"
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<YhEmpty v-if="!loading && !rows.length && !error" description="No users found" />
|
|
73
|
+
</template>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Agent Rules
|
|
77
|
+
|
|
78
|
+
- Keep `columns` outside the template.
|
|
79
|
+
- Use `rowKey` whenever rows have identity.
|
|
80
|
+
- Use `virtualConfig` for large local datasets.
|
|
81
|
+
- Use `loading` and `emptyConfig`/`YhEmpty` for async states.
|
|
82
|
+
- Use table events for remote sort/filter/page behavior.
|
|
83
|
+
- Do not invent `YhDataTable`; use `YhTable`.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Request Hooks
|
|
2
|
+
|
|
3
|
+
Use `@yh-ui/request` for request clients, Vue request state, streaming events, pagination, queues, GraphQL, WebSocket, and HTTP cache helpers.
|
|
4
|
+
|
|
5
|
+
## Request Instance
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createRequest } from '@yh-ui/request'
|
|
9
|
+
|
|
10
|
+
const api = createRequest({
|
|
11
|
+
baseURL: '/api',
|
|
12
|
+
timeout: 10000,
|
|
13
|
+
retry: 2
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
api.interceptors.request.use((config) => {
|
|
17
|
+
config.headers = {
|
|
18
|
+
...config.headers,
|
|
19
|
+
Authorization: `Bearer ${getToken()}`
|
|
20
|
+
}
|
|
21
|
+
return config
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## useRequest
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { createRequest, useRequest } from '@yh-ui/request'
|
|
30
|
+
|
|
31
|
+
interface User {
|
|
32
|
+
id: number
|
|
33
|
+
name: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const api = createRequest({ baseURL: '/api' })
|
|
37
|
+
const { data, loading, error, refresh, run } = useRequest<User[]>(() => api.get<User[]>('/users'))
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<YhButton :loading="loading" @click="refresh">Refresh</YhButton>
|
|
42
|
+
<YhButton @click="run()">Run</YhButton>
|
|
43
|
+
<pre v-if="error">{{ error.message }}</pre>
|
|
44
|
+
<ul>
|
|
45
|
+
<li v-for="user in data" :key="user.id">{{ user.name }}</li>
|
|
46
|
+
</ul>
|
|
47
|
+
</template>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## SSE
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { useSSE } from '@yh-ui/request'
|
|
54
|
+
|
|
55
|
+
const { isConnected, connect, disconnect, error } = useSSE('/api/events', {
|
|
56
|
+
reconnect: true,
|
|
57
|
+
reconnectInterval: 3000,
|
|
58
|
+
onMessage: (event) => {
|
|
59
|
+
console.log(event.data)
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Agent Rules
|
|
65
|
+
|
|
66
|
+
- Use `createRequest`, not old names.
|
|
67
|
+
- Prefer `useRequest` for component state instead of manually maintaining `loading`, `data`, and `error`.
|
|
68
|
+
- Use `useSSE` or `useAIStream` for streaming responses.
|
|
69
|
+
- Use pagination/load-more hooks when building list pages.
|
|
70
|
+
- Keep auth token handling in request interceptors or server middleware.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Source Truth
|
|
2
|
+
|
|
3
|
+
This file is generated by `pnpm generate:yh-ui-skill`. Edit `scripts/generate-yh-ui-skill.mjs` for durable source-truth changes.
|
|
4
|
+
|
|
5
|
+
This file is the compact source-aligned reference for AI agents. Prefer these names and package boundaries over guesses. It mirrors the public exports found in the current repository source.
|
|
6
|
+
|
|
7
|
+
## Package Boundaries
|
|
8
|
+
|
|
9
|
+
| Package | Source-aligned purpose |
|
|
10
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `@yh-ui/yh-ui` | All-in-one Vue plugin; re-exports components, hooks, utils, theme, and locale |
|
|
12
|
+
| `@yh-ui/components` | Vue components, business widgets, AI UI components, global methods |
|
|
13
|
+
| `@yh-ui/hooks` | Composition API utilities used by components and applications |
|
|
14
|
+
| `@yh-ui/theme` | Theme plugin, theme manager, tokens, CSS variables, dark mode and density |
|
|
15
|
+
| `@yh-ui/locale` | Locale files and `Language` type |
|
|
16
|
+
| `@yh-ui/icons` | Iconify runtime, icon helpers, preset collections, generated icon components |
|
|
17
|
+
| `@yh-ui/request` | Fetch-based request client, Vue hooks, SSE, AI stream, pagination, queues, GraphQL, WebSocket, HTTP cache |
|
|
18
|
+
| `@yh-ui/flow` | Flow canvas, built-in nodes/edges, BPMN nodes, AI workflow nodes, editor helpers |
|
|
19
|
+
| `@yh-ui/ai-sdk` | Vercel AI SDK re-exports, Vue AI hooks, provider adapters, tools, agents, RAG, MCP, observability |
|
|
20
|
+
| `@yh-ui/nuxt` | Nuxt module for component registration, composable imports, CSS injection, build transpile |
|
|
21
|
+
|
|
22
|
+
## `@yh-ui/components` Exports
|
|
23
|
+
|
|
24
|
+
### Base and form components
|
|
25
|
+
|
|
26
|
+
`YhButton`, `YhInput`, `YhInputNumber`, `YhInputTag`, `YhAutocomplete`, `YhCheckbox`, `YhCheckboxGroup`, `YhRadio`, `YhRadioGroup`, `YhRadioButton`, `YhSwitch`, `YhRate`, `YhSelect`, `YhOption`, `YhCascader`, `YhCascaderPanel`, `YhSlider`, `YhTimeSelect`, `YhTimePicker`, `YhDatePicker`, `YhTransfer`, `YhTransferPanel`, `YhTreeSelect`, `YhColorPicker`, `YhUpload`, `YhForm`, `YhFormItem`, `YhFormSchema`, `YhMention`
|
|
27
|
+
|
|
28
|
+
### Layout, navigation, and typography
|
|
29
|
+
|
|
30
|
+
`YhRow`, `YhCol`, `YhDivider`, `YhSpace`, `YhContainer`, `YhHeader`, `YhAside`, `YhMain`, `YhFooter`, `YhGrid`, `YhGridItem`, `YhConfigProvider`, `YhBreadcrumb`, `YhBreadcrumbItem`, `YhTabs`, `YhTabPane`, `YhSteps`, `YhStep`, `YhMenu`, `YhMenuItem`, `YhMenuItemGroup`, `YhSubMenu`, `YhDropdown`, `YhDropdownItem`, `YhDropdownMenu`, `YhAffix`, `YhBackTop`, `YhInfiniteScroll`, `YhTypographyTitle`, `YhTypographyText`, `YhTypographyParagraph`, `YhTypographyLink`
|
|
31
|
+
|
|
32
|
+
### Data display and feedback
|
|
33
|
+
|
|
34
|
+
`YhTag`, `YhIcon`, `YhBadge`, `YhCard`, `YhAvatar`, `YhEmpty`, `YhSkeleton`, `YhSkeletonItem`, `YhProgress`, `YhAlert`, `YhSpin`, `YhLoading`, `YhMessage`, `YhNotification`, `YhMessageBox`, `YhTooltip`, `YhPopconfirm`, `YhPopover`, `YhDialog`, `YhDialogMethod`, `YhDrawer`, `YhWatermark`, `YhMarquee`, `YhPagination`, `YhImage`, `YhImageViewer`, `YhDescriptions`, `YhDescriptionsItem`, `YhCalendar`, `YhWaterfall`, `YhTree`, `YhTreeNode`, `YhCountdown`, `YhTable`, `YhTableColumn`, `YhCarousel`, `YhCarouselItem`, `YhScrollbar`, `YhResult`
|
|
35
|
+
|
|
36
|
+
### Business components
|
|
37
|
+
|
|
38
|
+
`YhGanttChart`, `YhSkuSelector`, `YhPrice`, `YhProductCard`, `YhImageMagnifier`, `YhCouponCard`, `YhLuckyDraw`, `YhFilterBar`, `YhSubmitBar`, `YhCategoryNav`, `YhSmartAddress`
|
|
39
|
+
|
|
40
|
+
### AI components
|
|
41
|
+
|
|
42
|
+
`YhAiChat`, `YhAiBubble`, `YhAiSender`, `YhAiThoughtChain`, `YhAiCodeBlock`, `YhAiCodeEditor`, `YhAiCodeRunner`, `YhAiThinking`, `YhAiWelcome`, `YhAiActionGroup`, `YhAiEditorSender`, `YhAiArtifacts`, `YhAiVoiceTrigger`, `YhAiConversations`, `YhAiPrompts`, `YhAiAgentCard`, `YhAiSources`, `YhAiProvider`, `YhAiMention`, `YhAiBubbleList`, `YhAiFileCard`, `YhAiAttachments`, `YhAiMermaid`
|
|
43
|
+
|
|
44
|
+
Global methods from component install:
|
|
45
|
+
|
|
46
|
+
`YhMessage`, `YhNotification`, `YhDialogMethod`, `YhMessageBox`, and aliases on `app.config.globalProperties` such as `$message`, `$notify`, `$dialog`, `$msgbox`, `$alert`, `$confirm`, `$prompt`.
|
|
47
|
+
|
|
48
|
+
## Priority Component API Surface
|
|
49
|
+
|
|
50
|
+
### YhAiAttachments
|
|
51
|
+
|
|
52
|
+
Props: `beforeUpload`, `disabled`, `dragTarget`, `getDropContainer`, `hideUpload`, `httpRequest`, `items`, `limit`, `listStyle`, `maxCount`, `overflow`, `placeholder`, `scrollMaxHeight`, `themeOverrides`, `uploadIconSize`
|
|
53
|
+
Emits: `delete-card`, `exceed`, `update:items`, `upload-change`, `upload-drop`, `upload-error`, `upload-success`
|
|
54
|
+
Slots: `default`, `drop-area`, `file-item`, `upload-button`
|
|
55
|
+
Expose: None detected
|
|
56
|
+
|
|
57
|
+
### YhAiBubble
|
|
58
|
+
|
|
59
|
+
Props: `allowedAttributes`, `allowedSchemes`, `allowedTags`, `avatar`, `citations`, `content`, `enablePythonRuntime`, `enableSanitizer`, `loading`, `markdown`, `markdownOptions`, `multimodal`, `onCitationClick`, `onExplainCode`, `onRunCode`, `onStreamComplete`, `placement`, `pyodideUrl`, `pythonApiUrl`, `pythonRuntime`, `role`, `sanitizer`, `shape`, `streamInterval`, `streamMode`, `streamSpeed`, `streaming`, `structuredData`, `themeOverrides`, `time`, `typing`, `variant`
|
|
60
|
+
Emits: None detected
|
|
61
|
+
Slots: `avatar`, `default`, `footer`, `header`
|
|
62
|
+
Expose: None detected
|
|
63
|
+
|
|
64
|
+
### YhAiBubbleList
|
|
65
|
+
|
|
66
|
+
Props: `autoScroll`, `height`, `itemHeight`, `items`, `loading`, `themeOverrides`, `virtualScroll`
|
|
67
|
+
Emits: None detected
|
|
68
|
+
Slots: `bubble`, `default`, `loading`
|
|
69
|
+
Expose: `scrollRef`, `scrollToBottom`, `scrollToIndex`
|
|
70
|
+
|
|
71
|
+
### YhAiChat
|
|
72
|
+
|
|
73
|
+
Props: `estimatedItemHeight`, `loading`, `messages`, `suggestions`, `themeOverrides`, `virtualHeight`, `virtualScroll`
|
|
74
|
+
Emits: `clear`, `send`, `update:messages`
|
|
75
|
+
Slots: `default`, `header`, `loading`, `message`, `sender`
|
|
76
|
+
Expose: None detected
|
|
77
|
+
|
|
78
|
+
### YhAiCodeBlock
|
|
79
|
+
|
|
80
|
+
Props: `code`, `collapsible`, `defaultCollapsed`, `editable`, `filename`, `highlight`, `highlightLines`, `language`, `showEdit`, `showLineNumbers`, `showRun`, `themeOverrides`
|
|
81
|
+
Emits: `copy`, `edit`, `run`, `update`
|
|
82
|
+
Slots: `actions`, `default`
|
|
83
|
+
Expose: None detected
|
|
84
|
+
|
|
85
|
+
### YhAiCodeEditor
|
|
86
|
+
|
|
87
|
+
Props: `autofocus`, `fontSize`, `height`, `initialValue`, `language`, `minimap`, `modelValue`, `readonly`, `tabSize`, `theme`, `themeOverrides`, `wordWrap`
|
|
88
|
+
Emits: `change`, `dispose`, `mount`, `update:modelValue`
|
|
89
|
+
Slots: None detected
|
|
90
|
+
Expose: `focus`, `getEditor`, `getValue`, `setValue`
|
|
91
|
+
|
|
92
|
+
### YhAiCodeRunner
|
|
93
|
+
|
|
94
|
+
Props: `autorun`, `code`, `height`, `language`, `themeOverrides`
|
|
95
|
+
Emits: `error`, `output`, `ready`, `run`, `stop`
|
|
96
|
+
Slots: None detected
|
|
97
|
+
Expose: `clear`, `reset`, `run`, `stop`
|
|
98
|
+
|
|
99
|
+
### YhAiFileCard
|
|
100
|
+
|
|
101
|
+
Props: `audioProps`, `byte`, `description`, `icon`, `imageProps`, `loading`, `mask`, `name`, `size`, `src`, `themeOverrides`, `type`, `videoProps`
|
|
102
|
+
Emits: `click`
|
|
103
|
+
Slots: `default`
|
|
104
|
+
Expose: None detected
|
|
105
|
+
|
|
106
|
+
### YhAiMermaid
|
|
107
|
+
|
|
108
|
+
Props: `actions`, `className`, `classNames`, `code`, `config`, `header`, `onRenderTypeChange`, `prefixCls`, `style`, `styles`, `themeOverrides`
|
|
109
|
+
Emits: `error`, `ready`, `render-type-change`
|
|
110
|
+
Slots: `default`, `extra`, `header`
|
|
111
|
+
Expose: None detected
|
|
112
|
+
|
|
113
|
+
### YhAiSender
|
|
114
|
+
|
|
115
|
+
Props: `attachments`, `clearable`, `commands`, `disabled`, `loading`, `maxLength`, `mentionOptions`, `modelValue`, `placeholder`, `showWordLimit`, `themeOverrides`
|
|
116
|
+
Emits: `blur`, `change`, `clear`, `command`, `focus`, `remove-attachment`, `send`, `update:modelValue`, `upload`
|
|
117
|
+
Slots: `actions`, `default`, `prefix`, `submit`
|
|
118
|
+
Expose: None detected
|
|
119
|
+
|
|
120
|
+
### YhAiSources
|
|
121
|
+
|
|
122
|
+
Props: `maxVisible`, `mode`, `showFileType`, `showScore`, `sources`, `themeOverrides`
|
|
123
|
+
Emits: `click`, `open`
|
|
124
|
+
Slots: `default`
|
|
125
|
+
Expose: `scrollToSource`
|
|
126
|
+
|
|
127
|
+
### YhAiThoughtChain
|
|
128
|
+
|
|
129
|
+
Props: `autoCollapse`, `className`, `classNames`, `content`, `dotSize`, `draggable`, `editable`, `items`, `lineGradient`, `markdown`, `showProgress`, `status`, `style`, `styles`, `themeOverrides`, `thinking`, `title`
|
|
130
|
+
Emits: `node-add`, `node-click`, `node-delete`, `reorder`, `update:items`
|
|
131
|
+
Slots: `default`
|
|
132
|
+
Expose: None detected
|
|
133
|
+
|
|
134
|
+
### YhFormSchema
|
|
135
|
+
|
|
136
|
+
Props: `formProps`, `gutter`, `modelValue`, `schema`
|
|
137
|
+
Emits: `change`, `submit`, `update:modelValue`, `validate`
|
|
138
|
+
Slots: `default`
|
|
139
|
+
Expose: `clearValidate`, `formRef`, `getModel`, `resetFields`, `scrollToField`, `setFieldValue`, `validate`
|
|
140
|
+
|
|
141
|
+
### YhTable
|
|
142
|
+
|
|
143
|
+
Props: `autoHeight`, `border`, `cellClassName`, `cellStyle`, `columns`, `contextMenuConfig`, `currentRowKey`, `data`, `dragConfig`, `emptyConfig`, `emptyText`, `expandConfig`, `filterConfig`, `fit`, `headerCellClassName`, `headerCellStyle`, `headerConfig`, `headerRowClassName`, `headerRowStyle`, `height`, `highlightCurrentRow`, `indexConfig`, `keepScroll`, `lazy`, `loadMethod`, `loading`, `maxHeight`, `pagination`, `resizable`, `rowClassName`, `rowConfig`, `rowKey`
|
|
144
|
+
Emits: `cell-click`, `cell-dblclick`, `column-resize`, `column-visible-change`, `current-change`, `drag-end`, `expand-change`, `filter-change`, `header-click`, `header-contextmenu`, `page-change`, `row-click`, `row-contextmenu`, `row-dblclick`, `scroll`, `select`, `select-all`, `selection-change`, `sort-change`, `update:currentRowKey`, `update:data`
|
|
145
|
+
Slots: `default`, `toolbar`, `toolbar-left`, `toolbar-left-prefix`, `toolbar-left-suffix`, `toolbar-right`, `toolbar-right-prefix`, `toolbar-right-suffix`
|
|
146
|
+
Expose: `clearFilter`, `clearSelection`, `clearSort`, `doLayout`, `exportData`, `filter`, `getColumns`, `getExpandedRowKeys`, `getSelectionRowKeys`, `getSelectionRows`, `getTableData`, `importData`, `importFile`, `insertRow`, `openImport`, `print`, `printMultiple`, `printTemplate`, `refresh`, `removeRow`, `resetColumns`, `scrollTo`, `setColumnVisible`, `setCurrentRow`
|
|
147
|
+
|
|
148
|
+
## `@yh-ui/hooks` Exports
|
|
149
|
+
|
|
150
|
+
Use hooks from these source modules:
|
|
151
|
+
|
|
152
|
+
`useNamespace`, `useZIndex`, `useSKU`, `useCountdown`, `useLocale`, `useId`, `useFormItem`, `useVirtualScroll`, `useCache`, `useEventListener`, `useScrollLock`, `useClickOutside`, `useConfig`, AI hooks from `use-ai`, and reactive storage helpers from `storage`.
|
|
153
|
+
|
|
154
|
+
## `@yh-ui/flow` Exports
|
|
155
|
+
|
|
156
|
+
Canvas and helpers:
|
|
157
|
+
|
|
158
|
+
`Flow`, `Minimap`, `Controls`, `FlowBackground`, `NodeEditPanel`, `EdgeEditPanel`, `AiNodeEditPanel`.
|
|
159
|
+
|
|
160
|
+
Nodes:
|
|
161
|
+
|
|
162
|
+
`BaseNode`, `InputNode`, `OutputNode`, `GroupNode`, `CustomNode`, `NodeResizer`, `NodeToolbar`, `DiamondNode`, `DatabaseNode`.
|
|
163
|
+
|
|
164
|
+
BPMN nodes:
|
|
165
|
+
|
|
166
|
+
`BpmnStartEvent`, `BpmnEndEvent`, `BpmnTask`, `BpmnServiceTask`, `BpmnUserTask`, `BpmnExclusiveGateway`, `BpmnParallelGateway`, `BpmnInclusiveGateway`, `BPMN_NODE_TYPES`, `registerBpmnNodes`.
|
|
167
|
+
|
|
168
|
+
AI workflow nodes:
|
|
169
|
+
|
|
170
|
+
`AiLlmNode`, `AiPromptNode`, `AiAgentNode`, `AiToolNode`, `AiConditionNode`, `AiStartNode`, `AiEndNode`, `AiMemoryNode`, `AI_WORKFLOW_NODE_TYPES`, `registerAiWorkflowNodes`.
|
|
171
|
+
|
|
172
|
+
Edges:
|
|
173
|
+
|
|
174
|
+
`BaseEdge`, `SmoothEdge`, `StepEdge`, `BezierEdge`, `DataFlowEdge`.
|
|
175
|
+
|
|
176
|
+
Flow API:
|
|
177
|
+
|
|
178
|
+
Props: `nodes`, `edges`, `modelValue`, `minZoom`, `maxZoom`, `zoomStep`, `panZoomSpeed`, `defaultNodeType`, `defaultEdgeType`, `nodesDraggable`, `edgesConnectable`, `selectable`, `multiSelectKey`, `background`, `backgroundColor`, `gridSize`, `snapToGrid`, `snapGrid`, `readonly`, `keyboardShortcuts`, `showControls`, `showMinimap`, `minimapNodeColor`, `showAlignmentGuides`, `history`, `maxHistory`, `virtualized`, `virtualizationThreshold`, `isValidConnection`, `themeOverrides`
|
|
179
|
+
|
|
180
|
+
Emits: `update:modelValue`, `update:nodes`, `update:edges`, `nodeClick`, `nodeDblClick`, `nodeDragStart`, `nodeDrag`, `nodeDragEnd`, `nodeContextMenu`, `edgeClick`, `edgeDblClick`, `edgeContextMenu`, `edgeConnect`, `selectionChange`, `historyChange`, `viewportChange`
|
|
181
|
+
|
|
182
|
+
Slots: `node`, `edge`
|
|
183
|
+
|
|
184
|
+
## `@yh-ui/ai-sdk` Capability Map
|
|
185
|
+
|
|
186
|
+
Use these real capabilities:
|
|
187
|
+
|
|
188
|
+
- Vercel AI SDK re-exports such as `generateText`, `streamText`, `generateObject`, `streamObject`, `embed`, `tool`, `jsonSchema`, `zodSchema`.
|
|
189
|
+
- Vue AI helpers: `useAIChat`, `useAIStream`, `useConversation`, `useConversations`, `createStreamableValue`, `createYHFunctionTool`, `createProviderAdapter`, `getProviderPreset`, `PROVIDER_PRESETS`, `XRequest`, `createXRequest`.
|
|
190
|
+
- Agents and workflows: `useReActAgent`, `createPlanExecuteAgent`, `createEnhancedAgent`, `createReflexionAgent`, `createReWOOAgent`, `createChain`, `createParallelChain`.
|
|
191
|
+
- RAG and vector helpers: `createRAGSystem`, `createProductionRAG`, `createInMemoryVectorStore`, loaders and chunking helpers.
|
|
192
|
+
- MCP: `useMCPClient`, `useMCPTools`, `MCPServer`, `useMCPServer`, `createMCPServerHTTPHandler`.
|
|
193
|
+
- Observability and safety: `createTracer`, `createObservabilityManager`, `createSafetyFilter`, rate limit and cache adapters.
|
|
194
|
+
|
|
195
|
+
## Nuxt Auto-Imports
|
|
196
|
+
|
|
197
|
+
The Nuxt module registers component names using the configured prefix, default `Yh`. It also auto-imports common hooks and globals from `@yh-ui/hooks` and `@yh-ui/components`.
|
|
198
|
+
|
|
199
|
+
Important nuance: native `useId` is not overridden. YH-UI's hook is imported as `useYhId`.
|
|
200
|
+
|
|
201
|
+
## Known Non-Goals
|
|
202
|
+
|
|
203
|
+
- Do not claim complete API coverage inside this skill. It is a compact agent guide.
|
|
204
|
+
- Do not include provider secrets in frontend examples.
|
|
205
|
+
- Do not use legacy or guessed APIs when a source export is listed here.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Usage Patterns
|
|
2
|
+
|
|
3
|
+
These patterns are intentionally short. Use them as starting points, then adapt names and data to the user's app.
|
|
4
|
+
|
|
5
|
+
## Filterable Table Page
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref } from 'vue'
|
|
10
|
+
import { YhButton, YhForm, YhFormItem, YhInput, YhTable } from '@yh-ui/components'
|
|
11
|
+
|
|
12
|
+
const keyword = ref('')
|
|
13
|
+
const rows = ref([{ id: 1, name: 'YH-UI', status: 'active' }])
|
|
14
|
+
const columns = [
|
|
15
|
+
{ prop: 'name', label: 'Name' },
|
|
16
|
+
{ prop: 'status', label: 'Status' }
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
function search() {
|
|
20
|
+
// call API or filter rows
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<YhForm inline>
|
|
26
|
+
<YhFormItem label="Keyword">
|
|
27
|
+
<YhInput v-model="keyword" clearable placeholder="Search" />
|
|
28
|
+
</YhFormItem>
|
|
29
|
+
<YhFormItem>
|
|
30
|
+
<YhButton type="primary" @click="search">Search</YhButton>
|
|
31
|
+
</YhFormItem>
|
|
32
|
+
</YhForm>
|
|
33
|
+
|
|
34
|
+
<YhTable :data="rows" :columns="columns" />
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Dialog Form
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { ref } from 'vue'
|
|
43
|
+
import { YhButton, YhDialog, YhForm, YhFormItem, YhInput } from '@yh-ui/components'
|
|
44
|
+
|
|
45
|
+
const open = ref(false)
|
|
46
|
+
const name = ref('')
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<YhButton type="primary" @click="open = true">Create</YhButton>
|
|
51
|
+
|
|
52
|
+
<YhDialog v-model="open" title="Create item">
|
|
53
|
+
<YhForm>
|
|
54
|
+
<YhFormItem label="Name">
|
|
55
|
+
<YhInput v-model="name" />
|
|
56
|
+
</YhFormItem>
|
|
57
|
+
</YhForm>
|
|
58
|
+
</YhDialog>
|
|
59
|
+
</template>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Theme Variables In Custom CSS
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<template>
|
|
66
|
+
<section class="summary-panel">
|
|
67
|
+
<slot />
|
|
68
|
+
</section>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<style scoped>
|
|
72
|
+
.summary-panel {
|
|
73
|
+
color: var(--yh-text-color-primary);
|
|
74
|
+
background: var(--yh-bg-color);
|
|
75
|
+
border: 1px solid var(--yh-border-color);
|
|
76
|
+
border-radius: var(--yh-border-radius-base);
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Locale Boundary
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
import { ref } from 'vue'
|
|
86
|
+
import { YhConfigProvider } from '@yh-ui/components'
|
|
87
|
+
import zhCn from '@yh-ui/locale/lang/zh-cn'
|
|
88
|
+
import en from '@yh-ui/locale/lang/en'
|
|
89
|
+
|
|
90
|
+
const locale = ref(zhCn)
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<template>
|
|
94
|
+
<YhConfigProvider :locale="locale">
|
|
95
|
+
<YhButton @click="locale = en">English</YhButton>
|
|
96
|
+
<slot />
|
|
97
|
+
</YhConfigProvider>
|
|
98
|
+
</template>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Icon Usage
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<script setup lang="ts">
|
|
105
|
+
import { Icon } from '@yh-ui/icons/vue'
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<template>
|
|
109
|
+
<Icon icon="lucide:search" :size="18" />
|
|
110
|
+
</template>
|
|
111
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Vue Component Practices
|
|
2
|
+
|
|
3
|
+
Use these rules when generating or reviewing YH-UI Vue 3 code. They combine Vue official guidance with component-library patterns that make AI-generated code safer and easier to maintain.
|
|
4
|
+
|
|
5
|
+
## SFC Structure
|
|
6
|
+
|
|
7
|
+
- Prefer `<script setup lang="ts">` for application examples and small components.
|
|
8
|
+
- Order SFC blocks as `<script>`, `<template>`, then `<style>`.
|
|
9
|
+
- Keep imports at the top, then types, props/emits/models, state, computed values, watchers, lifecycle hooks, and functions grouped by feature.
|
|
10
|
+
- Use `scoped` styles for page/example CSS unless the task intentionally edits global theme CSS.
|
|
11
|
+
- Avoid large inline template expressions. Move non-trivial logic to computed values or functions.
|
|
12
|
+
|
|
13
|
+
## Props, Emits, And v-model
|
|
14
|
+
|
|
15
|
+
- Type props with TypeScript interfaces or inline type literals.
|
|
16
|
+
- Use `withDefaults(defineProps<Props>(), defaults)` when defaults are needed.
|
|
17
|
+
- Use typed `defineEmits` for custom events.
|
|
18
|
+
- For two-way binding, prefer `defineModel` in new Vue 3.4+ examples when the target project supports it; otherwise use `modelValue` and `update:modelValue`.
|
|
19
|
+
- Never mutate props directly. Emit events or copy prop values into local state when local edits are needed.
|
|
20
|
+
- Keep event names explicit and user-action oriented, such as `submit`, `cancel`, `refresh`, or `update:filters`.
|
|
21
|
+
|
|
22
|
+
## Slots And Composition
|
|
23
|
+
|
|
24
|
+
- Prefer slots for customizable content over hard-coded markup when writing reusable components.
|
|
25
|
+
- Use named slots for clear extension points such as `header`, `toolbar`, `actions`, `empty`, and `footer`.
|
|
26
|
+
- In app pages, compose YH-UI components directly instead of wrapping every component in a thin local abstraction.
|
|
27
|
+
- Create composables only when stateful logic is reused or complex enough to deserve a named boundary.
|
|
28
|
+
|
|
29
|
+
## Reactivity
|
|
30
|
+
|
|
31
|
+
- Use `ref` for primitives and replaceable values.
|
|
32
|
+
- Use `reactive` for stable object state that is mutated by field.
|
|
33
|
+
- Use `computed` for derived values instead of maintaining duplicated state.
|
|
34
|
+
- Use `watch` for side effects, not for deriving values.
|
|
35
|
+
- Avoid destructuring reactive objects unless using `toRefs`, `storeToRefs`, or Vue 3.5 reactive props destructure intentionally.
|
|
36
|
+
- Use `shallowRef` for large immutable objects, external instances, editors, charts, or flow graphs when deep reactivity is unnecessary.
|
|
37
|
+
|
|
38
|
+
## Accessibility
|
|
39
|
+
|
|
40
|
+
- Prefer semantic HTML around YH-UI components.
|
|
41
|
+
- Ensure icon-only buttons have an accessible label.
|
|
42
|
+
- Keep form labels visible through `YhFormItem` or explicit `aria-label`.
|
|
43
|
+
- Preserve keyboard behavior for dialogs, drawers, dropdowns, popovers, tabs, and menus.
|
|
44
|
+
- Do not remove focus outlines unless replacing them with an equally visible focus style.
|
|
45
|
+
|
|
46
|
+
## Performance
|
|
47
|
+
|
|
48
|
+
- Keep large tables and lists virtualized when YH-UI offers virtual scrolling.
|
|
49
|
+
- Use lazy-loaded components for heavy features such as flow editors, charts, code editors, and AI artifact renderers.
|
|
50
|
+
- Avoid creating new object/function literals in hot template loops when they can be stable constants.
|
|
51
|
+
- Use `v-show` for frequent toggles and `v-if` for expensive conditional branches.
|
|
52
|
+
- Use stable `:key` values in `v-for`; never use array index when item identity exists.
|
|
53
|
+
- Keep expensive formatting in computed values or memoized helpers.
|
|
54
|
+
|
|
55
|
+
## SSR And Hydration
|
|
56
|
+
|
|
57
|
+
- Do not access `window`, `document`, `localStorage`, `ResizeObserver`, or canvas APIs during SSR.
|
|
58
|
+
- Use `onMounted` or Nuxt `<ClientOnly>` for browser-only integrations.
|
|
59
|
+
- Give flow editors, charts, virtual lists, and code editors stable container dimensions to avoid hydration/layout shifts.
|
|
60
|
+
- Keep server-rendered initial state deterministic.
|
|
61
|
+
|
|
62
|
+
## Forms And Data Pages
|
|
63
|
+
|
|
64
|
+
- Use `YhForm`, `YhFormItem`, and typed form state for editable data.
|
|
65
|
+
- Keep search filters separate from committed query params when a page needs reset/search behavior.
|
|
66
|
+
- Include loading, error, empty, and success feedback for request-driven screens.
|
|
67
|
+
- Use `YhMessage`, `YhNotification`, `YhPopconfirm`, and `YhMessageBox` for user feedback instead of ad hoc alerts.
|
|
68
|
+
- Use `YhTable` columns as stable constants or computed values, not inline arrays in templates.
|
|
69
|
+
|
|
70
|
+
## Component-Library Code Style
|
|
71
|
+
|
|
72
|
+
- Preserve public API compatibility when editing reusable components.
|
|
73
|
+
- Do not rename props/events unless the user explicitly asks for a breaking change.
|
|
74
|
+
- Keep component props small and orthogonal.
|
|
75
|
+
- Prefer CSS variables and existing theme tokens over hard-coded colors.
|
|
76
|
+
- Use `useNamespace` for internal BEM-style component classes when editing package components.
|
|
77
|
+
- Use `useZIndex`, `useLocale`, `useId`/`useYhId`, and config hooks instead of local one-off implementations.
|
|
78
|
+
|
|
79
|
+
## Testing Expectations
|
|
80
|
+
|
|
81
|
+
- For reusable components, test props, emitted events, slots, keyboard/focus behavior, and important visual states.
|
|
82
|
+
- For composables, test state transitions and cleanup.
|
|
83
|
+
- For request code, test loading, success, error, retry, and cancellation when present.
|
|
84
|
+
- For Nuxt/SSR examples, check that browser-only code is gated.
|
package/dist/args.d.ts
ADDED