SuperAPI AI 工具集

etch-layouts

通用与其它

查看项目

更新于 10-16 05:47

技能介绍

用途:该技能用于为 Etch(WordPress 可视化构建器)创建布局、区块或组件,需要参考项目根目录的 etch-skills/generating-layouts.md。

产物结构:布局放在 gt-design-system/layouts/{component-name}/ 下,包含 {component-name}-etch.json(粘贴到 Etch 的 JSON)、{component-name}-preview.html(内联编译 CSS 的浏览器预览)、{component-name}.js(仅在需要交互时)。

粘贴格式:Etch 仅接受 JSON 粘贴,版本为 2.1,顶层字段包括 type(恒为 "block")、gutenbergBlock(含 blockName、attrs、innerBlocks、innerHTML、innerContent)、version、timestamp、styles(样式 ID 到样式定义的映射)。区块类型有 etch/element、etch/text、etch/loop、etch/condition、etch/component。每个区块必须包含 blockName、attrs、innerBlocks、innerHTML、innerContent 五个字段;每个元素必须有 metadata.name、class 属性及指向 styles 映射的 styles 数组。

样式:样式定义含 type(class/id/element)、selector、collection、css、readonly。CSS 使用类 SCSS 语法,所有像素值用 to-rem(),通过 & 写伪类与嵌套媒体查询,可结合 clamp()。颜色、字体、间距、布局、圆角、阴影、动效、层级均使用 GT 设计系统的 CSS 变量,如 --bg-base、--text-primary、--accent、--space-2xl、--radius-full 等,不得硬编码。命名采用 BEM。

动态表达式:属性与文本可用 {context.path} 语法,如 {site.url}、{this.title}、{user.displayName}、{props.myProp},循环项可用 {post.title}、{post.permalink.relative}、{post.date.dateFormat("M j, Y")}、{post.excerpt | stripTags | truncate:100} 等。

关键限制:不使用 data-etch-element(仅属旧转换脚本);不使用内置样式(如 etch-section-style / etch-container-style);每个元素各自拥有独立样式 ID,不用整体区块 CSS;所有像素值必须经 to-rem(),不得使用原始 px;颜色间距尺寸不得硬编码。

使用限制:关于价格、收费、平台支持范围及具体效果,资料暂未提供。