@nebula-spatial/viewer 0.5.18 → 0.6.0

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 (40) hide show
  1. package/CHANGELOG.md +63 -35
  2. package/dist/asset-ir-BEDGD9CL.js +637 -0
  3. package/dist/assets/source-types.d.ts +10 -0
  4. package/dist/assets/types.d.ts +59 -6
  5. package/dist/index-DoxM1Msk.js +17223 -0
  6. package/dist/index.d.ts +20 -1
  7. package/dist/index.js +29 -18
  8. package/dist/{mjcf-visual-CtY2Wk3w.js → mjcf-visual-CQEeWkL_.js} +12 -13
  9. package/dist/mujoco-runtime-BmuEJ_ST.js +791 -0
  10. package/dist/physics-guide-size-CplAlsve.js +12 -0
  11. package/dist/scene/instances.d.ts +36 -0
  12. package/dist/scene/joints.d.ts +129 -0
  13. package/dist/scene/session.d.ts +26 -0
  14. package/dist/scene/types.d.ts +284 -0
  15. package/dist/session-BnNntPUE.js +9169 -0
  16. package/dist/{session-DxTeRKCd.js → session-Cz4tFSlO.js} +6 -8
  17. package/dist/session-sBOJEWpK.js +559 -0
  18. package/dist/simulation/physics-runtime-state.d.ts +73 -0
  19. package/dist/simulation/types.d.ts +151 -0
  20. package/dist/simulation/usd-dependency-probe.d.ts +42 -0
  21. package/dist/simulation/usd-inspection.d.ts +66 -0
  22. package/dist/types.d.ts +46 -1
  23. package/dist/ui/camera-axis-gizmo.d.ts +5 -0
  24. package/dist/urdf-session-HKelZnMM.js +1230 -0
  25. package/dist/{usd-session-tW3LxVFs.js → usd-session-Cn6whyh4.js} +3915 -3687
  26. package/dist/version.d.ts +1 -1
  27. package/dist/visual/classification.d.ts +20 -0
  28. package/dist/{xacro-x2TeKQ7T.js → xacro-Cl7vUCSC.js} +1 -1
  29. package/package.json +2 -1
  30. package/runtime-assets.d.mts +9 -9
  31. package/runtime-assets.mjs +11 -11
  32. package/vite.d.mts +7 -7
  33. package/vite.mjs +115 -115
  34. package/dist/collision-debug-BSJoz5J7.js +0 -2947
  35. package/dist/index-E8DHSeyT.js +0 -11499
  36. package/dist/mujoco-runtime-fDWdXNEc.js +0 -739
  37. package/dist/resources-CHhCm2f7.js +0 -27
  38. package/dist/session-DB-osaBL.js +0 -801
  39. package/dist/stage-BnRjc-Rp.js +0 -592
  40. package/dist/urdf-session-Q_c3Rd1M.js +0 -1264
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import './version';
2
2
  export { viewerVersion } from './version';
3
3
  export type { ViewerSceneUiOptions, ViewerSceneUiParts } from './ui/types';
4
4
  export { createViewer } from './viewer';
5
+ export { axisGizmo } from './ui/camera-axis-gizmo';
5
6
  export { DEFAULT_GROUND_GRID_SCALE, chooseGroundGridScale, formatGroundGridScale, } from './assets/ground-grid';
6
7
  export type { GroundGridScale } from './assets/ground-grid';
7
8
  export { getUsdQuery } from './simulation/usd-query';
@@ -11,11 +12,29 @@ export { compileMujocoWasmModule } from './simulation/mujoco-wasm-module';
11
12
  export type { MujocoWasmCompileOptions } from './simulation/mujoco-wasm-module';
12
13
  export { preloadUsdViewer } from './simulation/usd-preload';
13
14
  export { prewarmUsdWorker } from './simulation/usd-prewarm';
15
+ export { probeUsdDependencies } from './simulation/usd-dependency-probe';
16
+ export type { UsdDependencyProbeRequest, UsdDependencyProbeResult, } from './simulation/usd-dependency-probe';
17
+ export { detectPlyContent, detectVisualContent } from './visual/classification';
18
+ export type { PlyContentKind, PlyHeader, VisualContentDetection, VisualContentKind, } from './visual/classification';
14
19
  export type { QueryableUsdModel, UsdAttributeValue, UsdBoundMaterial, UsdMetadataValue, UsdPrimInfo, UsdQuery, } from './simulation/usd-query';
15
- export type { AssetChangeEvent, AssetControlState, AssetControlChangeEvent, AssetBackgroundLoadingSnapshot, AssetDetectionResult, AssetErrorEvent, AssetErrorSnapshot, AssetFileEntry, AssetFormat, AssetLoaderContext, AssetLoaderContribution, AssetNoticeKind, AssetNoticeSnapshot, AssetPhysicsState, AssetPresentationProfile, AssetPreview, AssetPreviewCapabilities, AssetPreviewKind, AssetPreviewPhase, AssetPreviewSnapshot, AssetResourceResolver, AssetSession, AssetSingleSource, AssetSource, AssetUpAxis, NormalizedAssetSource, OpenAssetOptions, UsdExternalReferenceMode, ViewerAssetOptions, } from './assets/types';
20
+ export type { AssetChangeEvent, AssetControlState, AssetControlChangeEvent, AssetBackgroundLoadingSnapshot, AssetDetectionResult, AssetErrorEvent, AssetErrorSnapshot, AssetFileEntry, AssetFormat, AssetLoaderContext, AssetLoaderContribution, AssetNoticeKind, AssetNoticeSnapshot, AssetPhysicsState, AssetPresentationProfile, AssetPreview, AssetPreviewCapabilities, AssetPreviewKind, AssetPreviewPhase, AssetPreviewSnapshot, AssetResourceResolver, AssetSession, AssetSingleSource, AssetSource, AssetUpAxis, AssetWarningSnapshot, NormalizedAssetSource, OpenAssetOptions, UsdExternalReferenceMode, UsdVariantSelection, ViewerAssetOptions, } from './assets/types';
16
21
  export { USD_RESOURCE_AUTH, USD_RESOURCE_EXTERNAL_DENIED, USD_RESOURCE_FETCH, USD_RESOURCE_INVALID, USD_RESOURCE_NOT_FOUND, } from './simulation/usd-resource-policy';
17
22
  export type { Disposable, ToolbarItem, ViewerState, ViewerInteractionHooks, ViewerContributionPoint, ViewerPlugin, ViewerPluginContext, ViewerPluginRegistry, } from './plugins';
18
23
  export { configureViewerText } from './cad/text';
19
24
  export type { ViewerTextBuilderOptions } from './cad/text';
20
25
  export type { CadBlockModel, CadDocumentHandle, CadDocumentUnits, CadFontResolver, CadFontRequest, CadResolvedFont, CadResolvedTextFont, CadTextWarmupOptions, CadHudModel, CadHudSnapshot, CadInspectorModel, CadInspectorSnapshot, CadLayerModel, CadLayerRow, CadBlockUsageRow, CadSessionPhase, CadWorldBounds, CadScaleRulerState, CadInsertDetails, CadInsertSelection, CadInsertSelectionId, CadTextDetails, CadTextSelection, CadTextSelectionId, CadSelection, CadHit, CadViewerSnapshot, CadLoadProgress, CadViewerErrorCode, CadViewerErrorEvent, CadLoadSource, CadOpenOptions, CadSessionLoadTiming, RenderDebugBreakdownEntry, SplitBlockLayerDetail, CadViewerCapability, ResolveTextFont, CadViewerEventMap, CameraStateStore, Viewer, ViewerEventMap, ViewerEnvironment, ViewerEnvironmentState, ViewerEnvironmentTexture, ViewerFitViewOptions, ViewerHighlightOptions, ViewerOptions, ViewerPickOptions, ViewerPickResult, ViewerPointerEvent, ViewerObjectOptions, ViewerPreviewDragPreset, ViewerCameraSnapshot, ViewerOrthographicSnapshot, ViewerOrbitSnapshot, ViewerRenderStats, ViewerDocumentRect, ViewerCadUiKeyboardOptions, ViewerUiOptions, ViewerCadUiParts, ViewerCadUiOptions, ViewerUiPreset, ViewerCadUiStateStore, ViewerUiTheme, ViewerViewMode, CadInteractionMode, CameraChangeReason, ViewerUiTokens, } from './types';
21
26
  export type { JointInspection, JointInspectionJoint, JointInspectionSnapshot, AssetInspection, UrdfEntityKind, UrdfInspection, UrdfInspectionEntity, UrdfInspectionIssue, UrdfInspectionJoint, UrdfInspectionLink, UrdfInspectionMode, UrdfInspectionNode, UrdfInspectionOverlays, UrdfInspectionRobot, UrdfInspectionSnapshot, UrdfSourceRange } from './inspection/types';
