blockly 10.2.1 → 10.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +52 -51
- package/blockly_compressed.js +51 -50
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +1 -1
- package/blocks_compressed.js.map +1 -1
- package/core/generator.d.ts +19 -5
- package/core/renderers/common/info.d.ts +4 -4
- package/core/renderers/zelos/info.d.ts +1 -1
- package/package.json +1 -1
package/core/generator.d.ts
CHANGED
|
@@ -13,8 +13,10 @@ import type { Block } from './block.js';
|
|
|
13
13
|
import { Names } from './names.js';
|
|
14
14
|
import type { Workspace } from './workspace.js';
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Deprecated, no-longer used type declaration for per-block-type generator
|
|
17
|
+
* functions.
|
|
17
18
|
*
|
|
19
|
+
* @deprecated
|
|
18
20
|
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/generating-code}
|
|
19
21
|
* @param block The Block instance to generate code for.
|
|
20
22
|
* @param genearator The CodeGenerator calling the function.
|
|
@@ -28,10 +30,22 @@ export type BlockGenerator = (block: Block, generator: CodeGenerator) => [string
|
|
|
28
30
|
*/
|
|
29
31
|
export declare class CodeGenerator {
|
|
30
32
|
name_: string;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/**
|
|
34
|
+
* A dictionary of block generator functions, keyed by block type.
|
|
35
|
+
* Each block generator function takes two parameters:
|
|
36
|
+
*
|
|
37
|
+
* - the Block to generate code for, and
|
|
38
|
+
* - the calling CodeGenerator (or subclass) instance, so the
|
|
39
|
+
* function can call methods defined below (e.g. blockToCode) or
|
|
40
|
+
* on the relevant subclass (e.g. JavascripGenerator),
|
|
41
|
+
*
|
|
42
|
+
* and returns:
|
|
43
|
+
*
|
|
44
|
+
* - a [code, precedence] tuple (for value/expression blocks), or
|
|
45
|
+
* - a string containing the generated code (for statement blocks), or
|
|
46
|
+
* - null if no code should be emitted for block.
|
|
47
|
+
*/
|
|
48
|
+
forBlock: Record<string, (block: Block, generator: this) => [string, number] | string | null>;
|
|
35
49
|
/**
|
|
36
50
|
* This is used as a placeholder in functions defined using
|
|
37
51
|
* CodeGenerator.provideFunction_. It must not be legal code that could
|
|
@@ -93,11 +93,11 @@ export declare class RenderInfo {
|
|
|
93
93
|
/**
|
|
94
94
|
* Decide whether to start a new row between the two Blockly.Inputs.
|
|
95
95
|
*
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
98
|
-
* @returns True if the
|
|
96
|
+
* @param currInput The current input.
|
|
97
|
+
* @param prevInput The previous input.
|
|
98
|
+
* @returns True if the current input should be rendered on a new row.
|
|
99
99
|
*/
|
|
100
|
-
protected shouldStartNewRow_(
|
|
100
|
+
protected shouldStartNewRow_(currInput: Input, prevInput?: Input): boolean;
|
|
101
101
|
/** Add horizontal spacing between and around elements within each row. */
|
|
102
102
|
protected addElemSpacing_(): void;
|
|
103
103
|
/**
|
|
@@ -42,7 +42,7 @@ export declare class RenderInfo extends BaseRenderInfo {
|
|
|
42
42
|
*/
|
|
43
43
|
getRenderer(): Renderer;
|
|
44
44
|
measure(): void;
|
|
45
|
-
shouldStartNewRow_(
|
|
45
|
+
shouldStartNewRow_(currInput: Input, prevInput: Input): boolean;
|
|
46
46
|
getDesiredRowWidth_(row: Row): number;
|
|
47
47
|
getInRowSpacing_(prev: Measurable | null, next: Measurable | null): number;
|
|
48
48
|
getSpacerRowHeight_(prev: Row, next: Row): number;
|