blockly 11.0.0-beta.4 → 11.0.0-beta.5

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.
Files changed (101) hide show
  1. package/blockly.js +22 -0
  2. package/blockly.min.js +572 -508
  3. package/blockly_compressed.js +494 -467
  4. package/blockly_compressed.js.map +1 -1
  5. package/blocks.js +22 -0
  6. package/blocks_compressed.js +29 -27
  7. package/blocks_compressed.js.map +1 -1
  8. package/browser.js +30 -0
  9. package/core/block.d.ts +3 -10
  10. package/core/block_dragger.d.ts +10 -10
  11. package/core/block_svg.d.ts +32 -5
  12. package/core/blockly.d.ts +38 -3
  13. package/core/clipboard.d.ts +19 -0
  14. package/core/{insertion_marker_previewer.d.ts → connection_previewers/insertion_marker_previewer.d.ts} +3 -3
  15. package/core/events/events_click.d.ts +1 -1
  16. package/core/field_angle.d.ts +208 -0
  17. package/core/field_colour.d.ts +243 -0
  18. package/core/field_dropdown.d.ts +0 -1
  19. package/core/field_image.d.ts +1 -1
  20. package/core/field_multilineinput.d.ts +182 -0
  21. package/core/generator.d.ts +1 -1
  22. package/core/gesture.d.ts +0 -2
  23. package/core/grid.d.ts +9 -9
  24. package/core/icons/comment_icon.d.ts +3 -3
  25. package/core/icons/icon.d.ts +6 -0
  26. package/core/icons/icon_types.d.ts +2 -2
  27. package/core/icons/mutator_icon.d.ts +16 -1
  28. package/core/icons/warning_icon.d.ts +1 -1
  29. package/core/inputs/input.d.ts +19 -10
  30. package/core/interfaces/i_has_bubble.d.ts +1 -1
  31. package/core/interfaces/i_parameter_model.d.ts +0 -7
  32. package/core/interfaces/i_procedure_model.d.ts +0 -7
  33. package/core/options.d.ts +0 -1
  34. package/core/renderers/common/drawer.d.ts +7 -0
  35. package/core/renderers/measurables/icon.d.ts +5 -0
  36. package/core/renderers/minimalist/constants.d.ts +21 -0
  37. package/core/renderers/minimalist/drawer.d.ts +26 -0
  38. package/core/renderers/minimalist/info.d.ts +35 -0
  39. package/core/renderers/minimalist/minimalist.d.ts +12 -0
  40. package/core/renderers/minimalist/renderer.d.ts +48 -0
  41. package/core/serialization/procedures.d.ts +26 -28
  42. package/core/utils/dom.d.ts +9 -0
  43. package/core/utils/keycodes.d.ts +32 -32
  44. package/core/utils/size.d.ts +0 -10
  45. package/core/utils/string.d.ts +10 -0
  46. package/core/workspace_svg.d.ts +27 -0
  47. package/core-browser.js +26 -0
  48. package/core.js +26 -0
  49. package/dart.d.ts +24 -1
  50. package/dart.js +22 -0
  51. package/dart_compressed.js +68 -18
  52. package/dart_compressed.js.map +1 -1
  53. package/generators/dart/colour.d.ts +16 -0
  54. package/generators/dart/dart_generator.d.ts +17 -17
  55. package/generators/dart/text.d.ts +1 -0
  56. package/generators/javascript/colour.d.ts +16 -0
  57. package/generators/javascript/javascript_generator.d.ts +35 -34
  58. package/generators/javascript/text.d.ts +1 -0
  59. package/generators/lua/colour.d.ts +16 -0
  60. package/generators/lua/lua_generator.d.ts +10 -10
  61. package/generators/lua/text.d.ts +1 -0
  62. package/generators/php/colour.d.ts +16 -0
  63. package/generators/php/php_generator.d.ts +36 -36
  64. package/generators/php/text.d.ts +1 -0
  65. package/generators/python/colour.d.ts +16 -0
  66. package/generators/python/python_generator.d.ts +21 -20
  67. package/generators/python/text.d.ts +1 -0
  68. package/index.js +7 -19
  69. package/javascript.d.ts +41 -1
  70. package/javascript.js +23 -0
  71. package/javascript_compressed.js +49 -14
  72. package/javascript_compressed.js.map +1 -1
  73. package/lua.d.ts +18 -1
  74. package/lua.js +22 -0
  75. package/lua_compressed.js +40 -18
  76. package/lua_compressed.js.map +1 -1
  77. package/msg/constants.d.ts +14 -0
  78. package/msg/msg.d.ts +440 -0
  79. package/msg/qqq.d.ts +14 -0
  80. package/msg/synonyms.d.ts +14 -0
  81. package/node.js +21 -0
  82. package/package.json +11 -45
  83. package/php.d.ts +43 -1
  84. package/php.js +22 -0
  85. package/php_compressed.js +43 -10
  86. package/php_compressed.js.map +1 -1
  87. package/python.d.ts +27 -1
  88. package/python.js +23 -0
  89. package/python_compressed.js +37 -18
  90. package/python_compressed.js.map +1 -1
  91. package/core/comments/comment_view.d.ts +0 -200
  92. package/core/comments/workspace_comment.d.ts +0 -94
  93. package/core/comments.d.ts +0 -8
  94. package/core/interfaces/i_comment_icon.d.ts +0 -17
  95. package/core-node.js +0 -31
  96. package/media/arrow-dropdown.svg +0 -1
  97. package/media/resize-handle.svg +0 -3
  98. package/msg/ce.d.ts +0 -8
  99. package/msg/dtp.d.ts +0 -8
  100. package/msg/hsb.d.ts +0 -8
  101. package/msg/tdd.d.ts +0 -8
