blockly 11.0.0-beta.1 → 11.0.0-beta.3

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/core/block.d.ts CHANGED
@@ -139,6 +139,12 @@ export declare class Block implements IASTNodeLocation, IDeletable {
139
139
  * Is the current block currently in the process of being disposed?
140
140
  */
141
141
  private disposing;
142
+ /**
143
+ * Has this block been fully initialized? E.g. all fields initailized.
144
+ *
145
+ * @internal
146
+ */
147
+ initialized: boolean;
142
148
  private readonly xy_;
143
149
  isInFlyout: boolean;
144
150
  isInMutator: boolean;
@@ -147,7 +153,8 @@ export declare class Block implements IASTNodeLocation, IDeletable {
147
153
  protected isInsertionMarker_: boolean;
148
154
  /** Name of the type of hat. */
149
155
  hat?: string;
150
- rendered: boolean | null;
156
+ /** Is this block a BlockSVG? */
157
+ readonly rendered: boolean;
151
158
  /**
152
159
  * String for block help, or function that returns a URL. Null for no help.
153
160
  */
@@ -30,11 +30,6 @@ export declare class BlockDragger implements IBlockDragger {
30
30
  /** Whether the block would be deleted if dropped immediately. */
31
31
  protected wouldDeleteBlock_: boolean;
32
32
  protected startXY_: Coordinate;
33
- /**
34
- * @deprecated To be removed in v11. Updating icons is now handled by the
35
- * block's `moveDuringDrag` method.
36
- */
37
- protected dragIconData_: IconPositionData[];
38
33
  /**
39
34
  * @param block The block to drag.
40
35
  * @param workspace The workspace to drag on.
@@ -139,13 +134,6 @@ export declare class BlockDragger implements IBlockDragger {
139
134
  * @returns The input coordinate divided by the workspace scale.
140
135
  */
141
136
  protected pixelsToWorkspaceUnits_(pixelCoord: Coordinate): Coordinate;
142
- /**
143
- * Move all of the icons connected to this drag.
144
- *
145
- * @deprecated To be removed in v11. This is now handled by the block's
146
- * `moveDuringDrag` method.
147
- */
148
- protected dragIcons_(): void;
149
137
  /**
150
138
  * Get a list of the insertion markers that currently exist. Drags have 0, 1,
151
139
  * or 2 insertion markers.
@@ -10,7 +10,6 @@
10
10
  */
11
11
  import './events/events_selected.js';
12
12
  import { Block } from './block.js';
13
- import { CommentIcon } from './icons/comment_icon.js';
14
13
  import type { Connection } from './connection.js';
15
14
  import { ConnectionType } from './connection_type.js';
16
15
  import { ContextMenuOption, LegacyContextMenuOption } from './contextmenu_registry.js';
@@ -27,7 +26,6 @@ import type { IPathObject } from './renderers/common/i_path_object.js';
27
26
  import type { BlockStyle } from './theme.js';
28
27
  import { Coordinate } from './utils/coordinate.js';
29
28
  import { Rect } from './utils/rect.js';
30
- import { WarningIcon } from './icons/warning_icon.js';
31
29
  import type { Workspace } from './workspace.js';
32
30
  import type { WorkspaceSvg } from './workspace_svg.js';
33
31
  import { IconType } from './icons/icon_types.js';
@@ -68,17 +66,12 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
68
66
  private warningTextDb;
69
67
  /** Block's mutator icon (if any). */
70
68
  mutator: MutatorIcon | null;
71
- /**
72
- * Block's warning icon (if any).
73
- *
74
- * @deprecated Use `setWarningText` to modify warnings on this block.
75
- */
76
- warning: WarningIcon | null;
77
69
  private svgGroup_;
78
70
  style: BlockStyle;
79
71
  /** @internal */
80
72
  pathObject: IPathObject;
81
- rendered: boolean;
73
+ /** Is this block a BlockSVG? */
74
+ readonly rendered = true;
82
75
  private visuallyDisabled;
83
76
  /**
84
77
  * Is this block currently rendering? Used to stop recursive render calls
@@ -92,11 +85,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
92
85
  nextConnection: RenderedConnection;
93
86
  previousConnection: RenderedConnection;
94
87
  private translation;
95
- /**
96
- * The ID of the setTimeout callback for bumping neighbours, or 0 if no bump
97
- * is currently scheduled.
98
- */
99
- private bumpNeighboursPid;
100
88
  /** Whether this block is currently being dragged. */
101
89
  private dragging;
102
90
  /**
@@ -349,14 +337,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
349
337
  * @internal
350
338
  */
351
339
  updateDisabled(): void;
352
- /**
353
- * Get the comment icon attached to this block, or null if the block has no
354
- * comment.
355
- *
356
- * @returns The comment icon attached to this block, or null.
357
- * @deprecated Use getIcon. To be remove in v11.
358
- */
359
- getCommentIcon(): CommentIcon | null;
360
340
  /**
361
341
  * Set this block's warning text.
362
342
  *
@@ -506,8 +486,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
506
486
  * Returns connections originating from this block.
507
487
  *
508
488
  * @param all If true, return all connections even hidden ones.
509
- * Otherwise, for a non-rendered block return an empty list, and for a
510
- * collapsed block don't return inputs connections.
489
+ * Otherwise, for a collapsed block don't return inputs connections.
511
490
  * @returns Array of connections.
512
491
  * @internal
513
492
  */
@@ -562,14 +541,8 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
562
541
  */
563
542
  bumpNeighbours(): void;
564
543
  /**
565
- * Bumps unconnected blocks out of alignment.
566
- */
567
- private bumpNeighboursInternal;
568
- /**
569
- * Schedule snapping to grid and bumping neighbours to occur after a brief
570
- * delay.
571
- *
572
- * @internal
544
+ * Snap to grid, and then bump neighbouring blocks away at the end of the next
545
+ * render.
573
546
  */
574
547
  scheduleSnapAndBump(): void;
575
548
  /**
package/core/blockly.d.ts CHANGED
@@ -14,7 +14,6 @@ import { BlockSvg } from './block_svg.js';
14
14
  import { BlocklyOptions } from './blockly_options.js';
15
15
  import { Blocks } from './blocks.js';
16
16
  import * as browserEvents from './browser_events.js';
17
- import { Bubble } from './bubbles/bubble.js';
18
17
  import * as bubbles from './bubbles.js';
19
18
  import { BubbleDragger } from './bubble_dragger.js';
20
19
  import * as bumpObjects from './bump_objects.js';
@@ -59,9 +58,7 @@ import { Gesture } from './gesture.js';
59
58
  import { Grid } from './grid.js';
60
59
  import * as icons from './icons.js';
61
60
  import { inject } from './inject.js';
62
- import { Align } from './inputs/align.js';
63
61
  import { Input } from './inputs/input.js';
64
- import { inputTypes } from './inputs/input_types.js';
65
62
  import * as inputs from './inputs.js';
66
63
  import { InsertionMarkerManager } from './insertion_marker_manager.js';
67
64
  import { IASTNodeLocation } from './interfaces/i_ast_node_location.js';
@@ -117,7 +114,6 @@ import * as renderManagement from './render_management.js';
117
114
  import * as blockRendering from './renderers/common/block_rendering.js';
118
115
  import * as constants from './constants.js';
119
116
  import * as geras from './renderers/geras/geras.js';
120
- import * as minimalist from './renderers/minimalist/minimalist.js';
121
117
  import * as thrasos from './renderers/thrasos/thrasos.js';
122
118
  import * as zelos from './renderers/zelos/zelos.js';
123
119
  import { Scrollbar } from './scrollbar.js';
@@ -161,21 +157,6 @@ import { ZoomControls } from './zoom_controls.js';
161
157
  * @define {string}
162
158
  */
163
159
  export declare const VERSION = "uncompiled";
164
- /**
165
- * @see Blockly.Input.Align.LEFT
166
- * @deprecated Use `Blockly.inputs.Align.LEFT`. To be removed in v11.
167
- */
168
- export declare const ALIGN_LEFT = Align.LEFT;
169
- /**
170
- * @see Blockly.Input.Align.CENTRE
171
- * @deprecated Use `Blockly.inputs.Align.CENTER`. To be removed in v11.
172
- */
173
- export declare const ALIGN_CENTRE = Align.CENTRE;
174
- /**
175
- * @see Blockly.Input.Align.RIGHT
176
- * @deprecated Use `Blockly.inputs.Align.RIGHT`. To be removed in v11.
177
- */
178
- export declare const ALIGN_RIGHT = Align.RIGHT;
179
160
  /**
180
161
  * @see ConnectionType.INPUT_VALUE
181
162
  */
@@ -192,11 +173,6 @@ export declare const NEXT_STATEMENT = ConnectionType.NEXT_STATEMENT;
192
173
  * @see ConnectionType.PREVIOUS_STATEMENT
193
174
  */
194
175
  export declare const PREVIOUS_STATEMENT = ConnectionType.PREVIOUS_STATEMENT;
195
- /**
196
- * @see inputTypes.DUMMY_INPUT
197
- * @deprecated Use `Blockly.inputs.inputTypes.DUMMY`. To be removed in v11.
198
- */
199
- export declare const DUMMY_INPUT = inputTypes.DUMMY;
200
176
  /** Aliases for toolbox positions. */
201
177
  /**
202
178
  * @see toolbox.Position.TOP
@@ -312,7 +288,6 @@ export { constants };
312
288
  export { dialog };
313
289
  export { fieldRegistry };
314
290
  export { geras };
315
- export { minimalist };
316
291
  export { registry };
317
292
  export { thrasos };
318
293
  export { uiPosition };
@@ -326,8 +301,6 @@ export { BlockDragger };
326
301
  export { BlockSvg };
327
302
  export { Blocks };
328
303
  export { bubbles };
329
- /** @deprecated Use Blockly.bubbles.Bubble instead. To be removed in v11. */
330
- export { Bubble };
331
304
  export { BubbleDragger };
332
305
  export { CollapsibleToolboxCategory };
333
306
  export { ComponentManager };
@@ -429,10 +402,6 @@ export { WorkspaceDragger };
429
402
  export { WorkspaceSvg };
430
403
  export { ZoomControls };
431
404
  export { config };
432
- /** @deprecated Use Blockly.ConnectionType instead. */
433
- export declare const connectionTypes: typeof ConnectionType;
434
405
  export { inject };
435
- /** @deprecated Use Blockly.inputs.inputTypes instead. To be removed in v11. */
436
- export { inputTypes };
437
406
  export { serialization };
438
407
  //# sourceMappingURL=blockly.d.ts.map
@@ -8,14 +8,6 @@ import { BlockPaster } from './clipboard/block_paster.js';
8
8
  import { WorkspaceSvg } from './workspace_svg.js';
9
9
  import * as registry from './clipboard/registry.js';
10
10
  import { Coordinate } from './utils/coordinate.js';
11
- /**
12
- * Copy a copyable element onto the local clipboard.
13
- *
14
- * @param toCopy The copyable element to be copied.
15
- * @deprecated v11. Use `myCopyable.toCopyData()` instead. To be removed v12.
16
- * @internal
17
- */
18
- export declare function copy<T extends ICopyData>(toCopy: ICopyable<T>): T | null;
19
11
  /**
20
12
  * Private version of copy for stubbing in tests.
21
13
  */
@@ -35,17 +27,6 @@ export declare function paste<T extends ICopyData>(copyData: T, workspace: Works
35
27
  * @returns the pasted thing if the paste was successful, null otherwise.
36
28
  */
37
29
  export declare function paste(): ICopyable<ICopyData> | null;
38
- /**
39
- * Duplicate this copy-paste-able element.
40
- *
41
- * @param toDuplicate The element to be duplicated.
42
- * @returns The element that was duplicated, or null if the duplication failed.
43
- * @deprecated v11. Use
44
- * `Blockly.clipboard.paste(myCopyable.toCopyData(), myWorkspace)` instead.
45
- * To be removed v12.
46
- * @internal
47
- */
48
- export declare function duplicate<U extends ICopyData, T extends ICopyable<U> & IHasWorkspace>(toDuplicate: T): T | null;
49
30
  /**
50
31
  * Private version of duplicate for stubbing in tests.
51
32
  */
package/core/gesture.d.ts CHANGED
@@ -86,6 +86,8 @@ export declare class Gesture {
86
86
  * is in progress.
87
87
  */
88
88
  private workspaceDragger;
89
+ /** Whether the gesture is dragging or not. */
90
+ private dragging;
89
91
  /** The flyout a gesture started in, if any. */
90
92
  private flyout;
91
93
  /** Boolean for sanity-checking that some code is only called once. */
@@ -49,7 +49,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
49
49
  * Updates the state of the bubble (editable / noneditable) to reflect the
50
50
  * state of the bubble if the bubble is currently shown.
51
51
  */
52
- updateEditable(): void;
52
+ updateEditable(): Promise<void>;
53
53
  onLocationChange(blockOrigin: Coordinate): void;
54
54
  /** Sets the text of this comment. Updates any bubbles if they are visible. */
55
55
  setText(text: string): void;
@@ -82,7 +82,7 @@ export declare class CommentIcon extends Icon implements IHasBubble, ISerializab
82
82
  */
83
83
  onSizeChange(): void;
84
84
  bubbleIsVisible(): boolean;
85
- setBubbleVisible(visible: boolean): void;
85
+ setBubbleVisible(visible: boolean): Promise<void>;
86
86
  /**
87
87
  * Shows the editable text bubble for this comment, and adds change listeners
88
88
  * to update the state of this icon in response to changes in the bubble.
@@ -59,11 +59,5 @@ export declare abstract class Icon implements IIcon {
59
59
  * @returns Whether the icon should be clickable while the block is in a flyout.
60
60
  */
61
61
  isClickableInFlyout(autoClosingFlyout: boolean): boolean;
62
- /**
63
- * Sets the visibility of the icon's bubble if one exists.
64
- *
65
- * @deprecated Use `setBubbleVisible` instead. To be removed in v11.
66
- */
67
- setVisible(visibility: boolean): void;
68
62
  }
69
63
  //# sourceMappingURL=icon.d.ts.map
@@ -4,9 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { Abstract } from '../events/events_abstract.js';
7
- import type { Block } from '../block.js';
8
7
  import type { BlockSvg } from '../block_svg.js';
9
- import type { Connection } from '../connection.js';
10
8
  import { Coordinate } from '../utils/coordinate.js';
11
9
  import type { IHasBubble } from '../interfaces/i_has_bubble.js';
12
10
  import { Icon } from './icon.js';
@@ -55,7 +53,7 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
55
53
  onClick(): void;
56
54
  isClickableInFlyout(): boolean;
57
55
  bubbleIsVisible(): boolean;
58
- setBubbleVisible(visible: boolean): void;
56
+ setBubbleVisible(visible: boolean): Promise<void>;
59
57
  /** @returns the configuration the mini workspace should have. */
60
58
  private getMiniWorkspaceConfig;
61
59
  /**
@@ -91,18 +89,5 @@ export declare class MutatorIcon extends Icon implements IHasBubble {
91
89
  * currently open.
92
90
  */
93
91
  getWorkspace(): WorkspaceSvg | undefined;
94
- /**
95
- * Reconnects the given connection to the mutated input on the given block.
96
- *
97
- * @deprecated Use connection.reconnect instead. To be removed in v11.
98
- */
99
- static reconnect(connectionChild: Connection | null, block: Block, inputName: string): boolean;
100
- /**
101
- * Returns the parent workspace of a workspace that is inside a mini workspace
102
- * bubble, taking into account whether the workspace is a flyout.
103
- *
104
- * @deprecated Use workspace.getRootWorkspace. To be removed in v11.
105
- */
106
- static findParentWs(workspace: WorkspaceSvg): WorkspaceSvg | null;
107
92
  }
108
93
  //# sourceMappingURL=mutator_icon.d.ts.map
@@ -59,7 +59,7 @@ export declare class WarningIcon extends Icon implements IHasBubble {
59
59
  onClick(): void;
60
60
  isClickableInFlyout(): boolean;
61
61
  bubbleIsVisible(): boolean;
62
- setBubbleVisible(visible: boolean): void;
62
+ setBubbleVisible(visible: boolean): Promise<void>;
63
63
  /**
64
64
  * @returns the location the bubble should be anchored to.
65
65
  * I.E. the middle of this icon.
@@ -15,13 +15,14 @@ import type { Connection } from '../connection.js';
15
15
  import type { ConnectionType } from '../connection_type.js';
16
16
  import type { Field } from '../field.js';
17
17
  import { inputTypes } from './input_types.js';
18
+ import { Align } from './align.js';
18
19
  /** Class for an input with optional fields. */
19
20
  export declare class Input {
20
21
  name: string;
21
22
  private sourceBlock;
22
23
  fieldRow: Field[];
23
24
  /** Alignment of input's fields (left, right or centre). */
24
- align: Input.Align;
25
+ align: Align;
25
26
  /** Is the input visible? */
26
27
  private visible;
27
28
  readonly type: inputTypes;
@@ -121,6 +122,14 @@ export declare class Input {
121
122
  getShadowDom(): Element | null;
122
123
  /** Initialize the fields on this input. */
123
124
  init(): void;
125
+ /**
126
+ * Initializes the fields on this input for a headless block.
127
+ *
128
+ * @internal
129
+ */
130
+ initModel(): void;
131
+ /** Initializes the given field. */
132
+ private initField;
124
133
  /**
125
134
  * Sever all links to this input.
126
135
  */
@@ -135,22 +144,4 @@ export declare class Input {
135
144
  */
136
145
  protected makeConnection(type: ConnectionType): Connection;
137
146
  }
138
- export declare namespace Input {
139
- /**
140
- * Enum for alignment of inputs.
141
- *
142
- * @deprecated Use Blockly.inputs.Align. To be removed in v11.
143
- */
144
- enum Align {
145
- LEFT = -1,
146
- CENTRE = 0,
147
- RIGHT = 1
148
- }
149
- }
150
- /** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
151
- /** @suppress {deprecated} */
152
- export type Align = Input.Align;
153
- /** @deprecated Use Blockly.inputs.Align. To be removed in v11. */
154
- /** @suppress {deprecated} */
155
- export declare const Align: typeof Input.Align;
156
147
  //# sourceMappingURL=input.d.ts.map
@@ -7,7 +7,7 @@ export interface IHasBubble {
7
7
  /** @returns True if the bubble is currently open, false otherwise. */
8
8
  bubbleIsVisible(): boolean;
9
9
  /** Sets whether the bubble is open or not. */
10
- setBubbleVisible(visible: boolean): void;
10
+ setBubbleVisible(visible: boolean): Promise<void>;
11
11
  }
12
12
  /** Type guard that checks whether the given object is a IHasBubble. */
13
13
  export declare function hasBubble(obj: any): obj is IHasBubble;
@@ -3,6 +3,7 @@
3
3
  * Copyright 2022 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { ParameterState } from '../serialization/procedures';
6
7
  import { IProcedureModel } from './i_procedure_model';
7
8
  /**
8
9
  * A data model for a procedure.
@@ -33,5 +34,11 @@ export interface IParameterModel {
33
34
  getId(): string;
34
35
  /** Sets the procedure model this parameter is associated with. */
35
36
  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;
36
43
  }
37
44
  //# sourceMappingURL=i_parameter_model.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * Copyright 2022 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { State } from '../serialization/procedures.js';
6
7
  import { IParameterModel } from './i_parameter_model.js';
7
8
  /**
8
9
  * A data model for a procedure.
@@ -48,5 +49,11 @@ export interface IProcedureModel {
48
49
  * disabled, all procedure caller blocks should be disabled as well.
49
50
  */
50
51
  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;
51
58
  }
52
59
  //# sourceMappingURL=i_procedure_model.d.ts.map
package/core/options.d.ts CHANGED
@@ -32,6 +32,7 @@ export declare class Options {
32
32
  pathToMedia: string;
33
33
  hasCategories: boolean;
34
34
  moveOptions: MoveOptions;
35
+ /** @deprecated January 2019 */
35
36
  hasScrollbars: boolean;
36
37
  hasTrashcan: boolean;
37
38
  maxTrashcanContents: number;
@@ -37,13 +37,6 @@ export declare class Drawer {
37
37
  * required.
38
38
  */
39
39
  draw(): void;
40
- /**
41
- * Hide icons that were marked as hidden.
42
- *
43
- * @deprecated Manually hiding icons is no longer necessary. To be removed
44
- * in v11.
45
- */
46
- protected hideHiddenIcons_(): void;
47
40
  /**
48
41
  * Save sizing information back to the block
49
42
  * Most of the rendering information can be thrown away at the end of the
@@ -12,11 +12,6 @@ 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;
20
15
  flipRtl: boolean;
21
16
  /**
22
17
  * An object containing information about the space an icon takes up during
@@ -7,63 +7,65 @@ 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
- /**
11
- * Representation of a procedure data model.
12
- */
10
+ /** Represents the state of a procedure model. */
13
11
  export interface State {
14
12
  id: string;
15
13
  name: string;
16
14
  returnTypes: string[] | null;
17
15
  parameters?: ParameterState[];
16
+ [key: string]: unknown;
18
17
  }
19
- /**
20
- * Representation of a parameter data model.
21
- */
18
+ /** Represents the state of a parameter model. */
22
19
  export interface ParameterState {
23
20
  id: string;
24
21
  name: string;
25
22
  types?: string[];
23
+ [key: string]: unknown;
26
24
  }
27
25
  /**
28
26
  * A newable signature for an IProcedureModel.
29
27
  *
30
28
  * Refer to
31
- * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics
29
+ * https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
32
30
  * for what is going on with this.
33
31
  */
34
- type ProcedureModelConstructor<ProcedureModel extends IProcedureModel> = new (workspace: Workspace, name: string, id: string) => ProcedureModel;
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
+ }
35
43
  /**
36
44
  * A newable signature for an IParameterModel.
37
45
  *
38
46
  * Refer to
39
- * https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics
47
+ * https://www.typescriptlang.org/docs/handbook/interfaces.html#difference-between-the-static-and-instance-sides-of-classes
40
48
  * for what is going on with this.
41
49
  */
42
- type ParameterModelConstructor<ParameterModel extends IParameterModel> = new (workspace: Workspace, name: string, id: string) => ParameterModel;
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
+ }
43
61
  /**
44
62
  * Serializes the given IProcedureModel to JSON.
45
- *
46
- * @internal
47
63
  */
48
64
  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;
55
65
  /**
56
66
  * Deserializes the given procedure model State from JSON.
57
- *
58
- * @internal
59
67
  */
60
68
  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;
67
69
  /** Serializer for saving and loading procedure state. */
68
70
  export declare class ProcedureSerializer<ProcedureModel extends IProcedureModel, ParameterModel extends IParameterModel> implements ISerializer {
69
71
  private readonly procedureModelClass;
@@ -86,15 +86,6 @@ 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;
98
89
  /**
99
90
  * Sets the CSS transform property on an element. This function sets the
100
91
  * non-vendor-prefixed and vendor-prefixed versions for backwards compatibility
@@ -3,16 +3,6 @@
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;
16
6
  /**
17
7
  * Given an array of strings, return the length of the shortest one.
18
8
  *
@@ -20,7 +20,6 @@ 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';
24
23
  import type { IDragTarget } from './interfaces/i_drag_target.js';
25
24
  import type { IFlyout } from './interfaces/i_flyout.js';
26
25
  import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
@@ -576,32 +575,6 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
576
575
  * highlight/unhighlight the specified block.
577
576
  */
578
577
  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_;
605
578
  /**
606
579
  * Refresh the toolbox unless there's a drag in progress.
607
580
  *