@nebula-spatial/viewer 0.5.18 → 0.6.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +83 -35
  2. package/README.md +5 -0
  3. package/dist/asset-ir-BXa1EdOy.js +637 -0
  4. package/dist/assets/source-types.d.ts +10 -0
  5. package/dist/assets/types.d.ts +61 -6
  6. package/dist/assets/{usd-worker-B6-1I5dT.js → usd-worker-r6Nuoxlk.js} +671 -584
  7. package/dist/index-CHf9y9eX.js +17406 -0
  8. package/dist/index.d.ts +21 -2
  9. package/dist/index.js +29 -18
  10. package/dist/{mjcf-visual-CtY2Wk3w.js → mjcf-visual-DxMXiBnu.js} +12 -13
  11. package/dist/mujoco-runtime-BA88JuDR.js +791 -0
  12. package/dist/physics-guide-size-CplAlsve.js +12 -0
  13. package/dist/scene/instances.d.ts +36 -0
  14. package/dist/scene/joints.d.ts +129 -0
  15. package/dist/scene/session.d.ts +26 -0
  16. package/dist/scene/types.d.ts +292 -0
  17. package/dist/session-DLi-MvLB.js +240 -0
  18. package/dist/{session-DxTeRKCd.js → session-DqEr1CxY.js} +581 -567
  19. package/dist/session-ZNb3ZYLq.js +562 -0
  20. package/dist/simulation/physics-runtime-state.d.ts +73 -0
  21. package/dist/simulation/types.d.ts +151 -0
  22. package/dist/simulation/usd-dependency-probe.d.ts +42 -0
  23. package/dist/simulation/usd-inspection.d.ts +66 -0
  24. package/dist/spark-renderer-BGF_AaI9.js +25 -0
  25. package/dist/spark.module-kM8pwA1o.js +9278 -0
  26. package/dist/types.d.ts +75 -1
  27. package/dist/ui/camera-axis-gizmo.d.ts +5 -0
  28. package/dist/urdf-session-CKlR-fOQ.js +1230 -0
  29. package/dist/usd-session-DyNMsD-v.js +11199 -0
  30. package/dist/version.d.ts +1 -1
  31. package/dist/visual/classification.d.ts +20 -0
  32. package/dist/{xacro-x2TeKQ7T.js → xacro-BCLnc3tY.js} +1 -1
  33. package/openusd/openusd-runtime-manifest.json +6 -6
  34. package/openusd/openusd_probe.js +1 -1
  35. package/openusd/openusd_probe.wasm +0 -0
  36. package/package.json +2 -1
  37. package/runtime-assets.d.mts +9 -9
  38. package/runtime-assets.mjs +11 -11
  39. package/vite.d.mts +7 -7
  40. package/vite.mjs +115 -115
  41. package/dist/collision-debug-BSJoz5J7.js +0 -2947
  42. package/dist/index-E8DHSeyT.js +0 -11499
  43. package/dist/mujoco-runtime-fDWdXNEc.js +0 -739
  44. package/dist/resources-CHhCm2f7.js +0 -27
  45. package/dist/session-DB-osaBL.js +0 -801
  46. package/dist/stage-BnRjc-Rp.js +0 -592
  47. package/dist/urdf-session-Q_c3Rd1M.js +0 -1264
  48. package/dist/usd-session-tW3LxVFs.js +0 -10647