@@ -3,7 +3,6 @@
3
3
  * Copyright 2022 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { ParameterState } from '../serialization/procedures';
7
6
  import { IProcedureModel } from './i_procedure_model';
8
7
  /**
9
8
  * A data model for a procedure.
@@ -34,11 +33,5 @@ export interface IParameterModel {
34
33
  getId(): string;
35
34
  /** Sets the procedure model this parameter is associated with. */
36
35
  setProcedureModel(model: IProcedureModel): this;
37
- /**
38
- * Serializes the state of the parameter to JSON.
39
- *
40
- * @returns JSON serializable state of the parameter.
41
- */
42
- saveState(): ParameterState;
43
36
  }
44
37
  //# sourceMappingURL=i_parameter_model.d.ts.map
@@ -3,7 +3,6 @@
3
3
  * Copyright 2022 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { State } from '../serialization/procedures.js';
7
6
  import { IParameterModel } from './i_parameter_model.js';
8
7
  /**
9
8
  * A data model for a procedure.
@@ -49,11 +48,5 @@ export interface IProcedureModel {
49
48
  * disabled, all procedure caller blocks should be disabled as well.
50
49
  */
51
50
  getEnabled(): boolean;
52
- /**
53
- * Serializes the state of the procedure to JSON.
54
- *
55
- * @returns JSON serializable state of the procedure.
56
- */
57
- saveState(): State;
58
51
  }
59
52
  //# sourceMappingURL=i_procedure_model.d.ts.map
