Skip to content

Commit

Permalink
Suport g, circle, ellipse, polygon, polyline svg elements (#2259)
Browse files Browse the repository at this point in the history
* Fix Warming: Update Comment Capitalization

* Extend IntrinsicElements and Add JsxGElementProps

* Add svg circle support

* Add svg ellipse support

* Add svg polygon support

* Add svg polyline support
  • Loading branch information
FlippieCoetser committed Apr 23, 2023
1 parent b49506c commit 4970a4b
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
76 changes: 76 additions & 0 deletions src/lib/utils/jsx.elements.ts
Expand Up @@ -115,8 +115,13 @@ export interface IntrinsicElements {

// SVG Elements
svg: JsxSvgElementProps;
g: JsxGElementProps;
path: JsxPathElementProps;
rect: JsxRectElementProps;
circle: JsxCircleElementProps;
ellipse: JsxEllipseElementProps;
polygon: JsxPolygonElementProps;
polyline: JsxPolylineElementProps;
use: JsxUseElementProps;
}

Expand Down Expand Up @@ -1027,6 +1032,17 @@ export interface JsxSvgElementProps
y?: string | number;
}

/**
* Properties permitted on the `<g>` element.
*
* Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
*/
export interface JsxGElementProps
extends JsxSvgCoreProps,
JsxSvgStyleProps,
JsxSvgConditionalProcessingProps,
JsxSvgPresentationProps {}

/**
* Properties permitted on the `<path>` element.
*
Expand Down Expand Up @@ -1060,6 +1076,66 @@ export interface JsxRectElementProps
y?: string | number;
}

/**
* Properties permitted on the `<circle>` element.
*
* Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/circle
*/
export interface JsxCircleElementProps
extends JsxSvgCoreProps,
JsxSvgStyleProps,
JsxSvgConditionalProcessingProps,
JsxSvgPresentationProps {
cx?: string | number;
cy?: string | number;
r?: string | number;
pathLength?: number;
}

/**
* Properties permitted on the `<ellipse>` element.
*
* Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/ellipse
*/
export interface JsxEllipseElementProps
extends JsxSvgCoreProps,
JsxSvgStyleProps,
JsxSvgConditionalProcessingProps,
JsxSvgPresentationProps {
cx?: string | number;
cy?: string | number;
rx?: string | number;
ry?: string | number;
pathLength?: number;
}

/**
* Properties permitted on the `<polygon>` element.
*
* Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polygon
*/
export interface JsxPolygonElementProps
extends JsxSvgCoreProps,
JsxSvgStyleProps,
JsxSvgConditionalProcessingProps,
JsxSvgPresentationProps {
points?: string;
pathLength?: number;
}

/** Properties permitted on the `<polyline>` element.
*
* Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/polyline
*/
export interface JsxPolylineElementProps
extends JsxSvgCoreProps,
JsxSvgStyleProps,
JsxSvgConditionalProcessingProps,
JsxSvgPresentationProps {
points?: string;
pathLength?: number;
}

/**
* Properties permitted on the `<use>` element.
*
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/testProject/src/classes.ts
Expand Up @@ -216,7 +216,7 @@ export class SubClassA extends BaseClass implements PrintNameInterface {
public print(value: string): void {}

/**
* @inheritdoc
* @inheritDoc
*/
public printName(): void {
this.print(this.getName());
Expand Down

0 comments on commit 4970a4b

Please sign in to comment.