Skip to content

Commit 8a7f218

Browse files
authored
Update typings for slides (#324)
1 parent a3a0edc commit 8a7f218

File tree

2 files changed

+165
-5
lines changed

2 files changed

+165
-5
lines changed

plugin-api-standalone.d.ts

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare type ArgFreeEventType =
1616
interface PluginAPI {
1717
readonly apiVersion: '1.0.0'
1818
readonly command: string
19-
readonly editorType: 'figma' | 'figjam' | 'dev'
19+
readonly editorType: 'figma' | 'figjam' | 'dev' | 'slides'
2020
readonly mode: 'default' | 'textreview' | 'inspect' | 'codegen' | 'linkpreview' | 'auth'
2121
readonly pluginId?: string
2222
readonly widgetId?: string
@@ -56,6 +56,7 @@ interface PluginAPI {
5656
on(type: 'run', callback: (event: RunEvent) => void): void
5757
on(type: 'drop', callback: (event: DropEvent) => boolean): void
5858
on(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
59+
on(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
5960
on(
6061
type: 'textreview',
6162
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
@@ -65,6 +66,7 @@ interface PluginAPI {
6566
once(type: 'run', callback: (event: RunEvent) => void): void
6667
once(type: 'drop', callback: (event: DropEvent) => boolean): void
6768
once(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
69+
once(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
6870
once(
6971
type: 'textreview',
7072
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
@@ -74,6 +76,7 @@ interface PluginAPI {
7476
off(type: 'run', callback: (event: RunEvent) => void): void
7577
off(type: 'drop', callback: (event: DropEvent) => boolean): void
7678
off(type: 'documentchange', callback: (event: DocumentChangeEvent) => void): void
79+
off(type: 'slidesviewchange', callback: (event: SlidesViewChangeEvent) => void): void
7780
off(
7881
type: 'textreview',
7982
callback: (event: TextReviewEvent) => Promise<TextReviewRange[]> | TextReviewRange[],
@@ -93,6 +96,8 @@ interface PluginAPI {
9396
createPage(): PageNode
9497
createPageDivider(dividerName?: string): PageNode
9598
createSlice(): SliceNode
99+
createSlide(row?: number, col?: number): SlideNode
100+
createSlideRow(row?: number): SlideRowNode
96101
createSticky(): StickyNode
97102
createConnector(): ConnectorNode
98103
createShapeWithText(): ShapeWithTextNode
@@ -180,6 +185,8 @@ interface PluginAPI {
180185
node: FrameNode | ComponentNode | ComponentSetNode | SectionNode | null,
181186
): Promise<void>
182187
loadAllPagesAsync(): Promise<void>
188+
getSlideGrid(): Array<Array<SlideNode>>
189+
setSlideGrid(slideGrid: Array<Array<SlideNode>>): void
183190
}
184191
interface VersionHistoryResult {
185192
id: string
@@ -432,6 +439,7 @@ interface ViewportAPI {
432439
zoom: number
433440
scrollAndZoomIntoView(nodes: ReadonlyArray<BaseNode>): void
434441
readonly bounds: Rect
442+
slidesView: 'grid' | 'single-slide'
435443
}
436444
interface TextReviewAPI {
437445
requestToBeEnabledAsync(): Promise<void>
@@ -480,6 +488,9 @@ interface OpenDevResourcesEvent {
480488
}
481489
}
482490
declare type RunEvent = RunParametersEvent | OpenDevResourcesEvent
491+
interface SlidesViewChangeEvent {
492+
view: 'GRID' | 'SINGLE_SLIDE'
493+
}
483494
interface DropEvent {
484495
node: BaseNode | SceneNode
485496
x: number
@@ -1517,6 +1528,7 @@ interface BaseNodeMixin extends PluginDataMixin, DevResourcesMixin {
15171528
getCSSAsync(): Promise<{
15181529
[key: string]: string
15191530
}>
1531+
getTopLevelFrame(): FrameNode | undefined
15201532
}
15211533
interface PluginDataMixin {
15221534
getPluginData(key: string): string
@@ -2126,6 +2138,7 @@ interface PageNode
21262138
on(type: 'nodechange', callback: (event: NodeChangeEvent) => void): void
21272139
once(type: 'nodechange', callback: (event: NodeChangeEvent) => void): void
21282140
off(type: 'nodechange', callback: (event: NodeChangeEvent) => void): void
2141+
focusedSlide?: SlideNode | null
21292142
}
21302143
interface FrameNode extends DefaultFrameMixin {
21312144
readonly type: 'FRAME'
@@ -2574,12 +2587,75 @@ interface MediaNode extends OpaqueNodeMixin {
25742587
resizeWithoutConstraints(width: number, height: number): void
25752588
clone(): MediaNode
25762589
}
2577-
interface SectionNode extends ChildrenMixin, MinimalFillsMixin, OpaqueNodeMixin, DevStatusMixin {
2590+
interface SectionNode
2591+
extends ChildrenMixin,
2592+
MinimalFillsMixin,
2593+
OpaqueNodeMixin,
2594+
DevStatusMixin,
2595+
AspectRatioLockMixin {
25782596
readonly type: 'SECTION'
25792597
sectionContentsHidden: boolean
25802598
clone(): SectionNode
25812599
resizeWithoutConstraints(width: number, height: number): void
25822600
}
2601+
interface SlideNode extends BaseFrameMixin {
2602+
readonly type: 'SLIDE'
2603+
clone(): SlideNode
2604+
getSlideTransition(): SlideTransition
2605+
setSlideTransition(transition: SlideTransition): void
2606+
isSkippedSlide: boolean
2607+
}
2608+
interface SlideRowNode extends OpaqueNodeMixin, ChildrenMixin {
2609+
readonly type: 'SLIDE_ROW'
2610+
clone(): SlideRowNode
2611+
}
2612+
interface SlideGridNode extends OpaqueNodeMixin, ChildrenMixin {
2613+
readonly type: 'SLIDE_GRID'
2614+
}
2615+
interface InteractiveSlideElementNode extends OpaqueNodeMixin {
2616+
readonly type: 'INTERACTIVE_SLIDE_ELEMENT'
2617+
readonly interactiveSlideElementType: 'POLL' | 'EMBED' | 'FACEPILE' | 'ALIGNMENT' | 'YOUTUBE'
2618+
}
2619+
interface SlideTransition {
2620+
readonly style:
2621+
| 'NONE'
2622+
| 'DISSOLVE'
2623+
| 'SLIDE_FROM_LEFT'
2624+
| 'SLIDE_FROM_RIGHT'
2625+
| 'SLIDE_FROM_BOTTOM'
2626+
| 'SLIDE_FROM_TOP'
2627+
| 'PUSH_FROM_LEFT'
2628+
| 'PUSH_FROM_RIGHT'
2629+
| 'PUSH_FROM_BOTTOM'
2630+
| 'PUSH_FROM_TOP'
2631+
| 'MOVE_FROM_LEFT'
2632+
| 'MOVE_FROM_RIGHT'
2633+
| 'MOVE_FROM_TOP'
2634+
| 'MOVE_FROM_BOTTOM'
2635+
| 'SLIDE_OUT_TO_LEFT'
2636+
| 'SLIDE_OUT_TO_RIGHT'
2637+
| 'SLIDE_OUT_TO_TOP'
2638+
| 'SLIDE_OUT_TO_BOTTOM'
2639+
| 'MOVE_OUT_TO_LEFT'
2640+
| 'MOVE_OUT_TO_RIGHT'
2641+
| 'MOVE_OUT_TO_TOP'
2642+
| 'MOVE_OUT_TO_BOTTOM'
2643+
| 'SMART_ANIMATE'
2644+
readonly duration: number
2645+
readonly curve:
2646+
| 'EASE_IN'
2647+
| 'EASE_OUT'
2648+
| 'EASE_IN_AND_OUT'
2649+
| 'LINEAR'
2650+
| 'GENTLE'
2651+
| 'QUICK'
2652+
| 'BOUNCY'
2653+
| 'SLOW'
2654+
readonly timing: {
2655+
readonly type: 'ON_CLICK' | 'AFTER_DELAY'
2656+
readonly delay?: number
2657+
}
2658+
}
25832659
declare type BaseNode = DocumentNode | PageNode | SceneNode
25842660
declare type SceneNode =
25852661
| SliceNode
@@ -2609,6 +2685,10 @@ declare type SceneNode =
26092685
| HighlightNode
26102686
| WashiTapeNode
26112687
| TableNode
2688+
| SlideNode
2689+
| SlideRowNode
2690+
| SlideGridNode
2691+
| InteractiveSlideElementNode
26122692
declare type NodeType = BaseNode['type']
26132693
declare type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID'
26142694
declare type InheritedStyleField =
@@ -2709,4 +2789,4 @@ interface FindAllCriteria<T extends NodeType[]> {
27092789
}
27102790

27112791
// prettier-ignore
2712-
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, TextDecorationStyle, TextDecorationOffset, TextDecorationThickness, TextDecorationColor, 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, VariableBindableComponentPropertyDefinitionField, StickableMixin, ChildrenMixin, ConstraintMixin, DimensionAndPositionMixin, LayoutMixin, AspectRatioLockMixin, 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, BaseNode, SceneNode, NodeType, StyleType, InheritedStyleField, StyleConsumers, BaseStyleMixin, PaintStyle, TextStyle, EffectStyle, GridStyle, BaseStyle, Image, Video, BaseUser, User, ActiveUser, FindAllCriteria }
2792+
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, TextDecorationStyle, TextDecorationOffset, TextDecorationThickness, TextDecorationColor, 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, VariableBindableComponentPropertyDefinitionField, StickableMixin, ChildrenMixin, ConstraintMixin, DimensionAndPositionMixin, LayoutMixin, AspectRatioLockMixin, 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 }

0 commit comments

Comments
 (0)