Skip to content

Commit 9ef9583

Browse files
committed
+ SVG
1 parent 4913d7e commit 9ef9583

File tree

7 files changed

+2286
-11
lines changed

7 files changed

+2286
-11
lines changed

Package.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ let package = Package(
5151
name: "CSSOM",
5252
targets: ["CSSOM"]
5353
),
54+
.library(
55+
name: "SVG",
56+
targets: ["SVG"]
57+
),
5458
.executable(name: "WebIDLToSwift", targets: ["WebIDLToSwift"]),
5559
],
5660
dependencies: [
@@ -104,6 +108,10 @@ let package = Package(
104108
name: "CSSOM",
105109
dependencies: ["DOM", "WebAPIBase", "ECMAScript"]
106110
),
111+
.target(
112+
name: "SVG",
113+
dependencies: ["DOM", "WebAPIBase", "ECMAScript"]
114+
),
107115
// This support library should be moved to JavaScriptKit
108116
.target(name: "ECMAScript", dependencies: [
109117
"JavaScriptKit",

Sources/DOM/Generated.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4321,8 +4321,8 @@ public extension DocumentAndElementEventHandlers {
43214321
}
43224322
}
43234323

4324-
public class DocumentFragment: Node, NonElementParentNode, ParentNode {
4325-
@inlinable override public class var constructor: JSFunction? { JSObject.global[Strings.DocumentFragment].function }
4324+
open class DocumentFragment: Node, NonElementParentNode, ParentNode {
4325+
@inlinable override open class var constructor: JSFunction? { JSObject.global[Strings.DocumentFragment].function }
43264326

43274327
public required init(unsafelyWrapping jsObject: JSObject) {
43284328
super.init(unsafelyWrapping: jsObject)
@@ -4448,8 +4448,8 @@ public class DragEventInit: BridgedDictionary {
44484448
public var dataTransfer: DataTransfer?
44494449
}
44504450

4451-
public class Element: Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slottable, ARIAMixin, GeometryUtils {
4452-
@inlinable override public class var constructor: JSFunction? { JSObject.global[Strings.Element].function }
4451+
open class Element: Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slottable, ARIAMixin, GeometryUtils {
4452+
@inlinable override open class var constructor: JSFunction? { JSObject.global[Strings.Element].function }
44534453

44544454
public required init(unsafelyWrapping jsObject: JSObject) {
44554455
_namespaceURI = ReadonlyAttribute(jsObject: jsObject, name: Strings.namespaceURI)
@@ -12227,8 +12227,8 @@ public extension NavigatorPlugins {
1222712227
@inlinable var pdfViewerEnabled: Bool { jsObject[Strings.pdfViewerEnabled].fromJSValue()! }
1222812228
}
1222912229

12230-
public class Node: EventTarget {
12231-
@inlinable override public class var constructor: JSFunction? { JSObject.global[Strings.Node].function }
12230+
open class Node: EventTarget {
12231+
@inlinable override open class var constructor: JSFunction? { JSObject.global[Strings.Node].function }
1223212232

1223312233
public required init(unsafelyWrapping jsObject: JSObject) {
1223412234
_nodeType = ReadonlyAttribute(jsObject: jsObject, name: Strings.nodeType)
@@ -14350,8 +14350,8 @@ public enum ServiceWorkerUpdateViaCache: JSString, JSValueCompatible {
1435014350
@inlinable public var jsValue: JSValue { rawValue.jsValue }
1435114351
}
1435214352

14353-
public class ShadowRoot: DocumentFragment, DocumentOrShadowRoot {
14354-
@inlinable override public class var constructor: JSFunction? { JSObject.global[Strings.ShadowRoot].function }
14353+
open class ShadowRoot: DocumentFragment, DocumentOrShadowRoot {
14354+
@inlinable override open class var constructor: JSFunction? { JSObject.global[Strings.ShadowRoot].function }
1435514355

1435614356
public required init(unsafelyWrapping jsObject: JSObject) {
1435714357
_mode = ReadonlyAttribute(jsObject: jsObject, name: Strings.mode)

Sources/SVG/Customized.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import ECMAScript
2+
import JavaScriptKit
3+
import DOM
4+
5+
// copied out of generated file to work around issue with `className` property being incompatible with superclass.
6+
// NOTE: accessing ``SVGElement/className`` will crash your app.
7+
public class SVGElement: Element, GlobalEventHandlers, DocumentAndElementEventHandlers, SVGElementInstance, HTMLOrSVGElement {
8+
@inlinable override public class var constructor: JSFunction? { JSObject.global[Strings.SVGElement].function }
9+
10+
public required init(unsafelyWrapping jsObject: JSObject) {
11+
_svgClassName = ReadonlyAttribute(jsObject: jsObject, name: Strings.className)
12+
_ownerSVGElement = ReadonlyAttribute(jsObject: jsObject, name: Strings.ownerSVGElement)
13+
_viewportElement = ReadonlyAttribute(jsObject: jsObject, name: Strings.viewportElement)
14+
super.init(unsafelyWrapping: jsObject)
15+
}
16+
17+
@ReadonlyAttribute
18+
public var svgClassName: SVGAnimatedString
19+
20+
@ReadonlyAttribute
21+
public var ownerSVGElement: SVGSVGElement?
22+
23+
@ReadonlyAttribute
24+
public var viewportElement: SVGElement?
25+
}

0 commit comments

Comments
 (0)