blockly 11.0.0-beta.8 → 11.0.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/blockly.min.js +456 -475
- package/blockly.mjs +143 -0
- package/blockly_compressed.js +426 -445
- package/blockly_compressed.js.map +1 -1
- package/blocks.js +4 -0
- package/blocks.mjs +12 -0
- package/blocks_compressed.js +22 -23
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +52 -4
- package/core/block_svg.d.ts +22 -2
- package/core/blockly.d.ts +0 -4
- package/core/clipboard/block_paster.d.ts +3 -1
- package/core/clipboard/workspace_comment_paster.d.ts +5 -4
- package/core/comments/comment_view.d.ts +6 -1
- package/core/comments/rendered_workspace_comment.d.ts +22 -4
- 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/block_drag_strategy.d.ts +1 -8
- package/core/dragging/comment_drag_strategy.d.ts +1 -0
- package/core/events/events_block_change.d.ts +15 -0
- package/core/events/utils.d.ts +1 -3
- package/core/field.d.ts +20 -4
- package/core/field_input.d.ts +4 -3
- package/core/field_registry.d.ts +35 -3
- package/core/flyout_base.d.ts +8 -0
- package/core/grid.d.ts +9 -0
- package/core/interfaces/i_flyout.d.ts +10 -0
- package/core/keyboard_nav/ast_node.d.ts +10 -1
- package/core/layer_manager.d.ts +11 -0
- 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 -2
- package/core.js +4 -0
- package/dart.js +4 -0
- package/dart.mjs +6 -0
- package/index.mjs +143 -0
- package/javascript.js +4 -0
- package/javascript.mjs +6 -0
- package/lua.js +4 -0
- package/lua.mjs +6 -0
- package/media/resize-handle.svg +1 -1
- package/msg/ab.js +8 -7
- package/msg/ab.mjs +423 -0
- package/msg/ace.js +8 -7
- package/msg/ace.mjs +423 -0
- package/msg/af.js +8 -7
- package/msg/af.mjs +423 -0
- package/msg/am.js +8 -7
- package/msg/am.mjs +423 -0
- package/msg/ar.js +8 -7
- package/msg/ar.mjs +423 -0
- package/msg/ast.js +8 -7
- package/msg/ast.mjs +423 -0
- package/msg/az.js +8 -7
- package/msg/az.mjs +423 -0
- package/msg/ba.js +8 -7
- package/msg/ba.mjs +423 -0
- package/msg/bcc.js +8 -7
- package/msg/bcc.mjs +423 -0
- package/msg/be-tarask.js +8 -7
- package/msg/be-tarask.mjs +423 -0
- package/msg/be.js +8 -7
- package/msg/be.mjs +423 -0
- package/msg/bg.js +8 -7
- package/msg/bg.mjs +423 -0
- package/msg/bn.js +8 -7
- package/msg/bn.mjs +423 -0
- package/msg/br.js +8 -7
- package/msg/br.mjs +423 -0
- package/msg/bs.js +8 -7
- package/msg/bs.mjs +423 -0
- package/msg/ca.js +8 -7
- package/msg/ca.mjs +423 -0
- package/msg/cdo.js +8 -7
- package/msg/cdo.mjs +423 -0
- package/msg/ce.js +8 -7
- package/msg/ce.mjs +423 -0
- package/msg/cs.js +8 -7
- package/msg/cs.mjs +423 -0
- package/msg/da.js +8 -7
- package/msg/da.mjs +423 -0
- package/msg/de.js +27 -26
- package/msg/de.mjs +423 -0
- package/msg/diq.js +8 -7
- package/msg/diq.mjs +423 -0
- package/msg/dtp.js +8 -7
- package/msg/dtp.mjs +423 -0
- package/msg/dty.js +8 -7
- package/msg/dty.mjs +423 -0
- package/msg/ee.js +8 -7
- package/msg/ee.mjs +423 -0
- package/msg/el.js +123 -122
- package/msg/el.mjs +423 -0
- package/msg/en-gb.js +8 -7
- package/msg/en-gb.mjs +423 -0
- package/msg/en.js +8 -7
- package/msg/en.mjs +423 -0
- package/msg/eo.js +8 -7
- package/msg/eo.mjs +423 -0
- package/msg/es.js +8 -7
- package/msg/es.mjs +423 -0
- package/msg/et.js +8 -7
- package/msg/et.mjs +423 -0
- package/msg/eu.js +8 -7
- package/msg/eu.mjs +423 -0
- package/msg/fa.js +10 -9
- package/msg/fa.mjs +423 -0
- package/msg/fi.js +8 -7
- package/msg/fi.mjs +423 -0
- package/msg/fo.js +8 -7
- package/msg/fo.mjs +423 -0
- package/msg/fr.js +11 -10
- package/msg/fr.mjs +423 -0
- package/msg/frr.js +8 -7
- package/msg/frr.mjs +423 -0
- package/msg/gl.js +8 -7
- package/msg/gl.mjs +423 -0
- package/msg/gn.js +8 -7
- package/msg/gn.mjs +423 -0
- package/msg/gor.js +8 -7
- package/msg/gor.mjs +423 -0
- package/msg/ha.js +8 -7
- package/msg/ha.mjs +423 -0
- package/msg/hak.js +8 -7
- package/msg/hak.mjs +423 -0
- package/msg/he.js +8 -7
- package/msg/he.mjs +423 -0
- package/msg/hi.js +8 -7
- package/msg/hi.mjs +423 -0
- package/msg/hr.js +8 -7
- package/msg/hr.mjs +423 -0
- package/msg/hrx.js +8 -7
- package/msg/hrx.mjs +423 -0
- package/msg/hsb.js +8 -7
- package/msg/hsb.mjs +423 -0
- package/msg/hu.js +8 -7
- package/msg/hu.mjs +423 -0
- package/msg/hy.js +8 -7
- package/msg/hy.mjs +423 -0
- package/msg/ia.js +8 -7
- package/msg/ia.mjs +423 -0
- package/msg/id.js +8 -7
- package/msg/id.mjs +423 -0
- package/msg/ig.js +8 -7
- package/msg/ig.mjs +423 -0
- package/msg/inh.js +8 -7
- package/msg/inh.mjs +423 -0
- package/msg/is.js +8 -7
- package/msg/is.mjs +423 -0
- package/msg/it.js +8 -7
- package/msg/it.mjs +423 -0
- package/msg/ja.js +8 -7
- package/msg/ja.mjs +423 -0
- package/msg/ka.js +8 -7
- package/msg/ka.mjs +423 -0
- package/msg/kab.js +8 -7
- package/msg/kab.mjs +423 -0
- package/msg/kbd-cyrl.js +8 -7
- package/msg/kbd-cyrl.mjs +423 -0
- package/msg/km.js +8 -7
- package/msg/km.mjs +423 -0
- package/msg/kn.js +8 -7
- package/msg/kn.mjs +423 -0
- package/msg/ko.js +9 -8
- package/msg/ko.mjs +423 -0
- package/msg/ksh.js +8 -7
- package/msg/ksh.mjs +423 -0
- package/msg/ku-latn.js +8 -7
- package/msg/ku-latn.mjs +423 -0
- package/msg/ky.js +8 -7
- package/msg/ky.mjs +423 -0
- package/msg/la.js +8 -7
- package/msg/la.mjs +423 -0
- package/msg/lb.js +8 -7
- package/msg/lb.mjs +423 -0
- package/msg/lki.js +8 -7
- package/msg/lki.mjs +423 -0
- package/msg/lo.js +8 -7
- package/msg/lo.mjs +423 -0
- package/msg/lrc.js +8 -7
- package/msg/lrc.mjs +423 -0
- package/msg/lt.js +8 -7
- package/msg/lt.mjs +423 -0
- package/msg/lv.js +8 -7
- package/msg/lv.mjs +423 -0
- package/msg/mg.js +8 -7
- package/msg/mg.mjs +423 -0
- package/msg/mk.js +8 -7
- package/msg/mk.mjs +423 -0
- package/msg/ml.js +8 -7
- package/msg/ml.mjs +423 -0
- package/msg/mnw.js +8 -7
- package/msg/mnw.mjs +423 -0
- package/msg/ms.js +9 -8
- package/msg/ms.mjs +423 -0
- package/msg/my.js +8 -7
- package/msg/my.mjs +423 -0
- package/msg/mzn.js +8 -7
- package/msg/mzn.mjs +423 -0
- package/msg/nb.js +8 -7
- package/msg/nb.mjs +423 -0
- package/msg/ne.js +225 -224
- package/msg/ne.mjs +423 -0
- package/msg/nl.js +15 -14
- package/msg/nl.mjs +423 -0
- package/msg/oc.js +8 -7
- package/msg/oc.mjs +423 -0
- package/msg/olo.js +8 -7
- package/msg/olo.mjs +423 -0
- package/msg/pa.js +8 -7
- package/msg/pa.mjs +423 -0
- package/msg/pl.js +8 -7
- package/msg/pl.mjs +423 -0
- package/msg/pms.js +8 -7
- package/msg/pms.mjs +423 -0
- package/msg/ps.js +8 -7
- package/msg/ps.mjs +423 -0
- package/msg/pt-br.js +10 -9
- package/msg/pt-br.mjs +423 -0
- package/msg/pt.js +8 -7
- package/msg/pt.mjs +423 -0
- package/msg/ro.js +8 -7
- package/msg/ro.mjs +423 -0
- package/msg/ru.js +9 -8
- package/msg/ru.mjs +423 -0
- package/msg/sc.js +8 -7
- package/msg/sc.mjs +423 -0
- package/msg/sco.js +8 -7
- package/msg/sco.mjs +423 -0
- package/msg/sd.js +8 -7
- package/msg/sd.mjs +423 -0
- package/msg/shn.js +8 -7
- package/msg/shn.mjs +423 -0
- package/msg/si.js +8 -7
- package/msg/si.mjs +423 -0
- package/msg/sk.js +8 -7
- package/msg/sk.mjs +423 -0
- package/msg/skr-arab.js +8 -7
- package/msg/skr-arab.mjs +423 -0
- package/msg/sl.js +8 -7
- package/msg/sl.mjs +423 -0
- package/msg/smn.js +8 -7
- package/msg/smn.mjs +423 -0
- package/msg/sq.js +8 -7
- package/msg/sq.mjs +423 -0
- package/msg/sr-latn.js +8 -7
- package/msg/sr-latn.mjs +423 -0
- package/msg/sr.js +8 -7
- package/msg/sr.mjs +423 -0
- package/msg/sv.js +8 -7
- package/msg/sv.mjs +423 -0
- package/msg/sw.js +8 -7
- package/msg/sw.mjs +423 -0
- package/msg/ta.js +14 -13
- package/msg/ta.mjs +423 -0
- package/msg/tcy.js +8 -7
- package/msg/tcy.mjs +423 -0
- package/msg/tdd.js +11 -10
- package/msg/tdd.mjs +423 -0
- package/msg/te.js +8 -7
- package/msg/te.mjs +423 -0
- package/msg/th.js +8 -7
- package/msg/th.mjs +423 -0
- package/msg/ti.js +8 -7
- package/msg/ti.mjs +423 -0
- package/msg/tl.js +8 -7
- package/msg/tl.mjs +423 -0
- package/msg/tlh.js +8 -7
- package/msg/tlh.mjs +423 -0
- package/msg/tr.js +10 -9
- package/msg/tr.mjs +423 -0
- package/msg/ug-arab.js +8 -7
- package/msg/ug-arab.mjs +423 -0
- package/msg/uk.js +8 -7
- package/msg/uk.mjs +423 -0
- package/msg/ur.js +8 -7
- package/msg/ur.mjs +423 -0
- package/msg/uz.js +8 -7
- package/msg/uz.mjs +423 -0
- package/msg/vi.js +11 -10
- package/msg/vi.mjs +423 -0
- package/msg/xmf.js +8 -7
- package/msg/xmf.mjs +423 -0
- package/msg/yo.js +8 -7
- package/msg/yo.mjs +423 -0
- package/msg/zgh.js +8 -7
- package/msg/zgh.mjs +423 -0
- package/msg/zh-hans.js +9 -8
- package/msg/zh-hans.mjs +423 -0
- package/msg/zh-hant.js +18 -17
- package/msg/zh-hant.mjs +423 -0
- package/package.json +12 -2
- package/php.js +4 -0
- package/php.mjs +6 -0
- package/python.js +4 -0
- package/python.mjs +6 -0
- package/core/workspace_comment.d.ts +0 -190
- package/core/workspace_comment_svg.d.ts +0 -360
- package/msg/yue.d.ts +0 -8
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;
|
|
@@ -320,6 +320,12 @@ 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;
|
|
323
329
|
/**
|
|
324
330
|
* Find all the blocks that are directly nested inside this one.
|
|
325
331
|
* Includes value and statement inputs, as well as any following statement.
|
|
@@ -627,17 +633,44 @@ export declare class Block implements IASTNodeLocation {
|
|
|
627
633
|
*/
|
|
628
634
|
getOutputShape(): number | null;
|
|
629
635
|
/**
|
|
630
|
-
* Get whether this block is enabled or not.
|
|
636
|
+
* Get whether this block is enabled or not. A block is considered enabled
|
|
637
|
+
* if there aren't any reasons why it would be disabled. A block may still
|
|
638
|
+
* be disabled for other reasons even if the user attempts to manually
|
|
639
|
+
* enable it, such as when the block is in an invalid location.
|
|
631
640
|
*
|
|
632
641
|
* @returns True if enabled.
|
|
633
642
|
*/
|
|
634
643
|
isEnabled(): boolean;
|
|
635
|
-
/**
|
|
636
|
-
|
|
644
|
+
/** @deprecated v11 - Get whether the block is manually disabled. */
|
|
645
|
+
private get disabled();
|
|
646
|
+
/** @deprecated v11 - Set whether the block is manually disabled. */
|
|
647
|
+
private set disabled(value);
|
|
648
|
+
/**
|
|
649
|
+
* @deprecated v11 - Set whether the block is manually enabled or disabled.
|
|
650
|
+
* The user can toggle whether a block is disabled from a context menu
|
|
651
|
+
* option. A block may still be disabled for other reasons even if the user
|
|
652
|
+
* attempts to manually enable it, such as when the block is in an invalid
|
|
653
|
+
* location. This method is deprecated and setDisabledReason should be used
|
|
654
|
+
* instead.
|
|
637
655
|
*
|
|
638
656
|
* @param enabled True if enabled.
|
|
639
657
|
*/
|
|
640
658
|
setEnabled(enabled: boolean): void;
|
|
659
|
+
/**
|
|
660
|
+
* Add or remove a reason why the block might be disabled. If a block has
|
|
661
|
+
* any reasons to be disabled, then the block itself will be considered
|
|
662
|
+
* disabled. A block could be disabled for multiple independent reasons
|
|
663
|
+
* simultaneously, such as when the user manually disables it, or the block
|
|
664
|
+
* is invalid.
|
|
665
|
+
*
|
|
666
|
+
* @param disabled If true, then the block should be considered disabled for
|
|
667
|
+
* at least the provided reason, otherwise the block is no longer disabled
|
|
668
|
+
* for that reason.
|
|
669
|
+
* @param reason A language-neutral identifier for a reason why the block
|
|
670
|
+
* could be disabled. Call this method again with the same identifier to
|
|
671
|
+
* update whether the block is currently disabled for this reason.
|
|
672
|
+
*/
|
|
673
|
+
setDisabledReason(disabled: boolean, reason: string): void;
|
|
641
674
|
/**
|
|
642
675
|
* Get whether the block is disabled or not due to parents.
|
|
643
676
|
* The block's own disabled property is not considered.
|
|
@@ -645,6 +678,21 @@ export declare class Block implements IASTNodeLocation {
|
|
|
645
678
|
* @returns True if disabled.
|
|
646
679
|
*/
|
|
647
680
|
getInheritedDisabled(): boolean;
|
|
681
|
+
/**
|
|
682
|
+
* Get whether the block is currently disabled for the provided reason.
|
|
683
|
+
*
|
|
684
|
+
* @param reason A language-neutral identifier for a reason why the block
|
|
685
|
+
* could be disabled.
|
|
686
|
+
* @returns Whether the block is disabled for the provided reason.
|
|
687
|
+
*/
|
|
688
|
+
hasDisabledReason(reason: string): boolean;
|
|
689
|
+
/**
|
|
690
|
+
* Get a set of reasons why the block is currently disabled, if any. If the
|
|
691
|
+
* block is enabled, this set will be empty.
|
|
692
|
+
*
|
|
693
|
+
* @returns The set of reasons why the block is disabled, if any.
|
|
694
|
+
*/
|
|
695
|
+
getDisabledReasons(): ReadonlySet<string>;
|
|
648
696
|
/**
|
|
649
697
|
* Get whether the block is collapsed or not.
|
|
650
698
|
*
|
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.
|
package/core/blockly.d.ts
CHANGED
|
@@ -141,8 +141,6 @@ import * as VariablesDynamic from './variables_dynamic.js';
|
|
|
141
141
|
import * as WidgetDiv from './widgetdiv.js';
|
|
142
142
|
import { Workspace } from './workspace.js';
|
|
143
143
|
import { WorkspaceAudio } from './workspace_audio.js';
|
|
144
|
-
import { WorkspaceComment } from './workspace_comment.js';
|
|
145
|
-
import { WorkspaceCommentSvg } from './workspace_comment_svg.js';
|
|
146
144
|
import { WorkspaceDragger } from './workspace_dragger.js';
|
|
147
145
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
148
146
|
import * as Xml from './xml.js';
|
|
@@ -397,8 +395,6 @@ export { VariableModel };
|
|
|
397
395
|
export { VerticalFlyout };
|
|
398
396
|
export { Workspace };
|
|
399
397
|
export { WorkspaceAudio };
|
|
400
|
-
export { WorkspaceComment };
|
|
401
|
-
export { WorkspaceCommentSvg };
|
|
402
398
|
export { WorkspaceDragger };
|
|
403
399
|
export { WorkspaceSvg };
|
|
404
400
|
export { ZoomControls };
|
|
@@ -20,9 +20,11 @@ export declare class BlockPaster implements IPaster<BlockCopyData, BlockSvg> {
|
|
|
20
20
|
* Exported for testing.
|
|
21
21
|
*
|
|
22
22
|
* @param block The block to move to an unambiguous location.
|
|
23
|
+
* @param originalPosition The initial coordinate to start searching from,
|
|
24
|
+
* likely the position of the copied block.
|
|
23
25
|
* @internal
|
|
24
26
|
*/
|
|
25
|
-
export declare function moveBlockToNotConflict(block: BlockSvg): void;
|
|
27
|
+
export declare function moveBlockToNotConflict(block: BlockSvg, originalPosition: Coordinate): void;
|
|
26
28
|
export interface BlockCopyData extends ICopyData {
|
|
27
29
|
blockState: State;
|
|
28
30
|
typeCounts: {
|
|
@@ -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
|
|
@@ -83,7 +83,10 @@ export declare class CommentView implements IRenderedElement {
|
|
|
83
83
|
private createResizeHandle;
|
|
84
84
|
/** Returns the root SVG group element of the comment view. */
|
|
85
85
|
getSvgRoot(): SVGGElement;
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Returns the current size of the comment in workspace units.
|
|
88
|
+
* Respects collapsing.
|
|
89
|
+
*/
|
|
87
90
|
getSize(): Size;
|
|
88
91
|
/**
|
|
89
92
|
* Sets the size of the comment in workspace units, and updates the view
|
|
@@ -103,6 +106,8 @@ export declare class CommentView implements IRenderedElement {
|
|
|
103
106
|
private calcDeleteMargin;
|
|
104
107
|
/** Calculates the margin that should exist around the foldout icon. */
|
|
105
108
|
private calcFoldoutMargin;
|
|
109
|
+
/** Updates the size of the highlight rect to reflect the new size. */
|
|
110
|
+
private updateHighlightRect;
|
|
106
111
|
/** Updates the size of the top bar to reflect the new size. */
|
|
107
112
|
private updateTopBarSize;
|
|
108
113
|
/** Updates the size of the text area elements to reflect the new size. */
|
|
@@ -13,7 +13,10 @@ 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
|
-
|
|
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 {
|
|
17
20
|
/** The class encompassing the svg elements making up the workspace comment. */
|
|
18
21
|
private view;
|
|
19
22
|
readonly workspace: WorkspaceSvg;
|
|
@@ -35,7 +38,15 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
35
38
|
setEditable(editable: boolean): void;
|
|
36
39
|
/** Returns the root SVG element of this comment. */
|
|
37
40
|
getSvgRoot(): SVGElement;
|
|
38
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Returns the comment's size in workspace units.
|
|
43
|
+
* Does not respect collapsing.
|
|
44
|
+
*/
|
|
45
|
+
getSize(): Size;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the bounding rectangle of this comment in workspace coordinates.
|
|
48
|
+
* Respects collapsing.
|
|
49
|
+
*/
|
|
39
50
|
getBoundingRectangle(): Rect;
|
|
40
51
|
/** Move the comment by the given amounts in workspace coordinates. */
|
|
41
52
|
moveBy(dx: number, dy: number, reason?: string[] | undefined): void;
|
|
@@ -60,8 +71,6 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
60
71
|
* (that wasn't otherwise gobbled up, e.g. by resizing).
|
|
61
72
|
*/
|
|
62
73
|
private startGesture;
|
|
63
|
-
/** Returns whether this comment is deletable or not. */
|
|
64
|
-
isDeletable(): boolean;
|
|
65
74
|
/** Visually indicates that this comment would be deleted if dropped. */
|
|
66
75
|
setDeleteStyle(wouldDelete: boolean): void;
|
|
67
76
|
/** Returns whether this comment is movable or not. */
|
|
@@ -78,5 +87,14 @@ export declare class RenderedWorkspaceComment extends WorkspaceComment implement
|
|
|
78
87
|
select(): void;
|
|
79
88
|
/** Visually unhighlights the comment. */
|
|
80
89
|
unselect(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Returns a JSON serializable representation of this comment's state that
|
|
92
|
+
* can be used for pasting.
|
|
93
|
+
*/
|
|
94
|
+
toCopyData(): WorkspaceCommentCopyData | null;
|
|
95
|
+
/** Show a context menu for this comment. */
|
|
96
|
+
showContextMenu(e: PointerEvent): void;
|
|
97
|
+
/** Snap this comment to the nearest grid point. */
|
|
98
|
+
snapToGrid(): void;
|
|
81
99
|
}
|
|
82
100
|
//# 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
|
}
|
|
@@ -20,11 +20,6 @@ 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;
|
|
28
23
|
constructor(block: BlockSvg);
|
|
29
24
|
/** Returns true if the block is currently movable. False otherwise. */
|
|
30
25
|
isMovable(): boolean;
|
|
@@ -33,8 +28,6 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
33
28
|
* from any parent blocks.
|
|
34
29
|
*/
|
|
35
30
|
startDrag(e?: PointerEvent): void;
|
|
36
|
-
/** Starts a drag on a shadow, recording the drag offset. */
|
|
37
|
-
private startDraggingShadow;
|
|
38
31
|
/**
|
|
39
32
|
* Whether or not we should disconnect the block when a drag is started.
|
|
40
33
|
*
|
|
@@ -93,7 +86,7 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
93
86
|
* Cleans up any state at the end of the drag. Applies any pending
|
|
94
87
|
* connections.
|
|
95
88
|
*/
|
|
96
|
-
endDrag(
|
|
89
|
+
endDrag(): void;
|
|
97
90
|
/** Connects the given candidate connections. */
|
|
98
91
|
private applyConnections;
|
|
99
92
|
/**
|
|
@@ -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/field.d.ts
CHANGED
|
@@ -561,6 +561,7 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
561
561
|
*
|
|
562
562
|
* @param newValue New value.
|
|
563
563
|
* @param validatedValue Validated value.
|
|
564
|
+
* @param fireChangeEvent Whether to fire a change event if the value changes.
|
|
564
565
|
* @returns New value, or an Error object.
|
|
565
566
|
*/
|
|
566
567
|
private processValidation_;
|
|
@@ -605,8 +606,9 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
605
606
|
* No-op by default.
|
|
606
607
|
*
|
|
607
608
|
* @param _invalidValue The input value that was determined to be invalid.
|
|
609
|
+
* @param _fireChangeEvent Whether to fire a change event if the value changes.
|
|
608
610
|
*/
|
|
609
|
-
protected doValueInvalid_(_invalidValue: any): void;
|
|
611
|
+
protected doValueInvalid_(_invalidValue: any, _fireChangeEvent?: boolean): void;
|
|
610
612
|
/**
|
|
611
613
|
* Handle a pointerdown event on a field.
|
|
612
614
|
*
|
|
@@ -706,6 +708,17 @@ export declare abstract class Field<T = any> implements IASTNodeLocationSvg, IAS
|
|
|
706
708
|
* @internal
|
|
707
709
|
*/
|
|
708
710
|
updateMarkers_(): void;
|
|
711
|
+
/**
|
|
712
|
+
* Subclasses should reimplement this method to construct their Field
|
|
713
|
+
* subclass from a JSON arg object.
|
|
714
|
+
*
|
|
715
|
+
* It is an error to attempt to register a field subclass in the
|
|
716
|
+
* FieldRegistry if that subclass has not overridden this method.
|
|
717
|
+
*
|
|
718
|
+
* @param _options JSON configuration object with properties needed
|
|
719
|
+
* to configure a specific field.
|
|
720
|
+
*/
|
|
721
|
+
static fromJson(_options: FieldConfig): Field;
|
|
709
722
|
}
|
|
710
723
|
/**
|
|
711
724
|
* Extra configuration options for the base field.
|
|
@@ -714,12 +727,14 @@ export interface FieldConfig {
|
|
|
714
727
|
tooltip?: string;
|
|
715
728
|
}
|
|
716
729
|
/**
|
|
717
|
-
*
|
|
730
|
+
* Represents an object that has all the prototype properties of the `Field`
|
|
731
|
+
* class. This is necessary because constructors can change
|
|
718
732
|
* in descendants, though they should contain all of Field's prototype methods.
|
|
719
733
|
*
|
|
720
|
-
*
|
|
734
|
+
* This type should only be used in places where we directly access the prototype
|
|
735
|
+
* of a Field class or subclass.
|
|
721
736
|
*/
|
|
722
|
-
|
|
737
|
+
type FieldProto = Pick<typeof Field, 'prototype'>;
|
|
723
738
|
/**
|
|
724
739
|
* Represents an error where the field is trying to access its block or
|
|
725
740
|
* information about its block before it has actually been attached to said
|
|
@@ -729,4 +744,5 @@ export declare class UnattachedFieldError extends Error {
|
|
|
729
744
|
/** @internal */
|
|
730
745
|
constructor();
|
|
731
746
|
}
|
|
747
|
+
export {};
|
|
732
748
|
//# sourceMappingURL=field.d.ts.map
|
package/core/field_input.d.ts
CHANGED
|
@@ -88,10 +88,11 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
88
88
|
* value while allowing the display text to be handled by the htmlInput_.
|
|
89
89
|
*
|
|
90
90
|
* @param _invalidValue The input value that was determined to be invalid.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
91
|
+
* This is not used by the text input because its display value is stored
|
|
92
|
+
* on the htmlInput_.
|
|
93
|
+
* @param fireChangeEvent Whether to fire a change event if the value changes.
|
|
93
94
|
*/
|
|
94
|
-
protected doValueInvalid_(_invalidValue: any): void;
|
|
95
|
+
protected doValueInvalid_(_invalidValue: any, fireChangeEvent?: boolean): void;
|
|
95
96
|
/**
|
|
96
97
|
* Called by setValue if the text input is valid. Updates the value of the
|
|
97
98
|
* field, and updates the text of the field if it is not currently being
|
package/core/field_registry.d.ts
CHANGED
|
@@ -3,10 +3,42 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type { Field,
|
|
7
|
-
|
|
6
|
+
import type { Field, FieldConfig } from './field.js';
|
|
7
|
+
/**
|
|
8
|
+
* When constructing a field from JSON using the registry, the
|
|
9
|
+
* `fromJson` method in this file is called with an options parameter
|
|
10
|
+
* object consisting of the "type" which is the name of the field, and
|
|
11
|
+
* other options that are part of the field's config object.
|
|
12
|
+
*
|
|
13
|
+
* These options are then passed to the field's static `fromJson`
|
|
14
|
+
* method. That method accepts an options parameter with a type that usually
|
|
15
|
+
* extends from FieldConfig, and may or may not have a "type" attribute (in
|
|
16
|
+
* fact, it shouldn't, because we'd overwrite it as described above!)
|
|
17
|
+
*
|
|
18
|
+
* Unfortunately the registry has no way of knowing the actual Field subclass
|
|
19
|
+
* that will be returned from passing in the name of the field. Therefore it
|
|
20
|
+
* also has no way of knowing that the options object not only implements
|
|
21
|
+
* `FieldConfig`, but it also should satisfy the Config that belongs to that
|
|
22
|
+
* specific class's `fromJson` method.
|
|
23
|
+
*
|
|
24
|
+
* Because of this uncertainty, we just give up on type checking the properties
|
|
25
|
+
* passed to the `fromJson` method, and allow arbitrary string keys with
|
|
26
|
+
* unknown types.
|
|
27
|
+
*/
|
|
28
|
+
type RegistryOptions = FieldConfig & {
|
|
8
29
|
type: string;
|
|
9
30
|
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Represents the static methods that must be defined on any
|
|
34
|
+
* field that is registered, i.e. the constructor and fromJson methods.
|
|
35
|
+
*
|
|
36
|
+
* Because we don't know which Field subclass will be registered, we
|
|
37
|
+
* are unable to typecheck the parameters of the constructor.
|
|
38
|
+
*/
|
|
39
|
+
export interface RegistrableField {
|
|
40
|
+
new (...args: any[]): Field;
|
|
41
|
+
fromJson(options: FieldConfig): Field;
|
|
10
42
|
}
|
|
11
43
|
/**
|
|
12
44
|
* Registers a field type.
|
|
@@ -19,7 +51,7 @@ interface RegistryOptions {
|
|
|
19
51
|
* @throws {Error} if the type name is empty, the field is already registered,
|
|
20
52
|
* or the fieldClass is not an object containing a fromJson function.
|
|
21
53
|
*/
|
|
22
|
-
export declare function register(type: string, fieldClass:
|
|
54
|
+
export declare function register(type: string, fieldClass: RegistrableField): void;
|
|
23
55
|
/**
|
|
24
56
|
* Unregisters the field registered with the given type.
|
|
25
57
|
*
|
package/core/flyout_base.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { DeleteArea } from './delete_area.js';
|
|
|
8
8
|
import { FlyoutButton } from './flyout_button.js';
|
|
9
9
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
10
10
|
import type { Options } from './options.js';
|
|
11
|
+
import * as blocks from './serialization/blocks.js';
|
|
11
12
|
import { Coordinate } from './utils/coordinate.js';
|
|
12
13
|
import { Svg } from './utils/svg.js';
|
|
13
14
|
import * as toolbox from './utils/toolbox.js';
|
|
@@ -505,6 +506,13 @@ export declare abstract class Flyout extends DeleteArea implements IAutoHideable
|
|
|
505
506
|
* @returns The new block in the main workspace.
|
|
506
507
|
*/
|
|
507
508
|
private placeNewBlock;
|
|
509
|
+
/**
|
|
510
|
+
* Serialize a block to JSON.
|
|
511
|
+
*
|
|
512
|
+
* @param block The block to serialize.
|
|
513
|
+
* @returns A serialized representation of the block.
|
|
514
|
+
*/
|
|
515
|
+
protected serializeBlock(block: BlockSvg): blocks.State;
|
|
508
516
|
/**
|
|
509
517
|
* Positions a block on the target workspace.
|
|
510
518
|
*
|
package/core/grid.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { Coordinate } from './utils/coordinate.js';
|
|
6
7
|
import { GridOptions } from './options.js';
|
|
7
8
|
/**
|
|
8
9
|
* Class for a workspace's grid.
|
|
@@ -92,6 +93,14 @@ export declare class Grid {
|
|
|
92
93
|
* @internal
|
|
93
94
|
*/
|
|
94
95
|
moveTo(x: number, y: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Given a coordinate, return the nearest coordinate aligned to the grid.
|
|
98
|
+
*
|
|
99
|
+
* @param xy A workspace coordinate.
|
|
100
|
+
* @returns Workspace coordinate of nearest grid point.
|
|
101
|
+
* If there's no change, return the same coordinate object.
|
|
102
|
+
*/
|
|
103
|
+
alignXY(xy: Coordinate): Coordinate;
|
|
95
104
|
/**
|
|
96
105
|
* Create the DOM for the grid described by options.
|
|
97
106
|
*
|