mirror of
https://github.com/google/blockly.git
synced 2025-12-15 22:00:07 +01:00
refactor(blocks): Migrate blocks/blocks.js to TypeScript (#7193)
* refactor(blocks): Auto-migration of blocks/blocks.js to ts * fix(blocks): Manually migrate & fix types in blocks.ts * fix(build): Update location of blocks/blocks.ts exports object * fix(blocks): Remove lint * chore(blocks): Format
This commit is contained in:
committed by
GitHub
parent
ec71261813
commit
b6e084257e
@@ -1,48 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview All the blocks. (Entry point for blocks_compressed.js.)
|
||||
* @suppress {extraRequire}
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.module('Blockly.libraryBlocks');
|
||||
|
||||
const colour = goog.require('Blockly.libraryBlocks.colour');
|
||||
const lists = goog.require('Blockly.libraryBlocks.lists');
|
||||
const logic = goog.require('Blockly.libraryBlocks.logic');
|
||||
const loops = goog.require('Blockly.libraryBlocks.loops');
|
||||
const math = goog.require('Blockly.libraryBlocks.math');
|
||||
const procedures = goog.require('Blockly.libraryBlocks.procedures');
|
||||
const texts = goog.require('Blockly.libraryBlocks.texts');
|
||||
const variables = goog.require('Blockly.libraryBlocks.variables');
|
||||
const variablesDynamic = goog.require('Blockly.libraryBlocks.variablesDynamic');
|
||||
// const {BlockDefinition} = goog.requireType('Blockly.blocks');
|
||||
// TODO (6248): Properly import the BlockDefinition type.
|
||||
/* eslint-disable-next-line no-unused-vars */
|
||||
const BlockDefinition = Object;
|
||||
|
||||
|
||||
exports.colour = colour;
|
||||
exports.lists = lists;
|
||||
exports.logic = logic;
|
||||
exports.loops = loops;
|
||||
exports.math = math;
|
||||
exports.procedures = procedures;
|
||||
exports.texts = texts;
|
||||
exports.variables = variables;
|
||||
exports.variablesDynamic = variablesDynamic;
|
||||
|
||||
/**
|
||||
* A dictionary of the block definitions provided by all the
|
||||
* Blockly.libraryBlocks.* modules.
|
||||
* @type {!Object<string, !BlockDefinition>}
|
||||
*/
|
||||
const blocks = Object.assign(
|
||||
{}, colour.blocks, lists.blocks, logic.blocks, loops.blocks, math.blocks,
|
||||
procedures.blocks, variables.blocks, variablesDynamic.blocks);
|
||||
exports.blocks = blocks;
|
||||
46
blocks/blocks.ts
Normal file
46
blocks/blocks.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import * as goog from '../closure/goog/goog.js';
|
||||
goog.declareModuleId('Blockly.libraryBlocks');
|
||||
|
||||
import * as colour from './colour.js';
|
||||
import * as lists from './lists.js';
|
||||
import * as logic from './logic.js';
|
||||
import * as loops from './loops.js';
|
||||
import * as math from './math.js';
|
||||
import * as procedures from './procedures.js';
|
||||
import * as texts from './text.js';
|
||||
import * as variables from './variables.js';
|
||||
import * as variablesDynamic from './variables_dynamic.js';
|
||||
import type {BlockDefinition} from '../core/blocks.js';
|
||||
|
||||
export {
|
||||
colour,
|
||||
lists,
|
||||
loops,
|
||||
math,
|
||||
procedures,
|
||||
texts,
|
||||
variables,
|
||||
variablesDynamic,
|
||||
};
|
||||
|
||||
/**
|
||||
* A dictionary of the block definitions provided by all the
|
||||
* Blockly.libraryBlocks.* modules.
|
||||
*/
|
||||
export const blocks: {[key: string]: BlockDefinition} = Object.assign(
|
||||
{},
|
||||
colour.blocks,
|
||||
lists.blocks,
|
||||
logic.blocks,
|
||||
loops.blocks,
|
||||
math.blocks,
|
||||
procedures.blocks,
|
||||
variables.blocks,
|
||||
variablesDynamic.blocks
|
||||
);
|
||||
Reference in New Issue
Block a user