Skip to content

Commit 9f27f4e

Browse files
committed
Try to fix namespace import issue
1 parent 9ba538b commit 9f27f4e

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/index.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @packageDocumentation
99
*/
1010

11-
import { NumberAlias, SVG, Svg } from "@svgdotjs/svg.js";
11+
import * as SVGJS from "@svgdotjs/svg.js";
1212
import Ajv, {DefinedError as AJVError} from "ajv";
1313
import { renderers } from "./renderers";
1414
export { sheets } from "./sheets";
@@ -44,19 +44,19 @@ export interface IRenderOptions extends IRendererOptionsIn {
4444
* In that case, pass the Svg object.
4545
*
4646
*/
47-
target?: Svg;
47+
target?: SVGJS.Svg;
4848
/**
4949
* The width of the final SVG. This can be a string (representing something like a percentage).
5050
* See the SVG.js docs for details.
5151
*
5252
*/
53-
width?: NumberAlias;
53+
width?: SVGJS.NumberAlias;
5454
/**
5555
* The height of the final SVG. This can be a string (representing something like a percentage).
5656
* See the SVG.js docs for details.
5757
*
5858
*/
59-
height?: NumberAlias;
59+
height?: SVGJS.NumberAlias;
6060
/**
6161
* The string DOM ID you want the final output out be given.
6262
*
@@ -184,19 +184,19 @@ export const renderglyph = (glyphid: string, colour: number | string | Colourfun
184184
* @returns A valid SVG.js Svg object
185185
* @beta
186186
*/
187-
export const render = (json: APRenderRep, opts = {} as IRenderOptions): Svg => {
187+
export const render = (json: APRenderRep, opts = {} as IRenderOptions): SVGJS.Svg => {
188188
// Validate the JSON
189189
if (! validate(json)) {
190190
throw new Error(`The json object you submitted does not validate against the established schema. The validator said the following:\n${formatAJVErrors(validate.errors as AJVError[])}`);
191191
}
192192

193193
// Initialize the SVG container
194-
let draw: Svg;
194+
let draw: SVGJS.Svg;
195195
if ( ("target" in opts) && (opts.target != null) ) {
196196
draw = opts.target;
197197
} else if ( ("divelem" in opts) && (opts.divelem != null) ) {
198-
let height: NumberAlias = "100%";
199-
let width: NumberAlias = "100%";
198+
let height: SVGJS.NumberAlias = "100%";
199+
let width: SVGJS.NumberAlias = "100%";
200200
if ( ("height" in opts) && (opts.height !== null) && (opts.height !== undefined) ) {
201201
height = opts.height;
202202
}
@@ -207,10 +207,10 @@ export const render = (json: APRenderRep, opts = {} as IRenderOptions): Svg => {
207207
if ( ("svgid" in opts) && (opts.svgid !== undefined) && (opts.svgid.length > 0) ) {
208208
svgid = opts.svgid;
209209
}
210-
draw = SVG().addTo(opts.divelem).size(width, height).id(svgid);
210+
draw = SVGJS.SVG().addTo(opts.divelem).size(width, height).id(svgid);
211211
} else {
212-
let height: NumberAlias = "100%";
213-
let width: NumberAlias = "100%";
212+
let height: SVGJS.NumberAlias = "100%";
213+
let width: SVGJS.NumberAlias = "100%";
214214
if ( ("height" in opts) && (opts.height !== null) && (opts.height !== undefined) ) {
215215
height = opts.height;
216216
}
@@ -224,7 +224,7 @@ export const render = (json: APRenderRep, opts = {} as IRenderOptions): Svg => {
224224
if (opts.divid === undefined) {
225225
throw new Error("No target for the rendered SVG was given.");
226226
}
227-
draw = SVG().addTo("#" + opts.divid).size(width, height).id(svgid);
227+
draw = SVGJS.SVG().addTo("#" + opts.divid).size(width, height).id(svgid);
228228
}
229229

230230
let boardClick: (row: number, col: number, piece: string) => void = () => undefined;

0 commit comments

Comments
 (0)