pxt-core
Version:
Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors
36 lines (35 loc) • 1.82 kB
TypeScript
/// <reference path="../pxtlib.d.ts" />
import * as Blockly from "blockly";
export interface FlowOptions {
ratio?: number;
useViewWidth?: boolean;
}
export declare function patchBlocksFromOldWorkspace(blockInfo: ts.pxtc.BlocksInfo, oldWs: Blockly.Workspace, newXml: string): string;
/**
* Splits a blockly SVG AFTER a vertical layout. This function relies on the ordering
* of blocks / comments to get as getTopBlock(true)/getTopComment(true)
*/
export declare function splitSvg(svg: SVGSVGElement, ws: Blockly.WorkspaceSvg, emPixels?: number): Element;
export declare function verticalAlign(ws: Blockly.WorkspaceSvg, emPixels: number): void;
export declare function setCollapsedAll(ws: Blockly.WorkspaceSvg, collapsed: boolean): void;
export declare function flow(ws: Blockly.WorkspaceSvg, opts?: FlowOptions): void;
export declare function screenshotEnabled(): boolean;
export declare function screenshotAsync(ws: Blockly.WorkspaceSvg, pixelDensity?: number, encodeBlocks?: boolean): Promise<string>;
export declare function toPngAsync(ws: Blockly.WorkspaceSvg, pixelDensity?: number, encodeBlocks?: boolean): Promise<string>;
export declare function toSvgAsync(ws: Blockly.WorkspaceSvg, pixelDensity: number): Promise<{
width: number;
height: number;
xml: string;
}>;
export declare function serializeNode(sg: Node): string;
export declare function serializeSvgString(xmlString: string): string;
export interface BlockSvg {
width: number;
height: number;
svg: string;
xml: string;
css: string;
}
export declare function cleanUpBlocklySvg(svg: SVGElement): SVGElement;
export declare function blocklyToSvgAsync(sg: SVGElement, x: number, y: number, width: number, height: number, scale?: number): Promise<BlockSvg>;
export declare function documentToSvg(xsg: Node): string;