Skip to content

feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId - #153

Open
muzi131313 wants to merge 3 commits into
masterfrom
feat_team_library_api_enhance
Open

feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId#153
muzi131313 wants to merge 3 commits into
masterfrom
feat_team_library_api_enhance

Conversation

@muzi131313

@muzi131313 muzi131313 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

"## 变更摘要

getTeamLibraryAsync() 返回的 TeamLibrary 类型增强,对齐 master-web 运行时实际返回结构。纯类型声明变更(plugin.d.ts),无运行时影响。


改动内容

ComponentPropertyValue 增强(对齐 master-web 运行时):

  • 新增 variableId?: string — 当组件属性绑定到变量时,对应的变量 id(仅 TEXT/BOOLEAN 类型可能存在)

TeamLibraryComponent 增强(对齐 master-web MR !15649):

  • properties?: ComponentPropertyValue[] — 组件属性 / 变体属性,对齐 ComponentPropertyValue 结构;老库可能缺省
  • textNodeNames?: string[] — 组件所有后代 TEXT 图层的名称(去重);老库可能缺省

TeamLibraryStyle 增强(对齐 master-web MR !15649):

  • values?: ReadonlyArray<TeamLibraryStyleValue> — 各模式下的样式值列表,元素结构为 { modeId, modeName, value }
  • codeSyntax?: VariableCodeSyntax — 代码语法(web/android/ios),来自发布时 cover.codeSyntax;老库可能缺省

新增 TeamLibraryStyleValue 接口

  • modeId: string — 模式 id
  • modeName: string — 模式名称
  • value: any — 该模式下的样式值,形态随 style 类型变化(见下方)

values 中 value 的形态

样式分类 value 形态
paints / colors Paint[](colors 由变量化颜色的 floatData 转换)
effects Effect[]
texts 文本样式对象数组
grids LayoutGrid[]
strokeWidths / numbers / spacings / paddings / cornerRadiuses number[]
strings string
bools boolean

变量引用项或解析异常时 value 为 undefined,但仍保留 mode 条目。


文件变更

文件 改动 说明
plugin.d.ts +37 -0 类型声明增强

关联 MR

关联

- TeamLibraryComponent 新增 properties?: ComponentPropertyValue[]
  和 textNodeNames?: string[](老库可能缺省)
- TeamLibraryStyle 新增 values?: ReadonlyArray<TeamLibraryStyleValue>
- 新增 TeamLibraryStyleValue 类型 { modeId, modeName, value }
- ComponentPropertyValue 补 variableId?: string 字段

对应 master-web 改动: getTeamLibraryAsync 返回结构增强
复用已有 VariableCodeSyntax 类型, 对齐 master-web 发布 cover.codeSyntax
老库可能缺省
- 新增 ReferenceEffect 接口(type: 'REFERENCE' + reference/referenceSource/modeId)
- 新增 ReferencePaint 接口(type: 'REFERENCE' + reference/referenceSource/modeId)
- 扩展 Effect/Paint 联合类型,覆盖 style 引用 style 的场景
@muzi131313 muzi131313 changed the title feat(typings): TeamLibrary 暴露组件 properties/textNodeNames 与样式 values feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId Jul 22, 2026
@muzi131313 muzi131313 changed the title feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId #77 Jul 27, 2026
@muzi131313 muzi131313 changed the title feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId #77 feat(typings): TeamLibrary 暴露组件 properties/textNodeNames + 样式 values/codeSyntax + ComponentPropertyValue 补 variableId Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants