blockly 9.0.0 → 9.0.1

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/field.d.ts CHANGED
@@ -151,7 +151,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
151
151
  * @returns The block containing this field.
152
152
  * @throws An error if the source block is not defined.
153
153
  */
154
- getSourceBlock(): Block;
154
+ getSourceBlock(): Block | null;
155
155
  /**
156
156
  * Initialize everything to render this field. Override
157
157
  * methods initModel and initView rather than this method.
@@ -615,4 +615,13 @@ export interface FieldConfig {
615
615
  * in descendants, though they should contain all of Field's prototype methods.
616
616
  */
617
617
  export declare type FieldProto = Pick<typeof Field, 'prototype'>;
618
+ /**
619
+ * Represents an error where the field is trying to access its block or
620
+ * information about its block before it has actually been attached to said
621
+ * block.
622
+ */
623
+ export declare class UnattachedFieldError extends Error {
624
+ /** @internal */
625
+ constructor();
626
+ }
618
627
  //# sourceMappingURL=field.d.ts.map
@@ -16,6 +16,6 @@ export interface IASTNodeLocationWithBlock extends IASTNodeLocation {
16
16
  *
17
17
  * @returns The source block.
18
18
  */
19
- getSourceBlock(): Block;
19
+ getSourceBlock(): Block | null;
20
20
  }
21
21
  //# sourceMappingURL=i_ast_node_location_with_block.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * The interface for the data model of a procedure parameter.
8
+ *
9
+ * @namespace Blockly.IParameterModel
10
+ */
11
+ /**
12
+ * A data model for a procedure.
13
+ */
14
+ export interface IParameterModel {
15
+ /**
16
+ * Sets the name of this parameter to the given name.
17
+ */
18
+ setName(name: string): this;
19
+ /**
20
+ * Sets the types of this parameter to the given type.
21
+ */
22
+ setTypes(types: string[]): this;
23
+ /**
24
+ * Returns the unique language-neutral ID for the parameter.
25
+ *
26
+ * This represents the identify of the variable model which does not change
27
+ * over time.
28
+ */
29
+ getId(): string;
30
+ }
31
+ //# sourceMappingURL=i_parameter_model.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * The interface for the data model of a procedure.
8
+ *
9
+ * @namespace Blockly.IProcedureModel
10
+ */
11
+ import { IParameterModel } from './i_parameter_model.js';
12
+ /**
13
+ * A data model for a procedure.
14
+ */
15
+ export interface IProcedureModel {
16
+ /** Sets the human-readable name of the procedure. */
17
+ setName(name: string): this;
18
+ /**
19
+ * Inserts a parameter into the list of parameters.
20
+ *
21
+ * To move a parameter, first delete it, and then re-insert.
22
+ */
23
+ insertParameter(parameterModel: IParameterModel, index: number): this;
24
+ /** Removes the parameter at the given index from the parameter list. */
25
+ deleteParameter(index: number): this;
26
+ /**
27
+ * Sets the return type(s) of the procedure.
28
+ *
29
+ * Pass null to represent a procedure that does not return.
30
+ */
31
+ setReturnTypes(types: string[] | null): this;
32
+ /**
33
+ * Sets whether this procedure is enabled/disabled. If a procedure is disabled
34
+ * all procedure caller blocks should be disabled as well.
35
+ */
36
+ setEnabled(enabled: boolean): this;
37
+ /** Returns the unique language-neutral ID for the procedure. */
38
+ getId(): string;
39
+ /** Returns the human-readable name of the procedure. */
40
+ getName(): string;
41
+ /** Returns the parameter at the given index in the parameter list. */
42
+ getParameter(index: number): IParameterModel;
43
+ /** Returns an array of all of the parameters in the parameter list. */
44
+ getParameters(): IParameterModel[];
45
+ /**
46
+ * Returns the return type(s) of the procedure.
47
+ *
48
+ * Null represents a procedure that does not return a value.
49
+ */
50
+ getReturnTypes(): string[] | null;
51
+ /**
52
+ * Returns whether the procedure is enabled/disabled. If a procedure is
53
+ * disabled, all procedure caller blocks should be disabled as well.
54
+ */
55
+ getEnabled(): boolean;
56
+ }
57
+ //# sourceMappingURL=i_procedure_model.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
+ import type { VariableModel } from '../variable_model.js';
8
+ import type { Workspace } from '../workspace.js';
9
+ export declare class ObservableParameterModel implements IParameterModel {
10
+ private readonly workspace;
11
+ private id;
12
+ private variable;
13
+ constructor(workspace: Workspace, name: string, id?: string);
14
+ /**
15
+ * Sets the name of this parameter to the given name.
16
+ */
17
+ setName(name: string): this;
18
+ /**
19
+ * Unimplemented. The built-in ParameterModel does not support typing.
20
+ * If you want your procedure blocks to have typed parameters, you need to
21
+ * implement your own ParameterModel.
22
+ */
23
+ setTypes(_types: string[]): this;
24
+ /**
25
+ * Returns the unique language-neutral ID for the parameter.
26
+ *
27
+ * This represents the identify of the variable model which does not change
28
+ * over time.
29
+ */
30
+ getId(): string;
31
+ /** Returns the variable model associated with the parameter model. */
32
+ getVariableModel(): VariableModel;
33
+ }
34
+ //# sourceMappingURL=observable_parameter_model.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
7
+ import type { Workspace } from '../workspace.js';
8
+ export declare class ObservableProcedureMap extends Map<string, IProcedureModel> {
9
+ private readonly workspace;
10
+ constructor(workspace: Workspace);
11
+ /**
12
+ * Adds the given procedure model to the procedure map.
13
+ */
14
+ set(id: string, proc: IProcedureModel): this;
15
+ /**
16
+ * Deletes the ProcedureModel with the given ID from the procedure map (if it
17
+ * exists).
18
+ */
19
+ delete(id: string): boolean;
20
+ /**
21
+ * Removes all ProcedureModels from the procedure map.
22
+ */
23
+ clear(): void;
24
+ /**
25
+ * Adds the given ProcedureModel to the map of procedure models, so that
26
+ * blocks can find it.
27
+ */
28
+ add(proc: IProcedureModel): this;
29
+ }
30
+ //# sourceMappingURL=observable_procedure_map.d.ts.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IParameterModel } from '../interfaces/i_parameter_model.js';
7
+ import type { IProcedureModel } from '../interfaces/i_procedure_model.js';
8
+ import type { Workspace } from '../workspace.js';
9
+ export declare class ObservableProcedureModel implements IProcedureModel {
10
+ private readonly workspace;
11
+ private id;
12
+ private name;
13
+ private parameters;
14
+ private returnTypes;
15
+ private enabled;
16
+ constructor(workspace: Workspace, id?: string);
17
+ /** Sets the human-readable name of the procedure. */
18
+ setName(name: string): this;
19
+ /**
20
+ * Inserts a parameter into the list of parameters.
21
+ *
22
+ * To move a parameter, first delete it, and then re-insert.
23
+ */
24
+ insertParameter(parameterModel: IParameterModel, index: number): this;
25
+ /** Removes the parameter at the given index from the parameter list. */
26
+ deleteParameter(index: number): this;
27
+ /**
28
+ * Sets the return type(s) of the procedure.
29
+ *
30
+ * Pass null to represent a procedure that does not return.
31
+ */
32
+ setReturnTypes(types: string[] | null): this;
33
+ /**
34
+ * Sets whether this procedure is enabled/disabled. If a procedure is disabled
35
+ * all procedure caller blocks should be disabled as well.
36
+ */
37
+ setEnabled(enabled: boolean): this;
38
+ /** Returns the unique language-neutral ID for the procedure. */
39
+ getId(): string;
40
+ /** Returns the human-readable name of the procedure. */
41
+ getName(): string;
42
+ /** Returns the parameter at the given index in the parameter list. */
43
+ getParameter(index: number): IParameterModel;
44
+ /** Returns an array of all of the parameters in the parameter list. */
45
+ getParameters(): IParameterModel[];
46
+ /**
47
+ * Returns the return type of the procedure.
48
+ *
49
+ * Null represents a procedure that does not return a value.
50
+ */
51
+ getReturnTypes(): string[] | null;
52
+ /**
53
+ * Returns whether the procedure is enabled/disabled. If a procedure is
54
+ * disabled, all procedure caller blocks should be disabled as well.
55
+ */
56
+ getEnabled(): boolean;
57
+ }
58
+ //# sourceMappingURL=observable_procedure_model.d.ts.map
@@ -6,7 +6,7 @@
6
6
  import './events/events_block_change.js';
