@nebula-spatial/studio 0.1.0 → 0.1.2

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 (50) hide show
  1. package/README.md +2 -0
  2. package/dist/assets/openusd_three_loader-DLiqJWUM.js +13769 -0
  3. package/dist/assets/usd-export-worker-BRxTLqer.js +182 -0
  4. package/dist/assets/usd-worker-DekqMsQv.js +1392 -0
  5. package/dist/{builders-BAXRR5o5.js → builders-lydx4-Rh.js} +1 -1
  6. package/dist/core/session-persistence-controller.d.ts +55 -0
  7. package/dist/doc/placement-policy.d.ts +4 -0
  8. package/dist/editor/editor.d.ts +3 -1
  9. package/dist/editor/index.d.ts +2 -0
  10. package/dist/editor/session-persistence.d.ts +54 -0
  11. package/dist/editor.js +727 -490
  12. package/dist/export-evidence-z2Ne7Trf.js +2387 -0
  13. package/dist/generalization.js +2 -2
  14. package/dist/index.d.ts +4 -2
  15. package/dist/index.js +314 -306
  16. package/dist/mjcf-visual-IOy-ucto.js +72 -0
  17. package/dist/mujoco-runtime-BYZnrvbR.js +467 -0
  18. package/dist/persist/indexeddb-store.d.ts +22 -2
  19. package/dist/persist/session.d.ts +22 -0
  20. package/dist/persist/snapshot.d.ts +24 -0
  21. package/dist/{physics-facts-tfQYyNTD.js → physics-facts-D-URIBrt.js} +8 -7
  22. package/dist/{placement-policy-DY_FNRDu.js → placement-policy-C6dV6Tf-.js} +161 -141
  23. package/dist/ports/persistence.d.ts +45 -1
  24. package/dist/project/contracts.d.ts +3 -0
  25. package/dist/remote-asset-resolver-D-UeyDMD.js +311 -0
  26. package/dist/{scene-graph-DBLKAhxa.js → scene-graph-DVOXjMmp.js} +2 -2
  27. package/dist/scene-session-PhoFXFCY.js +22006 -0
  28. package/dist/scene.js +2 -2
  29. package/dist/session-2bp8YOA4.js +963 -0
  30. package/dist/session-B3WbC7Y2.js +296 -0
  31. package/dist/session-B9kEf4xN.js +915 -0
  32. package/dist/session-DYThdzLZ.js +825 -0
  33. package/dist/studio/index.d.ts +5 -0
  34. package/dist/studio/indexeddb-persistence.d.ts +2 -0
  35. package/dist/studio/indexeddb-session-persistence.d.ts +11 -0
  36. package/dist/studio/scene-package-asset-sources.d.ts +14 -0
  37. package/dist/studio.js +1423 -1220
  38. package/dist/urdf-session-CRXL4bHf.js +1230 -0
  39. package/dist/usd-session-CTzInpNy.js +7385 -0
  40. package/dist/version.d.ts +1 -1
  41. package/dist/view/scene-session.d.ts +5 -1
  42. package/dist/wasm-module-DZn2AM1W.js +13 -0
  43. package/dist/xacro-IpPHTMYs.js +76 -0
  44. package/package.json +1 -1
  45. package/dist/asset-source-BExlEcRt.js +0 -444
  46. package/dist/assets/usd-export-worker-BsGubtAE.js +0 -1
  47. package/dist/editorial-BkAFWfbg.js +0 -83
  48. package/dist/export-evidence-B_0zRmb8.js +0 -5027
  49. package/dist/remote-asset-resolver-Cb8cfNmw.js +0 -136
  50. package/dist/scene-session-BV1HnxNh.js +0 -3506
