Commit 104bd7f3d9

104bd7f3d9f59304cc79367d0c81f2d50333b749

parent: d06fe7dfc1

Unsigned

cmc <hello@cleberg.net> · 2026-11-01 06:56 UTC

Add ElementaryUI + OrgSwift spike in swift/ (!4)

Swift/Wasm port of the editor in swift/: ElementaryUI view, OrgSwift rendering, Blob downloads via JavaScriptKit. Embedded Swift build, 540 KB .wasm (193 KB brotli). The existing JS site is unchanged.

Requires the swift.org 6.4.2 toolchain, the 6.4.2 Wasm SDKs, and org-swift at ../../org-swift.

Layout: unified · split

swift/.gitignore added +5
@@ -0,0 +1,5 @@
1.build
2.vscode
3dist
4node_modules
5.DS_Store
\ No newline at end of file
swift/Package.resolved added +51
@@ -0,0 +1,51 @@
1{
2 "originHash" : "d8d37aad8e49eab3751cae8cd01aa704d6a3fbd8f66df7961d5f1dcd611b76ef",
3 "pins" : [
4 {
5 "identity" : "elementary",
6 "kind" : "remoteSourceControl",
7 "location" : "https://github.com/elementary-swift/elementary",
8 "state" : {
9 "revision" : "a565afcb8d70d9b54d06cedc4f4c61944501768f",
10 "version" : "0.8.4"
11 }
12 },
13 {
14 "identity" : "elementary-ui",
15 "kind" : "remoteSourceControl",
16 "location" : "https://github.com/elementary-swift/elementary-ui.git",
17 "state" : {
18 "revision" : "6e81fe0da6983824c5512c0b000f8c2d5bc13bd1",
19 "version" : "0.9.0"
20 }
21 },
22 {
23 "identity" : "javascriptkit",
24 "kind" : "remoteSourceControl",
25 "location" : "https://github.com/swiftwasm/JavaScriptKit.git",
26 "state" : {
27 "revision" : "a0961dd40b503d8cbafff520e85c9c6b05614a88",
28 "version" : "0.62.0"
29 }
30 },
31 {
32 "identity" : "swift-collections",
33 "kind" : "remoteSourceControl",
34 "location" : "https://github.com/apple/swift-collections",
35 "state" : {
36 "revision" : "f96b909e1a9e469620bc5037c1e24e00153f376f",
37 "version" : "1.7.5"
38 }
39 },
40 {
41 "identity" : "swift-syntax",
42 "kind" : "remoteSourceControl",
43 "location" : "https://github.com/swiftlang/swift-syntax",
44 "state" : {
45 "revision" : "79e4b74a295b6eb74a8b585e3a39d29e70c1dbd1",
46 "version" : "603.0.2"
47 }
48 }
49 ],
50 "version" : 3
51}
swift/Package.swift added +25
@@ -0,0 +1,25 @@
1// swift-tools-version:6.4
2import PackageDescription
3
4let package = Package(
5 name: "org-live",
6 platforms: [.macOS(.v26)],
7 dependencies: [
8 .package(url: "https://github.com/elementary-swift/elementary-ui.git", from: "0.9.0"),
9 .package(url: "https://github.com/swiftwasm/JavaScriptKit.git", from: "0.62.0"),
10 .package(path: "../../org-swift"),
11 ],
12 targets: [
13 .executableTarget(
14 name: "OrgLive",
15 dependencies: [
16 .product(name: "ElementaryUI", package: "elementary-ui"),
17 .product(name: "JavaScriptKit", package: "JavaScriptKit"),
18 .product(name: "OrgSwift", package: "org-swift"),
19 ],
20 swiftSettings: [
21 .swiftLanguageMode(.v5)
22 ],
23 )
24 ]
25)
swift/Sources/OrgLive/App.swift added +67
@@ -0,0 +1,67 @@
1import ElementaryUI
2import JavaScriptKit
3import OrgSwift
4
5@main
6struct App {
7 static func main() {
8 let app = Application(Editor())
9 app.mount(in: .body)
10 }
11}
12
13@View
14struct Editor {
15 var body: some View {
16 form(.autocomplete(.on)) {
17 div {
18 label(.custom(name: "for", value: "editor")) { "org-live" }
19 span(.class("spacer")) {}
20 button(.type(.button)) { "Save HTML" }
21 .onClick { save(renderHTML(editorValue()), extension: "html") }
22 button(.type(.button)) { "Save Org" }
23 .onClick { save(editorValue(), extension: "org") }
24 }
25 textarea(
26 .id("editor"),
27 .name("editor"),
28 .custom(name: "autocapitalize", value: "on"),
29 .custom(name: "autocorrect", value: "on"),
30 .custom(name: "spellcheck", value: "true"),
31 .placeholder("* Lorem Ipsum"),
32 .cols(80),
33 .wrap(.hard),
34 .autofocus,
35 .required
36 ) {}
37 .onInput { event in
38 preview.innerHTML = .string(renderHTML(event.targetValue ?? ""))
39 }
40 }
41 div(.id("preview")) {}
42 }
43}
44
45private let document = JSObject.global.document.object!
46private var preview: JSObject { document.getElementById!("preview").object! }
47
48private func editorValue() -> String {
49 document.getElementById!("editor").value.string ?? ""
50}
51
52private func renderHTML(_ org: String) -> String {
53 var options = OrgRenderOptions()
54 options.headingLevelOffset = 1
55 return OrgRenderer.renderToHTML(org, options: options)
56}
57
58private func save(_ data: String, extension ext: String) {
59 let filename = JSObject.global.Date.object!.new().toISOString!().string!
60 let blob = JSObject.global.Blob.object!.new([data])
61 let url = JSObject.global.URL.object!.createObjectURL!(blob)
62 let a = document.createElement!("a").object!
63 a.href = url
64 a.download = .string("\(filename).\(ext)")
65 _ = a.click!()
66 _ = JSObject.global.URL.object!.revokeObjectURL!(url)
67}
swift/index.html added +15
@@ -0,0 +1,15 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>org-live</title>
7 <link rel="stylesheet" href="../static/styles.css">
8 </head>
9 <body>
10 <script type="module">
11 import { init } from "virtual:swift-wasm?js&product=OrgLive";
12 await init();
13 </script>
14 </body>
15</html>
swift/package-lock.json added +848
@@ -0,0 +1,848 @@
1{
2 "name": "swift",
3 "lockfileVersion": 3,
4 "requires": true,
5 "packages": {
6 "": {
7 "dependencies": {
8 "@bjorn3/browser_wasi_shim": "~0.4.2"
9 },
10 "devDependencies": {
11 "@elementary-swift/vite-plugin-swift-wasm": "~0.2.0",
12 "vite": "^8.0.0"
13 }
14 },
15 "node_modules/@bjorn3/browser_wasi_shim": {
16 "version": "0.4.2",
17 "resolved": "https://registry.npmjs.org/@bjorn3/browser_wasi_shim/-/browser_wasi_shim-0.4.2.tgz",
18 "integrity": "sha512-/iHkCVUG3VbcbmEHn5iIUpIrh7a7WPiwZ3sHy4HZKZzBdSadwdddYDZAII2zBvQYV0Lfi8naZngPCN7WPHI/hA==",
19 "license": "MIT OR Apache-2.0"
20 },
21 "node_modules/@elementary-swift/vite-plugin-swift-wasm": {
22 "version": "0.2.0",
23 "resolved": "https://registry.npmjs.org/@elementary-swift/vite-plugin-swift-wasm/-/vite-plugin-swift-wasm-0.2.0.tgz",
24 "integrity": "sha512-vjA3D30CZeRPaoBTXT0mJX0Eb2oaJmNRtdAvQ7sL8tVnUdtr/oW56Pau9k2sbtAH/z8FXYNE8eQu9HlUc6aNCw==",
25 "dev": true,
26 "license": "Apache-2.0",
27 "dependencies": {
28 "picocolors": "^1.1.0"
29 },
30 "peerDependencies": {
31 "vite": "^7.0.0 || ^8.0.0"
32 }
33 },
34 "node_modules/@oxc-project/types": {
35 "version": "0.156.0",
36 "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz",
37 "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==",
38 "dev": true,
39 "license": "MIT",
40 "funding": {
41 "url": "https://github.com/sponsors/oxc-project"
42 }
43 },
44 "node_modules/@rolldown/binding-android-arm-eabi": {
45 "version": "1.2.16",
46 "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz",
47 "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==",
48 "cpu": [
49 "arm"
50 ],
51 "dev": true,
52 "license": "MIT",
53 "optional": true,
54 "os": [
55 "android"
56 ],
57 "engines": {
58 "node": "^20.19.0 || >=22.12.0"
59 }
60 },
61 "node_modules/@rolldown/binding-android-arm64": {
62 "version": "1.2.16",
63 "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz",
64 "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==",
65 "cpu": [
66 "arm64"
67 ],
68 "dev": true,
69 "license": "MIT",
70 "optional": true,
71 "os": [
72 "android"
73 ],
74 "engines": {
75 "node": "^20.19.0 || >=22.12.0"
76 }
77 },
78 "node_modules/@rolldown/binding-darwin-arm64": {
79 "version": "1.2.16",
80 "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz",
81 "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==",
82 "cpu": [
83 "arm64"
84 ],
85 "dev": true,
86 "license": "MIT",
87 "optional": true,
88 "os": [
89 "darwin"
90 ],
91 "engines": {
92 "node": "^20.19.0 || >=22.12.0"
93 }
94 },
95 "node_modules/@rolldown/binding-darwin-x64": {
96 "version": "1.2.16",
97 "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz",
98 "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==",
99 "cpu": [
100 "x64"
101 ],
102 "dev": true,
103 "license": "MIT",
104 "optional": true,
105 "os": [
106 "darwin"
107 ],
108 "engines": {
109 "node": "^20.19.0 || >=22.12.0"
110 }
111 },
112 "node_modules/@rolldown/binding-freebsd-x64": {
113 "version": "1.2.16",
114 "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz",
115 "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==",
116 "cpu": [
117 "x64"
118 ],
119 "dev": true,
120 "license": "MIT",
121 "optional": true,
122 "os": [
123 "freebsd"
124 ],
125 "engines": {
126 "node": "^20.19.0 || >=22.12.0"
127 }
128 },
129 "node_modules/@rolldown/binding-linux-arm-gnueabihf": {
130 "version": "1.2.16",
131 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz",
132 "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==",
133 "cpu": [
134 "arm"
135 ],
136 "dev": true,
137 "license": "MIT",
138 "optional": true,
139 "os": [
140 "linux"
141 ],
142 "engines": {
143 "node": "^20.19.0 || >=22.12.0"
144 }
145 },
146 "node_modules/@rolldown/binding-linux-arm64-gnu": {
147 "version": "1.2.16",
148 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz",
149 "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==",
150 "cpu": [
151 "arm64"
152 ],
153 "dev": true,
154 "libc": [
155 "glibc"
156 ],
157 "license": "MIT",
158 "optional": true,
159 "os": [
160 "linux"
161 ],
162 "engines": {
163 "node": "^20.19.0 || >=22.12.0"
164 }
165 },
166 "node_modules/@rolldown/binding-linux-arm64-musl": {
167 "version": "1.2.16",
168 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz",
169 "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==",
170 "cpu": [
171 "arm64"
172 ],
173 "dev": true,
174 "libc": [
175 "musl"
176 ],
177 "license": "MIT",
178 "optional": true,
179 "os": [
180 "linux"
181 ],
182 "engines": {
183 "node": "^20.19.0 || >=22.12.0"
184 }
185 },
186 "node_modules/@rolldown/binding-linux-ppc64-gnu": {
187 "version": "1.2.16",
188 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz",
189 "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==",
190 "cpu": [
191 "ppc64"
192 ],
193 "dev": true,
194 "libc": [
195 "glibc"
196 ],
197 "license": "MIT",
198 "optional": true,
199 "os": [
200 "linux"
201 ],
202 "engines": {
203 "node": "^20.19.0 || >=22.12.0"
204 }
205 },
206 "node_modules/@rolldown/binding-linux-s390x-gnu": {
207 "version": "1.2.16",
208 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz",
209 "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==",
210 "cpu": [
211 "s390x"
212 ],
213 "dev": true,
214 "libc": [
215 "glibc"
216 ],
217 "license": "MIT",
218 "optional": true,
219 "os": [
220 "linux"
221 ],
222 "engines": {
223 "node": "^20.19.0 || >=22.12.0"
224 }
225 },
226 "node_modules/@rolldown/binding-linux-x64-gnu": {
227 "version": "1.2.16",
228 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz",
229 "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==",
230 "cpu": [
231 "x64"
232 ],
233 "dev": true,
234 "libc": [
235 "glibc"
236 ],
237 "license": "MIT",
238 "optional": true,
239 "os": [
240 "linux"
241 ],
242 "engines": {
243 "node": "^20.19.0 || >=22.12.0"
244 }
245 },
246 "node_modules/@rolldown/binding-linux-x64-musl": {
247 "version": "1.2.16",
248 "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz",
249 "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==",
250 "cpu": [
251 "x64"
252 ],
253 "dev": true,
254 "libc": [
255 "musl"
256 ],
257 "license": "MIT",
258 "optional": true,
259 "os": [
260 "linux"
261 ],
262 "engines": {
263 "node": "^20.19.0 || >=22.12.0"
264 }
265 },
266 "node_modules/@rolldown/binding-openharmony-arm64": {
267 "version": "1.2.16",
268 "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz",
269 "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==",
270 "cpu": [
271 "arm64"
272 ],
273 "dev": true,
274 "license": "MIT",
275 "optional": true,
276 "os": [
277 "openharmony"
278 ],
279 "engines": {
280 "node": "^20.19.0 || >=22.12.0"
281 }
282 },
283 "node_modules/@rolldown/binding-win32-arm64-msvc": {
284 "version": "1.2.16",
285 "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz",
286 "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==",
287 "cpu": [
288 "arm64"
289 ],
290 "dev": true,
291 "license": "MIT",
292 "optional": true,
293 "os": [
294 "win32"
295 ],
296 "engines": {
297 "node": "^20.19.0 || >=22.12.0"
298 }
299 },
300 "node_modules/@rolldown/binding-win32-x64-msvc": {
301 "version": "1.2.16",
302 "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz",
303 "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==",
304 "cpu": [
305 "x64"
306 ],
307 "dev": true,
308 "license": "MIT",
309 "optional": true,
310 "os": [
311 "win32"
312 ],
313 "engines": {
314 "node": "^20.19.0 || >=22.12.0"
315 }
316 },
317 "node_modules/@rolldown/pluginutils": {
318 "version": "1.0.1",
319 "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
320 "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
321 "dev": true,
322 "license": "MIT"
323 },
324 "node_modules/detect-libc": {
325 "version": "2.1.2",
326 "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
327 "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
328 "dev": true,
329 "license": "Apache-2.0",
330 "engines": {
331 "node": ">=8"
332 }
333 },
334 "node_modules/fdir": {
335 "version": "6.5.0",
336 "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
337 "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
338 "dev": true,
339 "license": "MIT",
340 "engines": {
341 "node": ">=12.0.0"
342 },
343 "peerDependencies": {
344 "picomatch": "^3 || ^4"
345 },
346 "peerDependenciesMeta": {
347 "picomatch": {
348 "optional": true
349 }
350 }
351 },
352 "node_modules/fsevents": {
353 "version": "2.3.3",
354 "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
355 "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
356 "dev": true,
357 "hasInstallScript": true,
358 "license": "MIT",
359 "optional": true,
360 "os": [
361 "darwin"
362 ],
363 "engines": {
364 "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
365 }
366 },
367 "node_modules/lightningcss": {
368 "version": "1.33.0",
369 "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
370 "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
371 "dev": true,
372 "license": "MPL-2.0",
373 "dependencies": {
374 "detect-libc": "^2.0.3"
375 },
376 "engines": {
377 "node": ">= 12.0.0"
378 },
379 "funding": {
380 "type": "opencollective",
381 "url": "https://opencollective.com/parcel"
382 },
383 "optionalDependencies": {
384 "lightningcss-android-arm64": "1.33.0",
385 "lightningcss-darwin-arm64": "1.33.0",
386 "lightningcss-darwin-x64": "1.33.0",
387 "lightningcss-freebsd-x64": "1.33.0",
388 "lightningcss-linux-arm-gnueabihf": "1.33.0",
389 "lightningcss-linux-arm64-gnu": "1.33.0",
390 "lightningcss-linux-arm64-musl": "1.33.0",
391 "lightningcss-linux-x64-gnu": "1.33.0",
392 "lightningcss-linux-x64-musl": "1.33.0",
393 "lightningcss-win32-arm64-msvc": "1.33.0",
394 "lightningcss-win32-x64-msvc": "1.33.0"
395 }
396 },
397 "node_modules/lightningcss-android-arm64": {
398 "version": "1.33.0",
399 "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
400 "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
401 "cpu": [
402 "arm64"
403 ],
404 "dev": true,
405 "license": "MPL-2.0",
406 "optional": true,
407 "os": [
408 "android"
409 ],
410 "engines": {
411 "node": ">= 12.0.0"
412 },
413 "funding": {
414 "type": "opencollective",
415 "url": "https://opencollective.com/parcel"
416 }
417 },
418 "node_modules/lightningcss-darwin-arm64": {
419 "version": "1.33.0",
420 "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
421 "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
422 "cpu": [
423 "arm64"
424 ],
425 "dev": true,
426 "license": "MPL-2.0",
427 "optional": true,
428 "os": [
429 "darwin"
430 ],
431 "engines": {
432 "node": ">= 12.0.0"
433 },
434 "funding": {
435 "type": "opencollective",
436 "url": "https://opencollective.com/parcel"
437 }
438 },
439 "node_modules/lightningcss-darwin-x64": {
440 "version": "1.33.0",
441 "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
442 "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
443 "cpu": [
444 "x64"
445 ],
446 "dev": true,
447 "license": "MPL-2.0",
448 "optional": true,
449 "os": [
450 "darwin"
451 ],
452 "engines": {
453 "node": ">= 12.0.0"
454 },
455 "funding": {
456 "type": "opencollective",
457 "url": "https://opencollective.com/parcel"
458 }
459 },
460 "node_modules/lightningcss-freebsd-x64": {
461 "version": "1.33.0",
462 "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
463 "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
464 "cpu": [
465 "x64"
466 ],
467 "dev": true,
468 "license": "MPL-2.0",
469 "optional": true,
470 "os": [
471 "freebsd"
472 ],
473 "engines": {
474 "node": ">= 12.0.0"
475 },
476 "funding": {
477 "type": "opencollective",
478 "url": "https://opencollective.com/parcel"
479 }
480 },
481 "node_modules/lightningcss-linux-arm-gnueabihf": {
482 "version": "1.33.0",
483 "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
484 "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
485 "cpu": [
486 "arm"
487 ],
488 "dev": true,
489 "license": "MPL-2.0",
490 "optional": true,
491 "os": [
492 "linux"
493 ],
494 "engines": {
495 "node": ">= 12.0.0"
496 },
497 "funding": {
498 "type": "opencollective",
499 "url": "https://opencollective.com/parcel"
500 }
501 },
502 "node_modules/lightningcss-linux-arm64-gnu": {
503 "version": "1.33.0",
504 "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
505 "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
506 "cpu": [
507 "arm64"
508 ],
509 "dev": true,
510 "libc": [
511 "glibc"
512 ],
513 "license": "MPL-2.0",
514 "optional": true,
515 "os": [
516 "linux"
517 ],
518 "engines": {
519 "node": ">= 12.0.0"
520 },
521 "funding": {
522 "type": "opencollective",
523 "url": "https://opencollective.com/parcel"
524 }
525 },
526 "node_modules/lightningcss-linux-arm64-musl": {
527 "version": "1.33.0",
528 "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
529 "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
530 "cpu": [
531 "arm64"
532 ],
533 "dev": true,
534 "libc": [
535 "musl"
536 ],
537 "license": "MPL-2.0",
538 "optional": true,
539 "os": [
540 "linux"
541 ],
542 "engines": {
543 "node": ">= 12.0.0"
544 },
545 "funding": {
546 "type": "opencollective",
547 "url": "https://opencollective.com/parcel"
548 }
549 },
550 "node_modules/lightningcss-linux-x64-gnu": {
551 "version": "1.33.0",
552 "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
553 "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
554 "cpu": [
555 "x64"
556 ],
557 "dev": true,
558 "libc": [
559 "glibc"
560 ],
561 "license": "MPL-2.0",
562 "optional": true,
563 "os": [
564 "linux"
565 ],
566 "engines": {
567 "node": ">= 12.0.0"
568 },
569 "funding": {
570 "type": "opencollective",
571 "url": "https://opencollective.com/parcel"
572 }
573 },
574 "node_modules/lightningcss-linux-x64-musl": {
575 "version": "1.33.0",
576 "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
577 "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
578 "cpu": [
579 "x64"
580 ],
581 "dev": true,
582 "libc": [
583 "musl"
584 ],
585 "license": "MPL-2.0",
586 "optional": true,
587 "os": [
588 "linux"
589 ],
590 "engines": {
591 "node": ">= 12.0.0"
592 },
593 "funding": {
594 "type": "opencollective",
595 "url": "https://opencollective.com/parcel"
596 }
597 },
598 "node_modules/lightningcss-win32-arm64-msvc": {
599 "version": "1.33.0",
600 "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
601 "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
602 "cpu": [
603 "arm64"
604 ],
605 "dev": true,
606 "license": "MPL-2.0",
607 "optional": true,
608 "os": [
609 "win32"
610 ],
611 "engines": {
612 "node": ">= 12.0.0"
613 },
614 "funding": {
615 "type": "opencollective",
616 "url": "https://opencollective.com/parcel"
617 }
618 },
619 "node_modules/lightningcss-win32-x64-msvc": {
620 "version": "1.33.0",
621 "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
622 "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
623 "cpu": [
624 "x64"
625 ],
626 "dev": true,
627 "license": "MPL-2.0",
628 "optional": true,
629 "os": [
630 "win32"
631 ],
632 "engines": {
633 "node": ">= 12.0.0"
634 },
635 "funding": {
636 "type": "opencollective",
637 "url": "https://opencollective.com/parcel"
638 }
639 },
640 "node_modules/nanoid": {
641 "version": "3.3.20",
642 "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
643 "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
644 "dev": true,
645 "funding": [
646 {
647 "type": "github",
648 "url": "https://github.com/sponsors/ai"
649 }
650 ],
651 "license": "MIT",
652 "bin": {
653 "nanoid": "bin/nanoid.cjs"
654 },
655 "engines": {
656 "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
657 }
658 },
659 "node_modules/picocolors": {
660 "version": "1.1.1",
661 "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
662 "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
663 "dev": true,
664 "license": "ISC"
665 },
666 "node_modules/picomatch": {
667 "version": "4.0.7",
668 "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
669 "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
670 "dev": true,
671 "license": "MIT",
672 "engines": {
673 "node": ">=12"
674 },
675 "funding": {
676 "url": "https://github.com/sponsors/jonschlinkert"
677 }
678 },
679 "node_modules/postcss": {
680 "version": "8.5.32",
681 "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
682 "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
683 "dev": true,
684 "funding": [
685 {
686 "type": "opencollective",
687 "url": "https://opencollective.com/postcss/"
688 },
689 {
690 "type": "tidelift",
691 "url": "https://tidelift.com/funding/github/npm/postcss"
692 },
693 {
694 "type": "github",
695 "url": "https://github.com/sponsors/ai"
696 }
697 ],
698 "license": "MIT",
699 "dependencies": {
700 "nanoid": "^3.3.20",
701 "picocolors": "^1.1.1",
702 "source-map-js": "^1.2.2"
703 },
704 "engines": {
705 "node": "^10 || ^12 || >=14"
706 }
707 },
708 "node_modules/rolldown": {
709 "version": "1.2.16",
710 "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz",
711 "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==",
712 "dev": true,
713 "license": "MIT",
714 "dependencies": {
715 "@oxc-project/types": "=0.156.0",
716 "@rolldown/pluginutils": "^1.0.0"
717 },
718 "bin": {
719 "rolldown": "bin/cli.mjs"
720 },
721 "engines": {
722 "node": "^20.19.0 || >=22.12.0"
723 },
724 "optionalDependencies": {
725 "@rolldown/binding-android-arm-eabi": "1.2.16",
726 "@rolldown/binding-android-arm64": "1.2.16",
727 "@rolldown/binding-darwin-arm64": "1.2.16",
728 "@rolldown/binding-darwin-x64": "1.2.16",
729 "@rolldown/binding-freebsd-x64": "1.2.16",
730 "@rolldown/binding-linux-arm-gnueabihf": "1.2.16",
731 "@rolldown/binding-linux-arm64-gnu": "1.2.16",
732 "@rolldown/binding-linux-arm64-musl": "1.2.16",
733 "@rolldown/binding-linux-ppc64-gnu": "1.2.16",
734 "@rolldown/binding-linux-s390x-gnu": "1.2.16",
735 "@rolldown/binding-linux-x64-gnu": "1.2.16",
736 "@rolldown/binding-linux-x64-musl": "1.2.16",
737 "@rolldown/binding-openharmony-arm64": "1.2.16",
738 "@rolldown/binding-win32-arm64-msvc": "1.2.16",
739 "@rolldown/binding-win32-x64-msvc": "1.2.16"
740 }
741 },
742 "node_modules/source-map-js": {
743 "version": "1.2.2",
744 "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
745 "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
746 "dev": true,
747 "license": "BSD-3-Clause",
748 "engines": {
749 "node": ">=0.10.0"
750 }
751 },
752 "node_modules/tinyglobby": {
753 "version": "0.2.17",
754 "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
755 "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
756 "dev": true,
757 "license": "MIT",
758 "dependencies": {
759 "fdir": "^6.5.0",
760 "picomatch": "^4.0.4"
761 },
762 "engines": {
763 "node": ">=12.0.0"
764 },
765 "funding": {
766 "url": "https://github.com/sponsors/SuperchupuDev"
767 }
768 },
769 "node_modules/vite": {
770 "version": "8.3.5",
771 "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz",
772 "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==",
773 "dev": true,
774 "license": "MIT",
775 "dependencies": {
776 "lightningcss": "^1.33.0",
777 "picomatch": "^4.0.7",
778 "postcss": "^8.5.30",
779 "rolldown": "~1.2.14",
780 "tinyglobby": "^0.2.17"
781 },
782 "bin": {
783 "vite": "bin/vite.js"
784 },
785 "engines": {
786 "node": "^20.19.0 || >=22.12.0"
787 },
788 "funding": {
789 "url": "https://github.com/vitejs/vite?sponsor=1"
790 },
791 "optionalDependencies": {
792 "fsevents": "~2.3.3"
793 },
794 "peerDependencies": {
795 "@types/node": "^20.19.0 || >=22.12.0",
796 "@vitejs/devtools": "^0.7.1 || ^0.8.0",
797 "esbuild": "^0.27.0 || ^0.28.0",
798 "jiti": ">=1.21.0",
799 "less": "^4.0.0",
800 "sass": "^1.70.0",
801 "sass-embedded": "^1.70.0",
802 "stylus": ">=0.54.8",
803 "sugarss": "^5.0.0",
804 "terser": "^5.16.0",
805 "tsx": "^4.8.1",
806 "yaml": "^2.4.2"
807 },
808 "peerDependenciesMeta": {
809 "@types/node": {
810 "optional": true
811 },
812 "@vitejs/devtools": {
813 "optional": true
814 },
815 "esbuild": {
816 "optional": true
817 },
818 "jiti": {
819 "optional": true
820 },
821 "less": {
822 "optional": true
823 },
824 "sass": {
825 "optional": true
826 },
827 "sass-embedded": {
828 "optional": true
829 },
830 "stylus": {
831 "optional": true
832 },
833 "sugarss": {
834 "optional": true
835 },
836 "terser": {
837 "optional": true
838 },
839 "tsx": {
840 "optional": true
841 },
842 "yaml": {
843 "optional": true
844 }
845 }
846 }
847 }
848}
swift/package.json added +16
@@ -0,0 +1,16 @@
1{
2 "private": true,
3 "scripts": {
4 "dev": "vite --host 0.0.0.0 --open",
5 "build": "vite build",
6 "preview": "vite preview --host 0.0.0.0"
7 },
8 "type": "module",
9 "dependencies": {
10 "@bjorn3/browser_wasi_shim": "~0.4.2"
11 },
12 "devDependencies": {
13 "@elementary-swift/vite-plugin-swift-wasm": "~0.2.0",
14 "vite": "^8.0.0"
15 }
16}
swift/tsconfig.json added +18
@@ -0,0 +1,18 @@
1{
2 "compilerOptions": {
3 "target": "ES2022",
4 "module": "ESNext",
5 "moduleResolution": "bundler",
6 "lib": [
7 "ES2022",
8 "DOM"
9 ],
10 "types": [
11 "vite/client",
12 "@elementary-swift/vite-plugin-swift-wasm/client"
13 ],
14 "isolatedModules": true,
15 "strict": true,
16 "noEmit": true
17 }
18}
\ No newline at end of file
swift/vite.config.ts added +10
@@ -0,0 +1,10 @@
1import { defineConfig } from "vite";
2import swiftWasm from "@elementary-swift/vite-plugin-swift-wasm";
3
4export default defineConfig({
5 plugins: [
6 swiftWasm({
7 useEmbeddedSDK: true,
8 }),
9 ],
10});