blockly 13.1.1 → 13.2.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 +870 -854
- package/blockly_compressed.js +760 -749
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +77 -77
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +1 -1
- package/core/block_svg.d.ts +0 -10
- package/core/blockly.d.ts +1 -0
- package/core/connection_db.d.ts +40 -0
- package/core/dragging/block_drag_strategy.d.ts +8 -3
- package/core/field.d.ts +12 -0
- package/core/field_dropdown.d.ts +5 -1
- package/core/field_input.d.ts +7 -0
- package/core/insertion_marker.d.ts +54 -0
- package/core/insertion_marker_previewer.d.ts +17 -1
- package/core/interfaces/i_json_block_definition.d.ts +10 -0
- package/core/rendered_connection.d.ts +20 -0
- package/dart_compressed.js +23 -23
- package/javascript_compressed.js +28 -28
- package/lua_compressed.js +41 -41
- package/msg/ab.js +5 -0
- package/msg/ab.mjs +5 -0
- package/msg/ace.js +5 -0
- package/msg/ace.mjs +5 -0
- package/msg/af.js +5 -0
- package/msg/af.mjs +5 -0
- package/msg/am.js +5 -0
- package/msg/am.mjs +5 -0
- package/msg/ar.js +5 -0
- package/msg/ar.mjs +5 -0
- package/msg/ast.js +5 -0
- package/msg/ast.mjs +5 -0
- package/msg/az.js +5 -0
- package/msg/az.mjs +5 -0
- package/msg/ba.js +5 -0
- package/msg/ba.mjs +5 -0
- package/msg/bcc.js +5 -0
- package/msg/bcc.mjs +5 -0
- package/msg/be-tarask.js +5 -0
- package/msg/be-tarask.mjs +5 -0
- package/msg/be.js +5 -0
- package/msg/be.mjs +5 -0
- package/msg/bg.js +5 -0
- package/msg/bg.mjs +5 -0
- package/msg/bn.js +5 -0
- package/msg/bn.mjs +5 -0
- package/msg/br.js +5 -0
- package/msg/br.mjs +5 -0
- package/msg/bs.js +5 -0
- package/msg/bs.mjs +5 -0
- package/msg/ca.js +5 -0
- package/msg/ca.mjs +5 -0
- package/msg/ce.js +5 -0
- package/msg/ce.mjs +5 -0
- package/msg/cs.js +5 -0
- package/msg/cs.mjs +5 -0
- package/msg/csb.js +5 -0
- package/msg/csb.mjs +5 -0
- package/msg/da.js +5 -0
- package/msg/da.mjs +5 -0
- package/msg/de.js +5 -0
- package/msg/de.mjs +5 -0
- package/msg/diq.js +5 -0
- package/msg/diq.mjs +5 -0
- package/msg/dtp.js +5 -0
- package/msg/dtp.mjs +5 -0
- package/msg/dty.js +5 -0
- package/msg/dty.mjs +5 -0
- package/msg/ee.js +5 -0
- package/msg/ee.mjs +5 -0
- package/msg/el.js +5 -0
- package/msg/el.mjs +5 -0
- package/msg/en-gb.js +5 -0
- package/msg/en-gb.mjs +5 -0
- package/msg/en.js +5 -0
- package/msg/en.mjs +5 -0
- package/msg/eo.js +5 -0
- package/msg/eo.mjs +5 -0
- package/msg/es.js +5 -0
- package/msg/es.mjs +5 -0
- package/msg/et.js +5 -0
- package/msg/et.mjs +5 -0
- package/msg/eu.js +5 -0
- package/msg/eu.mjs +5 -0
- package/msg/fa.js +5 -0
- package/msg/fa.mjs +5 -0
- package/msg/fi.js +10 -5
- package/msg/fi.mjs +5 -0
- package/msg/fo.js +5 -0
- package/msg/fo.mjs +5 -0
- package/msg/fr.js +90 -85
- package/msg/fr.mjs +5 -0
- package/msg/frr.js +5 -0
- package/msg/frr.mjs +5 -0
- package/msg/ga.js +5 -0
- package/msg/ga.mjs +5 -0
- package/msg/gl.js +29 -24
- package/msg/gl.mjs +5 -0
- package/msg/gn.js +5 -0
- package/msg/gn.mjs +5 -0
- package/msg/gor.js +5 -0
- package/msg/gor.mjs +5 -0
- package/msg/ha.js +5 -0
- package/msg/ha.mjs +5 -0
- package/msg/he.js +36 -31
- package/msg/he.mjs +5 -0
- package/msg/hi.js +5 -0
- package/msg/hi.mjs +5 -0
- package/msg/hr.js +5 -0
- package/msg/hr.mjs +5 -0
- package/msg/hrx.js +5 -0
- package/msg/hrx.mjs +5 -0
- package/msg/hsb.js +5 -0
- package/msg/hsb.mjs +5 -0
- package/msg/hu.js +5 -0
- package/msg/hu.mjs +5 -0
- package/msg/hy.js +5 -0
- package/msg/hy.mjs +5 -0
- package/msg/ia.js +5 -0
- package/msg/ia.mjs +5 -0
- package/msg/id.js +5 -0
- package/msg/id.mjs +5 -0
- package/msg/ig.js +5 -0
- package/msg/ig.mjs +5 -0
- package/msg/inh.js +5 -0
- package/msg/inh.mjs +5 -0
- package/msg/is.js +5 -0
- package/msg/is.mjs +5 -0
- package/msg/it.js +10 -5
- package/msg/it.mjs +5 -0
- package/msg/ja.js +5 -0
- package/msg/ja.mjs +5 -0
- package/msg/ka.js +5 -0
- package/msg/ka.mjs +5 -0
- package/msg/kab.js +5 -0
- package/msg/kab.mjs +5 -0
- package/msg/kbd-cyrl.js +5 -0
- package/msg/kbd-cyrl.mjs +5 -0
- package/msg/km.js +5 -0
- package/msg/km.mjs +5 -0
- package/msg/kn.js +5 -0
- package/msg/kn.mjs +5 -0
- package/msg/ko.js +29 -24
- package/msg/ko.mjs +5 -0
- package/msg/krc.js +5 -0
- package/msg/krc.mjs +5 -0
- package/msg/ksh.js +5 -0
- package/msg/ksh.mjs +5 -0
- package/msg/ku-latn.js +5 -0
- package/msg/ku-latn.mjs +5 -0
- package/msg/ky.js +5 -0
- package/msg/ky.mjs +5 -0
- package/msg/la.js +5 -0
- package/msg/la.mjs +5 -0
- package/msg/lb.js +20 -15
- package/msg/lb.mjs +5 -0
- package/msg/lki.js +5 -0
- package/msg/lki.mjs +5 -0
- package/msg/lo.js +5 -0
- package/msg/lo.mjs +5 -0
- package/msg/lrc.js +5 -0
- package/msg/lrc.mjs +5 -0
- package/msg/lt.js +5 -0
- package/msg/lt.mjs +5 -0
- package/msg/lv.js +5 -0
- package/msg/lv.mjs +5 -0
- package/msg/mg.js +5 -0
- package/msg/mg.mjs +5 -0
- package/msg/mk.js +5 -0
- package/msg/mk.mjs +5 -0
- package/msg/ml.js +5 -0
- package/msg/ml.mjs +5 -0
- package/msg/mnw.js +5 -0
- package/msg/mnw.mjs +5 -0
- package/msg/ms.js +5 -0
- package/msg/ms.mjs +5 -0
- package/msg/mt.js +5 -0
- package/msg/mt.mjs +5 -0
- package/msg/my.js +5 -0
- package/msg/my.mjs +5 -0
- package/msg/mzn.js +5 -0
- package/msg/mzn.mjs +5 -0
- package/msg/nb.js +5 -0
- package/msg/nb.mjs +5 -0
- package/msg/ne.js +5 -0
- package/msg/ne.mjs +5 -0
- package/msg/nl.js +82 -77
- package/msg/nl.mjs +5 -0
- package/msg/oc.js +5 -0
- package/msg/oc.mjs +5 -0
- package/msg/olo.js +5 -0
- package/msg/olo.mjs +5 -0
- package/msg/pa.js +5 -0
- package/msg/pa.mjs +5 -0
- package/msg/pl.js +5 -0
- package/msg/pl.mjs +5 -0
- package/msg/pms.js +92 -87
- package/msg/pms.mjs +5 -0
- package/msg/ps.js +5 -0
- package/msg/ps.mjs +5 -0
- package/msg/pt-br.js +5 -0
- package/msg/pt-br.mjs +5 -0
- package/msg/pt.js +5 -0
- package/msg/pt.mjs +5 -0
- package/msg/ro.js +5 -0
- package/msg/ro.mjs +5 -0
- package/msg/ru.js +5 -0
- package/msg/ru.mjs +5 -0
- package/msg/sc.js +5 -0
- package/msg/sc.mjs +5 -0
- package/msg/sco.js +5 -0
- package/msg/sco.mjs +5 -0
- package/msg/sd.js +5 -0
- package/msg/sd.mjs +5 -0
- package/msg/shn.js +5 -0
- package/msg/shn.mjs +5 -0
- package/msg/si.js +5 -0
- package/msg/si.mjs +5 -0
- package/msg/sk.js +27 -22
- package/msg/sk.mjs +5 -0
- package/msg/skr-arab.js +5 -0
- package/msg/skr-arab.mjs +5 -0
- package/msg/sl.js +5 -0
- package/msg/sl.mjs +5 -0
- package/msg/smn.js +5 -0
- package/msg/smn.mjs +5 -0
- package/msg/sq.js +5 -0
- package/msg/sq.mjs +5 -0
- package/msg/sr-latn.js +5 -0
- package/msg/sr-latn.mjs +5 -0
- package/msg/sr.js +5 -0
- package/msg/sr.mjs +5 -0
- package/msg/sv.js +5 -0
- package/msg/sv.mjs +5 -0
- package/msg/sw.js +5 -0
- package/msg/sw.mjs +5 -0
- package/msg/ta.js +5 -0
- package/msg/ta.mjs +5 -0
- package/msg/tcy.js +5 -0
- package/msg/tcy.mjs +5 -0
- package/msg/tdd.js +5 -0
- package/msg/tdd.mjs +5 -0
- package/msg/te.js +5 -0
- package/msg/te.mjs +5 -0
- package/msg/th.js +5 -0
- package/msg/th.mjs +5 -0
- package/msg/ti.js +5 -0
- package/msg/ti.mjs +5 -0
- package/msg/tl.js +5 -0
- package/msg/tl.mjs +5 -0
- package/msg/tlh.js +5 -0
- package/msg/tlh.mjs +5 -0
- package/msg/tr.js +59 -54
- package/msg/tr.mjs +5 -0
- package/msg/ug-arab.js +5 -0
- package/msg/ug-arab.mjs +5 -0
- package/msg/uk.js +5 -0
- package/msg/uk.mjs +5 -0
- package/msg/ur.js +5 -0
- package/msg/ur.mjs +5 -0
- package/msg/uz.js +5 -0
- package/msg/uz.mjs +5 -0
- package/msg/vi.js +5 -0
- package/msg/vi.mjs +5 -0
- package/msg/xmf.js +5 -0
- package/msg/xmf.mjs +5 -0
- package/msg/yo.js +5 -0
- package/msg/yo.mjs +5 -0
- package/msg/zgh.js +5 -0
- package/msg/zgh.mjs +5 -0
- package/msg/zh-hans.js +5 -0
- package/msg/zh-hans.mjs +5 -0
- package/msg/zh-hant.js +5 -0
- package/msg/zh-hant.mjs +5 -0
- package/package.json +12 -21
- package/php_compressed.js +51 -51
- package/python_compressed.js +41 -41
package/core/block.d.ts
CHANGED
package/core/block_svg.d.ts
CHANGED
|
@@ -151,16 +151,6 @@ export declare class BlockSvg extends Block implements IBoundedElement, IContext
|
|
|
151
151
|
* @internal
|
|
152
152
|
*/
|
|
153
153
|
setParent(newParent: this | null): void;
|
|
154
|
-
/**
|
|
155
|
-
* Return the coordinates of the top-left corner of this block relative to the
|
|
156
|
-
* drawing surface's origin (0,0), in workspace units.
|
|
157
|
-
* If the block is on the workspace, (0, 0) is the origin of the workspace
|
|
158
|
-
* coordinate system.
|
|
159
|
-
* This does not change with workspace scale.
|
|
160
|
-
*
|
|
161
|
-
* @returns Object with .x and .y properties in workspace coordinates.
|
|
162
|
-
*/
|
|
163
|
-
getRelativeToSurfaceXY(): Coordinate;
|
|
164
154
|
/**
|
|
165
155
|
* Move a block by a relative offset.
|
|
166
156
|
*
|
package/core/blockly.d.ts
CHANGED
|
@@ -263,6 +263,7 @@ export declare const VARIABLE_DYNAMIC_CATEGORY_NAME: string;
|
|
|
263
263
|
* procedure blocks.
|
|
264
264
|
*/
|
|
265
265
|
export declare const PROCEDURE_CATEGORY_NAME: string;
|
|
266
|
+
export * from './interfaces/i_json_block_definition.js';
|
|
266
267
|
export * from './interfaces/i_navigation_policy.js';
|
|
267
268
|
export * from './keyboard_nav/navigation_policies/block_navigation_policy.js';
|
|
268
269
|
export * from './keyboard_nav/navigation_policies/bubble_navigation_policy.js';
|
package/core/connection_db.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export declare class ConnectionDB {
|
|
|
15
15
|
private readonly connectionChecker;
|
|
16
16
|
/** Array of connections sorted by y position in workspace units. */
|
|
17
17
|
private readonly connections;
|
|
18
|
+
/**
|
|
19
|
+
* Count of how many times bulk updates have been enabled. When reaching 0,
|
|
20
|
+
* the connection DB will be resorted.
|
|
21
|
+
*/
|
|
22
|
+
private bulkCounter;
|
|
18
23
|
/**
|
|
19
24
|
* @param connectionChecker The workspace's connection type checker, used to
|
|
20
25
|
* decide if connections are valid during a drag.
|
|
@@ -55,6 +60,17 @@ export declare class ConnectionDB {
|
|
|
55
60
|
* @throws {Error} If the connection cannot be found in the database.
|
|
56
61
|
*/
|
|
57
62
|
removeConnection(connection: RenderedConnection, yPos: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Moves the given connection in the connection DB to reflect its new Y
|
|
65
|
+
* position. For performance, this will be deferred if the connection DB is in
|
|
66
|
+
* the middle of a bulk update.
|
|
67
|
+
*
|
|
68
|
+
* @param connection The connection that is moving. Should be provided before
|
|
69
|
+
* its `Connection.y` field has been updated.
|
|
70
|
+
* @param newYPos The y coordinate (in workspace units) to which the
|
|
71
|
+
* connection will move.
|
|
72
|
+
*/
|
|
73
|
+
reorderConnection(connection: RenderedConnection, newYPos: number): void;
|
|
58
74
|
/**
|
|
59
75
|
* Find all nearby connections to the given connection.
|
|
60
76
|
* Type checking does not apply, since this function is used for bumping.
|
|
@@ -88,6 +104,30 @@ export declare class ConnectionDB {
|
|
|
88
104
|
connection: RenderedConnection | null;
|
|
89
105
|
radius: number;
|
|
90
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Notifies the connection DB that a series of connection moves is about to
|
|
109
|
+
* begin. May be called multiple times, and must be paired with a
|
|
110
|
+
* corresponding call to `endBulkUpdates()`.
|
|
111
|
+
*
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
beginBulkUpdates(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Notifies the connection DB that the most recent bulk series of connection
|
|
117
|
+
* moves has ended. Must be called after the corresponding
|
|
118
|
+
* `beginBulkUpdates()`. If all in-flight bulk updates have ended, this method
|
|
119
|
+
* will reorder the connection DB to reflect the current state of the
|
|
120
|
+
* connections.
|
|
121
|
+
*
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
endBulkUpdates(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Sorts the connections in the connection DB to reflect the current
|
|
127
|
+
* coordinates of the connections to allow for quick and correct connection
|
|
128
|
+
* lookups. Run automatically when a bulk update finishes.
|
|
129
|
+
*/
|
|
130
|
+
private reorderConnections;
|
|
91
131
|
/**
|
|
92
132
|
* Initialize a set of connection DBs for a workspace.
|
|
93
133
|
*
|
|
@@ -86,10 +86,13 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
86
86
|
*/
|
|
87
87
|
startDrag(e?: PointerEvent | KeyboardEvent): import("../blockly.js").IDraggable;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
89
|
+
* Caches a list of all valid connection pairs between the dragging block
|
|
90
|
+
* and any other blocks on the workspace. This is used to determine the
|
|
91
|
+
* closest valid connection during keyboard-driven moves and to determine
|
|
92
|
+
* the need to disambiguate between multiple compatible connections when
|
|
93
|
+
* announcing moves to assistive technologies.
|
|
91
94
|
*/
|
|
92
|
-
|
|
95
|
+
cacheAllConnectionPairs(): void;
|
|
93
96
|
/**
|
|
94
97
|
* Returns an array of visible bubbles attached to the given block or its
|
|
95
98
|
* descendants.
|
|
@@ -149,6 +152,8 @@ export declare class BlockDragStrategy implements IDragStrategy {
|
|
|
149
152
|
* @param draggingBlock The block being dragged.
|
|
150
153
|
* @param delta How far the pointer has moved from the position
|
|
151
154
|
* at the start of the drag, in workspace units.
|
|
155
|
+
* @param initialCandidate If provided, a connection candidate that the
|
|
156
|
+
* connection preview indicator will be attached to.
|
|
152
157
|
* @returns The neighbouring connection to which the connection preview will
|
|
153
158
|
* be attached.
|
|
154
159
|
*/
|
package/core/field.d.ts
CHANGED
|
@@ -195,6 +195,18 @@ export declare abstract class Field<T = any> implements IKeyboardAccessible, IRe
|
|
|
195
195
|
* unspecified.
|
|
196
196
|
*/
|
|
197
197
|
getAriaTypeName(): string | null;
|
|
198
|
+
/**
|
|
199
|
+
* Sets the ARIA-friendly label representation of this field's type.
|
|
200
|
+
*
|
|
201
|
+
* Implementations are responsible for, and encouraged to, set a localized
|
|
202
|
+
* version of the ARIA representation of the field's type. To that end, the
|
|
203
|
+
* provided value may contain message references of the form `%{BKY_...}`
|
|
204
|
+
* (e.g. `%{BKY_MY_FIELD_ARIA_TYPE}`), which are replaced with the
|
|
205
|
+
* corresponding `Blockly.Msg` value.
|
|
206
|
+
*
|
|
207
|
+
* @param ariaTypeName An ARIA representation of the field's type.
|
|
208
|
+
*/
|
|
209
|
+
setAriaTypeName(ariaTypeName: string): void;
|
|
198
210
|
/**
|
|
199
211
|
* Gets an ARIA-friendly label representation of this field's value.
|
|
200
212
|
*
|
package/core/field_dropdown.d.ts
CHANGED
|
@@ -314,7 +314,11 @@ export interface ImageProperties {
|
|
|
314
314
|
* (text, ImageProperties object, or HTML element), and the second element is
|
|
315
315
|
* the language-neutral value.
|
|
316
316
|
*/
|
|
317
|
-
export type MenuOption = [
|
|
317
|
+
export type MenuOption = [
|
|
318
|
+
string | ImageProperties | HTMLElement,
|
|
319
|
+
string,
|
|
320
|
+
string?
|
|
321
|
+
] | 'separator';
|
|
318
322
|
/**
|
|
319
323
|
* A function that generates an array of menu options for FieldDropdown
|
|
320
324
|
* or its descendants.
|
package/core/field_input.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
34
34
|
* True if the value currently displayed in the field's editory UI is valid.
|
|
35
35
|
*/
|
|
36
36
|
protected isTextValid_: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The warning icon to display on invalid input
|
|
39
|
+
*/
|
|
40
|
+
protected warningIcon: SVGElement | null;
|
|
37
41
|
/**
|
|
38
42
|
* The intial value of the field when the user opened an editor to change its
|
|
39
43
|
* value. When the editor is disposed, an event will be fired that uses this
|
|
@@ -79,6 +83,8 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
79
83
|
protected configure_(config: FieldInputConfig): void;
|
|
80
84
|
initView(): void;
|
|
81
85
|
isFullBlockField(): boolean;
|
|
86
|
+
/** Creates the DOM elements for the invalid input warning icon. */
|
|
87
|
+
protected createWarningIcon(): SVGElement | null;
|
|
82
88
|
/**
|
|
83
89
|
* Called by setValue if the text input is not valid. If the field is
|
|
84
90
|
* currently being edited it reverts value of the field to the previous
|
|
@@ -124,6 +130,7 @@ export declare abstract class FieldInput<T extends InputTypes> extends Field<str
|
|
|
124
130
|
* block field or not.
|
|
125
131
|
*/
|
|
126
132
|
protected render_(): void;
|
|
133
|
+
protected renderWarningIcon(rtl: boolean, isValid: boolean): void;
|
|
127
134
|
/**
|
|
128
135
|
* Set whether this field is spellchecked by the browser.
|
|
129
136
|
*
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Raspberry Pi Foundation
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { RenderedConnection } from './rendered_connection.js';
|
|
7
|
+
import { Size } from './utils/size.js';
|
|
8
|
+
/**
|
|
9
|
+
* Visual representation of a mid-drag block if it were to be connected.
|
|
10
|
+
*/
|
|
11
|
+
export declare class InsertionMarker {
|
|
12
|
+
/** The current size of the insertion marker, in workspace units. */
|
|
13
|
+
private size;
|
|
14
|
+
/** The DOM element representing the insertion marker. */
|
|
15
|
+
private marker?;
|
|
16
|
+
/** The static connection to which the insertion marker is attached. */
|
|
17
|
+
private parentConnection?;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the current size of the insertion marker in workspace units.
|
|
20
|
+
*/
|
|
21
|
+
getHeightWidth(): Size;
|
|
22
|
+
/**
|
|
23
|
+
* Displays an insertion marker representing the block structure if
|
|
24
|
+
* `draggingConnection` were to be connected to `staticConnection`.
|
|
25
|
+
*
|
|
26
|
+
* @param staticConnection The proposed connection on the stationary block.
|
|
27
|
+
* @param draggingConnection The proposed connection on a block being dragged.
|
|
28
|
+
*/
|
|
29
|
+
show(staticConnection: RenderedConnection, draggingConnection: RenderedConnection): void;
|
|
30
|
+
/**
|
|
31
|
+
* Hides the insertion marker.
|
|
32
|
+
*/
|
|
33
|
+
hide(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new insertion marker corresponding to the given block.
|
|
36
|
+
*
|
|
37
|
+
* @param block The block whose path will be used for the insertion marker.
|
|
38
|
+
* @returns An SVG group representing an insertion marker.
|
|
39
|
+
*/
|
|
40
|
+
private makeMarker;
|
|
41
|
+
/**
|
|
42
|
+
* Moves all connections on the given block adjacent to one another, excepting
|
|
43
|
+
* a specified connection. Otherwise identical to
|
|
44
|
+
* `BlockSvg.tightenChildrenEfficiently()`.
|
|
45
|
+
*
|
|
46
|
+
* @param block The block whose connections should be tightened.
|
|
47
|
+
* @param skip A connection to avoid tightening; generally that to which the
|
|
48
|
+
* insertion marker is being connected to, which may need to have a gap
|
|
49
|
+
* between it and its partner connection which the insertion marker will
|
|
50
|
+
* be spliced into.
|
|
51
|
+
*/
|
|
52
|
+
private partiallyTighten;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=insertion_marker.d.ts.map
|
|
@@ -13,6 +13,15 @@ export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|
|
13
13
|
private markerConn;
|
|
14
14
|
private draggedConn;
|
|
15
15
|
private staticConn;
|
|
16
|
+
private insertionMarker;
|
|
17
|
+
/**
|
|
18
|
+
* If set to true, uses a faster method for rendering insertion markers which
|
|
19
|
+
* will become the default in v14. This rendering method is enabled for the
|
|
20
|
+
* built-in Thrasos, Geras and Zelos renderers regardless of the state of this
|
|
21
|
+
* flag. Custom renderers will use the old rendering behavior unless this is
|
|
22
|
+
* set to true. This field will be removed in v14.
|
|
23
|
+
*/
|
|
24
|
+
static useFastInsertionMarkers: boolean;
|
|
16
25
|
constructor(draggedBlock: BlockSvg);
|
|
17
26
|
/**
|
|
18
27
|
* Display a connection preview where the draggedCon connects to the
|
|
@@ -28,7 +37,7 @@ export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|
|
28
37
|
previewReplacement(draggedConn: RenderedConnection, staticConn: RenderedConnection, replacedBlock: BlockSvg): void;
|
|
29
38
|
/**
|
|
30
39
|
* Display a connection preview where the draggedCon connects to the
|
|
31
|
-
* staticCon, and no block is being
|
|
40
|
+
* staticCon, and no block is being replaced.
|
|
32
41
|
*
|
|
33
42
|
* @param draggedConn The connection on the block stack being dragged.
|
|
34
43
|
* @param staticConn The connection not being dragged that we are
|
|
@@ -63,5 +72,12 @@ export declare class InsertionMarkerPreviewer implements IConnectionPreviewer {
|
|
|
63
72
|
private hideInsertionMarker;
|
|
64
73
|
/** Dispose of any references held by this connection previewer. */
|
|
65
74
|
dispose(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Returns whether or not new fast insertion marker rendering should be used.
|
|
77
|
+
* Defaults on for built-in renderers and off for custom renderers. Can be
|
|
78
|
+
* enabled for custom renderers by setting
|
|
79
|
+
* `InsertionMarkerPreviewer.useFastInsertionMarkers = true`.
|
|
80
|
+
*/
|
|
81
|
+
private shouldUseFastInsertionMarkers;
|
|
66
82
|
}
|
|
67
83
|
//# sourceMappingURL=insertion_marker_previewer.d.ts.map
|
|
@@ -54,25 +54,35 @@ interface UnknownArg {
|
|
|
54
54
|
type: string;
|
|
55
55
|
[key: string]: unknown;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* A custom ARIA label for the input, used in place of the label derived from
|
|
59
|
+
* the input's preceding fields. May contain message references of the form
|
|
60
|
+
* `%{BKY_...}`, which are replaced with the corresponding `Blockly.Msg` value.
|
|
61
|
+
*/
|
|
62
|
+
type AriaLabelText = string;
|
|
57
63
|
/** Input args */
|
|
58
64
|
interface InputValueArg {
|
|
59
65
|
type: 'input_value';
|
|
60
66
|
name?: string;
|
|
61
67
|
check?: string | string[];
|
|
62
68
|
align?: Align;
|
|
69
|
+
ariaLabelText?: AriaLabelText;
|
|
63
70
|
}
|
|
64
71
|
interface InputStatementArg {
|
|
65
72
|
type: 'input_statement';
|
|
66
73
|
name?: string;
|
|
67
74
|
check?: string | string[];
|
|
75
|
+
ariaLabelText?: AriaLabelText;
|
|
68
76
|
}
|
|
69
77
|
interface InputDummyArg {
|
|
70
78
|
type: 'input_dummy';
|
|
71
79
|
name?: string;
|
|
80
|
+
ariaLabelText?: AriaLabelText;
|
|
72
81
|
}
|
|
73
82
|
interface InputEndRowArg {
|
|
74
83
|
type: 'input_end_row';
|
|
75
84
|
name?: string;
|
|
85
|
+
ariaLabelText?: AriaLabelText;
|
|
76
86
|
}
|
|
77
87
|
/** Field args */
|
|
78
88
|
interface FieldInputArg extends FieldTextInputFromJsonConfig {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { BlockSvg } from './block_svg.js';
|
|
7
7
|
import { Connection } from './connection.js';
|
|
8
|
+
import type { InsertionMarker } from './insertion_marker.js';
|
|
8
9
|
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
9
10
|
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
10
11
|
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
@@ -19,6 +20,7 @@ export declare class RenderedConnection extends Connection implements IContextMe
|
|
|
19
20
|
private readonly offsetInBlock;
|
|
20
21
|
private trackedState;
|
|
21
22
|
private highlighted;
|
|
23
|
+
private insertionMarker?;
|
|
22
24
|
/** Connection this connection connects to. Null if not connected. */
|
|
23
25
|
targetConnection: RenderedConnection | null;
|
|
24
26
|
/**
|
|
@@ -245,6 +247,24 @@ export declare class RenderedConnection extends Connection implements IContextMe
|
|
|
245
247
|
/** See IFocusableNode.canBeFocused. */
|
|
246
248
|
canBeFocused(): boolean;
|
|
247
249
|
private findHighlightSvg;
|
|
250
|
+
/**
|
|
251
|
+
* Associates the given insertion marker with this connection.
|
|
252
|
+
*
|
|
253
|
+
* @internal
|
|
254
|
+
*/
|
|
255
|
+
attachInsertionMarker(marker: InsertionMarker): void;
|
|
256
|
+
/**
|
|
257
|
+
* Removes the insertion marker associated with this connection, if any.
|
|
258
|
+
*
|
|
259
|
+
* @internal
|
|
260
|
+
*/
|
|
261
|
+
detachInsertionMarker(): void;
|
|
262
|
+
/**
|
|
263
|
+
* Returns the insertion marker associated with this connection, if any.
|
|
264
|
+
*
|
|
265
|
+
* @internal
|
|
266
|
+
*/
|
|
267
|
+
getInsertionMarker(): InsertionMarker | undefined;
|
|
248
268
|
}
|
|
249
269
|
export declare namespace RenderedConnection {
|
|
250
270
|
/**
|
package/dart_compressed.js
CHANGED
|
@@ -12,25 +12,25 @@
|
|
|
12
12
|
}
|
|
13
13
|
}(this, function(__parent__) {
|
|
14
14
|
var $=__parent__.__namespace__;
|
|
15
|
-
var
|
|
16
|
-
f),d+=" else {\n"+f+"}";return d+"\n"},
|
|
15
|
+
var Os=function(a,b){var c=0,d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do{var e=b.valueToCode(a,"IF"+c,Z.NONE)||"false";var f=b.statementToCode(a,"DO"+c);b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+f);d+=(c>0?"else ":"")+"if ("+e+") {\n"+f+"}";c++}while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)f=a.getInput("ELSE")?b.statementToCode(a,"ELSE"):"",b.STATEMENT_SUFFIX&&(f=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+
|
|
16
|
+
f),d+=" else {\n"+f+"}";return d+"\n"},Ps=function(a,b){var c=a.getField("TIMES")?String(Number(a.getFieldValue("TIMES"))):b.valueToCode(a,"TIMES",Z.ASSIGNMENT)||"0";var d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a);a="";var e=b.nameDB_.getDistinctName("count",$.P.VARIABLE),f=c;c.match(/^\w+$/)||$.zf(c)||(f=b.nameDB_.getDistinctName("repeat_end",$.P.VARIABLE),a+="var "+f+" = "+c+";\n");return a+("for (int "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")},Qs=function(a,b){var c=a.getFieldValue("OP");
|
|
17
17
|
if(c==="NEG")return a=b.valueToCode(a,"NUM",Z.UNARY_PREFIX)||"0",a[0]==="-"&&(a=" "+a),["-"+a,Z.UNARY_PREFIX];b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c==="ABS"||c.substring(0,5)==="ROUND"?b.valueToCode(a,"NUM",Z.UNARY_POSTFIX)||"0":c==="SIN"||c==="COS"||c==="TAN"?b.valueToCode(a,"NUM",Z.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Z.NONE)||"0";switch(c){case "ABS":var d=a+".abs()";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+
|
|
18
18
|
a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d=a+".round()";break;case "ROUNDUP":d=a+".ceil()";break;case "ROUNDDOWN":d=a+".floor()";break;case "SIN":d="Math.sin("+a+" / 180 * Math.pi)";break;case "COS":d="Math.cos("+a+" / 180 * Math.pi)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.pi)"}if(d)return[d,Z.UNARY_POSTFIX];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.pi * 180";break;case "ACOS":d="Math.acos("+a+") / Math.pi * 180";
|
|
19
|
-
break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Z.MULTIPLICATIVE]},
|
|
20
|
-
"STACK"));var g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Z.NONE)||"");var h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");var m=g?"dynamic":"void",z=[],E=a.getVarModels();for(let
|
|
21
|
-
b.valueToCode(a,"TEXT",Z.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Z.UNARY_POSTFIX]},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
this.nameDB_.reset():this.nameDB_=new $.
|
|
19
|
+
break;case "ATAN":d="Math.atan("+a+") / Math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,Z.MULTIPLICATIVE]},Rs=function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d="";b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(d+=b.injectId(b.STATEMENT_SUFFIX,a));d&&(d=b.prefixLines(d,b.INDENT));var e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));var f="";a.getInput("STACK")&&(f=b.statementToCode(a,
|
|
20
|
+
"STACK"));var g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Z.NONE)||"");var h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");var m=g?"dynamic":"void",z=[],E=a.getVarModels();for(let J=0;J<E.length;J++)z[J]=b.getVariableName(E[J].getId());d=m+" "+c+"("+z.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},Ss=function(a,b){b.definitions_.import_dart_html="import 'dart:html' as Html;";var c="Html.window.prompt("+(a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):
|
|
21
|
+
b.valueToCode(a,"TEXT",Z.NONE)||"''")+", '')";a.getFieldValue("TYPE")==="NUMBER"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;",c="Math.parseDouble("+c+")");return[c,Z.UNARY_POSTFIX]},Ts=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Z.ATOMIC]},Us=function(a,b){var c=b.valueToCode(a,"VALUE",Z.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Z,Vs=Z||(Z={});Vs[Vs.ATOMIC=0]="ATOMIC";Vs[Vs.UNARY_POSTFIX=1]="UNARY_POSTFIX";
|
|
22
|
+
Vs[Vs.UNARY_PREFIX=2]="UNARY_PREFIX";Vs[Vs.MULTIPLICATIVE=3]="MULTIPLICATIVE";Vs[Vs.ADDITIVE=4]="ADDITIVE";Vs[Vs.SHIFT=5]="SHIFT";Vs[Vs.BITWISE_AND=6]="BITWISE_AND";Vs[Vs.BITWISE_XOR=7]="BITWISE_XOR";Vs[Vs.BITWISE_OR=8]="BITWISE_OR";Vs[Vs.RELATIONAL=9]="RELATIONAL";Vs[Vs.EQUALITY=10]="EQUALITY";Vs[Vs.LOGICAL_AND=11]="LOGICAL_AND";Vs[Vs.LOGICAL_OR=12]="LOGICAL_OR";Vs[Vs.IF_NULL=13]="IF_NULL";Vs[Vs.CONDITIONAL=14]="CONDITIONAL";Vs[Vs.CASCADE=15]="CASCADE";Vs[Vs.ASSIGNMENT=16]="ASSIGNMENT";
|
|
23
|
+
Vs[Vs.NONE=99]="NONE";
|
|
24
|
+
var Ws=class extends $.dq{constructor(a="Dart"){super(a);this.isInitialized=!1;for(let b in Z)a=Z[b],typeof a!=="string"&&(this["ORDER_"+b]=a);this.addReservedWords("assert,break,case,catch,class,const,continue,default,do,else,enum,extends,false,final,finally,for,if,in,is,new,null,rethrow,return,super,switch,this,throw,true,try,var,void,while,with,print,identityHashCode,identical,BidirectionalIterator,Comparable,double,Function,int,Invocation,Iterable,Iterator,List,Map,Match,num,Pattern,RegExp,Set,StackTrace,String,StringSink,Type,bool,DateTime,Deprecated,Duration,Expando,Null,Object,RuneIterator,Runes,Stopwatch,StringBuffer,Symbol,Uri,Comparator,AbstractClassInstantiationError,ArgumentError,AssertionError,CastError,ConcurrentModificationError,CyclicInitializationError,Error,Exception,FallThroughError,FormatException,IntegerDivisionByZeroException,NoSuchMethodError,NullThrownError,OutOfMemoryError,RangeError,StackOverflowError,StateError,TypeError,UnimplementedError,UnsupportedError")}init(a){super.init(a);this.nameDB_?
|
|
25
|
+
this.nameDB_.reset():this.nameDB_=new $.kj(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);var b=[],c=$.Cd(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.P.DEVELOPER_VARIABLE));a=$.Bd(a);for(c=0;c<a.length;c++)b.push(this.nameDB_.getName(a[c].getId(),$.P.VARIABLE));b.length&&(this.definitions_.variables="var "+b.join(", ")+";");this.isInitialized=!0}finish(a){a&&(a=this.prefixLines(a,this.INDENT));
|
|
26
26
|
a="main() {\n"+a+"}";var b=[],c=[];for(let d in this.definitions_){let e=this.definitions_[d];e.match(/^import\s/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+";\n"}quote_(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/\$/g,"\\$").replace(/'/g,"\\'");return"'"+a+"'"}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,
|
|
27
|
-
b,c=!1){var d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.
|
|
28
|
-
b,c=0,d=!1,e=Z.NONE){a.workspace.options.oneBasedIndex&&c--;var f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c?g=Z.ADDITIVE:d&&(g=Z.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
d=b.valueToCode(a,"FROM",Z.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"0",f=b.valueToCode(a,"BY",Z.ASSIGNMENT)||"1",g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.
|
|
32
|
-
e.match(/^\w+$/)||$.
|
|
33
|
-
"LIST",Z.ASSIGNMENT)||"[]",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"}};
|
|
27
|
+
b,c=!1){var d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.yf(e,this.COMMENT_WRAP-3),d="getProcedureDef"in a?d+this.prefixLines(e+"\n","/// "):d+this.prefixLines(e+"\n","// "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.je.VALUE&&(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"// "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjusted(a,
|
|
28
|
+
b,c=0,d=!1,e=Z.NONE){a.workspace.options.oneBasedIndex&&c--;var f=a.workspace.options.oneBasedIndex?"1":"0",g=e;c?g=Z.ADDITIVE:d&&(g=Z.UNARY_PREFIX);a=this.valueToCode(a,b,g)||f;if(c===0&&!d)return a;if($.zf(a))return a=String(Number(a)+c),d&&(a=String(-Number(a))),a;c>0?a=`${a} + ${c}`:c<0&&(a=`${a} - ${-c}`);d&&(a=c?`-(${a})`:`-${a}`);Math.floor(e)>=Math.floor(g)&&(a=`(${a})`);return a}};var Xs={};Xs.controls_if=Os;Xs.controls_ifelse=Os;Xs.logic_boolean=function(a){return[a.getFieldValue("BOOL")==="TRUE"?"true":"false",Z.ATOMIC]};Xs.logic_compare=function(a,b){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=c==="=="||c==="!="?Z.EQUALITY:Z.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]};Xs.logic_negate=function(a,b){var c=Z.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]};
|
|
29
|
+
Xs.logic_null=function(){return["null",Z.ATOMIC]};Xs.logic_operation=function(a,b){var c=a.getFieldValue("OP")==="AND"?"&&":"||",d=c==="&&"?Z.LOGICAL_AND:Z.LOGICAL_OR,e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b=c==="&&"?"true":"false",e||(e=b),a||(a=b)):a=e="false";return[e+" "+c+" "+a,d]};
|
|
30
|
+
Xs.logic_ternary=function(a,b){var c=b.valueToCode(a,"IF",Z.CONDITIONAL)||"false",d=b.valueToCode(a,"THEN",Z.CONDITIONAL)||"null";a=b.valueToCode(a,"ELSE",Z.CONDITIONAL)||"null";return[c+" ? "+d+" : "+a,Z.CONDITIONAL]};var Ys={controls_flow_statements:function(a,b){var c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){let d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");},controls_for:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),
|
|
31
|
+
d=b.valueToCode(a,"FROM",Z.ASSIGNMENT)||"0",e=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"0",f=b.valueToCode(a,"BY",Z.ASSIGNMENT)||"1",g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a);if($.zf(d)&&$.zf(e)&&$.zf(f))b=Number(d)<=Number(e),a="for ("+c+" = "+d+"; "+c+(b?" <= ":" >= ")+e+"; "+c,c=Math.abs(Number(f)),a=c===1?a+(b?"++":"--"):a+((b?" += ":" -= ")+c),a+=") {\n"+g+"}\n";else{a="";let h=d;d.match(/^\w+$/)||$.zf(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.P.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;
|
|
32
|
+
e.match(/^\w+$/)||$.zf(e)||(d=b.nameDB_.getDistinctName(c+"_end",$.P.VARIABLE),a+="var "+d+" = "+e+";\n");e=b.nameDB_.getDistinctName(c+"_inc",$.P.VARIABLE);a+="num "+e+" = ";a=$.zf(f)?a+(Math.abs(Number(f))+";\n"):a+("("+f+").abs();\n");a+="if ("+h+" > "+d+") {\n";a+=b.INDENT+e+" = -"+e+";\n";a=a+"}\nfor ("+(c+" = "+h+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n")}return a},controls_forEach:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,
|
|
33
|
+
"LIST",Z.ASSIGNMENT)||"[]",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);return"for (var "+c+" in "+d+") {\n"+e+"}\n"}};Ys.controls_repeat=Ps;Ys.controls_repeat_ext=Ps;Ys.controls_whileUntil=function(a,b){var c=a.getFieldValue("MODE")==="UNTIL",d=b.valueToCode(a,"BOOL",c?Z.UNARY_PREFIX:Z.NONE)||"false",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};var Zs={math_arithmetic:function(a,b){var c={ADD:[" + ",Z.ADDITIVE],MINUS:[" - ",Z.ADDITIVE],MULTIPLY:[" * ",Z.MULTIPLICATIVE],DIVIDE:[" / ",Z.MULTIPLICATIVE],POWER:[null,Z.NONE]}[a.getFieldValue("OP")],d=c[0];c=c[1];var e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return d?[e+d+a,c]:(b.definitions_.import_dart_math="import 'dart:math' as Math;",["Math.pow("+e+", "+a+")",Z.UNARY_POSTFIX])},math_atan2:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=
|
|
34
34
|
b.valueToCode(a,"X",Z.NONE)||"0";return["Math.atan2("+(b.valueToCode(a,"Y",Z.NONE)||"0")+", "+c+") / Math.pi * 180",Z.MULTIPLICATIVE]},math_change:function(a,b){var c=b.valueToCode(a,"DELTA",Z.ADDITIVE)||"0";a=b.getVariableName(a.getFieldValue("VAR"));return a+" = ("+a+" is num ? "+a+" : 0) + "+c+";\n"},math_constant:function(a,b){var c={PI:["Math.pi",Z.UNARY_POSTFIX],E:["Math.e",Z.UNARY_POSTFIX],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",Z.MULTIPLICATIVE],SQRT2:["Math.sqrt2",Z.UNARY_POSTFIX],SQRT1_2:["Math.sqrt1_2",
|
|
35
35
|
Z.UNARY_POSTFIX],INFINITY:["double.infinity",Z.ATOMIC]};a=a.getFieldValue("CONSTANT");a!=="INFINITY"&&(b.definitions_.import_dart_math="import 'dart:math' as Math;");return c[a]},math_constrain:function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";var c=b.valueToCode(a,"VALUE",Z.NONE)||"0",d=b.valueToCode(a,"LOW",Z.NONE)||"0";a=b.valueToCode(a,"HIGH",Z.NONE)||"double.infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",Z.UNARY_POSTFIX]},math_modulo:function(a,b){var c=
|
|
36
36
|
b.valueToCode(a,"DIVIDEND",Z.MULTIPLICATIVE)||"0";a=b.valueToCode(a,"DIVISOR",Z.MULTIPLICATIVE)||"0";return[c+" % "+a,Z.MULTIPLICATIVE]},math_number:function(a){a=Number(a.getFieldValue("NUM"));return a===Infinity?["double.infinity",Z.UNARY_POSTFIX]:a===-Infinity?["-double.infinity",Z.UNARY_PREFIX]:[String(a),a<0?Z.UNARY_PREFIX:Z.ATOMIC]},math_number_property:function(a,b){var c={EVEN:[" % 2 == 0",Z.MULTIPLICATIVE,Z.EQUALITY],ODD:[" % 2 == 1",Z.MULTIPLICATIVE,Z.EQUALITY],WHOLE:[" % 1 == 0",Z.MULTIPLICATIVE,
|
|
@@ -156,8 +156,8 @@ int ${b.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {
|
|
|
156
156
|
}
|
|
157
157
|
return new Math.Random().nextInt(b - a + 1) + a;
|
|
158
158
|
}
|
|
159
|
-
`)+"("+c+", "+a+")",Z.UNARY_POSTFIX]}};
|
|
160
|
-
|
|
159
|
+
`)+"("+c+", "+a+")",Z.UNARY_POSTFIX]}};Zs.math_round=Qs;Zs.math_single=Qs;Zs.math_trig=Qs;var $s={procedures_callnoreturn:function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+";\n"},procedures_callreturn:function(a,b){var c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVarModels();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Z.NONE)||"null";return[c+"("+d.join(", ")+")",Z.UNARY_POSTFIX]}};$s.procedures_defnoreturn=Rs;$s.procedures_defreturn=Rs;
|
|
160
|
+
$s.procedures_ifreturn=function(a,b){var c="if ("+(b.valueToCode(a,"CONDITION",Z.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Z.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"};var at={text:function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Z.ATOMIC]},text_append:function(a,b){var c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Z.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_changeCase:function(a,b){var c={UPPERCASE:".toUpperCase()",LOWERCASE:".toLowerCase()",TITLECASE:null}[a.getFieldValue("CASE")];a=b.valueToCode(a,"TEXT",c?Z.UNARY_POSTFIX:Z.NONE)||"''";return[c?a+c:b.provideFunction_("text_toTitleCase",`
|
|
161
161
|
String ${b.FUNCTION_NAME_PLACEHOLDER_}(String str) {
|
|
162
162
|
RegExp exp = new RegExp(r'\\b');
|
|
163
163
|
List<String> list = str.split(exp);
|
|
@@ -217,10 +217,10 @@ String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, String where1, num at1, Stri
|
|
|
217
217
|
return text.substring(at1, at2);
|
|
218
218
|
}
|
|
219
219
|
`)+"("+f+", '"+c+"', "+g+", '"+d+"', "+a+")";return[b,Z.UNARY_POSTFIX]},text_indexOf:function(a,b){var c=a.getFieldValue("END")==="FIRST"?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Z.NONE)||"''";b=(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Z.ADDITIVE]:[b,Z.UNARY_POSTFIX]},text_isEmpty:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".isEmpty",Z.UNARY_POSTFIX]},text_join:function(a,b){switch(a.itemCount_){case 0:return["''",
|
|
220
|
-
Z.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Z.UNARY_POSTFIX)||"''")+".toString()",Z.UNARY_POSTFIX];default:let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"''";return["["+c.join(",")+"].join()",Z.UNARY_POSTFIX]}},text_length:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".length",Z.UNARY_POSTFIX]},text_print:function(a,b){return"print("+(b.valueToCode(a,"TEXT",Z.NONE)||"''")+");\n"}};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
var
|
|
220
|
+
Z.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Z.UNARY_POSTFIX)||"''")+".toString()",Z.UNARY_POSTFIX];default:let c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"''";return["["+c.join(",")+"].join()",Z.UNARY_POSTFIX]}},text_length:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"''")+".length",Z.UNARY_POSTFIX]},text_print:function(a,b){return"print("+(b.valueToCode(a,"TEXT",Z.NONE)||"''")+");\n"}};at.text_prompt=Ss;at.text_prompt_ext=Ss;
|
|
221
|
+
at.text_replace=function(a,b){var c=b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''",d=b.valueToCode(a,"FROM",Z.NONE)||"''";a=b.valueToCode(a,"TO",Z.NONE)||"''";return[c+".replaceAll("+d+", "+a+")",Z.UNARY_POSTFIX]};at.text_reverse=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Z.UNARY_PREFIX]};
|
|
222
|
+
at.text_trim=function(a,b){var c={LEFT:".replaceFirst(new RegExp(r'^\\s+'), '')",RIGHT:".replaceFirst(new RegExp(r'\\s+$'), '')",BOTH:".trim()"}[a.getFieldValue("MODE")];return[(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+c,Z.UNARY_POSTFIX]};var bt={};bt.variables_get=Ts;bt.variables_set=Us;var ct={};ct.variables_get_dynamic=Ts;ct.variables_set_dynamic=Us;var dt=new Ws;dt.addReservedWords("Html,Math");
|
|
223
|
+
var et=Object.assign({},{lists_create_empty:function(){return["[]",Z.ATOMIC]},lists_create_with:function(a,b){var c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Z.NONE)||"null";return["["+c.join(", ")+"]",Z.ATOMIC]},lists_getIndex:function(a,b){function c(){var g=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),h="List "+g+" = "+f+";\n";f=g;return h}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"VALUE",e==="RANDOM"||
|
|
224
224
|
e==="FROM_END"?Z.NONE:Z.UNARY_POSTFIX)||"[]";if((e!=="RANDOM"||d!=="REMOVE")&&e!=="FROM_END"||f.match(/^\w+$/))switch(e){case "FIRST":if(d==="GET")return[f+".first",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt(0)",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt(0);\n";break;case "LAST":if(d==="GET")return[f+".last",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeLast()",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeLast();\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");
|
|
225
225
|
if(d==="GET")return[f+"["+a+"]",Z.UNARY_POSTFIX];if(d==="GET_REMOVE")return[f+".removeAt("+a+")",Z.UNARY_POSTFIX];if(d==="REMOVE")return f+".removeAt("+a+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Z.ADDITIVE);if(d==="GET")return[f+"["+f+".length - "+a+"]",Z.UNARY_POSTFIX];if(d==="GET_REMOVE"||d==="REMOVE"){a=f+".removeAt("+f+".length - "+a+")";if(d==="GET_REMOVE")return[a,Z.UNARY_POSTFIX];if(d==="REMOVE")return a+";\n"}break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";
|
|
226
226
|
if(d==="REMOVE")return d=b.nameDB_.getDistinctName("tmp_x",$.P.VARIABLE),"int "+d+" = new Math.Random().nextInt("+f+".length);\n"+(f+".removeAt("+d+");\n");if(d==="GET")return[b.provideFunction_("lists_get_random_item",`
|
|
@@ -280,7 +280,7 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
|
|
|
280
280
|
list.sort(compare);
|
|
281
281
|
return list;
|
|
282
282
|
}
|
|
283
|
-
`)+"("+c+', "'+a+'", '+d+")",Z.UNARY_POSTFIX]},lists_split:function(a,b){var c=b.valueToCode(a,"INPUT",Z.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Z.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+b+")",Z.UNARY_POSTFIX]}},
|
|
283
|
+
`)+"("+c+', "'+a+'", '+d+")",Z.UNARY_POSTFIX]},lists_split:function(a,b){var c=b.valueToCode(a,"INPUT",Z.UNARY_POSTFIX);b=b.valueToCode(a,"DELIM",Z.NONE)||"''";a=a.getFieldValue("MODE");if(a==="SPLIT")c||(c="''"),a="split";else if(a==="JOIN")c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+b+")",Z.UNARY_POSTFIX]}},Xs,Ys,Zs,$s,at,bt,ct);for(let a in et)dt.forBlock[a]=et[a];var ft={};ft.DartGenerator=Ws;ft.Order=Z;ft.dartGenerator=dt;$.__chunk_dart=ft;
|
|
284
284
|
$.__chunk_dart.__namespace__=$;
|
|
285
285
|
return $.__chunk_dart;
|
|
286
286
|
}));
|