blockly 11.0.0-beta.6 → 11.0.0-beta.8
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 +361 -346
- package/blockly_compressed.js +350 -335
- package/blockly_compressed.js.map +1 -1
- package/blocks_compressed.js +1 -1
- package/blocks_compressed.js.map +1 -1
- package/core/block.d.ts +2 -3
- package/core/block_svg.d.ts +23 -10
- package/core/blockly.d.ts +16 -15
- package/core/bubbles/bubble.d.ts +17 -2
- package/core/bubbles/mini_workspace_bubble.d.ts +1 -1
- package/core/bubbles/text_bubble.d.ts +1 -1
- package/core/bubbles/textinput_bubble.d.ts +1 -1
- package/core/comments/comment_view.d.ts +15 -1
- package/core/comments/rendered_workspace_comment.d.ts +43 -3
- package/core/comments/workspace_comment.d.ts +9 -3
- package/core/connection.d.ts +1 -1
- package/core/delete_area.d.ts +1 -2
- package/core/dragging/block_drag_strategy.d.ts +105 -0
- package/core/dragging/bubble_drag_strategy.d.ts +20 -0
- package/core/dragging/comment_drag_strategy.d.ts +20 -0
- package/core/dragging/dragger.d.ts +48 -0
- package/core/dragging.d.ts +11 -0
- package/core/events/events.d.ts +3 -0
- package/core/events/events_comment_base.d.ts +6 -1
- package/core/events/events_comment_change.d.ts +1 -1
- package/core/events/events_comment_collapse.d.ts +39 -0
- package/core/events/events_comment_create.d.ts +5 -1
- package/core/events/events_comment_delete.d.ts +5 -1
- package/core/events/events_comment_move.d.ts +17 -1
- package/core/events/utils.d.ts +2 -0
- package/core/flyout_base.d.ts +17 -1
- package/core/flyout_button.d.ts +26 -1
- package/core/gesture.d.ts +27 -53
- package/core/icons/comment_icon.d.ts +5 -0
- package/core/interfaces/i_comment_icon.d.ts +5 -1
- package/core/interfaces/i_deletable.d.ts +6 -0
- package/core/interfaces/i_delete_area.d.ts +1 -2
- package/core/interfaces/i_draggable.d.ts +47 -3
- package/core/interfaces/i_dragger.d.ts +32 -0
- package/core/interfaces/i_selectable.d.ts +5 -3
- package/core/internal_constants.d.ts +0 -7
- package/core/keyboard_nav/ast_node.d.ts +21 -2
- package/core/registry.d.ts +6 -2
- package/core/renderers/common/marker_svg.d.ts +7 -0
- package/core/toolbox/toolbox.d.ts +1 -2
- package/core/workspace_comment_svg.d.ts +1 -2
- package/core/workspace_svg.d.ts +0 -2
- package/core/xml.d.ts +5 -0
- package/dart_compressed.js +8 -8
- package/dart_compressed.js.map +1 -1
- package/javascript_compressed.js +10 -10
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +6 -7
- package/lua_compressed.js.map +1 -1
- package/media/delete-icon.svg +1 -0
- package/package.json +2 -2
- package/php_compressed.js +7 -7
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +3 -3
- package/python_compressed.js.map +1 -1
- package/core/block_dragger.d.ts +0 -212
- package/core/bubble_dragger.d.ts +0 -77
- package/core/interfaces/i_block_dragger.d.ts +0 -47
- /package/media/{arrow-dropdown.svg → foldout-icon.svg} +0 -0
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
import type { IMovable } from './i_movable.js';
|
|
6
|
+
import type { Workspace } from '../workspace.js';
|
|
8
7
|
/**
|
|
9
8
|
* The interface for an object that is selectable.
|
|
10
9
|
*/
|
|
11
|
-
export interface ISelectable
|
|
10
|
+
export interface ISelectable {
|
|
12
11
|
id: string;
|
|
12
|
+
workspace: Workspace;
|
|
13
13
|
/** Select this. Highlight it visually. */
|
|
14
14
|
select(): void;
|
|
15
15
|
/** Unselect this. Unhighlight it visually. */
|
|
16
16
|
unselect(): void;
|
|
17
17
|
}
|
|
18
|
+
/** Checks whether the given object is an ISelectable. */
|
|
19
|
+
export declare function isSelectable(obj: Object): obj is ISelectable;
|
|
18
20
|
//# sourceMappingURL=i_selectable.d.ts.map
|
|
@@ -9,13 +9,6 @@
|
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare const COLLAPSE_CHARS = 30;
|
|
12
|
-
/**
|
|
13
|
-
* When dragging a block out of a stack, split the stack in two (true), or drag
|
|
14
|
-
* out the block healing the stack (false).
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export declare const DRAG_STACK = true;
|
|
19
12
|
/**
|
|
20
13
|
* Lookup table for determining the opposite type of a connection.
|
|
21
14
|
*
|
|
@@ -16,6 +16,7 @@ import type { Input } from '../inputs/input.js';
|
|
|
16
16
|
import type { IASTNodeLocation } from '../interfaces/i_ast_node_location.js';
|
|
17
17
|
import { Coordinate } from '../utils/coordinate.js';
|
|
18
18
|
import type { Workspace } from '../workspace.js';
|
|
19
|
+
import { FlyoutButton } from '../flyout_button.js';
|
|
19
20
|
/**
|
|
20
21
|
* Class for an AST node.
|
|
21
22
|
* It is recommended that you use one of the createNode methods instead of
|
|
@@ -119,6 +120,13 @@ export declare class ASTNode {
|
|
|
119
120
|
* on the workspace.
|
|
120
121
|
*/
|
|
121
122
|
private navigateBetweenStacks;
|
|
123
|
+
/**
|
|
124
|
+
* Navigate between buttons and stacks of blocks on the flyout workspace.
|
|
125
|
+
*
|
|
126
|
+
* @param forward True to go forward. False to go backwards.
|
|
127
|
+
* @returns The next button, or next stack's first block, or null
|
|
128
|
+
*/
|
|
129
|
+
private navigateFlyoutContents;
|
|
122
130
|
/**
|
|
123
131
|
* Finds the top most AST node for a given block.
|
|
124
132
|
* This is either the previous connection, output connection or block
|
|
@@ -150,7 +158,7 @@ export declare class ASTNode {
|
|
|
150
158
|
* Finds the source block of the location of this node.
|
|
151
159
|
*
|
|
152
160
|
* @returns The source block of the location, or null if the node is of type
|
|
153
|
-
* workspace.
|
|
161
|
+
* workspace or button.
|
|
154
162
|
*/
|
|
155
163
|
getSourceBlock(): Block | null;
|
|
156
164
|
/**
|
|
@@ -232,6 +240,16 @@ export declare class ASTNode {
|
|
|
232
240
|
* stack.
|
|
233
241
|
*/
|
|
234
242
|
static createStackNode(topBlock: Block): ASTNode | null;
|
|
243
|
+
/**
|
|
244
|
+
* Create an AST node of type button. A button in this case refers
|
|
245
|
+
* specifically to a button in a flyout.
|
|
246
|
+
*
|
|
247
|
+
* @param button A top block has no parent and can be found in the list
|
|
248
|
+
* returned by workspace.getTopBlocks().
|
|
249
|
+
* @returns An AST node of type stack that points to the top block on the
|
|
250
|
+
* stack.
|
|
251
|
+
*/
|
|
252
|
+
static createButtonNode(button: FlyoutButton): ASTNode | null;
|
|
235
253
|
/**
|
|
236
254
|
* Creates an AST node pointing to a workspace.
|
|
237
255
|
*
|
|
@@ -262,7 +280,8 @@ export declare namespace ASTNode {
|
|
|
262
280
|
NEXT = "next",
|
|
263
281
|
PREVIOUS = "previous",
|
|
264
282
|
STACK = "stack",
|
|
265
|
-
WORKSPACE = "workspace"
|
|
283
|
+
WORKSPACE = "workspace",
|
|
284
|
+
BUTTON = "button"
|
|
266
285
|
}
|
|
267
286
|
}
|
|
268
287
|
export type Params = ASTNode.Params;
|
package/core/registry.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Abstract } from './events/events_abstract.js';
|
|
7
7
|
import type { Field } from './field.js';
|
|
8
|
-
import type { IBlockDragger } from './interfaces/i_block_dragger.js';
|
|
9
8
|
import type { IConnectionChecker } from './interfaces/i_connection_checker.js';
|
|
10
9
|
import type { IFlyout } from './interfaces/i_flyout.js';
|
|
11
10
|
import type { IMetricsManager } from './interfaces/i_metrics_manager.js';
|
|
@@ -21,6 +20,7 @@ import type { ToolboxItem } from './toolbox/toolbox_item.js';
|
|
|
21
20
|
import type { IPaster } from './interfaces/i_paster.js';
|
|
22
21
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
23
22
|
import type { IConnectionPreviewer } from './interfaces/i_connection_previewer.js';
|
|
23
|
+
import type { IDragger } from './interfaces/i_dragger.js';
|
|
24
24
|
export declare const TEST_ONLY: {
|
|
25
25
|
typeMap: {
|
|
26
26
|
[key: string]: {
|
|
@@ -58,7 +58,11 @@ export declare class Type<_T> {
|
|
|
58
58
|
static FLYOUTS_VERTICAL_TOOLBOX: Type<IFlyout>;
|
|
59
59
|
static FLYOUTS_HORIZONTAL_TOOLBOX: Type<IFlyout>;
|
|
60
60
|
static METRICS_MANAGER: Type<IMetricsManager>;
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Type for an IDragger. Formerly behavior was mostly covered by
|
|
63
|
+
* BlockDraggeers, which is why the name is inaccurate.
|
|
64
|
+
*/
|
|
65
|
+
static BLOCK_DRAGGER: Type<IDragger>;
|
|
62
66
|
/** @internal */
|
|
63
67
|
static SERIALIZER: Type<ISerializer>;
|
|
64
68
|
/** @internal */
|
|
@@ -148,6 +148,13 @@ export declare class MarkerSvg {
|
|
|
148
148
|
* @param curNode The node to draw the marker for.
|
|
149
149
|
*/
|
|
150
150
|
protected showWithStack_(curNode: ASTNode): void;
|
|
151
|
+
/**
|
|
152
|
+
* Position and display the marker for a flyout button.
|
|
153
|
+
* This is a box with extra padding around the button.
|
|
154
|
+
*
|
|
155
|
+
* @param curNode The node to draw the marker for.
|
|
156
|
+
*/
|
|
157
|
+
protected showWithButton_(curNode: ASTNode): void;
|
|
151
158
|
/** Show the current marker. */
|
|
152
159
|
protected showCurrent_(): void;
|
|
153
160
|
/**************************
|
|
@@ -187,11 +187,10 @@ export declare class Toolbox extends DeleteArea implements IAutoHideable, IKeybo
|
|
|
187
187
|
* before onDragEnter/onDragOver/onDragExit.
|
|
188
188
|
*
|
|
189
189
|
* @param element The block or bubble currently being dragged.
|
|
190
|
-
* @param _couldConnect Whether the element could could connect to another.
|
|
191
190
|
* @returns Whether the element provided would be deleted if dropped on this
|
|
192
191
|
* area.
|
|
193
192
|
*/
|
|
194
|
-
wouldDelete(element: IDraggable
|
|
193
|
+
wouldDelete(element: IDraggable): boolean;
|
|
195
194
|
/**
|
|
196
195
|
* Handles when a cursor with a block or bubble enters this drag target.
|
|
197
196
|
*
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import './events/events_selected.js';
|
|
12
12
|
import type { IBoundedElement } from './interfaces/i_bounded_element.js';
|
|
13
|
-
import type { IBubble } from './interfaces/i_bubble.js';
|
|
14
13
|
import type { ICopyable } from './interfaces/i_copyable.js';
|
|
15
14
|
import { Coordinate } from './utils/coordinate.js';
|
|
16
15
|
import { Rect } from './utils/rect.js';
|
|
@@ -20,7 +19,7 @@ import { WorkspaceCommentCopyData } from './clipboard/workspace_comment_paster.j
|
|
|
20
19
|
/**
|
|
21
20
|
* Class for a workspace comment's SVG representation.
|
|
22
21
|
*/
|
|
23
|
-
export declare class WorkspaceCommentSvg extends WorkspaceComment implements IBoundedElement,
|
|
22
|
+
export declare class WorkspaceCommentSvg extends WorkspaceComment implements IBoundedElement, ICopyable<WorkspaceCommentCopyData> {
|
|
24
23
|
/**
|
|
25
24
|
* The width and height to use to size a workspace comment when it is first
|
|
26
25
|
* added, before it has been edited by the user.
|
package/core/workspace_svg.d.ts
CHANGED
|
@@ -497,8 +497,6 @@ export declare class WorkspaceSvg extends Workspace implements IASTNodeLocationS
|
|
|
497
497
|
updateScreenCalculationsIfScrolled(): void;
|
|
498
498
|
/**
|
|
499
499
|
* @returns The layer manager for this workspace.
|
|
500
|
-
*
|
|
501
|
-
* @internal
|
|
502
500
|
*/
|
|
503
501
|
getLayerManager(): LayerManager | null;
|
|
504
502
|
/**
|
package/core/xml.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { Block } from './block.js';
|
|
|
7
7
|
import type { VariableModel } from './variable_model.js';
|
|
8
8
|
import type { Workspace } from './workspace.js';
|
|
9
9
|
import { WorkspaceSvg } from './workspace_svg.js';
|
|
10
|
+
import { WorkspaceComment } from './comments/workspace_comment.js';
|
|
10
11
|
/**
|
|
11
12
|
* Encode a block tree as XML.
|
|
12
13
|
*
|
|
@@ -16,6 +17,8 @@ import { WorkspaceSvg } from './workspace_svg.js';
|
|
|
16
17
|
* @returns XML DOM element.
|
|
17
18
|
*/
|
|
18
19
|
export declare function workspaceToDom(workspace: Workspace, skipId?: boolean): Element;
|
|
20
|
+
/** Serializes the given workspace comment to XML. */
|
|
21
|
+
export declare function saveWorkspaceComment(comment: WorkspaceComment, skipId?: boolean): Element;
|
|
19
22
|
/**
|
|
20
23
|
* Encode a list of variables as XML.
|
|
21
24
|
*
|
|
@@ -74,6 +77,8 @@ export declare function clearWorkspaceAndLoadFromXml(xml: Element, workspace: Wo
|
|
|
74
77
|
* @returns An array containing new block IDs.
|
|
75
78
|
*/
|
|
76
79
|
export declare function domToWorkspace(xml: Element, workspace: Workspace): string[];
|
|
80
|
+
/** Deserializes the given comment state into the given workspace. */
|
|
81
|
+
export declare function loadWorkspaceComment(elem: Element, workspace: Workspace): WorkspaceComment;
|
|
77
82
|
/**
|
|
78
83
|
* Decode an XML DOM and create blocks on the workspace. Position the new
|
|
79
84
|
* blocks immediately below prior blocks, aligned by their starting edge.
|
package/dart_compressed.js
CHANGED
|
@@ -226,19 +226,19 @@ int ${b.FUNCTION_NAME_PLACEHOLDER_}(num a, num b) {
|
|
|
226
226
|
}
|
|
227
227
|
`)+"("+c+", "+a+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},math_random_float$$module$build$src$generators$dart$math=function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";return["new Math.Random().nextDouble()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},math_atan2$$module$build$src$generators$dart$math=function(a,b){b.definitions_.import_dart_math="import 'dart:math' as Math;";const c=b.valueToCode(a,"X",Order$$module$build$src$generators$dart$dart_generator.NONE)||
|
|
228
228
|
"0";return["Math.atan2("+(b.valueToCode(a,"Y",Order$$module$build$src$generators$dart$dart_generator.NONE)||"0")+", "+c+") / Math.pi * 180",Order$$module$build$src$generators$dart$dart_generator.MULTIPLICATIVE]},procedures_defreturn$$module$build$src$generators$dart$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME"));var 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));
|
|
229
|
-
let e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));
|
|
230
|
-
function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$dart$dart_generator.NONE)||"null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},procedures_callnoreturn$$module$build$src$generators$dart$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,
|
|
231
|
-
function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$dart$dart_generator.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$dart$text=
|
|
232
|
-
Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},text_join$$module$build$src$generators$dart$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".toString()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];default:const c=Array(a.itemCount_);
|
|
233
|
-
b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return["["+c.join(",")+"].join()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}},text_append$$module$build$src$generators$dart$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_length$$module$build$src$generators$dart$text=
|
|
234
|
-
b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".length",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_isEmpty$$module$build$src$generators$dart$text=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_indexOf$$module$build$src$generators$dart$text=
|
|
229
|
+
let e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));let f="";a.getInput("STACK")&&(f=b.statementToCode(a,"STACK"));let g="";a.getInput("RETURN")&&(g=b.valueToCode(a,"RETURN",Order$$module$build$src$generators$dart$dart_generator.NONE)||"");let h="";f&&g&&(h=d);g&&(g=b.INDENT+"return "+g+";\n");const k=g?"dynamic":"void",l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d=k+" "+c+"("+l.join(", ")+") {\n"+d+e+f+h+g+"}";d=b.scrub_(a,
|
|
230
|
+
d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$dart$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$dart$dart_generator.NONE)||"null";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},procedures_callnoreturn$$module$build$src$generators$dart$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,
|
|
231
|
+
b)[0]+";\n"},procedures_ifreturn$$module$build$src$generators$dart$procedures=function(a,b){let c="if ("+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$dart$dart_generator.NONE)||"false")+") {\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.NONE)||"null",c+=b.INDENT+"return "+a+";\n"):c+=b.INDENT+"return;\n";return c+"}\n"},text$$module$build$src$generators$dart$text=
|
|
232
|
+
function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$dart$dart_generator.ATOMIC]},text_join$$module$build$src$generators$dart$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$dart$dart_generator.ATOMIC];case 1:return[(b.valueToCode(a,"ADD0",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".toString()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];default:const c=Array(a.itemCount_);
|
|
233
|
+
for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return["["+c.join(",")+"].join()",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]}},text_append$$module$build$src$generators$dart$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";return c+" = ["+c+", "+a+"].join();\n"},text_length$$module$build$src$generators$dart$text=
|
|
234
|
+
function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".length",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_isEmpty$$module$build$src$generators$dart$text=function(a,b){return[(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+".isEmpty",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_indexOf$$module$build$src$generators$dart$text=
|
|
235
235
|
function(a,b){const c="FIRST"===a.getFieldValue("END")?"indexOf":"lastIndexOf",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";b=(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX)||"''")+"."+c+"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$dart$dart_generator.ADDITIVE]:[b,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX]},text_charAt$$module$build$src$generators$dart$text=
|
|
236
236
|
function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE","FIRST"===c||"FROM_START"===c?Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX:Order$$module$build$src$generators$dart$dart_generator.NONE)||"''";switch(c){case "FIRST":return[d+"[0]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "FROM_START":return a=b.getAdjusted(a,"AT"),[d+"["+a+"]",Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "LAST":case "FROM_END":return a=
|
|
237
|
-
b.getAdjusted(a,"AT",1),[b.provideFunction_("text_get_from_end",`
|
|
237
|
+
"LAST"===c?1:b.getAdjusted(a,"AT",1),[`${b.provideFunction_("text_get_from_end",`
|
|
238
238
|
String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text, num x) {
|
|
239
239
|
return text[text.length - x];
|
|
240
240
|
}
|
|
241
|
-
`)
|
|
241
|
+
`)}(${d}, ${a})`,Order$$module$build$src$generators$dart$dart_generator.UNARY_POSTFIX];case "RANDOM":return b.definitions_.import_dart_math="import 'dart:math' as Math;",[b.provideFunction_("text_random_letter",`
|
|
242
242
|
String ${b.FUNCTION_NAME_PLACEHOLDER_}(String text) {
|
|
243
243
|
int x = new Math.Random().nextInt(text.length);
|
|
244
244
|
return text[x];
|