Skip to content

Commit

Permalink
typings updates for boundVariables, text style overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflee-figma committed Aug 15, 2024
1 parent b74f820 commit 2d9c1ca
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions plugin-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ interface DropShadowEffect {
readonly visible: boolean
readonly blendMode: BlendMode
readonly showShadowBehindNode?: boolean
readonly boundVariables?: {
readonly boundVariables: {
[field in VariableBindableEffectField]?: VariableAlias
}
}
Expand All @@ -995,15 +995,15 @@ interface InnerShadowEffect {
readonly spread?: number
readonly visible: boolean
readonly blendMode: BlendMode
readonly boundVariables?: {
readonly boundVariables: {
[field in VariableBindableEffectField]?: VariableAlias
}
}
interface BlurEffect {
readonly type: 'LAYER_BLUR' | 'BACKGROUND_BLUR'
readonly radius: number
readonly visible: boolean
readonly boundVariables?: {
readonly boundVariables: {
['radius']?: VariableAlias
}
}
Expand Down Expand Up @@ -1035,7 +1035,7 @@ interface SolidPaint {
readonly visible?: boolean
readonly opacity?: number
readonly blendMode?: BlendMode
readonly boundVariables?: {
readonly boundVariables: {
[field in VariableBindablePaintField]?: VariableAlias
}
}
Expand Down Expand Up @@ -1085,7 +1085,7 @@ interface RowsColsLayoutGrid {
readonly offset?: number
readonly visible?: boolean
readonly color?: RGBA
readonly boundVariables?: {
readonly boundVariables: {
[field in VariableBindableLayoutGridField]?: VariableAlias
}
}
Expand All @@ -1094,7 +1094,7 @@ interface GridLayoutGrid {
readonly sectionSize: number
readonly visible?: boolean
readonly color?: RGBA
readonly boundVariables?: {
readonly boundVariables: {
['sectionSize']?: VariableAlias
}
}
Expand Down Expand Up @@ -1212,6 +1212,9 @@ declare type MaskType = 'ALPHA' | 'VECTOR' | 'LUMINANCE'
interface Font {
fontName: FontName
}
declare type TextStyleOverrideType = {
type: 'SEMANTIC_ITALIC' | 'SEMANTIC_WEIGHT' | 'HYPERLINK' | 'TEXT_DECORATION'
}
interface StyledTextSegment {
characters: string
start: number
Expand All @@ -1232,12 +1235,13 @@ interface StyledTextSegment {
openTypeFeatures: {
readonly [feature in OpenTypeFeature]: boolean
}
boundVariables?: {
readonly boundVariables: {
[field in Exclude<
VariableBindableTextField,
'paragraphSpacing' | 'paragraphIndent'
>]?: VariableAlias
}
textStyleOverrides: TextStyleOverrideType[]
}
declare type Reaction = {
action?: Action
Expand Down Expand Up @@ -1507,7 +1511,7 @@ interface SceneNodeMixin extends ExplicitVariableModesMixin {
[nodeProperty in 'visible' | 'characters' | 'mainComponent']?: string
}
| null
readonly boundVariables?: {
readonly boundVariables: {
readonly [field in VariableBindableNodeField]?: VariableAlias
} & {
readonly [field in VariableBindableTextField]?: VariableAlias[]
Expand Down Expand Up @@ -1549,7 +1553,6 @@ declare type VariableBindableNodeField =
| 'paddingTop'
| 'paddingBottom'
| 'visible'
| 'cornerRadius'
| 'topLeftRadius'
| 'topRightRadius'
| 'bottomLeftRadius'
Expand Down Expand Up @@ -1642,15 +1645,7 @@ interface DeprecatedBackgroundMixin {
backgrounds: ReadonlyArray<Paint>
backgroundStyleId: string
}
declare type StrokeCap =
| 'NONE'
| 'ROUND'
| 'SQUARE'
| 'ARROW_LINES'
| 'ARROW_EQUILATERAL'
| 'TRIANGLE_FILLED'
| 'DIAMOND_FILLED'
| 'CIRCLE_FILLED'
declare type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL'
declare type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'
declare type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH'
interface AutoLayoutMixin {
Expand Down Expand Up @@ -2163,7 +2158,7 @@ declare type ComponentProperties = {
type: ComponentPropertyType
value: string | boolean
preferredValues?: InstanceSwapPreferredValue[]
readonly boundVariables?: {
readonly boundVariables: {
[field in VariableBindableComponentPropertyField]?: VariableAlias
}
}
Expand Down Expand Up @@ -2524,7 +2519,7 @@ interface BaseStyleMixin extends PublishableMixin, PluginDataMixin {
interface PaintStyle extends BaseStyleMixin {
type: 'PAINT'
paints: ReadonlyArray<Paint>
readonly boundVariables?: {
readonly boundVariables: {
readonly [field in VariableBindablePaintStyleField]?: VariableAlias[]
}
}
Expand All @@ -2542,22 +2537,22 @@ interface TextStyle extends BaseStyleMixin {
hangingPunctuation: boolean
hangingList: boolean
textCase: TextCase
boundVariables?: {
readonly boundVariables: {
[field in VariableBindableTextField]?: VariableAlias
}
setBoundVariable(field: VariableBindableTextField, variable: Variable | null): void
}
interface EffectStyle extends BaseStyleMixin {
type: 'EFFECT'
effects: ReadonlyArray<Effect>
readonly boundVariables?: {
readonly boundVariables: {
readonly [field in VariableBindableEffectStyleField]?: VariableAlias[]
}
}
interface GridStyle extends BaseStyleMixin {
type: 'GRID'
layoutGrids: ReadonlyArray<LayoutGrid>
readonly boundVariables?: {
readonly boundVariables: {
readonly [field in VariableBindableGridStyleField]?: VariableAlias[]
}
}
Expand Down

0 comments on commit 2d9c1ca

Please sign in to comment.