Style
自定义样式。
type Style = PaintStyle | EffectStyle | TextStyle | GridStyle | StrokeWidthStyle | PaddingStyle | SpacingStyle | CornerRadiusStyle
PaintStyle:填充及描边样式,具体可查看类型PaintStyle。EffectStyle:特效样式,具体可查看类型EffectStyle。TextStyle:文字样式,具体可查看类型TextStyle。GridStyle:网格样式,具体可查看类型GridStyle。StrokeWidthStyle:描边宽度样式,具体可查看类型StrokeWidthStyle。PaddingStyle:内边距样式,具体可查看类型PaddingStyle。SpacingStyle:间距样式,具体可查看类型SpacingStyle。CornerRadiusStyle:圆角样式,具体可查看类型CornerRadiusStyle。
StyleType
样式类型。
type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID' | 'STROKE_WIDTH' | 'PADDING' | 'SPACING' | 'CORNER_RADIUS'
PAINT:填充。TEXT:文字。EFFECT:特效。GRID:网格。STROKE_WIDTH:描边宽度。PADDING:内边距。SPACING:间距。CORNER_RADIUS:圆角。
PaintStyle
填充及描边样式。
interface PaintStyle extends BaseStyle {
type: 'PAINT'
paints: ReadonlyArray<Paint>
}
type:类型,取值为填充PAINT。paints:填充,具体可查看类型 PAINT。
EffectStyle
特效样式。
interface EffectStyle extends BaseStyle {
type: 'EFFECT'
effects: ReadonlyArray<Effect>
}
type:类型,取值为特效EFFECT。effects:特效,具体可查看类型Effect。
TextStyle
文字样式。
interface TextStyle extends BaseStyle {
type: 'TEXT'
fontSize: number
fontStyle: string
fontName: FontName
decoration: TextDecoration
letterSpacing: LetterSpacing
letterSpacingUnit: 'PERCENT' | 'PIXELS'
lineHeight: LineHeight
textCase: TextCase
}
type:类型,取值为文字TEXT。fontSize:文字尺寸。fontStyle:文字样式。fontName:字体。decoration:文字装饰线,具体可查看类型 TextDecoration。letterSpacing:字间距,具体可查看类型 LetterSpacing。letterSpacingUnit:字间距单位,取值为百分比PERCENT,或像素PIXELS。lineHeight:行高,具体可查看类型 LineHeight。textCase:字母大小写,具体可查看类型 TextCase。
GridStyle
网格样式。
interface GridStyle extends BaseStyle {
type: 'GRID'
layoutGrids: ReadonlyArray<LayoutGrid>
}
type:类型,取值为网格GRID。layoutGrids:网格布局样式,具体可查看类型 LayoutGrid。
StrokeWidthStyle
描边宽度样式。
interface StrokeWidthStyle extends BaseStyle {
type: 'STROKE_WIDTH'
value: StrokeWidthValue
}
interface StrokeWidthValue {
top: number
right: number
bottom: number
left: number
}
type:类型,取值为描边宽度STROKE_WIDTH。value:描边宽度值,包含四个方向的描边宽度(上、右、下、左)。
PaddingStyle
内边距样式。
interface PaddingStyle extends BaseStyle {
type: 'PADDING'
value: PaddingValue
}
interface PaddingValue {
top: number
right: number
bottom: number
left: number
}
type:类型,取值为内边距PADDING。value:内边距值,包含四个方向的内边距(上、右、下、左)。
SpacingStyle
间距样式。
interface SpacingStyle extends BaseStyle {
type: 'SPACING'
value: number
}
type:类型,取值为间距SPACING。value:间距值。
CornerRadiusStyle
圆角样式。
interface CornerRadiusStyle extends BaseStyle {
type: 'CORNER_RADIUS'
value: CornerRadiusValue
}
interface CornerRadiusValue {
topLeft: number
topRight: number
bottomRight: number
bottomLeft: number
}
type:类型,取值为圆角CORNER_RADIUS。value:圆角值,包含四个角的圆角(左上、右上、右下、左下)。
BaseStyle
基础样式。
interface BaseStyle extends PublishableMixin {
readonly id: string
readonly type: StyleType
name: string
remove(): void
}
type:类型,具体可查看类型 StyleType。remove():删除样式。
TIP
您无法删除团队库样式,remove方法在调用时会出错。
PublishableMixin
发布状态。
interface PublishableMixin {
description: string
readonly isExternal: boolean
readonly ukey: string
readonly publishStatus: PublishStatus
}
description:描述。isExternal:是否是远端数据。ukey:唯一的key值。publishStatus:描述可发布到团队库的元素(即样式和组件)的状态,具体可查看类型 PublishStatus。