@figma/plugin-typings
Advanced tools
Comparing version 1.39.1 to 1.40.0
@@ -1,2 +0,2 @@ | ||
// Figma Plugin API version 1, update 39 | ||
// Figma Plugin API version 1, update 40 | ||
/// <reference path="./plugin-api.d.ts" /> | ||
@@ -3,0 +3,0 @@ |
{ | ||
"name": "@figma/plugin-typings", | ||
"version": "1.39.1", | ||
"version": "1.40.0", | ||
"description": "Typings for the Figma Plugin API", | ||
@@ -5,0 +5,0 @@ "main": "", |
@@ -8,2 +8,4 @@ | ||
readonly editorType: 'figma' | 'figjam' | ||
readonly pluginId?: string | ||
readonly widgetId?: string | ||
@@ -40,6 +42,14 @@ readonly fileKey: string | undefined | ||
on<T extends ArgFreeEventType | "run">(type: T, callback: (event: T extends ArgFreeEventType ? never : RunEvent) => void): void | ||
once<T extends ArgFreeEventType | "run">(type: T, callback: (event: T extends ArgFreeEventType ? never : RunEvent) => void): void | ||
off<T extends ArgFreeEventType | "run">(type: T, callback: (event: T extends ArgFreeEventType ? never : RunEvent) => void): void | ||
on(type: ArgFreeEventType, callback: () => void): void; | ||
on(type: "run", callback: (event: RunEvent) => void): void | ||
on(type: "drop", callback: (event: DropEvent) => boolean): void; | ||
once(type: ArgFreeEventType, callback: () => void): void | ||
once(type: "run", callback: (event: RunEvent) => void): void; | ||
once(type: "drop", callback: (event: DropEvent) => boolean): void; | ||
off(type: ArgFreeEventType, callback: () => void): void | ||
off(type: "run", callback: (event: RunEvent) => void): void; | ||
off(type: "drop", callback: (event: DropEvent) => boolean): void; | ||
readonly mixed: unique symbol | ||
@@ -102,2 +112,4 @@ | ||
createLinkPreviewAsync(url:string): Promise<EmbedNode | LinkUnfurlNode> | ||
combineAsVariants(nodes: ReadonlyArray<ComponentNode>, parent: BaseNode & ChildrenMixin, index?: number): ComponentSetNode | ||
@@ -204,2 +216,25 @@ group(nodes: ReadonlyArray<BaseNode>, parent: BaseNode & ChildrenMixin, index?: number): GroupNode | ||
interface DropEvent { | ||
node: BaseNode | SceneNode | ||
x: number | ||
y: number | ||
absoluteX: number | ||
absoluteY: number | ||
items: DropItem[] | ||
files: DropFile[] | ||
dropMetadata?: any | ||
} | ||
interface DropItem { | ||
type: string | ||
data: string | ||
} | ||
interface DropFile { | ||
name: string | ||
type: string | ||
getBytesAsync: Promise<Uint8Array> | ||
getTextAsync: Promise<string> | ||
} | ||
//////////////////////////////////////////////////////////////////////////////// | ||
@@ -1030,7 +1065,36 @@ // Datatypes | ||
readonly type: 'WIDGET' | ||
readonly widgetId: string | ||
readonly widgetSyncedState: { [key: string]: any } | ||
clone(): WidgetNode | ||
cloneWidget(overrides: { [key: string]: any }): WidgetNode | ||
cloneWidget( | ||
syncedStateOverrides: { [name: string]: any }, | ||
syncedMapOverrides?: { [mapName: string]: { [key: string]: any } }, | ||
): WidgetNode | ||
} | ||
interface EmbedData { | ||
srcUrl: string; | ||
canonicalUrl: string | null; | ||
title: string | null; | ||
description: string | null; | ||
provider: string | null; | ||
} | ||
interface EmbedNode extends OpaqueNodeMixin, SceneNodeMixin { | ||
readonly type: "EMBED" | ||
readonly embedData: EmbedData; | ||
clone(): EmbedNode | ||
} | ||
interface LinkUnfurlData { | ||
url: string; | ||
title: string | null; | ||
description: string | null; | ||
provider: string | null; | ||
} | ||
interface LinkUnfurlNode extends OpaqueNodeMixin, SceneNodeMixin { | ||
readonly type: "LINK_UNFURL" | ||
readonly linkUnfurlData: LinkUnfurlData; | ||
clone(): LinkUnfurlNode | ||
} | ||
type BaseNode = | ||
@@ -1061,3 +1125,5 @@ DocumentNode | | ||
StampNode | | ||
WidgetNode | ||
WidgetNode | | ||
EmbedNode | | ||
LinkUnfurlNode | ||
@@ -1064,0 +1130,0 @@ type NodeType = BaseNode['type'] |
39887
1001