blockly 11.0.0-beta.7 → 11.0.0-beta.9
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 +344 -364
- package/blockly_compressed.js +321 -341
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +22 -23
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +46 -4
- package/core/block_svg.d.ts +23 -3
- package/core/blockly.d.ts +12 -10
- package/core/clipboard/workspace_comment_paster.d.ts +5 -4
- package/core/comments/comment_view.d.ts +10 -0
- package/core/comments/rendered_workspace_comment.d.ts +16 -1
- package/core/constants.d.ts +5 -0
- package/core/contextmenu.d.ts +1 -34
- package/core/contextmenu_items.d.ts +8 -0
- package/core/contextmenu_registry.d.ts +18 -3
- package/core/dragging/comment_drag_strategy.d.ts +1 -0
- package/core/dragging/dragger.d.ts +5 -4
- package/core/dragging.d.ts +11 -0
- package/core/events/events_block_change.d.ts +15 -0
- package/core/events/utils.d.ts +1 -3
- package/core/gesture.d.ts +5 -0
- package/core/registry.d.ts +5 -1
- package/core/serialization/blocks.d.ts +1 -0
- package/core/serialization/workspace_comments.d.ts +1 -1
- package/core/utils/toolbox.d.ts +1 -0
- package/core/workspace.d.ts +9 -1
- package/core/workspace_svg.d.ts +10 -4
- package/msg/ab.js +1 -0
- package/msg/ace.js +1 -0
- package/msg/af.js +1 -0
- package/msg/am.js +1 -0
- package/msg/ar.js +1 -0
- package/msg/ast.js +1 -0
- package/msg/az.js +1 -0
- package/msg/ba.js +1 -0
- package/msg/bcc.js +1 -0
- package/msg/be-tarask.js +1 -0
- package/msg/be.js +1 -0
- package/msg/bg.js +1 -0
- package/msg/bn.js +1 -0
- package/msg/br.js +1 -0
- package/msg/bs.js +1 -0
- package/msg/ca.js +1 -0
- package/msg/cdo.js +1 -0
- package/msg/ce.js +1 -0
- package/msg/cs.js +1 -0
- package/msg/da.js +1 -0
- package/msg/de.js +1 -0
- package/msg/diq.js +1 -0
- package/msg/dtp.js +1 -0
- package/msg/dty.js +1 -0
- package/msg/ee.js +1 -0
- package/msg/el.js +1 -0
- package/msg/en-gb.js +1 -0
- package/msg/en.js +1 -0
- package/msg/eo.js +1 -0
- package/msg/es.js +1 -0
- package/msg/et.js +1 -0
- package/msg/eu.js +1 -0
- package/msg/fa.js +1 -0
- package/msg/fi.js +1 -0
- package/msg/fo.js +1 -0
- package/msg/fr.js +1 -0
- package/msg/frr.js +1 -0
- package/msg/gl.js +1 -0
- package/msg/gn.js +1 -0
- package/msg/gor.js +1 -0
- package/msg/ha.js +1 -0
- package/msg/hak.js +1 -0
- package/msg/he.js +1 -0
- package/msg/hi.js +1 -0
- package/msg/hr.js +1 -0
- package/msg/hrx.js +1 -0
- package/msg/hsb.js +1 -0
- package/msg/hu.js +1 -0
- package/msg/hy.js +1 -0
- package/msg/ia.js +1 -0
- package/msg/id.js +1 -0
- package/msg/ig.js +1 -0
- package/msg/inh.js +1 -0
- package/msg/is.js +1 -0
- package/msg/it.js +1 -0
- package/msg/ja.js +1 -0
- package/msg/ka.js +1 -0
- package/msg/kab.js +1 -0
- package/msg/kbd-cyrl.js +1 -0
- package/msg/km.js +1 -0
- package/msg/kn.js +1 -0
- package/msg/ko.js +1 -0
- package/msg/ksh.js +1 -0
- package/msg/ku-latn.js +1 -0
- package/msg/ky.js +1 -0
- package/msg/la.js +1 -0
- package/msg/lb.js +1 -0
- package/msg/lki.js +1 -0
- package/msg/lo.js +1 -0
- package/msg/lrc.js +1 -0
- package/msg/lt.js +1 -0
- package/msg/lv.js +1 -0
- package/msg/mg.js +1 -0
- package/msg/mk.js +1 -0
- package/msg/ml.js +1 -0
- package/msg/mnw.js +1 -0
- package/msg/ms.js +1 -0
- package/msg/my.js +1 -0
- package/msg/mzn.js +1 -0
- package/msg/nb.js +1 -0
- package/msg/ne.js +1 -0
- package/msg/nl.js +1 -0
- package/msg/oc.js +1 -0
- package/msg/olo.js +1 -0
- package/msg/pa.js +1 -0
- package/msg/pl.js +1 -0
- package/msg/pms.js +1 -0
- package/msg/ps.js +1 -0
- package/msg/pt-br.js +1 -0
- package/msg/pt.js +1 -0
- package/msg/ro.js +1 -0
- package/msg/ru.js +1 -0
- package/msg/sc.js +1 -0
- package/msg/sco.js +1 -0
- package/msg/sd.js +1 -0
- package/msg/shn.js +1 -0
- package/msg/si.js +1 -0
- package/msg/sk.js +1 -0
- package/msg/skr-arab.js +1 -0
- package/msg/sl.js +1 -0
- package/msg/smn.js +1 -0
- package/msg/sq.js +1 -0
- package/msg/sr-latn.js +1 -0
- package/msg/sr.js +1 -0
- package/msg/sv.js +1 -0
- package/msg/sw.js +1 -0
- package/msg/ta.js +1 -0
- package/msg/tcy.js +1 -0
- package/msg/tdd.js +1 -0
- package/msg/te.js +1 -0
- package/msg/th.js +1 -0
- package/msg/ti.js +1 -0
- package/msg/tl.js +1 -0
- package/msg/tlh.js +1 -0
- package/msg/tr.js +1 -0
- package/msg/ug-arab.js +1 -0
- package/msg/uk.js +1 -0
- package/msg/ur.js +1 -0
- package/msg/uz.js +1 -0
- package/msg/vi.js +1 -0
- package/msg/xmf.js +1 -0
- package/msg/yo.js +1 -0
- package/msg/zgh.js +1 -0
- package/msg/zh-hans.js +1 -0
- package/msg/zh-hant.js +1 -0
- package/package.json +1 -1
- package/core/workspace_comment.d.ts +0 -190
- package/core/workspace_comment_svg.d.ts +0 -360
package/core/block.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ export declare class Block implements IASTNodeLocation {
|
|
|
123
123
|
inputList: Input[];
|
|
124
124
|
inputsInline?: boolean;
|
|
125
125
|
icons: IIcon[];
|
|
126
|
-
private
|
|
126
|
+
private disabledReasons;
|
|
127
127
|
tooltip: Tooltip.TipInfo;
|
|
128
128
|
contextMenu: boolean;
|
|
129
129
|
protected parentBlock_: this | null;
|
|
@@ -627,17 +627,44 @@ export declare class Block implements IASTNodeLocation {
|
|
|
627
627
|
*/
|
|
628
628
|
getOutputShape(): number | null;
|
|
629
629
|
/**
|
|
630
|
-
* Get whether this block is enabled or not.
|
|
630
|
+
* Get whether this block is enabled or not. A block is considered enabled
|
|
631
|
+
* if there aren't any reasons why it would be disabled. A block may still
|
|
632
|
+
* be disabled for other reasons even if the user attempts to manually
|
|
633
|
+
* enable it, such as when the block is in an invalid location.
|
|
631
634
|
*
|
|
632
635
|
* @returns True if enabled.
|
|
633
636
|
*/
|
|
634
637
|
isEnabled(): boolean;
|
|
635
|
-
/**
|
|
636
|
-
|
|
638
|
+
/** @deprecated v11 - Get whether the block is manually disabled. */
|
|
639
|
+
private get disabled();
|
|
640
|
+
/** @deprecated v11 - Set whether the block is manually disabled. */
|
|
641
|
+
private set disabled(value);
|
|
642
|
+
/**
|
|
643
|
+
* @deprecated v11 - Set whether the block is manually enabled or disabled.
|
|
644
|
+
* The user can toggle whether a block is disabled from a context menu
|
|
645
|
+
* option. A block may still be disabled for other reasons even if the user
|
|
646
|
+
* attempts to manually enable it, such as when the block is in an invalid
|
|
647
|
+
* location. This method is deprecated and setDisabledReason should be used
|
|
648
|
+
* instead.
|
|
637
649
|
*
|
|
638
650
|
* @param enabled True if enabled.
|
|
639
651
|
*/
|
|
640
652
|
setEnabled(enabled: boolean): void;
|
|
653
|
+
/**
|
|
654
|
+
* Add or remove a reason why the block might be disabled. If a block has
|
|
655
|
+
* any reasons to be disabled, then the block itself will be considered
|
|
656
|
+
* disabled. A block could be disabled for multiple independent reasons
|
|
657
|
+
* simultaneously, such as when the user manually disables it, or the block
|
|
658
|
+
* is invalid.
|
|
659
|
+
*
|
|
660
|
+
* @param disabled If true, then the block should be considered disabled for
|
|
661
|
+
* at least the provided reason, otherwise the block is no longer disabled
|
|
662
|
+
* for that reason.
|
|
663
|
+
* @param reason A language-neutral identifier for a reason why the block
|
|
664
|
+
* could be disabled. Call this method again with the same identifier to
|
|
665
|
+
* update whether the block is currently disabled for this reason.
|
|
666
|
+
*/
|
|
667
|
+
setDisabledReason(disabled: boolean, reason: string): void;
|
|
641
668
|
/**
|
|
642
669
|
* Get whether the block is disabled or not due to parents.
|
|
643
670
|
* The block's own disabled property is not considered.
|
|
@@ -645,6 +672,21 @@ export declare class Block implements IASTNodeLocation {
|
|
|
645
672
|
* @returns True if disabled.
|
|
646
673
|
*/
|
|
647
674
|
getInheritedDisabled(): boolean;
|
|
675
|
+
/**
|
|
676
|
+
* Get whether the block is currently disabled for the provided reason.
|
|
677
|
+
*
|
|
678
|
+
* @param reason A language-neutral identifier for a reason why the block
|
|
679
|
+
* could be disabled.
|
|
680
|
+
* @returns Whether the block is disabled for the provided reason.
|
|
681
|
+
*/
|
|
682
|
+
hasDisabledReason(reason: string): boolean;
|
|
683
|
+
/**
|
|
684
|
+
* Get a set of reasons why the block is currently disabled, if any. If the
|
|
685
|
+
* block is enabled, this set will be empty.
|
|
686
|
+
*
|
|
687
|
+
* @returns The set of reasons why the block is disabled, if any.
|
|
688
|
+
*/
|
|
689
|
+
getDisabledReasons(): ReadonlySet<string>;
|
|
648
690
|
/**
|
|
649
691
|
* Get whether the block is collapsed or not.
|
|
650
692
|
*
|
package/core/block_svg.d.ts
CHANGED
|
@@ -238,7 +238,7 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
238
238
|
* @param e Mouse event.
|
|
239
239
|
* @internal
|
|
240
240
|
*/
|
|
241
|
-
showContextMenu(e:
|
|
241
|
+
showContextMenu(e: PointerEvent): void;
|
|
242
242
|
/**
|
|
243
243
|
* Updates the locations of any parts of the block that need to know where
|
|
244
244
|
* they are (e.g. connections, icons).
|
|
@@ -356,11 +356,31 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
356
356
|
private createIconPointerDownListener;
|
|
357
357
|
removeIcon(type: IconType<IIcon>): boolean;
|
|
358
358
|
/**
|
|
359
|
-
* Set whether the block is enabled or
|
|
359
|
+
* @deprecated v11 - Set whether the block is manually enabled or disabled.
|
|
360
|
+
* The user can toggle whether a block is disabled from a context menu
|
|
361
|
+
* option. A block may still be disabled for other reasons even if the user
|
|
362
|
+
* attempts to manually enable it, such as when the block is in an invalid
|
|
363
|
+
* location. This method is deprecated and setDisabledReason should be used
|
|
364
|
+
* instead.
|
|
360
365
|
*
|
|
361
366
|
* @param enabled True if enabled.
|
|
362
367
|
*/
|
|
363
368
|
setEnabled(enabled: boolean): void;
|
|
369
|
+
/**
|
|
370
|
+
* Add or remove a reason why the block might be disabled. If a block has
|
|
371
|
+
* any reasons to be disabled, then the block itself will be considered
|
|
372
|
+
* disabled. A block could be disabled for multiple independent reasons
|
|
373
|
+
* simultaneously, such as when the user manually disables it, or the block
|
|
374
|
+
* is invalid.
|
|
375
|
+
*
|
|
376
|
+
* @param disabled If true, then the block should be considered disabled for
|
|
377
|
+
* at least the provided reason, otherwise the block is no longer disabled
|
|
378
|
+
* for that reason.
|
|
379
|
+
* @param reason A language-neutral identifier for a reason why the block
|
|
380
|
+
* could be disabled. Call this method again with the same identifier to
|
|
381
|
+
* update whether the block is currently disabled for this reason.
|
|
382
|
+
*/
|
|
383
|
+
setDisabledReason(disabled: boolean, reason: string): void;
|
|
364
384
|
/**
|
|
365
385
|
* Set whether the block is highlighted or not. Block highlighting is
|
|
366
386
|
* often used to visually mark blocks currently being executed.
|
|
@@ -659,6 +679,6 @@ export declare class BlockSvg extends Block implements IASTNodeLocationSvg, IBou
|
|
|
659
679
|
/**
|
|
660
680
|
* Returns a representation of this block that can be displayed in a flyout.
|
|
661
681
|
*/
|
|
662
|
-
|
|
682
|
+
toFlyoutInfo(): FlyoutItemInfo[];
|
|
663
683
|
}
|
|
664
684
|
//# sourceMappingURL=block_svg.d.ts.map
|
package/core/blockly.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import * as comments from './comments.js';
|
|
|
30
30
|
import * as Css from './css.js';
|
|
31
31
|
import { DeleteArea } from './delete_area.js';
|
|
32
32
|
import * as dialog from './dialog.js';
|
|
33
|
-
import
|
|
33
|
+
import * as dragging from './dragging.js';
|
|
34
34
|
import { DragTarget } from './drag_target.js';
|
|
35
35
|
import * as dropDownDiv from './dropdowndiv.js';
|
|
36
36
|
import * as Events from './events/events.js';
|
|
@@ -70,11 +70,12 @@ import { IComponent } from './interfaces/i_component.js';
|
|
|
70
70
|
import { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
71
71
|
import { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
72
72
|
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
73
|
-
import { ICopyable, isCopyable } from './interfaces/i_copyable.js';
|
|
73
|
+
import { ICopyable, isCopyable, ICopyData } from './interfaces/i_copyable.js';
|
|
74
74
|
import { IDeletable, isDeletable } from './interfaces/i_deletable.js';
|
|
75
75
|
import { IDeleteArea } from './interfaces/i_delete_area.js';
|
|
76
76
|
import { IDragTarget } from './interfaces/i_drag_target.js';
|
|
77
|
-
import {
|
|
77
|
+
import { IDragger } from './interfaces/i_dragger.js';
|
|
78
|
+
import { IDraggable, isDraggable, IDragStrategy } from './interfaces/i_draggable.js';
|
|
78
79
|
import { IFlyout } from './interfaces/i_flyout.js';
|
|
79
80
|
import { IHasBubble, hasBubble } from './interfaces/i_has_bubble.js';
|
|
80
81
|
import { IIcon, isIcon } from './interfaces/i_icon.js';
|
|
@@ -85,6 +86,7 @@ import { IObservable, isObservable } from './interfaces/i_observable.js';
|
|
|
85
86
|
import { IPaster, isPaster } from './interfaces/i_paster.js';
|
|
86
87
|
import { IPositionable } from './interfaces/i_positionable.js';
|
|
87
88
|
import { IRegistrable } from './interfaces/i_registrable.js';
|
|
89
|
+
import { IRenderedElement, isRenderedElement } from './interfaces/i_rendered_element.js';
|
|
88
90
|
import { ISelectable, isSelectable } from './interfaces/i_selectable.js';
|
|
89
91
|
import { ISelectableToolboxItem } from './interfaces/i_selectable_toolbox_item.js';
|
|
90
92
|
import { ISerializable, isSerializable } from './interfaces/i_serializable.js';
|
|
@@ -98,6 +100,7 @@ import { Cursor } from './keyboard_nav/cursor.js';
|
|
|
98
100
|
import { Marker } from './keyboard_nav/marker.js';
|
|
99
101
|
import { TabNavigateCursor } from './keyboard_nav/tab_navigate_cursor.js';
|
|
100
102
|
import { MarkerManager } from './marker_manager.js';
|
|
103
|
+
import type { LayerManager } from './layer_manager.js';
|
|
101
104
|
import { Menu } from './menu.js';
|
|
102
105
|
import { MenuItem } from './menuitem.js';
|
|
103
106
|
import { MetricsManager } from './metrics_manager.js';
|
|
@@ -138,8 +141,6 @@ import * as VariablesDynamic from './variables_dynamic.js';
|
|
|
138
141
|
import * as WidgetDiv from './widgetdiv.js';
|
|
139
142
|
import { Workspace } from './workspace.js';
|
|
140
143
|
import { WorkspaceAudio } from './workspace_audio.js';
|
|
141
|
-
import { WorkspaceComment } from './workspace_comment.js';
|
|
142
|
-
import { WorkspaceCommentSvg } from './workspace_comment_svg.js';
|
|
143
144
|
import { WorkspaceDragger } from './workspace_dragger.js';
|
|
144
145
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
145
146
|
import * as Xml from './xml.js';
|
|
@@ -307,7 +308,7 @@ export { ContextMenuRegistry };
|
|
|
307
308
|
export { comments };
|
|
308
309
|
export { Cursor };
|
|
309
310
|
export { DeleteArea };
|
|
310
|
-
export {
|
|
311
|
+
export { dragging };
|
|
311
312
|
export { DragTarget };
|
|
312
313
|
export declare const DropDownDiv: typeof dropDownDiv;
|
|
313
314
|
export { Field, FieldConfig, FieldValidator, UnattachedFieldError };
|
|
@@ -339,11 +340,12 @@ export { IConnectionChecker };
|
|
|
339
340
|
export { IConnectionPreviewer };
|
|
340
341
|
export { IContextMenu };
|
|
341
342
|
export { icons };
|
|
342
|
-
export { ICopyable, isCopyable };
|
|
343
|
+
export { ICopyable, isCopyable, ICopyData };
|
|
343
344
|
export { IDeletable, isDeletable };
|
|
344
345
|
export { IDeleteArea };
|
|
345
346
|
export { IDragTarget };
|
|
346
|
-
export {
|
|
347
|
+
export { IDragger };
|
|
348
|
+
export { IDraggable, isDraggable, IDragStrategy };
|
|
347
349
|
export { IFlyout };
|
|
348
350
|
export { IHasBubble, hasBubble };
|
|
349
351
|
export { IIcon, isIcon };
|
|
@@ -358,6 +360,7 @@ export { IObservable, isObservable };
|
|
|
358
360
|
export { IPaster, isPaster };
|
|
359
361
|
export { IPositionable };
|
|
360
362
|
export { IRegistrable };
|
|
363
|
+
export { IRenderedElement, isRenderedElement };
|
|
361
364
|
export { ISelectable, isSelectable };
|
|
362
365
|
export { ISelectableToolboxItem };
|
|
363
366
|
export { ISerializable, isSerializable };
|
|
@@ -367,6 +370,7 @@ export { IToolboxItem };
|
|
|
367
370
|
export { IVariableBackedParameterModel, isVariableBackedParameterModel };
|
|
368
371
|
export { Marker };
|
|
369
372
|
export { MarkerManager };
|
|
373
|
+
export { LayerManager };
|
|
370
374
|
export { Menu };
|
|
371
375
|
export { MenuItem };
|
|
372
376
|
export { MetricsManager };
|
|
@@ -391,8 +395,6 @@ export { VariableModel };
|
|
|
391
395
|
export { VerticalFlyout };
|
|
392
396
|
export { Workspace };
|
|
393
397
|
export { WorkspaceAudio };
|
|
394
|
-
export { WorkspaceComment };
|
|
395
|
-
export { WorkspaceCommentSvg };
|
|
396
398
|
export { WorkspaceDragger };
|
|
397
399
|
export { WorkspaceSvg };
|
|
398
400
|
export { ZoomControls };
|
|
@@ -7,12 +7,13 @@ import { IPaster } from '../interfaces/i_paster.js';
|
|
|
7
7
|
import { ICopyData } from '../interfaces/i_copyable.js';
|
|
8
8
|
import { Coordinate } from '../utils/coordinate.js';
|
|
9
9
|
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
10
|
-
import
|
|
11
|
-
|
|
10
|
+
import * as commentSerialiation from '../serialization/workspace_comments.js';
|
|
11
|
+
import { RenderedWorkspaceComment } from '../comments/rendered_workspace_comment.js';
|
|
12
|
+
export declare class WorkspaceCommentPaster implements IPaster<WorkspaceCommentCopyData, RenderedWorkspaceComment> {
|
|
12
13
|
static TYPE: string;
|
|
13
|
-
paste(copyData: WorkspaceCommentCopyData, workspace: WorkspaceSvg, coordinate?: Coordinate):
|
|
14
|
+
paste(copyData: WorkspaceCommentCopyData, workspace: WorkspaceSvg, coordinate?: Coordinate): RenderedWorkspaceComment | null;
|
|
14
15
|
}
|
|
15
16
|
export interface WorkspaceCommentCopyData extends ICopyData {
|
|
16
|
-
commentState:
|
|
17
|
+
commentState: commentSerialiation.State;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=workspace_comment_paster.d.ts.map
|
|
@@ -11,6 +11,10 @@ export declare class CommentView implements IRenderedElement {
|
|
|
11
11
|
private readonly workspace;
|
|
12
12
|
/** The root group element of the comment view. */
|
|
13
13
|
private svgRoot;
|
|
14
|
+
/**
|
|
15
|
+
* The svg rect element that we use to create a hightlight around the comment.
|
|
16
|
+
*/
|
|
17
|
+
private highlightRect;
|
|
14
18
|
/** The group containing all of the top bar elements. */
|
|
15
19
|
private topBarGroup;
|
|
16
20
|
/** The rect background for the top bar. */
|
|
@@ -62,6 +66,10 @@ export declare class CommentView implements IRenderedElement {
|
|
|
62
66
|
/** Whether this comment view has been disposed or not. */
|
|
63
67
|
private disposed;
|
|
64
68
|
constructor(workspace: WorkspaceSvg);
|
|
69
|
+
/**
|
|
70
|
+
* Creates the rect we use for highlighting the comment when it's selected.
|
|
71
|
+
*/
|
|
72
|
+
private createHighlightRect;
|
|
65
73
|
/**
|
|
66
74
|
* Creates the top bar and the elements visually within it.
|
|
67
75
|
* Registers event listeners.
|
|
@@ -95,6 +103,8 @@ export declare class CommentView implements IRenderedElement {
|
|
|
95
103
|
private calcDeleteMargin;
|
|
96
104
|
/** Calculates the margin that should exist around the foldout icon. */
|
|
97
105
|
private calcFoldoutMargin;
|
|
106
|
+
/** Updates the size of the highlight rect to reflect the new size. */
|
|
107
|
+
private updateHighlightRect;
|
|
98
108
|
/** Updates the size of the top bar to reflect the new size. */
|
|
99
109
|
private updateTopBarSize;
|
|
100
110
|
/** Updates the size of the text area elements to reflect the new size. */
|
|
@@ -12,7 +12,11 @@ import { IBoundedElement } from '../interfaces/i_bounded_element.js';
|
|
|
12
12
|
import { IRenderedElement } from '../interfaces/i_rendered_element.js';
|
|
13
13
|
import { IDraggable } from '../interfaces/i_draggable.js';
|
|
14
14
|
import { ISelectable } from '../interfaces/i_selectable.js';
|
|
15
|
-
|
|
15
|
+
import { IDeletable } from '../interfaces/i_deletable.js';
|
|
16
|
+
import { ICopyable } from '../interfaces/i_copyable.js';
|
|
17
|
+
import { WorkspaceCommentCopyData } from '../clipboard/workspace_comment_paster.js';
|
|
18
|
+
import { IContextMenu } from '../interfaces/i_contextmenu.js';
|
|
19
|
+
export declare class RenderedWorkspaceComment extends WorkspaceComment implements IBoundedElement, IRenderedElement, IDraggable, ISelectable, IDeletable, ICopyable<WorkspaceCommentCopyData>, IContextMenu {
|
|
16
20
|
/** The class encompassing the svg elements making up the workspace comment. */
|
|
17
21
|
private view;
|
|
18
22
|
readonly workspace: WorkspaceSvg;
|
|
@@ -59,6 +63,8 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
59
63
|
* (that wasn't otherwise gobbled up, e.g. by resizing).
|
|
60
64
|
*/
|
|
61
65
|
private startGesture;
|
|
66
|
+
/** Visually indicates that this comment would be deleted if dropped. */
|
|
67
|
+
setDeleteStyle(wouldDelete: boolean): void;
|
|
62
68
|
/** Returns whether this comment is movable or not. */
|
|
63
69
|
isMovable(): boolean;
|
|
64
70
|
/** Starts a drag on the comment. */
|
|
@@ -69,7 +75,16 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
69
75
|
endDrag(): void;
|
|
70
76
|
/** Moves the comment back to where it was at the start of a drag. */
|
|
71
77
|
revertDrag(): void;
|
|
78
|
+
/** Visually highlights the comment. */
|
|
72
79
|
select(): void;
|
|
80
|
+
/** Visually unhighlights the comment. */
|
|
73
81
|
unselect(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Returns a JSON serializable representation of this comment's state that
|
|
84
|
+
* can be used for pasting.
|
|
85
|
+
*/
|
|
86
|
+
toCopyData(): WorkspaceCommentCopyData | null;
|
|
87
|
+
/** Show a context menu for this comment. */
|
|
88
|
+
showContextMenu(e: PointerEvent): void;
|
|
74
89
|
}
|
|
75
90
|
//# sourceMappingURL=rendered_workspace_comment.d.ts.map
|
package/core/constants.d.ts
CHANGED
|
@@ -11,4 +11,9 @@ export declare const COLLAPSED_INPUT_NAME = "_TEMP_COLLAPSED_INPUT";
|
|
|
11
11
|
* The language-neutral ID given to the collapsed field.
|
|
12
12
|
*/
|
|
13
13
|
export declare const COLLAPSED_FIELD_NAME = "_TEMP_COLLAPSED_FIELD";
|
|
14
|
+
/**
|
|
15
|
+
* The language-neutral ID for when the reason why a block is disabled is
|
|
16
|
+
* because the user manually disabled it, such as via the context menu.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MANUALLY_DISABLED = "MANUALLY_DISABLED";
|
|
14
19
|
//# sourceMappingURL=constants.d.ts.map
|
package/core/contextmenu.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ 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 { WorkspaceCommentSvg } from './workspace_comment_svg.js';
|
|
11
|
-
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
12
10
|
/**
|
|
13
11
|
* Gets the block the context menu is currently attached to.
|
|
14
12
|
*
|
|
@@ -28,7 +26,7 @@ export declare function setCurrentBlock(block: Block | null): void;
|
|
|
28
26
|
* @param options Array of menu options.
|
|
29
27
|
* @param rtl True if RTL, false if LTR.
|
|
30
28
|
*/
|
|
31
|
-
export declare function show(e:
|
|
29
|
+
export declare function show(e: PointerEvent, options: (ContextMenuOption | LegacyContextMenuOption)[], rtl: boolean): void;
|
|
32
30
|
/**
|
|
33
31
|
* Hide the context menu.
|
|
34
32
|
*/
|
|
@@ -46,35 +44,4 @@ export declare function dispose(): void;
|
|
|
46
44
|
* @returns Function that creates a block.
|
|
47
45
|
*/
|
|
48
46
|
export declare function callbackFactory(block: Block, state: Element | serializationBlocks.State): () => BlockSvg;
|
|
49
|
-
/**
|
|
50
|
-
* Make a context menu option for deleting the current workspace comment.
|
|
51
|
-
*
|
|
52
|
-
* @param comment The workspace comment where the
|
|
53
|
-
* right-click originated.
|
|
54
|
-
* @returns A menu option,
|
|
55
|
-
* containing text, enabled, and a callback.
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
export declare function commentDeleteOption(comment: WorkspaceCommentSvg): LegacyContextMenuOption;
|
|
59
|
-
/**
|
|
60
|
-
* Make a context menu option for duplicating the current workspace comment.
|
|
61
|
-
*
|
|
62
|
-
* @param comment The workspace comment where the
|
|
63
|
-
* right-click originated.
|
|
64
|
-
* @returns A menu option,
|
|
65
|
-
* containing text, enabled, and a callback.
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
export declare function commentDuplicateOption(comment: WorkspaceCommentSvg): LegacyContextMenuOption;
|
|
69
|
-
/**
|
|
70
|
-
* Make a context menu option for adding a comment on the workspace.
|
|
71
|
-
*
|
|
72
|
-
* @param ws The workspace where the right-click
|
|
73
|
-
* originated.
|
|
74
|
-
* @param e The right-click mouse event.
|
|
75
|
-
* @returns A menu option, containing text, enabled, and a callback.
|
|
76
|
-
* comments are not bundled in.
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
|
-
export declare function workspaceCommentOption(ws: WorkspaceSvg, e: Event): ContextMenuOption;
|
|
80
47
|
//# sourceMappingURL=contextmenu.d.ts.map
|
|
@@ -55,6 +55,14 @@ export declare function registerDelete(): void;
|
|
|
55
55
|
* Option to open help for a block.
|
|
56
56
|
*/
|
|
57
57
|
export declare function registerHelp(): void;
|
|
58
|
+
/** Registers an option for deleting a workspace comment. */
|
|
59
|
+
export declare function registerCommentDelete(): void;
|
|
60
|
+
/** Registers an option for duplicating a workspace comment. */
|
|
61
|
+
export declare function registerCommentDuplicate(): void;
|
|
62
|
+
/** Registers an option for adding a workspace comment to the workspace. */
|
|
63
|
+
export declare function registerCommentCreate(): void;
|
|
64
|
+
/** Registers all workspace comment related menu items. */
|
|
65
|
+
export declare function registerCommentOptions(): void;
|
|
58
66
|
/**
|
|
59
67
|
* Registers all default context menu items. This should be called once per
|
|
60
68
|
* instance of ContextMenuRegistry.
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
11
|
import type { BlockSvg } from './block_svg.js';
|
|
12
|
+
import { RenderedWorkspaceComment } from './comments/rendered_workspace_comment.js';
|
|
12
13
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
13
14
|
/**
|
|
14
15
|
* Class for the registry of context menu items. This is intended to be a
|
|
@@ -63,7 +64,8 @@ export declare namespace ContextMenuRegistry {
|
|
|
63
64
|
*/
|
|
64
65
|
enum ScopeType {
|
|
65
66
|
BLOCK = "block",
|
|
66
|
-
WORKSPACE = "workspace"
|
|
67
|
+
WORKSPACE = "workspace",
|
|
68
|
+
COMMENT = "comment"
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
69
71
|
* The actual workspace/block where the menu is being rendered. This is passed
|
|
@@ -72,12 +74,19 @@ export declare namespace ContextMenuRegistry {
|
|
|
72
74
|
interface Scope {
|
|
73
75
|
block?: BlockSvg;
|
|
74
76
|
workspace?: WorkspaceSvg;
|
|
77
|
+
comment?: RenderedWorkspaceComment;
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
77
80
|
* A menu item as entered in the registry.
|
|
78
81
|
*/
|
|
79
82
|
interface RegistryItem {
|
|
80
|
-
|
|
83
|
+
/**
|
|
84
|
+
* @param scope Object that provides a reference to the thing that had its
|
|
85
|
+
* context menu opened.
|
|
86
|
+
* @param e The original event that triggered the context menu to open. Not
|
|
87
|
+
* the event that triggered the click on the option.
|
|
88
|
+
*/
|
|
89
|
+
callback: (scope: Scope, e: PointerEvent) => void;
|
|
81
90
|
scopeType: ScopeType;
|
|
82
91
|
displayText: ((p1: Scope) => string | HTMLElement) | string | HTMLElement;
|
|
83
92
|
preconditionFn: (p1: Scope) => string;
|
|
@@ -90,7 +99,13 @@ export declare namespace ContextMenuRegistry {
|
|
|
90
99
|
interface ContextMenuOption {
|
|
91
100
|
text: string | HTMLElement;
|
|
92
101
|
enabled: boolean;
|
|
93
|
-
|
|
102
|
+
/**
|
|
103
|
+
* @param scope Object that provides a reference to the thing that had its
|
|
104
|
+
* context menu opened.
|
|
105
|
+
* @param e The original event that triggered the context menu to open. Not
|
|
106
|
+
* the event that triggered the click on the option.
|
|
107
|
+
*/
|
|
108
|
+
callback: (scope: Scope, e: PointerEvent) => void;
|
|
94
109
|
scope: Scope;
|
|
95
110
|
weight: number;
|
|
96
111
|
}
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
* Copyright 2024 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { IDragTarget } from '../interfaces/i_drag_target.js';
|
|
6
7
|
import { IDeletable } from '../interfaces/i_deletable.js';
|
|
7
8
|
import { IDragger } from '../interfaces/i_dragger.js';
|
|
8
9
|
import { IDraggable } from '../interfaces/i_draggable.js';
|
|
9
10
|
import { Coordinate } from '../utils/coordinate.js';
|
|
10
11
|
import { WorkspaceSvg } from '../workspace_svg.js';
|
|
11
12
|
export declare class Dragger implements IDragger {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
protected draggable: IDraggable;
|
|
14
|
+
protected workspace: WorkspaceSvg;
|
|
15
|
+
protected startLoc: Coordinate;
|
|
16
|
+
protected dragTarget: IDragTarget | null;
|
|
16
17
|
constructor(draggable: IDraggable, workspace: WorkspaceSvg);
|
|
17
18
|
/** Handles any drag startup. */
|
|
18
19
|
onDragStart(e: PointerEvent): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2024 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Dragger } from './dragging/dragger.js';
|
|
7
|
+
import { BlockDragStrategy } from './dragging/block_drag_strategy.js';
|
|
8
|
+
import { BubbleDragStrategy } from './dragging/bubble_drag_strategy.js';
|
|
9
|
+
import { CommentDragStrategy } from './dragging/comment_drag_strategy.js';
|
|
10
|
+
export { Dragger, BlockDragStrategy, BubbleDragStrategy, CommentDragStrategy };
|
|
11
|
+
//# sourceMappingURL=dragging.d.ts.map
|
|
@@ -29,6 +29,11 @@ export declare class BlockChange extends BlockBase {
|
|
|
29
29
|
oldValue: unknown;
|
|
30
30
|
/** The new value of the element. */
|
|
31
31
|
newValue: unknown;
|
|
32
|
+
/**
|
|
33
|
+
* If element is 'disabled', this is the language-neutral identifier of the
|
|
34
|
+
* reason why the block was or was not disabled.
|
|
35
|
+
*/
|
|
36
|
+
private disabledReason?;
|
|
32
37
|
/**
|
|
33
38
|
* @param opt_block The changed block. Undefined for a blank event.
|
|
34
39
|
* @param opt_element One of 'field', 'comment', 'disabled', etc.
|
|
@@ -53,6 +58,15 @@ export declare class BlockChange extends BlockBase {
|
|
|
53
58
|
* @internal
|
|
54
59
|
*/
|
|
55
60
|
static fromJson(json: BlockChangeJson, workspace: Workspace, event?: any): BlockChange;
|
|
61
|
+
/**
|
|
62
|
+
* Set the language-neutral identifier for the reason why the block was or was
|
|
63
|
+
* not disabled. This is only valid for events where element is 'disabled'.
|
|
64
|
+
* Defaults to 'MANUALLY_DISABLED'.
|
|
65
|
+
*
|
|
66
|
+
* @param disabledReason The identifier of the reason why the block was or was
|
|
67
|
+
* not disabled.
|
|
68
|
+
*/
|
|
69
|
+
setDisabledReason(disabledReason: string): void;
|
|
56
70
|
/**
|
|
57
71
|
* Does this event record any change of state?
|
|
58
72
|
*
|
|
@@ -80,5 +94,6 @@ export interface BlockChangeJson extends BlockBaseJson {
|
|
|
80
94
|
name?: string;
|
|
81
95
|
newValue: unknown;
|
|
82
96
|
oldValue: unknown;
|
|
97
|
+
disabledReason?: string;
|
|
83
98
|
}
|
|
84
99
|
//# sourceMappingURL=events_block_change.d.ts.map
|
package/core/events/utils.d.ts
CHANGED
|
@@ -231,10 +231,8 @@ export declare function fromJson(json: any, workspace: Workspace): Abstract;
|
|
|
231
231
|
*/
|
|
232
232
|
export declare function get(eventType: string): new (...p1: any[]) => Abstract;
|
|
233
233
|
/**
|
|
234
|
-
*
|
|
234
|
+
* Set if a block is disabled depending on whether it is properly connected.
|
|
235
235
|
* Use this on applications where all blocks should be connected to a top block.
|
|
236
|
-
* Recommend setting the 'disable' option to 'false' in the config so that
|
|
237
|
-
* users don't try to re-enable disabled orphan blocks.
|
|
238
236
|
*
|
|
239
237
|
* @param event Custom data for event.
|
|
240
238
|
*/
|
package/core/gesture.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ import type { Field } from './field.js';
|
|
|
15
15
|
import type { IBubble } from './interfaces/i_bubble.js';
|
|
16
16
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
17
17
|
import { Coordinate } from './utils/coordinate.js';
|
|
18
|
+
import { WorkspaceDragger } from './workspace_dragger.js';
|
|
18
19
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
19
20
|
import type { IIcon } from './interfaces/i_icon.js';
|
|
21
|
+
import { IDragger } from './interfaces/i_dragger.js';
|
|
20
22
|
import { RenderedWorkspaceComment } from './comments.js';
|
|
21
23
|
/**
|
|
22
24
|
* Class for one gesture.
|
|
@@ -398,6 +400,7 @@ export declare class Gesture {
|
|
|
398
400
|
* @returns Whether this gesture was a click on a bubble.
|
|
399
401
|
*/
|
|
400
402
|
private isBubbleClick;
|
|
403
|
+
private isCommentClick;
|
|
401
404
|
/**
|
|
402
405
|
* Whether this gesture is a click on a block. This should only be called
|
|
403
406
|
* when ending a gesture (pointerup).
|
|
@@ -421,6 +424,8 @@ export declare class Gesture {
|
|
|
421
424
|
* @returns Whether this gesture was a click on a workspace.
|
|
422
425
|
*/
|
|
423
426
|
private isWorkspaceClick;
|
|
427
|
+
/** Returns the current dragger if the gesture is a drag. */
|
|
428
|
+
getCurrentDragger(): WorkspaceDragger | IDragger | null;
|
|
424
429
|
/**
|
|
425
430
|
* Whether this gesture is a drag of either a workspace or block.
|
|
426
431
|
* This function is called externally to block actions that cannot be taken
|
package/core/registry.d.ts
CHANGED
|
@@ -58,7 +58,11 @@ export declare class Type<_T> {
|
|
|
58
58
|
static FLYOUTS_VERTICAL_TOOLBOX: Type<IFlyout>;
|
|
59
59
|
static FLYOUTS_HORIZONTAL_TOOLBOX: Type<IFlyout>;
|
|
60
60
|
static METRICS_MANAGER: Type<IMetricsManager>;
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Type for an IDragger. Formerly behavior was mostly covered by
|
|
63
|
+
* BlockDraggeers, which is why the name is inaccurate.
|
|
64
|
+
*/
|
|
65
|
+
static BLOCK_DRAGGER: Type<IDragger>;
|
|
62
66
|
/** @internal */
|
|
63
67
|
static SERIALIZER: Type<ISerializer>;
|
|
64
68
|
/** @internal */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ISerializer } from '../interfaces/i_serializer.js';
|
|
7
7
|
import { Workspace } from '../workspace.js';
|
|
8
|
-
import { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
8
|
+
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
9
9
|
export interface State {
|
|
10
10
|
id?: string;
|
|
11
11
|
text?: string;
|
package/core/utils/toolbox.d.ts
CHANGED
package/core/workspace.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { Options } from './options.js';
|
|
|
18
18
|
import type * as toolbox from './utils/toolbox.js';
|
|
19
19
|
import { VariableMap } from './variable_map.js';
|
|
20
20
|
import type { VariableModel } from './variable_model.js';
|
|
21
|
-
import
|
|
21
|
+
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
22
22
|
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
23
23
|
/**
|
|
24
24
|
* Class for a workspace. This is a data structure that contains blocks.
|
|
@@ -279,6 +279,14 @@ export declare class Workspace implements IASTNodeLocation {
|
|
|
279
279
|
* @returns The created block.
|
|
280
280
|
*/
|
|
281
281
|
newBlock(prototypeName: string, opt_id?: string): Block;
|
|
282
|
+
/**
|
|
283
|
+
* Obtain a newly created comment.
|
|
284
|
+
*
|
|
285
|
+
* @param id Optional ID. Use this ID if provided, otherwise create a new
|
|
286
|
+
* ID.
|
|
287
|
+
* @returns The created comment.
|
|
288
|
+
*/
|
|
289
|
+
newComment(id?: string): WorkspaceComment;
|
|
282
290
|
/**
|
|
283
291
|
* The number of blocks that may be added to the workspace before reaching
|
|
284
292
|
* the maxBlocks.
|