@babylonjs/inspector 9.1.0 → 9.2.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 (31) hide show
  1. package/bin/inspector-bridge.mjs +4734 -0
  2. package/bin/inspector-cli.mjs +4931 -0
  3. package/lib/cli/protocol.d.ts +180 -0
  4. package/lib/components/properties/materials/openpbrMaterialProperties.d.ts +3 -0
  5. package/lib/{extensionsListService-BmiNjZiw.js → extensionsListService-eRZtqcfj.js} +3 -3
  6. package/lib/{extensionsListService-BmiNjZiw.js.map → extensionsListService-eRZtqcfj.js.map} +1 -1
  7. package/lib/{index-BCbXjPTn.js → index-FWuITINA.js} +1134 -266
  8. package/lib/index-FWuITINA.js.map +1 -0
  9. package/lib/index.d.ts +3 -0
  10. package/lib/index.js +2 -2
  11. package/lib/inspectable.d.ts +67 -0
  12. package/lib/misc/defaultPerfStrategies.d.ts +16 -0
  13. package/lib/modularTool.d.ts +6 -1
  14. package/lib/modularity/serviceContainer.d.ts +24 -1
  15. package/lib/{quickCreateToolsService-BoqrJqoM.js → quickCreateToolsService-MzZbVrvr.js} +3 -3
  16. package/lib/{quickCreateToolsService-BoqrJqoM.js.map → quickCreateToolsService-MzZbVrvr.js.map} +1 -1
  17. package/lib/{reflectorService-CFTva2GG.js → reflectorService-DdPEZLjO.js} +3 -3
  18. package/lib/{reflectorService-CFTva2GG.js.map → reflectorService-DdPEZLjO.js.map} +1 -1
  19. package/lib/services/cli/cliConnectionStatus.d.ts +19 -0
  20. package/lib/services/cli/entityQueryService.d.ts +8 -0
  21. package/lib/services/cli/inspectableBridgeService.d.ts +22 -0
  22. package/lib/services/cli/inspectableCommandRegistry.d.ts +58 -0
  23. package/lib/services/cli/perfTraceCommandService.d.ts +9 -0
  24. package/lib/services/cli/screenshotCommandService.d.ts +8 -0
  25. package/lib/services/cli/shaderCommandService.d.ts +7 -0
  26. package/lib/services/cli/statsCommandService.d.ts +9 -0
  27. package/lib/services/cliConnectionStatusService.d.ts +4 -0
  28. package/lib/services/defaultToolbarMetadata.d.ts +2 -1
  29. package/package.json +11 -4
  30. package/readme.md +27 -0
  31. package/lib/index-BCbXjPTn.js.map +0 -1
package/lib/index.d.ts CHANGED
@@ -46,6 +46,9 @@ export * from "./services/selectionService";
46
46
  export type { IShellService, ToolbarItemDefinition, SidePaneDefinition, CentralContentDefinition } from "./services/shellService";
47
47
  export { ShellServiceIdentity } from "./services/shellService";
48
48
  export * from "./inspector";
49
+ export { StartInspectable, type InspectableToken, type InspectableOptions } from "./inspectable";
50
+ export type { IInspectableCommandRegistry, InspectableCommandDescriptor, InspectableCommandArg } from "./services/cli/inspectableCommandRegistry";
51
+ export { InspectableCommandRegistryIdentity } from "./services/cli/inspectableCommandRegistry";
49
52
  export { ConvertOptions, Inspector } from "./legacy/inspector";
50
53
  export { AttachDebugLayer, DetachDebugLayer } from "./legacy/debugLayer";
