New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@figma/plugin-typings

Package Overview
Dependencies
Maintainers
33
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figma/plugin-typings - npm Package Compare versions

Comparing version 1.57.1 to 1.58.0

7

index.d.ts

@@ -32,4 +32,8 @@ // Figma Plugin API version 1, update 40

method?: string
headers?: { [name: string]: string }
/**
* @deprecated use headers instead
*/
headersObject?: { [name: string]: string }
body?: Uint8Array
body?: Uint8Array | string
credentials?: string

@@ -52,2 +56,3 @@ cache?: string

text(): Promise<string>
json(): Promise<any>
}

@@ -54,0 +59,0 @@ } // declare global

2

package.json
{
"name": "@figma/plugin-typings",
"version": "1.57.1",
"version": "1.58.0",
"description": "Typings for the Figma Plugin API",

@@ -5,0 +5,0 @@ "main": "",

@@ -1,2 +0,3 @@

type ArgFreeEventType =
/* plugin-typings are auto-generated. Do not update them directly. See plugin-docs/ for instructions. */
declare type ArgFreeEventType =
| 'selectionchange'

@@ -11,3 +12,2 @@ | 'currentpagechange'

| 'timerdone'
interface PluginAPI {

@@ -19,37 +19,22 @@ readonly apiVersion: '1.0.0'

readonly widgetId?: string
readonly fileKey: string | undefined
skipInvisibleInstanceChildren: boolean
readonly timer?: TimerAPI
readonly viewport: ViewportAPI
readonly currentUser: User | null
readonly activeUsers: ActiveUser[]
readonly textreview?: TextReviewAPI
closePlugin(message?: string): void
notify(message: string, options?: NotificationOptions): NotificationHandler
commitUndo(): void
triggerUndo(): void
saveVersionHistoryAsync(title: string, description?: string): Promise<VersionHistoryResult>
showUI(html: string, options?: ShowUIOptions): void
readonly ui: UIAPI
readonly clientStorage: ClientStorageAPI
readonly parameters: ParametersAPI
getNodeById(id: string): BaseNode | null
getStyleById(id: string): BaseStyle | null
readonly root: DocumentNode
currentPage: PageNode
on(type: ArgFreeEventType, callback: () => void): void

@@ -63,3 +48,2 @@ on(type: 'run', callback: (event: RunEvent) => void): void

): void
once(type: ArgFreeEventType, callback: () => void): void

@@ -73,3 +57,2 @@ once(type: 'run', callback: (event: RunEvent) => void): void

): void
off(type: ArgFreeEventType, callback: () => void): void

@@ -83,5 +66,3 @@ off(type: 'run', callback: (event: RunEvent) => void): void

): void
readonly mixed: unique symbol
createRectangle(): RectangleNode

@@ -104,8 +85,3 @@ createLine(): LineNode

createNodeFromJSXAsync(jsx: any): Promise<SceneNode>
/**
* [DEPRECATED]: This API often fails to create a valid boolean operation. Use figma.union, figma.subtract, figma.intersect and figma.exclude instead.
*/
createBooleanOperation(): BooleanOperationNode
createPaintStyle(): PaintStyle

@@ -115,5 +91,2 @@ createTextStyle(): TextStyle

createGridStyle(): GridStyle
// The styles are returned in the same order as displayed in the UI. Only
// local styles are returned. Never styles from team library.
getLocalPaintStyles(): PaintStyle[]

@@ -123,3 +96,2 @@ getLocalTextStyles(): TextStyle[]

getLocalGridStyles(): GridStyle[]
moveLocalPaintStyleAfter(targetNode: PaintStyle, reference: PaintStyle | null): void

@@ -129,3 +101,2 @@ moveLocalTextStyleAfter(targetNode: TextStyle, reference: TextStyle | null): void

moveLocalGridStyleAfter(targetNode: GridStyle, reference: GridStyle | null): void
moveLocalPaintFolderAfter(targetFolder: string, reference: string | null): void

@@ -135,22 +106,15 @@ moveLocalTextFolderAfter(targetFolder: string, reference: string | null): void

moveLocalGridFolderAfter(targetFolder: string, reference: string | null): void
importComponentByKeyAsync(key: string): Promise<ComponentNode>
importComponentSetByKeyAsync(key: string): Promise<ComponentSetNode>
importStyleByKeyAsync(key: string): Promise<BaseStyle>
listAvailableFontsAsync(): Promise<Font[]>
loadFontAsync(fontName: FontName): Promise<void>
readonly hasMissingFont: boolean
createNodeFromSvg(svg: string): FrameNode
createImage(data: Uint8Array): Image
createImageAsync(src: string): Promise<Image>
getImageByHash(hash: string): Image | null
createVideoAsync(data: Uint8Array): Promise<Video>
createLinkPreviewAsync(url: string): Promise<EmbedNode | LinkUnfurlNode>
createGif(hash: string): MediaNode
combineAsVariants(

@@ -167,3 +131,2 @@ nodes: ReadonlyArray<ComponentNode>,

): VectorNode
union(

@@ -189,8 +152,5 @@ nodes: ReadonlyArray<BaseNode>,

): BooleanOperationNode
ungroup(node: SceneNode & ChildrenMixin): Array<SceneNode>
base64Encode(data: Uint8Array): string
base64Decode(data: string): Uint8Array
getFileThumbnailNode(): FrameNode | ComponentNode | ComponentSetNode | null

