@babylonjs/inspector 9.25.0 → 9.26.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 (56) hide show
  1. package/bin/inspector-bridge.mjs +3 -1
  2. package/bin/inspector-cli.mjs +3 -1
  3. package/lib/components/explorer/explorer.d.ts +40 -0
  4. package/lib/components/{scene/sceneExplorerDragDrop.d.ts → explorer/explorerDragDrop.d.ts} +8 -8
  5. package/lib/components/explorer/explorerModel.d.ts +359 -0
  6. package/lib/components/properties/boundProperty.d.ts +15 -0
  7. package/lib/components/scene/sceneExplorer.d.ts +10 -124
  8. package/lib/contexts/watcherContext.d.ts +11 -0
  9. package/lib/{extensionsListService-CKrN2x5A.js → extensionsListService-DVpZa3gV.js} +14 -14
  10. package/lib/{extensionsListService-CKrN2x5A.js.map → extensionsListService-DVpZa3gV.js.map} +1 -1
  11. package/lib/hooks/pollingHooks.d.ts +3 -0
  12. package/lib/{index-CgagLRQT.js → index-C5ggNiyY.js} +24160 -23545
  13. package/lib/index-C5ggNiyY.js.map +1 -0
  14. package/lib/index.common.d.ts +88 -0
  15. package/lib/index.d.ts +2 -87
  16. package/lib/index.js +15 -15
  17. package/lib/inspector.common.d.ts +38 -0
  18. package/lib/inspector.d.ts +3 -39
  19. package/lib/inspectorHost.d.ts +26 -0
  20. package/lib/lite/engineContext.d.ts +20 -0
  21. package/lib/lite/engineExplorerService.d.ts +75 -0
  22. package/lib/lite/engineSelectionService.d.ts +11 -0
  23. package/lib/lite/explorerDisplayInfo.d.ts +12 -0
  24. package/lib/lite/extensionsListService-xgITNk9y.js +216 -0
  25. package/lib/lite/extensionsListService-xgITNk9y.js.map +1 -0
  26. package/lib/lite/index-DmQN3QdU.js +8518 -0
  27. package/lib/lite/index-DmQN3QdU.js.map +1 -0
  28. package/lib/lite/index.d.ts +6 -0
  29. package/lib/lite/index.js +21 -0
  30. package/lib/lite/index.js.map +1 -0
  31. package/lib/lite/inspector.d.ts +9 -0
  32. package/lib/lite/services/panes/properties/enginePropertiesService.d.ts +4 -0
  33. package/lib/lite/services/panes/properties/materialPropertiesService.d.ts +3 -0
  34. package/lib/lite/services/panes/properties/meshPropertiesService.d.ts +3 -0
  35. package/lib/lite/services/panes/properties/renderingContextPropertiesService.d.ts +4 -0
  36. package/lib/lite/services/panes/properties/textLayerPropertiesService.d.ts +4 -0
  37. package/lib/lite/services/panes/properties/texturePropertiesService.d.ts +3 -0
  38. package/lib/lite/services/panes/scene/materialExplorerService.d.ts +4 -0
  39. package/lib/lite/services/panes/scene/meshExplorerService.d.ts +4 -0
  40. package/lib/lite/services/panes/scene/sceneExplorerSection.d.ts +21 -0
  41. package/lib/lite/services/panes/scene/sceneResources.d.ts +13 -0
  42. package/lib/lite/services/panes/scene/textLayerExplorerService.d.ts +3 -0
  43. package/lib/lite/services/panes/scene/textureExplorerService.d.ts +3 -0
  44. package/lib/{quickCreateToolsService-C-GqDTqc.js → quickCreateToolsService-0rVa_CjZ.js} +14 -14
  45. package/lib/{quickCreateToolsService-C-GqDTqc.js.map → quickCreateToolsService-0rVa_CjZ.js.map} +1 -1
  46. package/lib/{reflectorService-CPunL_Qs.js → reflectorService-pyDncbYA.js} +16 -16
  47. package/lib/{reflectorService-CPunL_Qs.js.map → reflectorService-pyDncbYA.js.map} +1 -1
  48. package/lib/services/panes/explorer/explorerPane.d.ts +79 -0
  49. package/lib/services/panes/explorer/explorerService.d.ts +80 -0
  50. package/lib/services/panes/scene/sceneExplorerService.d.ts +7 -2
  51. package/lib/services/sceneSelectionService.d.ts +11 -0
  52. package/lib/services/selectionService.d.ts +5 -2
  53. package/lib/services/watcherService.d.ts +46 -3
  54. package/package.json +12 -1
  55. package/readme.md +10 -0
  56. package/lib/index-CgagLRQT.js.map +0 -1