27
+ /**
28
+ * Multi-asset scene authoring. A scene owns one stage and several placed
29
+ * assets; the joint surface (`SceneInstanceJoints`) is what a host saves a pose
30
+ * through. Persistence is never the Viewer's: read `capturePose()`, store it,
31
+ * and write it back with `applyInstancePose`.
32
+ */
33
+ export { createSceneSession, findInstanceId } from './scene/session';
34
+ export type { SceneSessionDeps } from './scene/session';
35
+ export { clampJointValue, createSceneInstanceJoints, isSceneScalarJoint, jointBlockReason, toSceneJointDescriptor, } from './scene/joints';
36
+ export type { JointInspectionSource, SceneInstanceJoints, SceneJointBlockReason, SceneJointDescriptor, SceneJointPose, SceneJointSnapshot, SceneJointState, } from './scene/joints';
37
+ export type { SceneControl, SceneDeterministicCheckOptions, SceneDeterministicCheckResult, SceneEntry, SceneInspectionOverlay, SceneInstanceBounds, SceneInstancePhysics, SceneInstanceRuntime, SceneInstanceSnapshot, SceneInstancePhase, SceneOptions, ScenePhysicsConfiguration, ScenePhysicsState, ScenePlacement, SceneSnapshot, Vec3Like, } from './scene/types';
38
+ export type { PhysicsBodyMotionType, PhysicsRuntimeBodyState, PhysicsRuntimeCaptureOptions, PhysicsRuntimeContactState, PhysicsRuntimeGrabState, PhysicsRuntimeJointState, PhysicsRuntimeSnapshot, } from './simulation/physics-runtime-state';
39
+ export type { UsdInspectionJoint, UsdInspectionMaterial, UsdInspectionMesh, UsdInspectionPrim, UsdInspectionSnapshot, UsdInspectionStage, UsdInspectionVariantSet, } from './simulation/usd-inspection';
40
+ export type { ViewerCaptureOptions, ViewerCaptureResult } from './types';
package/dist/index.js CHANGED
@@ -1,20 +1,31 @@
1
- import { D as r, v as s, A as o, w as U, U as E, u as _, y as d, B as D, C as R, E as S, F as i, k as u, G as c, H as C, I as O } from "./index-E8DHSeyT.js";
2
- import { configureCadTextBuilder as m } from "@nebula-spatial/cad-loader";
1
+ import { D as s, I as o, V as r, J as n, U as t, H as i, W as c, X as U, Y as d, Z as S, _ as E, $ as _, a0 as D, a1 as l, a2 as R, L as m, a3 as p, a4 as u, m as C, a5 as O, a6 as I, a7 as V, a8 as G, a9 as T, aa as f, ab as N } from "./index-DoxM1Msk.js";
2
+ import { configureCadTextBuilder as x } from "@nebula-spatial/cad-loader";
3
3
  export {
4
- r as DEFAULT_GROUND_GRID_SCALE,
5
- s as USD_RESOURCE_AUTH,
6
- o as USD_RESOURCE_EXTERNAL_DENIED,
7
- U as USD_RESOURCE_FETCH,
8
- E as USD_RESOURCE_INVALID,
9
- _ as USD_RESOURCE_NOT_FOUND,
10
- d as chooseGroundGridScale,
11
- D as compileMujocoWasmModule,
12
- R as compileOpenUsdWasmModule,
13
- m as configureViewerText,
14
- S as createViewer,
15
- i as formatGroundGridScale,
16
- u as getUsdQuery,
17
- c as preloadUsdViewer,
18
- C as prewarmUsdWorker,
19
- O as viewerVersion
4
+ s as DEFAULT_GROUND_GRID_SCALE,
5
+ o as USD_RESOURCE_AUTH,
6
+ r as USD_RESOURCE_EXTERNAL_DENIED,
7
+ n as USD_RESOURCE_FETCH,
8
+ t as USD_RESOURCE_INVALID,
9
+ i as USD_RESOURCE_NOT_FOUND,
10
+ c as axisGizmo,
11
+ U as chooseGroundGridScale,
12
+ d as clampJointValue,
13
+ S as compileMujocoWasmModule,
14
+ E as compileOpenUsdWasmModule,
15
+ x as configureViewerText,
16
+ _ as createSceneInstanceJoints,
17
+ D as createSceneSession,
18
+ l as createViewer,
19
+ R as detectPlyContent,
20
+ m as detectVisualContent,
21
+ p as findInstanceId,
22
+ u as formatGroundGridScale,
23
+ C as getUsdQuery,
24
+ O as isSceneScalarJoint,
25
+ I as jointBlockReason,
26
+ V as preloadUsdViewer,
27
+ G as prewarmUsdWorker,
28
+ T as probeUsdDependencies,
29
+ f as toSceneJointDescriptor,
30
+ N as viewerVersion
20
31
  };