@@ -201,7 +161,5 @@ setFileThumbnailNodeAsync(

}
interface VersionHistoryResult {
id: string
}
interface ClientStorageAPI {

@@ -213,3 +171,2 @@ getAsync(key: string): Promise<any | undefined>

}
interface NotificationOptions {

@@ -224,9 +181,6 @@ timeout?: number

}
type NotifyDequeueReason = 'timeout' | 'dismiss' | 'action_button_click'
declare type NotifyDequeueReason = 'timeout' | 'dismiss' | 'action_button_click'
interface NotificationHandler {
cancel: () => void
}
interface ShowUIOptions {

@@ -237,16 +191,15 @@ visible?: boolean

height?: number
position?: { x: number; y: number }
position?: {
x: number
y: number
}
themeColors?: boolean
}
interface UIPostMessageOptions {
origin?: string
}
interface OnMessageProperties {
origin: string
}
type MessageEventHandler = (pluginMessage: any, props: OnMessageProperties) => void
declare type MessageEventHandler = (pluginMessage: any, props: OnMessageProperties) => void
interface UIAPI {

@@ -257,3 +210,2 @@ show(): void

close(): void
postMessage(pluginMessage: any, options?: UIPostMessageOptions): void

@@ -265,3 +217,2 @@ onmessage: MessageEventHandler | undefined

}
interface TimerAPI {

@@ -271,3 +222,2 @@ readonly remaining: number

readonly state: 'STOPPED' | 'PAUSED' | 'RUNNING'
pause: () => void

@@ -278,3 +228,2 @@ resume: () => void

}
interface ViewportAPI {

@@ -286,3 +235,2 @@ center: Vector

}
interface TextReviewAPI {

@@ -293,7 +241,5 @@ requestToBeEnabledAsync(): Promise<void>

}
interface ParameterValues {
[key: string]: any
}
interface SuggestionResults {

@@ -314,4 +260,3 @@ setSuggestions(

}
type ParameterInputEvent<ParametersType = ParameterValues> = {
declare type ParameterInputEvent<ParametersType = ParameterValues> = {
query: string

@@ -322,3 +267,2 @@ key: string

}
interface ParametersAPI {

@@ -329,3 +273,2 @@ on(type: 'input', callback: (event: ParameterInputEvent) => void): void

}
interface RunEvent<ParametersType = ParameterValues | undefined> {

@@ -335,3 +278,2 @@ command: string

}
interface DropEvent {

@@ -347,3 +289,2 @@ node: BaseNode | SceneNode

}
interface DropItem {

@@ -353,3 +294,2 @@ type: string

}
interface DropFile {

@@ -361,7 +301,5 @@ name: string

}
interface DocumentChangeEvent {
documentChanges: DocumentChange[]
}
interface BaseDocumentChange {

@@ -371,7 +309,5 @@ id: string

}
interface BaseNodeChange extends BaseDocumentChange {
node: SceneNode | RemovedNode
}
interface RemovedNode {

@@ -382,11 +318,8 @@ readonly removed: true

}
interface CreateChange extends BaseNodeChange {
type: 'CREATE'
}
interface DeleteChange extends BaseNodeChange {
type: 'DELETE'
}
interface PropertyChange extends BaseNodeChange {

@@ -396,11 +329,8 @@ type: 'PROPERTY_CHANGE'

}
interface BaseStyleChange extends BaseDocumentChange {
style: PaintStyle | TextStyle | GridStyle | EffectStyle | null
}
interface StyleCreateChange extends BaseStyleChange {
type: 'STYLE_CREATE'
}
interface StyleDeleteChange extends BaseStyleChange {

@@ -410,3 +340,2 @@ type: 'STYLE_DELETE'

}
interface StylePropertyChange extends BaseStyleChange {

@@ -416,4 +345,3 @@ type: 'STYLE_PROPERTY_CHANGE'

}
type DocumentChange =
declare type DocumentChange =
| CreateChange

@@ -425,4 +353,3 @@ | DeleteChange

| StylePropertyChange
type NodeChangeProperty =
declare type NodeChangeProperty =
| 'pointCount'

@@ -539,4 +466,3 @@ | 'name'

| 'textBackground'
type StyleChangeProperty =
declare type StyleChangeProperty =
| 'name'

@@ -558,8 +484,6 @@ | 'pluginData'

| 'layoutGrids'
type TextReviewEvent = {
declare type TextReviewEvent = {
text: string
}
type TextReviewRange = {
declare type TextReviewRange = {
start: number

@@ -570,8 +494,3 @@ end: number

}
////////////////////////////////////////////////////////////////////////////////
// Datatypes
type Transform = [[number, number, number], [number, number, number]]
declare type Transform = [[number, number, number], [number, number, number]]
interface Vector {

@@ -581,3 +500,2 @@ readonly x: number

}
interface Rect {

@@ -589,3 +507,2 @@ readonly x: number

}
interface RGB {

@@ -596,3 +513,2 @@ readonly r: number

}
interface RGBA {

@@ -604,3 +520,2 @@ readonly r: number

}
interface FontName {

@@ -610,7 +525,4 @@ readonly family: string

}
type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'
type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'
declare type TextCase = 'ORIGINAL' | 'UPPER' | 'LOWER' | 'TITLE'
declare type TextDecoration = 'NONE' | 'UNDERLINE' | 'STRIKETHROUGH'
interface ArcData {

@@ -621,3 +533,2 @@ readonly startingAngle: number

}
interface DropShadowEffect {

@@ -633,3 +544,2 @@ readonly type: 'DROP_SHADOW'

}
interface InnerShadowEffect {

@@ -644,3 +554,2 @@ readonly type: 'INNER_SHADOW'

}
interface BlurEffect {

@@ -651,7 +560,4 @@ readonly type: 'LAYER_BLUR' | 'BACKGROUND_BLUR'

}
type Effect = DropShadowEffect | InnerShadowEffect | BlurEffect
type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE'
declare type Effect = DropShadowEffect | InnerShadowEffect | BlurEffect
declare type ConstraintType = 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'SCALE'
interface Constraints {

@@ -661,3 +567,2 @@ readonly horizontal: ConstraintType

}
interface ColorStop {

@@ -667,3 +572,2 @@ readonly position: number

}
interface ImageFilters {

@@ -678,7 +582,5 @@ readonly exposure?: number

}
interface SolidPaint {
readonly type: 'SOLID'
readonly color: RGB
readonly visible?: boolean

@@ -688,3 +590,2 @@ readonly opacity?: number

}
interface GradientPaint {

@@ -694,3 +595,2 @@ readonly type: 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND'

readonly gradientStops: ReadonlyArray<ColorStop>
readonly visible?: boolean

@@ -700,3 +600,2 @@ readonly opacity?: number

}
interface ImagePaint {

@@ -706,7 +605,6 @@ readonly type: 'IMAGE'

readonly imageHash: string | null
readonly imageTransform?: Transform // setting for "CROP"
readonly scalingFactor?: number // setting for "TILE"
readonly rotation?: number // setting for "FILL" | "FIT" | "TILE"
readonly imageTransform?: Transform
readonly scalingFactor?: number
readonly rotation?: number
readonly filters?: ImageFilters
readonly visible?: boolean

@@ -716,3 +614,2 @@ readonly opacity?: number

}
interface VideoPaint {

@@ -722,5 +619,5 @@ readonly type: 'VIDEO'

readonly videoHash: string | null
readonly videoTransform?: Transform // setting for "CROP"
readonly scalingFactor?: number // setting for "TILE"
readonly rotation?: number // setting for "TILE" | "FILL" | "FIT"
readonly videoTransform?: Transform
readonly scalingFactor?: number
readonly rotation?: number
readonly filters?: ImageFilters

@@ -731,5 +628,3 @@ readonly visible?: boolean

}
type Paint = SolidPaint | GradientPaint | ImagePaint | VideoPaint
declare type Paint = SolidPaint | GradientPaint | ImagePaint | VideoPaint
interface Guide {

@@ -739,3 +634,2 @@ readonly axis: 'X' | 'Y'

}
interface RowsColsLayoutGrid {

@@ -745,21 +639,15 @@ readonly pattern: 'ROWS' | 'COLUMNS'

readonly gutterSize: number
readonly count: number // Infinity when "Auto" is set in the UI
readonly sectionSize?: number // Not set for alignment: "STRETCH"
readonly offset?: number // Not set for alignment: "CENTER"
readonly count: number
readonly sectionSize?: number
readonly offset?: number
readonly visible?: boolean
readonly color?: RGBA
}
interface GridLayoutGrid {
readonly pattern: 'GRID'
readonly sectionSize: number
readonly visible?: boolean
readonly color?: RGBA
}
type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid
declare type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid
interface ExportSettingsConstraints {

@@ -769,32 +657,26 @@ readonly type: 'SCALE' | 'WIDTH' | 'HEIGHT'

}
interface ExportSettingsImage {
readonly format: 'JPG' | 'PNG'
readonly contentsOnly?: boolean // defaults to true
readonly useAbsoluteBounds?: boolean // defaults to false
readonly contentsOnly?: boolean
readonly useAbsoluteBounds?: boolean
readonly suffix?: string
readonly constraint?: ExportSettingsConstraints
}
interface ExportSettingsSVG {
readonly format: 'SVG'
readonly contentsOnly?: boolean // defaults to true
readonly useAbsoluteBounds?: boolean // defaults to false
readonly contentsOnly?: boolean
readonly useAbsoluteBounds?: boolean
readonly suffix?: string
readonly svgOutlineText?: boolean // defaults to true
readonly svgIdAttribute?: boolean // defaults to false
readonly svgSimplifyStroke?: boolean // defaults to true
readonly svgOutlineText?: boolean
readonly svgIdAttribute?: boolean
readonly svgSimplifyStroke?: boolean
}
interface ExportSettingsPDF {
readonly format: 'PDF'
readonly contentsOnly?: boolean // defaults to true
readonly useAbsoluteBounds?: boolean // defaults to false
readonly contentsOnly?: boolean
readonly useAbsoluteBounds?: boolean
readonly suffix?: string
}
type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF
type WindingRule = 'NONZERO' | 'EVENODD'
declare type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF
declare type WindingRule = 'NONZERO' | 'EVENODD'
interface VectorVertex {

@@ -808,10 +690,8 @@ readonly x: number

}
interface VectorSegment {
readonly start: number
readonly end: number
readonly tangentStart?: Vector // Defaults to { x: 0, y: 0 }
readonly tangentEnd?: Vector // Defaults to { x: 0, y: 0 }
readonly tangentStart?: Vector
readonly tangentEnd?: Vector
}
interface VectorRegion {

@@ -823,9 +703,7 @@ readonly windingRule: WindingRule

}
interface VectorNetwork {
readonly vertices: ReadonlyArray<VectorVertex>
readonly segments: ReadonlyArray<VectorSegment>
readonly regions?: ReadonlyArray<VectorRegion> // Defaults to []
readonly regions?: ReadonlyArray<VectorRegion>
}
interface VectorPath {

@@ -835,5 +713,3 @@ readonly windingRule: WindingRule | 'NONE'

}
type VectorPaths = ReadonlyArray<VectorPath>
declare type VectorPaths = ReadonlyArray<VectorPath>
interface LetterSpacing {

@@ -843,4 +719,3 @@ readonly value: number

}
type LineHeight =
declare type LineHeight =
| {

@@ -853,13 +728,10 @@ readonly value: number

}
type HyperlinkTarget = {
declare type HyperlinkTarget = {
type: 'URL' | 'NODE'
value: string
}
type TextListOptions = {
declare type TextListOptions = {
type: 'ORDERED' | 'UNORDERED' | 'NONE'
}
type BlendMode =
declare type BlendMode =
| 'PASS_THROUGH'

@@ -884,7 +756,5 @@ | 'NORMAL'

| 'LUMINOSITY'
interface Font {
fontName: FontName
}
interface StyledTextSegment {

@@ -908,9 +778,15 @@ characters: string

}
type Reaction = { action: Action | null; trigger: Trigger | null }
type Action =
| { readonly type: 'BACK' | 'CLOSE' }
| { readonly type: 'URL'; url: string }
declare type Reaction = {
action: Action | null
trigger: Trigger | null
}
declare type Action =
| {
readonly type: 'BACK' | 'CLOSE'
}
| {
readonly type: 'URL'
url: string
}
| {
readonly type: 'UPDATE_MEDIA_RUNTIME'

@@ -925,9 +801,5 @@ readonly mediaAction: 'PLAY' | 'PAUSE' | 'TOGGLE_PLAY_PAUSE'

readonly preserveScrollPosition: boolean
// Only present if navigation == "OVERLAY" and the destination uses
// overlay position type "RELATIVE"
readonly overlayRelativePosition?: Vector
readonly resetVideoPosition?: boolean
}
interface SimpleTransition {

@@ -938,3 +810,2 @@ readonly type: 'DISSOLVE' | 'SMART_ANIMATE' | 'SCROLL_ANIMATE'

}
interface DirectionalTransition {

@@ -944,12 +815,11 @@ readonly type: 'MOVE_IN' | 'MOVE_OUT' | 'PUSH' | 'SLIDE_IN' | 'SLIDE_OUT'

readonly matchLayers: boolean
readonly easing: Easing
readonly duration: number
}
type Transition = SimpleTransition | DirectionalTransition
type Trigger =
| { readonly type: 'ON_CLICK' | 'ON_HOVER' | 'ON_PRESS' | 'ON_DRAG' }
declare type Transition = SimpleTransition | DirectionalTransition
declare type Trigger =
| {
readonly type: 'ON_CLICK' | 'ON_HOVER' | 'ON_PRESS' | 'ON_DRAG'
}
| {
readonly type: 'AFTER_TIMEOUT'

@@ -967,5 +837,3 @@ readonly timeout: number

}
type Navigation = 'NAVIGATE' | 'SWAP' | 'OVERLAY' | 'SCROLL_TO' | 'CHANGE_TO'
declare type Navigation = 'NAVIGATE' | 'SWAP' | 'OVERLAY' | 'SCROLL_TO' | 'CHANGE_TO'
interface Easing {

@@ -983,3 +851,2 @@ readonly type:

}
interface EasingFunctionBezier {

@@ -991,6 +858,4 @@ x1: number

}
type OverflowDirection = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'BOTH'
type OverlayPositionType =
declare type OverflowDirection = 'NONE' | 'HORIZONTAL' | 'VERTICAL' | 'BOTH'
declare type OverlayPositionType =
| 'CENTER'

@@ -1004,20 +869,25 @@ | 'TOP_LEFT'

| 'MANUAL'
type OverlayBackground =
| { readonly type: 'NONE' }
| { readonly type: 'SOLID_COLOR'; readonly color: RGBA }
type OverlayBackgroundInteraction = 'NONE' | 'CLOSE_ON_CLICK_OUTSIDE'
type PublishStatus = 'UNPUBLISHED' | 'CURRENT' | 'CHANGED'
declare type OverlayBackground =
| {
readonly type: 'NONE'
}
| {
readonly type: 'SOLID_COLOR'
readonly color: RGBA
}
declare type OverlayBackgroundInteraction = 'NONE' | 'CLOSE_ON_CLICK_OUTSIDE'
declare type PublishStatus = 'UNPUBLISHED' | 'CURRENT' | 'CHANGED'
interface ConnectorEndpointPosition {
position: { x: number; y: number }
position: {
x: number
y: number
}
}
interface ConnectorEndpointPositionAndEndpointNodeId {
position: { x: number; y: number }
position: {
x: number
y: number
}
endpointNodeId: string
}
interface ConnectorEndpointEndpointNodeIdAndMagnet {

@@ -1027,9 +897,7 @@ endpointNodeId: string

}
type ConnectorEndpoint =
declare type ConnectorEndpoint =
| ConnectorEndpointPosition
| ConnectorEndpointEndpointNodeIdAndMagnet
| ConnectorEndpointPositionAndEndpointNodeId
type ConnectorStrokeCap =
declare type ConnectorStrokeCap =
| 'NONE'

@@ -1041,18 +909,14 @@ | 'ARROW_EQUILATERAL'

| 'CIRCLE_FILLED'
////////////////////////////////////////////////////////////////////////////////
// Mixins
interface BaseNodeMixin extends PluginDataMixin {
readonly id: string
readonly parent: (BaseNode & ChildrenMixin) | null
name: string // Note: setting this also sets `autoRename` to false on TextNodes
name: string
readonly removed: boolean
toString(): string
remove(): void
setRelaunchData(data: { [command: string]: /* description */ string }): void
getRelaunchData(): { [command: string]: /* description */ string }
setRelaunchData(data: { [command: string]: string }): void
getRelaunchData(): {
[command: string]: string
}
}
interface PluginDataMixin {

@@ -1062,5 +926,2 @@ getPluginData(key: string): string

getPluginDataKeys(): string[]
// Namespace is a string that must be at least 3 alphanumeric characters, and should
// be a name related to your plugin. Other plugins will be able to read this data.
getSharedPluginData(namespace: string, key: string): string

@@ -1070,3 +931,2 @@ setSharedPluginData(namespace: string, key: string, value: string): void

}
interface SceneNodeMixin {

@@ -1083,39 +943,25 @@ visible: boolean

}
interface StickableMixin {
stuckTo: SceneNode | null
}
interface ChildrenMixin {
readonly children: ReadonlyArray<SceneNode>
appendChild(child: SceneNode): void
insertChild(index: number, child: SceneNode): void
findChildren(callback?: (node: SceneNode) => boolean): SceneNode[]
findChild(callback: (node: SceneNode) => boolean): SceneNode | null
/**
* If you only need to search immediate children, it is much faster
* to call node.children.filter(callback) or node.findChildren(callback)
*/
findAll(callback?: (node: SceneNode) => boolean): SceneNode[]
/**
* If you only need to search immediate children, it is much faster
* to call node.children.find(callback) or node.findChild(callback)
*/
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
findAllWithCriteria<T extends NodeType[]>(criteria: {
types: T
}): Array<{ type: T[number] } & SceneNode>
}): Array<
{
type: T[number]
} & SceneNode
>
findWidgetNodesByWidgetId(widgetId: string): Array<WidgetNode>
}
interface ConstraintMixin {
constraints: Constraints
}
interface LayoutMixin {

@@ -1126,4 +972,3 @@ readonly absoluteTransform: Transform

y: number
rotation: number // In degrees
rotation: number
readonly width: number

@@ -1134,8 +979,5 @@ readonly height: number

constrainProportions: boolean
// applicable only inside auto-layout frames
layoutAlign: 'MIN' | 'CENTER' | 'MAX' | 'STRETCH' | 'INHERIT'
layoutGrow: number
layoutPositioning: 'AUTO' | 'ABSOLUTE'
resize(width: number, height: number): void

@@ -1145,3 +987,2 @@ resizeWithoutConstraints(width: number, height: number): void

}
interface BlendMixin extends MinimalBlendMixin {

@@ -1152,13 +993,10 @@ isMask: boolean

}
interface ContainerMixin {
expanded: boolean
backgrounds: ReadonlyArray<Paint> // DEPRECATED: use 'fills' instead
backgroundStyleId: string // DEPRECATED: use 'fillStyleId' instead
backgrounds: ReadonlyArray<Paint>
backgroundStyleId: string
}
type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL'
type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND'
type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH'
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 MinimalStrokesMixin {

@@ -1173,3 +1011,2 @@ strokes: ReadonlyArray<Paint>

}
interface IndividualStrokesMixin {

@@ -1181,3 +1018,2 @@ strokeTopWeight: number

}
interface MinimalFillsMixin {

@@ -1187,3 +1023,2 @@ fills: ReadonlyArray<Paint> | PluginAPI['mixed']

}
interface GeometryMixin extends MinimalStrokesMixin, MinimalFillsMixin {

@@ -1195,3 +1030,2 @@ strokeCap: StrokeCap | PluginAPI['mixed']

}
interface CornerMixin {

@@ -1201,3 +1035,2 @@ cornerRadius: number | PluginAPI['mixed']

}
interface RectangleCornerMixin {

@@ -1209,12 +1042,9 @@ topLeftRadius: number

}
interface ExportMixin {
exportSettings: ReadonlyArray<ExportSettings>
exportAsync(settings?: ExportSettings): Promise<Uint8Array> // Defaults to PNG format
exportAsync(settings?: ExportSettings): Promise<Uint8Array>
}
interface FramePrototypingMixin {
overflowDirection: OverflowDirection
numberOfFixedChildren: number
readonly overlayPositionType: OverlayPositionType

@@ -1224,3 +1054,2 @@ readonly overlayBackground: OverlayBackground

}
interface VectorLikeMixin {

@@ -1234,7 +1063,5 @@ vectorNetwork: VectorNetwork

}
interface DocumentationLink {
readonly uri: string
}
interface PublishableMixin {

@@ -1244,6 +1071,5 @@ description: string

readonly remote: boolean
readonly key: string // The key to use with "importComponentByKeyAsync", "importComponentSetByKeyAsync", and "importStyleByKeyAsync"
readonly key: string
getPublishStatusAsync(): Promise<PublishStatus>
}
interface DefaultShapeMixin

@@ -1257,3 +1083,2 @@ extends BaseNodeMixin,

ExportMixin {}
interface BaseFrameMixin

@@ -1273,19 +1098,15 @@ extends BaseNodeMixin,

layoutMode: 'NONE' | 'HORIZONTAL' | 'VERTICAL'
primaryAxisSizingMode: 'FIXED' | 'AUTO' // applicable only if layoutMode != "NONE"
counterAxisSizingMode: 'FIXED' | 'AUTO' // applicable only if layoutMode != "NONE"
primaryAxisAlignItems: 'MIN' | 'MAX' | 'CENTER' | 'SPACE_BETWEEN' // applicable only if layoutMode != "NONE"
counterAxisAlignItems: 'MIN' | 'MAX' | 'CENTER' | 'BASELINE' // applicable only if layoutMode != "NONE"
paddingLeft: number // applicable only if layoutMode != "NONE"
paddingRight: number // applicable only if layoutMode != "NONE"
paddingTop: number // applicable only if layoutMode != "NONE"
paddingBottom: number // applicable only if layoutMode != "NONE"
itemSpacing: number // applicable only if layoutMode != "NONE"
itemReverseZIndex: boolean // applicable only if layoutMode != "NONE"
strokesIncludedInLayout: boolean // applicable only if layoutMode != "NONE"
horizontalPadding: number // DEPRECATED: use the individual paddings
verticalPadding: number // DEPRECATED: use the individual paddings
primaryAxisSizingMode: 'FIXED' | 'AUTO'
counterAxisSizingMode: 'FIXED' | 'AUTO'
primaryAxisAlignItems: 'MIN' | 'MAX' | 'CENTER' | 'SPACE_BETWEEN'
counterAxisAlignItems: 'MIN' | 'MAX' | 'CENTER' | 'BASELINE'
paddingLeft: number
paddingRight: number
paddingTop: number
paddingBottom: number
itemSpacing: number
itemReverseZIndex: boolean
strokesIncludedInLayout: boolean
horizontalPadding: number
verticalPadding: number
layoutGrids: ReadonlyArray<LayoutGrid>

@@ -1296,5 +1117,3 @@ gridStyleId: string

}
interface DefaultFrameMixin extends BaseFrameMixin, FramePrototypingMixin, ReactionMixin {}
interface OpaqueNodeMixin extends BaseNodeMixin, SceneNodeMixin, ExportMixin {

@@ -1309,3 +1128,2 @@ readonly absoluteTransform: Transform

}
interface MinimalBlendMixin {

@@ -1315,7 +1133,7 @@ opacity: number

}
interface VariantMixin {
readonly variantProperties: { [property: string]: string } | null
readonly variantProperties: {
[property: string]: string
} | null
}
interface ComponentPropertiesMixin {

@@ -1339,9 +1157,6 @@ readonly componentPropertyDefinitions: ComponentPropertyDefinitions

}
interface TextSublayerNode extends MinimalFillsMixin {
readonly hasMissingFont: boolean
paragraphIndent: number
paragraphSpacing: number
fontSize: number | PluginAPI['mixed']

@@ -1355,7 +1170,5 @@ fontName: FontName | PluginAPI['mixed']

hyperlink: HyperlinkTarget | null | PluginAPI['mixed']
characters: string
insertCharacters(start: number, characters: string, useStyle?: 'BEFORE' | 'AFTER'): void
deleteCharacters(start: number, end: number): void
getRangeFontSize(start: number, end: number): number | PluginAPI['mixed']

@@ -1400,11 +1213,5 @@ setRangeFontSize(start: number, end: number, value: number): void

}
////////////////////////////////////////////////////////////////////////////////
// Nodes
interface DocumentNode extends BaseNodeMixin {
readonly type: 'DOCUMENT'
readonly children: ReadonlyArray<PageNode>
appendChild(child: PageNode): void

@@ -1414,36 +1221,30 @@ insertChild(index: number, child: PageNode): void

findChild(callback: (node: PageNode) => boolean): PageNode | null
/**
* If you only need to search immediate children, it is much faster
* to call node.children.filter(callback) or node.findChildren(callback)
*/
findAll(callback?: (node: PageNode | SceneNode) => boolean): Array<PageNode | SceneNode>
/**
* If you only need to search immediate children, it is much faster
* to call node.children.find(callback) or node.findChild(callback)
*/
findOne(callback: (node: PageNode | SceneNode) => boolean): PageNode | SceneNode | null
findAllWithCriteria<T extends NodeType[]>(criteria: {
types: T
}): Array<{ type: T[number] } & (PageNode | SceneNode)>
}): Array<
{
type: T[number]
} & (PageNode | SceneNode)
>
}
interface PageNode extends BaseNodeMixin, ChildrenMixin, ExportMixin {
readonly type: 'PAGE'
clone(): PageNode
guides: ReadonlyArray<Guide>
selection: ReadonlyArray<SceneNode>
selectedTextRange: { node: TextNode; start: number; end: number } | null
flowStartingPoints: ReadonlyArray<{ nodeId: string; name: string }>
selectedTextRange: {
node: TextNode
start: number
end: number
} | null
flowStartingPoints: ReadonlyArray<{
nodeId: string
name: string
}>
backgrounds: ReadonlyArray<Paint>
prototypeBackgrounds: ReadonlyArray<Paint>
readonly prototypeStartNode: FrameNode | GroupNode | ComponentNode | InstanceNode | null
}
interface FrameNode extends DefaultFrameMixin {

@@ -1453,3 +1254,2 @@ readonly type: 'FRAME'

}
interface GroupNode

@@ -1467,3 +1267,2 @@ extends BaseNodeMixin,

}
interface SliceNode extends BaseNodeMixin, SceneNodeMixin, LayoutMixin, ExportMixin {

@@ -1473,3 +1272,2 @@ readonly type: 'SLICE'

}
interface RectangleNode

