fix: export Field-related types from Blockly (#6877)

* chore: re-exported Field config types from Blockly

* mark `@internal` types, export field error, and add validator comments
This commit is contained in:
Blake Thomas Williams
2023-03-03 16:20:20 -06:00
committed by GitHub
parent 3a7ac3be1b
commit 9e5bfc243e
11 changed files with 238 additions and 47 deletions

View File

@@ -25,8 +25,6 @@ import {Svg} from './utils/svg.js';
import * as userAgent from './utils/useragent.js';
import * as WidgetDiv from './widgetdiv.js';
export type FieldMultilineInputValidator = FieldTextInputValidator;
/**
* Class for an editable text area field.
*/
@@ -481,3 +479,20 @@ export interface FieldMultilineInputFromJsonConfig extends
FieldMultilineInputConfig {
text?: string;
}
/**
* A function that is called to validate changes to the field's value before
* they are set.
*
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
* @param newValue The value to be validated.
* @returns One of three instructions for setting the new value: `T`, `null`,
* or `undefined`.
*
* - `T` to set this function's returned value instead of `newValue`.
*
* - `null` to invoke `doValueInvalid_` and not set a value.
*
* - `undefined` to set `newValue` as is.
*/
export type FieldMultilineInputValidator = FieldTextInputValidator;