blockly 9.0.0-beta.2 → 9.0.0-beta.4
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 +285 -280
- package/blockly_compressed.js +285 -280
- package/blockly_compressed.js.map +1 -1
- package/core/field.d.ts +39 -12
- package/core/tooltip.d.ts +1 -1
- package/core/utils/dom.d.ts +5 -1
- package/package.json +1 -1
package/core/field.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
38
38
|
name?: string;
|
|
39
39
|
protected value_: any;
|
|
40
40
|
/** Validation function called when user edits an editable field. */
|
|
41
|
-
protected validator_: Function;
|
|
41
|
+
protected validator_: Function | null;
|
|
42
42
|
/**
|
|
43
43
|
* Used to cache the field's tooltip value if setTooltip is called when the
|
|
44
44
|
* field is not yet initialized. Is *not* guaranteed to be accurate.
|
|
@@ -56,17 +56,17 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
56
56
|
*/
|
|
57
57
|
private markerSvg_;
|
|
58
58
|
/** The rendered field's SVG group element. */
|
|
59
|
-
protected fieldGroup_: SVGGElement;
|
|
59
|
+
protected fieldGroup_: SVGGElement | null;
|
|
60
60
|
/** The rendered field's SVG border element. */
|
|
61
|
-
protected borderRect_: SVGRectElement;
|
|
61
|
+
protected borderRect_: SVGRectElement | null;
|
|
62
62
|
/** The rendered field's SVG text element. */
|
|
63
|
-
protected textElement_: SVGTextElement;
|
|
63
|
+
protected textElement_: SVGTextElement | null;
|
|
64
64
|
/** The rendered field's text content element. */
|
|
65
|
-
protected textContent_: Text;
|
|
65
|
+
protected textContent_: Text | null;
|
|
66
66
|
/** Mouse down event listener data. */
|
|
67
67
|
private mouseDownWrapper_;
|
|
68
68
|
/** Constants associated with the source block's renderer. */
|
|
69
|
-
protected constants_: ConstantProvider;
|
|
69
|
+
protected constants_: ConstantProvider | null;
|
|
70
70
|
/**
|
|
71
71
|
* Has this field been disposed of?
|
|
72
72
|
*
|
|
@@ -76,7 +76,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
76
76
|
/** Maximum characters of text to display before adding an ellipsis. */
|
|
77
77
|
maxDisplayLength: number;
|
|
78
78
|
/** Block this field is attached to. Starts as null, then set in init. */
|
|
79
|
-
protected sourceBlock_: Block;
|
|
79
|
+
protected sourceBlock_: Block | null;
|
|
80
80
|
/** Does this block need to be re-rendered? */
|
|
81
81
|
protected isDirty_: boolean;
|
|
82
82
|
/** Is the field visible, or hidden due to the block being collapsed? */
|
|
@@ -86,7 +86,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
86
86
|
*/
|
|
87
87
|
protected enabled_: boolean;
|
|
88
88
|
/** The element the click handler is bound to. */
|
|
89
|
-
protected clickTarget_: Element;
|
|
89
|
+
protected clickTarget_: Element | null;
|
|
90
90
|
/**
|
|
91
91
|
* The prefix field.
|
|
92
92
|
*
|
|
@@ -149,6 +149,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
149
149
|
* Get the block this field is attached to.
|
|
150
150
|
*
|
|
151
151
|
* @returns The block containing this field.
|
|
152
|
+
* @throws An error if the source block is not defined.
|
|
152
153
|
*/
|
|
153
154
|
getSourceBlock(): Block;
|
|
154
155
|
/**
|
|
@@ -234,7 +235,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
234
235
|
* Used to see if `this` has overridden any relevant hooks.
|
|
235
236
|
* @returns The stringified version of the XML state, or null.
|
|
236
237
|
*/
|
|
237
|
-
protected saveLegacyState(callingClass:
|
|
238
|
+
protected saveLegacyState(callingClass: FieldProto): string | null;
|
|
238
239
|
/**
|
|
239
240
|
* Loads the given state using either the old XML hooks, if they should be
|
|
240
241
|
* used. Returns true to indicate loading has been handled, false otherwise.
|
|
@@ -244,7 +245,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
244
245
|
* @param state The state to apply to the field.
|
|
245
246
|
* @returns Whether the state was applied or not.
|
|
246
247
|
*/
|
|
247
|
-
loadLegacyState(callingClass:
|
|
248
|
+
loadLegacyState(callingClass: FieldProto, state: any): boolean;
|
|
248
249
|
/**
|
|
249
250
|
* Dispose of all DOM objects and events belonging to this editable field.
|
|
250
251
|
*
|
|
@@ -331,7 +332,28 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
331
332
|
*
|
|
332
333
|
* @returns The group element.
|
|
333
334
|
*/
|
|
334
|
-
getSvgRoot(): SVGGElement;
|
|
335
|
+
getSvgRoot(): SVGGElement | null;
|
|
336
|
+
/**
|
|
337
|
+
* Gets the border rectangle element.
|
|
338
|
+
*
|
|
339
|
+
* @returns The border rectangle element.
|
|
340
|
+
* @throws An error if the border rectangle element is not defined.
|
|
341
|
+
*/
|
|
342
|
+
protected getBorderRect(): SVGRectElement;
|
|
343
|
+
/**
|
|
344
|
+
* Gets the text element.
|
|
345
|
+
*
|
|
346
|
+
* @returns The text element.
|
|
347
|
+
* @throws An error if the text element is not defined.
|
|
348
|
+
*/
|
|
349
|
+
protected getTextElement(): SVGTextElement;
|
|
350
|
+
/**
|
|
351
|
+
* Gets the text content.
|
|
352
|
+
*
|
|
353
|
+
* @returns The text content.
|
|
354
|
+
* @throws An error if the text content is not defined.
|
|
355
|
+
*/
|
|
356
|
+
protected getTextContent(): Text;
|
|
335
357
|
/**
|
|
336
358
|
* Updates the field to match the colour/style of the block. Should only be
|
|
337
359
|
* called by BlockSvg.applyColour().
|
|
@@ -514,7 +536,7 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
514
536
|
*
|
|
515
537
|
* @returns Element to bind click handler to.
|
|
516
538
|
*/
|
|
517
|
-
protected getClickTarget_(): Element;
|
|
539
|
+
protected getClickTarget_(): Element | null;
|
|
518
540
|
/**
|
|
519
541
|
* Return the absolute coordinates of the top-left corner of this field.
|
|
520
542
|
* The origin (0,0) is the top-left corner of the page body.
|
|
@@ -588,4 +610,9 @@ export declare abstract class Field implements IASTNodeLocationSvg, IASTNodeLoca
|
|
|
588
610
|
export interface FieldConfig {
|
|
589
611
|
tooltip?: string;
|
|
590
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* For use by Field and descendants of Field. Constructors can change
|
|
615
|
+
* in descendants, though they should contain all of Field's prototype methods.
|
|
616
|
+
*/
|
|
617
|
+
export declare type FieldProto = Pick<typeof Field, 'prototype'>;
|
|
591
618
|
//# sourceMappingURL=field.d.ts.map
|
package/core/tooltip.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export declare function bindMouseEvents(element: Element): void;
|
|
|
114
114
|
* @param element SVG element onto which tooltip is bound.
|
|
115
115
|
* @alias Blockly.Tooltip.unbindMouseEvents
|
|
116
116
|
*/
|
|
117
|
-
export declare function unbindMouseEvents(element: Element): void;
|
|
117
|
+
export declare function unbindMouseEvents(element: Element | null): void;
|
|
118
118
|
/**
|
|
119
119
|
* Dispose of the tooltip.
|
|
120
120
|
*
|
package/core/utils/dom.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export declare function createSvgElement<T extends SVGElement>(name: string | Sv
|
|
|
49
49
|
/**
|
|
50
50
|
* Add a CSS class to a element.
|
|
51
51
|
*
|
|
52
|
+
* Handles multiple space-separated classes for legacy reasons.
|
|
53
|
+
*
|
|
52
54
|
* @param element DOM element to add class to.
|
|
53
55
|
* @param className Name of class to add.
|
|
54
56
|
* @returns True if class was added, false if already present.
|
|
@@ -56,7 +58,7 @@ export declare function createSvgElement<T extends SVGElement>(name: string | Sv
|
|
|
56
58
|
*/
|
|
57
59
|
export declare function addClass(element: Element, className: string): boolean;
|
|
58
60
|
/**
|
|
59
|
-
* Removes multiple
|
|
61
|
+
* Removes multiple classes from an element.
|
|
60
62
|
*
|
|
61
63
|
* @param element DOM element to remove classes from.
|
|
62
64
|
* @param classNames A string of one or multiple class names for an element.
|
|
@@ -66,6 +68,8 @@ export declare function removeClasses(element: Element, classNames: string): voi
|
|
|
66
68
|
/**
|
|
67
69
|
* Remove a CSS class from a element.
|
|
68
70
|
*
|
|
71
|
+
* Handles multiple space-separated classes for legacy reasons.
|
|
72
|
+
*
|
|
69
73
|
* @param element DOM element to remove class from.
|
|
70
74
|
* @param className Name of class to remove.
|
|
71
75
|
* @returns True if class was removed, false if never present.
|