hyva-ui-component
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHyva UI Component
Hyva UI组件
Applies Hyva UI template-based (non-CMS) components to a Hyvä theme by copying files from to .
{hyva_ui_path}/components/app/design/frontend/{Vendor}/{Theme}/Path variable: = (default) or user-provided custom path.
{hyva_ui_path}vendor/hyva-themes/hyva-uiCommand execution: For any commands that need to run inside the development environment (e.g., commands), use the skill to detect the environment and determine the appropriate command wrapper.
bin/magentohyva-exec-shell-cmd将基于Hyva UI模板的(非CMS)组件应用到Hyvä主题中,具体方式是将文件从复制到。
{hyva_ui_path}/components/app/design/frontend/{Vendor}/{Theme}/路径变量: = (默认值)或用户提供的自定义路径。
{hyva_ui_path}vendor/hyva-themes/hyva-ui命令执行: 对于需要在开发环境中运行的任何命令(如命令),请使用技能来检测环境并确定合适的命令包装器。
bin/magentohyva-exec-shell-cmdStep 0: Verify Hyva UI Installation
步骤0:验证Hyva UI安装
bash
ls vendor/hyva-themes/hyva-ui/components/ 2>/dev/nullIf NOT found, offer options: (A) User provides custom extraction path, (B) , (C) Download from https://hyva.io/my-account/my-downloads/
composer require --dev hyva-themes/hyva-uiAfter install, refresh catalog:
<skill_path>/scripts/refresh_catalog.sh {hyva_ui_path} <skill_path>/references/components.mdWhere is the directory containing this SKILL.md file.
<skill_path>bash
ls vendor/hyva-themes/hyva-ui/components/ 2>/dev/null如果未找到,提供以下选项:(A) 用户提供自定义提取路径,(B) ,(C) 从https://hyva.io/my-account/my-downloads/下载
composer require --dev hyva-themes/hyva-ui安装完成后,刷新目录:
<skill_path>/scripts/refresh_catalog.sh {hyva_ui_path} <skill_path>/references/components.md其中是包含此SKILL.md文件的目录。
<skill_path>Step 1: Identify Theme Path
步骤1:确定主题路径
Use the skill to find existing Hyvä themes. Filter the results to only include themes in (exclude vendor themes).
hyva-theme-listapp/design/frontend/Prompt the user to select:
- Existing Hyvä themes: List themes returned by the script as options (e.g., )
Example/winterWonderTheme - Create new theme: Always include an option to create a new child theme
If user selects "Create new theme":
- Use the skill to create the new theme first
hyva-child-theme - Continue with the newly created theme path after the skill completes
If user selects an existing theme:
Continue with the selected theme path:
app/design/frontend/{Vendor}/{Theme}使用技能查找现有的Hyvä主题。过滤结果,仅包含中的主题(排除vendor主题)。
hyva-theme-listapp/design/frontend/提示用户选择:
- 现有Hyvä主题:将脚本返回的主题列为选项(例如)
Example/winterWonderTheme - 创建新主题:始终包含创建新子主题的选项
如果用户选择“创建新主题”:
- 首先使用技能创建新主题
hyva-child-theme - 技能完成后,使用新创建的主题路径继续操作
如果用户选择现有主题:
使用选定的主题路径继续操作:
app/design/frontend/{Vendor}/{Theme}Step 2: List or Select Component
步骤2:列出或选择组件
If no component specified or user asks to list components, show only the "Non-CMS Components (Template-Based)" section from .
references/components.mdDo NOT list or mention:
- CMS components (accordion, card, categories, error-page, generic-content, order-confirmation, shortcuts, testimonial, usp, product-data/C-highlights)
- Plugins (alpine-collapse, splidejs, sticky-header, tailwind-v3-design-tokens, tailwind-v4)
These are internal dependencies or require the CMS Tailwind JIT compiler and are not applicable for direct installation via this skill.
如果未指定组件,或用户要求列出组件,请显示中的仅“非CMS组件(基于模板)”部分。
references/components.md请勿列出或提及:
- CMS组件(手风琴、卡片、分类、错误页面、通用内容、订单确认、快捷方式、推荐语、USP、product-data/C-highlights)
- 插件(alpine-collapse、splidejs、sticky-header、tailwind-v3-design-tokens、tailwind-v4)
这些是内部依赖项,或需要CMS Tailwind JIT编译器,不适合通过此技能直接安装。
Step 3: Show Variants
步骤3:显示变体
Variants: A=Basic, B=Enhanced, C=Advanced, D=Specialized. List with:
ls {hyva_ui_path}/components/{component}/变体:A=基础版,B=增强版,C=进阶版,D=专业版。使用以下命令列出:
ls {hyva_ui_path}/components/{component}/Step 4: Read Component README
步骤4:查看组件README
Always read before copying. Present to user: dependencies, configuration options, special requirements.
{hyva_ui_path}/components/{component}/{variant}/README.md在复制之前,务必阅读。向用户展示其中的依赖项、配置选项和特殊要求。
{hyva_ui_path}/components/{component}/{variant}/README.mdStep 5: Copy Component Files
步骤5:复制组件文件
Before copying, check which destination files already exist to track created vs updated:
bash
undefined复制前,检查哪些目标文件已存在,以跟踪创建和更新的文件:
bash
undefinedList source files
列出源文件
find {hyva_ui_path}/components/{component}/{variant}/src -type f
find {hyva_ui_path}/components/{component}/{variant}/src -type f
For each source file, check if destination exists
对每个源文件,检查目标文件是否存在
e.g., for src/Magento_Catalog/templates/product/view/gallery.phtml
例如,对于src/Magento_Catalog/templates/product/view/gallery.phtml
check: {theme_path}/Magento_Catalog/templates/product/view/gallery.phtml
检查:{theme_path}/Magento_Catalog/templates/product/view/gallery.phtml
Track each file as either:
- **created**: Destination file did not exist before copy
- **updated**: Destination file already existed (will be overwritten)
Then copy:
```bash
cp -r {hyva_ui_path}/components/{component}/{variant}/src/* {theme_path}/The directory contains Magento module folders (, , etc.) that map directly to theme structure. For existing layout XML files, merge content rather than overwriting.
src/Magento_Theme/Magento_Catalog/
将每个文件标记为以下类型之一:
- **(created)**: 目标文件在复制前不存在
- **(updated)**: 目标文件已存在(将被覆盖)
然后执行复制:
```bash
cp -r {hyva_ui_path}/components/{component}/{variant}/src/* {theme_path}/src/Magento_Theme/Magento_Catalog/Step 5.5: Add XML Configuration Options
步骤5.5:添加XML配置选项
Check if README contains XML configuration (look for , ).
<var name="etc/view.xmlIf found:
- Extract the first XML block containing elements with default values
<var name= - Identify the module attribute (e.g., )
module="Magento_Catalog" - Add to :
{theme_path}/etc/view.xml- If file doesn't exist: Create with full structure
<view> - If exists: Add
<vars module="...">elements inside it<var> - If section missing: Add new before
<vars module="..."></view>
- If file doesn't exist: Create with full
- Notify: "Added configuration options to with default values."
{theme_path}/etc/view.xml
Preserve existing view.xml content and keep XML comments from README.
检查README中是否包含XML配置(查找、)。
<var name="etc/view.xml如果找到:
- 提取第一个包含带有默认值的元素的XML块
<var name= - 识别模块属性(例如)
module="Magento_Catalog" - 将其添加到中:
{theme_path}/etc/view.xml- 如果文件不存在:创建完整的结构
<view> - 如果已存在:在其中添加
<vars module="...">元素<var> - 如果该部分缺失:在之前添加新的
</view><vars module="...">
- 如果文件不存在:创建完整的
- 通知用户:"已将配置选项添加到,使用默认值。"
{theme_path}/etc/view.xml
保留现有的view.xml内容,并保留README中的XML注释。
Step 6: Handle Dependencies
步骤6:处理依赖项
Check README for dependencies and install them automatically (do not ask the user to select plugins):
- Plugin dependencies: Copy required files from (e.g., splidejs for gallery/D-splide)
{hyva_ui_path}/plugins/{plugin}/src/ - Component dependencies: Apply dependent components first
- External packages: e.g.,
composer require hyva-themes/magento2-hyva-payment-icons
检查README中的依赖项并自动安装(无需让用户选择插件):
- 插件依赖项: 从复制所需文件(例如,图库/D-splide所需的splidejs)
{hyva_ui_path}/plugins/{plugin}/src/ - 组件依赖项: 先应用依赖的组件
- 外部包: 例如
composer require hyva-themes/magento2-hyva-payment-icons
Step 7: Ask to recompile styles
步骤7:询问是否重新编译样式
- Rebuild Tailwind: Always ask: "Do you need to recompile Tailwind CSS styles?" Never automatically build — an external tool may already be handling this. If the user wants to compile, use the skill with the target theme.
hyva-compile-tailwind-css
- 重建Tailwind: 始终询问:"是否需要重新编译Tailwind CSS样式?" 切勿自动构建——外部工具可能已在处理此操作。如果用户需要编译,请使用技能针对目标主题执行。
hyva-compile-tailwind-css
Step 8: Output Summary
步骤8:输出摘要
After applying all changes, output a summary of modifications:
应用所有更改后,输出修改的摘要:
8.1: List Modified Files
8.1:列出修改的文件
Display all files that were created or modified during this component installation. Use the tracking from Step 5 to label each file correctly:
- (created): File did not exist before and was newly created
- (updated): File already existed and was overwritten
Modified files:
- {theme_path}/Magento_Catalog/templates/product/view/gallery.phtml (updated)
- {theme_path}/Magento_Theme/templates/html/header.phtml (created)
- {theme_path}/etc/view.xml (updated)显示在此组件安装过程中创建或修改的所有文件。使用步骤5中的跟踪信息为每个文件正确标记:
- (created): 文件之前不存在,是新创建的
- (updated): 文件已存在,被覆盖
修改的文件:
- {theme_path}/Magento_Catalog/templates/product/view/gallery.phtml (updated)
- {theme_path}/Magento_Theme/templates/html/header.phtml (created)
- {theme_path}/etc/view.xml (updated)8.2: XML Configuration Table
8.2:XML配置表
If XML configuration was added to , parse the XML block from the README and display a table of options:
{theme_path}/etc/view.xmlbash
undefined如果已向添加XML配置,请解析README中的XML块并显示选项表:
{theme_path}/etc/view.xmlbash
undefinedExtract the XML config block from README and parse it
从README中提取XML配置块并解析
php <skill_path>/scripts/parse_readme_xml.php --format=table < xml_block.txt
The table shows each option with columns:
- **Option**: The full option path without a common prefix (e.g., `magnifier.enable`)
- **Value**: The default value configured
- **Description**: Explanatory text from the XML comment
Example output (common prefix like `gallery.` is automatically stripped):Option | Value | Description
---------------------+------------+---------------------------------------------------
nav | thumbs | Gallery navigation style (false/thumbs/counter)
magnifier.enable | false | Turn on/off magnifier (true/false)
For markdown output (e.g., when creating documentation), use `--format=md`.php <skill_path>/scripts/parse_readme_xml.php --format=table < xml_block.txt
该表显示每个选项,包含以下列:
- **选项**:不带公共前缀的完整选项路径(例如`magnifier.enable`)
- **值**:配置的默认值
- **说明**:XML注释中的解释文本
示例输出(自动去除公共前缀如`gallery.`):选项 | 值 | 说明
---------------------+------------+---------------------------------------------------
nav | thumbs | 图库导航样式(false/thumbs/counter)
magnifier.enable | false | 开启/关闭放大镜(true/false)
对于Markdown输出(例如创建文档时),使用`--format=md`。Step 9: Final steps
步骤9:最终步骤
- Review copied templates for store-specific customization
- 检查复制的模板,针对店铺进行特定定制
Quick Reference
快速参考
{hyva_ui_path}/components/{component}/{variant}/
├── README.md # Instructions
├── media/ # Preview images
└── src/ # Files to copy to themeSee for the full component catalog (only show non-CMS section to users).
<!-- Copyright © Hyvä Themes https://hyva.io. All rights reserved. Licensed under OSL 3.0 -->references/components.md{hyva_ui_path}/components/{component}/{variant}/
├── README.md # 说明文档
├── media/ # 预览图片
└── src/ # 要复制到主题的文件有关完整的组件目录,请查看(仅向用户显示非CMS部分)。
<!-- Copyright © Hyvä Themes https://hyva.io. All rights reserved. Licensed under OSL 3.0 -->",references/components.md