@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.
Files changed (39) hide show
  1. package/README.md +40 -0
  2. package/assets/llms-full.txt +38 -0
  3. package/assets/llms.txt +22 -0
  4. package/assets/metadata.json +4 -0
  5. package/assets/skills/yh-ui/LICENSE.txt +21 -0
  6. package/assets/skills/yh-ui/README.md +53 -0
  7. package/assets/skills/yh-ui/SKILL.md +179 -0
  8. package/assets/skills/yh-ui/evals/model-eval-2026-05-16.md +47 -0
  9. package/assets/skills/yh-ui/references/agent-workflows.md +53 -0
  10. package/assets/skills/yh-ui/references/ai-components.md +82 -0
  11. package/assets/skills/yh-ui/references/api-cheatsheet.md +203 -0
  12. package/assets/skills/yh-ui/references/codegen-rubric.md +36 -0
  13. package/assets/skills/yh-ui/references/component-map.md +70 -0
  14. package/assets/skills/yh-ui/references/eval-scenarios.md +92 -0
  15. package/assets/skills/yh-ui/references/flow.md +54 -0
  16. package/assets/skills/yh-ui/references/nuxt.md +50 -0
  17. package/assets/skills/yh-ui/references/recipes-ai.md +58 -0
  18. package/assets/skills/yh-ui/references/recipes-flow.md +56 -0
  19. package/assets/skills/yh-ui/references/recipes-form-schema.md +82 -0
  20. package/assets/skills/yh-ui/references/recipes-table.md +83 -0
  21. package/assets/skills/yh-ui/references/request.md +70 -0
  22. package/assets/skills/yh-ui/references/source-truth.md +205 -0
  23. package/assets/skills/yh-ui/references/usage-patterns.md +111 -0
  24. package/assets/skills/yh-ui/references/vue-component-practices.md +84 -0
  25. package/dist/args.d.ts +2 -0
  26. package/dist/args.mjs +76 -0
  27. package/dist/cli.d.ts +2 -0
  28. package/dist/cli.mjs +153 -0
  29. package/dist/fs.d.ts +5 -0
  30. package/dist/fs.mjs +23 -0
  31. package/dist/index.d.ts +5 -0
  32. package/dist/index.mjs +10 -0
  33. package/dist/install.d.ts +4 -0
  34. package/dist/install.mjs +117 -0
  35. package/dist/targets.d.ts +6 -0
  36. package/dist/targets.mjs +64 -0
  37. package/dist/types.d.ts +53 -0
  38. package/dist/types.mjs +1 -0
  39. package/package.json +44 -0