51
54
  export * from "@babylonjs/shared-ui-components/fluent/hooks/keyboardHooks.js";
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Accordion, i as AccordionSection, l as AccordionSectionItem, m as AttachDebugLayer, n as BooleanBadgePropertyLine, o as BoundProperty, p as BuiltInsExtensionFeed, B as Button, j as ButtonLine, q as Checkbox, C as CheckboxPropertyLine, r as ChildWindow, s as Collapse, t as Color3GradientComponent, v as Color3GradientList, w as Color3PropertyLine, x as Color4GradientComponent, y as Color4GradientList, z as Color4PropertyLine, D as ColorPickerPopup, E as ColorStepGradientComponent, F as ComboBox, G as ComboBoxPropertyLine, H as ConstructorFactory, I as ConvertOptions, J as DebugServiceIdentity, K as DetachDebugLayer, O as DraggableLine, Q as Dropdown, R as EntitySelector, U as ErrorBoundary, W as ExtensibleAccordion, X as FactorGradientComponent, Y as FactorGradientList, Z as FileUploadLine, _ as GetPropertyDescriptor, $ as GizmoServiceIdentity, a0 as HexPropertyLine, a1 as InfoLabel, a2 as InputHexField, a3 as InputHsvField, a4 as Inspector, a5 as InterceptFunction, a6 as InterceptProperty, a7 as IsPropertyReadonly, a8 as LineContainer, L as Link, a9 as LinkPropertyLine, c as LinkToEntity, aa as LinkToEntityPropertyLine, ab as List, ac as MakeDialogTeachingMoment, ad as MakeLazyComponent, ae as MakePopoverTeachingMoment, af as MakePropertyHook, ag as MakeTeachingMoment, ah as MaterialSelector, M as MessageBar, ai as NodeSelector, aj as NumberDropdown, ak as NumberDropdownPropertyLine, N as NumberInputPropertyLine, al as ObservableCollection, am as Pane, an as PlaceholderPropertyLine, P as Popover, ao as PositionedPopover, ap as PropertiesServiceIdentity, aq as Property, ar as PropertyContext, as as PropertyLine, at as QuaternionPropertyLine, au as RotationVectorPropertyLine, f as SceneContextIdentity, av as SceneExplorerServiceIdentity, aw as SearchBar, ax as SearchBox, ay as SelectionServiceDefinition, g as SelectionServiceIdentity, az as SettingsServiceIdentity, aA as SettingsStoreIdentity, S as ShellServiceIdentity, aB as ShowInspector, aC as SidePaneContainer, aD as SkeletonSelector, aE as Slider, aF as SpinButton, d as SpinButtonPropertyLine, aG as StatsServiceIdentity, aH as StringDropdown, aI as StringDropdownPropertyLine, aJ as StringifiedPropertyLine, aK as Switch, aL as SwitchPropertyLine, aM as SyncedSliderInput, aN as SyncedSliderPropertyLine, aO as TeachingMoment, aP as TextAreaPropertyLine, aQ as TextInput, T as TextInputPropertyLine, aR as TextPropertyLine, aS as Textarea, aT as TextureSelector, aU as TextureUpload, aV as Theme, aW as ThemeServiceIdentity, aX as ToastProvider, aY as ToggleButton, k as ToolsServiceIdentity, aZ as Tooltip, a_ as UploadButton, a$ as Vector2PropertyLine, V as Vector3PropertyLine, b0 as Vector4PropertyLine, b1 as WatcherServiceIdentity, b2 as useAngleConverters, b3 as useAsyncResource, b4 as useColor3Property, b5 as useColor4Property, b6 as useEventListener, b7 as useEventfulState, b as useInterceptObservable, b8 as useKeyListener, b9 as useKeyState, ba as useObservableCollection, h as useObservableState, bb as useOrderedObservableCollection, bc as usePollingObservable, e as useProperty, bd as usePropertyChangedNotifier, be as useQuaternionProperty, bf as useResource, bg as useSetting, bh as useTheme, bi as useThemeMode, a as useToast, bj as useVector3Property } from './index-BCbXjPTn.js';
1
+ export { A as Accordion, i as AccordionSection, l as AccordionSectionItem, m as AttachDebugLayer, n as BooleanBadgePropertyLine, o as BoundProperty, p as BuiltInsExtensionFeed, B as Button, j as ButtonLine, q as Checkbox, C as CheckboxPropertyLine, r as ChildWindow, s as Collapse, t as Color3GradientComponent, v as Color3GradientList, w as Color3PropertyLine, x as Color4GradientComponent, y as Color4GradientList, z as Color4PropertyLine, D as ColorPickerPopup, E as ColorStepGradientComponent, F as ComboBox, G as ComboBoxPropertyLine, H as ConstructorFactory, I as ConvertOptions, J as DebugServiceIdentity, K as DetachDebugLayer, O as DraggableLine, Q as Dropdown, R as EntitySelector, U as ErrorBoundary, W as ExtensibleAccordion, X as FactorGradientComponent, Y as FactorGradientList, Z as FileUploadLine, _ as GetPropertyDescriptor, $ as GizmoServiceIdentity, a0 as HexPropertyLine, a1 as InfoLabel, a2 as InputHexField, a3 as InputHsvField, a4 as InspectableCommandRegistryIdentity, a5 as Inspector, a6 as InterceptFunction, a7 as InterceptProperty, a8 as IsPropertyReadonly, a9 as LineContainer, L as Link, aa as LinkPropertyLine, c as LinkToEntity, ab as LinkToEntityPropertyLine, ac as List, ad as MakeDialogTeachingMoment, ae as MakeLazyComponent, af as MakePopoverTeachingMoment, ag as MakePropertyHook, ah as MakeTeachingMoment, ai as MaterialSelector, M as MessageBar, aj as NodeSelector, ak as NumberDropdown, al as NumberDropdownPropertyLine, N as NumberInputPropertyLine, am as ObservableCollection, an as Pane, ao as PlaceholderPropertyLine, P as Popover, ap as PositionedPopover, aq as PropertiesServiceIdentity, ar as Property, as as PropertyContext, at as PropertyLine, au as QuaternionPropertyLine, av as RotationVectorPropertyLine, f as SceneContextIdentity, aw as SceneExplorerServiceIdentity, ax as SearchBar, ay as SearchBox, az as SelectionServiceDefinition, g as SelectionServiceIdentity, aA as SettingsServiceIdentity, aB as SettingsStoreIdentity, S as ShellServiceIdentity, aC as ShowInspector, aD as SidePaneContainer, aE as SkeletonSelector, aF as Slider, aG as SpinButton, d as SpinButtonPropertyLine, aH as StartInspectable, aI as StatsServiceIdentity, aJ as StringDropdown, aK as StringDropdownPropertyLine, aL as StringifiedPropertyLine, aM as Switch, aN as SwitchPropertyLine, aO as SyncedSliderInput, aP as SyncedSliderPropertyLine, aQ as TeachingMoment, aR as TextAreaPropertyLine, aS as TextInput, T as TextInputPropertyLine, aT as TextPropertyLine, aU as Textarea, aV as TextureSelector, aW as TextureUpload, aX as Theme, aY as ThemeServiceIdentity, aZ as ToastProvider, a_ as ToggleButton, k as ToolsServiceIdentity, a$ as Tooltip, b0 as UploadButton, b1 as Vector2PropertyLine, V as Vector3PropertyLine, b2 as Vector4PropertyLine, b3 as WatcherServiceIdentity, b4 as useAngleConverters, b5 as useAsyncResource, b6 as useColor3Property, b7 as useColor4Property, b8 as useEventListener, b9 as useEventfulState, b as useInterceptObservable, ba as useKeyListener, bb as useKeyState, bc as useObservableCollection, h as useObservableState, bd as useOrderedObservableCollection, be as usePollingObservable, e as useProperty, bf as usePropertyChangedNotifier, bg as useQuaternionProperty, bh as useResource, bi as useSetting, bj as useTheme, bk as useThemeMode, a as useToast, bl as useVector3Property } from './index-FWuITINA.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@fluentui/react-components';
@@ -46,6 +46,7 @@ import '@babylonjs/core/Lights/light.js';
46
46
  import '@babylonjs/core/Meshes/abstractMesh.js';
