blockly 13.3.0 → 13.4.1-beta.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 +1006 -986
- package/blockly_compressed.js +888 -873
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +86 -86
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +2 -2
- package/core/block_aria_composer.d.ts +1 -1
- package/core/block_svg.d.ts +7 -7
- package/core/bubbles/bubble.d.ts +4 -4
- package/core/bubbles/mini_workspace_bubble.d.ts +5 -3
- package/core/bubbles/text_bubble.d.ts +9 -5
- package/core/bubbles/textinput_bubble.d.ts +1 -1
- package/core/clipboard/block_paster.d.ts +5 -5
- package/core/clipboard/registry.d.ts +1 -1
- package/core/clipboard/workspace_comment_paster.d.ts +4 -4
- package/core/clipboard.d.ts +1 -1
- package/core/comments/comment_editor.d.ts +6 -6
- package/core/comments/comment_view.d.ts +3 -3
- package/core/comments/rendered_workspace_comment.d.ts +11 -11
- package/core/comments/workspace_comment.d.ts +2 -2
- package/core/common.d.ts +2 -2
- package/core/config.d.ts +37 -11
- package/core/contextmenu_registry.d.ts +2 -2
- package/core/events/events_block_base.d.ts +2 -1
- package/core/events/events_block_change.d.ts +3 -2
- package/core/events/events_block_create.d.ts +3 -2
- package/core/events/events_block_delete.d.ts +3 -2
- package/core/events/events_block_drag.d.ts +2 -2
- package/core/events/events_block_field_intermediate_change.d.ts +3 -2
- package/core/events/events_block_move.d.ts +2 -1
- package/core/events/events_click.d.ts +2 -2
- package/core/events/events_comment_base.d.ts +2 -1
- package/core/events/events_comment_change.d.ts +2 -1
- package/core/events/events_comment_collapse.d.ts +3 -2
- package/core/events/events_comment_create.d.ts +2 -1
- package/core/events/events_comment_delete.d.ts +2 -1
- package/core/events/events_comment_drag.d.ts +2 -2
- package/core/events/events_comment_move.d.ts +8 -2
- package/core/events/events_comment_resize.d.ts +2 -1
- package/core/events/events_selected.d.ts +1 -1
- package/core/events/events_theme_change.d.ts +1 -1
- package/core/events/events_toolbox_item_select.d.ts +1 -1
- package/core/events/events_trashcan_open.d.ts +1 -1
- package/core/events/events_var_base.d.ts +2 -1
- package/core/events/events_var_create.d.ts +2 -1
- package/core/events/events_var_delete.d.ts +2 -1
- package/core/events/events_var_rename.d.ts +2 -1
- package/core/events/events_var_type_change.d.ts +2 -1
- package/core/events/events_viewport.d.ts +1 -1
- package/core/field.d.ts +4 -3
- package/core/field_checkbox.d.ts +2 -1
- package/core/field_dropdown.d.ts +2 -1
- package/core/field_image.d.ts +2 -1
- package/core/field_input.d.ts +3 -2
- package/core/field_label.d.ts +2 -1
- package/core/field_label_serializable.d.ts +2 -1
- package/core/field_number.d.ts +2 -1
- package/core/field_textinput.d.ts +3 -2
- package/core/field_variable.d.ts +5 -3
- package/core/flyout_base.d.ts +4 -3
- package/core/flyout_horizontal.d.ts +13 -0
- package/core/flyout_metrics_manager.d.ts +2 -1
- package/core/generator.d.ts +1 -1
- package/core/gesture.d.ts +2 -2
- package/core/grid.d.ts +1 -1
- package/core/icons/icon_types.d.ts +4 -4
- package/core/icons/registry.d.ts +1 -1
- package/core/insertion_marker.d.ts +1 -1
- package/core/insertion_marker_previewer.d.ts +3 -3
- package/core/interfaces/i_bubble.d.ts +2 -2
- package/core/interfaces/i_comment_icon.d.ts +6 -6
- package/core/interfaces/i_drag_target.d.ts +2 -2
- package/core/interfaces/i_icon.d.ts +1 -1
- package/core/interfaces/i_json_block_definition.d.ts +7 -7
- package/core/interfaces/i_keyboard_accessible.d.ts +1 -1
- package/core/interfaces/i_parameter_model.d.ts +2 -2
- package/core/interfaces/i_paster.d.ts +3 -3
- package/core/interfaces/i_procedure_block.d.ts +1 -1
- package/core/interfaces/i_procedure_map.d.ts +1 -1
- package/core/interfaces/i_procedure_model.d.ts +2 -2
- package/core/interfaces/i_selectable.d.ts +1 -1
- package/core/interfaces/i_variable_backed_parameter_model.d.ts +1 -1
- package/core/layer_manager.d.ts +3 -3
- package/core/observable_procedure_map.d.ts +1 -1
- package/core/procedures.d.ts +1 -1
- package/core/render_management.d.ts +1 -1
- package/core/rendered_connection.d.ts +1 -1
- package/core/renderers/common/info.d.ts +1 -1
- package/core/renderers/common/path_object.d.ts +2 -2
- package/core/renderers/zelos/drawer.d.ts +1 -1
- package/core/renderers/zelos/info.d.ts +1 -1
- package/core/serialization/procedures.d.ts +2 -2
- package/core/serialization/workspace_comments.d.ts +2 -2
- package/core/shortcut_registry.d.ts +2 -2
- package/core/utils/aria.d.ts +1 -1
- package/core/utils/dom.d.ts +17 -2
- package/core/utils/style.d.ts +14 -0
- package/core/utils/toolbox.d.ts +0 -8
- package/core/variable_map.d.ts +1 -1
- package/core/variable_model.d.ts +1 -1
- package/core/variables.d.ts +1 -1
- package/core/workspace.d.ts +2 -2
- package/core/workspace_focus_target.d.ts +6 -1
- package/core/workspace_svg.d.ts +3 -3
- package/core/xml.d.ts +1 -1
- package/dart_compressed.js +25 -25
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +27 -27
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +24 -24
- package/lua_compressed.js.map +1 -1
- 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 +162 -157
- 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 +5 -0
- package/msg/fi.mjs +5 -0
- package/msg/fo.js +5 -0
- package/msg/fo.mjs +5 -0
- package/msg/fr.js +10 -5
- package/msg/fr.mjs +5 -0
- package/msg/frr.js +5 -0
- package/msg/frr.mjs +5 -0
- package/msg/ga.js +12 -7
- package/msg/ga.mjs +5 -0
- package/msg/gl.js +5 -0
- 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 +25 -20
- 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 +5 -0
- 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 +34 -29
- package/msg/kn.mjs +5 -0
- package/msg/ko.js +11 -6
- 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 +16 -11
- 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 +7 -2
- 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 +6 -1
- package/msg/ne.mjs +5 -0
- package/msg/nl.js +5 -0
- 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 +5 -0
- 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 +13 -8
- 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 +12 -7
- package/msg/sk.mjs +5 -0
- package/msg/skr-arab.js +487 -482
- 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 +6 -1
- package/msg/tcy.mjs +5 -0
- package/msg/tdd.js +23 -18
- 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 +5 -0
- 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 +24 -19
- 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 +41 -36
- package/msg/zh-hant.mjs +5 -0
- package/package.json +12 -18
- package/php_compressed.js +21 -21
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +27 -27
- package/python_compressed.js.map +1 -1
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { WorkspaceComment } from '../comments/workspace_comment.js';
|
|
7
|
-
import { ISerializer } from '../interfaces/i_serializer.js';
|
|
8
|
-
import { Workspace } from '../workspace.js';
|
|
7
|
+
import type { ISerializer } from '../interfaces/i_serializer.js';
|
|
8
|
+
import type { Workspace } from '../workspace.js';
|
|
9
9
|
export interface State {
|
|
10
10
|
id?: string;
|
|
11
11
|
text?: string;
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @class
|
|
11
11
|
*/
|
|
12
|
-
import { Scope } from './contextmenu_registry.js';
|
|
12
|
+
import type { Scope } from './contextmenu_registry.js';
|
|
13
13
|
import { KeyCodes } from './utils/keycodes.js';
|
|
14
|
-
import { WorkspaceSvg } from './workspace_svg.js';
|
|
14
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
15
15
|
/**
|
|
16
16
|
* Class for the registry of keyboard shortcuts. This is intended to be a
|
|
17
17
|
* singleton. You should not create a new instance, and only access this class
|
package/core/utils/aria.d.ts
CHANGED
|
@@ -276,7 +276,7 @@ export declare function getState(element: Element, stateName: State): string | n
|
|
|
276
276
|
*
|
|
277
277
|
* @param parent The container element to which the live region will be appended.
|
|
278
278
|
*/
|
|
279
|
-
export declare function initializeGlobalAriaLiveRegion(parent:
|
|
279
|
+
export declare function initializeGlobalAriaLiveRegion(parent: HTMLElement): void;
|
|
280
280
|
/**
|
|
281
281
|
* Requests that the specified text be read to the user if a screen reader is
|
|
282
282
|
* currently active.
|
package/core/utils/dom.d.ts
CHANGED
|
@@ -112,6 +112,17 @@ export declare function stopTextWidthCache(): void;
|
|
|
112
112
|
* @returns Width of element.
|
|
113
113
|
*/
|
|
114
114
|
export declare function getTextWidth(textElement: SVGTextElement): number;
|
|
115
|
+
/**
|
|
116
|
+
* Gets the size of a text element, caching it in the process.
|
|
117
|
+
*
|
|
118
|
+
* @internal
|
|
119
|
+
* @param textElement An SVG 'text' element.
|
|
120
|
+
* @returns Height and width of the element.
|
|
121
|
+
*/
|
|
122
|
+
export declare function getTextSize(textElement: SVGTextElement): {
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
};
|
|
115
126
|
/**
|
|
116
127
|
* Gets the width of a text element using a faster method than `getTextWidth`.
|
|
117
128
|
* This method requires that we know the text element's font family and size in
|
|
@@ -121,9 +132,11 @@ export declare function getTextWidth(textElement: SVGTextElement): number;
|
|
|
121
132
|
* @param fontSize The font size to use.
|
|
122
133
|
* @param fontWeight The font weight to use.
|
|
123
134
|
* @param fontFamily The font family to use.
|
|
135
|
+
* @param letterSpacing The letter spacing to use.
|
|
136
|
+
* @param wordSpacing The word spacing to use.
|
|
124
137
|
* @returns Width of element.
|
|
125
138
|
*/
|
|
126
|
-
export declare function getFastTextWidth(textElement: SVGTextElement, fontSize: number, fontWeight: string, fontFamily: string): number;
|
|
139
|
+
export declare function getFastTextWidth(textElement: SVGTextElement, fontSize: number, fontWeight: string, fontFamily: string, letterSpacing?: string, wordSpacing?: string): number;
|
|
127
140
|
/**
|
|
128
141
|
* Gets the width of a text element using a faster method than `getTextWidth`.
|
|
129
142
|
* This method requires that we know the text element's font family and size in
|
|
@@ -135,9 +148,11 @@ export declare function getFastTextWidth(textElement: SVGTextElement, fontSize:
|
|
|
135
148
|
* @param fontSize The font size to use.
|
|
136
149
|
* @param fontWeight The font weight to use.
|
|
137
150
|
* @param fontFamily The font family to use.
|
|
151
|
+
* @param letterSpacing The letter spacing to use.
|
|
152
|
+
* @param wordSpacing The word spacing to use.
|
|
138
153
|
* @returns Width of element.
|
|
139
154
|
*/
|
|
140
|
-
export declare function getFastTextWidthWithSizeString(textElement: SVGTextElement, fontSize: string, fontWeight: string, fontFamily: string): number;
|
|
155
|
+
export declare function getFastTextWidthWithSizeString(textElement: SVGTextElement, fontSize: string, fontWeight: string, fontFamily: string, letterSpacing?: string, wordSpacing?: string): number;
|
|
141
156
|
/**
|
|
142
157
|
* Measure a font's metrics. The height and baseline values.
|
|
143
158
|
*
|
package/core/utils/style.d.ts
CHANGED
|
@@ -53,6 +53,20 @@ export declare function getViewportPageOffset(): Coordinate;
|
|
|
53
53
|
* @returns The computed border widths.
|
|
54
54
|
*/
|
|
55
55
|
export declare function getBorderBox(element: Element): Rect;
|
|
56
|
+
/**
|
|
57
|
+
* Converts a point in page coordinates into the equivalent CSS `left`/`top`
|
|
58
|
+
* for an absolutely positioned child of `container`.
|
|
59
|
+
*
|
|
60
|
+
* Those properties are resolved against the container's padding box, so the
|
|
61
|
+
* container's border widths have to be subtracted along with its position.
|
|
62
|
+
*
|
|
63
|
+
* @param x Horizontal page coordinate.
|
|
64
|
+
* @param y Vertical page coordinate.
|
|
65
|
+
* @param container The relatively positioned parent element.
|
|
66
|
+
* @returns The equivalent point relative to the container's padding box.
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
export declare function pageToContainerOffset(x: number, y: number, container: Element): Coordinate;
|
|
56
70
|
/**
|
|
57
71
|
* Changes the scroll position of `container` with the minimum amount so
|
|
58
72
|
* that the content and the borders of the given `element` become visible.
|
package/core/utils/toolbox.d.ts
CHANGED
|
@@ -154,10 +154,6 @@ export declare function convertFlyoutDefToJsonArray(flyoutDef: FlyoutDefinition
|
|
|
154
154
|
* @internal
|
|
155
155
|
*/
|
|
156
156
|
export declare function hasCategories(toolboxJson: ToolboxInfo | null): boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Private version of hasCategories for stubbing in tests.
|
|
159
|
-
*/
|
|
160
|
-
declare function hasCategoriesInternal(toolboxJson: ToolboxInfo | null): boolean;
|
|
161
157
|
/**
|
|
162
158
|
* Whether or not the category is collapsible.
|
|
163
159
|
*
|
|
@@ -173,8 +169,4 @@ export declare function isCategoryCollapsible(categoryInfo: CategoryInfo): boole
|
|
|
173
169
|
* @returns DOM tree of blocks, or null.
|
|
174
170
|
*/
|
|
175
171
|
export declare function parseToolboxTree(toolboxDef: Element | null | string): Element | null;
|
|
176
|
-
export declare const TEST_ONLY: {
|
|
177
|
-
hasCategoriesInternal: typeof hasCategoriesInternal;
|
|
178
|
-
};
|
|
179
|
-
export {};
|
|
180
172
|
//# sourceMappingURL=toolbox.d.ts.map
|
package/core/variable_map.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
7
|
-
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
7
|
+
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
8
8
|
import type { Workspace } from './workspace.js';
|
|
9
9
|
/**
|
|
10
10
|
* Class for a variable map. This contains a dictionary data structure with
|
package/core/variable_model.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
6
|
+
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
7
7
|
import type { Workspace } from './workspace.js';
|
|
8
8
|
/**
|
|
9
9
|
* Class for a variable model.
|
package/core/variables.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { Block } from './block.js';
|
|
7
|
-
import { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
7
|
+
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
8
8
|
import type { BlockInfo, FlyoutItemInfo } from './utils/toolbox.js';
|
|
9
9
|
import type { Workspace } from './workspace.js';
|
|
10
10
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
package/core/workspace.d.ts
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* @class
|
|
10
10
|
*/
|
|
11
11
|
import type { Block } from './block.js';
|
|
12
|
-
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
12
|
+
import type { WorkspaceComment } from './comments/workspace_comment.js';
|
|
13
13
|
import type { ConnectionDB } from './connection_db.js';
|
|
14
14
|
import type { Abstract } from './events/events_abstract.js';
|
|
15
15
|
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
16
16
|
import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
17
|
-
import { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
17
|
+
import type { IProcedureMap } from './interfaces/i_procedure_map.js';
|
|
18
18
|
import type { IVariableMap } from './interfaces/i_variable_map.js';
|
|
19
19
|
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
20
20
|
import { Options } from './options.js';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Raspberry Pi Foundation
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import type { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
6
7
|
import type { IFocusableNode } from './interfaces/i_focusable_node.js';
|
|
7
8
|
import type { IFocusableTree } from './interfaces/i_focusable_tree.js';
|
|
8
9
|
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
@@ -18,7 +19,7 @@ import type { WorkspaceSvg } from './workspace_svg.js';
|
|
|
18
19
|
* description; the enclosing region keeps a short, stable label
|
|
19
20
|
* ("Blocks workspace.").
|
|
20
21
|
*/
|
|
21
|
-
export declare class WorkspaceFocusTarget implements IFocusableNode {
|
|
22
|
+
export declare class WorkspaceFocusTarget implements IFocusableNode, IContextMenu {
|
|
22
23
|
private readonly workspace;
|
|
23
24
|
private readonly element;
|
|
24
25
|
/**
|
|
@@ -42,5 +43,9 @@ export declare class WorkspaceFocusTarget implements IFocusableNode {
|
|
|
42
43
|
* @returns The workspace this focus target represents.
|
|
43
44
|
*/
|
|
44
45
|
getWorkspace(): WorkspaceSvg;
|
|
46
|
+
/**
|
|
47
|
+
* Displays the workspace's context menu.
|
|
48
|
+
*/
|
|
49
|
+
showContextMenu(e: Event): void;
|
|
45
50
|
}
|
|
46
51
|
//# sourceMappingURL=workspace_focus_target.d.ts.map
|
package/core/workspace_svg.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ import type { Block } from './block.js';
|
|
|
12
12
|
import type { BlockSvg } from './block_svg.js';
|
|
13
13
|
import * as browserEvents from './browser_events.js';
|
|
14
14
|
import { RenderedWorkspaceComment } from './comments/rendered_workspace_comment.js';
|
|
15
|
-
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
15
|
+
import type { WorkspaceComment } from './comments/workspace_comment.js';
|
|
16
16
|
import { ComponentManager } from './component_manager.js';
|
|
17
|
-
import { ContextMenuOption } from './contextmenu_registry.js';
|
|
17
|
+
import type { ContextMenuOption } from './contextmenu_registry.js';
|
|
18
18
|
import type { FlyoutButton } from './flyout_button.js';
|
|
19
19
|
import { Gesture } from './gesture.js';
|
|
20
20
|
import { Grid } from './grid.js';
|
|
21
21
|
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
22
|
-
import { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
22
|
+
import type { IContextMenu } from './interfaces/i_contextmenu.js';
|
|
23
23
|
import type { IDragTarget } from './interfaces/i_drag_target.js';
|
|
24
24
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
25
25
|
import { type IFocusableNode } from './interfaces/i_focusable_node.js';
|
package/core/xml.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { Block } from './block.js';
|
|
|
7
7
|
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
8
8
|
import type { IVariableModel, IVariableState } from './interfaces/i_variable_model.js';
|
|
9
9
|
import type { Workspace } from './workspace.js';
|
|
10
|
-
import { WorkspaceSvg } from './workspace_svg.js';
|
|
10
|
+
import type { WorkspaceSvg } from './workspace_svg.js';
|
|
11
11
|
/**
|
|
12
12
|
* Encode a block tree as XML.
|
|
13
13
|
*
|
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 mt=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"},nt=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+$/)||$.Bf(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")},ot=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
|
|
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]},pt=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 l=g?"dynamic":"void",z=[],F=a.getVarModels();for(let J=0;J<F.length;J++)z[J]=b.getVariableName(F[J].getId());d=l+" "+c+"("+z.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},qt=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]},rt=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Z.ATOMIC]},st=function(a,b){var c=b.valueToCode(a,"VALUE",Z.ASSIGNMENT)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+";\n"},Z,tt=Z||(Z={});tt[tt.ATOMIC=0]="ATOMIC";tt[tt.UNARY_POSTFIX=1]="UNARY_POSTFIX";
|
|
22
|
+
tt[tt.UNARY_PREFIX=2]="UNARY_PREFIX";tt[tt.MULTIPLICATIVE=3]="MULTIPLICATIVE";tt[tt.ADDITIVE=4]="ADDITIVE";tt[tt.SHIFT=5]="SHIFT";tt[tt.BITWISE_AND=6]="BITWISE_AND";tt[tt.BITWISE_XOR=7]="BITWISE_XOR";tt[tt.BITWISE_OR=8]="BITWISE_OR";tt[tt.RELATIONAL=9]="RELATIONAL";tt[tt.EQUALITY=10]="EQUALITY";tt[tt.LOGICAL_AND=11]="LOGICAL_AND";tt[tt.LOGICAL_OR=12]="LOGICAL_OR";tt[tt.IF_NULL=13]="IF_NULL";tt[tt.CONDITIONAL=14]="CONDITIONAL";tt[tt.CASCADE=15]="CASCADE";tt[tt.ASSIGNMENT=16]="ASSIGNMENT";
|
|
23
|
+
tt[tt.NONE=99]="NONE";
|
|
24
|
+
var ut=class extends $.Bq{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 $.Ej(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);var b=[],c=$.Ed(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.P.DEVELOPER_VARIABLE));a=$.Dd(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=$.Af(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===$.le.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($.Bf(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 vt={};vt.controls_if=mt;vt.controls_ifelse=mt;vt.logic_boolean=function(a){return[a.getFieldValue("BOOL")==="TRUE"?"true":"false",Z.ATOMIC]};vt.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]};vt.logic_negate=function(a,b){var c=Z.UNARY_PREFIX;return["!"+(b.valueToCode(a,"BOOL",c)||"true"),c]};
|
|
29
|
+
vt.logic_null=function(){return["null",Z.ATOMIC]};vt.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
|
+
vt.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 wt={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($.Bf(d)&&$.Bf(e)&&$.Bf(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+$/)||$.Bf(d)||(h=b.nameDB_.getDistinctName(c+"_start",$.P.VARIABLE),a+="var "+h+" = "+d+";\n");d=e;
|
|
32
|
+
e.match(/^\w+$/)||$.Bf(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=$.Bf(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"}};wt.controls_repeat=nt;wt.controls_repeat_ext=nt;wt.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 xt={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]}};xt.math_round=ot;xt.math_single=ot;xt.math_trig=ot;var yt={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]}};yt.procedures_defnoreturn=pt;yt.procedures_defreturn=pt;
|
|
160
|
+
yt.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 zt={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"}};zt.text_prompt=qt;zt.text_prompt_ext=qt;
|
|
221
|
+
zt.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]};zt.text_reverse=function(a,b){return["new String.fromCharCodes("+(b.valueToCode(a,"TEXT",Z.UNARY_POSTFIX)||"''")+".runes.toList().reversed)",Z.UNARY_PREFIX]};
|
|
222
|
+
zt.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 At={};At.variables_get=rt;At.variables_set=st;var Bt={};Bt.variables_get_dynamic=rt;Bt.variables_set_dynamic=st;var Ct=new ut;Ct.addReservedWords("Html,Math");
|
|
223
|
+
var Dt=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",`
|
|
@@ -263,8 +263,8 @@ List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String where1, num at1, String w
|
|
|
263
263
|
return list.sublist(at1, at2);
|
|
264
264
|
}
|
|
265
265
|
`)+"("+c+", '"+d+"', "+f+", '"+e+"', "+a+")";return[b,Z.UNARY_POSTFIX]},lists_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]},lists_isEmpty:function(a,b){return[(b.valueToCode(a,"VALUE",Z.UNARY_POSTFIX)||"[]")+".isEmpty",Z.UNARY_POSTFIX]},lists_length:function(a,b){return[(b.valueToCode(a,
|
|
266
|
-
"VALUE",Z.UNARY_POSTFIX)||"[]")+".length",Z.UNARY_POSTFIX]},lists_repeat:function(a,b){var c=b.valueToCode(a,"ITEM",Z.NONE)||"null";return["new List.filled("+(b.valueToCode(a,"NUM",Z.NONE)||"0")+", "+c+")",Z.UNARY_POSTFIX]},lists_reverse:function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Z.NONE)||"[]")+".reversed)",Z.UNARY_POSTFIX]},lists_setIndex:function(a,b){function c(){if(f.match(/^\w+$/))return"";var h=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),
|
|
267
|
-
h;return
|
|
266
|
+
"VALUE",Z.UNARY_POSTFIX)||"[]")+".length",Z.UNARY_POSTFIX]},lists_repeat:function(a,b){var c=b.valueToCode(a,"ITEM",Z.NONE)||"null";return["new List.filled("+(b.valueToCode(a,"NUM",Z.NONE)||"0")+", "+c+")",Z.UNARY_POSTFIX]},lists_reverse:function(a,b){return["new List.from("+(b.valueToCode(a,"LIST",Z.NONE)||"[]")+".reversed)",Z.UNARY_POSTFIX]},lists_setIndex:function(a,b){function c(){if(f.match(/^\w+$/))return"";var h=b.nameDB_.getDistinctName("tmp_list",$.P.VARIABLE),l="List "+h+" = "+f+";\n";f=
|
|
267
|
+
h;return l}var d=a.getFieldValue("MODE")||"GET",e=a.getFieldValue("WHERE")||"FROM_START",f=b.valueToCode(a,"LIST",Z.UNARY_POSTFIX)||"[]",g=b.valueToCode(a,"TO",Z.ASSIGNMENT)||"null";switch(e){case "FIRST":if(d==="SET")return f+"[0] = "+g+";\n";if(d==="INSERT")return f+".insert(0, "+g+");\n";break;case "LAST":if(d==="SET")return c()+(f+"["+f+".length - 1] = "+g+";\n");if(d==="INSERT")return f+".add("+g+");\n";break;case "FROM_START":a=b.getAdjusted(a,"AT");if(d==="SET")return f+"["+a+"] = "+g+";\n";
|
|
268
268
|
if(d==="INSERT")return f+".insert("+a+", "+g+");\n";break;case "FROM_END":a=b.getAdjusted(a,"AT",1,!1,Z.ADDITIVE);e=c();if(d==="SET")return e+(f+"["+f+".length - "+a+"] = "+g+";\n");if(d==="INSERT")return e+(f+".insert("+f+".length - "+a+", "+g+");\n");break;case "RANDOM":b.definitions_.import_dart_math="import 'dart:math' as Math;";a=c();e=b.nameDB_.getDistinctName("tmp_x",$.P.VARIABLE);a+="int "+e+" = new Math.Random().nextInt("+f+".length);\n";if(d==="SET")return a+(f+"["+e+"] = "+g+";\n");if(d===
|
|
269
269
|
"INSERT")return a+(f+".insert("+e+", "+g+");\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_sort:function(a,b){var c=b.valueToCode(a,"LIST",Z.NONE)||"[]",d=a.getFieldValue("DIRECTION")==="1"?1:-1;a=a.getFieldValue("TYPE");return[b.provideFunction_("lists_sort",`
|
|
270
270
|
List ${b.FUNCTION_NAME_PLACEHOLDER_}(List list, String type, int direction) {
|
|
@@ -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]}},vt,wt,xt,yt,zt,At,Bt);for(let a in Dt)Ct.forBlock[a]=Dt[a];var Et={};Et.DartGenerator=ut;Et.Order=Z;Et.dartGenerator=Ct;$.__chunk_dart=Et;
|
|
284
284
|
$.__chunk_dart.__namespace__=$;
|
|
285
285
|
return $.__chunk_dart;
|
|
286
286
|
}));
|