@@ -1,7 +1,6 @@
1
- import { c as v, s as E } from "./session-DB-osaBL.js";
2
- import { Group as q, Euler as z, BoxGeometry as G, SphereGeometry as N, CylinderGeometry as P, CapsuleGeometry as $, PlaneGeometry as I, Mesh as X } from "three";
3
- import { disposeModelResources as j } from "./resources-CHhCm2f7.js";
4
- function U(f) {
1
+ import { O as v, T as E, d as z } from "./index-DoxM1Msk.js";
2
+ import { Group as q, Euler as G, BoxGeometry as N, SphereGeometry as P, CylinderGeometry as $, CapsuleGeometry as I, PlaneGeometry as X, Mesh as j } from "three";
3
+ function D(f) {
5
4
  const y = f.extension.documents, l = new q();
6
5
  l.name = f.name;
7
6
  try {
@@ -29,7 +28,7 @@ function U(f) {
29
28
  s.quaternion.set(t[1], t[2], t[3], t[0]).normalize();
30
29
  } else {
31
30
  const t = h(e.getAttribute("euler"), [0, 0, 0], 3);
32
- s.quaternion.setFromEuler(new z(t[0] * g, t[1] * g, t[2] * g, "XYZ"));
31
+ s.quaternion.setFromEuler(new G(t[0] * g, t[1] * g, t[2] * g, "XYZ"));
33
32
  }
34
33
  if (m.add(s), e.tagName === "body") {
35
34
  M(e, s);
@@ -41,13 +40,13 @@ function U(f) {
41
40
  if (F && (r.length < F || r.some((t) => n === "plane" ? t < 0 : t <= 0)))
42
41
  throw new Error(`MJCF geom ${n} 的尺寸缺失或无效`);
43
42
  let i;
44
- if (n === "box") i = new G(2 * r[0], 2 * r[1], 2 * r[2]);
45
- else if (n === "sphere") i = new N(r[0]);
43
+ if (n === "box") i = new N(2 * r[0], 2 * r[1], 2 * r[2]);
44
+ else if (n === "sphere") i = new P(r[0]);
46
45
  else if (n === "cylinder")
47
- i = new P(r[0], r[0], 2 * r[1]), i.rotateX(Math.PI / 2);
46
+ i = new $(r[0], r[0], 2 * r[1]), i.rotateX(Math.PI / 2);
48
47
  else if (n === "capsule")
49
- i = new $(r[0], 2 * r[1]), i.rotateX(Math.PI / 2);
50
- else if (n === "plane") i = new I(2 * (r[0] || 5), 2 * (r[1] || 5));
48
+ i = new I(r[0], 2 * r[1]), i.rotateX(Math.PI / 2);
49
+ else if (n === "plane") i = new X(2 * (r[0] || 5), 2 * (r[1] || 5));
51
50
  else throw new Error(`MJCF 独立预览暂不支持 geom ${n}`);
52
51
  const p = e.getAttribute("material"), o = [...u.querySelectorAll("asset > material")].find((t) => t.getAttribute("name") === p);
53
52
  if (p && !o) throw new Error(`Undefined MJCF material: ${p}`);
@@ -58,16 +57,16 @@ function U(f) {
58
57
  metalness: Math.max(0, w("metallic", 0)),
59
58
  specular: w("specular", 0.5),
60
59
  emission: w("emission", 0)
61
- }), C = new X(i, S);
60
+ }), C = new j(i, S);
62
61
  n === "plane" && m === l && (C.userData.excludeFromSimulationFit = !0), s.add(C);
63
62
  }
64
63
  }, A = u.querySelector("worldbody");
65
64
  if (!A) throw new Error("MJCF 缺少 worldbody");
66
65
  return M(A, l), l.updateMatrixWorld(!0), l;
67
66
  } catch (u) {
68
- throw j(l), u;
67
+ throw z(l), u;
69
68
  }
70
69
  }
71
70
  export {
72
- U as compileMjcfPreview
71
+ D as compileMjcfPreview
73
72
  };