7
7
  import type { Block } from './block.js';
8
8
  import type { Abstract } from './events/events_abstract.js';
9
- import type { Field } from './field.js';
9
+ import { Field } from './field.js';
10
10
  import type { Workspace } from './workspace.js';
11
11
  import type { WorkspaceSvg } from './workspace_svg.js';
12
12
  /**
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as blocks from './serialization/blocks.js';
7
+ import * as exceptions from './serialization/exceptions.js';
8
+ import * as priorities from './serialization/priorities.js';
9
+ import * as registry from './serialization/registry.js';
10
+ import * as variables from './serialization/variables.js';
11
+ import * as workspaces from './serialization/workspaces.js';
12
+ import { ISerializer } from './interfaces/i_serializer.js';
13
+ export { blocks, exceptions, priorities, registry, variables, workspaces, ISerializer, };
14
+ //# sourceMappingURL=serialization.d.ts.map
package/core/touch.d.ts CHANGED
@@ -73,9 +73,9 @@ export declare function shouldHandleEvent(e: Event | PseudoEvent): boolean;
73
73
  * Get the touch identifier from the given event. If it was a mouse event, the
74
74
  * identifier is the string 'mouse'.
75
75
  *
76
- * @param e Mouse event or touch event.
77
- * @returns The touch identifier from the first changed touch, if defined.
78
- * Otherwise 'mouse'.
76
+ * @param e Pointer event, mouse event, or touch event.
77
+ * @returns The pointerId, or touch identifier from the first changed touch, if
78
+ * defined. Otherwise 'mouse'.
79
79
  * @alias Blockly.Touch.getTouchIdentifierFromEvent
80
80
  */
81
81
  export declare function getTouchIdentifierFromEvent(e: Event | PseudoEvent): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blockly",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "description": "Blockly is a library for building visual programming editors.",
5
5
  "keywords": [
6
6
  "blockly"