package/core/options.d.ts CHANGED
@@ -32,7 +32,6 @@ export declare class Options {
32
32
  pathToMedia: string;
33
33
  hasCategories: boolean;
34
34
  moveOptions: MoveOptions;
35
- /** @deprecated January 2019 */
36
35
  hasScrollbars: boolean;
37
36
  hasTrashcan: boolean;
38
37
  maxTrashcanContents: number;
@@ -38,6 +38,13 @@ export declare class Drawer {
38
38
  * required.
39
39
  */
40
40
  draw(): void;
41
+ /**
42
+ * Hide icons that were marked as hidden.
43
+ *
44
+ * @deprecated Manually hiding icons is no longer necessary. To be removed
45
+ * in v11.
46
+ */
47
+ protected hideHiddenIcons_(): void;
41
48
  /**
42
49
  * Save sizing information back to the block
43
50
  * Most of the rendering information can be thrown away at the end of the
@@ -12,6 +12,11 @@ import { Measurable } from './base.js';
12
12
  */
13
13
  export declare class Icon extends Measurable {
14
14
  icon: BlocklyIcon;
15
+ /**
16
+ * @deprecated Will be removed in v11. Create a subclass of the Icon
17
+ * measurable if this data is necessary for you.
18
+ */
19
+ isVisible: boolean;
15
20
  flipRtl: boolean;
16
21
  /**
17
22
  * An object containing information about the space an icon takes up during
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ConstantProvider as BaseConstantProvider } from '../common/constants.js';
7
+ /**
8
+ * An object that provides constants for rendering blocks in the minimalist
9
+ * renderer.
10
+ *
11
+ * @deprecated Use Blockly.blockRendering.ConstantProvider instead.
12
+ * To be removed in v11.
13
+ */
14
+ export declare class ConstantProvider extends BaseConstantProvider {
15
+ /**
16
+ * @deprecated Use Blockly.blockRendering.ConstantProvider instead.
17
+ * To be removed in v11.
18
+ */
19
+ constructor();
20
+ }
21
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from '../../block_svg.js';
7
+ import { Drawer as BaseDrawer } from '../common/drawer.js';
8
+ import type { RenderInfo } from './info.js';
9
+ /**
10
+ * An object that draws a block based on the given rendering information.
11
+ *
12
+ * @deprecated Use Blockly.blockRendering.Drawer instead.
13
+ * To be removed in v11.
14
+ */
15
+ export declare class Drawer extends BaseDrawer {
16
+ /**
17
+ * @param block The block to render.
18
+ * @param info An object containing all information needed to render this
19
+ * block.
20
+ *
21
+ * @deprecated Use Blockly.blockRendering.Drawer instead.
22
+ * To be removed in v11.
23
+ */
24
+ constructor(block: BlockSvg, info: RenderInfo);
25
+ }
26
+ //# sourceMappingURL=drawer.d.ts.map
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from '../../block_svg.js';
7
+ import { RenderInfo as BaseRenderInfo } from '../common/info.js';
8
+ import type { Renderer } from './renderer.js';
9
+ /**
10
+ * An object containing all sizing information needed to draw this block.
11
+ *
12
+ * This measure pass does not propagate changes to the block (although fields
13
+ * may choose to rerender when getSize() is called). However, calling it
14
+ * repeatedly may be expensive.
15
+ *
16
+ * @deprecated Use Blockly.blockRendering.RenderInfo instead. To be removed
17
+ * in v11.
18
+ */
19
+ export declare class RenderInfo extends BaseRenderInfo {
20
+ protected renderer_: Renderer;
21
+ /**
22
+ * @param renderer The renderer in use.
23
+ * @param block The block to measure.
24
+ * @deprecated Use Blockly.blockRendering.RenderInfo instead. To be removed
25
+ * in v11.
26
+ */
27
+ constructor(renderer: Renderer, block: BlockSvg);
28
+ /**
29
+ * Get the block renderer in use.
30
+ *
31
+ * @returns The block renderer in use.
32
+ */
33
+ getRenderer(): Renderer;
34
+ }
35
+ //# sourceMappingURL=info.d.ts.map
@@ -0,0 +1,12 @@
1
+ /** @file Re-exports of Blockly.minimalist.* modules. */
2
+ /**
3
+ * @license
4
+ * Copyright 2021 Google LLC
5
+ * SPDX-License-Identifier: Apache-2.0
6
+ */
7
+ import { ConstantProvider } from './constants.js';
8
+ import { Drawer } from './drawer.js';
9
+ import { RenderInfo } from './info.js';
10
+ import { Renderer } from './renderer.js';
11
+ export { ConstantProvider, Drawer, Renderer, RenderInfo };
12
+ //# sourceMappingURL=minimalist.d.ts.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { BlockSvg } from '../../block_svg.js';
7
+ import type { RenderInfo as BaseRenderInfo } from '../common/info.js';
8
+ import { Renderer as BaseRenderer } from '../common/renderer.js';
9
+ import { ConstantProvider } from './constants.js';
10
+ import { Drawer } from './drawer.js';
11
+ import { RenderInfo } from './info.js';
12
+ /**
13
+ * The minimalist renderer.
14
+ *
15
+ * @deprecated Use Blockly.blockRendering.Renderer instead. To be removed
16
+ * in v11.
17
+ */
18
+ export declare class Renderer extends BaseRenderer {
19
+ /**
20
+ * @param name The renderer name.
21
+ * @deprecated Use Blockly.blockRendering.Renderer instead. To be removed
22
+ * in v11.
23
+ */
24
+ constructor(name: string);
25
+ /**
26
+ * Create a new instance of the renderer's constant provider.
27
+ *
28
+ * @returns The constant provider.
29
+ */
30
+ protected makeConstants_(): ConstantProvider;
31
+ /**
32
+ * Create a new instance of the renderer's render info object.
33
+ *
34
+ * @param block The block to measure.
35
+ * @returns The render info object.
36
+ */
37
+ protected makeRenderInfo_(block: BlockSvg): RenderInfo;
38
+ /**
39
+ * Create a new instance of the renderer's drawer.
40
+ *
41
+ * @param block The block to render.
42
+ * @param info An object containing all information needed to render this
43
+ * block.
44
+ * @returns The drawer.
45
+ */
46
+ protected makeDrawer_(block: BlockSvg, info: BaseRenderInfo): Drawer;
47
+ }
48
+ //# sourceMappingURL=renderer.d.ts.map
@@ -7,65 +7,63 @@ import { IParameterModel } from '../interfaces/i_parameter_model.js';
7
7
  import { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
8
  import type { ISerializer } from '../interfaces/i_serializer.js';
9
9
  import type { Workspace } from '../workspace.js';
10
- /** Represents the state of a procedure model. */
10
+ /**
11
+ * Representation of a procedure data model.
12
+ */
11
13
  export interface State {
12
14
  id: string;
13
15
  name: string;
14
16
  returnTypes: string[] | null;
15
17
  parameters?: ParameterState[];
16
- [key: string]: unknown;
17
18
  }
18
- /** Represents the state of a parameter model. */
19
+ /**
20
+ * Representation of a parameter data model.
21
+ */
19
22
  export interface ParameterState {
20
23
  id: string;
21
24
  name: string;
22
25
  types?: string[];
23
- [key: string]: unknown;
24
26
  }
25
27
  /**
26
28
  * A newable signature for an IProcedureModel.
27
29
  *
28
30
  * Refer to
29
- * https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
31
+ * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics
30
32
  * for what is going on with this.
31
33
  */
32
- interface ProcedureModelConstructor<ProcedureModel extends IProcedureModel> {
33
- new (workspace: Workspace, name: string, id: string): ProcedureModel;
34
- /**
35
- * Deserializes the JSON state and returns a procedure model.
36
- *
37
- * @param state The state to deserialize.
38
- * @param workspace The workspace to load the procedure model into.
39
- * @returns The constructed procedure model.
40
- */
41
- loadState(state: Object, workspace: Workspace): ProcedureModel;
42
- }
34
+ type ProcedureModelConstructor<ProcedureModel extends IProcedureModel> = new (workspace: Workspace, name: string, id: string) => ProcedureModel;
43
35
  /**
44
36
  * A newable signature for an IParameterModel.
45
37
  *
46
38
  * Refer to
47
- * https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
39
+ * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics
48
40
  * for what is going on with this.
49
41
  */
50
- interface ParameterModelConstructor<ParameterModel extends IParameterModel> {
51
- new (workspace: Workspace, name: string, id: string): ParameterModel;
52
- /**
53
- * Deserializes the JSON state and returns a parameter model.
54
- *
55
- * @param state The state to deserialize.
56
- * @param workspace The workspace to load the parameter model into.
57
- * @returns The constructed parameter model.
58
- */
59
- loadState(state: Object, workspace: Workspace): ParameterModel;
60
- }
42
+ type ParameterModelConstructor<ParameterModel extends IParameterModel> = new (workspace: Workspace, name: string, id: string) => ParameterModel;
61
43
  /**
62
44
  * Serializes the given IProcedureModel to JSON.
45
+ *
46
+ * @internal
63
47
  */
64
48
  export declare function saveProcedure(proc: IProcedureModel): State;
49
+ /**
50
+ * Serializes the given IParameterModel to JSON.
51
+ *
52
+ * @internal
53
+ */
54
+ export declare function saveParameter(param: IParameterModel): ParameterState;
65
55
  /**
66
56
  * Deserializes the given procedure model State from JSON.
57
+ *
58
+ * @internal
67
59
  */
68
60
  export declare function loadProcedure<ProcedureModel extends IProcedureModel, ParameterModel extends IParameterModel>(procedureModelClass: ProcedureModelConstructor<ProcedureModel>, parameterModelClass: ParameterModelConstructor<ParameterModel>, state: State, workspace: Workspace): ProcedureModel;
61
+ /**
62
+ * Deserializes the given ParameterState from JSON.
63
+ *
64
+ * @internal
65
+ */
66
+ export declare function loadParameter<ParameterModel extends IParameterModel>(parameterModelClass: ParameterModelConstructor<ParameterModel>, state: ParameterState, workspace: Workspace): ParameterModel;
69
67
  /** Serializer for saving and loading procedure state. */
70
68
  export declare class ProcedureSerializer<ProcedureModel extends IProcedureModel, ParameterModel extends IParameterModel> implements ISerializer {
71
69
  private readonly procedureModelClass;
@@ -86,6 +86,15 @@ export declare function removeNode(node: Node | null): Node | null;
86
86
  * @param refNode Existing element to precede new node.
87
87
  */
88
88
  export declare function insertAfter(newNode: Element, refNode: Element): void;
89
+ /**
90
+ * Whether a node contains another node.
91
+ *
92
+ * @param parent The node that should contain the other node.
93
+ * @param descendant The node to test presence of.
94
+ * @returns Whether the parent node contains the descendant node.
95
+ * @deprecated Use native 'contains' DOM method.
96
+ */
97
+ export declare function containsNode(parent: Node, descendant: Node): boolean;
89
98
  /**
90
99
  * Sets the CSS transform property on an element. This function sets the
91
100
  * non-vendor-prefixed and vendor-prefixed versions for backwards compatibility
@@ -16,7 +16,7 @@ export declare enum KeyCodes {
16
16
  MAC_ENTER = 3,
17
17
  BACKSPACE = 8,
18
18
  TAB = 9,
19
- NUM_CENTER = 12,// NUMLOCK on FF/Safari Mac
19
+ NUM_CENTER = 12,
20
20
  ENTER = 13,
21
21
  SHIFT = 16,
22
22
  CTRL = 17,
@@ -25,18 +25,18 @@ export declare enum KeyCodes {
25
25
  CAPS_LOCK = 20,
26
26
  ESC = 27,
27
27
  SPACE = 32,
28
- PAGE_UP = 33,// also NUM_NORTH_EAST
29
- PAGE_DOWN = 34,// also NUM_SOUTH_EAST
30
- END = 35,// also NUM_SOUTH_WEST
31
- HOME = 36,// also NUM_NORTH_WEST
32
- LEFT = 37,// also NUM_WEST
33
- UP = 38,// also NUM_NORTH
34
- RIGHT = 39,// also NUM_EAST
35
- DOWN = 40,// also NUM_SOUTH
36
- PLUS_SIGN = 43,// NOT numpad plus
28
+ PAGE_UP = 33,
29
+ PAGE_DOWN = 34,
30
+ END = 35,
31
+ HOME = 36,
32
+ LEFT = 37,
33
+ UP = 38,
34
+ RIGHT = 39,
35
+ DOWN = 40,
36
+ PLUS_SIGN = 43,
37
37
  PRINT_SCREEN = 44,
38
- INSERT = 45,// also NUM_INSERT
39
- DELETE = 46,// also NUM_DELETE
38
+ INSERT = 45,
39
+ DELETE = 46,
40
40
  ZERO = 48,
41
41
  ONE = 49,
42
42
  TWO = 50,
@@ -47,11 +47,11 @@ export declare enum KeyCodes {
47
47
  SEVEN = 55,
48
48
  EIGHT = 56,
49
49
  NINE = 57,
50
- FF_SEMICOLON = 59,// Firefox (Gecko) fires this for semicolon instead of 186
51
- FF_EQUALS = 61,// Firefox (Gecko) fires this for equals instead of 187
52
- FF_DASH = 173,// Firefox (Gecko) fires this for dash instead of 189
50
+ FF_SEMICOLON = 59,
51
+ FF_EQUALS = 61,
52
+ FF_DASH = 173,
53
53
  FF_HASH = 163,
54
- QUESTION_MARK = 63,// needs localization
54
+ QUESTION_MARK = 63,
55
55
  AT_SIGN = 64,
56
56
  A = 65,
57
57
  B = 66,
@@ -79,7 +79,7 @@ export declare enum KeyCodes {
79
79
  X = 88,
80
80
  Y = 89,
81
81
  Z = 90,
82
- META = 91,// WIN_KEY_LEFT
82
+ META = 91,
83
83
  WIN_KEY_RIGHT = 92,
84
84
  CONTEXT_MENU = 93,
85
85
  NUM_ZERO = 96,
@@ -113,22 +113,22 @@ export declare enum KeyCodes {
113
113
  SCROLL_LOCK = 145,
114
114
  FIRST_MEDIA_KEY = 166,
115
115
  LAST_MEDIA_KEY = 183,
116
- SEMICOLON = 186,// needs localization
117
- DASH = 189,// needs localization
118
- EQUALS = 187,// needs localization
119
- COMMA = 188,// needs localization
120
- PERIOD = 190,// needs localization
121
- SLASH = 191,// needs localization
122
- APOSTROPHE = 192,// needs localization
123
- TILDE = 192,// needs localization
124
- SINGLE_QUOTE = 222,// needs localization
125
- OPEN_SQUARE_BRACKET = 219,// needs localization
126
- BACKSLASH = 220,// needs localization
127
- CLOSE_SQUARE_BRACKET = 221,// needs localization
116
+ SEMICOLON = 186,
117
+ DASH = 189,
118
+ EQUALS = 187,
119
+ COMMA = 188,
120
+ PERIOD = 190,
121
+ SLASH = 191,
122
+ APOSTROPHE = 192,
123
+ TILDE = 192,
124
+ SINGLE_QUOTE = 222,
125
+ OPEN_SQUARE_BRACKET = 219,
126
+ BACKSLASH = 220,
127
+ CLOSE_SQUARE_BRACKET = 221,
128
128
  WIN_KEY = 224,
129
- MAC_FF_META = 224,// Firefox (Gecko) fires this for the meta key instead of 91
130
- MAC_WK_CMD_LEFT = 91,// WebKit Left Command key fired, same as META
131
- MAC_WK_CMD_RIGHT = 93,// WebKit Right Command key fired, different from META
129
+ MAC_FF_META = 224,
130
+ MAC_WK_CMD_LEFT = 91,
131
+ MAC_WK_CMD_RIGHT = 93,
132
132
  WIN_IME = 229,
133
133
  VK_NONAME = 252,
134
134
  PHANTOM = 255
@@ -30,15 +30,5 @@ export declare class Size {
30
30
  * are null.
31
31
  */
32
32
  static equals(a: Size | null, b: Size | null): boolean;
33
- /**
34
- * Returns a new size with the maximum width and height values out of both
35
- * sizes.
36
- */
37
- static max(a: Size, b: Size): Size;
38
- /**
39
- * Returns a new size with the minimum width and height values out of both
40
- * sizes.
41
- */
42
- static min(a: Size, b: Size): Size;
43
33
  }
44
34
  //# sourceMappingURL=size.d.ts.map
@@ -3,6 +3,16 @@
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ /**
7
+ * Fast prefix-checker.
8
+ * Copied from Closure's goog.string.startsWith.
9
+ *
10
+ * @param str The string to check.
11
+ * @param prefix A string to look for at the start of `str`.
12
+ * @returns True if `str` begins with `prefix`.
13
+ * @deprecated Use built-in **string.startsWith** instead.
14
+ */
15
+ export declare function startsWith(str: string, prefix: string): boolean;
6
16
  /**
7
17
  * Given an array of strings, return the length of the shortest one.
8
18
  *
@@ -20,6 +20,7 @@ import { Gesture } from './gesture.js';
20
20
  import { Grid } from './grid.js';
21
21
  import type { IASTNodeLocationSvg } from './interfaces/i_ast_node_location_svg.js';
22
22
  import type { IBoundedElement } from './interfaces/i_bounded_element.js';
23
+ import type { ICopyData, ICopyable } from './interfaces/i_copyable.js';
23
24
  import type { IDragTarget } from './interfaces/i_drag_target.js';
24
25
  import type { IFlyout } from './interfaces/i_flyout.js';
25
26
  import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
@@ -575,6 +576,32 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
575
576
  * highlight/unhighlight the specified block.
576
577
  */
577
578
  highlightBlock(id: string | null, opt_state?: boolean): void;
579
+ /**
580
+ * Pastes the provided block or workspace comment onto the workspace.
581
+ * Does not check whether there is remaining capacity for the object, that
582
+ * should be done before calling this method.
583
+ *
584
+ * @param state The representation of the thing to paste.
585
+ * @returns The pasted thing, or null if the paste was not successful.
586
+ * @deprecated v10. Use `Blockly.clipboard.paste` instead. To be removed in
587
+ * v11.
588
+ */
589
+ paste(state: any | Element | DocumentFragment): ICopyable<ICopyData> | null;
590
+ /**
591
+ * Paste the provided block onto the workspace.
592
+ *
593
+ * @param xmlBlock XML block element.
594
+ * @param jsonBlock JSON block representation.
595
+ * @returns The pasted block.
596
+ */
597
+ private pasteBlock_;
598
+ /**
599
+ * Paste the provided comment onto the workspace.
600
+ *
601
+ * @param xmlComment XML workspace comment element.
602
+ * @returns The pasted workspace comment.
603
+ */
604
+ private pasteWorkspaceComment_;
578
605
  /**
579
606
  * Refresh the toolbox unless there's a drag in progress.
580
607
  *
@@ -0,0 +1,26 @@
1
+ /* eslint-disable */
2
+ ;(function(root, factory) {
3
+ if (typeof define === 'function' && define.amd) { // AMD
4
+ define(['./blockly'], factory);
5
+ } else if (typeof exports === 'object') { // Node.js
6
+ module.exports = factory(require('./blockly'));
7
+ } else { // Browser
8
+ root.Blockly = factory(root.Blockly);
9
+ }
10
+ }(this, function(Blockly) {
11
+ /**
12
+ * @license
13
+ * Copyright 2019 Google LLC
14
+ * SPDX-License-Identifier: Apache-2.0
15
+ */
16
+
17
+ /**
18
+ * @fileoverview Blockly core module for the browser. It includes blockly.js
19
+ * and adds a helper method for setting the locale.
20
+ */
21
+
22
+ /* eslint-disable */
23
+ 'use strict';
24
+
25
+ return Blockly;
26
+ }));
package/core.js ADDED
@@ -0,0 +1,26 @@
1
+ /* eslint-disable */
2
+ (function (Blockly){
3
+ /**
4
+ * @license
5
+ * Copyright 2019 Google LLC
6
+ * SPDX-License-Identifier: Apache-2.0
7
+ */
8
+
9
+ /**
10
+ * @fileoverview Blockly core module for Node. It includes blockly-node.js
11
+ * and adds a helper method for setting the locale.
12
+ */
13
+
14
+ /* eslint-disable */
15
+ 'use strict';
16
+
17
+ // Override textToDomDocument and provide Node.js alternatives to DOMParser and
18
+ // XMLSerializer.
19
+ if (typeof globalThis.document !== 'object') {
20
+ const {JSDOM} = require('jsdom');
21
+ const {window} = new JSDOM(`<!DOCTYPE html>`);
22
+ Blockly.utils.xml.injectDependencies(window);
23
+ }
24
+
25
+ module.exports = Blockly;
26
+ })(require('./blockly'));
package/dart.d.ts CHANGED
@@ -4,4 +4,27 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- export * from './generators/dart';
7
+ export enum Order {
8
+ ATOMIC = 0, // 0 "" ...
9
+ UNARY_POSTFIX = 1, // expr++ expr-- () [] . ?.
10
+ UNARY_PREFIX = 2, // -expr !expr ~expr ++expr --expr
11
+ MULTIPLICATIVE = 3, // * / % ~/
12
+ ADDITIVE = 4, // + -
13
+ SHIFT = 5, // << >>
14
+ BITWISE_AND = 6, // &
15
+ BITWISE_XOR = 7, // ^
16
+ BITWISE_OR = 8, // |
17
+ RELATIONAL = 9, // >= > <= < as is is!
18
+ EQUALITY = 10, // == !=
19
+ LOGICAL_AND = 11, // &&
20
+ LOGICAL_OR = 12, // ||
21
+ IF_NULL = 13, // ??
22
+ CONDITIONAL = 14, // expr ? expr : expr
23
+ CASCADE = 15, // ..
24
+ ASSIGNMENT = 16, // = *= /= ~/= %= += -= <<= >>= &= ^= |=
25
+ NONE = 99, // (...)
26
+ }
27
+
28
+ export declare const dartGenerator: any;
29
+
30
+ export {DartGenerator} from './generators/dart';
package/dart.js ADDED
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+ ;(function(root, factory) {
3
+ if (typeof define === 'function' && define.amd) { // AMD
4
+ define(['./core', './dart_compressed.js'], factory);
5
+ } else if (typeof exports === 'object') { // Node.js
6
+ module.exports = factory(require('./core'), require('./dart_compressed.js'));
7
+ } else { // Browser
8
+ root.BlocklyDart = factory(root.Blockly, root.BlocklyDart);
9
+ }
10
+ }(this, function(Blockly, BlocklyDart) {
11
+ /**
12
+ * @license
13
+ * Copyright 2020 Google LLC
14
+ * SPDX-License-Identifier: Apache-2.0
15
+ */
16
+
17
+ /**
18
+ * @fileoverview Dart generator module; just a wrapper for dart_compressed.js.
19
+ */
20
+
21
+ return BlocklyDart;
22
+ }));