Skip to content

Commit

Permalink
sunset set*Style() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflee-figma committed Feb 1, 2024
1 parent edb5696 commit 9694988
Showing 1 changed file with 105 additions and 15 deletions.
120 changes: 105 additions & 15 deletions plugin-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,6 @@ interface BlendMixin extends MinimalBlendMixin {
effects: ReadonlyArray<Effect>
effectStyleId: string
setEffectStyleIdAsync(styleId: string): Promise<void>
setEffectStyle(style: EffectStyle): void
}
interface ContainerMixin {
expanded: boolean
Expand Down Expand Up @@ -1657,7 +1656,6 @@ interface MinimalStrokesMixin {
strokes: ReadonlyArray<Paint>
strokeStyleId: string
setStrokeStyleIdAsync(styleId: string): Promise<void>
setStrokeStyle(style: PaintStyle): void
strokeWeight: number | PluginAPI['mixed']
strokeJoin: StrokeJoin | PluginAPI['mixed']
strokeAlign: 'CENTER' | 'INSIDE' | 'OUTSIDE'
Expand All @@ -1674,7 +1672,6 @@ interface MinimalFillsMixin {
fills: ReadonlyArray<Paint> | PluginAPI['mixed']
fillStyleId: string | PluginAPI['mixed']
setFillStyleIdAsync(styleId: string): Promise<void>
setFillStyle(style: PaintStyle): void
}
interface GeometryMixin extends MinimalStrokesMixin, MinimalFillsMixin {
strokeCap: StrokeCap | PluginAPI['mixed']
Expand Down Expand Up @@ -1747,12 +1744,12 @@ interface BaseFrameMixin
ExportMixin,
IndividualStrokesMixin,
AutoLayoutMixin,
AnnotationsMixin,
DevStatusMixin {
readonly detachedInfo: DetachedInfo | null
layoutGrids: ReadonlyArray<LayoutGrid>
gridStyleId: string
setGridStyleIdAsync(styleId: string): Promise<void>
setGridStyle(style: GridStyle): void
clipsContent: boolean
guides: ReadonlyArray<Guide>
inferredAutoLayout: InferredAutoLayoutResult | null
Expand All @@ -1767,6 +1764,87 @@ interface MinimalBlendMixin {
opacity: number
blendMode: BlendMode
}
interface Annotation {
readonly label?: string
readonly properties?: ReadonlyArray<AnnotationProperty>
}
interface AnnotationProperty {
readonly type: AnnotationPropertyType
}
declare type AnnotationPropertyType =
| 'width'
| 'height'
| 'maxWidth'
| 'minWidth'
| 'maxHeight'
| 'minHeight'
| 'fills'
| 'strokes'
| 'effects'
| 'strokeWeight'
| 'cornerRadius'
| 'textStyleId'
| 'textAlignHorizontal'
| 'fontFamily'
| 'fontSize'
| 'fontWeight'
| 'lineHeight'
| 'letterSpacing'
| 'itemSpacing'
| 'padding'
| 'layoutMode'
| 'alignItems'
| 'opacity'
| 'mainComponent'
interface AnnotationsMixin {
annotations: ReadonlyArray<Annotation>
}
interface Measurement {
id: string
start: {
node: SceneNode
side: MeasurementSide
}
end: {
node: SceneNode
side: MeasurementSide
}
offset: MeasurementOffset
}
declare type MeasurementSide = 'TOP' | 'RIGHT' | 'BOTTOM' | 'LEFT'
declare type MeasurementOffset =
| {
type: 'INNER'
relative: number
}
| {
type: 'OUTER'
fixed: number
}
interface MeasurementsMixin {
getMeasurements(): Measurement[]
getMeasurementsForNode(node: SceneNode): Measurement[]
addMeasurement(
start: {
node: SceneNode
side: MeasurementSide
},
end: {
node: SceneNode
side: MeasurementSide
},
options?: {
offset?: MeasurementOffset
},
): Measurement
editMeasurement(
id: string,
newValue: {
offset: MeasurementOffset
},
): Measurement
deleteMeasurement(id: string): void
}
interface VariantMixin {
readonly variantProperties: {
[property: string]: string
Expand Down Expand Up @@ -1842,11 +1920,9 @@ interface NonResizableTextMixin {
setRangeFills(start: number, end: number, value: Paint[]): void
getRangeTextStyleId(start: number, end: number): string | PluginAPI['mixed']
setRangeTextStyleIdAsync(start: number, end: number, styleId: string): Promise<void>
setRangeTextStyle(start: number, end: number, style: TextStyle): void
setRangeTextStyleId(start: number, end: number, value: string): void
getRangeFillStyleId(start: number, end: number): string | PluginAPI['mixed']
setRangeFillStyleIdAsync(start: number, end: number, styleId: string): Promise<void>
setRangeFillStyle(start: number, end: number, style: PaintStyle): void
setRangeFillStyleId(start: number, end: number, value: string): void
getRangeListOptions(start: number, end: number): TextListOptions | PluginAPI['mixed']
setRangeListOptions(start: number, end: number, value: TextListOptions): void
Expand Down Expand Up @@ -1893,7 +1969,12 @@ interface ExplicitVariableModesMixin {
setExplicitVariableModeForCollection(collection: VariableCollection, modeId: string): void
setExplicitVariableModeForCollection(collectionId: string, modeId: string): void
}
interface PageNode extends BaseNodeMixin, ChildrenMixin, ExportMixin, ExplicitVariableModesMixin {
interface PageNode
extends BaseNodeMixin,
ChildrenMixin,
ExportMixin,
ExplicitVariableModesMixin,
MeasurementsMixin {
readonly type: 'PAGE'
clone(): PageNode
guides: ReadonlyArray<Guide>
Expand Down Expand Up @@ -1941,35 +2022,45 @@ interface RectangleNode
ConstraintMixin,
CornerMixin,
RectangleCornerMixin,
IndividualStrokesMixin {
IndividualStrokesMixin,
AnnotationsMixin {
readonly type: 'RECTANGLE'
clone(): RectangleNode
}
interface LineNode extends DefaultShapeMixin, ConstraintMixin {
interface LineNode extends DefaultShapeMixin, ConstraintMixin, AnnotationsMixin {
readonly type: 'LINE'
clone(): LineNode
}
interface EllipseNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {
interface EllipseNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin, AnnotationsMixin {
readonly type: 'ELLIPSE'
clone(): EllipseNode
arcData: ArcData
}
interface PolygonNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {
interface PolygonNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin, AnnotationsMixin {
readonly type: 'POLYGON'
clone(): PolygonNode
pointCount: number
}
interface StarNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {
interface StarNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin, AnnotationsMixin {
readonly type: 'STAR'
clone(): StarNode
pointCount: number
innerRadius: number
}
interface VectorNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin, VectorLikeMixin {
interface VectorNode
extends DefaultShapeMixin,
ConstraintMixin,
CornerMixin,
VectorLikeMixin,
AnnotationsMixin {
readonly type: 'VECTOR'
clone(): VectorNode
}
interface TextNode extends DefaultShapeMixin, ConstraintMixin, NonResizableTextMixin {
interface TextNode
extends DefaultShapeMixin,
ConstraintMixin,
NonResizableTextMixin,
AnnotationsMixin {
readonly type: 'TEXT'
clone(): TextNode
textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'
Expand All @@ -1980,7 +2071,6 @@ interface TextNode extends DefaultShapeMixin, ConstraintMixin, NonResizableTextM
autoRename: boolean
textStyleId: string | PluginAPI['mixed']
setTextStyleIdAsync(styleId: string): Promise<void>
setTextStyle(style: TextStyle): void
}
declare type ComponentPropertyType = 'BOOLEAN' | 'TEXT' | 'INSTANCE_SWAP' | 'VARIANT'
declare type InstanceSwapPreferredValue = {
Expand Down

0 comments on commit 9694988

Please sign in to comment.