Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for g tag inside svg #2259

Merged
merged 6 commits into from Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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