@@ -1,11 +1,11 @@
1
- /** Fallback directories used when the host does not install the Viewer Vite plugin. */
2
- export const viewerRuntimeAssetDirectories = Object.freeze({
3
- basis: 'basis/',
4
- draco: 'draco/',
5
- });
6
-
7
- /** Fallback OpenUSD URLs used outside Vite or without the Viewer Vite plugin. */
8
- export const viewerRuntimeAssetUrls = Object.freeze({
9
- openUsdModuleUrl: '/openusd/openusd_probe.js',
10
- openUsdWasmUrl: '/openusd/openusd_probe.wasm',
11
- });
1
+ /** Fallback directories used when the host does not install the Viewer Vite plugin. */
2
+ export const viewerRuntimeAssetDirectories = Object.freeze({
3
+ basis: 'basis/',
4
+ draco: 'draco/',
5
+ });
6
+
7
+ /** Fallback OpenUSD URLs used outside Vite or without the Viewer Vite plugin. */
8
+ export const viewerRuntimeAssetUrls = Object.freeze({
9
+ openUsdModuleUrl: '/openusd/openusd_probe.js',
10
+ openUsdWasmUrl: '/openusd/openusd_probe.wasm',
11
+ });
package/vite.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import type { Plugin } from 'vite';
2
-
3
- /**
4
- * Serves the Viewer's Basis and Draco runtime files with stable filenames in
5
- * development and copies them into each production build.
6
- */
7
- export declare function viewerRuntimeAssets(): Plugin;
1
+ import type { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Serves the Viewer's Basis and Draco runtime files with stable filenames in
5
+ * development and copies them into each production build.
6
+ */
7
+ export declare function viewerRuntimeAssets(): Plugin;
package/vite.mjs CHANGED
@@ -1,115 +1,115 @@
1
- import { readFileSync } from 'node:fs';
2
- import { extname, join } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
-
5
- const runtimeDirectories = Object.freeze([
6
- {
7
- name: 'basis',
8
- root: fileURLToPath(new URL('./basis/', import.meta.url)),
9
- files: ['basis_transcoder.js', 'basis_transcoder.wasm'],
10
- },
11
- {
12
- name: 'draco',
13
- root: fileURLToPath(new URL('./draco/', import.meta.url)),
14
- files: ['draco_wasm_wrapper.js', 'draco_decoder.wasm'],
15
- },
16
- ]);
17
-
18
- const contentTypes = new Map([
19
- ['.js', 'text/javascript; charset=utf-8'],
20
- ['.wasm', 'application/wasm'],
21
- ]);
22
- const runtimeAssetSpecifier = '@nebula-spatial/viewer/runtime-assets';
23
- const runtimeAssetVirtualId = '\0nebula-spatial-viewer-runtime-assets';
24
-
25
- function normalizeBase(base) {
26
- if (!base || base === './' || base === '.') return '/';
27
- const pathname = /^[a-z]+:\/\//i.test(base) ? new URL(base).pathname : base;
28
- const rooted = pathname.startsWith('/') ? pathname : `/${pathname}`;
29
- return rooted.endsWith('/') ? rooted : `${rooted}/`;
30
- }
31
-
32
- function runtimeAssets() {
33
- return runtimeDirectories.flatMap((directory) => directory.files.map((file) => ({
34
- directory: directory.name,
35
- file,
36
- path: join(directory.root, file),
37
- })));
38
- }
39
-
40
- /**
41
- * Serves the Viewer's Basis and Draco runtime files with stable filenames in
42
- * development and copies them into each production build.
43
- */
44
- export function viewerRuntimeAssets() {
45
- let base = '/';
46
-
47
- return {
48
- name: 'nebula-spatial-viewer-runtime-assets',
49
- enforce: 'pre',
50
- configResolved(config) {
51
- base = normalizeBase(config.base);
52
- },
53
- resolveId(id) {
54
- return id === runtimeAssetSpecifier ? runtimeAssetVirtualId : null;
55
- },
56
- load(id) {
57
- if (id !== runtimeAssetVirtualId) return null;
58
- return [
59
- "import openUsdModuleUrl from '@nebula-spatial/viewer/openusd/openusd_probe.js?url';",
60
- "import openUsdWasmUrl from '@nebula-spatial/viewer/openusd/openusd_probe.wasm?url';",
61
- `export const viewerRuntimeAssetDirectories = Object.freeze(${JSON.stringify({
62
- basis: `${base}basis/`,
63
- draco: `${base}draco/`,
64
- })});`,
65
- 'export const viewerRuntimeAssetUrls = Object.freeze({ openUsdModuleUrl, openUsdWasmUrl });',
66
- '',
67
- ].join('\n');
68
- },
69
- buildStart() {
70
- for (const asset of runtimeAssets()) {
71
- // Read eagerly so a broken package fails at build start, not midway.
72
- readFileSync(asset.path);
73
- }
74
- },
75
- configureServer(server) {
76
- server.middlewares.use((request, response, next) => {
77
- if (request.method !== 'GET' && request.method !== 'HEAD') {
78
- next();
79
- return;
80
- }
81
- let pathname;
82
- try {
83
- pathname = decodeURIComponent(new URL(request.url ?? '/', 'http://viewer.invalid').pathname);
84
- } catch {
85
- next();
86
- return;
87
- }
88
- const asset = runtimeAssets().find(({ directory, file }) => (
89
- pathname === `${base}${directory}/${file}`
90
- || pathname.endsWith(`/${directory}/${file}`)
91
- ));
92
- if (!asset) {
93
- next();
94
- return;
95
- }
96
- const bytes = readFileSync(asset.path);
97
- response.statusCode = 200;
98
- response.setHeader('Content-Type', contentTypes.get(extname(asset.file)) ?? 'application/octet-stream');
99
- response.setHeader('Cache-Control', 'no-cache');
100
- response.setHeader('Content-Length', bytes.byteLength);
101
- if (request.method === 'HEAD') response.end();
102
- else response.end(bytes);
103
- });
104
- },
105
- generateBundle() {
106
- for (const asset of runtimeAssets()) {
107
- this.emitFile({
108
- type: 'asset',
109
- fileName: `${asset.directory}/${asset.file}`,
110
- source: readFileSync(asset.path),
111
- });
112
- }
113
- },
114
- };
115
- }
1
+ import { readFileSync } from 'node:fs';
2
+ import { extname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const runtimeDirectories = Object.freeze([
6
+ {
7
+ name: 'basis',
8
+ root: fileURLToPath(new URL('./basis/', import.meta.url)),
9
+ files: ['basis_transcoder.js', 'basis_transcoder.wasm'],
10
+ },
11
+ {
12
+ name: 'draco',
13
+ root: fileURLToPath(new URL('./draco/', import.meta.url)),
14
+ files: ['draco_wasm_wrapper.js', 'draco_decoder.wasm'],
15
+ },
16
+ ]);
17
+
18
+ const contentTypes = new Map([
19
+ ['.js', 'text/javascript; charset=utf-8'],
20
+ ['.wasm', 'application/wasm'],
21
+ ]);
22
+ const runtimeAssetSpecifier = '@nebula-spatial/viewer/runtime-assets';
23
+ const runtimeAssetVirtualId = '\0nebula-spatial-viewer-runtime-assets';
24
+
25
+ function normalizeBase(base) {
26
+ if (!base || base === './' || base === '.') return '/';
27
+ const pathname = /^[a-z]+:\/\//i.test(base) ? new URL(base).pathname : base;
28
+ const rooted = pathname.startsWith('/') ? pathname : `/${pathname}`;
29
+ return rooted.endsWith('/') ? rooted : `${rooted}/`;
30
+ }
31
+
32
+ function runtimeAssets() {
33
+ return runtimeDirectories.flatMap((directory) => directory.files.map((file) => ({
34
+ directory: directory.name,
35
+ file,
36
+ path: join(directory.root, file),
37
+ })));
38
+ }
39
+
40
+ /**
41
+ * Serves the Viewer's Basis and Draco runtime files with stable filenames in
42
+ * development and copies them into each production build.
43
+ */
44
+ export function viewerRuntimeAssets() {
45
+ let base = '/';
46
+
47
+ return {
48
+ name: 'nebula-spatial-viewer-runtime-assets',
49
+ enforce: 'pre',
50
+ configResolved(config) {
51
+ base = normalizeBase(config.base);
52
+ },
53
+ resolveId(id) {
54
+ return id === runtimeAssetSpecifier ? runtimeAssetVirtualId : null;
55
+ },
56
+ load(id) {
57
+ if (id !== runtimeAssetVirtualId) return null;
58
+ return [
59
+ "import openUsdModuleUrl from '@nebula-spatial/viewer/openusd/openusd_probe.js?url';",
60
+ "import openUsdWasmUrl from '@nebula-spatial/viewer/openusd/openusd_probe.wasm?url';",
61
+ `export const viewerRuntimeAssetDirectories = Object.freeze(${JSON.stringify({
62
+ basis: `${base}basis/`,
63
+ draco: `${base}draco/`,
64
+ })});`,
65
+ 'export const viewerRuntimeAssetUrls = Object.freeze({ openUsdModuleUrl, openUsdWasmUrl });',
66
+ '',
67
+ ].join('\n');
68
+ },
69
+ buildStart() {
70
+ for (const asset of runtimeAssets()) {
71
+ // Read eagerly so a broken package fails at build start, not midway.
72
+ readFileSync(asset.path);
73
+ }
74
+ },
75
+ configureServer(server) {
76
+ server.middlewares.use((request, response, next) => {
77
+ if (request.method !== 'GET' && request.method !== 'HEAD') {
78
+ next();
79
+ return;
80
+ }
81
+ let pathname;
82
+ try {
83
+ pathname = decodeURIComponent(new URL(request.url ?? '/', 'http://viewer.invalid').pathname);
84
+ } catch {
85
+ next();
86
+ return;
87
+ }
88
+ const asset = runtimeAssets().find(({ directory, file }) => (
89
+ pathname === `${base}${directory}/${file}`
90
+ || pathname.endsWith(`/${directory}/${file}`)
91
+ ));
92
+ if (!asset) {
93
+ next();
94
+ return;
95
+ }
96
+ const bytes = readFileSync(asset.path);
97
+ response.statusCode = 200;
98
+ response.setHeader('Content-Type', contentTypes.get(extname(asset.file)) ?? 'application/octet-stream');
99
+ response.setHeader('Cache-Control', 'no-cache');
100
+ response.setHeader('Content-Length', bytes.byteLength);
101
+ if (request.method === 'HEAD') response.end();
102
+ else response.end(bytes);
103
+ });
104
+ },
105
+ generateBundle() {
106
+ for (const asset of runtimeAssets()) {
107
+ this.emitFile({
108
+ type: 'asset',
109
+ fileName: `${asset.directory}/${asset.file}`,
110
+ source: readFileSync(asset.path),
111
+ });
112
+ }
113
+ },
114
+ };
115
+ }