Skip to content

Commit 43401f4

Browse files
committed
update typings for new release
1 parent 7126b4d commit 43401f4

File tree

2 files changed

+143
-15
lines changed

2 files changed

+143
-15
lines changed

plugin-api-standalone.d.ts

Lines changed: 72 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,9 +2015,9 @@ interface VariablesAPI {
20152015
*
20162016
* @deprecated Use `createVariable(string, VariableCollection, VariableResolvedDataType)` instead. This function will throw an exception if the plugin manifest contains `"documentAccess": "dynamic-page"`.
20172017
*
2018-
* @param name - the name of the newly created variable
2019-
* @param collectionId - the ID of a collection object
2020-
* @param resolvedType - the resolved type of this variable
2018+
* @param name - The name of the newly created variable
2019+
* @param collectionId - The ID of a collection object
2020+
* @param resolvedType - The resolved type of this variable
20212021
*/
20222022
createVariable(
20232023
name: string,
@@ -2027,9 +2027,9 @@ interface VariablesAPI {
20272027
/**
20282028
* Creates a variable with a given name and resolved type inside a collection.
20292029
*
2030-
* @param name - the name of the newly created variable
2030+
* @param name - The name of the newly created variable
20312031
* @param collection - A variable collection. Make sure to pass a collection object here; passing a collection ID is deprecated.
2032-
* @param resolvedType - the resolved type of this variable
2032+
* @param resolvedType - The resolved type of this variable
20332033
*/
20342034
createVariable(
20352035
name: string,
@@ -2038,9 +2038,22 @@ interface VariablesAPI {
20382038
): Variable
20392039
/**
20402040
* Creates a new variable collection with the given name.
2041-
* @param name - the name of the newly created variable collection.
2041+
* @param name - The name of the newly created variable collection.
20422042
*/
20432043
createVariableCollection(name: string): VariableCollection
2044+
/**
2045+
* Creates a new extended variable collection from a library or local variable collection with the given name.
2046+
* @param collectionKey - The key of the library or local variable collection to extend.
2047+
* @param name - The name of the newly created variable collection.
2048+
*
2049+
* Note: This API is limited to the Enterprise plan.
2050+
* If limited by the current pricing tier, this method will throw an error with the message
2051+
* `in extend: Cannot create extended collections outside of enterprise plan.`
2052+
*/
2053+
extendLibraryCollectionByKeyAsync(
2054+
collectionKey: string,
2055+
name: string,
2056+
): Promise<ExtendedVariableCollection>
20442057
/**
20452058
* Helper function to create a variable alias.
20462059
*
@@ -10086,7 +10099,7 @@ interface Variable extends PluginDataMixin {
1008610099
resolvedType: VariableResolvedDataType
1008710100
}
1008810101
/**
10089-
* Sets the value of this variable for the provided mode.
10102+
* Sets the value of this variable for the provided mode. If the modeId belongs to an extended collection, the value will be overridden on the extension.
1009010103
*/
1009110104
setValueForMode(modeId: string, newValue: VariableValue): void
1009210105
/**
@@ -10143,6 +10156,16 @@ interface Variable extends PluginDataMixin {
1014310156
* Remove a platform definition from {@link Variable.codeSyntax}. Acceptable parameters are `'WEB'`, `'ANDROID'`, and `'iOS'` if previously defined.
1014410157
*/
1014510158
removeVariableCodeSyntax(platform: CodeSyntaxPlatform): void
10159+
/**
10160+
* The overridden or inherited values for each mode for the provided collection that inherits this variable. Note that this will not resolve any aliases. To return fully resolved values in all cases, consider using {@link Variable.resolveForConsumer}.
10161+
*/
10162+
valuesByModeForCollectionAsync(collection: VariableCollection): Promise<{
10163+
[modeId: string]: VariableValue
10164+
}>
10165+
/**
10166+
* Removes the overridden value for the given mode if it exists and returns to the inherited value.
10167+
*/
10168+
removeOverrideForMode(extendedModeId: string): void
1014610169
}
1014710170
interface VariableCollection extends PluginDataMixin {
1014810171
/**
@@ -10161,6 +10184,8 @@ interface VariableCollection extends PluginDataMixin {
1016110184
getPublishStatusAsync(): Promise<PublishStatus>
1016210185
/** Whether this variable collection is remote or local. */
1016310186
readonly remote: boolean
10187+
/** Whether this variable collection is an extension of another variable collection. */
10188+
readonly isExtension: boolean
1016410189
/** The list of modes defined for this variable collection. */
1016510190
readonly modes: Array<{
1016610191
modeId: string
@@ -10182,6 +10207,17 @@ interface VariableCollection extends PluginDataMixin {
1018210207
* Note that while this key is present on local and published variable collections, `TeamLibaryAPI` can only be used to query the variables of variable collections that are already published.
1018310208
*/
1018410209
readonly key: string
10210+
/**
10211+
* Creates an extended variable collection from this variable collection. Returns the newly created extended variable collection. This method is only available on local variable collections.
10212+
*
10213+
* Note: This API is limited to the Enterprise plan.
10214+
* If limited by the current pricing tier, this method will throw an error with the message
10215+
* `in extend: Cannot create extended collections outside of enterprise plan.`
10216+
*
10217+
* See [Figma plans and features](https://help.figma.com/hc/en-us/articles/360040328273) for more information.
10218+
*
10219+
*/
10220+
extend(name: string): ExtendedVariableCollection
1018510221
/** Removes this variable collection and all of its variables from the document. */
1018610222
remove(): void
1018710223
/** Removes the given mode by ID. */
@@ -10200,6 +10236,34 @@ interface VariableCollection extends PluginDataMixin {
1020010236
/** Renames the given mode. */
1020110237
renameMode(modeId: string, newName: string): void
1020210238
}
10239+
interface ExtendedVariableCollection extends Omit<VariableCollection, 'addMode'> {
10240+
/** `isExtension` is set to `true` to distinguish an extended collection from base variable collections. */
10241+
readonly isExtension: true
10242+
/**
10243+
* The ID of the parent variable collection.
10244+
*/
10245+
readonly parentVariableCollectionId: string
10246+
/**
10247+
* The list of variables contained in this extended variable collection including variables that are inherited from its parent collection.
10248+
*/
10249+
readonly variableIds: string[]
10250+
/** The overridden variable values in this extended variable collection. */
10251+
readonly variableOverrides: {
10252+
[variableId: string]: {
10253+
[extendedModeId: string]: VariableValue
10254+
}
10255+
}
10256+
/** Removes all overridden values in this extended collection for the given variable. */
10257+
removeOverridesForVariable(variableToClear: Variable): void
10258+
/** The modes inherited from the parent collection. */
10259+
readonly modes: Array<{
10260+
modeId: string
10261+
name: string
10262+
parentModeId: string
10263+
}>
10264+
/** Removes the given mode by ID if its parent mode has been deleted. */
10265+
removeMode(modeId: string): void
10266+
}
1020310267
type AnnotationCategoryColor =
1020410268
| 'yellow'
1020510269
| 'orange'
@@ -10935,4 +10999,4 @@ interface FindAllCriteria<T extends NodeType[]> {
1093510999
}
1093611000

1093711001
// prettier-ignore
10938-
export { ArgFreeEventType, PluginAPI, VersionHistoryResult, VariablesAPI, LibraryVariableCollection, LibraryVariable, AnnotationsAPI, BuzzAPI, BuzzTextField, BuzzMediaField, BuzzAssetType, 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, CanvasViewChangeEvent, 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, FontStyle, TextDecorationOffset, TextDecorationThickness, TextDecorationColor, OpenTypeFeature, ArcData, DropShadowEffect, InnerShadowEffect, BlurEffectBase, BlurEffectNormal, BlurEffectProgressive, BlurEffect, NoiseEffectBase, NoiseEffectMonotone, NoiseEffectDuotone, NoiseEffectMultitone, NoiseEffect, TextureEffect, GlassEffect, Effect, ConstraintType, Constraints, ColorStop, ImageFilters, SolidPaint, GradientPaint, ImagePaint, VideoPaint, PatternPaint, 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, GridTrackSize, GridLayoutMixin, AutoLayoutChildrenMixin, GridChildrenMixin, 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, BaseNonResizableTextMixin, NonResizableTextMixin, NonResizableTextPathMixin, TextSublayerNode, DocumentNode, ExplicitVariableModesMixin, PageNode, FrameNode, GroupNode, TransformGroupNode, SliceNode, RectangleNode, LineNode, EllipseNode, PolygonNode, StarNode, VectorNode, TextNode, TextPathNode, 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, AnnotationCategoryColor, AnnotationCategory, 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 }
11002+
export { ArgFreeEventType, PluginAPI, VersionHistoryResult, VariablesAPI, LibraryVariableCollection, LibraryVariable, AnnotationsAPI, BuzzAPI, BuzzTextField, BuzzMediaField, BuzzAssetType, 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, CanvasViewChangeEvent, 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, FontStyle, TextDecorationOffset, TextDecorationThickness, TextDecorationColor, OpenTypeFeature, ArcData, DropShadowEffect, InnerShadowEffect, BlurEffectBase, BlurEffectNormal, BlurEffectProgressive, BlurEffect, NoiseEffectBase, NoiseEffectMonotone, NoiseEffectDuotone, NoiseEffectMultitone, NoiseEffect, TextureEffect, GlassEffect, Effect, ConstraintType, Constraints, ColorStop, ImageFilters, SolidPaint, GradientPaint, ImagePaint, VideoPaint, PatternPaint, 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, GridTrackSize, GridLayoutMixin, AutoLayoutChildrenMixin, GridChildrenMixin, 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, BaseNonResizableTextMixin, NonResizableTextMixin, NonResizableTextPathMixin, TextSublayerNode, DocumentNode, ExplicitVariableModesMixin, PageNode, FrameNode, GroupNode, TransformGroupNode, SliceNode, RectangleNode, LineNode, EllipseNode, PolygonNode, StarNode, VectorNode, TextNode, TextPathNode, 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, ExtendedVariableCollection, AnnotationCategoryColor, AnnotationCategory, 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)