Skip to content

Commit 78f92fd

Browse files
committed
Merge branch 'main' of github.com:swiftwasm/DOMKit into katei/generate-single-file
# Conflicts: # Sources/DOMKit/WebIDL/Strings.swift
2 parents 4fb6989 + 7ebda4b commit 78f92fd

File tree

5 files changed

+109
-3
lines changed

5 files changed

+109
-3
lines changed

.github/workflows/test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
2020
brew install swiftwasm/tap/carton
2121
22+
carton bundle --product DOMKitDemo
2223
carton test --environment defaultBrowser
2324
env:
2425
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.swift-version

-1
This file was deleted.

Sources/DOMKit/WebIDL/console.swift

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// This file was auto-generated by WebIDLToSwift. DO NOT EDIT!
2+
3+
import JavaScriptEventLoop
4+
import JavaScriptKit
5+
6+
public enum console {
7+
@inlinable public static var jsObject: JSObject {
8+
JSObject.global[Strings.console].object!
9+
}
10+
11+
@inlinable public static func assert(condition: Bool? = nil, data: JSValue...) {
12+
let this = JSObject.global[Strings.console].object!
13+
_ = this[Strings.assert].function!(this: this, arguments: [condition?.jsValue ?? .undefined] + data.map(\.jsValue))
14+
}
15+
16+
@inlinable public static func clear() {
17+
let this = JSObject.global[Strings.console].object!
18+
_ = this[Strings.clear].function!(this: this, arguments: [])
19+
}
20+
21+
@inlinable public static func debug(data: JSValue...) {
22+
let this = JSObject.global[Strings.console].object!
23+
_ = this[Strings.debug].function!(this: this, arguments: data.map(\.jsValue))
24+
}
25+
26+
@inlinable public static func error(data: JSValue...) {
27+
let this = JSObject.global[Strings.console].object!
28+
_ = this[Strings.error].function!(this: this, arguments: data.map(\.jsValue))
29+
}
30+
31+
@inlinable public static func info(data: JSValue...) {
32+
let this = JSObject.global[Strings.console].object!
33+
_ = this[Strings.info].function!(this: this, arguments: data.map(\.jsValue))
34+
}
35+
36+
@inlinable public static func log(data: JSValue...) {
37+
let this = JSObject.global[Strings.console].object!
38+
_ = this[Strings.log].function!(this: this, arguments: data.map(\.jsValue))
39+
}
40+
41+
@inlinable public static func table(tabularData: JSValue? = nil, properties: [String]? = nil) {
42+
let this = JSObject.global[Strings.console].object!
43+
_ = this[Strings.table].function!(this: this, arguments: [tabularData?.jsValue ?? .undefined, properties?.jsValue ?? .undefined])
44+
}
45+
46+
@inlinable public static func trace(data: JSValue...) {
47+
let this = JSObject.global[Strings.console].object!
48+
_ = this[Strings.trace].function!(this: this, arguments: data.map(\.jsValue))
49+
}
50+
51+
@inlinable public static func warn(data: JSValue...) {
52+
let this = JSObject.global[Strings.console].object!
53+
_ = this[Strings.warn].function!(this: this, arguments: data.map(\.jsValue))
54+
}
55+
56+
@inlinable public static func dir(item: JSValue? = nil, options: JSObject? = nil) {
57+
let this = JSObject.global[Strings.console].object!
58+
_ = this[Strings.dir].function!(this: this, arguments: [item?.jsValue ?? .undefined, options?.jsValue ?? .undefined])
59+
}
60+
61+
@inlinable public static func dirxml(data: JSValue...) {
62+
let this = JSObject.global[Strings.console].object!
63+
_ = this[Strings.dirxml].function!(this: this, arguments: data.map(\.jsValue))
64+
}
65+
66+
@inlinable public static func count(label: String? = nil) {
67+
let this = JSObject.global[Strings.console].object!
68+
_ = this[Strings.count].function!(this: this, arguments: [label?.jsValue ?? .undefined])
69+
}
70+
71+
@inlinable public static func countReset(label: String? = nil) {
72+
let this = JSObject.global[Strings.console].object!
73+
_ = this[Strings.countReset].function!(this: this, arguments: [label?.jsValue ?? .undefined])
74+
}
75+
76+
@inlinable public static func group(data: JSValue...) {
77+
let this = JSObject.global[Strings.console].object!
78+
_ = this[Strings.group].function!(this: this, arguments: data.map(\.jsValue))
79+
}
80+
81+
@inlinable public static func groupCollapsed(data: JSValue...) {
82+
let this = JSObject.global[Strings.console].object!
83+
_ = this[Strings.groupCollapsed].function!(this: this, arguments: data.map(\.jsValue))
84+
}
85+
86+
@inlinable public static func groupEnd() {
87+
let this = JSObject.global[Strings.console].object!
88+
_ = this[Strings.groupEnd].function!(this: this, arguments: [])
89+
}
90+
91+
@inlinable public static func time(label: String? = nil) {
92+
let this = JSObject.global[Strings.console].object!
93+
_ = this[Strings.time].function!(this: this, arguments: [label?.jsValue ?? .undefined])
94+
}
95+
96+
@inlinable public static func timeLog(label: String? = nil, data: JSValue...) {
97+
let this = JSObject.global[Strings.console].object!
98+
_ = this[Strings.timeLog].function!(this: this, arguments: [label?.jsValue ?? .undefined] + data.map(\.jsValue))
99+
}
100+
101+
@inlinable public static func timeEnd(label: String? = nil) {
102+
let this = JSObject.global[Strings.console].object!
103+
_ = this[Strings.timeEnd].function!(this: this, arguments: [label?.jsValue ?? .undefined])
104+
}
105+
}

Sources/DOMKitDemo/main.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import JavaScriptKit
22
import DOMKit
33

4-
let document = global.document
4+
let document = globalThis.document
55

66
let header = HTMLElement(from: document.createElement(localName: "h1"))!
77
header.innerText = "Hello World!"
8-
_ = document.body.appendChild(node: header)
8+
_ = document.body!.appendChild(node: header)
99

1010
console.log(data: "Hello, world!")

parse-idl/parse-all.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ console.log(
2222
"service-workers",
2323
"url",
2424
"streams",
25+
"console",
2526
].map((key) => parsedFiles[key]),
2627
null,
2728
2

0 commit comments

Comments
 (0)