blockly 11.0.0 → 11.1.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/core/block.d.ts CHANGED
@@ -320,12 +320,6 @@ export declare class Block implements IASTNodeLocation {
320
320
  * @internal
321
321
  */
322
322
  getTopStackBlock(): this;
323
- /**
324
- * Returns this block if it is a shadow block, or the first non-shadow parent.
325
- *
326
- * @internal
327
- */
328
- getFirstNonShadowBlock(): this;
329
323
  /**
330
324
  * Find all the blocks that are directly nested inside this one.
331
325
  * Includes value and statement inputs, as well as any following statement.
@@ -7,6 +7,7 @@ import type { Block } from './block.js';
7
7
  import type { BlockSvg } from './block_svg.js';
8
8
  import type { ContextMenuOption, LegacyContextMenuOption } from './contextmenu_registry.js';
9
9
  import * as serializationBlocks from './serialization/blocks.js';
10
+ import type { WorkspaceSvg } from './workspace_svg.js';
10
11
  /**
11
12
  * Gets the block the context menu is currently attached to.
12
13
  *
@@ -25,8 +26,9 @@ export declare function setCurrentBlock(block: Block | null): void;
25
26
  * @param e Mouse event.
26
27
  * @param options Array of menu options.
27
28
  * @param rtl True if RTL, false if LTR.
29
+ * @param workspace The workspace associated with the context menu, if any.
28
30
  */
29
- export declare function show(e: PointerEvent, options: (ContextMenuOption | LegacyContextMenuOption)[], rtl: boolean): void;
31
+ export declare function show(e: PointerEvent, options: (ContextMenuOption | LegacyContextMenuOption)[], rtl: boolean, workspace?: WorkspaceSvg): void;
30
32
  /**
31
33
  * Hide the context menu.
32
34
  */
@@ -20,6 +20,11 @@ export declare class BlockDragStrategy implements IDragStrategy {
20
20
  private connectionCandidate;
21
21
  private connectionPreviewer;
22
22
  private dragging;
23
+ /**
24
+ * If this is a shadow block, the offset between this block and the parent
25
+ * block, to add to the drag location. In workspace units.
26
+ */
27
+ private dragOffset;
23
28
  constructor(block: BlockSvg);
24
29
  /** Returns true if the block is currently movable. False otherwise. */
25
30
  isMovable(): boolean;
@@ -28,6 +33,8 @@ export declare class BlockDragStrategy implements IDragStrategy {
28
33
  * from any parent blocks.
29
34
  */
30
35
  startDrag(e?: PointerEvent): void;
36
+ /** Starts a drag on a shadow, recording the drag offset. */
37
+ private startDraggingShadow;
31
38
  /**
32
39
  * Whether or not we should disconnect the block when a drag is started.
33
40
  *
@@ -86,7 +93,7 @@ export declare class BlockDragStrategy implements IDragStrategy {
86
93
  * Cleans up any state at the end of the drag. Applies any pending
87
94
  * connections.
88
95
  */
89
- endDrag(): void;
96
+ endDrag(e?: PointerEvent): void;
90
97
  /** Connects the given candidate connections. */
91
98
  private applyConnections;
92
99
  /**
@@ -35,14 +35,15 @@ export declare class Dragger implements IDragger {
35
35
  * Returns true if we would delete the draggable if it was dropped
36
36
  * at the current location.
37
37
  */
38
- protected wouldDeleteDraggable(e: PointerEvent, draggable: IDraggable & IDeletable): boolean;
38
+ protected wouldDeleteDraggable(e: PointerEvent, rootDraggable: IDraggable & IDeletable): boolean;
39
39
  /** Handles any drag cleanup. */
40
40
  onDragEnd(e: PointerEvent): void;
41
+ private getRoot;
41
42
  /**
42
43
  * Returns true if we should return the draggable to its original location
43
44
  * at the end of the drag.
44
45
  */
45
- protected shouldReturnToStart(e: PointerEvent, draggable: IDraggable): boolean;
46
+ protected shouldReturnToStart(e: PointerEvent, rootDraggable: IDraggable): boolean;
46
47
  protected pixelsToWorkspaceUnits(pixelCoord: Coordinate): Coordinate;
47
48
  }
48
49
  //# sourceMappingURL=dragger.d.ts.map
@@ -162,7 +162,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
162
162
  *
163
163
  * @returns The newly created text input editor.
164
164
  */
165
- protected widgetCreate_(): HTMLElement;
165
+ protected widgetCreate_(): HTMLInputElement | HTMLTextAreaElement;
166
166
  /**
167
167
  * Closes the editor, saves the results, and disposes of any events or
168
168
  * DOM-references belonging to the editor.
@@ -264,6 +264,12 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
264
264
  setAutoClose(autoClose: boolean): void;
265
265
  /** Automatically hides the flyout if it is an autoclosing flyout. */
266
266
  autoHide(onlyClosePopups: boolean): void;
267
+ /**
268
+ * Get the target workspace inside the flyout.
269
+ *
270
+ * @returns The target workspace inside the flyout.
271
+ */
272
+ getTargetWorkspace(): WorkspaceSvg;
267
273
  /**
268
274
  * Is the flyout visible?
269
275
  *
@@ -13,7 +13,7 @@ import type { IASTNodeLocationSvg } from './blockly.js';
13
13
  export declare class FlyoutButton implements IASTNodeLocationSvg {
14
14
  private readonly workspace;
15
15
  private readonly targetWorkspace;
16
- private readonly isLabel_;
16
+ private readonly isFlyoutLabel;
17
17
  /** The horizontal margin around the text in the button. */
18
18
  static TEXT_MARGIN_X: number;
19
19
  /** The vertical margin around the text in the button. */
@@ -44,10 +44,10 @@ export declare class FlyoutButton implements IASTNodeLocationSvg {
44
44
  * @param workspace The workspace in which to place this button.
45
45
  * @param targetWorkspace The flyout's target workspace.
46
46
  * @param json The JSON specifying the label/button.
47
- * @param isLabel_ Whether this button should be styled as a label.
47
+ * @param isFlyoutLabel Whether this button should be styled as a label.
48
48
  * @internal
49
49
  */
50
- constructor(workspace: WorkspaceSvg, targetWorkspace: WorkspaceSvg, json: toolbox.ButtonOrLabelInfo, isLabel_: boolean);
50
+ constructor(workspace: WorkspaceSvg, targetWorkspace: WorkspaceSvg, json: toolbox.ButtonOrLabelInfo, isFlyoutLabel: boolean);
51
51
  /**
52
52
  * Create the button elements.
53
53
  *
@@ -68,7 +68,6 @@ export declare class HorizontalFlyout extends Flyout {
68
68
  * @param currentDragDeltaXY How far the pointer has moved from the position
69
69
  * at mouse down, in pixel units.
70
70
  * @returns True if the drag is toward the workspace.
71
- * @internal
72
71
  */
73
72
  isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;
74
73
  /**
@@ -69,7 +69,6 @@ export declare class VerticalFlyout extends Flyout {
69
69
  * @param currentDragDeltaXY How far the pointer has moved from the position
70
70
  * at mouse down, in pixel units.
71
71
  * @returns True if the drag is toward the workspace.
72
- * @internal
73
72
  */
74
73
  isDragTowardWorkspace(currentDragDeltaXY: Coordinate): boolean;
75
74
  /**
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import type { Rect } from './utils/rect.js';
7
7
  import type { Size } from './utils/size.js';
8
+ import type { WorkspaceSvg } from './workspace_svg.js';
8
9
  /**
9
10
  * Returns the HTML container for editor widgets.
10
11
  *
@@ -29,8 +30,9 @@ export declare function createDom(): void;
29
30
  * @param rtl Right-to-left (true) or left-to-right (false).
30
31
  * @param newDispose Optional cleanup function to be run when the widget is
31
32
  * closed.
33
+ * @param workspace The workspace associated with the widget owner.
32
34
  */
33
- export declare function show(newOwner: unknown, rtl: boolean, newDispose: () => void): void;
35
+ export declare function show(newOwner: unknown, rtl: boolean, newDispose: () => void, workspace?: WorkspaceSvg | null): void;
34
36
  /**
35
37
  * Destroy the widget and hide the div.
36
38
  */
@@ -48,6 +50,13 @@ export declare function isVisible(): boolean;
48
50
  * @param oldOwner The object that was using this container.
49
51
  */
50
52
  export declare function hideIfOwner(oldOwner: unknown): void;
53
+ /**
54
+ * Destroy the widget and hide the div if it is being used by an object in the
55
+ * specified workspace, or if it is used by an unknown workspace.
56
+ *
57
+ * @param oldOwnerWorkspace The workspace that was using this container.
58
+ */
59
+ export declare function hideIfOwnerIsInWorkspace(oldOwnerWorkspace: WorkspaceSvg): void;
51
60
  /**
52
61
  * Position the widget div based on an anchor rectangle.
53
62
  * The widget should be placed adjacent to but not overlapping the anchor
@@ -788,7 +788,6 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
788
788
  *
789
789
  * @param x Target X to scroll to.
790
790
  * @param y Target Y to scroll to.
791
- * @internal
792
791
  */
793
792
  scroll(x: number, y: number): void;
794
793
  /**
package/msg/be-tarask.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import be-tarask from './be-tarask.js';
1
+ import be_tarask from './be-tarask.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = be-tarask;
423
+ } = be_tarask;
package/msg/en-gb.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import en-gb from './en-gb.js';
1
+ import en_gb from './en-gb.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = en-gb;
423
+ } = en_gb;
package/msg/kbd-cyrl.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import kbd-cyrl from './kbd-cyrl.js';
1
+ import kbd_cyrl from './kbd-cyrl.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = kbd-cyrl;
423
+ } = kbd_cyrl;
package/msg/ku-latn.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import ku-latn from './ku-latn.js';
1
+ import ku_latn from './ku-latn.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = ku-latn;
423
+ } = ku_latn;
package/msg/pt-br.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import pt-br from './pt-br.js';
1
+ import pt_br from './pt-br.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = pt-br;
423
+ } = pt_br;
package/msg/skr-arab.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import skr-arab from './skr-arab.js';
1
+ import skr_arab from './skr-arab.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = skr-arab;
423
+ } = skr_arab;
package/msg/sr-latn.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import sr-latn from './sr-latn.js';
1
+ import sr_latn from './sr-latn.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = sr-latn;
423
+ } = sr_latn;
package/msg/ug-arab.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import ug-arab from './ug-arab.js';
1
+ import ug_arab from './ug-arab.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = ug-arab;
423
+ } = ug_arab;
package/msg/zh-hans.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import zh-hans from './zh-hans.js';
1
+ import zh_hans from './zh-hans.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = zh-hans;
423
+ } = zh_hans;
package/msg/zh-hant.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import zh-hant from './zh-hant.js';
1
+ import zh_hant from './zh-hant.js';
2
2
  export const {
3
3
  LOGIC_HUE,
4
4
  LOOPS_HUE,
@@ -420,4 +420,4 @@ export const {
420
420
  COLLAPSED_WARNINGS_WARNING,
421
421
  DIALOG_OK,
422
422
  DIALOG_CANCEL,
423
- } = zh-hant;
423
+ } = zh_hant;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "blockly",
3
- "version": "11.0.0",
3
+ "version": "11.1.0",
4
4
  "description": "Blockly is a library for building visual programming editors.",
5
5
  "keywords": [
6
6
  "blockly"
7
7
  ],
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/google/blockly.git"
10
+ "url": "git+https://github.com/google/blockly.git"
11
11
  },
12
12
  "bugs": {
13
13
  "url": "https://github.com/google/blockly/issues"