From aff04fff7e682fc2c2deb6c129270002e3d412cd Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 26 Jul 2022 22:08:32 +0000 Subject: [PATCH] fix: add type information to blockly options (#6283) * fix: add type information to blockly options * chore: format * chore: remove erroneous comment --- core/blockly_options.ts | 61 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/core/blockly_options.ts b/core/blockly_options.ts index 775669f92..e7d718e77 100644 --- a/core/blockly_options.ts +++ b/core/blockly_options.ts @@ -15,11 +15,66 @@ import * as goog from '../closure/goog/goog.js'; goog.declareModuleId('Blockly.BlocklyOptions'); +import {Theme} from './theme.js'; +import {Workspace} from './workspace.js'; + /** * Blockly options. - * This interface is further described in - * `typings/parts/blockly-interfaces.d.ts`. * @alias Blockly.BlocklyOptions */ -export interface BlocklyOptions {} +export interface BlocklyOptions { + collapse?: boolean; + comments?: boolean; + cs?: boolean; + disable?: boolean; + grid?: GridOptions; + horizontalLayout?: boolean; + maxBlocks?: number; + maxInstances?: {[blockType: string]: number}; + media?: string; + move?: MoveOptions; + oneBasedIndex?: boolean; + readOnly?: boolean; + renderer?: string; + rendererOverrides?: {[rendererConstant: string]: any}; + rtl?: boolean; + scrollbars?: ScrollbarOptions|boolean; + sounds?: boolean; + theme?: Theme; + toolbox?: string|object|Element; + toolboxPosition?: string; + trashcan?: boolean; + maxTrashcanContents?: boolean; + plugins?: object; + zoom?: ZoomOptions; + parentWorkspace?: Workspace; +} + +export interface GridOptions { + colour?: string; + length?: number; + snap?: boolean; + spacing?: number; +} + +export interface MoveOptions { + drag?: boolean; + scrollbars?: boolean|ScrollbarOptions; + wheel?: boolean; +} + +export interface ScrollbarOptions { + horizontal?: boolean; + vertical?: boolean; +} + +export interface ZoomOptions { + controls?: boolean; + maxScale?: number; + minScale?: number; + pinch?: boolean; + scaleSpeed?: number; + startScale?: number; + wheel?: boolean; +}