@@ -0,0 +1,203 @@
1
+ # API Cheatsheet
2
+
3
+ This file is generated by `pnpm generate:yh-ui-skill` using the TypeScript AST for script APIs and template scanning for slots. It lists common and source-extracted APIs that coding agents usually need. Check source docs for complete behavioral details.
4
+
5
+ ## Install Entries
6
+
7
+ ```ts
8
+ import YhUI from '@yh-ui/yh-ui'
9
+ import '@yh-ui/yh-ui/css'
10
+
11
+ import { YhButton, YhTable } from '@yh-ui/components'
12
+ import '@yh-ui/components/style.css'
13
+ ```
14
+
15
+ ## Common Components
16
+
17
+ | Component | Common usage |
18
+ | ------------------ | ----------------------------------------------------------------------------------- |
19
+ | `YhButton` | `type`, `size`, `loading`, click events |
20
+ | `YhInput` | `v-model`, `clearable`, `placeholder`, password/text input |
21
+ | `YhForm` | Form container; use with `YhFormItem` |
22
+ | `YhFormItem` | `label`, validation and field layout |
23
+ | `YhTable` | `data`, `columns`, selection, pagination, toolbar, export, print, virtual scrolling |
24
+ | `YhDialog` | `v-model`, `title`, default/footer content |
25
+ | `YhDrawer` | `v-model`, `title`, detail side panels |
26
+ | `YhMessage` | Global feedback: success/error/info/warning style calls |
27
+ | `YhConfigProvider` | Locale and configuration boundary |
28
+ | `YhScrollbar` | Custom scroll containers |
29
+ | `YhCarousel` | Image or content carousel; use with `YhCarouselItem` |
30
+ | `YhImageMagnifier` | Product/image inspection |
31
+
32
+ ## Source-Extracted Priority APIs
33
+
34
+ ### YhAiAttachments
35
+
36
+ Props: `beforeUpload`, `disabled`, `dragTarget`, `getDropContainer`, `hideUpload`, `httpRequest`, `items`, `limit`, `listStyle`, `maxCount`, `overflow`, `placeholder`, `scrollMaxHeight`, `themeOverrides`, `uploadIconSize`
37
+ Emits: `delete-card`, `exceed`, `update:items`, `upload-change`, `upload-drop`, `upload-error`, `upload-success`
38
+ Slots: `default`, `drop-area`, `file-item`, `upload-button`
39
+ Expose: None detected
40
+
41
+ ### YhAiBubble
42
+
43
+ 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`
44
+ Emits: None detected
45
+ Slots: `avatar`, `default`, `footer`, `header`
46
+ Expose: None detected
47
+
48
+ ### YhAiBubbleList
49
+
50
+ Props: `autoScroll`, `height`, `itemHeight`, `items`, `loading`, `themeOverrides`, `virtualScroll`
51
+ Emits: None detected
52
+ Slots: `bubble`, `default`, `loading`
53
+ Expose: `scrollRef`, `scrollToBottom`, `scrollToIndex`
54
+
55
+ ### YhAiChat
56
+
57
+ Props: `estimatedItemHeight`, `loading`, `messages`, `suggestions`, `themeOverrides`, `virtualHeight`, `virtualScroll`
58
+ Emits: `clear`, `send`, `update:messages`
59
+ Slots: `default`, `header`, `loading`, `message`, `sender`
60
+ Expose: None detected
61
+
62
+ ### YhAiCodeBlock
63
+
64
+ Props: `code`, `collapsible`, `defaultCollapsed`, `editable`, `filename`, `highlight`, `highlightLines`, `language`, `showEdit`, `showLineNumbers`, `showRun`, `themeOverrides`
65
+ Emits: `copy`, `edit`, `run`, `update`
66
+ Slots: `actions`, `default`
67
+ Expose: None detected
68
+
69
+ ### YhAiCodeEditor
70
+
71
+ Props: `autofocus`, `fontSize`, `height`, `initialValue`, `language`, `minimap`, `modelValue`, `readonly`, `tabSize`, `theme`, `themeOverrides`, `wordWrap`
72
+ Emits: `change`, `dispose`, `mount`, `update:modelValue`
73
+ Slots: None detected
74
+ Expose: `focus`, `getEditor`, `getValue`, `setValue`
75
+
76
+ ### YhAiCodeRunner
77
+
78
+ Props: `autorun`, `code`, `height`, `language`, `themeOverrides`
79
+ Emits: `error`, `output`, `ready`, `run`, `stop`
80
+ Slots: None detected
81
+ Expose: `clear`, `reset`, `run`, `stop`
82
+
83
+ ### YhAiFileCard
84
+
85
+ Props: `audioProps`, `byte`, `description`, `icon`, `imageProps`, `loading`, `mask`, `name`, `size`, `src`, `themeOverrides`, `type`, `videoProps`
86
+ Emits: `click`
87
+ Slots: `default`
88
+ Expose: None detected
89
+
90
+ ### YhAiMermaid
91
+
92
+ Props: `actions`, `className`, `classNames`, `code`, `config`, `header`, `onRenderTypeChange`, `prefixCls`, `style`, `styles`, `themeOverrides`
93
+ Emits: `error`, `ready`, `render-type-change`
94
+ Slots: `default`, `extra`, `header`
95
+ Expose: None detected
96
+
97
+ ### YhAiSender
98
+
99
+ Props: `attachments`, `clearable`, `commands`, `disabled`, `loading`, `maxLength`, `mentionOptions`, `modelValue`, `placeholder`, `showWordLimit`, `themeOverrides`
100
+ Emits: `blur`, `change`, `clear`, `command`, `focus`, `remove-attachment`, `send`, `update:modelValue`, `upload`
101
+ Slots: `actions`, `default`, `prefix`, `submit`
102
+ Expose: None detected
103
+
104
+ ### YhAiSources
105
+
106
+ Props: `maxVisible`, `mode`, `showFileType`, `showScore`, `sources`, `themeOverrides`
107
+ Emits: `click`, `open`
108
+ Slots: `default`
109
+ Expose: `scrollToSource`
110
+
111
+ ### YhAiThoughtChain
112
+
113
+ Props: `autoCollapse`, `className`, `classNames`, `content`, `dotSize`, `draggable`, `editable`, `items`, `lineGradient`, `markdown`, `showProgress`, `status`, `style`, `styles`, `themeOverrides`, `thinking`, `title`
114
+ Emits: `node-add`, `node-click`, `node-delete`, `reorder`, `update:items`
115
+ Slots: `default`
116
+ Expose: None detected
117
+
118
+ ### YhFormSchema
119
+
120
+ Props: `formProps`, `gutter`, `modelValue`, `schema`
121
+ Emits: `change`, `submit`, `update:modelValue`, `validate`
122
+ Slots: `default`
123
+ Expose: `clearValidate`, `formRef`, `getModel`, `resetFields`, `scrollToField`, `setFieldValue`, `validate`
124
+
125
+ ### YhTable
126
+
127
+ 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`
128
+ 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`
129
+ Slots: `default`, `toolbar`, `toolbar-left`, `toolbar-left-prefix`, `toolbar-left-suffix`, `toolbar-right`, `toolbar-right-prefix`, `toolbar-right-suffix`
130
+ 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`
131
+
132
+ ### Flow
133
+
134
+ 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`
135
+
136
+ Emits: `update:modelValue`, `update:nodes`, `update:edges`, `nodeClick`, `nodeDblClick`, `nodeDragStart`, `nodeDrag`, `nodeDragEnd`, `nodeContextMenu`, `edgeClick`, `edgeDblClick`, `edgeContextMenu`, `edgeConnect`, `selectionChange`, `historyChange`, `viewportChange`
137
+
138
+ Slots: `node`, `edge`
139
+
140
+ ## Table Columns
141
+
142
+ Use column objects with at least `prop` and `label` unless the existing app uses another local pattern.
143
+
144
+ ```ts
145
+ const columns = [
146
+ { prop: 'name', label: 'Name' },
147
+ { prop: 'status', label: 'Status' }
148
+ ]
149
+ ```
150
+
151
+ ## Theme
152
+
153
+ Use the real theme plugin and hooks:
154
+
155
+ ```ts
156
+ import { ThemePlugin, useTheme } from '@yh-ui/theme'
157
+
158
+ app.use(ThemePlugin, {
159
+ preset: 'blue',
160
+ followSystem: true,
161
+ persist: true
162
+ })
163
+ ```
164
+
165
+ Common theme helpers include `useTheme`, `setThemePreset`, `toggleDarkMode`, `checkContrast`, and `getTextColorForBackground`.
166
+
167
+ ## Locale
168
+
169
+ Use lowercase language package paths:
170
+
171
+ ```ts
172
+ import zhCn from '@yh-ui/locale/lang/zh-cn'
173
+ import en from '@yh-ui/locale/lang/en'
174
+ ```
175
+
176
+ ## Hooks
177
+
178
+ | Hook | Use case |
179
+ | ------------------ | -------------------------------- |
180
+ | `useNamespace` | BEM-style class names |
181
+ | `useZIndex` | Overlay z-index allocation |
182
+ | `useLocale` | Component locale text |
183
+ | `useVirtualScroll` | Large lists |
184
+ | `useCountdown` | Countdown state |
185
+ | `useSKU` | SKU combinations |
186
+ | `useAiChat` | AI chat state from hooks package |
187
+
188
+ ## AI SDK
189
+
190
+ Use `@yh-ui/ai-sdk/vue` when the example is Vue-specific:
191
+
192
+ ```ts
193
+ import { createProviderAdapter, getProviderPreset, useAIChat } from '@yh-ui/ai-sdk/vue'
194
+ ```
195
+
196
+ Use `@yh-ui/ai-sdk` for general AI SDK, Vercel AI SDK re-exports, agents, RAG, MCP, loaders, observability, and server utilities.
197
+
198
+ ## Do Not Use
199
+
200
+ - `createYhTheme`
201
+ - `createRequestInstance`
202
+ - `@yh-ui/yh-ui/locale/zh-CN`
203
+ - Invented component names that are not exported by the package
@@ -0,0 +1,36 @@
1
+ # Code Generation Rubric
2
+
3
+ Use this checklist before returning YH-UI code.
4
+
5
+ ## Must Pass
6
+
7
+ - Imports use real package paths from `source-truth.md`.
8
+ - Component names exist in `source-truth.md`.
9
+ - Vue examples include required CSS when using component-only imports.
10
+ - Nuxt examples use `@yh-ui/nuxt` and rely on auto-import unless the user disabled it.
11
+ - Locale imports use `@yh-ui/locale/lang/zh-cn`, `@yh-ui/locale/lang/en`, or another real locale path pattern.
12
+ - Theme customization uses `@yh-ui/theme`, `ThemePlugin`, `useTheme`, or CSS variables.
13
+ - Request examples use `createRequest` and `useRequest` instead of stale factory names.
14
+ - Flow examples set an explicit height.
15
+ - AI examples do not expose provider API keys in frontend code.
16
+ - Vue SFC examples follow `vue-component-practices.md` for block order, TypeScript, props/emits, reactivity, accessibility, SSR, and performance.
17
+
18
+ ## Should Pass
19
+
20
+ - Pick the smallest YH-UI surface that solves the task.
21
+ - Prefer composable AI UI for custom products and `YhAiChat` for complete chat surfaces.
22
+ - Include empty, loading, and error states for data-heavy pages.
23
+ - Keep examples TypeScript-friendly.
24
+ - Avoid unrelated dependencies when YH-UI already provides the capability.
25
+ - Keep generated UI code readable and production-shaped, not demo-only.
26
+ - Use stable `:key` values, computed derived state, and explicit loading/error/empty states where relevant.
27
+
28
+ ## Red Flags
29
+
30
+ - Invented `Yh*` components.
31
+ - Old APIs such as `createYhTheme` or `createRequestInstance`.
32
+ - Nuxt pages manually importing many YH-UI components despite auto-import.
33
+ - Hard-coded design tokens where `var(--yh-*)` variables would fit.
34
+ - Flow canvas without height.
35
+ - Provider secrets in Vite env variables or browser bundles.
36
+ - Direct prop mutation, untyped emits, inaccessible icon buttons, or browser-only APIs during SSR.
@@ -0,0 +1,70 @@
1
+ # Component Map
2
+
3
+ Use this map to choose real YH-UI components for common product tasks.
4
+
5
+ ## Admin And Dashboard
6
+
7
+ | Scenario | Recommended components |
8
+ | -------------------------- | ------------------------------------------------------------------------- |
9
+ | Search/filter form | `YhForm`, `YhFormItem`, `YhInput`, `YhSelect`, `YhDatePicker`, `YhButton` |
10
+ | Data table page | `YhTable`, `YhPagination`, `YhTag`, `YhDropdown`, `YhMessage` |
11
+ | Detail drawer | `YhDrawer`, `YhDescriptions`, `YhButton`, `YhSpace` |
12
+ | Confirm destructive action | `YhPopconfirm`, `YhMessage`, `YhButton` |
13
+ | Empty/error result | `YhEmpty`, `YhResult`, `YhButton` |
14
+ | Scrollable panel | `YhScrollbar`, `YhBackTop` |
15
+ | Image gallery | `YhImage`, `YhImageViewer`, `YhCarousel`, `YhCarouselItem` |
16
+
17
+ ## Forms
18
+
19
+ | Scenario | Recommended components |
20
+ | ------------------ | -------------------------------------------------------------------------------- |
21
+ | Standard form | `YhForm`, `YhFormItem`, `YhInput`, `YhSelect`, `YhRadioGroup`, `YhCheckboxGroup` |
22
+ | Schema-driven form | `YhFormSchema` |
23
+ | Upload form | `YhUpload`, `YhForm`, `YhMessage` |
24
+ | Numeric settings | `YhInputNumber`, `YhSlider`, `YhSwitch` |
25
+ | Tags or mentions | `YhInputTag`, `YhMention` |
26
+
27
+ ## AI Products
28
+
29
+ | Scenario | Recommended components |
30
+ | ----------------- | --------------------------------------------------- |
31
+ | Chat surface | `YhAiBubble`, `YhAiSender`, `YhAiProvider` |
32
+ | Complete chat app | `YhAiChat`, `YhAiConversations`, `YhAiPrompts` |
33
+ | Reasoning display | `YhAiThoughtChain`, `YhAiThinking` |
34
+ | Code response | `YhAiCodeBlock`, `YhAiCodeEditor`, `YhAiCodeRunner` |
35
+ | Source citations | `YhAiSources`, `YhAiArtifacts`, `YhAiAttachments` |
36
+ | Message list | `YhAiBubbleList`, `YhAiBubble`, `YhAiActionGroup` |
37
+ | File response | `YhAiFileCard`, `YhAiAttachments` |
38
+ | Prompt mention | `YhAiMention`, `YhAiPrompts` |
39
+ | Mermaid diagram | `YhAiMermaid` |
40
+
41
+ ## Ecommerce And Business
42
+
43
+ | Scenario | Recommended components |
44
+ | ------------------- | --------------------------------------------------------- |
45
+ | Product listing | `YhProductCard`, `YhPrice`, `YhWaterfall`, `YhPagination` |
46
+ | SKU selection | `YhSkuSelector` or `useSKU` |
47
+ | Coupons | `YhCouponCard` |
48
+ | Checkout footer | `YhSubmitBar` |
49
+ | Address parsing | `YhSmartAddress`, `useAddressParser` |
50
+ | Category navigation | `YhCategoryNav` |
51
+ | Product inspection | `YhImageMagnifier`, `YhImage` |
52
+ | Promotion filter | `YhFilterBar`, `YhLuckyDraw` |
53
+
54
+ ## Workflow And Flow
55
+
56
+ | Scenario | Recommended package/components |
57
+ | ------------------ | -------------------------------------------------------------- |
58
+ | Flow canvas | `@yh-ui/flow`: `Flow`, `Controls`, `Minimap`, `FlowBackground` |
59
+ | Custom node editor | `NodeEditPanel`, `EdgeEditPanel`, `NodeToolbar`, `NodeResizer` |
60
+ | BPMN sketch | BPMN node exports from `@yh-ui/flow` |
61
+ | AI workflow | AI workflow node exports from `@yh-ui/flow` |
62
+
63
+ ## Icons, Theme, Locale
64
+
65
+ | Scenario | Recommended package/components |
66
+ | ----------------------- | ------------------------------------------- |
67
+ | Runtime Iconify icon | `@yh-ui/icons/vue`: `Icon` |
68
+ | YH icon component | `YhIcon` |
69
+ | Theme switching | `@yh-ui/theme`: `ThemePlugin`, `useTheme` |
70
+ | Runtime locale boundary | `YhConfigProvider` + `@yh-ui/locale/lang/*` |
@@ -0,0 +1,92 @@
1
+ # Eval Scenarios
2
+
3
+ Use these prompts to test whether the skill helps an AI model generate source-aligned YH-UI code.
4
+
5
+ ## Scenario 1: Vue Admin Table
6
+
7
+ Prompt:
8
+
9
+ > Build a Vue 3 page with a keyword filter, search button, table, and empty state using YH-UI.
10
+
11
+ Expected signals:
12
+
13
+ - Uses `YhForm`, `YhFormItem`, `YhInput`, `YhButton`, `YhTable`, and optionally `YhEmpty`.
14
+ - Imports from `@yh-ui/components` or uses the all-in-one package.
15
+ - Does not invent table props beyond common `data` and `columns`.
16
+ - Uses stable keys, stable column definitions, and loading/error/empty states when request-driven.
17
+
18
+ ## Scenario 2: Nuxt Setup
19
+
20
+ Prompt:
21
+
22
+ > Add YH-UI to a Nuxt app and create a page with a button and table.
23
+
24
+ Expected signals:
25
+
26
+ - Uses `modules: ['@yh-ui/nuxt']`.
27
+ - Page uses `<YhButton>` and `<YhTable>` directly.
28
+ - Does not manually import every component in the page.
29
+
30
+ ## Scenario 3: AI Chat Surface
31
+
32
+ Prompt:
33
+
34
+ > Create a custom AI chat UI with streaming messages, sources, attachments, and cancel support.
35
+
36
+ Expected signals:
37
+
38
+ - Uses `YhAiBubbleList` or `YhAiBubble`, `YhAiSender`, `YhAiSources`, `YhAiAttachments`.
39
+ - Uses `useAIChat` from `@yh-ui/ai-sdk/vue`.
40
+ - Keeps provider secrets out of browser code.
41
+ - Does not display hidden chain-of-thought text.
42
+
43
+ ## Scenario 4: Request Hook
44
+
45
+ Prompt:
46
+
47
+ > Fetch users from `/api/users` with loading, error, and refresh behavior.
48
+
49
+ Expected signals:
50
+
51
+ - Uses `createRequest` and `useRequest`.
52
+ - Shows loading/error UI.
53
+ - Does not use `createRequestInstance`.
54
+
55
+ ## Scenario 5: Flow In Nuxt
56
+
57
+ Prompt:
58
+
59
+ > Add an AI workflow editor to a Nuxt page.
60
+
61
+ Expected signals:
62
+
63
+ - Uses `@yh-ui/flow`.
64
+ - Wraps the editor in `<ClientOnly>`.
65
+ - Sets explicit height.
66
+ - Uses AI workflow node names from `source-truth.md`.
67
+
68
+ ## Scenario 6: Reusable Vue Wrapper
69
+
70
+ Prompt:
71
+
72
+ > Create a reusable YH-UI search toolbar component with typed props, v-model filters, slots for actions, and accessible buttons.
73
+
74
+ Expected signals:
75
+
76
+ - Uses `<script setup lang="ts">`.
77
+ - Types props and emits or uses `defineModel` when appropriate.
78
+ - Does not mutate props directly.
79
+ - Provides named slots such as `actions`.
80
+ - Icon-only buttons have accessible labels.
81
+
82
+ ## Scenario 7: Repair Hallucinated Code
83
+
84
+ Prompt:
85
+
86
+ > Fix this YH-UI snippet that imports `createYhTheme`, `YhAiSuggestion`, and `@yh-ui/yh-ui/locale/zh-CN`.
87
+
88
+ Expected signals:
89
+
90
+ - Replaces theme usage with `ThemePlugin` or `useTheme`.
91
+ - Replaces non-existing AI components with source-aligned components.
92
+ - Replaces locale path with `@yh-ui/locale/lang/zh-cn`.
@@ -0,0 +1,54 @@
1
+ # Flow Editor
2
+
3
+ Use `@yh-ui/flow` for flow charts, node editors, BPMN sketches, and AI workflow diagrams.
4
+
5
+ ## Basic Canvas
6
+
7
+ ```vue
8
+ <script setup lang="ts">
9
+ import { Controls, Flow, FlowBackground, Minimap } from '@yh-ui/flow'
10
+ import type { FlowEdge, FlowNode } from '@yh-ui/flow'
11
+
12
+ const nodes: FlowNode[] = [
13
+ { id: 'start', type: 'input', label: 'Start', position: { x: 80, y: 80 } },
14
+ { id: 'task', label: 'Process', position: { x: 280, y: 80 } }
15
+ ]
16
+
17
+ const edges: FlowEdge[] = [{ id: 'e-start-task', source: 'start', target: 'task' }]
18
+ </script>
19
+
20
+ <template>
21
+ <Flow :nodes="nodes" :edges="edges" fit-view style="height: 560px">
22
+ <Minimap />
23
+ <Controls />
24
+ <FlowBackground />
25
+ </Flow>
26
+ </template>
27
+ ```
28
+
29
+ ## Nuxt SSR
30
+
31
+ ```vue
32
+ <template>
33
+ <ClientOnly>
34
+ <Flow :nodes="nodes" :edges="edges" style="height: 560px" />
35
+ </ClientOnly>
36
+ </template>
37
+ ```
38
+
39
+ ## Useful Exports
40
+
41
+ | Area | Exports |
42
+ | ------- | ----------------------------------------------------------------------------------------------- |
43
+ | Canvas | `Flow`, `Minimap`, `Controls`, `FlowBackground` |
44
+ | Nodes | `BaseNode`, `InputNode`, `OutputNode`, `GroupNode`, `CustomNode`, `DiamondNode`, `DatabaseNode` |
45
+ | Edges | `BaseEdge`, `SmoothEdge`, `StepEdge`, `BezierEdge`, `DataFlowEdge` |
46
+ | Editing | `NodeEditPanel`, `EdgeEditPanel`, `AiNodeEditPanel`, `NodeToolbar`, `NodeResizer` |
47
+ | Presets | BPMN nodes, AI workflow nodes, registration helpers |
48
+
49
+ ## Agent Rules
50
+
51
+ - Always give the canvas an explicit height.
52
+ - Use Vue components for custom node rendering.
53
+ - Keep workflow node data serializable when persistence is required.
54
+ - Use BPMN exports for BPMN-style diagrams and AI workflow exports for agent-like flows.
@@ -0,0 +1,50 @@
1
+ # Nuxt Integration
2
+
3
+ Use `@yh-ui/nuxt` for Nuxt 3/4 apps.
4
+
5
+ ## Setup
6
+
7
+ ```ts
8
+ export default defineNuxtConfig({
9
+ modules: ['@yh-ui/nuxt'],
10
+ yhUI: {
11
+ importStyle: true,
12
+ buildTranspile: true,
13
+ prefix: 'Yh',
14
+ ssrOptimization: {
15
+ componentCache: true
16
+ }
17
+ }
18
+ })
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ After module registration, ordinary pages should use YH-UI components directly:
24
+
25
+ ```vue
26
+ <template>
27
+ <YhButton type="primary">Create</YhButton>
28
+ <YhInput v-model="keyword" clearable placeholder="Search" />
29
+ <YhTable :data="rows" :columns="columns" />
30
+ </template>
31
+
32
+ <script setup lang="ts">
33
+ const keyword = ref('')
34
+ const rows = ref([{ id: 1, name: 'YH-UI' }])
35
+ const columns = [{ prop: 'name', label: 'Name' }]
36
+ </script>
37
+ ```
38
+
39
+ ## Auto-Imported Utilities
40
+
41
+ The module auto-imports common hooks and utilities such as `useNamespace`, `useZIndex`, `useLocale`, `useVirtualScroll`, `useAiChat`, `useSKU`, and `useCountdown`.
42
+
43
+ `useId` is imported as `useYhId` to avoid conflicts with Vue/Nuxt native `useId`.
44
+
45
+ ## SSR Rules
46
+
47
+ - Use `<ClientOnly>` around browser-heavy flow editors.
48
+ - Do not assume `window`, `document`, or `localStorage` exists during SSR.
49
+ - Keep API keys on the server side, especially for AI provider routes.
50
+ - Let the module inject CSS unless the user explicitly disabled `importStyle`.
@@ -0,0 +1,58 @@
1
+ # Deep Recipe: YhAi Components
2
+
3
+ Use this recipe for AI chat, copilots, assistant panels, generated artifacts, citations, attachments, and code-heavy AI answers.
4
+
5
+ ## Default Choice
6
+
7
+ - Use `YhAiChat` for a complete chat surface.
8
+ - Compose `YhAiBubbleList`, `YhAiBubble`, `YhAiSender`, `YhAiSources`, `YhAiAttachments`, and `YhAiActionGroup` for custom products.
9
+ - Use `@yh-ui/ai-sdk/vue` for Vue chat state.
10
+ - Keep provider secrets in server routes.
11
+
12
+ ## Source-Aligned API Highlights
13
+
14
+ - `YhAiChat`: `messages`, `loading`, `suggestions`, `virtualScroll`, `virtualHeight`, `estimatedItemHeight`; emits `send`, `update:messages`, `clear`; slots `header`, `message`, `loading`, `sender`.
15
+ - `YhAiBubble`: `content`, `markdown`, `role`, `placement`, `loading`, `typing`, `streaming`, `citations`, `multimodal`, `structuredData`, `enableSanitizer`; slots `avatar`, `header`, `default`, `footer`.
16
+ - `YhAiSender`: `modelValue`, `placeholder`, `disabled`, `loading`, `clearable`, `commands`, `mentionOptions`, `attachments`; emits `update:modelValue`, `send`, `change`, `clear`, `command`, `remove-attachment`, `upload`; slots `prefix`, `actions`, `submit`.
17
+
18
+ ## Pattern: Custom Chat
19
+
20
+ ```vue
21
+ <script setup lang="ts">
22
+ import { YhAiAttachments, YhAiBubble, YhAiSender, YhAiSources } from '@yh-ui/components'
23
+ import { useAIChat } from '@yh-ui/ai-sdk/vue'
24
+
25
+ const { messages, input, isLoading, sendMessage, stop } = useAIChat({
26
+ api: '/api/chat'
27
+ })
28
+ </script>
29
+
30
+ <template>
31
+ <section class="chat-shell">
32
+ <YhAiBubble
33
+ v-for="message in messages"
34
+ :key="message.id"
35
+ :role="message.role"
36
+ :content="message.content"
37
+ :loading="message.status === 'loading'"
38
+ streaming
39
+ />
40
+
41
+ <YhAiSources v-if="messages.at(-1)?.sources?.length" :sources="messages.at(-1).sources" />
42
+ <YhAiAttachments
43
+ v-if="messages.at(-1)?.attachments?.length"
44
+ :items="messages.at(-1).attachments"
45
+ />
46
+
47
+ <YhAiSender v-model="input" :loading="isLoading" @send="sendMessage" @cancel="stop" />
48
+ </section>
49
+ </template>
50
+ ```
51
+
52
+ ## Security And UX Rules
53
+
54
+ - Never expose provider keys through `VITE_*` env vars or browser code.
55
+ - Treat model output as untrusted content; keep sanitizer enabled unless the server sanitizes output.
56
+ - Do not display hidden chain-of-thought text. Use `YhAiThoughtChain` for explicit user-facing reasoning steps.
57
+ - Use `YhAiSources` for citations and `YhAiArtifacts` for rich generated outputs.
58
+ - Use `YhAiCodeBlock`, `YhAiCodeEditor`, and `YhAiCodeRunner` for code-centric responses instead of raw `<pre>` blocks when interaction matters.
@@ -0,0 +1,56 @@
1
+ # Deep Recipe: Flow
2
+
3
+ Use this recipe for workflow editors, node graphs, BPMN-like diagrams, AI workflow canvases, and visual automation builders.
4
+
5
+ ## Default Choice
6
+
7
+ Use `@yh-ui/flow` with `Flow`, `Controls`, `Minimap`, and `FlowBackground`.
8
+
9
+ Always set an explicit canvas height.
10
+
11
+ ## Source-Aligned API Highlights
12
+
13
+ - Props: `nodes`, `edges`, `modelValue`, `minZoom`, `maxZoom`, `defaultNodeType`, `defaultEdgeType`, `nodesDraggable`, `edgesConnectable`, `selectable`, `background`, `snapToGrid`, `readonly`, `keyboardShortcuts`, `showControls`, `showMinimap`, `history`, `virtualized`, `isValidConnection`.
14
+ - Events: `update:modelValue`, `update:nodes`, `update:edges`, `nodeClick`, `nodeDragStart`, `nodeDrag`, `nodeDragEnd`, `edgeClick`, `edgeConnect`, `selectionChange`, `historyChange`, `viewportChange`.
15
+ - Slots: `node`, `edge`.
16
+ - Use AI workflow nodes: `AiLlmNode`, `AiPromptNode`, `AiAgentNode`, `AiToolNode`, `AiConditionNode`, `AiStartNode`, `AiEndNode`, `AiMemoryNode`.
17
+ - Use BPMN nodes: `BpmnStartEvent`, `BpmnEndEvent`, `BpmnTask`, `BpmnServiceTask`, `BpmnUserTask`, `BpmnExclusiveGateway`, `BpmnParallelGateway`, `BpmnInclusiveGateway`.
18
+
19
+ ## Pattern: Nuxt AI Workflow
20
+
21
+ ```vue
22
+ <script setup lang="ts">
23
+ import { Controls, Flow, FlowBackground, Minimap } from '@yh-ui/flow'
24
+ import type { Edge, Node } from '@yh-ui/flow'
25
+
26
+ const nodes: Node[] = [
27
+ { id: 'start', type: 'ai-start', label: 'Start', position: { x: 80, y: 120 } },
28
+ { id: 'llm', type: 'ai-llm', label: 'LLM', position: { x: 320, y: 120 } },
29
+ { id: 'end', type: 'ai-end', label: 'End', position: { x: 560, y: 120 } }
30
+ ]
31
+
32
+ const edges: Edge[] = [
33
+ { id: 'e-start-llm', source: 'start', target: 'llm' },
34
+ { id: 'e-llm-end', source: 'llm', target: 'end' }
35
+ ]
36
+ </script>
37
+
38
+ <template>
39
+ <ClientOnly>
40
+ <Flow :nodes="nodes" :edges="edges" fit-view style="height: 640px">
41
+ <Minimap />
42
+ <Controls />
43
+ <FlowBackground />
44
+ </Flow>
45
+ </ClientOnly>
46
+ </template>
47
+ ```
48
+
49
+ ## Agent Rules
50
+
51
+ - In Nuxt or SSR, wrap in `<ClientOnly>`.
52
+ - Use serializable node `data` for persistence.
53
+ - Use `isValidConnection` for business validation.
54
+ - Use `update:nodes` and `update:edges` for controlled editing.
55
+ - Use slots for custom node/edge rendering.
56
+ - Do not render Flow in a zero-height container.