@invisionapp/studio-api
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -10,2 +10,7 @@ # Changelog | ||
## 3.1.0 - 2019-04-09 | ||
## Added | ||
- Updated `d.ts` to include `environment.logPath` | ||
- Updated `d.ts` to include latest Document Mutation API developments | ||
## 3.0.3 - 2019-03-06 | ||
@@ -12,0 +17,0 @@ ### Changed |
324
index.d.ts
@@ -1,2 +0,2 @@ | ||
export declare type EventListener = Function; | ||
export declare type EventListener = (...args: any[]) => void; | ||
export declare type RemoveEventListener = () => void; | ||
@@ -16,2 +16,5 @@ export interface IAuthEventsV0 { | ||
} | ||
export interface IUIEventsV0 { | ||
onDidThemeChange(listenerFunction: EventListener): RemoveEventListener; | ||
} | ||
export interface IAuthEventsV1 { | ||
@@ -24,27 +27,11 @@ onDidUserLogin(listenerFunction: EventListener): RemoveEventListener; | ||
onDidDocumentLoad(listenerFunction: EventListener): RemoveEventListener; | ||
onDIdSelectionChange(listenerFunction: EventListener): RemoveEventListener; | ||
onDidSelectionChange(listenerFunction: EventListener): RemoveEventListener; | ||
} | ||
export declare type IFetchReponse = Response; | ||
export interface IFetchOptions extends RequestInit { | ||
token?: string; | ||
env?: string; | ||
export interface ICoreEventsV1 { | ||
onWillShow(listenerFunction: EventListener): RemoveEventListener; | ||
onWillShutDown(listenerFunction: EventListener): RemoveEventListener; | ||
} | ||
export interface IFetchAPIFacade { | ||
sendHttpRequest(url: string, options?: IFetchOptions | undefined): Promise<IFetchReponse>; | ||
export interface IUIEventsV1 { | ||
onDidThemeChange(listenerFunction: EventListener): RemoveEventListener; | ||
} | ||
/** | ||
* This file was automatically generated by json-schema-to-typescript. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
* and run json-schema-to-typescript to regenerate this file. | ||
*/ | ||
export type PluginManifestVersion = '0.1.0' | '0.2.0'; | ||
export type PluginName = string; | ||
/** | ||
* Minimal manifest.json JSON Schema for running plugin in InVision Studio | ||
*/ | ||
export interface PluginManifest { | ||
manifestVersion: PluginManifestVersion; | ||
name: PluginName; | ||
[k: string]: any; | ||
} | ||
export declare type IEncoding = 'utf8' | 'base64'; | ||
@@ -84,6 +71,24 @@ export interface IFileJSON { | ||
} | ||
export interface ISaveOptions { | ||
/** | ||
* This file was automatically generated by json-schema-to-typescript. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
* and run json-schema-to-typescript to regenerate this file. | ||
*/ | ||
export type PluginManifestVersion = '0.1.0' | '0.2.0'; | ||
export type PluginName = string; | ||
/** | ||
* Minimal manifest.json JSON Schema for running plugin in InVision Studio | ||
*/ | ||
export interface PluginManifest { | ||
manifestVersion: PluginManifestVersion; | ||
name: PluginName; | ||
[k: string]: any; | ||
} | ||
export interface IDialogOptions { | ||
extensions?: string | string[]; | ||
} | ||
export interface ISaveOptions extends IDialogOptions { | ||
encoding?: IEncoding; | ||
} | ||
export interface IOpenOptions { | ||
export interface IOpenOptions extends IDialogOptions { | ||
encoding?: IEncoding; | ||
@@ -102,2 +107,6 @@ } | ||
} | ||
export interface IUserInfo { | ||
userId: number; | ||
[k: string]: any; | ||
} | ||
export interface UDFNode { | ||
@@ -162,3 +171,3 @@ id: string; | ||
} | ||
export interface IPluginManagerAPIFacade { | ||
export interface IPluginManagerAPIFacadeV0 { | ||
reload(): Promise<void>; | ||
@@ -170,39 +179,49 @@ list(): Promise<Record<string, any>[]>; | ||
} | ||
export interface IPluginManagerAPIFacadeV1 { | ||
list(): Promise<Record<string, any>[]>; | ||
} | ||
export declare type ToastAction = [string, Function]; | ||
export interface IComponents { | ||
Button: string; | ||
ButtonSet: string; | ||
ButtonSetOption: string; | ||
CheckBox: string; | ||
ComboBox: string; | ||
DialogButton: React.ReactNode; | ||
DialogContent: React.ReactNode; | ||
Divider: string; | ||
FlexBox: string; | ||
Image: string; | ||
NumberInput: string; | ||
Popover: string; | ||
ProgressIndicator: string; | ||
Radio: string; | ||
Select: string; | ||
Slider: string; | ||
TagBox: string; | ||
Text: string; | ||
TextArea: string; | ||
TextBox: string; | ||
Toast: string; | ||
ToastAction: string; | ||
ToastText: string; | ||
readonly Button: React.ComponentClass<any>; | ||
readonly ButtonSet: React.ComponentClass<any>; | ||
readonly ButtonSetOption: React.ComponentClass<any>; | ||
readonly CheckBox: React.ComponentClass<any>; | ||
readonly ComboBox: React.ComponentClass<any>; | ||
readonly Divider: React.ComponentClass<any>; | ||
readonly FlexBox: React.ComponentClass<any>; | ||
readonly Image: React.ComponentClass<any>; | ||
readonly NumberInput: React.ComponentClass<any>; | ||
readonly ProgressIndicator: React.ComponentClass<any>; | ||
readonly Radio: React.ComponentClass<any>; | ||
readonly Select: React.ComponentClass<any>; | ||
readonly Slider: React.ComponentClass<any>; | ||
readonly TagBox: React.ComponentClass<any>; | ||
readonly Text: string; | ||
readonly TextArea: React.ComponentClass<any>; | ||
readonly TextBox: React.ComponentClass<any>; | ||
} | ||
export interface ILegacyComponents { | ||
readonly Toast: string; | ||
readonly ToastAction: string; | ||
readonly ToastText: string; | ||
} | ||
export interface ITopLevelComponents { | ||
Dialog: React.ReactNode; | ||
FloatingWindow: React.ReactNode; | ||
Modal: React.ReactNode; | ||
ToastTop: React.ReactNode; | ||
readonly AppDock: React.ComponentClass<any>; | ||
readonly Dialog: React.ComponentClass<any>; | ||
readonly DialogButton: React.ComponentClass<any>; | ||
readonly DialogContent: React.ComponentClass<any>; | ||
readonly FloatingWindow: React.ComponentClass<any>; | ||
readonly Modal: React.ComponentClass<any>; | ||
readonly Popover: React.ComponentClass<any>; | ||
readonly ToastTop: React.ComponentClass<any>; | ||
} | ||
export interface IPluginRendererAPIFacade { | ||
components: IComponents & ITopLevelComponents; | ||
export interface IPluginRendererAPIFacadeV0 { | ||
components: IComponents & ITopLevelComponents & ILegacyComponents; | ||
render(reactElement: any, contentArea: string): any; | ||
toast(text: string, actions?: ToastAction[], isDismissible?: boolean): void; | ||
} | ||
export interface IPluginRendererAPIFacadeV1 { | ||
components: IComponents & ITopLevelComponents & ILegacyComponents; | ||
toast(text: string, actions?: ToastAction[], isDismissible?: boolean): void; | ||
} | ||
export interface ISettingsAPIFacade { | ||
@@ -219,11 +238,154 @@ getSettingsData(key: string, plugin?: string): Promise<any>; | ||
export declare const IAnalyticsAPI: unique symbol; | ||
declare class Selection { | ||
export interface IChange { | ||
id: string; | ||
prop: string; | ||
value: any; | ||
} | ||
declare class Target { | ||
_documentNode: any; | ||
supportedAccessors: Set<string>; | ||
supportedCollections: Set<string>; | ||
constructor(_documentNode: any); | ||
readonly id: string; | ||
children(): Target[]; | ||
apply(prop: string, args: any[]): IChange | null; | ||
getRawCollection(prop: string): any[]; | ||
} | ||
export interface IDocumentChange { | ||
id: string; | ||
[prop: string]: any; | ||
} | ||
declare class ChangeSet { | ||
private changes; | ||
constructor(); | ||
add(id: string, prop: string, value: any): void; | ||
getChanges(): IDocumentChange[]; | ||
getPropChanges(id: string, prop: string): any[] | null; | ||
replacePropChanges(id: string, prop: string, value: any): void; | ||
private hasChangesFor; | ||
private canCollateChange; | ||
private findChangeGroup; | ||
private addNewChange; | ||
private getPropChangeObject; | ||
} | ||
export interface ICollectionElement { | ||
[key: string]: any; | ||
setters: SettersObject; | ||
getChanges: Function; | ||
} | ||
export declare type SettersObject = { | ||
[key: string]: Function | SetterInstruction; | ||
}; | ||
export interface SetterInstruction { | ||
transform: Function; | ||
validate: Function; | ||
} | ||
declare class CollectionElement implements ICollectionElement { | ||
protected _id: string | undefined; | ||
readonly id: string | undefined; | ||
protected setId(id?: string): void; | ||
setters: SettersObject; | ||
getSetters(): SettersObject; | ||
getChanges(): any; | ||
autoValidateAndSet(prop: string, value: any): boolean; | ||
validateAndSet(prop: string, value: any, validator: Function, errorMsg?: string): boolean; | ||
static fromRawElement(element: { | ||
[key: string]: any; | ||
}): any; | ||
} | ||
declare class BaseFill extends CollectionElement implements ICollectionElement { | ||
color: UdfColor; | ||
private isEnabled; | ||
private opacity; | ||
private blendMode; | ||
constructor(color?: UdfColor); | ||
setters: SettersObject; | ||
getChanges(): any; | ||
private removeUndefined; | ||
isValidBlendMode(str: string): boolean; | ||
} | ||
declare class SolidFill extends BaseFill implements ICollectionElement { | ||
readonly type: 'solid'; | ||
constructor(...args: any[]); | ||
getColor(...args: any[]): UdfColor; | ||
setters: SettersObject; | ||
getChanges(): UdfSolidFill; | ||
} | ||
export declare type GradientFillType = 'linear-gradient' | 'radial-gradient'; | ||
export declare type ShortGradientFillType = 'linear' | 'radial'; | ||
export declare type GradientFillObject = { | ||
type: ShortGradientFillType; | ||
origin: UdfPercentPoint; | ||
destination: UdfPercentPoint; | ||
stops: UdfColorStop[]; | ||
}; | ||
declare class GradientFill extends BaseFill implements ICollectionElement { | ||
readonly type: GradientFillType | undefined; | ||
origin: UdfPercentPoint | undefined; | ||
destination: UdfPercentPoint | undefined; | ||
stops: UdfColorStop[] | undefined; | ||
constructor(...args: any[]); | ||
getGradientAttrs(...args: any[]): GradientFillObject; | ||
setters: SettersObject; | ||
getChanges(): UdfLinearGradientFill | UdfRadialGradientFill; | ||
} | ||
declare enum ImageFitTypes { | ||
fill = "fill", | ||
fit = "fit", | ||
stretch = "stretch", | ||
tile = "tile" | ||
} | ||
export interface ImageObject { | ||
fit: ImageFitTypes; | ||
resourceId: null | string; | ||
scale: number; | ||
} | ||
declare class ImageFill extends BaseFill implements ICollectionElement { | ||
readonly type: 'image-fill'; | ||
image: ImageObject; | ||
constructor(...args: any[]); | ||
getImageObject(...args: any[]): ImageObject; | ||
setters: SettersObject; | ||
getChanges(): UdfImageFill; | ||
} | ||
export declare type FillObjType = SolidFill | GradientFill | ImageFill; | ||
declare class Collection { | ||
private node; | ||
private type; | ||
private changeSet; | ||
private rawCollection; | ||
private target; | ||
constructor(node: Target, type: string, changeSet: ChangeSet); | ||
update(): void; | ||
insertAt(struct: FillObjType, index: number): void; | ||
removeAt(index: number): void; | ||
indexOf(id: string): number; | ||
targetIndexOf(id: string): number; | ||
getObjectAt(index: number): FillObjType | null; | ||
getCopyOf(id: string): FillObjType | null; | ||
readonly size: number; | ||
private createTarget; | ||
private createTargetElement; | ||
} | ||
declare class Selection { | ||
private targets; | ||
private changeSet; | ||
constructor(targets: Target[], changeSet: ChangeSet); | ||
children(): Selection; | ||
apply(prop: string, ...args: any[]): void; | ||
getCollectionBag(type: string): Collection[]; | ||
static fromRawNodes(nodes: any, changeSet: ChangeSet): Selection; | ||
} | ||
export declare type DocumentMutator = (selection: Selection) => void; | ||
export interface IDocumentAPIFacade { | ||
getAllPages(cb: DocumentMutator): void; | ||
getCurrentPage(cb: DocumentMutator): void; | ||
getSelectedLayers(cb: DocumentMutator): void; | ||
getAllPages(cb: DocumentMutator): Promise<void>; | ||
getCurrentPage(cb: DocumentMutator): Promise<void>; | ||
getSelectedLayers(cb: DocumentMutator): Promise<void>; | ||
} | ||
export interface IThemeServiceAPIFacade { | ||
getTheme(): Promise<string>; | ||
} | ||
export interface IAppDockAPIFacade { | ||
download(name: string, displayName: string, manifest?: PluginManifest): Promise<void>; | ||
} | ||
export interface IAPIExtension { | ||
@@ -239,39 +401,49 @@ getInstallableMethods(options?: GetAPIOptions): any; | ||
} | ||
export interface IUserInfo { | ||
email: string; | ||
userId: number; | ||
[k: string]: any; | ||
export declare type IFetchReponse = Response; | ||
export interface IFetchOptions extends RequestInit { | ||
token?: string; | ||
env?: string; | ||
} | ||
export interface ISafeUserServiceAPIFacade { | ||
export interface IFetchAPIFacade { | ||
sendHttpRequest(url: string, options?: IFetchOptions | undefined): Promise<IFetchReponse>; | ||
} | ||
export interface IUserServiceAPIFacade { | ||
getUser(): Promise<IUserInfo | null>; | ||
} | ||
export interface IPluginCustomProtocolAPIFacade { | ||
readonly customProtocolUrl: any; | ||
export declare const IUserServiceAPI: unique symbol; | ||
export interface IUserServiceAPI extends IAPIExtension, IUserServiceAPIFacade { | ||
} | ||
export interface IEnvironmentAPIFacade { | ||
readonly customProtocolUrl: string; | ||
readonly logPath: string; | ||
} | ||
export interface IGeneratorEnforcer { | ||
} | ||
export declare namespace V0API { | ||
type Auth = IAuthEventsV0 & ISafeUserServiceAPIFacade; | ||
type Analytics = IAnalyticsAPI; | ||
type Auth = IAuthEventsV0 & IUserServiceAPI; | ||
type Core = IFetchAPIFacade & IPluginCacheAPIFacade & ICoreEventsV0; | ||
type Document = IUDFServiceFacade & IUDFEventsV0 & IDocumentAPIFacade; | ||
type Environment = IPluginCustomProtocolAPIFacade & IGeneratorEnforcer; | ||
type Document = IUDFServiceFacade & IUDFEventsV0; | ||
type Environment = IEnvironmentAPIFacade & IGeneratorEnforcer; | ||
type Files = IFileSystemAPIFacade & IGeneratorEnforcer; | ||
type Logger = ILoggerAPIFacade & IGeneratorEnforcer; | ||
type Plugins = IPluginManagerAPIFacade & IGeneratorEnforcer; | ||
type Plugins = IPluginManagerAPIFacadeV0 & IGeneratorEnforcer; | ||
type Renderer = IGenerateImagesFacade & IGeneratorEnforcer; | ||
type Settings = ISettingsAPIFacade & IGeneratorEnforcer; | ||
type UI = IPluginRendererAPIFacade & IGeneratorEnforcer; | ||
type UI = IPluginRendererAPIFacadeV0 & IThemeServiceAPIFacade & IUIEventsV0 & IGeneratorEnforcer; | ||
type __Danger = IAppDockAPIFacade; | ||
} | ||
export declare namespace V1API { | ||
type Analytics = IAnalyticsAPI; | ||
type Auth = IAuthEventsV1 & ISafeUserServiceAPIFacade; | ||
type Core = IFetchAPIFacade & IPluginCacheAPIFacade & ICoreEventsV0; | ||
type Auth = IAuthEventsV1 & IUserServiceAPI; | ||
type Core = ICoreEventsV1; | ||
type Document = IDocumentEventsV1 & IDocumentAPIFacade; | ||
type Environment = IPluginCustomProtocolAPIFacade & IGeneratorEnforcer; | ||
type Environment = IEnvironmentAPIFacade & IGeneratorEnforcer; | ||
type Files = IFileSystemAPIFacade & IGeneratorEnforcer; | ||
type Logger = ILoggerAPIFacade & IGeneratorEnforcer; | ||
type Plugins = IPluginManagerAPIFacade & IGeneratorEnforcer; | ||
type Plugins = IPluginManagerAPIFacadeV1 & IGeneratorEnforcer; | ||
type Renderer = IGenerateImagesFacade & IGeneratorEnforcer; | ||
type Settings = ISettingsAPIFacade & IGeneratorEnforcer; | ||
type UI = IPluginRendererAPIFacade & IGeneratorEnforcer; | ||
type UI = IPluginRendererAPIFacadeV1 & IThemeServiceAPIFacade & IUIEventsV1 & IGeneratorEnforcer; | ||
type __Danger = IAppDockAPIFacade; | ||
} | ||
@@ -278,0 +450,0 @@ export declare const auth: V1API.Auth; |
{ | ||
"name": "@invisionapp/studio-api", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18940
466