-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: TypeScript type definition (#23)
- Loading branch information
1 parent
b105a25
commit 43312fc
Showing
37 changed files
with
830 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './models'; | ||
export * from './utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Color from '../Color'; | ||
import Group from '../Group'; | ||
import RulerData from '../RulerData'; | ||
|
||
declare class Artboard extends Group { | ||
_class: 'artboard'; | ||
shouldBreakMaskChain: boolean; | ||
backgroundColor: Color; | ||
hasBackgroundColor: boolean; | ||
horizontalRulerData: RulerData; | ||
verticalRulerData: RulerData; | ||
includeBackgroundColorInExport: boolean; | ||
includeInCloudUpload: boolean; | ||
isFlowHome: boolean; | ||
resizesContent: boolean; | ||
|
||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = Artboard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import StringAttribute from '../StringAttribute'; | ||
|
||
declare class AttributedString { | ||
_class: 'attributedString'; | ||
string: string; | ||
attributes: StringAttribute[]; | ||
|
||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = AttributedString; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Color from '../Color'; | ||
|
||
declare class Border { | ||
static Position: { | ||
Inside: 1; | ||
Center: 0; | ||
Outside: 2; | ||
}; | ||
|
||
constructor(args?: any, json?: any); | ||
|
||
_class: 'border'; | ||
isEnabled: boolean; | ||
color: Color; | ||
fillType: number; | ||
position: 0 | 1 | 2; | ||
thickness: number; | ||
} | ||
|
||
export = Border; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
declare class BorderOptions { | ||
static LineCapStyle: { | ||
butt: 0; | ||
round: 1; | ||
projecting: 2; | ||
}; | ||
|
||
static LineJoinStyle: { | ||
miter: 0; | ||
round: 1; | ||
bevel: 2; | ||
}; | ||
|
||
constructor(args?: any, json?: any); | ||
|
||
_class: 'borderOptions'; | ||
isEnabled: boolean; | ||
dashPattern: number[]; | ||
lineCapStyle: 0 | 1 | 2; | ||
lineJoinStyle: 0 | 1 | 2; | ||
} | ||
|
||
export = BorderOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import TinyColor from 'tinycolor2'; | ||
|
||
declare class Color { | ||
_class: 'color'; | ||
alpha: number; | ||
blue: number; | ||
green: number; | ||
red: number; | ||
|
||
constructor(args?: any, json?: any); | ||
|
||
set(tinyColor: TinyColor.Instance): Color; | ||
|
||
_getTinyColor(): TinyColor.Instance; | ||
} | ||
|
||
export = Color; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
declare class CurvePoint { | ||
_class: 'curvePoint'; | ||
cornerRadius: number; | ||
curveFrom: string; | ||
curveTo: string; | ||
hasCurveFrom: boolean; | ||
hasCurveTo: boolean; | ||
point: string; | ||
|
||
constructor(args?: any, json?: any); | ||
|
||
} | ||
|
||
export = CurvePoint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import Color from '../Color'; | ||
import Page from '../Page'; | ||
import SharedStyle from '../SharedStyle'; | ||
|
||
declare class Document { | ||
_class: 'document'; | ||
do_objectID: string; | ||
assets: { | ||
_class: 'assetCollection'; | ||
colors: Color[]; | ||
gradients: any[]; // TODO | ||
imageCollections: { | ||
_class: 'imageCollection'; | ||
images: any; // TODO | ||
}, | ||
images: any[]; // TODO | ||
}; | ||
colorSpace: number; | ||
currentPageIndex: number; | ||
foreignLayerStyles: SharedStyle[]; | ||
foreignSymbols: any[]; // TODO | ||
foreignTextStyles: SharedStyle[]; | ||
layerStyles: { | ||
_class: 'sharedStyleContainer'; | ||
objects: SharedStyle[]; | ||
}; | ||
layerSymbols: { | ||
_class: 'symbolContainer'; | ||
objects: any[]; // TODO | ||
}; | ||
layerTextStyles: { | ||
_class: 'sharedTextStyleContainer'; | ||
objects: SharedStyle[]; | ||
}; | ||
pages: Page[]; | ||
|
||
constructor(args?: any, json?: any); | ||
|
||
getLayerStyles(): SharedStyle[]; | ||
|
||
getLayerStyle(name: string): SharedStyle | undefined; | ||
|
||
addLayerStyle(style: SharedStyle): Document; | ||
|
||
getTextStyles(): SharedStyle[]; | ||
|
||
addTextStyle(style: SharedStyle): Document; | ||
|
||
addPage(pageID: string): Document; | ||
} | ||
|
||
export = Document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
declare class ExportFormat { | ||
_class: 'exportFormat'; | ||
absoluteSize: number; | ||
fileFormat: string; | ||
name: string; | ||
nameScheme: number; | ||
scale: number; | ||
visibleScaleType: number; | ||
|
||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = ExportFormat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import ExportFormat from '../ExportFormat'; | ||
|
||
declare class ExportOptions { | ||
_class: 'exportOptions'; | ||
exportFormats: ExportFormat[]; | ||
includedLayerIds: string[]; | ||
layerOptions: number; | ||
shouldTrim: boolean; | ||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = ExportOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Color from '../Color'; | ||
import Gradient from '../Gradient'; | ||
|
||
declare class Fill { | ||
static FillType: { | ||
Color: 0, | ||
Gradient: 1, | ||
Pattrern: 4, | ||
Noise: 5, | ||
}; | ||
|
||
_class: 'fill'; | ||
isEnabled: boolean; | ||
color: Color; | ||
fillType: 0 | 1 | 4 | 5; | ||
noiseIndex: number; | ||
noiseIntensity: number; | ||
patternFillType: number; | ||
patternTileScale: number; | ||
gradient: Gradient; | ||
|
||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = Fill; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Color from '../Color'; | ||
|
||
declare class Gradient { | ||
static GradientStop: { | ||
_class: 'gradientStop'; | ||
color: Color; | ||
position: number; | ||
} | ||
|
||
static GradientType: { | ||
Linear: 0; | ||
Radial: 1; | ||
Angular: 2; | ||
} | ||
|
||
_class: 'gradient'; | ||
elipseLength: number; | ||
from: string; | ||
to: string; | ||
gradientType: number; | ||
stops: Array<typeof Gradient.GradientStop>; | ||
|
||
constructor(args?: any, json?: any); | ||
} | ||
|
||
export = Gradient; |
Oops, something went wrong.