Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add type information to blockly options #6283

Merged
merged 3 commits into from
Jul 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 58 additions & 3 deletions core/blockly_options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}