mjswan 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ /*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */
2
+ /*
3
+ * Cross-Origin Isolation Service Worker
4
+ *
5
+ * On hosting platforms that don't allow custom HTTP headers (e.g. GitHub Pages),
6
+ * this service worker intercepts all responses and injects the COOP/COEP headers
7
+ * required for SharedArrayBuffer (used by MuJoCo WASM threading).
8
+ */
9
+ if (typeof window === "undefined") {
10
+ // Service Worker context
11
+ self.addEventListener("install", () => self.skipWaiting());
12
+ self.addEventListener("activate", (event) =>
13
+ event.waitUntil(self.clients.claim())
14
+ );
15
+ self.addEventListener("fetch", (event) => {
16
+ if (event.request.cache === "only-if-cached" && event.request.mode !== "same-origin") {
17
+ return;
18
+ }
19
+ event.respondWith(
20
+ fetch(event.request).then((response) => {
21
+ if (response.status === 0) {
22
+ return response;
23
+ }
24
+ const headers = new Headers(response.headers);
25
+ headers.set("Cross-Origin-Embedder-Policy", "require-corp");
26
+ headers.set("Cross-Origin-Opener-Policy", "same-origin");
27
+ return new Response(response.body, {
28
+ status: response.status,
29
+ statusText: response.statusText,
30
+ headers,
31
+ });
32
+ })
33
+ );
34
+ });
35
+ } else {
36
+ // Window context – register the service worker
37
+ (() => {
38
+ const reloadedBySW = window.sessionStorage.getItem("coiReloadedBySW");
39
+ window.sessionStorage.removeItem("coiReloadedBySW");
40
+
41
+ // Already isolated, nothing to do
42
+ if (window.crossOriginIsolated) return;
43
+
44
+ const reg = navigator.serviceWorker;
45
+ if (!reg) {
46
+ console.warn("coi-serviceworker: navigator.serviceWorker is not available.");
47
+ return;
48
+ }
49
+
50
+ reg.register(new URL("coi-serviceworker.js", window.location.href).href).then(
51
+ (registration) => {
52
+ if (registration.active && !registration.installing && !registration.waiting) {
53
+ // SW is active but page is not isolated – need a reload
54
+ if (!reloadedBySW) {
55
+ window.sessionStorage.setItem("coiReloadedBySW", "true");
56
+ window.location.reload();
57
+ }
58
+ }
59
+ registration.addEventListener("updatefound", () => {
60
+ const worker = registration.installing;
61
+ if (!worker) return;
62
+ worker.addEventListener("statechange", () => {
63
+ if (worker.state === "activated" && !reloadedBySW) {
64
+ window.sessionStorage.setItem("coiReloadedBySW", "true");
65
+ window.location.reload();
66
+ }
67
+ });
68
+ });
69
+ },
70
+ (err) => {
71
+ console.error("coi-serviceworker: registration failed.", err);
72
+ }
73
+ );
74
+ })();
75
+ }
@@ -0,0 +1,22 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="logo.svg" type="image/svg+xml" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Browser-based mujoco simulation with real-time policy control"
11
+ />
12
+ <link rel="manifest" href="manifest.json" />
13
+ <title>mjswan</title>
14
+ <script src="coi-serviceworker.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-D06ezVv2.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index-D_DiXcjN.css">
17
+ </head>
18
+ <body>
19
+ <noscript>You need to enable JavaScript to run this app.</noscript>
20
+ <div id="root"></div>
21
+ </body>
22
+ </html>
package/dist/logo.svg ADDED
@@ -0,0 +1,137 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="200 200 640 620" width="640" height="620">
3
+ <!-- floating animation: 10s still → 3 cycles of bobbing (1.8s each), repeat -->
4
+ <g>
5
+ <animateTransform
6
+ attributeName="transform"
7
+ type="translate"
8
+ values="0,0; 0,0; 0,-8; 0,0; 0,-8; 0,0; 0,-8; 0,0"
9
+ keyTimes="0.000000; 0.649351; 0.707792; 0.766234; 0.824675; 0.883117; 0.941558; 1.000000"
10
+ keySplines="0 0 1 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1"
11
+ dur="15.4s"
12
+ repeatCount="indefinite"
13
+ calcMode="spline"
14
+ />
15
+
16
+ <!-- body -->
17
+ <path
18
+ d="M0 0
19
+ C19.5727 16.7077 31.694 39.4918 33.9375 65.1875
20
+ C34.2483 68.7468 34.5336 77.6772 34.4414 74.1055
21
+ C35.3284 108.461 20.7228 141.122 1.3125 168.688
22
+ C-5.88395 178.98 -12.1939 187.385 -18.6875 195.688
23
+ C-117.884 309.753 -127.903 324.625 -136.688 340.688
24
+ C-145.984 357.74 -151.229 373.839 -154.688 390.688
25
+ C-159.889 420.158 -154.646 450.48 -139.688 473.688
26
+ C-130.828 484.996 -129.138 487.158 -128.688 490.688
27
+ C-128.003 496.049 -146.936 485.86 -141.886 487.789
28
+ C-162.872 479.77 -181.351 468.137 -197.688 452.688
29
+ C-214.286 432.749 -214.884 431.811 -215.5 430.844
30
+ C-229.272 408.287 -233.515 380.931 -227.848 355.086
31
+ C-220.957 327.486 -206.224 303.7 -188.688 281.688
32
+ C-147.292 235.169 -144.935 232.879 -142.188 230.75
33
+ C-80.4324 169.193 -78.6908 167.534 -76.5 165.438
34
+ C-59.2641 144.552 -48.9109 133.056 -52.6875 137.938
35
+ C-35.7197 116.006 -21.9713 91.7633 -24.9609 63.0625
36
+ C-26.4511 54.9648 -30.6331 49.1579 -36.8438 43.9141
37
+ C-43.5075 39.481 -51.0195 40.0666 -58.6875 40.6875
38
+ C-70.1326 43.2181 -78.1196 49.8792 -86.1008 58.0808
39
+ C-97.7104 69.9591 -111.568 78.7846 -125.638 87.4277
40
+ C-142.065 97.6106 -154.944 104.08 -168.312 110.062
41
+ C-174.557 112.83 -178.525 114.388 -182.688 115.688
42
+ C-182.688 110.888 -181.993 110.537 -178.75 107.25
43
+ C-171.175 99.1168 -165.266 90.2501 -160.25 80.375
44
+ C-155.541 70.8385 -154.46 63.8139 -154.25 55.4375
45
+ C-153.495 37.9004 -147.572 20.2698 -134.688 7.6875
46
+ C-118.97 -5.41176 -113.353 -9.26387 -106.688 -12.375
47
+ C-69.8744 -29.0972 -29.4707 -23.1467 0 0
48
+ Z"
49
+ fill="#8DB7D0"
50
+ transform="translate(484.6875,268.3125)"
51
+ />
52
+
53
+ <!-- wing (upper) -->
54
+ <path
55
+ d="M0 0
56
+ C0.99 0.33 1.98 0.66 3 1
57
+ C3.50273592 33.32978676 -0.1782821 64.23857643 -18 92
58
+ C-18.54527344 92.88171875 -19.09054687 93.7634375 -19.65234375 94.671875
59
+ C-24.01408702 101.19965404 -29.37357603 106.6774807 -34.875 112.25
60
+ C-35.9894751 113.38550293 -35.9894751 113.38550293 -37.12646484 114.54394531
61
+ C-54.23500166 131.5070838 -77.49478148 141.78198121 -100.125 149.125
62
+ C-101.04595459 149.42543213 -101.96690918 149.72586426 -102.91577148 150.03540039
63
+ C-121.99194699 156.01143688 -141.5908025 160.10136666 -161.1875 163.9375
64
+ C-163.38191 164.37185905 -165.57624474 164.80659852 -167.77050781 165.24169922
65
+ C-179.84201212 167.62865029 -191.92546077 169.94705022 -204.02108765 172.20825195
66
+ C-254.77553552 181.69800017 -306.53049762 191.5980273 -353 215
67
+ C-353.78842285 215.38752441 -354.5768457 215.77504883 -355.38916016 216.17431641
68
+ C-380.52985125 228.55944866 -404.34890627 246.55449383 -420.30078125 269.83984375
69
+ C-422 272 -422 272 -425 273
70
+ C-432.4807795 258.03844099 -424.16714295 229.81400699 -419.25 214.6875
71
+ C-410.92457114 190.63833318 -397.33387924 171.41890069 -380 153
72
+ C-361.06655762 136.2889209 -361.06655762 136.2889209 -360.11425781 135.56347656
73
+ C-325.18813978 109.11045849 -285.2103014 92.96660275 -243.36181641 80.96679688
74
+ C-207.46448896 70.34199233 -179.66475383 64.13512513 -151.96337891 57.89355469
75
+ C-57.23331851 35.62872491 -57.23331851 35.62872491 -4 3
76
+ Z"
77
+ fill="#8CB7D0"
78
+ transform="translate(790,477)"
79
+ >
80
+ <!-- rotates -3° around lower-left root (-425, 273) during flap -->
81
+ <animateTransform
82
+ attributeName="transform"
83
+ type="rotate"
84
+ additive="sum"
85
+ values="0 -425 273; 0 -425 273; -3 -425 273; 0 -425 273; -3 -425 273; 0 -425 273; -3 -425 273; 0 -425 273; -3 -425 273; 0 -425 273; -3 -425 273; 0 -425 273; -3 -425 273; 0 -425 273"
86
+ keyTimes="0.000000; 0.649351; 0.678571; 0.707792; 0.737013; 0.766234; 0.795455; 0.824675; 0.853896; 0.883117; 0.912338; 0.941558; 0.970779; 1.000000"
87
+ keySplines="0 0 1 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1"
88
+ dur="15.4s"
89
+ repeatCount="indefinite"
90
+ calcMode="spline"
91
+ />
92
+ </path>
93
+
94
+ <!-- wing (lower) -->
95
+ <path
96
+ d="M0 0
97
+ C0.66 0.33 1.32 0.66 2 1
98
+ C0.76786494 10.7099599 -1.81378767 19.7863669 -5 29
99
+ C-5.61294922 30.79050781 -5.61294922 30.79050781 -6.23828125 32.6171875
100
+ C-14.32385196 54.41722181 -27.61978044 72.85715266 -43.58447266 89.51708984
101
+ C-44.86555551 90.8591556 -46.12733217 92.21958521 -47.38671875 93.58203125
102
+ C-58.55706587 105.32132645 -72.19290338 114.629147 -86 123
103
+ C-87.05832031 123.65226563 -88.11664062 124.30453125 -89.20703125 124.9765625
104
+ C-138.76343451 154.48701853 -199.25625268 164.36761193 -256 168
105
+ C-257.03453308 168.07098404 -257.03453308 168.07098404 -258.08996582 168.1434021
106
+ C-276.81558315 169.39387259 -295.600971 169.19681341 -314.35842514 169.18847656
107
+ C-317.14264869 169.18749377 -319.92686671 169.1884829 -322.71109009 169.18969727
108
+ C-349.51749529 169.19405644 -376.24716366 168.86745873 -403 167
109
+ C-403.33 166.01 -403.66 165.02 -404 164
110
+ C-390.66935201 141.73781786 -367.25938037 125.3304604 -345 113
111
+ C-344.27345215 112.59297852 -343.5469043 112.18595703 -342.79833984 111.76660156
112
+ C-332.26027757 105.90151613 -321.64205858 101.03747566 -310.32348633 96.89233398
113
+ C-307.59626236 95.84494472 -304.92021539 94.69613531 -302.234375 93.546875
114
+ C-296.15544756 90.9970295 -289.99639207 88.96116136 -283.6875 87.0625
115
+ C-282.5521582 86.71896484 -281.41681641 86.37542969 -280.24707031 86.02148438
116
+ C-241.25049447 74.33882818 -201.12895296 67.38246254 -161.12744141 60.11425781
117
+ C-73.57278168 45.808027 -73.57278168 45.808027 0 0
118
+ Z"
119
+ fill="#8DB7D0"
120
+ transform="translate(779,597)"
121
+ >
122
+ <!-- rotates -2° around lower-left root (-404, 164) during flap -->
123
+ <animateTransform
124
+ attributeName="transform"
125
+ type="rotate"
126
+ additive="sum"
127
+ values="0 -404 164; 0 -404 164; -2 -404 164; 0 -404 164; -2 -404 164; 0 -404 164; -2 -404 164; 0 -404 164; -2 -404 164; 0 -404 164; -2 -404 164; 0 -404 164; -2 -404 164; 0 -404 164"
128
+ keyTimes="0.000000; 0.649351; 0.678571; 0.707792; 0.737013; 0.766234; 0.795455; 0.824675; 0.853896; 0.883117; 0.912338; 0.941558; 0.970779; 1.000000"
129
+ keySplines="0 0 1 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1; 0.5 0 0.5 1"
130
+ dur="15.4s"
131
+ repeatCount="indefinite"
132
+ calcMode="spline"
133
+ />
134
+ </path>
135
+
136
+ </g>
137
+ </svg>
@@ -0,0 +1,15 @@
1
+ {
2
+ "short_name": "mjswan",
3
+ "name": "mjswan",
4
+ "icons": [
5
+ {
6
+ "src": "logo.svg",
7
+ "sizes": "any",
8
+ "type": "image/svg+xml"
9
+ }
10
+ ],
11
+ "start_url": ".",
12
+ "display": "standalone",
13
+ "theme_color": "#000000",
14
+ "background_color": "#ffffff"
15
+ }
@@ -0,0 +1,2 @@
1
+ User-agent: *
2
+ Disallow:
package/index.html ADDED
@@ -0,0 +1,21 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="logo.svg" type="image/svg+xml" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Browser-based mujoco simulation with real-time policy control"
11
+ />
12
+ <link rel="manifest" href="manifest.json" />
13
+ <title>mjswan</title>
14
+ <script src="coi-serviceworker.js"></script>
15
+ </head>
16
+ <body>
17
+ <noscript>You need to enable JavaScript to run this app.</noscript>
18
+ <div id="root"></div>
19
+ <script type="module" src="src/index.tsx"></script>
20
+ </body>
21
+ </html>
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "mjswan",
3
+ "type": "module",
4
+ "version": "0.0.10",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ttktjmt/mjswan.git"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "index.html",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "dev": "vite --host",
17
+ "build": "tsc && vite build",
18
+ "preview": "vite preview",
19
+ "lint": "eslint src/",
20
+ "lint:fix": "eslint src/ --fix",
21
+ "typecheck": "tsc --noEmit"
22
+ },
23
+ "dependencies": {
24
+ "@mantine/core": "^8.3.0",
25
+ "@mantine/hooks": "^8.3.0",
26
+ "@mantine/vanilla-extract": "^8.3.0",
27
+ "@tabler/icons-react": "^3.0.0",
28
+ "jszip": "^3.10.1",
29
+ "onnxruntime-web": "^1.21.1",
30
+ "react": "^18.3.1",
31
+ "react-dom": "^18.3.1",
32
+ "three": "^0.181.1"
33
+ },
34
+ "overrides": {
35
+ "minimatch": ">=10.2.1"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^25.0.3",
39
+ "@types/react": "^18.3.0",
40
+ "@types/react-dom": "^18.3.0",
41
+ "@types/three": "^0.181.0",
42
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
43
+ "@typescript-eslint/parser": "^8.56.0",
44
+ "@vanilla-extract/css": "^1.14.1",
45
+ "@vanilla-extract/vite-plugin": "^5.1.4",
46
+ "@vitejs/plugin-react": "^4.2.0",
47
+ "eslint": "^10.0.0",
48
+ "globals": "^15.11.0",
49
+ "typescript": "^5.9.3",
50
+ "vite": "^7.3.1"
51
+ }
52
+ }