Migrate core/utils/svg.js to goog.module

This commit is contained in:
kozbial
2021-08-17 14:37:23 -07:00
committed by Monica Kozbial
parent 26802bcb7f
commit cf5c38c3f5
2 changed files with 78 additions and 75 deletions

View File

@@ -5,17 +5,18 @@
*/
/**
* @fileoverview Defines the Blockly.utils.Svg class. Its constants enumerate
* @fileoverview Defines the Svg class. Its constants enumerate
* all SVG tag names used by Blockly.
* @author samelh@google.com (Sam El-Husseini)
*/
'use strict';
/**
* @name Blockly.utils.Svg
* @name Svg
* @namespace
*/
goog.provide('Blockly.utils.Svg');
goog.module('Blockly.utils.Svg');
goog.module.declareLegacyNamespace();
/**
@@ -25,7 +26,7 @@ goog.provide('Blockly.utils.Svg');
* @template T
* @private
*/
Blockly.utils.Svg = function(tagName) {
const Svg = function(tagName) {
/**
* @type {string}
* @private
@@ -38,144 +39,146 @@ Blockly.utils.Svg = function(tagName) {
* @return {string} The name.
* @override
*/
Blockly.utils.Svg.prototype.toString = function() {
Svg.prototype.toString = function() {
return this.tagName_;
};
/** @type {!Blockly.utils.Svg<!SVGAnimateElement>}
/** @type {!Svg<!SVGAnimateElement>}
* @package
*/
Blockly.utils.Svg.ANIMATE =
new Blockly.utils.Svg('animate');
Svg.ANIMATE =
new Svg('animate');
/** @type {!Blockly.utils.Svg<!SVGCircleElement>}
/** @type {!Svg<!SVGCircleElement>}
* @package
*/
Blockly.utils.Svg.CIRCLE =
new Blockly.utils.Svg('circle');
Svg.CIRCLE =
new Svg('circle');
/** @type {!Blockly.utils.Svg<!SVGClipPathElement>}
/** @type {!Svg<!SVGClipPathElement>}
* @package
*/
Blockly.utils.Svg.CLIPPATH =
new Blockly.utils.Svg('clipPath');
Svg.CLIPPATH =
new Svg('clipPath');
/** @type {!Blockly.utils.Svg<!SVGDefsElement>}
/** @type {!Svg<!SVGDefsElement>}
* @package
*/
Blockly.utils.Svg.DEFS =
new Blockly.utils.Svg('defs');
Svg.DEFS =
new Svg('defs');
/** @type {!Blockly.utils.Svg<!SVGFECompositeElement>}
/** @type {!Svg<!SVGFECompositeElement>}
* @package
*/
Blockly.utils.Svg.FECOMPOSITE =
new Blockly.utils.Svg('feComposite');
Svg.FECOMPOSITE =
new Svg('feComposite');
/** @type {!Blockly.utils.Svg<!SVGFEComponentTransferElement>}
/** @type {!Svg<!SVGFEComponentTransferElement>}
* @package
*/
Blockly.utils.Svg.FECOMPONENTTRANSFER =
new Blockly.utils.Svg('feComponentTransfer');
Svg.FECOMPONENTTRANSFER =
new Svg('feComponentTransfer');
/** @type {!Blockly.utils.Svg<!SVGFEFloodElement>}
/** @type {!Svg<!SVGFEFloodElement>}
* @package
*/
Blockly.utils.Svg.FEFLOOD =
new Blockly.utils.Svg('feFlood');
Svg.FEFLOOD =
new Svg('feFlood');
/** @type {!Blockly.utils.Svg<!SVGFEFuncAElement>}
/** @type {!Svg<!SVGFEFuncAElement>}
* @package
*/
Blockly.utils.Svg.FEFUNCA =
new Blockly.utils.Svg('feFuncA');
Svg.FEFUNCA =
new Svg('feFuncA');
/** @type {!Blockly.utils.Svg<!SVGFEGaussianBlurElement>}
/** @type {!Svg<!SVGFEGaussianBlurElement>}
* @package
*/
Blockly.utils.Svg.FEGAUSSIANBLUR =
new Blockly.utils.Svg('feGaussianBlur');
Svg.FEGAUSSIANBLUR =
new Svg('feGaussianBlur');
/** @type {!Blockly.utils.Svg<!SVGFEPointLightElement>}
/** @type {!Svg<!SVGFEPointLightElement>}
* @package
*/
Blockly.utils.Svg.FEPOINTLIGHT =
new Blockly.utils.Svg('fePointLight');
Svg.FEPOINTLIGHT =
new Svg('fePointLight');
/** @type {!Blockly.utils.Svg<!SVGFESpecularLightingElement>}
/** @type {!Svg<!SVGFESpecularLightingElement>}
* @package
*/
Blockly.utils.Svg.FESPECULARLIGHTING =
new Blockly.utils.Svg('feSpecularLighting');
Svg.FESPECULARLIGHTING =
new Svg('feSpecularLighting');
/** @type {!Blockly.utils.Svg<!SVGFilterElement>}
/** @type {!Svg<!SVGFilterElement>}
* @package
*/
Blockly.utils.Svg.FILTER =
new Blockly.utils.Svg('filter');
Svg.FILTER =
new Svg('filter');
/** @type {!Blockly.utils.Svg<!SVGForeignObjectElement>}
/** @type {!Svg<!SVGForeignObjectElement>}
* @package
*/
Blockly.utils.Svg.FOREIGNOBJECT =
new Blockly.utils.Svg('foreignObject');
Svg.FOREIGNOBJECT =
new Svg('foreignObject');
/** @type {!Blockly.utils.Svg<!SVGGElement>}
/** @type {!Svg<!SVGGElement>}
* @package
*/
Blockly.utils.Svg.G =
new Blockly.utils.Svg('g');
Svg.G =
new Svg('g');
/** @type {!Blockly.utils.Svg<!SVGImageElement>}
/** @type {!Svg<!SVGImageElement>}
* @package
*/
Blockly.utils.Svg.IMAGE =
new Blockly.utils.Svg('image');
Svg.IMAGE =
new Svg('image');
/** @type {!Blockly.utils.Svg<!SVGLineElement>}
/** @type {!Svg<!SVGLineElement>}
* @package
*/
Blockly.utils.Svg.LINE =
new Blockly.utils.Svg('line');
Svg.LINE =
new Svg('line');
/** @type {!Blockly.utils.Svg<!SVGPathElement>}
/** @type {!Svg<!SVGPathElement>}
* @package
*/
Blockly.utils.Svg.PATH =
new Blockly.utils.Svg('path');
Svg.PATH =
new Svg('path');
/** @type {!Blockly.utils.Svg<!SVGPatternElement>}
/** @type {!Svg<!SVGPatternElement>}
* @package
*/
Blockly.utils.Svg.PATTERN =
new Blockly.utils.Svg('pattern');
Svg.PATTERN =
new Svg('pattern');
/** @type {!Blockly.utils.Svg<!SVGPolygonElement>}
/** @type {!Svg<!SVGPolygonElement>}
* @package
*/
Blockly.utils.Svg.POLYGON =
new Blockly.utils.Svg('polygon');
Svg.POLYGON =
new Svg('polygon');
/** @type {!Blockly.utils.Svg<!SVGRectElement>}
/** @type {!Svg<!SVGRectElement>}
* @package
*/
Blockly.utils.Svg.RECT =
new Blockly.utils.Svg('rect');
Svg.RECT =
new Svg('rect');
/** @type {!Blockly.utils.Svg<!SVGSVGElement>}
/** @type {!Svg<!SVGSVGElement>}
* @package
*/
Blockly.utils.Svg.SVG =
new Blockly.utils.Svg('svg');
Svg.SVG =
new Svg('svg');
/** @type {!Blockly.utils.Svg<!SVGTextElement>}
/** @type {!Svg<!SVGTextElement>}
* @package
*/
Blockly.utils.Svg.TEXT =
new Blockly.utils.Svg('text');
Svg.TEXT =
new Svg('text');
/** @type {!Blockly.utils.Svg<!SVGTSpanElement>}
/** @type {!Svg<!SVGTSpanElement>}
* @package
*/
Blockly.utils.Svg.TSPAN =
new Blockly.utils.Svg('tspan');
Svg.TSPAN =
new Svg('tspan');
exports = Svg;

View File

@@ -221,7 +221,7 @@ goog.addDependency('../../core/utils/rect.js', ['Blockly.utils.Rect'], [], {'lan
goog.addDependency('../../core/utils/size.js', ['Blockly.utils.Size'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/utils/string.js', ['Blockly.utils.string'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/utils/style.js', ['Blockly.utils.style'], ['Blockly.utils.Coordinate', 'Blockly.utils.Size'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/utils/svg.js', ['Blockly.utils.Svg'], []);
goog.addDependency('../../core/utils/svg.js', ['Blockly.utils.Svg'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/utils/svg_paths.js', ['Blockly.utils.svgPaths'], [], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/utils/toolbox.js', ['Blockly.utils.toolbox'], ['Blockly.Xml', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
goog.addDependency('../../core/utils/useragent.js', ['Blockly.utils.userAgent'], ['Blockly.utils.global']);