Skip to content

Commit f4af071

Browse files
authored
Add SVG - Basic Shapes section (#676)
* Add SVG - Basic Shapes section Adds detail to the inheritance hierarchy, so that it fixes microsoft/TypeScript#29573 * Add SVG element names
1 parent 6ba5bfe commit f4af071

5 files changed

Lines changed: 119 additions & 14 deletions

File tree

baselines/dom.generated.d.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12608,7 +12608,7 @@ declare var SVGAnimationElement: {
1260812608
};
1260912609

1261012610
/** An interface for the <circle> element. The circle element is defined by the cx and cy attributes that denote the coordinates of the centre of the circle. */
12611-
interface SVGCircleElement extends SVGGraphicsElement {
12611+
interface SVGCircleElement extends SVGGeometryElement {
1261212612
readonly cx: SVGAnimatedLength;
1261312613
readonly cy: SVGAnimatedLength;
1261412614
readonly r: SVGAnimatedLength;
@@ -12752,7 +12752,7 @@ declare var SVGElementInstanceList: {
1275212752
};
1275312753

1275412754
/** Provides access to the properties of <ellipse> elements. */
12755-
interface SVGEllipseElement extends SVGGraphicsElement {
12755+
interface SVGEllipseElement extends SVGGeometryElement {
1275612756
readonly cx: SVGAnimatedLength;
1275712757
readonly cy: SVGAnimatedLength;
1275812758
readonly rx: SVGAnimatedLength;
@@ -13468,7 +13468,7 @@ declare var SVGLengthList: {
1346813468
};
1346913469

1347013470
/** Provides access to the properties of <line> elements, as well as methods to manipulate them. */
13471-
interface SVGLineElement extends SVGGraphicsElement {
13471+
interface SVGLineElement extends SVGGeometryElement {
1347213472
readonly x1: SVGAnimatedLength;
1347313473
readonly x2: SVGAnimatedLength;
1347413474
readonly y1: SVGAnimatedLength;
@@ -13949,14 +13949,16 @@ declare var SVGPatternElement: {
1394913949
};
1395013950

1395113951
interface SVGPointList {
13952+
readonly length: number;
1395213953
readonly numberOfItems: number;
13953-
appendItem(newItem: SVGPoint): SVGPoint;
13954+
appendItem(newItem: DOMPoint): DOMPoint;
1395413955
clear(): void;
13955-
getItem(index: number): SVGPoint;
13956-
initialize(newItem: SVGPoint): SVGPoint;
13957-
insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;
13958-
removeItem(index: number): SVGPoint;
13959-
replaceItem(newItem: SVGPoint, index: number): SVGPoint;
13956+
getItem(index: number): DOMPoint;
13957+
initialize(newItem: DOMPoint): DOMPoint;
13958+
insertItemBefore(newItem: DOMPoint, index: number): DOMPoint;
13959+
removeItem(index: number): DOMPoint;
13960+
replaceItem(newItem: DOMPoint, index: number): DOMPoint;
13961+
[index: number]: DOMPoint;
1396013962
}
1396113963

1396213964
declare var SVGPointList: {
@@ -13965,7 +13967,7 @@ declare var SVGPointList: {
1396513967
};
1396613968

1396713969
/** Provides access to the properties of <polygon> elements, as well as methods to manipulate them. */
13968-
interface SVGPolygonElement extends SVGGraphicsElement, SVGAnimatedPoints {
13970+
interface SVGPolygonElement extends SVGGeometryElement, SVGAnimatedPoints {
1396913971
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1397013972
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1397113973
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -13978,7 +13980,7 @@ declare var SVGPolygonElement: {
1397813980
};
1397913981

1398013982
/** Provides access to the properties of <polyline> elements, as well as methods to manipulate them. */
13981-
interface SVGPolylineElement extends SVGGraphicsElement, SVGAnimatedPoints {
13983+
interface SVGPolylineElement extends SVGGeometryElement, SVGAnimatedPoints {
1398213984
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1398313985
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1398413986
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -14048,7 +14050,7 @@ declare var SVGRadialGradientElement: {
1404814050
};
1404914051

1405014052
/** Provides access to the properties of <rect> elements, as well as methods to manipulate them. */
14051-
interface SVGRectElement extends SVGGraphicsElement {
14053+
interface SVGRectElement extends SVGGeometryElement {
1405214054
readonly height: SVGAnimatedLength;
1405314055
readonly rx: SVGAnimatedLength;
1405414056
readonly ry: SVGAnimatedLength;
@@ -17999,8 +18001,6 @@ interface SVGElementTagNameMap {
1799918001
"metadata": SVGMetadataElement;
1800018002
"path": SVGPathElement;
1800118003
"pattern": SVGPatternElement;
18002-
"polygon": SVGPolygonElement;
18003-
"polyline": SVGPolylineElement;
1800418004
"radialGradient": SVGRadialGradientElement;
1800518005
"rect": SVGRectElement;
1800618006
"script": SVGScriptElement;

baselines/dom.iterable.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ interface SVGNumberList {
166166
[Symbol.iterator](): IterableIterator<SVGNumber>;
167167
}
168168

169+
interface SVGPointList {
170+
[Symbol.iterator](): IterableIterator<DOMPoint>;
171+
}
172+
169173
interface SVGStringList {
170174
[Symbol.iterator](): IterableIterator<string>;
171175
}

inputfiles/addedTypes.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,38 @@
18631863
"extends": "SVGAnimationElement",
18641864
"exposed": "Window"
18651865
},
1866+
"SVGRectElement": {
1867+
"element": [
1868+
{
1869+
"namespace": "SVG",
1870+
"name": "rect"
1871+
}
1872+
]
1873+
},
1874+
"SVGCircleElement": {
1875+
"element": [
1876+
{
1877+
"namespace": "SVG",
1878+
"name": "circle"
1879+
}
1880+
]
1881+
},
1882+
"SVGEllipseElement": {
1883+
"element": [
1884+
{
1885+
"namespace": "SVG",
1886+
"name": "ellipse"
1887+
}
1888+
]
1889+
},
1890+
"SVGLineElement": {
1891+
"element": [
1892+
{
1893+
"namespace": "SVG",
1894+
"name": "line"
1895+
}
1896+
]
1897+
},
18661898
"MediaStream": {
18671899
"events": {
18681900
"event": [
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[Exposed=Window]
2+
interface SVGRectElement : SVGGeometryElement {
3+
[SameObject] readonly attribute SVGAnimatedLength x;
4+
[SameObject] readonly attribute SVGAnimatedLength y;
5+
[SameObject] readonly attribute SVGAnimatedLength width;
6+
[SameObject] readonly attribute SVGAnimatedLength height;
7+
[SameObject] readonly attribute SVGAnimatedLength rx;
8+
[SameObject] readonly attribute SVGAnimatedLength ry;
9+
};
10+
11+
[Exposed=Window]
12+
interface SVGCircleElement : SVGGeometryElement {
13+
[SameObject] readonly attribute SVGAnimatedLength cx;
14+
[SameObject] readonly attribute SVGAnimatedLength cy;
15+
[SameObject] readonly attribute SVGAnimatedLength r;
16+
};
17+
18+
[Exposed=Window]
19+
interface SVGEllipseElement : SVGGeometryElement {
20+
[SameObject] readonly attribute SVGAnimatedLength cx;
21+
[SameObject] readonly attribute SVGAnimatedLength cy;
22+
[SameObject] readonly attribute SVGAnimatedLength rx;
23+
[SameObject] readonly attribute SVGAnimatedLength ry;
24+
};
25+
26+
[Exposed=Window]
27+
interface SVGLineElement : SVGGeometryElement {
28+
[SameObject] readonly attribute SVGAnimatedLength x1;
29+
[SameObject] readonly attribute SVGAnimatedLength y1;
30+
[SameObject] readonly attribute SVGAnimatedLength x2;
31+
[SameObject] readonly attribute SVGAnimatedLength y2;
32+
};
33+
34+
interface mixin SVGAnimatedPoints {
35+
[SameObject] readonly attribute SVGPointList points;
36+
[SameObject] readonly attribute SVGPointList animatedPoints;
37+
};
38+
39+
[Exposed=Window]
40+
interface SVGPointList {
41+
42+
readonly attribute unsigned long length;
43+
readonly attribute unsigned long numberOfItems;
44+
45+
void clear();
46+
DOMPoint initialize(DOMPoint newItem);
47+
getter DOMPoint getItem(unsigned long index);
48+
DOMPoint insertItemBefore(DOMPoint newItem, unsigned long index);
49+
DOMPoint replaceItem(DOMPoint newItem, unsigned long index);
50+
DOMPoint removeItem(unsigned long index);
51+
DOMPoint appendItem(DOMPoint newItem);
52+
setter void (unsigned long index, DOMPoint newItem);
53+
};
54+
55+
[Exposed=Window]
56+
interface SVGPolylineElement : SVGGeometryElement {
57+
};
58+
59+
SVGPolylineElement includes SVGAnimatedPoints;
60+
61+
[Exposed=Window]
62+
interface SVGPolygonElement : SVGGeometryElement {
63+
};
64+
65+
SVGPolygonElement includes SVGAnimatedPoints;

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@
295295
"url": "https://svgwg.org/svg2-draft/types.html",
296296
"title": "SVG - Basic Data Types and Interfaces"
297297
},
298+
{
299+
"url": "https://svgwg.org/svg2-draft/shapes.html",
300+
"title": "SVG - Basic Shapes"
301+
},
298302
{
299303
"url": "https://w3c.github.io/touch-events/",
300304
"title": "Touch Events"

0 commit comments

Comments
 (0)