47
47
  import '@babylonjs/core/node.js';
48
48
  import 'react-dom/client';
49
+ import '@babylonjs/core/Misc/screenshotTools.js';
49
50
  import '@babylonjs/core/Layers/selectionOutlineLayer.js';
50
51
  import '@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js';
51
52
  import '@babylonjs/core/Animations/animationGroup.js';
@@ -139,7 +140,6 @@ import '@babylonjs/core/Sprites/spriteSceneComponent.js';
139
140
  import '@babylonjs/core/Materials/Textures/dynamicTexture.js';
140
141
  import '@babylonjs/core/Misc/equirectangularCapture.js';
141
142
  import '@babylonjs/core/Misc/sceneRecorder.js';
142
- import '@babylonjs/core/Misc/screenshotTools.js';
143
143
  import '@babylonjs/core/Misc/videoRecorder.js';
144
144
  import '@babylonjs/core/Misc/sceneSerializer.js';
145
145
  import '@babylonjs/core/Misc/environmentTextureTools.js';
@@ -0,0 +1,67 @@
1
+ import { type IDisposable } from "@babylonjs/core/index.js";
2
+ import { type Scene } from "@babylonjs/core/scene.js";
3
+ import { type WeaklyTypedServiceDefinition, ServiceContainer } from "./modularity/serviceContainer";
4
+ /**
5
+ * Options for making a scene inspectable via the Inspector CLI.
6
+ */
7
+ export type InspectableOptions = {
8
+ /**
9
+ * WebSocket port for the bridge's browser port. Defaults to 4400.
10
+ */
11
+ port?: number;
12
+ /**
13
+ * Session display name reported to the bridge. Defaults to `document.title`.
14
+ */
15
+ name?: string;
16
+ /**
17
+ * Additional service definitions to register with the inspectable container.
18
+ * These are added in a separate call from the built-in services and are removed
19
+ * when the returned token is disposed.
20
+ */
21
+ serviceDefinitions?: readonly WeaklyTypedServiceDefinition[];
22
+ };
23
+ /**
24
+ * A token returned by {@link StartInspectable} that can be disposed to disconnect
25
+ * the scene from the Inspector CLI bridge.
26
+ */
27
+ export type InspectableToken = IDisposable & {
28
+ /**
29
+ * Whether this token has been disposed.
30
+ */
31
+ readonly isDisposed: boolean;
32
+ };
33
+ /**
34
+ * @internal
35
+ * An internal token that also exposes the underlying ServiceContainer,
36
+ * allowing ShowInspector to use it as a parent container.
37
+ */
38
+ export type InternalInspectableToken = InspectableToken & {
39
+ /**
40
+ * The ServiceContainer backing this inspectable session.
41
+ */
42
+ readonly serviceContainer: ServiceContainer;
43
+ };
44
+ /**
45
+ * @internal
46
+ * Internal implementation that returns an {@link InternalInspectableToken} with access
47
+ * to the underlying ServiceContainer. Used by ShowInspector to set up a parent container relationship.
48
+ */
49
+ export declare function _StartInspectable(scene: Scene, options?: Partial<InspectableOptions>): InternalInspectableToken;
50
+ /**
51
+ * Makes a scene inspectable by connecting it to the Inspector CLI bridge.
52
+ * This creates a headless {@link ServiceContainer} (no UI) and registers the
53
+ * {@link InspectableBridgeService} which opens a WebSocket to the bridge and
54
+ * exposes a command registry for CLI-invocable commands.
55
+ *
56
+ * Multiple callers may call this for the same scene. Each returned token is
57
+ * ref-counted — the underlying connection is only torn down when all tokens
58
+ * have been disposed. Additional {@link InspectableOptions.serviceDefinitions}
59
+ * passed by each caller are added to the shared container and removed when
60
+ * that caller's token is disposed.
61
+ *
62
+ * @param scene The scene to make inspectable.
63
+ * @param options Optional configuration.
64
+ * @returns An {@link InspectableToken} that can be disposed to disconnect.
65
+ * @experimental
66
+ */
67
+ export declare function StartInspectable(scene: Scene, options?: Partial<InspectableOptions>): InspectableToken;
@@ -0,0 +1,16 @@
1
+ import { type PerformanceViewerCollector } from "@babylonjs/core/Misc/PerformanceViewer/performanceViewerCollector.js";
2
+ /**
3
+ * The strategy parameter type accepted by {@link PerformanceViewerCollector.addCollectionStrategies}.
4
+ */
5
+ export type PerfStrategyParameter = Parameters<PerformanceViewerCollector["addCollectionStrategies"]>[number];
6
+ /**
7
+ * Performance metadata categories for grouping strategies.
8
+ */
9
+ export declare const enum PerfMetadataCategory {
10
+ Count = "Count",
11
+ FrameSteps = "Frame Steps Duration"
12
+ }
13
+ /**
14
+ * Default list of performance collection strategies used by the performance viewer and CLI perf trace.
15
+ */
16
+ export declare const DefaultPerfStrategies: readonly PerfStrategyParameter[];
@@ -1,6 +1,6 @@
1
1
  import { type IDisposable } from "@babylonjs/core/index.js";
