@sketch-hq/sketch-file-format-ts
Advanced tools
Comparing version 4.0.5 to 5.0.0
# @sketch-hq/sketch-file-format-ts | ||
## 5.0.0 | ||
### Major Changes | ||
- 8c997ce: Update to Sketch File Format `3.6.1` | ||
### Minor Changes | ||
- 8c997ce: Add `ClassMap` a type that maps `_class` strings to their object | ||
type. | ||
## 4.0.5 | ||
@@ -4,0 +15,0 @@ |
@@ -1426,1 +1426,63 @@ /** | ||
} | ||
/** | ||
* A mapping of class values to object types | ||
*/ | ||
export declare type ClassMap = { | ||
triangle: Triangle; | ||
textStyle: TextStyle; | ||
text: Text; | ||
symbolMaster: SymbolMaster; | ||
symbolInstance: SymbolInstance; | ||
symbolContainer: SymbolContainer; | ||
style: Style; | ||
stringAttribute: StringAttribute; | ||
star: Star; | ||
slice: Slice; | ||
simpleGrid: SimpleGrid; | ||
sharedTextStyleContainer: SharedTextStyleContainer; | ||
sharedStyleContainer: SharedStyleContainer; | ||
sharedStyle: SharedStyle; | ||
shapePath: ShapePath; | ||
shapeGroup: ShapeGroup; | ||
shadow: Shadow; | ||
rulerData: RulerData; | ||
rectangle: Rectangle; | ||
rect: Rect; | ||
polygon: Polygon; | ||
paragraphStyle: ParagraphStyle; | ||
page: Page; | ||
overrideValue: OverrideValue; | ||
oval: Oval; | ||
layoutGrid: LayoutGrid; | ||
innerShadow: InnerShadow; | ||
imageCollection: ImageCollection; | ||
group: Group; | ||
graphicsContextSettings: GraphicsContextSettings; | ||
gradientStop: GradientStop; | ||
gradient: Gradient; | ||
fontDescriptor: FontDescriptor; | ||
fill: Fill; | ||
exportOptions: ExportOptions; | ||
exportFormat: ExportFormat; | ||
curvePoint: CurvePoint; | ||
colorControls: ColorControls; | ||
color: Color; | ||
borderOptions: BorderOptions; | ||
border: Border; | ||
blur: Blur; | ||
bitmap: Bitmap; | ||
attributedString: AttributedString; | ||
assetCollection: AssetCollection; | ||
artboard: Artboard; | ||
MSJSONOriginalDataReference: ImageDataRef; | ||
MSJSONFileReference: ImageFileRef; | ||
MSImmutableOverrideProperty: OverrideProperty; | ||
MSImmutableHotspotLayer: Hotspot; | ||
MSImmutableGradientAsset: GradientAsset; | ||
MSImmutableFreeformGroupLayout: FreeformGroupLayout; | ||
MSImmutableForeignTextStyle: ForeignTextStyle; | ||
MSImmutableForeignSymbol: ForeignSymbol; | ||
MSImmutableForeignLayerStyle: ForeignLayerStyle; | ||
MSImmutableFlowConnection: FlowConnection; | ||
MSImmutableColorAsset: ColorAsset; | ||
}; |
@@ -1468,1 +1468,64 @@ /** | ||
} | ||
/** | ||
* A mapping of class values to object types | ||
*/ | ||
export declare type ClassMap = { | ||
triangle: Triangle; | ||
textStyle: TextStyle; | ||
text: Text; | ||
symbolMaster: SymbolMaster; | ||
symbolInstance: SymbolInstance; | ||
symbolContainer: SymbolContainer; | ||
style: Style; | ||
stringAttribute: StringAttribute; | ||
star: Star; | ||
slice: Slice; | ||
simpleGrid: SimpleGrid; | ||
sharedTextStyleContainer: SharedTextStyleContainer; | ||
sharedStyleContainer: SharedStyleContainer; | ||
sharedStyle: SharedStyle; | ||
shapePath: ShapePath; | ||
shapeGroup: ShapeGroup; | ||
shadow: Shadow; | ||
rulerData: RulerData; | ||
rectangle: Rectangle; | ||
rect: Rect; | ||
polygon: Polygon; | ||
paragraphStyle: ParagraphStyle; | ||
page: Page; | ||
overrideValue: OverrideValue; | ||
oval: Oval; | ||
layoutGrid: LayoutGrid; | ||
innerShadow: InnerShadow; | ||
imageCollection: ImageCollection; | ||
group: Group; | ||
graphicsContextSettings: GraphicsContextSettings; | ||
gradientStop: GradientStop; | ||
gradient: Gradient; | ||
fontDescriptor: FontDescriptor; | ||
fill: Fill; | ||
exportOptions: ExportOptions; | ||
exportFormat: ExportFormat; | ||
curvePoint: CurvePoint; | ||
colorControls: ColorControls; | ||
color: Color; | ||
borderOptions: BorderOptions; | ||
border: Border; | ||
blur: Blur; | ||
bitmap: Bitmap; | ||
attributedString: AttributedString; | ||
assetCollection: AssetCollection; | ||
artboard: Artboard; | ||
MSJSONOriginalDataReference: ImageDataRef; | ||
MSJSONFileReference: ImageFileRef; | ||
MSImmutableOverrideProperty: OverrideProperty; | ||
MSImmutableInferredGroupLayout: InferredGroupLayout; | ||
MSImmutableHotspotLayer: Hotspot; | ||
MSImmutableGradientAsset: GradientAsset; | ||
MSImmutableFreeformGroupLayout: FreeformGroupLayout; | ||
MSImmutableForeignTextStyle: ForeignTextStyle; | ||
MSImmutableForeignSymbol: ForeignSymbol; | ||
MSImmutableForeignLayerStyle: ForeignLayerStyle; | ||
MSImmutableFlowConnection: FlowConnection; | ||
MSImmutableColorAsset: ColorAsset; | ||
}; |
@@ -14,3 +14,3 @@ /** | ||
gradientAssets: GradientAsset[]; | ||
images: (ImageFileRef | ImageDataRef)[]; | ||
images: (FileRef | DataRef)[]; | ||
colors: Color[]; | ||
@@ -45,2 +45,3 @@ gradients: Gradient[]; | ||
blue: UnitInterval; | ||
swatchID?: Uuid; | ||
}; | ||
@@ -93,15 +94,15 @@ /** | ||
/** | ||
* Defines a reference to an image file within the document bundle | ||
* Defines a reference to a file within the document bundle | ||
*/ | ||
export declare type ImageFileRef = { | ||
export declare type FileRef = { | ||
_class: 'MSJSONFileReference'; | ||
_ref_class: 'MSImageData'; | ||
_ref_class: 'MSImageData' | 'MSImmutablePage'; | ||
_ref: string; | ||
}; | ||
/** | ||
* Defines a reference to an image data within the document bundle | ||
* Defines inline base64 data | ||
*/ | ||
export declare type ImageDataRef = { | ||
export declare type DataRef = { | ||
_class: 'MSJSONOriginalDataReference'; | ||
_ref_class: 'MSImageData'; | ||
_ref_class: 'MSImageData' | 'MSFontData'; | ||
_ref: string; | ||
@@ -285,3 +286,3 @@ data: { | ||
gradient: Gradient; | ||
image?: ImageFileRef | ImageDataRef; | ||
image?: FileRef | DataRef; | ||
}; | ||
@@ -1086,3 +1087,3 @@ /** | ||
overrideName: OverrideName; | ||
value: string | Uuid | ImageFileRef | ImageDataRef; | ||
value: string | Uuid | FileRef | DataRef; | ||
}; | ||
@@ -1182,3 +1183,3 @@ /** | ||
fillReplacesImage: boolean; | ||
image: ImageFileRef | ImageDataRef; | ||
image: FileRef | DataRef; | ||
intendedDPI: number; | ||
@@ -1242,2 +1243,23 @@ clippingMask: PointListString; | ||
/** | ||
* Defines a swatch that has been imported from a library | ||
*/ | ||
export declare type ForeignSwatch = { | ||
_class: 'MSImmutableForeignSwatch'; | ||
do_objectID: Uuid; | ||
libraryID: Uuid; | ||
sourceLibraryName: string; | ||
symbolPrivate: boolean; | ||
remoteSwatchID: Uuid; | ||
localSwatch: Swatch; | ||
}; | ||
/** | ||
* Defines a swatch color variable. | ||
*/ | ||
export declare type Swatch = { | ||
_class: 'swatch'; | ||
do_objectID: Uuid; | ||
name: string; | ||
value: Color; | ||
}; | ||
/** | ||
* Defines a document's list of reusable styles | ||
@@ -1264,34 +1286,20 @@ */ | ||
/** | ||
* Defines font data embedded in the document | ||
* Defines a document's list of swatches | ||
*/ | ||
export declare type EmbeddedFontRef = { | ||
_class: 'embeddedFontReference'; | ||
embeddedFontData: FontDataRef; | ||
fontFamilyName: string; | ||
fontFileType: string; | ||
embedded: boolean; | ||
export declare type SwatchContainer = { | ||
_class: 'swatchContainer'; | ||
objects: Swatch[]; | ||
}; | ||
/** | ||
* Defines a reference to base64 font data within the document bundle | ||
* Defines a reference to font data embedded in the document | ||
*/ | ||
export declare type FontDataRef = { | ||
_class: 'MSJSONOriginalDataReference'; | ||
_ref_class: 'MSEmbeddedFontData'; | ||
_ref: string; | ||
data: { | ||
_data: string; | ||
}; | ||
sha1: { | ||
_data: string; | ||
}; | ||
export declare type FontRef = { | ||
_class: 'fontReference'; | ||
fontData: DataRef; | ||
fontFamilyName: string; | ||
fontFileName: string; | ||
options: number; | ||
postscriptNames: string[]; | ||
}; | ||
/** | ||
* Defines a reference to a JSON page file within the document bundle | ||
*/ | ||
export declare type PageFileRef = { | ||
_class: 'MSJSONFileReference'; | ||
_ref_class: 'MSImmutablePage'; | ||
_ref: string; | ||
}; | ||
/** | ||
* Page layers are the top level organisational abstraction within a document | ||
@@ -1348,3 +1356,3 @@ */ | ||
}; | ||
version: 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129; | ||
version: 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130; | ||
fonts: string[]; | ||
@@ -1401,2 +1409,30 @@ compatibilityVersion: 99; | ||
/** | ||
* The workspace is a folder in the Sketch file archive that can contain arbitrary JSON files, allowing Sketch and 3rd party products and tools to store settings that should travel with the Sketch document. To avoid clashes or settings being overridden, select a unique name for your workspace file. A workspace file named `assistants` has been reserved for Sketch Assistant settings, and is specified below. Note that custom layer-level data should continue to be stored in `userInfo` of these objects, not within the workspace. | ||
*/ | ||
export declare type Workspace = { | ||
assistants: AssistantsWorkspace; | ||
[key: string]: any; | ||
}; | ||
/** | ||
* Contains Assistant configuration that travels with the document in the file workspace. Maintains a record of which Assistants have been installed to the document and where they've been installed from in the `dependencies` field. Additionally Assistant metadata from their package.json files are cached in the `dependencyMetadata` field. | ||
*/ | ||
export declare type AssistantsWorkspace = { | ||
dependencies: { | ||
[key: string]: string; | ||
}; | ||
dependencyMetadata: { | ||
[key: string]: { | ||
sketch: string; | ||
homepage: string; | ||
name: string; | ||
version: string; | ||
'sketch-assistants': { | ||
title: string; | ||
icon: string; | ||
description: string; | ||
}; | ||
}; | ||
}; | ||
}; | ||
/** | ||
* This schema describes a representation of an expanded Sketch file, that is, a Sketch file that has been unzipped, all of its entries parsed to JSON and merged into a single object. A concrete example of an expanded sketch file is the return value of the `fromFile` function | ||
@@ -1414,6 +1450,8 @@ */ | ||
foreignTextStyles: ForeignTextStyle[]; | ||
foreignSwatches?: ForeignSwatch[]; | ||
layerStyles: SharedStyleContainer; | ||
layerTextStyles: SharedTextStyleContainer; | ||
layerSymbols?: SymbolContainer; | ||
embeddedFontReferences?: EmbeddedFontRef[]; | ||
sharedSwatches?: SwatchContainer; | ||
fontReferences?: FontRef[]; | ||
autoEmbedFonts?: boolean; | ||
@@ -1425,2 +1463,3 @@ agreedToFontEmbedding?: boolean; | ||
user: User; | ||
workspace?: Workspace; | ||
}; | ||
@@ -1439,9 +1478,11 @@ /** | ||
foreignTextStyles: ForeignTextStyle[]; | ||
foreignSwatches?: ForeignSwatch[]; | ||
layerStyles: SharedStyleContainer; | ||
layerTextStyles: SharedTextStyleContainer; | ||
layerSymbols?: SymbolContainer; | ||
embeddedFontReferences?: EmbeddedFontRef[]; | ||
sharedSwatches?: SwatchContainer; | ||
fontReferences?: FontRef[]; | ||
autoEmbedFonts?: boolean; | ||
agreedToFontEmbedding?: boolean; | ||
pages: PageFileRef[]; | ||
pages: FileRef[]; | ||
}; | ||
@@ -1459,3 +1500,3 @@ /** | ||
*/ | ||
export declare type AnyObject = AssetCollection | ImageCollection | ColorAsset | Color | GradientAsset | Gradient | GradientStop | ImageFileRef | ImageDataRef | ForeignLayerStyle | SharedStyle | Style | Border | GraphicsContextSettings | BorderOptions | Blur | Fill | TextStyle | ParagraphStyle | FontDescriptor | Shadow | InnerShadow | ColorControls | ForeignSymbol | SymbolMaster | ExportOptions | ExportFormat | Rect | FlowConnection | FreeformGroupLayout | InferredGroupLayout | Artboard | Group | Oval | CurvePoint | Polygon | Rectangle | ShapePath | Star | Triangle | ShapeGroup | Text | AttributedString | StringAttribute | SymbolInstance | OverrideValue | Slice | Hotspot | Bitmap | RulerData | LayoutGrid | SimpleGrid | OverrideProperty | ForeignTextStyle | SharedStyleContainer | SharedTextStyleContainer | SymbolContainer | EmbeddedFontRef | FontDataRef | PageFileRef | Page; | ||
export declare type AnyObject = AssetCollection | ImageCollection | ColorAsset | Color | GradientAsset | Gradient | GradientStop | FileRef | DataRef | ForeignLayerStyle | SharedStyle | Style | Border | GraphicsContextSettings | BorderOptions | Blur | Fill | TextStyle | ParagraphStyle | FontDescriptor | Shadow | InnerShadow | ColorControls | ForeignSymbol | SymbolMaster | ExportOptions | ExportFormat | Rect | FlowConnection | FreeformGroupLayout | InferredGroupLayout | Artboard | Group | Oval | CurvePoint | Polygon | Rectangle | ShapePath | Star | Triangle | ShapeGroup | Text | AttributedString | StringAttribute | SymbolInstance | OverrideValue | Slice | Hotspot | Bitmap | RulerData | LayoutGrid | SimpleGrid | OverrideProperty | ForeignTextStyle | ForeignSwatch | Swatch | SharedStyleContainer | SharedTextStyleContainer | SymbolContainer | SwatchContainer | FontRef | Page; | ||
/** | ||
@@ -1468,2 +1509,3 @@ * Enum of all possible _class property values | ||
MSImmutableForeignLayerStyle = "MSImmutableForeignLayerStyle", | ||
MSImmutableForeignSwatch = "MSImmutableForeignSwatch", | ||
MSImmutableForeignSymbol = "MSImmutableForeignSymbol", | ||
@@ -1488,3 +1530,2 @@ MSImmutableForeignTextStyle = "MSImmutableForeignTextStyle", | ||
CurvePoint = "curvePoint", | ||
EmbeddedFontReference = "embeddedFontReference", | ||
ExportFormat = "exportFormat", | ||
@@ -1494,2 +1535,3 @@ ExportOptions = "exportOptions", | ||
FontDescriptor = "fontDescriptor", | ||
FontReference = "fontReference", | ||
Gradient = "gradient", | ||
@@ -1521,2 +1563,4 @@ GradientStop = "gradientStop", | ||
Style = "style", | ||
Swatch = "swatch", | ||
SwatchContainer = "swatchContainer", | ||
SymbolContainer = "symbolContainer", | ||
@@ -1529,1 +1573,68 @@ SymbolInstance = "symbolInstance", | ||
} | ||
/** | ||
* A mapping of class values to object types | ||
*/ | ||
export declare type ClassMap = { | ||
triangle: Triangle; | ||
textStyle: TextStyle; | ||
text: Text; | ||
symbolMaster: SymbolMaster; | ||
symbolInstance: SymbolInstance; | ||
symbolContainer: SymbolContainer; | ||
swatchContainer: SwatchContainer; | ||
swatch: Swatch; | ||
style: Style; | ||
stringAttribute: StringAttribute; | ||
star: Star; | ||
slice: Slice; | ||
simpleGrid: SimpleGrid; | ||
sharedTextStyleContainer: SharedTextStyleContainer; | ||
sharedStyleContainer: SharedStyleContainer; | ||
sharedStyle: SharedStyle; | ||
shapePath: ShapePath; | ||
shapeGroup: ShapeGroup; | ||
shadow: Shadow; | ||
rulerData: RulerData; | ||
rectangle: Rectangle; | ||
rect: Rect; | ||
polygon: Polygon; | ||
paragraphStyle: ParagraphStyle; | ||
page: Page; | ||
overrideValue: OverrideValue; | ||
oval: Oval; | ||
layoutGrid: LayoutGrid; | ||
innerShadow: InnerShadow; | ||
imageCollection: ImageCollection; | ||
group: Group; | ||
graphicsContextSettings: GraphicsContextSettings; | ||
gradientStop: GradientStop; | ||
gradient: Gradient; | ||
fontReference: FontRef; | ||
fontDescriptor: FontDescriptor; | ||
fill: Fill; | ||
exportOptions: ExportOptions; | ||
exportFormat: ExportFormat; | ||
curvePoint: CurvePoint; | ||
colorControls: ColorControls; | ||
color: Color; | ||
borderOptions: BorderOptions; | ||
border: Border; | ||
blur: Blur; | ||
bitmap: Bitmap; | ||
attributedString: AttributedString; | ||
assetCollection: AssetCollection; | ||
artboard: Artboard; | ||
MSJSONOriginalDataReference: DataRef; | ||
MSJSONFileReference: FileRef; | ||
MSImmutableOverrideProperty: OverrideProperty; | ||
MSImmutableInferredGroupLayout: InferredGroupLayout; | ||
MSImmutableHotspotLayer: Hotspot; | ||
MSImmutableGradientAsset: GradientAsset; | ||
MSImmutableFreeformGroupLayout: FreeformGroupLayout; | ||
MSImmutableForeignTextStyle: ForeignTextStyle; | ||
MSImmutableForeignSymbol: ForeignSymbol; | ||
MSImmutableForeignSwatch: ForeignSwatch; | ||
MSImmutableForeignLayerStyle: ForeignLayerStyle; | ||
MSImmutableFlowConnection: FlowConnection; | ||
MSImmutableColorAsset: ColorAsset; | ||
}; |
@@ -314,2 +314,3 @@ "use strict"; | ||
ClassValue["MSImmutableForeignLayerStyle"] = "MSImmutableForeignLayerStyle"; | ||
ClassValue["MSImmutableForeignSwatch"] = "MSImmutableForeignSwatch"; | ||
ClassValue["MSImmutableForeignSymbol"] = "MSImmutableForeignSymbol"; | ||
@@ -334,3 +335,2 @@ ClassValue["MSImmutableForeignTextStyle"] = "MSImmutableForeignTextStyle"; | ||
ClassValue["CurvePoint"] = "curvePoint"; | ||
ClassValue["EmbeddedFontReference"] = "embeddedFontReference"; | ||
ClassValue["ExportFormat"] = "exportFormat"; | ||
@@ -340,2 +340,3 @@ ClassValue["ExportOptions"] = "exportOptions"; | ||
ClassValue["FontDescriptor"] = "fontDescriptor"; | ||
ClassValue["FontReference"] = "fontReference"; | ||
ClassValue["Gradient"] = "gradient"; | ||
@@ -367,2 +368,4 @@ ClassValue["GradientStop"] = "gradientStop"; | ||
ClassValue["Style"] = "style"; | ||
ClassValue["Swatch"] = "swatch"; | ||
ClassValue["SwatchContainer"] = "swatchContainer"; | ||
ClassValue["SymbolContainer"] = "symbolContainer"; | ||
@@ -369,0 +372,0 @@ ClassValue["SymbolInstance"] = "symbolInstance"; |
{ | ||
"name": "@sketch-hq/sketch-file-format-ts", | ||
"description": "TypeScript types for the Sketch File Format", | ||
"version": "4.0.5", | ||
"version": "5.0.0", | ||
"main": "dist/index", | ||
@@ -22,3 +22,3 @@ "types": "dist/index", | ||
"@sketch-hq/sketch-file-format-2": "npm:@sketch-hq/sketch-file-format@2.0.3", | ||
"@sketch-hq/sketch-file-format-3": "npm:@sketch-hq/sketch-file-format@3.5.5", | ||
"@sketch-hq/sketch-file-format-3": "npm:@sketch-hq/sketch-file-format@3.6.1", | ||
"@types/humps": "1.1.3", | ||
@@ -25,0 +25,0 @@ "@types/jest": "25.2.1", |
183864
5754