Skip to content

Commit

Permalink
add typings for figma.on(slidesviewchange) and rename for slidesmode …
Browse files Browse the repository at this point in the history
…to slidesview
  • Loading branch information
figma-nfiner committed Nov 1, 2024
1 parent 2ba01a5 commit acade9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
15 changes: 9 additions & 6 deletions plugin-api-standalone.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ interface PluginAPI {
on(type: 'run', callback: (event: RunEvent) => void): void
on(type: 'drop', callback: (event: DropEvent) => boolean): void
on(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
on(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
on(
type: 'textreview',
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
Expand All @@ -65,6 +66,7 @@ interface PluginAPI {
once(type: 'run', callback: (event: RunEvent) => void): void
once(type: 'drop', callback: (event: DropEvent) => boolean): void
once(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
once(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
once(
type: 'textreview',
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
Expand All @@ -74,6 +76,7 @@ interface PluginAPI {
off(type: 'run', callback: (event: RunEvent) => void): void
off(type: 'drop', callback: (event: DropEvent) => boolean): void
off(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
off(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
off(
type: 'textreview',
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
Expand Down Expand Up @@ -434,7 +437,7 @@ interface ViewportAPI {
zoom: number
scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void
readonly bounds: Rect
slidesMode: 'grid' | 'single-slide'
slidesView: 'grid' | 'single-slide'
}
interface TextReviewAPI {
requestToBeEnabledAsync(): Promise<void>
Expand Down Expand Up @@ -483,6 +486,9 @@ interface OpenDevResourcesEvent {
}
}
declare type RunEvent = RunParametersEvent | OpenDevResourcesEvent
interface SlidesViewChangeEvent {
view: 'GRID' | 'SINGLE_SLIDE'
}
interface DropEvent {
node: BaseNode | SceneNode
x: number
Expand Down Expand Up @@ -1857,7 +1863,6 @@ interface Measurement {
side: MeasurementSide
}
offset: MeasurementOffset
freeText: string
}
declare type MeasurementSide = 'TOP' | 'RIGHT' | 'BOTTOM' | 'LEFT'
declare type MeasurementOffset =
Expand All @@ -1883,14 +1888,12 @@ interface MeasurementsMixin {
},
options?: {
offset?: MeasurementOffset
freeText?: string
},
): Measurement
editMeasurement(
id: string,
newValue: {
offset?: MeasurementOffset
freeText?: string
offset: MeasurementOffset
},
): Measurement
deleteMeasurement(id: string): void
Expand Down Expand Up @@ -2690,4 +2693,4 @@ interface FindAllCriteria<T extends NodeType[]> {
}

// prettier-ignore
export { ArgFreeEventType, PluginAPI, VersionHistoryResult, VariablesAPI, LibraryVariableCollection, LibraryVariable, TeamLibraryAPI, PaymentStatus, PaymentsAPI, ClientStorageAPI, NotificationOptions, NotifyDequeueReason, NotificationHandler, ShowUIOptions, UIPostMessageOptions, OnMessageProperties, MessageEventHandler, UIAPI, UtilAPI, ColorPalette, ColorPalettes, ConstantsAPI, CodegenEvent, CodegenPreferences, CodegenPreferencesEvent, CodegenResult, CodegenAPI, DevResource, DevResourceWithNodeId, LinkPreviewEvent, PlainTextElement, LinkPreviewResult, AuthEvent, DevResourceOpenEvent, AuthResult, VSCodeAPI, DevResourcesAPI, TimerAPI, ViewportAPI, TextReviewAPI, ParameterValues, SuggestionResults, ParameterInputEvent, ParametersAPI, RunParametersEvent, OpenDevResourcesEvent, RunEvent, DropEvent, DropItem, DropFile, DocumentChangeEvent, StyleChangeEvent, StyleChange, BaseDocumentChange, BaseNodeChange, RemovedNode, CreateChange, DeleteChange, PropertyChange, BaseStyleChange, StyleCreateChange, StyleDeleteChange, StylePropertyChange, DocumentChange, NodeChangeProperty, NodeChangeEvent, NodeChange, StyleChangeProperty, TextReviewEvent, TextReviewRange, Transform, Vector, Rect, RGB, RGBA, FontName, TextCase, TextDecoration, OpenTypeFeature, ArcData, DropShadowEffect, InnerShadowEffect, BlurEffect, Effect, ConstraintType, Constraints, ColorStop, ImageFilters, SolidPaint, GradientPaint, ImagePaint, VideoPaint, Paint, Guide, RowsColsLayoutGrid, GridLayoutGrid, LayoutGrid, ExportSettingsConstraints, ExportSettingsImage, ExportSettingsSVGBase, ExportSettingsSVG, ExportSettingsSVGString, ExportSettingsPDF, ExportSettingsREST, ExportSettings, WindingRule, VectorVertex, VectorSegment, VectorRegion, VectorNetwork, VectorPath, VectorPaths, LetterSpacing, LineHeight, LeadingTrim, HyperlinkTarget, TextListOptions, BlendMode, MaskType, Font, TextStyleOverrideType, StyledTextSegment, Reaction, VariableDataType, ExpressionFunction, Expression, VariableValueWithExpression, VariableData, ConditionalBlock, DevStatus, Action, SimpleTransition, DirectionalTransition, Transition, Trigger, Navigation, Easing, EasingFunctionBezier, EasingFunctionSpring, OverflowDirection, OverlayPositionType, OverlayBackground, OverlayBackgroundInteraction, PublishStatus, ConnectorEndpointPosition, ConnectorEndpointPositionAndEndpointNodeId, ConnectorEndpointEndpointNodeIdAndMagnet, ConnectorEndpoint, ConnectorStrokeCap, BaseNodeMixin, PluginDataMixin, DevResourcesMixin, DevStatusMixin, SceneNodeMixin, VariableBindableNodeField, VariableBindableTextField, VariableBindablePaintField, VariableBindablePaintStyleField, VariableBindableColorStopField, VariableBindableEffectField, VariableBindableEffectStyleField, VariableBindableLayoutGridField, VariableBindableGridStyleField, VariableBindableComponentPropertyField, StickableMixin, ChildrenMixin, ConstraintMixin, DimensionAndPositionMixin, LayoutMixin, BlendMixin, ContainerMixin, DeprecatedBackgroundMixin, StrokeCap, StrokeJoin, HandleMirroring, AutoLayoutMixin, AutoLayoutChildrenMixin, InferredAutoLayoutResult, DetachedInfo, MinimalStrokesMixin, IndividualStrokesMixin, MinimalFillsMixin, GeometryMixin, CornerMixin, RectangleCornerMixin, ExportMixin, FramePrototypingMixin, VectorLikeMixin, ReactionMixin, DocumentationLink, PublishableMixin, DefaultShapeMixin, BaseFrameMixin, DefaultFrameMixin, OpaqueNodeMixin, MinimalBlendMixin, Annotation, AnnotationProperty, AnnotationPropertyType, AnnotationsMixin, Measurement, MeasurementSide, MeasurementOffset, MeasurementsMixin, VariantMixin, ComponentPropertiesMixin, NonResizableTextMixin, TextSublayerNode, DocumentNode, ExplicitVariableModesMixin, PageNode, FrameNode, GroupNode, SliceNode, RectangleNode, LineNode, EllipseNode, PolygonNode, StarNode, VectorNode, TextNode, ComponentPropertyType, InstanceSwapPreferredValue, ComponentPropertyOptions, ComponentPropertyDefinitions, ComponentSetNode, ComponentNode, ComponentProperties, InstanceNode, BooleanOperationNode, StickyNode, StampNode, TableNode, TableCellNode, HighlightNode, WashiTapeNode, ShapeWithTextNode, CodeBlockNode, LabelSublayerNode, ConnectorNode, VariableResolvedDataType, VariableAlias, VariableValue, VariableScope, CodeSyntaxPlatform, Variable, VariableCollection, WidgetNode, EmbedData, EmbedNode, LinkUnfurlData, LinkUnfurlNode, MediaData, MediaNode, SectionNode, SlideNode, SlideRowNode, SlideGridNode, InteractiveSlideElementNode, SlideTransition, BaseNode, SceneNode, NodeType, StyleType, InheritedStyleField, StyleConsumers, BaseStyleMixin, PaintStyle, TextStyle, EffectStyle, GridStyle, BaseStyle, Image, Video, BaseUser, User, ActiveUser, FindAllCriteria }
export { ArgFreeEventType, PluginAPI, VersionHistoryResult, VariablesAPI, LibraryVariableCollection, LibraryVariable, TeamLibraryAPI, PaymentStatus, PaymentsAPI, ClientStorageAPI, NotificationOptions, NotifyDequeueReason, NotificationHandler, ShowUIOptions, UIPostMessageOptions, OnMessageProperties, MessageEventHandler, UIAPI, UtilAPI, ColorPalette, ColorPalettes, ConstantsAPI, CodegenEvent, CodegenPreferences, CodegenPreferencesEvent, CodegenResult, CodegenAPI, DevResource, DevResourceWithNodeId, LinkPreviewEvent, PlainTextElement, LinkPreviewResult, AuthEvent, DevResourceOpenEvent, AuthResult, VSCodeAPI, DevResourcesAPI, TimerAPI, ViewportAPI, TextReviewAPI, ParameterValues, SuggestionResults, ParameterInputEvent, ParametersAPI, RunParametersEvent, OpenDevResourcesEvent, RunEvent, SlidesViewChangeEvent, DropEvent, DropItem, DropFile, DocumentChangeEvent, StyleChangeEvent, StyleChange, BaseDocumentChange, BaseNodeChange, RemovedNode, CreateChange, DeleteChange, PropertyChange, BaseStyleChange, StyleCreateChange, StyleDeleteChange, StylePropertyChange, DocumentChange, NodeChangeProperty, NodeChangeEvent, NodeChange, StyleChangeProperty, TextReviewEvent, TextReviewRange, Transform, Vector, Rect, RGB, RGBA, FontName, TextCase, TextDecoration, OpenTypeFeature, ArcData, DropShadowEffect, InnerShadowEffect, BlurEffect, Effect, ConstraintType, Constraints, ColorStop, ImageFilters, SolidPaint, GradientPaint, ImagePaint, VideoPaint, Paint, Guide, RowsColsLayoutGrid, GridLayoutGrid, LayoutGrid, ExportSettingsConstraints, ExportSettingsImage, ExportSettingsSVGBase, ExportSettingsSVG, ExportSettingsSVGString, ExportSettingsPDF, ExportSettingsREST, ExportSettings, WindingRule, VectorVertex, VectorSegment, VectorRegion, VectorNetwork, VectorPath, VectorPaths, LetterSpacing, LineHeight, LeadingTrim, HyperlinkTarget, TextListOptions, BlendMode, MaskType, Font, TextStyleOverrideType, StyledTextSegment, Reaction, VariableDataType, ExpressionFunction, Expression, VariableValueWithExpression, VariableData, ConditionalBlock, DevStatus, Action, SimpleTransition, DirectionalTransition, Transition, Trigger, Navigation, Easing, EasingFunctionBezier, EasingFunctionSpring, OverflowDirection, OverlayPositionType, OverlayBackground, OverlayBackgroundInteraction, PublishStatus, ConnectorEndpointPosition, ConnectorEndpointPositionAndEndpointNodeId, ConnectorEndpointEndpointNodeIdAndMagnet, ConnectorEndpoint, ConnectorStrokeCap, BaseNodeMixin, PluginDataMixin, DevResourcesMixin, DevStatusMixin, SceneNodeMixin, VariableBindableNodeField, VariableBindableTextField, VariableBindablePaintField, VariableBindablePaintStyleField, VariableBindableColorStopField, VariableBindableEffectField, VariableBindableEffectStyleField, VariableBindableLayoutGridField, VariableBindableGridStyleField, VariableBindableComponentPropertyField, StickableMixin, ChildrenMixin, ConstraintMixin, DimensionAndPositionMixin, LayoutMixin, BlendMixin, ContainerMixin, DeprecatedBackgroundMixin, StrokeCap, StrokeJoin, HandleMirroring, AutoLayoutMixin, AutoLayoutChildrenMixin, InferredAutoLayoutResult, DetachedInfo, MinimalStrokesMixin, IndividualStrokesMixin, MinimalFillsMixin, GeometryMixin, CornerMixin, RectangleCornerMixin, ExportMixin, FramePrototypingMixin, VectorLikeMixin, ReactionMixin, DocumentationLink, PublishableMixin, DefaultShapeMixin, BaseFrameMixin, DefaultFrameMixin, OpaqueNodeMixin, MinimalBlendMixin, Annotation, AnnotationProperty, AnnotationPropertyType, AnnotationsMixin, Measurement, MeasurementSide, MeasurementOffset, MeasurementsMixin, VariantMixin, ComponentPropertiesMixin, NonResizableTextMixin, TextSublayerNode, DocumentNode, ExplicitVariableModesMixin, PageNode, FrameNode, GroupNode, SliceNode, RectangleNode, LineNode, EllipseNode, PolygonNode, StarNode, VectorNode, TextNode, ComponentPropertyType, InstanceSwapPreferredValue, ComponentPropertyOptions, ComponentPropertyDefinitions, ComponentSetNode, ComponentNode, ComponentProperties, InstanceNode, BooleanOperationNode, StickyNode, StampNode, TableNode, TableCellNode, HighlightNode, WashiTapeNode, ShapeWithTextNode, CodeBlockNode, LabelSublayerNode, ConnectorNode, VariableResolvedDataType, VariableAlias, VariableValue, VariableScope, CodeSyntaxPlatform, Variable, VariableCollection, WidgetNode, EmbedData, EmbedNode, LinkUnfurlData, LinkUnfurlNode, MediaData, MediaNode, SectionNode, SlideNode, SlideRowNode, SlideGridNode, InteractiveSlideElementNode, SlideTransition, BaseNode, SceneNode, NodeType, StyleType, InheritedStyleField, StyleConsumers, BaseStyleMixin, PaintStyle, TextStyle, EffectStyle, GridStyle, BaseStyle, Image, Video, BaseUser, User, ActiveUser, FindAllCriteria }
13 changes: 8 additions & 5 deletions plugin-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ interface PluginAPI {
on(type: 'run', callback: (event: RunEvent) => void): void
on(type: 'drop', callback: (event: DropEvent) => boolean): void
on(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
on(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
on(
type: 'textreview',
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
Expand All @@ -61,6 +62,7 @@ interface PluginAPI {
once(type: 'run', callback: (event: RunEvent) => void): void
once(type: 'drop', callback: (event: DropEvent) => boolean): void
once(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
once(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
once(
type: 'textreview',
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
Expand All @@ -70,6 +72,7 @@ interface PluginAPI {
off(type: 'run', callback: (event: RunEvent) => void): void
off(type: 'drop', callback: (event: DropEvent) => boolean): void
off(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
off(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
off(
type: 'textreview',
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
Expand Down Expand Up @@ -430,7 +433,7 @@ interface ViewportAPI {
zoom: number
scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void
readonly bounds: Rect
slidesMode: 'grid' | 'single-slide'
slidesView: 'grid' | 'single-slide'
}
interface TextReviewAPI {
requestToBeEnabledAsync(): Promise<void>
Expand Down Expand Up @@ -479,6 +482,9 @@ interface OpenDevResourcesEvent {
}
}
declare type RunEvent = RunParametersEvent | OpenDevResourcesEvent
interface SlidesViewChangeEvent {
view: 'GRID' | 'SINGLE_SLIDE'
}
interface DropEvent {
node: BaseNode | SceneNode
x: number
Expand Down Expand Up @@ -1853,7 +1859,6 @@ interface Measurement {
side: MeasurementSide
}
offset: MeasurementOffset
freeText: string
}
declare type MeasurementSide = 'TOP' | 'RIGHT' | 'BOTTOM' | 'LEFT'
declare type MeasurementOffset =
Expand All @@ -1879,14 +1884,12 @@ interface MeasurementsMixin {
},
options?: {
offset?: MeasurementOffset
freeText?: string
},
): Measurement
editMeasurement(
id: string,
newValue: {
offset?: MeasurementOffset
freeText?: string
offset: MeasurementOffset
},
): Measurement
deleteMeasurement(id: string): void
Expand Down

0 comments on commit acade9b

Please sign in to comment.