@@ -1484,3 +1282,2 @@ extends DefaultShapeMixin,

}
interface LineNode extends DefaultShapeMixin, ConstraintMixin {

@@ -1490,3 +1287,2 @@ readonly type: 'LINE'

}
interface EllipseNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {

@@ -1497,3 +1293,2 @@ readonly type: 'ELLIPSE'

}
interface PolygonNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {

@@ -1504,3 +1299,2 @@ readonly type: 'POLYGON'

}
interface StarNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {

@@ -1512,3 +1306,2 @@ readonly type: 'STAR'

}
interface VectorNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin, VectorLikeMixin {

@@ -1518,7 +1311,5 @@ readonly type: 'VECTOR'

}
interface TextNode extends DefaultShapeMixin, ConstraintMixin, TextSublayerNode {
readonly type: 'TEXT'
clone(): TextNode
textAlignHorizontal: 'LEFT' | 'CENTER' | 'RIGHT' | 'JUSTIFIED'

@@ -1528,13 +1319,13 @@ textAlignVertical: 'TOP' | 'CENTER' | 'BOTTOM'

autoRename: boolean
textStyleId: string | PluginAPI['mixed']
}
type ComponentPropertyType = 'BOOLEAN' | 'TEXT' | 'INSTANCE_SWAP' | 'VARIANT'
type InstanceSwapPreferredValue = { type: 'COMPONENT' | 'COMPONENT_SET'; key: string }
type ComponentPropertyOptions = {
declare type ComponentPropertyType = 'BOOLEAN' | 'TEXT' | 'INSTANCE_SWAP' | 'VARIANT'
declare type InstanceSwapPreferredValue = {
type: 'COMPONENT' | 'COMPONENT_SET'
key: string
}
declare type ComponentPropertyOptions = {
preferredValues?: InstanceSwapPreferredValue[]
}
type ComponentPropertyDefinitions = {
declare type ComponentPropertyDefinitions = {
[propertyName: string]: {

@@ -1547,3 +1338,2 @@ type: ComponentPropertyType

}
interface ComponentSetNode extends BaseFrameMixin, PublishableMixin, ComponentPropertiesMixin {

@@ -1553,5 +1343,8 @@ readonly type: 'COMPONENT_SET'

readonly defaultVariant: ComponentNode
readonly variantGroupProperties: { [property: string]: { values: string[] } }
readonly variantGroupProperties: {
[property: string]: {
values: string[]
}
}
}
interface ComponentNode

@@ -1567,4 +1360,3 @@ extends DefaultFrameMixin,

}
type ComponentProperties = {
declare type ComponentProperties = {
[propertyName: string]: {

@@ -1576,3 +1368,2 @@ type: ComponentPropertyType

}
interface InstanceNode extends DefaultFrameMixin, VariantMixin {

@@ -1589,6 +1380,8 @@ readonly type: 'INSTANCE'

isExposedInstance: boolean
readonly overrides: { id: string; overriddenFields: NodeChangeProperty[] }[]
readonly overrides: {
id: string
overriddenFields: NodeChangeProperty[]
}[]
resetOverrides(): void
}
interface BooleanOperationNode extends DefaultShapeMixin, ChildrenMixin, CornerMixin {

@@ -1598,6 +1391,4 @@ readonly type: 'BOOLEAN_OPERATION'

booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE'
expanded: boolean
}
interface StickyNode extends OpaqueNodeMixin, MinimalFillsMixin, MinimalBlendMixin {

@@ -1610,3 +1401,2 @@ readonly type: 'STICKY'

}
interface StampNode extends DefaultShapeMixin, ConstraintMixin, StickableMixin {

@@ -1617,3 +1407,2 @@ readonly type: 'STAMP'

}
interface HighlightNode

@@ -1629,3 +1418,2 @@ extends DefaultShapeMixin,

}
interface WashiTapeNode extends DefaultShapeMixin, StickableMixin {

@@ -1635,3 +1423,2 @@ readonly type: 'WASHI_TAPE'

}
interface ShapeWithTextNode

@@ -1659,3 +1446,2 @@ extends OpaqueNodeMixin,

rotation: number
resize(width: number, height: number): void

@@ -1665,3 +1451,2 @@ rescale(scale: number): void

}
interface CodeBlockNode extends OpaqueNodeMixin, MinimalBlendMixin {

@@ -1688,7 +1473,5 @@ readonly type: 'CODE_BLOCK'

}
interface LabelSublayerNode {
fills: Paint[] | PluginAPI['mixed']
}
interface ConnectorNode extends OpaqueNodeMixin, MinimalBlendMixin, MinimalStrokesMixin {

@@ -1707,19 +1490,30 @@ readonly type: 'CONNECTOR'

}
interface WidgetNode extends OpaqueNodeMixin, StickableMixin {
readonly type: 'WIDGET'
readonly widgetId: string
readonly widgetSyncedState: { [key: string]: any }
readonly widgetSyncedState: {
[key: string]: any
}
clone(): WidgetNode
cloneWidget(
syncedStateOverrides: { [name: string]: any },
syncedMapOverrides?: { [mapName: string]: { [key: string]: any } },
syncedStateOverrides: {
[name: string]: any
},
syncedMapOverrides?: {
[mapName: string]: {
[key: string]: any
}
},
): WidgetNode
setWidgetSyncedState(
syncedState: { [name: string]: any },
syncedMap?: { [mapName: string]: { [key: string]: any } },
syncedState: {
[name: string]: any
},
syncedMap?: {
[mapName: string]: {
[key: string]: any
}
},
): void
}
interface EmbedData {

@@ -1737,3 +1531,2 @@ srcUrl: string

}
interface LinkUnfurlData {

@@ -1750,3 +1543,2 @@ url: string

}
interface MediaData {

@@ -1758,3 +1550,2 @@ hash: string

readonly mediaData: MediaData
resize(width: number, height: number): void

@@ -1764,3 +1555,2 @@ resizeWithoutConstraints(width: number, height: number): void

}
interface SectionNode extends ChildrenMixin, MinimalFillsMixin, OpaqueNodeMixin {

@@ -1771,6 +1561,4 @@ readonly type: 'SECTION'

}
type BaseNode = DocumentNode | PageNode | SceneNode
type SceneNode =
declare type BaseNode = DocumentNode | PageNode | SceneNode
declare type SceneNode =
| SliceNode

@@ -1808,2 +1596,14 @@ | FrameNode

type StyleType = 'PAINT' | 'TEXT' | 'EFFECT' | 'GRID'
declare type InheritedStyleField =
| 'fillStyleId'
| 'strokeStyleId'
| 'backgroundStyleId'
| 'textStyleId'
| 'effectStyleId'
| 'gridStyleId'
| 'strokeStyleId'
interface StyleConsumers {
node: SceneNode
fields: InheritedStyleField[]
}

@@ -1813,6 +1613,6 @@ interface BaseStyle extends PublishableMixin, PluginDataMixin {

readonly type: StyleType
readonly consumers: StyleConsumers[]
name: string
remove(): void
}
interface PaintStyle extends BaseStyle {

@@ -1822,3 +1622,2 @@ type: 'PAINT'

}
interface TextStyle extends BaseStyle {

@@ -1835,3 +1634,2 @@ type: 'TEXT'

}
interface EffectStyle extends BaseStyle {

@@ -1841,3 +1639,2 @@ type: 'EFFECT'

}
interface GridStyle extends BaseStyle {

@@ -1847,9 +1644,9 @@ type: 'GRID'

}
////////////////////////////////////////////////////////////////////////////////
// Other
interface Image {
readonly hash: string
getBytesAsync(): Promise<Uint8Array>
getSizeAsync(): Promise<{
width: number
height: number
}>
}

@@ -1859,3 +1656,2 @@ interface Video {

}
interface BaseUser {

@@ -1866,10 +1662,6 @@ readonly id: string | null

}
interface User extends BaseUser {
// The current user's multiplayer color. This will match the color of their
// dot stamps and cursor.
readonly color: string
readonly sessionId: number
}
interface ActiveUser extends User {

@@ -1876,0 +1668,0 @@ readonly position: Vector | null

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc