@rotifer/playground 0.5.0-alpha.2 → 0.7.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/CHANGELOG.md +159 -15
- package/LICENSE +1 -1
- package/README.md +51 -23
- package/README.zh.md +54 -25
- package/dist/cloud/auth.d.ts +7 -1
- package/dist/cloud/auth.d.ts.map +1 -1
- package/dist/cloud/auth.js +65 -1
- package/dist/cloud/auth.js.map +1 -1
- package/dist/cloud/client.d.ts +4 -1
- package/dist/cloud/client.d.ts.map +1 -1
- package/dist/cloud/client.js +9 -2
- package/dist/cloud/client.js.map +1 -1
- package/dist/cloud/types.d.ts +3 -1
- package/dist/cloud/types.d.ts.map +1 -1
- package/dist/cloud/types.js.map +1 -1
- package/dist/commands/agent-create.d.ts.map +1 -1
- package/dist/commands/agent-create.js +66 -3
- package/dist/commands/agent-create.js.map +1 -1
- package/dist/commands/agent-run.d.ts.map +1 -1
- package/dist/commands/agent-run.js +296 -32
- package/dist/commands/agent-run.js.map +1 -1
- package/dist/commands/arena-submit.d.ts.map +1 -1
- package/dist/commands/arena-submit.js +45 -17
- package/dist/commands/arena-submit.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +9 -3
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +13 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +23 -16
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/network.js +4 -4
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +162 -44
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +209 -23
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/wrap.d.ts.map +1 -1
- package/dist/commands/wrap.js +17 -1
- package/dist/commands/wrap.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/runtime/network-gateway.d.ts +53 -0
- package/dist/runtime/network-gateway.d.ts.map +1 -0
- package/dist/runtime/network-gateway.js +147 -0
- package/dist/runtime/network-gateway.js.map +1 -0
- package/dist/utils/binding.d.ts +25 -0
- package/dist/utils/binding.d.ts.map +1 -1
- package/dist/utils/binding.js.map +1 -1
- package/dist/utils/open-browser.d.ts +10 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +23 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/genes/academic-writer/.cloud-manifest.json +6 -0
- package/genes/academic-writer/.gene-manifest.json +8 -0
- package/genes/academic-writer/SKILL.md +274 -0
- package/genes/academic-writer/phenotype.json +28 -0
- package/genes/ai-components/.cloud-manifest.json +6 -0
- package/genes/ai-components/.gene-manifest.json +8 -0
- package/genes/ai-components/SKILL.md +381 -0
- package/genes/ai-components/phenotype.json +28 -0
- package/genes/algorithmic-art/.cloud-manifest.json +6 -0
- package/genes/algorithmic-art/.gene-manifest.json +8 -0
- package/genes/algorithmic-art/SKILL.md +405 -0
- package/genes/algorithmic-art/phenotype.json +28 -0
- package/genes/answer-synthesizer/.cloud-manifest.json +6 -0
- package/genes/answer-synthesizer/index.ts +194 -0
- package/genes/answer-synthesizer/phenotype.json +61 -0
- package/genes/api-designer/.cloud-manifest.json +6 -0
- package/genes/api-designer/.gene-manifest.json +8 -0
- package/genes/api-designer/SKILL.md +456 -0
- package/genes/api-designer/phenotype.json +28 -0
- package/genes/auto-coder/.cloud-manifest.json +6 -0
- package/genes/auto-coder/.gene-manifest.json +8 -0
- package/genes/auto-coder/SKILL.md +400 -0
- package/genes/auto-coder/phenotype.json +28 -0
- package/genes/auto-writer/.cloud-manifest.json +6 -0
- package/genes/auto-writer/.gene-manifest.json +8 -0
- package/genes/auto-writer/SKILL.md +361 -0
- package/genes/auto-writer/phenotype.json +28 -0
- package/genes/brand-personality/.cloud-manifest.json +6 -0
- package/genes/brand-personality/.gene-manifest.json +8 -0
- package/genes/brand-personality/SKILL.md +549 -0
- package/genes/brand-personality/phenotype.json +28 -0
- package/genes/business-writer/.cloud-manifest.json +6 -0
- package/genes/business-writer/.gene-manifest.json +8 -0
- package/genes/business-writer/SKILL.md +448 -0
- package/genes/business-writer/phenotype.json +28 -0
- package/genes/citation-manager/.cloud-manifest.json +6 -0
- package/genes/citation-manager/.gene-manifest.json +8 -0
- package/genes/citation-manager/SKILL.md +279 -0
- package/genes/citation-manager/index.ts +162 -0
- package/genes/citation-manager/package.json +1 -0
- package/genes/citation-manager/phenotype.json +50 -0
- package/genes/code-complexity/.cloud-manifest.json +6 -0
- package/genes/code-complexity/README.md +35 -0
- package/genes/code-complexity/index.ts +101 -0
- package/genes/code-complexity/phenotype.json +34 -0
- package/genes/copywriter/.cloud-manifest.json +6 -0
- package/genes/copywriter/.gene-manifest.json +8 -0
- package/genes/copywriter/SKILL.md +329 -0
- package/genes/copywriter/phenotype.json +28 -0
- package/genes/creative-writer/.cloud-manifest.json +6 -0
- package/genes/creative-writer/.gene-manifest.json +8 -0
- package/genes/creative-writer/SKILL.md +356 -0
- package/genes/creative-writer/phenotype.json +28 -0
- package/genes/data-modeler/.cloud-manifest.json +6 -0
- package/genes/data-modeler/.gene-manifest.json +8 -0
- package/genes/data-modeler/SKILL.md +486 -0
- package/genes/data-modeler/phenotype.json +28 -0
- package/genes/debugger/.cloud-manifest.json +6 -0
- package/genes/debugger/.gene-manifest.json +8 -0
- package/genes/debugger/SKILL.md +416 -0
- package/genes/debugger/phenotype.json +28 -0
- package/genes/design-tokens/.cloud-manifest.json +6 -0
- package/genes/design-tokens/.gene-manifest.json +8 -0
- package/genes/design-tokens/SKILL.md +222 -0
- package/genes/design-tokens/index.ts +128 -0
- package/genes/design-tokens/package.json +1 -0
- package/genes/design-tokens/phenotype.json +1 -0
- package/genes/devops-automator/.cloud-manifest.json +6 -0
- package/genes/devops-automator/.gene-manifest.json +8 -0
- package/genes/devops-automator/SKILL.md +490 -0
- package/genes/devops-automator/phenotype.json +28 -0
- package/genes/doc-coauthoring/.cloud-manifest.json +6 -0
- package/genes/doc-coauthoring/.gene-manifest.json +8 -0
- package/genes/doc-coauthoring/SKILL.md +375 -0
- package/genes/doc-coauthoring/phenotype.json +28 -0
- package/genes/doc-retrieval/.cloud-manifest.json +6 -0
- package/genes/doc-retrieval/index.ts +134 -0
- package/genes/doc-retrieval/phenotype.json +54 -0
- package/genes/docs-writer/.cloud-manifest.json +6 -0
- package/genes/docs-writer/.gene-manifest.json +8 -0
- package/genes/docs-writer/SKILL.md +492 -0
- package/genes/docs-writer/phenotype.json +28 -0
- package/genes/evolve-life/.cloud-manifest.json +6 -0
- package/genes/evolve-life/.compile-result.json +12 -0
- package/genes/evolve-life/README.md +52 -0
- package/genes/evolve-life/gene.ir.wasm +0 -0
- package/genes/evolve-life/gene.wasm +0 -0
- package/genes/evolve-life/index.ts +255 -0
- package/genes/evolve-life/phenotype.json +129 -0
- package/genes/evolve-life-bitwise/.cloud-manifest.json +6 -0
- package/genes/evolve-life-bitwise/.compile-result.json +12 -0
- package/genes/evolve-life-bitwise/gene.ir.wasm +0 -0
- package/genes/evolve-life-bitwise/gene.wasm +0 -0
- package/genes/evolve-life-bitwise/index.ts +273 -0
- package/genes/evolve-life-bitwise/phenotype.json +129 -0
- package/genes/evolve-life-sparse/.cloud-manifest.json +6 -0
- package/genes/evolve-life-sparse/.compile-result.json +12 -0
- package/genes/evolve-life-sparse/gene.ir.wasm +0 -0
- package/genes/evolve-life-sparse/gene.wasm +0 -0
- package/genes/evolve-life-sparse/index.ts +236 -0
- package/genes/evolve-life-sparse/phenotype.json +129 -0
- package/genes/fact-checker/.cloud-manifest.json +6 -0
- package/genes/fact-checker/.gene-manifest.json +8 -0
- package/genes/fact-checker/SKILL.md +373 -0
- package/genes/fact-checker/phenotype.json +28 -0
- package/genes/genesis-code-format/.cloud-manifest.json +6 -0
- package/genes/genesis-code-format/package.json +1 -0
- package/genes/genesis-code-format/phenotype.json +1 -0
- package/genes/genesis-file-read/.cloud-manifest.json +6 -0
- package/genes/genesis-file-read/index.ts +11 -1
- package/genes/genesis-file-read/package.json +1 -0
- package/genes/genesis-file-read/phenotype.json +1 -0
- package/genes/genesis-l0-constraint/.cloud-manifest.json +6 -0
- package/genes/genesis-l0-constraint/package.json +1 -0
- package/genes/genesis-l0-constraint/phenotype.json +1 -0
- package/genes/genesis-web-search/.cloud-manifest.json +2 -2
- package/genes/genesis-web-search/package.json +1 -0
- package/genes/genesis-web-search/phenotype.json +1 -0
- package/genes/genesis-web-search-lite/.cloud-manifest.json +6 -0
- package/genes/genesis-web-search-lite/package.json +1 -0
- package/genes/genesis-web-search-lite/phenotype.json +1 -0
- package/genes/git-workflow/.cloud-manifest.json +6 -0
- package/genes/git-workflow/.gene-manifest.json +8 -0
- package/genes/git-workflow/SKILL.md +407 -0
- package/genes/git-workflow/phenotype.json +28 -0
- package/genes/grammar-checker/.cloud-manifest.json +6 -0
- package/genes/grammar-checker/.gene-manifest.json +8 -0
- package/genes/grammar-checker/SKILL.md +194 -0
- package/genes/grammar-checker/index.ts +168 -0
- package/genes/grammar-checker/package.json +1 -0
- package/genes/grammar-checker/phenotype.json +52 -0
- package/genes/json-validator/.cloud-manifest.json +6 -0
- package/genes/json-validator/README.md +42 -0
- package/genes/json-validator/index.ts +112 -0
- package/genes/json-validator/phenotype.json +42 -0
- package/genes/license-advisor/.cloud-manifest.json +6 -0
- package/genes/license-advisor/.gene-manifest.json +8 -0
- package/genes/license-advisor/SKILL.md +117 -0
- package/genes/license-advisor/phenotype.json +28 -0
- package/genes/logic-architect/.cloud-manifest.json +6 -0
- package/genes/logic-architect/.gene-manifest.json +8 -0
- package/genes/logic-architect/SKILL.md +451 -0
- package/genes/logic-architect/phenotype.json +28 -0
- package/genes/markdown-formatter/.cloud-manifest.json +6 -0
- package/genes/markdown-formatter/README.md +34 -0
- package/genes/markdown-formatter/index.ts +86 -0
- package/genes/markdown-formatter/phenotype.json +32 -0
- package/genes/orch/.cloud-manifest.json +6 -0
- package/genes/orch/.gene-manifest.json +8 -0
- package/genes/orch/SKILL.md +504 -0
- package/genes/orch/phenotype.json +28 -0
- package/genes/particle-barneshut/.cloud-manifest.json +6 -0
- package/genes/particle-barneshut/.compile-result.json +12 -0
- package/genes/particle-barneshut/README.md +55 -0
- package/genes/particle-barneshut/gene.ir.wasm +0 -0
- package/genes/particle-barneshut/gene.wasm +0 -0
- package/genes/particle-barneshut/index.ts +486 -0
- package/genes/particle-barneshut/phenotype.json +137 -0
- package/genes/particle-brute/.cloud-manifest.json +6 -0
- package/genes/particle-brute/.compile-result.json +12 -0
- package/genes/particle-brute/README.md +55 -0
- package/genes/particle-brute/gene.ir.wasm +0 -0
- package/genes/particle-brute/gene.wasm +0 -0
- package/genes/particle-brute/index.ts +277 -0
- package/genes/particle-brute/phenotype.json +137 -0
- package/genes/particle-spatial/.cloud-manifest.json +6 -0
- package/genes/particle-spatial/.compile-result.json +12 -0
- package/genes/particle-spatial/README.md +53 -0
- package/genes/particle-spatial/gene.ir.wasm +0 -0
- package/genes/particle-spatial/gene.wasm +0 -0
- package/genes/particle-spatial/index.ts +352 -0
- package/genes/particle-spatial/phenotype.json +137 -0
- package/genes/performance-optimizer/.cloud-manifest.json +6 -0
- package/genes/performance-optimizer/.gene-manifest.json +8 -0
- package/genes/performance-optimizer/SKILL.md +480 -0
- package/genes/performance-optimizer/phenotype.json +28 -0
- package/genes/plagiarism-checker/.cloud-manifest.json +6 -0
- package/genes/plagiarism-checker/.gene-manifest.json +8 -0
- package/genes/plagiarism-checker/SKILL.md +342 -0
- package/genes/plagiarism-checker/phenotype.json +28 -0
- package/genes/product-manager/.cloud-manifest.json +6 -0
- package/genes/product-manager/.gene-manifest.json +8 -0
- package/genes/product-manager/SKILL.md +249 -0
- package/genes/product-manager/phenotype.json +28 -0
- package/genes/project-reviewer/.cloud-manifest.json +6 -0
- package/genes/project-reviewer/.gene-manifest.json +8 -0
- package/genes/project-reviewer/SKILL.md +312 -0
- package/genes/project-reviewer/phenotype.json +28 -0
- package/genes/prompt-engineer/.cloud-manifest.json +6 -0
- package/genes/prompt-engineer/.gene-manifest.json +8 -0
- package/genes/prompt-engineer/SKILL.md +411 -0
- package/genes/prompt-engineer/phenotype.json +28 -0
- package/genes/readability-analyzer/.cloud-manifest.json +6 -0
- package/genes/readability-analyzer/.gene-manifest.json +8 -0
- package/genes/readability-analyzer/SKILL.md +357 -0
- package/genes/readability-analyzer/index.ts +123 -0
- package/genes/readability-analyzer/package.json +1 -0
- package/genes/readability-analyzer/phenotype.json +35 -0
- package/genes/rotifer-protocol/SKILL.md +121 -0
- package/genes/security-auditor/.cloud-manifest.json +6 -0
- package/genes/security-auditor/.gene-manifest.json +8 -0
- package/genes/security-auditor/SKILL.md +494 -0
- package/genes/security-auditor/phenotype.json +28 -0
- package/genes/seo-optimizer/.cloud-manifest.json +6 -0
- package/genes/seo-optimizer/.gene-manifest.json +8 -0
- package/genes/seo-optimizer/SKILL.md +327 -0
- package/genes/seo-optimizer/index.ts +206 -0
- package/genes/seo-optimizer/package.json +1 -0
- package/genes/seo-optimizer/phenotype.json +1 -0
- package/genes/source-linker/.cloud-manifest.json +6 -0
- package/genes/source-linker/index.ts +88 -0
- package/genes/source-linker/phenotype.json +45 -0
- package/genes/style-optimizer/.cloud-manifest.json +6 -0
- package/genes/style-optimizer/.gene-manifest.json +8 -0
- package/genes/style-optimizer/SKILL.md +285 -0
- package/genes/style-optimizer/phenotype.json +28 -0
- package/genes/tech-lead/.cloud-manifest.json +6 -0
- package/genes/tech-lead/.gene-manifest.json +8 -0
- package/genes/tech-lead/SKILL.md +451 -0
- package/genes/tech-lead/phenotype.json +28 -0
- package/genes/test-wrap/.cloud-manifest.json +6 -0
- package/genes/test-wrap/.gene-manifest.json +8 -0
- package/genes/test-wrap/phenotype.json +28 -0
- package/genes/testing-strategist/.cloud-manifest.json +6 -0
- package/genes/testing-strategist/.gene-manifest.json +8 -0
- package/genes/testing-strategist/SKILL.md +500 -0
- package/genes/testing-strategist/phenotype.json +28 -0
- package/genes/text-summarizer/.cloud-manifest.json +6 -0
- package/genes/text-summarizer/README.md +34 -0
- package/genes/text-summarizer/index.ts +122 -0
- package/genes/text-summarizer/phenotype.json +32 -0
- package/genes/tone-analyzer/.cloud-manifest.json +6 -0
- package/genes/tone-analyzer/.gene-manifest.json +8 -0
- package/genes/tone-analyzer/SKILL.md +410 -0
- package/genes/tone-analyzer/phenotype.json +28 -0
- package/genes/translator/.cloud-manifest.json +6 -0
- package/genes/translator/.gene-manifest.json +8 -0
- package/genes/translator/SKILL.md +355 -0
- package/genes/translator/phenotype.json +28 -0
- package/genes/ui-components/.cloud-manifest.json +6 -0
- package/genes/ui-components/.gene-manifest.json +8 -0
- package/genes/ui-components/SKILL.md +467 -0
- package/genes/ui-components/phenotype.json +28 -0
- package/genes/uiux-designer/.cloud-manifest.json +6 -0
- package/genes/uiux-designer/.gene-manifest.json +8 -0
- package/genes/uiux-designer/SKILL.md +353 -0
- package/genes/uiux-designer/phenotype.json +28 -0
- package/genes/url-extractor/.cloud-manifest.json +6 -0
- package/genes/url-extractor/README.md +37 -0
- package/genes/url-extractor/index.ts +86 -0
- package/genes/url-extractor/phenotype.json +48 -0
- package/genes/ux-patterns/.cloud-manifest.json +6 -0
- package/genes/ux-patterns/.gene-manifest.json +8 -0
- package/genes/ux-patterns/SKILL.md +872 -0
- package/genes/ux-patterns/phenotype.json +28 -0
- package/genes/web3-components/.cloud-manifest.json +6 -0
- package/genes/web3-components/.gene-manifest.json +8 -0
- package/genes/web3-components/SKILL.md +390 -0
- package/genes/web3-components/phenotype.json +28 -0
- package/package.json +6 -5
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-components
|
|
3
|
+
description: 参数化UI组件库,根据风格参数动态生成按钮、输入框、卡片等组件样式。当用户提到"按钮""输入框""卡片""表格""弹窗""导航"等组件时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UI Components (参数化组件库)
|
|
7
|
+
|
|
8
|
+
**定位**: 根据风格参数动态生成组件样式,而非从固定变体中选择。
|
|
9
|
+
|
|
10
|
+
**依赖**:
|
|
11
|
+
- [brand-personality](../brand-personality/SKILL.md) - 提供风格维度参数
|
|
12
|
+
- [design-tokens](../design-tokens/SKILL.md) - 提供CSS变量
|
|
13
|
+
- [ux-patterns](../ux-patterns/SKILL.md) - 提供文案和动效参数
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 参数化组件生成
|
|
18
|
+
|
|
19
|
+
### 核心思路
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
输入: 风格参数 (borderRadius, motionIntensity, contrast, colors...)
|
|
23
|
+
↓
|
|
24
|
+
处理: 参数映射函数
|
|
25
|
+
↓
|
|
26
|
+
输出: 组件CSS类/样式
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 参数到样式的映射
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
interface StyleParams {
|
|
33
|
+
borderRadius: number; // 0-100 → 圆角
|
|
34
|
+
motionIntensity: number; // 0-100 → 动效
|
|
35
|
+
contrast: number; // 0-100 → 阴影/边框强度
|
|
36
|
+
density: number; // 0-100 → 间距
|
|
37
|
+
colors: {
|
|
38
|
+
primary: string;
|
|
39
|
+
secondary?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function generateButtonStyles(params: StyleParams) {
|
|
44
|
+
const radius = Math.round(params.borderRadius * 0.32); // 0-32px
|
|
45
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
46
|
+
const shadowOpacity = 0.05 + params.contrast * 0.002;
|
|
47
|
+
const padding = params.density > 50 ? 'px-6 py-3' : 'px-4 py-2.5';
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
base: `
|
|
51
|
+
${padding}
|
|
52
|
+
bg-[${params.colors.primary}] text-white
|
|
53
|
+
text-sm font-medium
|
|
54
|
+
rounded-[${radius}px]
|
|
55
|
+
transition-all duration-[${Math.round(duration)}ms]
|
|
56
|
+
`,
|
|
57
|
+
hover: params.contrast > 50
|
|
58
|
+
? `hover:shadow-lg hover:-translate-y-0.5`
|
|
59
|
+
: `hover:brightness-110`,
|
|
60
|
+
active: params.motionIntensity > 60
|
|
61
|
+
? `active:scale-95`
|
|
62
|
+
: `active:brightness-95`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 按钮 (Button)
|
|
70
|
+
|
|
71
|
+
### 参数化生成
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
function Button({ params, children }: { params: StyleParams; children: React.ReactNode }) {
|
|
75
|
+
const radius = Math.round(params.borderRadius * 0.32);
|
|
76
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
77
|
+
|
|
78
|
+
// 根据参数决定样式特性
|
|
79
|
+
const useGradient = params.contrast > 70;
|
|
80
|
+
const useShadow = params.contrast > 40;
|
|
81
|
+
const useScale = params.motionIntensity > 50;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<button
|
|
85
|
+
className={`
|
|
86
|
+
px-${params.density > 50 ? 6 : 4} py-${params.density > 50 ? 3 : 2.5}
|
|
87
|
+
text-sm font-medium text-white
|
|
88
|
+
rounded-[${radius}px]
|
|
89
|
+
transition-all duration-[${Math.round(duration)}ms]
|
|
90
|
+
${useGradient
|
|
91
|
+
? 'bg-gradient-to-r from-[var(--color-primary)] to-[var(--color-secondary)]'
|
|
92
|
+
: 'bg-[var(--color-primary)]'}
|
|
93
|
+
${useShadow ? 'shadow-md hover:shadow-lg' : ''}
|
|
94
|
+
${useScale ? 'hover:scale-[1.02] active:scale-95' : 'hover:brightness-110'}
|
|
95
|
+
`}
|
|
96
|
+
>
|
|
97
|
+
{children}
|
|
98
|
+
</button>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 参数效果对照
|
|
104
|
+
|
|
105
|
+
| 参数组合 | 效果 |
|
|
106
|
+
|---------|------|
|
|
107
|
+
| borderRadius: 15, motionIntensity: 15 | 小圆角,快速过渡,无缩放 |
|
|
108
|
+
| borderRadius: 70, motionIntensity: 55 | 大圆角,中等过渡,轻微缩放 |
|
|
109
|
+
| borderRadius: 85, motionIntensity: 80, contrast: 80 | 药丸形,弹性动效,渐变+阴影 |
|
|
110
|
+
|
|
111
|
+
### 示例输出
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<!-- borderRadius: 20, motionIntensity: 30, contrast: 40 -->
|
|
115
|
+
<button class="px-4 py-2.5 bg-[var(--color-primary)] text-white text-sm font-medium
|
|
116
|
+
rounded-[6px] transition-all duration-[206ms]
|
|
117
|
+
hover:brightness-110">
|
|
118
|
+
提交
|
|
119
|
+
</button>
|
|
120
|
+
|
|
121
|
+
<!-- borderRadius: 70, motionIntensity: 60, contrast: 60 -->
|
|
122
|
+
<button class="px-6 py-3 bg-[var(--color-primary)] text-white text-sm font-medium
|
|
123
|
+
rounded-[22px] shadow-md transition-all duration-[332ms]
|
|
124
|
+
hover:shadow-lg hover:scale-[1.02] active:scale-95">
|
|
125
|
+
开始使用
|
|
126
|
+
</button>
|
|
127
|
+
|
|
128
|
+
<!-- borderRadius: 90, motionIntensity: 85, contrast: 80 -->
|
|
129
|
+
<button class="px-6 py-3 text-white text-sm font-semibold
|
|
130
|
+
rounded-full shadow-lg
|
|
131
|
+
bg-gradient-to-r from-[var(--color-primary)] to-[var(--color-secondary)]
|
|
132
|
+
transition-all duration-[437ms]
|
|
133
|
+
hover:shadow-xl hover:scale-105 active:scale-95">
|
|
134
|
+
Let's Go!
|
|
135
|
+
</button>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 卡片 (Card)
|
|
141
|
+
|
|
142
|
+
### 参数化生成
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
function generateCardStyles(params: StyleParams) {
|
|
146
|
+
const radius = Math.round(params.borderRadius * 0.32) + 4; // 卡片圆角稍大
|
|
147
|
+
const padding = 16 + params.density * 0.16; // 16-32px
|
|
148
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
149
|
+
|
|
150
|
+
// 边框 vs 阴影
|
|
151
|
+
const useShadow = params.contrast > 50;
|
|
152
|
+
const borderStyle = useShadow
|
|
153
|
+
? 'border-transparent shadow-md'
|
|
154
|
+
: 'border border-gray-100';
|
|
155
|
+
|
|
156
|
+
// 悬停效果
|
|
157
|
+
const hoverEffect = params.motionIntensity > 40
|
|
158
|
+
? 'hover:shadow-lg hover:-translate-y-1'
|
|
159
|
+
: 'hover:border-gray-200';
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
container: `
|
|
163
|
+
bg-white rounded-[${radius}px] p-[${Math.round(padding)}px]
|
|
164
|
+
${borderStyle}
|
|
165
|
+
transition-all duration-[${Math.round(duration)}ms]
|
|
166
|
+
${hoverEffect}
|
|
167
|
+
`,
|
|
168
|
+
title: `text-lg font-semibold text-gray-900 mb-2`,
|
|
169
|
+
description: `text-sm text-gray-500 leading-relaxed`
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 示例输出
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<!-- 低参数: borderRadius: 25, contrast: 35 -->
|
|
178
|
+
<div class="bg-white rounded-[12px] p-5 border border-gray-100
|
|
179
|
+
transition-all duration-[185ms]
|
|
180
|
+
hover:border-gray-200">
|
|
181
|
+
<h3 class="text-lg font-semibold text-gray-900 mb-2">标题</h3>
|
|
182
|
+
<p class="text-sm text-gray-500">描述内容</p>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<!-- 高参数: borderRadius: 75, contrast: 65, motionIntensity: 60 -->
|
|
186
|
+
<div class="bg-white rounded-[28px] p-7 shadow-md
|
|
187
|
+
transition-all duration-[332ms]
|
|
188
|
+
hover:shadow-lg hover:-translate-y-1">
|
|
189
|
+
<h3 class="text-lg font-semibold text-gray-900 mb-2">温暖标题</h3>
|
|
190
|
+
<p class="text-sm text-gray-500 leading-relaxed">温暖的描述文字</p>
|
|
191
|
+
</div>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 输入框 (Input)
|
|
197
|
+
|
|
198
|
+
### 参数化生成
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
function generateInputStyles(params: StyleParams) {
|
|
202
|
+
const radius = Math.round(params.borderRadius * 0.28); // 输入框圆角稍小
|
|
203
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
204
|
+
|
|
205
|
+
// 背景样式
|
|
206
|
+
const bgStyle = params.contrast < 40
|
|
207
|
+
? 'bg-transparent border-b border-gray-300' // 下划线风格
|
|
208
|
+
: 'bg-gray-50 border border-gray-200'; // 常规风格
|
|
209
|
+
|
|
210
|
+
return `
|
|
211
|
+
w-full px-4 py-2.5 text-sm text-gray-900
|
|
212
|
+
${bgStyle}
|
|
213
|
+
rounded-[${radius}px]
|
|
214
|
+
placeholder-gray-400
|
|
215
|
+
transition-all duration-[${Math.round(duration)}ms]
|
|
216
|
+
focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20
|
|
217
|
+
focus:border-[var(--color-primary)]
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 示例输出
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<!-- 低对比度/极简: borderRadius: 10, contrast: 25 -->
|
|
226
|
+
<input class="w-full px-4 py-2.5 text-sm text-gray-900
|
|
227
|
+
bg-transparent border-b border-gray-300
|
|
228
|
+
rounded-[3px] placeholder-gray-400
|
|
229
|
+
transition-all duration-[122ms]
|
|
230
|
+
focus:outline-none focus:border-[var(--color-primary)]"
|
|
231
|
+
placeholder="请输入...">
|
|
232
|
+
|
|
233
|
+
<!-- 高参数: borderRadius: 65, contrast: 55 -->
|
|
234
|
+
<input class="w-full px-4 py-2.5 text-sm text-gray-900
|
|
235
|
+
bg-gray-50 border border-gray-200
|
|
236
|
+
rounded-[18px] placeholder-gray-400
|
|
237
|
+
transition-all duration-[311ms]
|
|
238
|
+
focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20
|
|
239
|
+
focus:border-[var(--color-primary)]"
|
|
240
|
+
placeholder="请输入...">
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 弹窗 (Modal)
|
|
246
|
+
|
|
247
|
+
### 参数化生成
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
function generateModalStyles(params: StyleParams) {
|
|
251
|
+
const radius = Math.round(params.borderRadius * 0.32) + 8; // 弹窗圆角更大
|
|
252
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
253
|
+
const padding = 20 + params.density * 0.12;
|
|
254
|
+
|
|
255
|
+
// 入场动画
|
|
256
|
+
const animation = params.motionIntensity > 60
|
|
257
|
+
? 'animate-pop-in' // 弹性缩放
|
|
258
|
+
: 'animate-fade-in'; // 简单淡入
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
overlay: `fixed inset-0 bg-black/30 backdrop-blur-sm z-40`,
|
|
262
|
+
container: `
|
|
263
|
+
fixed inset-0 flex items-center justify-center z-50 p-4
|
|
264
|
+
`,
|
|
265
|
+
content: `
|
|
266
|
+
bg-white rounded-[${radius}px] shadow-xl w-full max-w-md
|
|
267
|
+
${animation}
|
|
268
|
+
`,
|
|
269
|
+
header: `px-${Math.round(padding / 4)} py-4 border-b border-gray-100`,
|
|
270
|
+
body: `px-${Math.round(padding / 4)} py-4`,
|
|
271
|
+
footer: `px-${Math.round(padding / 4)} py-4 bg-gray-50 flex justify-end gap-3
|
|
272
|
+
rounded-b-[${radius}px]`
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 导航 (Navigation)
|
|
280
|
+
|
|
281
|
+
### 侧边栏参数化
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
function generateSidebarStyles(params: StyleParams) {
|
|
285
|
+
const itemRadius = Math.round(params.borderRadius * 0.24);
|
|
286
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
287
|
+
|
|
288
|
+
return {
|
|
289
|
+
container: `w-64 h-screen bg-white border-r border-gray-100 p-4`,
|
|
290
|
+
navItem: `
|
|
291
|
+
flex items-center gap-3 px-3 py-2.5
|
|
292
|
+
text-gray-600 text-sm
|
|
293
|
+
rounded-[${itemRadius}px]
|
|
294
|
+
transition-colors duration-[${Math.round(duration)}ms]
|
|
295
|
+
hover:bg-gray-50
|
|
296
|
+
`,
|
|
297
|
+
navItemActive: `
|
|
298
|
+
flex items-center gap-3 px-3 py-2.5
|
|
299
|
+
text-[var(--color-primary)] font-medium text-sm
|
|
300
|
+
rounded-[${itemRadius}px]
|
|
301
|
+
bg-[var(--color-primary)]/5
|
|
302
|
+
`
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 表格 (Table)
|
|
310
|
+
|
|
311
|
+
### 参数化生成
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
function generateTableStyles(params: StyleParams) {
|
|
315
|
+
const containerRadius = Math.round(params.borderRadius * 0.32);
|
|
316
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
container: `bg-white rounded-[${containerRadius}px] border border-gray-100 overflow-hidden`,
|
|
320
|
+
header: `bg-gray-50 border-b border-gray-100`,
|
|
321
|
+
headerCell: `px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider`,
|
|
322
|
+
body: `divide-y divide-gray-50`,
|
|
323
|
+
row: `hover:bg-gray-50 transition-colors duration-[${Math.round(duration * 0.5)}ms]`,
|
|
324
|
+
cell: `px-6 py-4 text-sm text-gray-900`
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## 反馈组件
|
|
332
|
+
|
|
333
|
+
### Toast 参数化
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
function generateToastStyles(params: StyleParams) {
|
|
337
|
+
const radius = Math.round(params.borderRadius * 0.28);
|
|
338
|
+
const duration = 80 + params.motionIntensity * 4.2;
|
|
339
|
+
|
|
340
|
+
// 入场动画
|
|
341
|
+
const animation = params.motionIntensity > 50
|
|
342
|
+
? 'animate-slide-up'
|
|
343
|
+
: 'animate-fade-in';
|
|
344
|
+
|
|
345
|
+
return `
|
|
346
|
+
flex items-center gap-3 px-4 py-3
|
|
347
|
+
bg-white border border-gray-100
|
|
348
|
+
rounded-[${radius}px] shadow-lg
|
|
349
|
+
${animation}
|
|
350
|
+
`;
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### 空状态参数化
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
function generateEmptyStateStyles(params: StyleParams, emotionalTone: number) {
|
|
358
|
+
// 根据 emotionalTone 决定是否使用 emoji/插画
|
|
359
|
+
const useEmoji = emotionalTone >= 60;
|
|
360
|
+
const iconSize = emotionalTone > 70 ? 'text-6xl' : 'text-4xl';
|
|
361
|
+
|
|
362
|
+
return {
|
|
363
|
+
container: `py-16 text-center`,
|
|
364
|
+
icon: useEmoji ? iconSize : 'w-16 h-16 text-gray-300',
|
|
365
|
+
title: `text-lg font-medium text-gray-900 mb-2`,
|
|
366
|
+
description: `text-sm text-gray-500 mb-6`,
|
|
367
|
+
action: `px-4 py-2 bg-[var(--color-primary)] text-white rounded-[var(--radius-md)]`
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## 预设快捷入口
|
|
375
|
+
|
|
376
|
+
预设只是预定义的参数组合:
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
const COMPONENT_PRESETS = {
|
|
380
|
+
minimal: {
|
|
381
|
+
borderRadius: 15, motionIntensity: 15, contrast: 35, density: 40
|
|
382
|
+
},
|
|
383
|
+
warm: {
|
|
384
|
+
borderRadius: 70, motionIntensity: 55, contrast: 45, density: 65
|
|
385
|
+
},
|
|
386
|
+
playful: {
|
|
387
|
+
borderRadius: 85, motionIntensity: 80, contrast: 70, density: 55
|
|
388
|
+
},
|
|
389
|
+
professional: {
|
|
390
|
+
borderRadius: 25, motionIntensity: 35, contrast: 55, density: 45
|
|
391
|
+
},
|
|
392
|
+
bold: {
|
|
393
|
+
borderRadius: 50, motionIntensity: 90, contrast: 95, density: 50
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// 使用预设
|
|
398
|
+
const warmButton = generateButtonStyles({
|
|
399
|
+
...COMPONENT_PRESETS.warm,
|
|
400
|
+
colors: { primary: '#E07A5F' }
|
|
401
|
+
});
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## 人性化细节
|
|
407
|
+
|
|
408
|
+
### 有机形状(高 borderRadius + 微调)
|
|
409
|
+
|
|
410
|
+
```css
|
|
411
|
+
/* 当 borderRadius > 70 时,可选择性使用不对称圆角 */
|
|
412
|
+
.organic-card {
|
|
413
|
+
border-radius: 24px 20px 28px 22px;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/* 或微妙倾斜 */
|
|
417
|
+
.playful-tilt {
|
|
418
|
+
transform: rotate(-0.5deg);
|
|
419
|
+
}
|
|
420
|
+
.playful-tilt:hover {
|
|
421
|
+
transform: rotate(0.5deg);
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### 渐变与光效(高 contrast)
|
|
426
|
+
|
|
427
|
+
```html
|
|
428
|
+
<!-- contrast > 70 时可使用 -->
|
|
429
|
+
<div class="relative overflow-hidden">
|
|
430
|
+
<div class="absolute -top-40 -right-40 w-80 h-80
|
|
431
|
+
bg-[var(--color-primary)]/10 rounded-full blur-3xl"></div>
|
|
432
|
+
<!-- 内容 -->
|
|
433
|
+
</div>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## 使用工作流
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
// 1. 获取风格参数
|
|
442
|
+
const params = getStyleParams(); // 从 brand-personality 获取
|
|
443
|
+
|
|
444
|
+
// 2. 生成组件样式
|
|
445
|
+
const buttonStyles = generateButtonStyles(params);
|
|
446
|
+
const cardStyles = generateCardStyles(params);
|
|
447
|
+
const inputStyles = generateInputStyles(params);
|
|
448
|
+
|
|
449
|
+
// 3. 应用到组件
|
|
450
|
+
<button className={buttonStyles.base + buttonStyles.hover}>
|
|
451
|
+
提交
|
|
452
|
+
</button>
|
|
453
|
+
|
|
454
|
+
<div className={cardStyles.container}>
|
|
455
|
+
<h3 className={cardStyles.title}>标题</h3>
|
|
456
|
+
<p className={cardStyles.description}>描述</p>
|
|
457
|
+
</div>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## 相关技能
|
|
463
|
+
|
|
464
|
+
- **brand-personality**: 提供风格维度参数
|
|
465
|
+
- **design-tokens**: 提供CSS变量(圆角、颜色、动效)
|
|
466
|
+
- **ux-patterns**: 提供文案和动效参数
|
|
467
|
+
- **uiux-designer**: 统一调度入口
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"domain": "ui.components",
|
|
3
|
+
"description": "Parameterized UI component library. Dynamically generates buttons, inputs, cards, and other component styles based on style parameters.",
|
|
4
|
+
"inputSchema": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"prompt": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"required": []
|
|
12
|
+
},
|
|
13
|
+
"outputSchema": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"result": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": [],
|
|
22
|
+
"version": "0.1.0",
|
|
23
|
+
"author": "rotifer-team",
|
|
24
|
+
"createdAt": 1771939271216,
|
|
25
|
+
"fidelity": "Wrapped",
|
|
26
|
+
"transparency": "Open",
|
|
27
|
+
"source": "skill"
|
|
28
|
+
}
|