@@ -687,7 +687,9 @@ let PerMessageDeflate$4 = class PerMessageDeflate {
687
687
  (typeof opts.serverMaxWindowBits === 'number' &&
688
688
  opts.serverMaxWindowBits > params.server_max_window_bits))) ||
689
689
  (typeof opts.clientMaxWindowBits === 'number' &&
690
- !params.client_max_window_bits)
690
+ (typeof params.client_max_window_bits === 'number'
691
+ ? opts.clientMaxWindowBits > params.client_max_window_bits
692
+ : !params.client_max_window_bits))
691
693
  ) {
692
694
  return false;
693
695
  }
@@ -690,7 +690,9 @@ let PerMessageDeflate$3 = class PerMessageDeflate {
690
690
  (typeof opts.serverMaxWindowBits === 'number' &&
691
691
  opts.serverMaxWindowBits > params.server_max_window_bits))) ||
692
692
  (typeof opts.clientMaxWindowBits === 'number' &&
693
- !params.client_max_window_bits)
693
+ (typeof params.client_max_window_bits === 'number'
694
+ ? opts.clientMaxWindowBits > params.client_max_window_bits
695
+ : !params.client_max_window_bits))
694
696
  ) {
695
697
  return false;
696
698
  }
@@ -0,0 +1,40 @@
1
+ import { type FunctionComponent } from "react";
2
+ import { type Nullable } from "@babylonjs/core/index.js";
3
+ import { type ExplorerCommandProvider, type ExplorerNodeDescription } from "./explorerModel";
4
+ /**
5
+ * A generic, recursive tree explorer.
6
+ *
7
+ * The Explorer is intentionally product agnostic: it renders whatever hierarchy is described by the
8
+ * {@link ExplorerNodeDescription}s returned from `getNodes`, which means nodes of different kinds backed by
9
+ * completely unrelated entity types can be arbitrarily nested within each other.
10
+ * @param props The props describing the hierarchy to render, the available commands, and the selection state.
11
+ * @returns The explorer tree component.
12
+ */
13
+ export declare const Explorer: FunctionComponent<{
14
+ /**
15
+ * Enumerates the top level nodes of the tree. This is re-invoked whenever the tree needs to be rebuilt
16
+ * (e.g. when one of the change observables of the described nodes fires), so it should always reflect
17
+ * the current state of the hierarchy. It must be referentially stable (e.g. wrapped in `useCallback`).
18
+ */
19
+ getNodes: () => readonly ExplorerNodeDescription[];
20
+ /**
21
+ * Command providers for nodes that represent an entity.
22
+ */
23
+ itemCommandProviders: readonly ExplorerCommandProvider<object>[];
24
+ /**
25
+ * Command providers for group nodes. The provider context is the group's display name.
26
+ */
27
+ groupCommandProviders: readonly ExplorerCommandProvider<string, "contextMenu">[];
28
+ /**
29
+ * The currently selected entity.
30
+ */
31
+ selectedEntity?: Nullable<object>;
32
+ /**
33
+ * Called when the selected entity changes.
34
+ */
35
+ setSelectedEntity?: (entity: Nullable<object>) => void;
36
+ /**
37
+ * The accessible label of the tree.
38
+ */
39
+ ariaLabel?: string;
40
+ }>;
@@ -1,7 +1,7 @@
1
1
  import { type DragEvent } from "react";
2
- import { type SceneExplorerDragDropConfig } from "./sceneExplorer";
2
+ import { type ExplorerDragDropConfig } from "./explorerModel";
3
3
  /**
4
- * Props for drop-only event handlers on a section header.
4
+ * Props for drop-only event handlers on a group node.
5
5
  */