2
2
  import { type IExtensionFeed } from "./extensibility/extensionFeed";
3
- import { type WeaklyTypedServiceDefinition } from "./modularity/serviceContainer";
3
+ import { type WeaklyTypedServiceDefinition, ServiceContainer } from "./modularity/serviceContainer";
4
4
  import { type ShellServiceOptions } from "./services/shellService";
5
5
  import { type ThemeMode } from "./services/themeService";
6
6
  export type ModularToolOptions = {
@@ -28,6 +28,11 @@ export type ModularToolOptions = {
28
28
  * The extension feeds that provide optional extensions the user can install.
29
29
  */
30
30
  extensionFeeds?: readonly IExtensionFeed[];
31
+ /**
32
+ * An optional parent ServiceContainer. Dependencies not found in the tool's own container
33
+ * will be resolved from this parent.
34
+ */
35
+ parentContainer?: ServiceContainer;
31
36
  } & ShellServiceOptions;
32
37
  /**
33
38
  * Creates a modular tool with a base set of common tool services, including the toolbar/side pane basic UI layout.
@@ -13,11 +13,18 @@ export type WeaklyTypedServiceDefinition = Omit<ServiceDefinition<IService<symbo
13
13
  */
14
14
  export declare class ServiceContainer implements IDisposable {
15
15
  private readonly _friendlyName;
16
+ private readonly _parent?;
16
17
  private _isDisposed;
17
18
  private readonly _serviceDefinitions;
18
19
  private readonly _serviceDependents;
19
20
  private readonly _serviceInstances;
20
- constructor(_friendlyName: string);
21
+ private readonly _children;
22
+ /**
23
+ * Creates a new ServiceContainer.
24
+ * @param _friendlyName A human-readable name for debugging.
25
+ * @param _parent An optional parent container. Dependencies not found locally will be resolved from the parent.
26
+ */
27
+ constructor(_friendlyName: string, _parent?: ServiceContainer | undefined);
21
28
  /**
22
29
  * Adds a set of service definitions in the service container.
23
30
  * The services are sorted based on their dependencies.
@@ -33,9 +40,25 @@ export declare class ServiceContainer implements IDisposable {
33
40
  */
34
41
  addServiceAsync<Produces extends IService<symbol>[] = [], Consumes extends IService<symbol>[] = []>(serviceDefinition: ServiceDefinition<Produces, Consumes>, abortSignal?: AbortSignal): Promise<IDisposable>;
35
42
  private _addServiceAsync;
43
+ /**
44
+ * Resolves a dependency by contract identity for a consuming service.
45
+ * Checks local services first, then walks up the parent chain.
46
+ * Registers the consumer as a dependent in whichever container owns the dependency.
47
+ * @param contract The contract identity to resolve.
48
+ * @param consumer The service definition that consumes this dependency.
49
+ * @returns The resolved service instance.
50
+ */
51
+ private _resolveDependency;
52
+ /**
53
+ * Removes a consumer from the dependent set for a given contract, checking locally first then the parent chain.
54
+ * @param contract The contract identity.
55
+ * @param consumer The service definition to remove as a dependent.
56
+ */
57
+ private _removeDependentFromChain;
36
58
  private _removeService;
37
59
  /**
38
60
  * Disposes the service container and all contained services.
61
+ * Throws if this container is still a parent of any live child containers.
39
62
  */
40
63
  dispose(): void;
41
64
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { P as Popover, a as useToast, b as useInterceptObservable, B as Button, c as LinkToEntity, T as TextInputPropertyLine, d as SpinButtonPropertyLine, C as CheckboxPropertyLine, V as Vector3PropertyLine, e as useProperty, M as MessageBar, S as ShellServiceIdentity, f as SceneContextIdentity, g as SelectionServiceIdentity, h as useObservableState, A as Accordion, i as AccordionSection } from './index-BCbXjPTn.js';
2
+ import { P as Popover, a as useToast, b as useInterceptObservable, B as Button, c as LinkToEntity, T as TextInputPropertyLine, d as SpinButtonPropertyLine, C as CheckboxPropertyLine, V as Vector3PropertyLine, e as useProperty, M as MessageBar, S as ShellServiceIdentity, f as SceneContextIdentity, g as SelectionServiceIdentity, h as useObservableState, A as Accordion, i as AccordionSection } from './index-FWuITINA.js';
3
3
  import { SettingsRegular, CollectionsAdd20Regular } from '@fluentui/react-icons';
4
4
  import '@babylonjs/core/Particles/webgl2ParticleSystem.js';
5
5
  import '@babylonjs/core/Rendering/prePassRendererSceneComponent.js';
@@ -74,6 +74,7 @@ import '@babylonjs/core/Lights/light.js';
74
74
  import '@babylonjs/core/Meshes/abstractMesh.js';
75
75
  import '@babylonjs/core/node.js';
76
76
  import 'react-dom/client';
77
+ import '@babylonjs/core/Misc/screenshotTools.js';
77
78
  import '@babylonjs/core/Layers/selectionOutlineLayer.js';
78
79
  import '@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js';
79
80
  import '@babylonjs/core/Animations/animationGroup.js';
@@ -149,7 +150,6 @@ import '@babylonjs/core/Sprites/spriteSceneComponent.js';
149
150
  import '@babylonjs/core/Materials/Textures/dynamicTexture.js';
150
151
  import '@babylonjs/core/Misc/equirectangularCapture.js';
151
152
  import '@babylonjs/core/Misc/sceneRecorder.js';
152
- import '@babylonjs/core/Misc/screenshotTools.js';
153
153
  import '@babylonjs/core/Misc/videoRecorder.js';
154
154
  import '@babylonjs/core/Misc/sceneSerializer.js';
155
155
  import '@babylonjs/core/Misc/environmentTextureTools.js';
@@ -772,4 +772,4 @@ var quickCreateToolsService = {
772
772
  };
773
773
 
774
774
  export { CreateToolsServiceDefinition, quickCreateToolsService as default };
775
- //# sourceMappingURL=quickCreateToolsService-BoqrJqoM.js.map
775
+ //# sourceMappingURL=quickCreateToolsService-MzZbVrvr.js.map