@@ -0,0 +1,182 @@
1
+ function c(t) {
2
+ if (t instanceof Error) {
3
+ const e = t;
4
+ return {
5
+ name: e.name,
6
+ message: e.message,
7
+ ...typeof e.code == "string" ? { code: e.code } : {},
8
+ ...typeof e.stage == "string" ? { stage: e.stage } : {},
9
+ ...e.detail && typeof e.detail == "object" ? { detail: e.detail } : {}
10
+ };
11
+ }
12
+ return { name: "Error", message: String(t) };
13
+ }
14
+ const d = globalThis;
15
+ let u = null, l = "", i = null;
16
+ function s(t, e = []) {
17
+ d.postMessage(t, e);
18
+ }
19
+ function a(t, e, r) {
20
+ if (!u) throw new Error("OpenUSD exporter runtime is not initialized.");
21
+ const n = u.ccall(t, "string", r, e);
22
+ if (typeof n != "string") throw new Error(`${t} did not return JSON.`);
23
+ const o = JSON.parse(n);
24
+ if (o.ok === !1)
25
+ throw Object.assign(new Error(String(o.message ?? `${t} failed.`)), {
26
+ code: typeof o.code == "string" ? o.code : `${t.toUpperCase()}_FAILED`,
27
+ stage: typeof o.stage == "string" ? o.stage : "worker",
28
+ detail: o
29
+ });
30
+ return o;
31
+ }
32
+ async function p(t) {
33
+ u = await (await import(
34
+ /* @vite-ignore */
35
+ t.moduleUrl
36
+ )).default({
37
+ locateFile: (n) => n.endsWith(".wasm") ? t.wasmUrl : n
38
+ });
39
+ const r = u._usd_exporter_api_version();
40
+ if (r !== t.apiVersion)
41
+ throw Object.assign(
42
+ new Error(`OpenUSD exporter API ${r} does not match expected ${t.apiVersion}.`),
43
+ { code: "EXPORT_RUNTIME_API_MISMATCH", stage: "worker-load" }
44
+ );
45
+ l = t.runtimeId, s({ type: "ready", apiVersion: r, runtimeId: l });
46
+ }
47
+ function f(t, e) {
48
+ const r = a(
49
+ "usd_export_begin",
50
+ [JSON.stringify(t), JSON.stringify(e)],
51
+ ["string", "string"]
52
+ ), n = Number(r.handle);
53
+ if (!Number.isInteger(n) || n <= 0)
54
+ throw Object.assign(new Error("Exporter returned an invalid session handle."), {
55
+ code: "EXPORT_HANDLE_INVALID",
56
+ stage: "stage-build"
57
+ });
58
+ return i = n, {
59
+ handle: n,
60
+ planDigest: String(r.planDigest ?? "")
61
+ };
62
+ }
63
+ function b(t, e) {
64
+ if (!u || i === null) throw new Error("Exporter session is not initialized.");
65
+ const r = new Uint8Array(e), n = u._malloc(Math.max(1, r.byteLength));
66
+ if (!n) throw new Error(`Unable to allocate ${r.byteLength} bytes for ${t}.`);
67
+ try {
68
+ u.HEAPU8.set(r, n), a(
69
+ "usd_export_write_resource",
70
+ [i, t, n, r.byteLength],
71
+ ["number", "string", "number", "number"]
72
+ );
73
+ } finally {
74
+ u._free(n);
75
+ }
76
+ }
77
+ function _(t) {
78
+ if (!u || i === null) throw new Error("Exporter session is not initialized.");
79
+ const e = a(
80
+ "usd_export_output_info",
81
+ [i, t],
82
+ ["number", "string"]
83
+ ), r = Number(u.ccall(
84
+ "usd_export_output_size",
85
+ "number",
86
+ ["number", "string"],
87
+ [i, t]
88
+ ));
89
+ if (!Number.isInteger(r) || r < 0 || r !== e.byteSize)
90
+ throw Object.assign(new Error(`Invalid exporter output size for ${t}.`), {
91
+ code: "EXPORT_OUTPUT_SIZE_INVALID",
92
+ stage: "final-validate"
93
+ });
94
+ const n = Number(u.ccall(
95
+ "usd_export_output_data",
96
+ "number",
97
+ ["number", "string"],
98
+ [i, t]
99
+ ));
100
+ if (r > 0 && !n)
101
+ throw new Error(`Exporter output pointer is null for ${t}.`);
102
+ const o = u.HEAPU8.slice(n, n + r);
103
+ return o.buffer.slice(o.byteOffset, o.byteOffset + o.byteLength);
104
+ }
105
+ async function y(t) {
106
+ switch (t.type) {
107
+ case "init":
108
+ await p(t.runtime);
109
+ return;
110
+ case "begin":
111
+ s({
112
+ type: "result",
113
+ id: t.id,
114
+ value: f(t.plan, t.options)
115
+ });
116
+ return;
117
+ case "write-resource":
118
+ b(t.path, t.bytes), s({ type: "result", id: t.id, value: { path: t.path } });
119
+ return;
120
+ case "build-stage":
121
+ s({
122
+ type: "result",
123
+ id: t.id,
124
+ value: a("usd_export_build_stage", [i], ["number"])
125
+ });
126
+ return;
127
+ case "write-output":
128
+ s({
129
+ type: "result",
130
+ id: t.id,
131
+ value: a(
132
+ "usd_export_write_layer",
133
+ [i, t.encoding, t.path],
134
+ ["number", "string", "string"]
135
+ )
136
+ });
137
+ return;
138
+ case "package-usdz":
139
+ s({
140
+ type: "result",
141
+ id: t.id,
142
+ value: a(
143
+ "usd_export_package_usdz",
144
+ [i, t.entryPath, t.outputPath],
145
+ ["number", "string", "string"]
146
+ )
147
+ });
148
+ return;
149
+ case "validate":
150
+ s({
151
+ type: "result",
152
+ id: t.id,
153
+ value: a(
154
+ "usd_export_validate",
155
+ [i, JSON.stringify(t.expectation)],
156
+ ["number", "string"]
157
+ )
158
+ });
159
+ return;
160
+ case "read-output": {
161
+ const e = _(t.path);
162
+ s({ type: "output", id: t.id, path: t.path, bytes: e }, [e]);
163
+ return;
164
+ }
165
+ case "release":
166
+ i !== null ? (s({
167
+ type: "result",
168
+ id: t.id,
169
+ value: a("usd_export_release", [i], ["number"])
170
+ }), i = null) : s({ type: "result", id: t.id, value: { ok: !0 } });
171
+ }
172
+ }
173
+ d.onmessage = (t) => {
174
+ const e = t.data;
175
+ y(e).catch((r) => {
176
+ s({
177
+ type: "error",
178
+ ..."id" in e ? { id: e.id } : {},
179
+ error: c(r)
180
+ });
181
+ });
182
+ };