mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
updates typings to update 9 (#41102)
This commit is contained in:
committed by
Ryan Cavanaugh
parent
ba63399ef3
commit
cf41279e00
@@ -12,4 +12,8 @@ async () => {
|
||||
const { a } = await figma.clientStorage.getAsync('happy');
|
||||
};
|
||||
|
||||
if (frame.cornerRadius !== figma.mixed) {
|
||||
frame.topLeftRadius = frame.cornerRadius;
|
||||
}
|
||||
|
||||
figma.closePlugin();
|
||||
|
||||
Vendored
+156
-58
@@ -7,12 +7,14 @@
|
||||
// rudi@figma.com, jonas@figma.com
|
||||
// While changes to the types aren't breaking changes to how plugins run,
|
||||
// it is preferable to coordinate breaking type changes with breaking API changes.
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
// Figma Plugin API version 1, update 5
|
||||
// Figma Plugin API version 1, update 9
|
||||
|
||||
declare global {
|
||||
// Global variable with Figma's plugin API.
|
||||
declare const figma: PluginAPI;
|
||||
declare const __html__: string;
|
||||
const figma: PluginAPI;
|
||||
const __html__: string;
|
||||
|
||||
interface PluginAPI {
|
||||
readonly apiVersion: '1.0.0';
|
||||
@@ -37,7 +39,7 @@ interface PluginAPI {
|
||||
once(type: 'selectionchange' | 'currentpagechange' | 'close', callback: () => void): void;
|
||||
off(type: 'selectionchange' | 'currentpagechange' | 'close', callback: () => void): void;
|
||||
|
||||
readonly mixed: symbol;
|
||||
readonly mixed: unique symbol;
|
||||
|
||||
createRectangle(): RectangleNode;
|
||||
createLine(): LineNode;
|
||||
@@ -79,7 +81,7 @@ interface PluginAPI {
|
||||
createImage(data: Uint8Array): Image;
|
||||
getImageByHash(hash: string): Image;
|
||||
|
||||
group(nodes: ReadonlyArray<BaseNode>, parent: BaseNode & ChildrenMixin, index?: number): FrameNode;
|
||||
group(nodes: ReadonlyArray<BaseNode>, parent: BaseNode & ChildrenMixin, index?: number): GroupNode;
|
||||
flatten(nodes: ReadonlyArray<BaseNode>, parent?: BaseNode & ChildrenMixin, index?: number): VectorNode;
|
||||
|
||||
union(nodes: ReadonlyArray<BaseNode>, parent: BaseNode & ChildrenMixin, index?: number): BooleanOperationNode;
|
||||
@@ -105,7 +107,6 @@ interface ShowUIOptions {
|
||||
visible?: boolean;
|
||||
width?: number;
|
||||
height?: number;
|
||||
position?: 'default' | 'last' | 'auto'; // PROPOSED API ONLY
|
||||
}
|
||||
|
||||
interface UIPostMessageOptions {
|
||||
@@ -277,30 +278,30 @@ interface GridLayoutGrid {
|
||||
type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid;
|
||||
|
||||
interface ExportSettingsConstraints {
|
||||
type: 'SCALE' | 'WIDTH' | 'HEIGHT';
|
||||
value: number;
|
||||
readonly type: 'SCALE' | 'WIDTH' | 'HEIGHT';
|
||||
readonly value: number;
|
||||
}
|
||||
|
||||
interface ExportSettingsImage {
|
||||
format: 'JPG' | 'PNG';
|
||||
contentsOnly?: boolean; // defaults to true
|
||||
suffix?: string;
|
||||
constraint?: ExportSettingsConstraints;
|
||||
readonly format: 'JPG' | 'PNG';
|
||||
readonly contentsOnly?: boolean; // defaults to true
|
||||
readonly suffix?: string;
|
||||
readonly constraint?: ExportSettingsConstraints;
|
||||
}
|
||||
|
||||
interface ExportSettingsSVG {
|
||||
format: 'SVG';
|
||||
contentsOnly?: boolean; // defaults to true
|
||||
suffix?: string;
|
||||
svgOutlineText?: boolean; // defaults to true
|
||||
svgIdAttribute?: boolean; // defaults to false
|
||||
svgSimplifyStroke?: boolean; // defaults to true
|
||||
readonly format: 'SVG';
|
||||
readonly contentsOnly?: boolean; // defaults to true
|
||||
readonly suffix?: string;
|
||||
readonly svgOutlineText?: boolean; // defaults to true
|
||||
readonly svgIdAttribute?: boolean; // defaults to false
|
||||
readonly svgSimplifyStroke?: boolean; // defaults to true
|
||||
}
|
||||
|
||||
interface ExportSettingsPDF {
|
||||
format: 'PDF';
|
||||
contentsOnly?: boolean; // defaults to true
|
||||
suffix?: string;
|
||||
readonly format: 'PDF';
|
||||
readonly contentsOnly?: boolean; // defaults to true
|
||||
readonly suffix?: string;
|
||||
}
|
||||
|
||||
type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF;
|
||||
@@ -380,6 +381,65 @@ interface Font {
|
||||
fontName: FontName;
|
||||
}
|
||||
|
||||
interface Reaction {
|
||||
action: Action;
|
||||
trigger: Trigger;
|
||||
}
|
||||
|
||||
type Action =
|
||||
{ readonly type: "BACK" | "CLOSE" } |
|
||||
{ readonly type: "URL", url: string } |
|
||||
{ readonly type: "NODE";
|
||||
readonly destinationId: string | null;
|
||||
readonly navigation: Navigation;
|
||||
readonly transition: Transition | null;
|
||||
readonly preserveScrollPosition: boolean;
|
||||
|
||||
// Only present if navigation == "OVERLAY" and the destination uses
|
||||
// overlay position type "RELATIVE"
|
||||
readonly overlayRelativePosition?: Vector;
|
||||
};
|
||||
|
||||
interface SimpleTransition {
|
||||
readonly type: "DISSOLVE" | "SMART_ANIMATE";
|
||||
readonly easing: Easing;
|
||||
readonly duration: number;
|
||||
}
|
||||
|
||||
interface DirectionalTransition {
|
||||
readonly type: "MOVE_IN" | "MOVE_OUT" | "PUSH" | "SLIDE_IN" | "SLIDE_OUT";
|
||||
readonly direction: "LEFT" | "RIGHT" | "TOP" | "BOTTOM";
|
||||
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" } |
|
||||
{ readonly type: "AFTER_TIMEOUT", readonly timeout: number } |
|
||||
{ readonly type: "MOUSE_ENTER" | "MOUSE_LEAVE" | "MOUSE_UP" | "MOUSE_DOWN",
|
||||
readonly delay: number;
|
||||
};
|
||||
|
||||
type Navigation = "NAVIGATE" | "SWAP" | "OVERLAY";
|
||||
|
||||
interface Easing {
|
||||
readonly type: "EASE_IN" | "EASE_OUT" | "EASE_IN_AND_OUT" | "LINEAR";
|
||||
}
|
||||
|
||||
type OverflowDirection = "NONE" | "HORIZONTAL" | "VERTICAL" | "BOTH";
|
||||
|
||||
type OverlayPositionType = "CENTER" | "TOP_LEFT" | "TOP_CENTER" | "TOP_RIGHT" | "BOTTOM_LEFT" | "BOTTOM_CENTER" | "BOTTOM_RIGHT" | "MANUAL";
|
||||
|
||||
type OverlayBackground =
|
||||
{ readonly type: "NONE" } |
|
||||
{ readonly type: "SOLID_COLOR", readonly color: RGBA };
|
||||
|
||||
type OverlayBackgroundInteraction = "NONE" | "CLOSE_ON_CLICK_OUTSIDE";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Mixins
|
||||
|
||||
@@ -429,6 +489,8 @@ interface LayoutMixin {
|
||||
readonly width: number;
|
||||
readonly height: number;
|
||||
|
||||
layoutAlign: "MIN" | "CENTER" | "MAX"; // applicable only inside auto-layout frames
|
||||
|
||||
resize(width: number, height: number): void;
|
||||
resizeWithoutConstraints(width: number, height: number): void;
|
||||
}
|
||||
@@ -441,13 +503,13 @@ interface BlendMixin {
|
||||
effectStyleId: string;
|
||||
}
|
||||
|
||||
interface FrameMixin {
|
||||
backgrounds: ReadonlyArray<Paint>;
|
||||
interface ContainerMixin {
|
||||
backgrounds: ReadonlyArray<Paint>; // DEPRECATED: use 'fills' instead
|
||||
layoutGrids: ReadonlyArray<LayoutGrid>;
|
||||
clipsContent: boolean;
|
||||
guides: ReadonlyArray<Guide>;
|
||||
gridStyleId: string;
|
||||
backgroundStyleId: string;
|
||||
backgroundStyleId: string; // DEPRECATED: use 'fillStyleId' instead
|
||||
}
|
||||
|
||||
type StrokeCap = 'NONE' | 'ROUND' | 'SQUARE' | 'ARROW_LINES' | 'ARROW_EQUILATERAL';
|
||||
@@ -455,44 +517,73 @@ type StrokeJoin = 'MITER' | 'BEVEL' | 'ROUND';
|
||||
type HandleMirroring = 'NONE' | 'ANGLE' | 'ANGLE_AND_LENGTH';
|
||||
|
||||
interface GeometryMixin {
|
||||
fills: ReadonlyArray<Paint> | symbol;
|
||||
fills: ReadonlyArray<Paint> | PluginAPI['mixed'];
|
||||
strokes: ReadonlyArray<Paint>;
|
||||
strokeWeight: number;
|
||||
strokeAlign: 'CENTER' | 'INSIDE' | 'OUTSIDE';
|
||||
strokeCap: StrokeCap | symbol;
|
||||
strokeJoin: StrokeJoin | symbol;
|
||||
strokeCap: StrokeCap | PluginAPI['mixed'];
|
||||
strokeJoin: StrokeJoin | PluginAPI['mixed'];
|
||||
dashPattern: ReadonlyArray<number>;
|
||||
fillStyleId: string | symbol;
|
||||
fillStyleId: string | PluginAPI['mixed'];
|
||||
strokeStyleId: string;
|
||||
}
|
||||
|
||||
interface CornerMixin {
|
||||
cornerRadius: number | symbol;
|
||||
cornerRadius: number | PluginAPI['mixed'];
|
||||
cornerSmoothing: number;
|
||||
}
|
||||
|
||||
interface RectangleCornerMixin {
|
||||
topLeftRadius: number;
|
||||
topRightRadius: number;
|
||||
bottomLeftRadius: number;
|
||||
bottomRightRadius: number;
|
||||
}
|
||||
|
||||
interface ExportMixin {
|
||||
exportSettings: ReadonlyArray<ExportSettings>;
|
||||
exportAsync(settings?: ExportSettings): Promise<Uint8Array>; // Defaults to PNG format
|
||||
}
|
||||
|
||||
interface ReactionMixin {
|
||||
readonly reactions: ReadonlyArray<Reaction>; // PROPOSED API ONLY
|
||||
}
|
||||
|
||||
interface DefaultShapeMixin
|
||||
extends BaseNodeMixin,
|
||||
SceneNodeMixin,
|
||||
ReactionMixin,
|
||||
BlendMixin,
|
||||
GeometryMixin,
|
||||
LayoutMixin,
|
||||
ExportMixin {}
|
||||
|
||||
interface DefaultContainerMixin
|
||||
interface DefaultFrameMixin
|
||||
extends BaseNodeMixin,
|
||||
SceneNodeMixin,
|
||||
ReactionMixin,
|
||||
ChildrenMixin,
|
||||
FrameMixin,
|
||||
ContainerMixin,
|
||||
GeometryMixin,
|
||||
CornerMixin,
|
||||
RectangleCornerMixin,
|
||||
BlendMixin,
|
||||
ConstraintMixin,
|
||||
LayoutMixin,
|
||||
ExportMixin {}
|
||||
ExportMixin {
|
||||
layoutMode: "NONE" | "HORIZONTAL" | "VERTICAL";
|
||||
counterAxisSizingMode: "FIXED" | "AUTO"; // applicable only if layoutMode != "NONE"
|
||||
horizontalPadding: number; // applicable only if layoutMode != "NONE"
|
||||
verticalPadding: number; // applicable only if layoutMode != "NONE"
|
||||
itemSpacing: number; // applicable only if layoutMode != "NONE"
|
||||
|
||||
overflowDirection: OverflowDirection; // PROPOSED API ONLY
|
||||
numberOfFixedChildren: number; // PROPOSED API ONLY
|
||||
|
||||
readonly overlayPositionType: OverlayPositionType; // PROPOSED API ONLY
|
||||
readonly overlayBackground: OverlayBackground; // PROPOSED API ONLY
|
||||
readonly overlayBackgroundInteraction: OverlayBackgroundInteraction; // PROPOSED API ONLY
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Nodes
|
||||
@@ -517,25 +608,28 @@ interface PageNode extends BaseNodeMixin, ChildrenMixin, ExportMixin {
|
||||
selection: ReadonlyArray<SceneNode>;
|
||||
|
||||
backgrounds: ReadonlyArray<Paint>;
|
||||
|
||||
readonly prototypeStartNode: FrameNode | GroupNode | ComponentNode | InstanceNode | null; // PROPOSED API ONLY
|
||||
}
|
||||
|
||||
interface FrameNode extends DefaultContainerMixin {
|
||||
readonly type: 'FRAME' | 'GROUP';
|
||||
interface FrameNode extends DefaultFrameMixin {
|
||||
readonly type: 'FRAME';
|
||||
clone(): FrameNode;
|
||||
}
|
||||
|
||||
interface GroupNode extends BaseNodeMixin, SceneNodeMixin, ReactionMixin, ChildrenMixin, ContainerMixin, BlendMixin, LayoutMixin, ExportMixin {
|
||||
readonly type: 'GROUP';
|
||||
clone(): GroupNode;
|
||||
}
|
||||
|
||||
interface SliceNode extends BaseNodeMixin, SceneNodeMixin, LayoutMixin, ExportMixin {
|
||||
readonly type: 'SLICE';
|
||||
clone(): SliceNode;
|
||||
}
|
||||
|
||||
interface RectangleNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {
|
||||
interface RectangleNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin, RectangleCornerMixin {
|
||||
readonly type: 'RECTANGLE';
|
||||
clone(): RectangleNode;
|
||||
topLeftRadius: number;
|
||||
topRightRadius: number;
|
||||
bottomLeftRadius: number;
|
||||
bottomRightRadius: number;
|
||||
}
|
||||
|
||||
interface LineNode extends DefaultShapeMixin, ConstraintMixin {
|
||||
@@ -567,7 +661,7 @@ interface VectorNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin {
|
||||
clone(): VectorNode;
|
||||
vectorNetwork: VectorNetwork;
|
||||
vectorPaths: VectorPaths;
|
||||
handleMirroring: HandleMirroring | symbol;
|
||||
handleMirroring: HandleMirroring | PluginAPI['mixed'];
|
||||
}
|
||||
|
||||
interface TextNode extends DefaultShapeMixin, ConstraintMixin {
|
||||
@@ -582,35 +676,35 @@ interface TextNode extends DefaultShapeMixin, ConstraintMixin {
|
||||
paragraphSpacing: number;
|
||||
autoRename: boolean;
|
||||
|
||||
textStyleId: string | symbol;
|
||||
fontSize: number | symbol;
|
||||
fontName: FontName | symbol;
|
||||
textCase: TextCase | symbol;
|
||||
textDecoration: TextDecoration | symbol;
|
||||
letterSpacing: LetterSpacing | symbol;
|
||||
lineHeight: LineHeight | symbol;
|
||||
textStyleId: string | PluginAPI['mixed'];
|
||||
fontSize: number | PluginAPI['mixed'];
|
||||
fontName: FontName | PluginAPI['mixed'];
|
||||
textCase: TextCase | PluginAPI['mixed'];
|
||||
textDecoration: TextDecoration | PluginAPI['mixed'];
|
||||
letterSpacing: LetterSpacing | PluginAPI['mixed'];
|
||||
lineHeight: LineHeight | PluginAPI['mixed'];
|
||||
|
||||
getRangeFontSize(start: number, end: number): number | symbol;
|
||||
getRangeFontSize(start: number, end: number): number | PluginAPI['mixed'];
|
||||
setRangeFontSize(start: number, end: number, value: number): void;
|
||||
getRangeFontName(start: number, end: number): FontName | symbol;
|
||||
getRangeFontName(start: number, end: number): FontName | PluginAPI['mixed'];
|
||||
setRangeFontName(start: number, end: number, value: FontName): void;
|
||||
getRangeTextCase(start: number, end: number): TextCase | symbol;
|
||||
getRangeTextCase(start: number, end: number): TextCase | PluginAPI['mixed'];
|
||||
setRangeTextCase(start: number, end: number, value: TextCase): void;
|
||||
getRangeTextDecoration(start: number, end: number): TextDecoration | symbol;
|
||||
getRangeTextDecoration(start: number, end: number): TextDecoration | PluginAPI['mixed'];
|
||||
setRangeTextDecoration(start: number, end: number, value: TextDecoration): void;
|
||||
getRangeLetterSpacing(start: number, end: number): LetterSpacing | symbol;
|
||||
getRangeLetterSpacing(start: number, end: number): LetterSpacing | PluginAPI['mixed'];
|
||||
setRangeLetterSpacing(start: number, end: number, value: LetterSpacing): void;
|
||||
getRangeLineHeight(start: number, end: number): LineHeight | symbol;
|
||||
getRangeLineHeight(start: number, end: number): LineHeight | PluginAPI['mixed'];
|
||||
setRangeLineHeight(start: number, end: number, value: LineHeight): void;
|
||||
getRangeFills(start: number, end: number): Paint[] | symbol;
|
||||
getRangeFills(start: number, end: number): Paint[] | PluginAPI['mixed'];
|
||||
setRangeFills(start: number, end: number, value: Paint[]): void;
|
||||
getRangeTextStyleId(start: number, end: number): string | symbol;
|
||||
getRangeTextStyleId(start: number, end: number): string | PluginAPI['mixed'];
|
||||
setRangeTextStyleId(start: number, end: number, value: string): void;
|
||||
getRangeFillStyleId(start: number, end: number): string | symbol;
|
||||
getRangeFillStyleId(start: number, end: number): string | PluginAPI['mixed'];
|
||||
setRangeFillStyleId(start: number, end: number, value: string): void;
|
||||
}
|
||||
|
||||
interface ComponentNode extends DefaultContainerMixin {
|
||||
interface ComponentNode extends DefaultFrameMixin {
|
||||
readonly type: 'COMPONENT';
|
||||
clone(): ComponentNode;
|
||||
|
||||
@@ -620,7 +714,7 @@ interface ComponentNode extends DefaultContainerMixin {
|
||||
readonly key: string; // The key to use with "importComponentByKeyAsync"
|
||||
}
|
||||
|
||||
interface InstanceNode extends DefaultContainerMixin {
|
||||
interface InstanceNode extends DefaultFrameMixin {
|
||||
readonly type: 'INSTANCE';
|
||||
clone(): InstanceNode;
|
||||
masterComponent: ComponentNode;
|
||||
@@ -637,6 +731,7 @@ type BaseNode = DocumentNode | PageNode | SceneNode;
|
||||
type SceneNode =
|
||||
| SliceNode
|
||||
| FrameNode
|
||||
| GroupNode
|
||||
| ComponentNode
|
||||
| InstanceNode
|
||||
| BooleanOperationNode
|
||||
@@ -713,3 +808,6 @@ interface Image {
|
||||
readonly hash: string;
|
||||
getBytesAsync(): Promise<Uint8Array>;
|
||||
}
|
||||
} // declare global
|
||||
|
||||
export {};
|
||||
|
||||
Reference in New Issue
Block a user