6
6
  export type DropProps = {
7
7
  onDragOver: (e: DragEvent) => void;
@@ -19,20 +19,20 @@ export type DragDropProps = {
19
19
  /**
20
20
  * Options for the drag-drop hook.
21
21
  */
22
- export type SceneExplorerDragDropOptions = {
23
- /** Called after a successful drop with the dragged entity and target (entity or null for section root). */
22
+ export type ExplorerDragDropOptions = {
23
+ /** Called after a successful drop with the dragged entity and target (entity or null for the branch root). */
24
24
  onDrop?: (draggedEntity: object, targetEntity: object | null) => void;
25
25
  };
26
26
  /**
27
- * Hook that provides drag-drop functionality for the scene explorer.
27
+ * Hook that provides drag-drop functionality for the explorer.
28
28
  * Uses vanilla HTML5 drag and drop APIs.
29
29
  * @param options Optional callbacks for drag-drop events.
30
30
  * @returns State and props factory for drag-drop functionality.
31
31
  */
32
- export declare function useSceneExplorerDragDrop(options?: SceneExplorerDragDropOptions): {
32
+ export declare function useExplorerDragDrop(options?: ExplorerDragDropOptions): {
33
33
  draggedEntity: object | undefined;
34
34
  dropTarget: object | undefined;
35
35
  dropTargetIsRoot: boolean;
36
- createDragProps: (entity: object, getName: () => string, dragDropConfig?: SceneExplorerDragDropConfig<object>) => DragDropProps;
37
- createSectionDropProps: (dragDropConfig: SceneExplorerDragDropConfig<object> | undefined) => DropProps;
36
+ createDragProps: (entity: object, getName: () => string, dragDropConfig?: ExplorerDragDropConfig<object>) => DragDropProps;
37
+ createGroupDropProps: (dragDropConfig: ExplorerDragDropConfig<object> | undefined) => DropProps;
38
38
  };
@@ -0,0 +1,359 @@
1
+ import { type ComponentType } from "react";
2
+ import { type IDisposable, type IReadonlyObservable } from "@babylonjs/core/index.js";
3
+ /**
4
+ * The value used to uniquely identify a node within the Explorer tree (e.g. for expansion state).
5
+ * This matches the Fluent `TreeItemValue` type.
6
+ * @experimental
7
+ */
8
+ export type ExplorerNodeValue = string | number;
9
+ /**
10
+ * Information about how to display a node in the Explorer tree.
11
+ * @experimental
12
+ */
13
+ export type ExplorerDisplayInfo = Partial<IDisposable> & Readonly<{
14
+ /**
15
+ * The name of the node to display in the Explorer tree.
16
+ */
17
+ name: string;
18
+ /**
19
+ * An observable that notifies when the display info (such as the name) changes.
20
+ */
21
+ onChange?: IReadonlyObservable<void>;
22
+ /**
23
+ * An optional validation error message for this node. When present, the node's
24
+ * icon is replaced with a warning icon whose tooltip displays this message.
25
+ */
26
+ validationError?: string;
27
+ }>;
28
+ /**
29
+ * Configuration for drag-and-drop behavior within a branch of the Explorer tree.
30
+ * The configuration applies to the node it is specified on as well as all of its descendants.
31
+ * @experimental
32
+ */
33
+ export type ExplorerDragDropConfig<T> = Readonly<{
34
+ /**
35
+ * Determines whether an entity can be dragged.
36
+ * @param entity The entity to check.
37
+ * @returns True if the entity can be dragged, false otherwise.
38
+ */
39
+ canDrag: (entity: T) => boolean;
40
+ /**
41
+ * Determines whether an entity can be dropped onto a target.
42
+ * @param draggedEntity The entity being dragged.
43
+ * @param targetEntity The potential drop target entity, or null if dropping onto the branch root.
44
+ * @returns True if the drop is allowed, false otherwise.
45
+ */
46
+ canDrop: (draggedEntity: T, targetEntity: T | null) => boolean;
47
+ /**
48
+ * Called when a drag-and-drop operation completes.
49
+ * @param draggedEntity The entity that was dragged.
50
+ * @param targetEntity The entity it was dropped onto, or null if dropped onto the branch root.
51
+ */
52
+ onDrop: (draggedEntity: T, targetEntity: T | null) => void;
53
+ }>;
54
+ type InlineCommand = {
55
+ /**
56
+ * An icon component to render for the command. Required for inline commands.
57
+ */
58
+ icon: ComponentType;
59
+ /**
60
+ * The mode of the command. Inline commands are shown directly in the tree item layout. Inline by default.
61
+ */
62
+ mode?: "inline";
63
+ };
64
+ type ContextMenuCommand = {
65
+ /**
66
+ * An icon component to render for the command. Optional for context menu commands.
67
+ */
68
+ icon?: ComponentType;
69
+ /**
70
+ * The mode of the command. Context menu commands are shown in the context menu for the tree item.
71
+ */
72
+ mode: "contextMenu";
73
+ };
74
+ /**
75
+ * The supported command modes (inline or context menu).
76
+ * @experimental
77
+ */
78
+ export type ExplorerCommandMode = NonNullable<(InlineCommand | ContextMenuCommand)["mode"]>;
79
+ type ActionCommand = {
80
+ readonly type: "action";
81
+ /**
82
+ * The function that executes the command.
83
+ */
84
+ execute(): unknown | Promise<unknown>;
85
+ };
86
+ type ToggleCommand = {
87
+ readonly type: "toggle";
88
+ /**
89
+ * A boolean indicating if the command is enabled.
90
+ */
91
+ isEnabled: boolean;
92
+ };
93
+ /**
94
+ * The supported command types (action or toggle).
95
+ * @experimental
96
+ */
97
+ export type ExplorerCommandType = (ActionCommand | ToggleCommand)["type"];
98
+ /**
99
+ * Describes a command that can be executed on a node in the Explorer.
100
+ * @experimental
101
+ */
102
+ export type ExplorerCommand<ModeT extends ExplorerCommandMode = ExplorerCommandMode, TypeT extends ExplorerCommandType = ExplorerCommandType> = Partial<IDisposable> & Readonly<{
103
+ /**
104
+ * The display name of the command (e.g. "Delete", "Rename", etc.).
105
+ */
106
+ displayName: string;
107
+ /**
108
+ * An optional array of hotkeys that trigger the command.
109
+ */
110
+ hotKey?: {
111
+ keyCode: string;
112
+ control?: boolean;
113
+ alt?: boolean;
114
+ shift?: boolean;
115
+ meta?: boolean;
116
+ };
117
+ /**
118
+ * An observable that notifies when the command state changes.
119
+ */
120
+ onChange?: IReadonlyObservable<unknown>;
121
+ }> & (ModeT extends "inline" ? InlineCommand : ContextMenuCommand) & (TypeT extends "action" ? ActionCommand : ToggleCommand);
122
+ /**
123
+ * Provides a command for a specific context (an entity or a group name) in the Explorer.
124
+ * @experimental
125
+ */
126
+ export type ExplorerCommandProvider<ContextT, ModeT extends ExplorerCommandMode = ExplorerCommandMode, TypeT extends ExplorerCommandType = ExplorerCommandType> = Readonly<{
127
+ /**
128
+ * An optional order for the command, relative to other commands.
129
+ * Defaults to 0.
130
+ */
131
+ order?: number;
132
+ /**
133
+ * A predicate function that determines if the command is applicable to the given context.
134
+ */
135
+ predicate: (context: unknown) => context is ContextT;
136
+ /**
137
+ * Gets the command information for the given context.
138
+ */
139
+ getCommand: (context: ContextT) => ExplorerCommand<ModeT, TypeT>;
140
+ }>;
141
+ /**
142
+ * The visual treatment used for a node in the Explorer tree.
143
+ * - "root": The single top level node representing the object being inspected (e.g. a Scene or an Engine).
144
+ * - "group": A heading style node (e.g. "Nodes", "Materials", "Auxiliary Surfaces").
145
+ * - "item": A standard node representing an entity within the tree (e.g. a mesh or a material).
146
+ * @experimental
147
+ */
148
+ export type ExplorerNodeKind = "root" | "group" | "item";
149
+ /**
150
+ * Describes a single node of the Explorer tree.
151
+ *
152
+ * This is the generic (product agnostic) model the Explorer renders. Each node describes its own
153
+ * presentation and enumerates its own children, which means an Explorer hierarchy can be arbitrarily
154
+ * deep and fully heterogeneous (nodes of different kinds, backed by unrelated entity types, can be
155
+ * freely nested within each other).
156
+ * @experimental
157
+ */
158
+ export type ExplorerNodeDescription = Readonly<{
159
+ /**
160
+ * An identifier for the node that is stable across rebuilds and unique among its siblings.
161
+ */
162
+ id: string;
163
+ /**
164
+ * The visual treatment used for this node. Defaults to "item".
165
+ */
166
+ kind?: ExplorerNodeKind;
167
+ /**
168
+ * The entity represented by this node, if any.
169
+ * Nodes with an entity are selectable and are always displayed.
170
+ * Nodes without an entity are purely structural, are not selectable, and are only displayed when they have visible children.
171
+ */
172
+ entity?: object;
173
+ /**
174
+ * Gets the display information for this node.
175
+ * This is ideally "live" display info (e.g. updates to the display info are taken into account and communicated via the observable).
176
+ * This means in many cases the display info will need to be disposed when it is no longer needed so observable registrations can be removed.
177
+ */
178
+ getDisplayInfo: () => ExplorerDisplayInfo;
179
+ /**
180
+ * An optional icon component to render for the node.
181
+ */
182
+ icon?: ComponentType<{
183
+ entity: object;
184
+ }>;
185
+ /**
186
+ * Enumerates the children of this node. Children may be of any kind and may describe entirely different entity types.
187
+ */
188
+ getChildren?: () => readonly ExplorerNodeDescription[];
189
+ /**
190
+ * Optional configuration for drag-and-drop behavior within this node.
191
+ * Descendants inherit this configuration unless they specify their own.
192
+ * If not provided (and not inherited), drag-and-drop is disabled for the node.
193
+ */
194
+ dragDropConfig?: ExplorerDragDropConfig<object>;
195
+ /**
196
+ * A function that returns observables that notify when descendants of this node are added.
197
+ */
198
+ getAddedObservables?: () => readonly IReadonlyObservable<unknown>[];
199
+ /**
200
+ * A function that returns observables that notify when descendants of this node are removed.
201
+ */
202
+ getRemovedObservables?: () => readonly IReadonlyObservable<object>[];
203
+ /**
204
+ * A function that returns observables that notify when descendants of this node are moved (e.g. re-parented).
205
+ */
206
+ getMovedObservables?: () => readonly IReadonlyObservable<unknown>[];
207
+ }>;
208
+ /**
209
+ * A materialized node of the Explorer tree, produced by {@link BuildExplorerTree}.
210
+ */
211
+ export type ExplorerNode = {
212
+ /**
213
+ * The visual treatment used for this node.
214
+ */
215
+ readonly kind: ExplorerNodeKind;
216
+ /**
217
+ * The value that uniquely identifies this node within the tree (e.g. for expansion state).
218
+ */
219
+ readonly value: ExplorerNodeValue;
220
+ /**
221
+ * The one based depth of this node within the tree (used for indentation and accessibility).
222
+ */
223
+ readonly depth: number;
224
+ /**
225
+ * The parent of this node, or undefined for top level nodes.
226
+ */
227
+ readonly parent?: ExplorerNode;
228
+ /**
229
+ * The visible children of this node.
230
+ */
231
+ readonly children: ExplorerNode[];
232
+ /**
233
+ * The entity represented by this node, or undefined if this node is purely structural.
234
+ */
235
+ readonly entity?: object;
236
+ /**
237
+ * An optional icon component to render for the node.
238
+ */
239
+ readonly icon?: ComponentType<{
240
+ entity: object;
241
+ }>;
242
+ /**
243
+ * Gets the (possibly live) display info for this node.
244
+ */
245
+ readonly getDisplayInfo: () => ExplorerDisplayInfo;
246
+ /**
247
+ * The drag-and-drop configuration that applies to this node (either its own or inherited from an ancestor).
248
+ */
249
+ readonly dragDropConfig?: ExplorerDragDropConfig<object>;
250
+ };
251
+ /**
252
+ * The result of materializing a set of {@link ExplorerNodeDescription}s into a tree.
253
+ */
254
+ export type ExplorerTree = {
255
+ /**
256
+ * The visible top level nodes, in the order they were described.
257
+ */
258
+ readonly nodes: readonly ExplorerNode[];
259
+ /**
260
+ * All visible nodes, keyed by their tree value.
261
+ */
262
+ readonly nodesByValue: ReadonlyMap<ExplorerNodeValue, ExplorerNode>;
263
+ /**
264
+ * All visible nodes that represent an entity, keyed by that entity. An entity can occur in
265
+ * multiple branches, so each value contains every occurrence in tree order.
266
+ */
267
+ readonly nodesByEntity: ReadonlyMap<object, readonly ExplorerNode[]>;
268
+ /**
269
+ * The observables (gathered from every described node, including nodes that are not currently visible)
270
+ * that notify when the topology of the tree changes.
271
+ */
272
+ readonly changeObservables: {
273
+ readonly added: readonly IReadonlyObservable<unknown>[];
274
+ readonly removed: readonly IReadonlyObservable<object>[];
275
+ readonly moved: readonly IReadonlyObservable<unknown>[];
276
+ };
277
+ };
278
+ /**
279
+ * Gets a stable identifier for an entity. If the entity has a numeric `uniqueId` property it is used,
280
+ * otherwise a synthetic id is generated and cached for the lifetime of the entity.
281
+ * @param entity The entity to get an identifier for.
282
+ * @returns A stable numeric identifier for the entity.
283
+ */
284
+ export declare function GetEntityId(entity: object): number;
285
+ /**
286
+ * Determines whether a node should be displayed in the Explorer tree.
287
+ * Nodes that represent an entity are always displayed (they are selectable and meaningful on their own),
288
+ * while purely structural nodes are only displayed when they have at least one visible child.
289
+ * @param node A node with an optional entity and a set of already filtered (visible) children.
290
+ * @returns True if the node should be displayed, false otherwise.
291
+ */
292
+ export declare function ShouldDisplayNode(node: {
293
+ readonly entity?: object;
294
+ readonly children: readonly unknown[];
295
+ }): boolean;
296
+ /**
297
+ * Gets the children of a node in display order. The declared order is preserved unless alphabetical
298
+ * sorting is enabled, in which case item nodes are sorted without moving structural nodes.
299
+ * @param node The node whose children should be ordered.
300
+ * @param sortItems Whether item nodes should be sorted alphabetically by display name.
301
+ * @returns The ordered children of the node.
302
+ */
303
+ export declare function GetOrderedChildren(node: ExplorerNode, sortItems: boolean): readonly ExplorerNode[];
304
+ /**
305
+ * Materializes a set of node descriptions into an Explorer tree.
306
+ *
307
+ * Nodes are visited recursively so that arbitrarily nested, heterogeneous hierarchies are supported.
308
+ * Structural nodes (nodes without an entity) that end up with no visible children are omitted from the
309
+ * resulting tree, but their change observables are still gathered so the tree can be rebuilt when they
310
+ * gain children.
311
+ * @param descriptions The top level node descriptions.
312
+ * @returns The materialized tree, along with lookup maps and the gathered change observables.
313
+ */
314
+ export declare function BuildExplorerTree(descriptions: readonly ExplorerNodeDescription[]): ExplorerTree;
315
+ /**
316
+ * Options that control which nodes of an Explorer tree are visible.
317
+ */
318
+ export type ExplorerVisibilityOptions = Readonly<{
319
+ /**
320
+ * The values of the nodes that are currently expanded.
321
+ */
322
+ openItems: ReadonlySet<ExplorerNodeValue>;
323
+ /**
324
+ * A lower case filter string. When non-empty, the expansion state is ignored and only matching
325
+ * nodes (and their ancestors) are visible.
326
+ */
327
+ filter: string;
328
+ /**
329
+ * Whether item nodes should be sorted alphabetically by display name.
330
+ */
331
+ sortItems: boolean;
332
+ }>;
333
+ /**
334
+ * Computes the flattened, ordered list of nodes that should currently be rendered.
335
+ *
336
+ * Only nodes that represent an entity participate in filter matching. Purely structural nodes
337
+ * (e.g. the "Nodes" or "Materials" sections) become visible when one of their descendants matches.
338
+ * The root node is always visible.
339
+ * @param nodes The top level nodes of the tree.
340
+ * @param options Options controlling expansion, filtering, and sorting.
341
+ * @returns The nodes to render, in tree order.
342
+ */
343
+ export declare function GetVisibleExplorerNodes(nodes: readonly ExplorerNode[], options: ExplorerVisibilityOptions): readonly ExplorerNode[];
344
+ /**
345
+ * Expands or collapses a node and all of its descendants.
346
+ * @param node The node to expand or collapse.
347
+ * @param open True to expand, false to collapse.
348
+ * @param openItems The mutable set of expanded node values to update.
349
+ */
350
+ export declare function ExpandOrCollapseAll(node: ExplorerNode, open: boolean, openItems: Set<ExplorerNodeValue>): void;
351
+ /**
352
+ * Gets the values of all ancestors of the node representing the specified entity, which is what must be
353
+ * expanded for that entity to be revealed.
354
+ * @param tree The tree to search.
355
+ * @param entity The entity to reveal.
356
+ * @returns The values of the ancestor nodes, or an empty array if the entity is not present in the tree.
357
+ */
358
+ export declare function GetAncestorValues(tree: ExplorerTree, entity: object): readonly ExplorerNodeValue[];
359
+ export {};
@@ -49,6 +49,21 @@ declare function BoundPropertyImpl<TargetT extends object, PropertyKeyT extends
49
49
  * @returns JSX element
50
50
  */
51
51
  export declare const BoundProperty: typeof BoundPropertyImpl;
52
+ type ComponentValue<ComponentT extends ComponentType<any>> = ComponentProps<ComponentT> extends {
53
+ value: infer ValueT;
54
+ } ? ValueT : never;
55
+ export type ComputedPropertyProps<TargetT extends object, ComponentT extends ComponentType<any>> = Omit<ComponentProps<ComponentT>, "value" | "onChange"> & {
56
+ component: ComponentT;
57
+ target: TargetT;
58
+ getValue: (target: TargetT) => ComponentValue<ComponentT>;
59
+ };
60
+ /**
61
+ * Renders a read-only property-line component with a computed value that follows the Preferred
62
+ * Watch Mode. Use {@link BoundProperty} instead for an editable `target[propertyKey]`.
63
+ * @param props The target, computed getter, and property-line component props.
64
+ * @returns The property-line component with its current computed value.
65
+ */
66
+ export declare function ComputedProperty<TargetT extends object, ComponentT extends ComponentType<any>>(props: ComputedPropertyProps<TargetT, ComponentT>): import("react/jsx-runtime").JSX.Element;
52
67
  /**
53
68
  * Mutually exclusive propertyPath or functionPath - one required
54
69
  */
@@ -1,49 +1,16 @@
1
- import { type ComponentType, type FunctionComponent } from "react";
2
- import { type IDisposable, type IReadonlyObservable, type Nullable, type Scene } from "@babylonjs/core/index.js";
1
+ import { type ComponentType } from "react";
2
+ import { type IReadonlyObservable } from "@babylonjs/core/index.js";
3
+ import { type ExplorerCommand, type ExplorerCommandMode, type ExplorerCommandProvider, type ExplorerCommandType, type ExplorerDisplayInfo, type ExplorerDragDropConfig } from "../explorer/explorerModel";
3
4
  /**
4
5
  * Information about how to display an entity in the Scene Explorer tree.
5
6
  */
6
- export type EntityDisplayInfo = Partial<IDisposable> & Readonly<{
7
- /**
8
- * The name of the entity to display in the Scene Explorer tree.
9
- */
10
- name: string;
11
- /**
12
- * An observable that notifies when the display info (such as the name) changes.
13
- */
14
- onChange?: IReadonlyObservable<void>;
15
- /**
16
- * An optional validation error message for this entity. When present, the entity's
17
- * icon is replaced with a warning icon whose tooltip displays this message.
18
- */
19
- validationError?: string;
20
- }>;
7
+ export type EntityDisplayInfo = ExplorerDisplayInfo;
21
8
  /**
22
9
  * Configuration for drag-and-drop behavior within a section.
23
10
  */
24
- export type SceneExplorerDragDropConfig<T> = Readonly<{
25
- /**
26
- * Determines whether an entity can be dragged.
27
- * @param entity The entity to check.
28
- * @returns True if the entity can be dragged, false otherwise.
29
- */
30
- canDrag: (entity: T) => boolean;
31
- /**
32
- * Determines whether an entity can be dropped onto a target.
33
- * @param draggedEntity The entity being dragged.
34
- * @param targetEntity The potential drop target entity, or null if dropping onto the section root.
35
- * @returns True if the drop is allowed, false otherwise.
36
- */
37
- canDrop: (draggedEntity: T, targetEntity: T | null) => boolean;
38
- /**
39
- * Called when a drag-and-drop operation completes.
40
- * @param draggedEntity The entity that was dragged.
41
- * @param targetEntity The entity it was dropped onto, or null if dropped onto the section root.
42
- */
43
- onDrop: (draggedEntity: T, targetEntity: T | null) => void;
44
- }>;
11
+ export type SceneExplorerDragDropConfig<T> = ExplorerDragDropConfig<T>;
45
12
  /**
46
- * Describes a section in the Scene Explorer (e.g. "Nodes", "Materials", etc.).
13
+ * Describes a section containing entities in the Scene Explorer.
47
14
  */
48
15
  export type SceneExplorerSection<T extends object> = Readonly<{
49
16
  /**
@@ -93,95 +60,14 @@ export type SceneExplorerSection<T extends object> = Readonly<{
93
60
  */
94
61
  dragDropConfig?: SceneExplorerDragDropConfig<T>;
95
62
  }>;
96
- type InlineCommand = {
97
- /**
98
- * An icon component to render for the command. Required for inline commands.
99
- */
100
- icon: ComponentType;
101
- /**
102
- * The mode of the command. Inline commands are shown directly in the tree item layout. Inline by default.
103
- */
104
- mode?: "inline";
105
- };
106
- type ContextMenuCommand = {
107
- /**
108
- * An icon component to render for the command. Optional for context menu commands.
109
- */
110
- icon?: ComponentType;
111
- /**
112
- * The mode of the command. Context menu commands are shown in the context menu for the tree item.
113
- */
114
- mode: "contextMenu";
115
- };
116
- type CommandMode = NonNullable<(InlineCommand | ContextMenuCommand)["mode"]>;
117
- type ActionCommand = {
118
- readonly type: "action";
119
- /**
120
- * The function that executes the command.
121
- */
122
- execute(): unknown | Promise<unknown>;
123
- };
124
- type ToggleCommand = {
125
- readonly type: "toggle";
126
- /**
127
- * A boolean indicating if the command is enabled.
128
- */
129
- isEnabled: boolean;
130
- };
131
- type CommandType = (ActionCommand | ToggleCommand)["type"];
63
+ type CommandMode = ExplorerCommandMode;
64
+ type CommandType = ExplorerCommandType;
132
65
  /**
133
66
  * Describes a command that can be executed on entities or sections in the Scene Explorer.
134
67
  */
135
- export type SceneExplorerCommand<ModeT extends CommandMode = CommandMode, TypeT extends CommandType = CommandType> = Partial<IDisposable> & Readonly<{
136
- /**
137
- * The display name of the command (e.g. "Delete", "Rename", etc.).
138
- */
139
- displayName: string;
140
- /**
141
- * An optional array of hotkeys that trigger the command.
142
- */
143
- hotKey?: {
144
- keyCode: string;
145
- control?: boolean;
146
- alt?: boolean;
147
- shift?: boolean;
148
- meta?: boolean;
149
- };
150
- /**
151
- * An observable that notifies when the command state changes.
152
- */
153
- onChange?: IReadonlyObservable<unknown>;
154
- }> & (ModeT extends "inline" ? InlineCommand : ContextMenuCommand) & (TypeT extends "action" ? ActionCommand : ToggleCommand);
68
+ export type SceneExplorerCommand<ModeT extends CommandMode = CommandMode, TypeT extends CommandType = CommandType> = ExplorerCommand<ModeT, TypeT>;
155
69
  /**
156
70
  * Provides a command for a specific entity or section context in the Scene Explorer.
157
71
  */
158
- export type SceneExplorerCommandProvider<ContextT, ModeT extends CommandMode = CommandMode, TypeT extends CommandType = CommandType> = Readonly<{
159
- /**
160
- * An optional order for the section, relative to other commands.
161
- * Defaults to 0.
162
- */
163
- order?: number;
164
- /**
165
- * A predicate function that determines if the command is applicable to the given context.
166
- */
167
- predicate: (context: unknown) => context is ContextT;
168
- /**
169
- * Gets the command information for the given context.
170
- */
171
- getCommand: (context: ContextT) => SceneExplorerCommand<ModeT, TypeT>;
172
- }>;
173
- declare const ActionCommand: FunctionComponent<{
174
- command: SceneExplorerCommand<"inline", "action">;
175
- }>;
176
- declare const ToggleCommand: FunctionComponent<{
177
- command: SceneExplorerCommand<"inline", "toggle">;
178
- }>;
179
- export declare const SceneExplorer: FunctionComponent<{
180
- sections: readonly SceneExplorerSection<object>[];
181
- entityCommandProviders: readonly SceneExplorerCommandProvider<object>[];
182
- sectionCommandProviders: readonly SceneExplorerCommandProvider<string, "contextMenu">[];
183
- scene: Scene;
184
- selectedEntity?: Nullable<object>;
185
- setSelectedEntity?: (entity: Nullable<object>) => void;
186
- }>;
72
+ export type SceneExplorerCommandProvider<ContextT, ModeT extends CommandMode = CommandMode, TypeT extends CommandType = CommandType> = ExplorerCommandProvider<ContextT, ModeT, TypeT>;
187
73
  export {};
@@ -1,3 +1,14 @@
1
1
  import { type IWatcherService } from "../services/watcherService";
2
2
  export declare const WatcherContext: import("react").Context<IWatcherService>;
3
3
  export declare function useWatcher(): IWatcherService;
4
+ /**
5
+ * Reads a computed value and keeps it synchronized with Watcher refreshes.
6
+ * @param target The object from which the value is computed.
7
+ * @param getValue A stable function that computes the value from the target.
8
+ * @returns The latest computed value.
9
+ * @remarks Use this for inspected values that should honor the Preferred Watch Mode. Use
10
+ * `useObservableState` directly when the source exposes a precise change observable, or combine
11
+ * `usePollingObservable` with `useObservableState` for telemetry that intentionally uses a fixed
12
+ * cadence independent of Watch Mode.
13
+ */
14
+ export declare function useWatchedValue<Target, Value>(target: Target, getValue: (target: Target) => Value): Value;