@babylonjs/inspector 8.37.0-preview → 8.37.1-preview

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.
@@ -3,8 +3,8 @@ import { useMemo, useEffect, useState, useRef, useCallback, forwardRef, createCo
3
3
  import { Color3, Color4 } from '@babylonjs/core/Maths/math.color.js';
4
4
  import { Vector3, Quaternion, Matrix, Vector2, Vector4, TmpVectors } from '@babylonjs/core/Maths/math.vector.js';
5
5
  import { Observable } from '@babylonjs/core/Misc/observable.js';
6
- import { makeStyles, Link as Link$1, Body1, ToggleButton as ToggleButton$1, Button as Button$1, tokens, InfoLabel as InfoLabel$1, Body1Strong, Checkbox as Checkbox$1, mergeClasses, Accordion as Accordion$1, AccordionItem, AccordionHeader, Subtitle2Stronger, AccordionPanel, Divider, TeachingPopover, TeachingPopoverSurface, TeachingPopoverHeader, TeachingPopoverBody, createLightTheme, createDarkTheme, FluentProvider, Tooltip, Menu, MenuTrigger, SplitButton, MenuPopover, MenuList, MenuItem, Toolbar as Toolbar$1, Portal, RendererProvider, ToolbarRadioButton, createDOMRenderer, MenuGroup, MenuGroupHeader, SearchBox as SearchBox$1, FlatTree, FlatTreeItem, TreeItemLayout, treeItemLevelToken, Switch as Switch$1, PresenceBadge, useId, SpinButton as SpinButton$1, Slider, Input, Dropdown as Dropdown$1, Option, Popover, PopoverTrigger, ColorSwatch, PopoverSurface, ColorPicker, ColorArea, ColorSlider, AlphaSlider, MenuItemRadio, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, DialogActions, List as List$1, ListItem, Spinner, Badge, MessageBar as MessageBar$1, MessageBarBody, MessageBarTitle, Textarea as Textarea$1, ToolbarButton, useComboboxFilter, Combobox, Field } from '@fluentui/react-components';
7
- import { ChevronCircleRight16Regular, ChevronCircleRight20Regular, ChevronCircleDown16Regular, ChevronCircleDown20Regular, Copy16Regular, Copy20Regular, PanelLeftExpandRegular, PanelRightExpandRegular, PanelLeftContractRegular, PanelRightContractRegular, PictureInPictureEnterRegular, MoreHorizontalRegular, LayoutColumnTwoFocusLeftFilled, LayoutColumnTwoSplitLeftFocusTopLeftFilled, LayoutColumnTwoSplitLeftFocusBottomLeftFilled, LayoutColumnTwoFocusRightFilled, LayoutColumnTwoSplitRightFocusTopRightFilled, LayoutColumnTwoSplitRightFocusBottomRightFilled, DocumentTextRegular, createFluentIcon, FilterRegular, GlobeRegular, ArrowExpandAllRegular, CubeTreeRegular, BugRegular, SettingsRegular, ArrowUploadRegular, DataBarHorizontalRegular, WrenchRegular, WeatherSunnyRegular, WeatherMoonRegular, ErrorCircleRegular, ArrowRotateClockwiseRegular, ArrowExpandRegular, SelectObjectRegular, CubeRegular, SaveRegular, ArrowUndoRegular, BracesRegular, BracesDismiss16Regular, CopyRegular, DeleteRegular, EyeOffFilled, EyeFilled, ArrowMoveFilled, StopFilled, PlayFilled, StackRegular, FilmstripRegular, PauseFilled, WeatherSunnyLowFilled, LayerRegular, FrameRegular, PlayRegular, AppGenericRegular, MyLocationRegular, CameraRegular, LightbulbRegular, BorderOutsideRegular, BorderNoneRegular, EyeRegular, EyeOffRegular, VideoFilled, VideoRegular, FlashlightRegular, FlashlightOffRegular, DropRegular, BlurRegular, PipelineRegular, PersonWalkingRegular, DataLineRegular, PersonSquareRegular, LayerDiagonalPersonRegular, ImageEditRegular, ImageRegular, TargetRegular, PersonFeedbackRegular, BranchRegular, DeleteFilled } from '@fluentui/react-icons';
6
+ import { makeStyles, Link as Link$1, Body1, ToggleButton as ToggleButton$1, Button as Button$1, tokens, InfoLabel as InfoLabel$1, Body1Strong, Checkbox as Checkbox$1, mergeClasses, Accordion as Accordion$1, AccordionItem, AccordionHeader, Subtitle2Stronger, AccordionPanel, Divider, TeachingPopover, TeachingPopoverSurface, TeachingPopoverHeader, TeachingPopoverBody, createLightTheme, createDarkTheme, FluentProvider, Tooltip, Menu, MenuTrigger, SplitButton, MenuPopover, MenuList, MenuItem, Toolbar as Toolbar$1, Portal, RendererProvider, ToolbarRadioButton, createDOMRenderer, MenuGroup, MenuGroupHeader, SearchBox as SearchBox$1, FlatTree, FlatTreeItem, TreeItemLayout, treeItemLevelToken, MenuDivider, MenuItemCheckbox, Switch as Switch$1, PresenceBadge, useId, SpinButton as SpinButton$1, Slider, Input, Dropdown as Dropdown$1, Option, Popover, PopoverTrigger, ColorSwatch, PopoverSurface, ColorPicker, ColorArea, ColorSlider, AlphaSlider, MenuItemRadio, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, DialogActions, List as List$1, ListItem, Spinner, Badge, MessageBar as MessageBar$1, MessageBarBody, MessageBarTitle, Textarea as Textarea$1, ToolbarButton, useComboboxFilter, Combobox, Field } from '@fluentui/react-components';
7
+ import { ChevronCircleRight16Regular, ChevronCircleRight20Regular, ChevronCircleDown16Regular, ChevronCircleDown20Regular, Copy16Regular, Copy20Regular, PanelLeftExpandRegular, PanelRightExpandRegular, PanelLeftContractRegular, PanelRightContractRegular, PictureInPictureEnterRegular, MoreHorizontalRegular, LayoutColumnTwoFocusLeftFilled, LayoutColumnTwoSplitLeftFocusTopLeftFilled, LayoutColumnTwoSplitLeftFocusBottomLeftFilled, LayoutColumnTwoFocusRightFilled, LayoutColumnTwoSplitRightFocusTopRightFilled, LayoutColumnTwoSplitRightFocusBottomRightFilled, DocumentTextRegular, createFluentIcon, FilterRegular, GlobeRegular, ArrowExpandAllRegular, ArrowCollapseAllRegular, CubeTreeRegular, BugRegular, SettingsRegular, ArrowUploadRegular, DataBarHorizontalRegular, WrenchRegular, WeatherSunnyRegular, WeatherMoonRegular, ErrorCircleRegular, ArrowRotateClockwiseRegular, ArrowExpandRegular, SelectObjectRegular, CubeRegular, SaveRegular, ArrowUndoRegular, BracesRegular, BracesDismiss16Regular, CopyRegular, DeleteRegular, EyeOffFilled, EyeFilled, ArrowMoveFilled, StopFilled, PlayFilled, StackRegular, FilmstripRegular, PauseFilled, WeatherSunnyLowFilled, LayerRegular, FrameRegular, PlayRegular, AppGenericRegular, MyLocationRegular, CameraRegular, LightbulbRegular, BorderOutsideRegular, BorderNoneRegular, EyeRegular, EyeOffRegular, VideoFilled, VideoRegular, FlashlightRegular, FlashlightOffRegular, DropRegular, BlurRegular, PipelineRegular, PersonWalkingRegular, DataLineRegular, PersonSquareRegular, LayerDiagonalPersonRegular, ImageEditRegular, ImageRegular, TargetRegular, PersonFeedbackRegular, BranchRegular, DeleteFilled } from '@fluentui/react-icons';
8
8
  import { Collapse as Collapse$1, Fade } from '@fluentui/react-motion-components-preview';
9
9
  import '@babylonjs/core/Misc/typeStore.js';
10
10
  import { useLocalStorage, useTernaryDarkMode } from 'usehooks-ts';
@@ -2396,7 +2396,7 @@ const PlaceHolderCommand = {
2396
2396
  /* No-op */
2397
2397
  },
2398
2398
  };
2399
- function MakeCommandElement(command, isPlaceholder) {
2399
+ function MakeInlineCommandElement(command, isPlaceholder) {
2400
2400
  if (isPlaceholder) {
2401
2401
  // Placeholders are not visible and not interacted with, so they are always ActionCommand
2402
2402
  // components, just to ensure the exact right amount of space is taken up.
@@ -2459,6 +2459,7 @@ const EntityTreeItem = (props) => {
2459
2459
  dispose: () => commands.forEach((command) => command.dispose?.()),
2460
2460
  });
2461
2461
  }, [entityItem.entity, commandProviders]));
2462
+ const inlineCommands = useMemo(() => commands.filter((command) => command.mode !== "contextMenu"), [commands]);
2462
2463
  // TreeItemLayout actions (totally unrelated to "Action" type commands) are only visible when the item is focused or has pointer hover.
2463
2464
  const actions = useMemo(() => {
2464
2465
  const defaultCommands = [];
@@ -2470,8 +2471,8 @@ const EntityTreeItem = (props) => {
2470
2471
  execute: () => expandAll(),
2471
2472
  });
2472
2473
  }
2473
- return [...defaultCommands, ...commands].map((command) => MakeCommandElement(command, false));
2474
- }, [commands, hasChildren, expandAll]);
2474
+ return [...defaultCommands, ...inlineCommands].map((command) => MakeInlineCommandElement(command, false));
2475
+ }, [inlineCommands, hasChildren, expandAll]);
2475
2476
  // TreeItemLayout asides are always visible.
2476
2477
  const [aside, setAside] = useState([]);
2477
2478
  // This useEffect keeps the aside up-to-date. What should always show is any enabled toggle command, along with
@@ -2480,16 +2481,16 @@ const EntityTreeItem = (props) => {
2480
2481
  const updateAside = () => {
2481
2482
  let isAnyCommandEnabled = false;
2482
2483
  const aside = [];
2483
- for (const command of commands) {
2484
+ for (const command of inlineCommands) {
2484
2485
  isAnyCommandEnabled || (isAnyCommandEnabled = command.type === "toggle" && command.isEnabled);
2485
2486
  if (isAnyCommandEnabled) {
2486
- aside.push(MakeCommandElement(command, command.type !== "toggle" || !command.isEnabled));
2487
+ aside.push(MakeInlineCommandElement(command, command.type !== "toggle" || !command.isEnabled));
2487
2488
  }
2488
2489
  }
2489
2490
  setAside(aside);
2490
2491
  };
2491
2492
  updateAside();
2492
- const observers = commands
2493
+ const observers = inlineCommands
2493
2494
  .map((command) => command.onChange)
2494
2495
  .filter((onChange) => !!onChange)
2495
2496
  .map((onChange) => onChange.add(updateAside));
@@ -2498,8 +2499,38 @@ const EntityTreeItem = (props) => {
2498
2499
  observer.remove();
2499
2500
  }
2500
2501
  };
2501
- }, [commands]);
2502
- return (jsxs(Menu, { openOnContext: true, children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(FlatTreeItem, { value: entityItem.entity.uniqueId,
2502
+ }, [inlineCommands]);
2503
+ const contextMenuCommands = useMemo(() => commands.filter((command) => command.mode === "contextMenu"), [commands]);
2504
+ const [checkedContextMenuItems, setCheckedContextMenuItems] = useState({ toggleCommands: [] });
2505
+ useEffect(() => {
2506
+ const updateCheckedItems = () => {
2507
+ const checkedItems = [];
2508
+ for (const command of contextMenuCommands) {
2509
+ if (command.type === "toggle" && command.isEnabled) {
2510
+ checkedItems.push(command.displayName);
2511
+ }
2512
+ }
2513
+ setCheckedContextMenuItems({ toggleCommands: checkedItems });
2514
+ };
2515
+ updateCheckedItems();
2516
+ const observers = contextMenuCommands
2517
+ .map((command) => command.onChange)
2518
+ .filter((onChange) => !!onChange)
2519
+ .map((onChange) => onChange.add(updateCheckedItems));
2520
+ return () => {
2521
+ for (const observer of observers) {
2522
+ observer.remove();
2523
+ }
2524
+ };
2525
+ }, [contextMenuCommands]);
2526
+ const onContextMenuCheckedValueChange = useCallback((e, data) => {
2527
+ for (const command of contextMenuCommands) {
2528
+ if (command.type === "toggle") {
2529
+ command.isEnabled = data.checkedItems.includes(command.displayName);
2530
+ }
2531
+ }
2532
+ }, [contextMenuCommands]);
2533
+ return (jsxs(Menu, { openOnContext: true, checkedValues: checkedContextMenuItems, onCheckedValueChange: onContextMenuCheckedValueChange, children: [jsx(MenuTrigger, { disableButtonEnhancement: true, children: jsx(FlatTreeItem, { value: entityItem.entity.uniqueId,
2503
2534
  // Disable manual expand/collapse when a filter is active.
2504
2535
  itemType: !isFiltering && hasChildren ? "branch" : "leaf", parentValue: entityItem.parent.type === "section" ? entityItem.parent.sectionName : entityItem.entity.uniqueId, "aria-level": entityItem.depth, "aria-setsize": 1, "aria-posinset": 1, onClick: select, style: { [treeItemLevelToken]: entityItem.depth }, children: jsx(TreeItemLayout, { iconBefore: entityItem.icon ? jsx(entityItem.icon, { entity: entityItem.entity }) : null, className: compactMode ? classes.treeItemLayoutCompact : undefined, style: isSelected ? { backgroundColor: tokens.colorNeutralBackground1Selected } : undefined, actions: actions, aside: {
2505
2536
  // Match the gap and padding of the actions.
@@ -2508,7 +2539,9 @@ const EntityTreeItem = (props) => {
2508
2539
  }, main: {
2509
2540
  // Prevent the "main" content (the Body1 below) from growing too large and pushing the actions/aside out of view.
2510
2541
  className: classes.treeItemLayoutMain,
2511
- }, children: jsx(Body1, { wrap: false, truncate: true, children: name }) }) }, entityItem.entity.uniqueId) }), jsx(MenuPopover, { hidden: !hasChildren, children: jsxs(MenuList, { children: [jsx(MenuItem, { onClick: expandAll, children: jsx(Body1, { children: "Expand All" }) }), jsx(MenuItem, { onClick: collapseAll, children: jsx(Body1, { children: "Collapse All" }) })] }) })] }));
2542
+ }, children: jsx(Body1, { wrap: false, truncate: true, children: name }) }) }, entityItem.entity.uniqueId) }), jsx(MenuPopover, { hidden: !hasChildren && contextMenuCommands.length === 0, children: jsxs(MenuList, { children: [hasChildren && (jsxs(Fragment, { children: [jsx(MenuItem, { icon: jsx(ArrowExpandAllRegular, {}), onClick: expandAll, children: jsx(Body1, { children: "Expand All" }) }), jsx(MenuItem, { icon: jsx(ArrowCollapseAllRegular, {}), onClick: collapseAll, children: jsx(Body1, { children: "Collapse All" }) })] })), hasChildren && contextMenuCommands.length > 0 && jsx(MenuDivider, {}), contextMenuCommands.map((command) => command.type === "action" ? (jsx(MenuItem, { icon: command.icon ? jsx(command.icon, {}) : undefined, onClick: () => command.execute(), children: command.displayName }, command.displayName)) : (jsx(MenuItemCheckbox, {
2543
+ // Don't show both a checkmark and an icon. null means no checkmark, undefined means default (checkmark).
2544
+ checkmark: command.icon ? null : undefined, icon: command.icon ? jsx(command.icon, {}) : undefined, name: "toggleCommands", value: command.displayName, children: command.displayName }, command.displayName)))] }) })] }));
2512
2545
  };
2513
2546
  const SceneExplorer = (props) => {
2514
2547
  const classes = useStyles$b();
@@ -3473,7 +3506,7 @@ const DefaultInspectorExtensionFeed = new BuiltInsExtensionFeed("Inspector", [
3473
3506
  keywords: ["export", "gltf", "glb", "babylon", "exporter", "tools"],
3474
3507
  ...BabylonWebResources,
3475
3508
  author: { name: "Alex Chuber", forumUserName: "alexchuber" },
3476
- getExtensionModuleAsync: async () => await import('./exportService-BB4L49R4.js'),
3509
+ getExtensionModuleAsync: async () => await import('./exportService-BGS52fVw.js'),
3477
3510
  },
3478
3511
  {
3479
3512
  name: "Capture Tools",
@@ -3481,7 +3514,7 @@ const DefaultInspectorExtensionFeed = new BuiltInsExtensionFeed("Inspector", [
3481
3514
  keywords: ["capture", "screenshot", "gif", "video", "tools"],
3482
3515
  ...BabylonWebResources,
3483
3516
  author: { name: "Alex Chuber", forumUserName: "alexchuber" },
3484
- getExtensionModuleAsync: async () => await import('./captureService-DF30oxR-.js'),
3517
+ getExtensionModuleAsync: async () => await import('./captureService-DlzvwY4k.js'),
3485
3518
  },
3486
3519
  {
3487
3520
  name: "Import Tools",
@@ -3489,7 +3522,7 @@ const DefaultInspectorExtensionFeed = new BuiltInsExtensionFeed("Inspector", [
3489
3522
  keywords: ["import", "tools"],
3490
3523
  ...BabylonWebResources,
3491
3524
  author: { name: "Alex Chuber", forumUserName: "alexchuber" },
3492
- getExtensionModuleAsync: async () => await import('./importService-DEe18q7F.js'),
3525
+ getExtensionModuleAsync: async () => await import('./importService-nyYXNIoV.js'),
3493
3526
  },
3494
3527
  ]);
3495
3528
 
@@ -4597,7 +4630,7 @@ function MakeModularTool(options) {
4597
4630
  });
4598
4631
  // Register the extension list service (for browsing/installing extensions) if extension feeds are provided.
4599
4632
  if (extensionFeeds.length > 0) {
4600
- const { ExtensionListServiceDefinition } = await import('./extensionsListService-DcpjIM_c.js');
4633
+ const { ExtensionListServiceDefinition } = await import('./extensionsListService-Ch91ejP8.js');
4601
4634
  await serviceContainer.addServiceAsync(ExtensionListServiceDefinition);
4602
4635
  }
4603
4636
  // Register the theme selector service (for selecting the theme) if theming is configured.
@@ -9275,6 +9308,7 @@ function ShowInspector(scene, options = {}) {
9275
9308
  existingToken.dispose();
9276
9309
  InspectorTokens.delete(scene);
9277
9310
  }
9311
+ InspectorTokens.set(scene, inspectorToken);
9278
9312
  const disposeActions = [];
9279
9313
  const canvasContainerDisplay = parentElement.style.display;
9280
9314
  const canvasContainerChildren = [];
@@ -9436,7 +9470,6 @@ function ConvertOptions(v1Options) {
9436
9470
  // • gizmoCamera: Do users care about this one?
9437
9471
  // • skipDefaultFontLoading: Probably doesn't make sense for Inspector v2 using Fluent.
9438
9472
  // TODO:
9439
- // • explorerExtensibility
9440
9473
  // • contextMenu
9441
9474
  // • contextMenuOverride
9442
9475
  v1Options = {
@@ -9523,6 +9556,32 @@ function ConvertOptions(v1Options) {
9523
9556
  };
9524
9557
  serviceDefinitions.push(additionalNodesServiceDefinition);
9525
9558
  }
9559
+ if (v1Options.explorerExtensibility && v1Options.explorerExtensibility.length > 0) {
9560
+ const { explorerExtensibility } = v1Options;
9561
+ const explorerExtensibilityServiceDefinition = {
9562
+ friendlyName: "Explorer Extensibility",
9563
+ consumes: [SceneExplorerServiceIdentity],
9564
+ factory: (sceneExplorerService) => {
9565
+ const sceneExplorerCommandRegistrations = explorerExtensibility.flatMap((command) => command.entries.map((entry) => sceneExplorerService.addCommand({
9566
+ predicate: (entity) => command.predicate(entity),
9567
+ getCommand: (entity) => {
9568
+ return {
9569
+ displayName: entry.label,
9570
+ type: "action",
9571
+ mode: "contextMenu",
9572
+ execute: () => entry.action(entity),
9573
+ };
9574
+ },
9575
+ })));
9576
+ return {
9577
+ dispose: () => {
9578
+ sceneExplorerCommandRegistrations.forEach((registration) => registration.dispose());
9579
+ },
9580
+ };
9581
+ },
9582
+ };
9583
+ serviceDefinitions.push(explorerExtensibilityServiceDefinition);
9584
+ }
9526
9585
  const v2Options = {
9527
9586
  containerElement: v1Options.globalRoot,
9528
9587
  layoutMode: v1Options.overlay ? "overlay" : "inline",
@@ -9859,4 +9918,4 @@ const TextAreaPropertyLine = (props) => {
9859
9918
  };
9860
9919
 
9861
9920
  export { SettingsContextIdentity as $, useAsyncResource as A, ButtonLine as B, Collapse as C, DebugServiceIdentity as D, ExtensibleAccordion as E, FileUploadLine as F, useCompactMode as G, useSidePaneDockOverrides as H, Inspector as I, useAngleConverters as J, MakeTeachingMoment as K, Link as L, MakeLazyComponent as M, NumberDropdownPropertyLine as N, MakeDialogTeachingMoment as O, PropertiesServiceIdentity as P, InterceptFunction as Q, GetPropertyDescriptor as R, SwitchPropertyLine as S, ToolsServiceIdentity as T, IsPropertyReadonly as U, InterceptProperty as V, ObservableCollection as W, ConstructorFactory as X, SceneContextIdentity as Y, SelectionServiceIdentity as Z, SelectionServiceDefinition as _, SyncedSliderPropertyLine as a, ShowInspector as a0, AccordionSection as a1, Accordion as a2, Button as a3, Checkbox as a4, ColorPickerPopup as a5, InputHexField as a6, InputHsvField as a7, ComboBox as a8, DraggableLine as a9, Color4PropertyLine as aA, HexPropertyLine as aB, TextInputPropertyLine as aC, NumberInputPropertyLine as aD, LinkPropertyLine as aE, PropertyLine as aF, LineContainer as aG, PlaceholderPropertyLine as aH, SpinButtonPropertyLine as aI, StringifiedPropertyLine as aJ, TextAreaPropertyLine as aK, TextPropertyLine as aL, RotationVectorPropertyLine as aM, QuaternionPropertyLine as aN, Vector2PropertyLine as aO, Vector3PropertyLine as aP, Vector4PropertyLine as aQ, Dropdown as aa, NumberDropdown as ab, StringDropdown as ac, FactorGradientComponent as ad, Color3GradientComponent as ae, Color4GradientComponent as af, ColorStepGradientComponent as ag, InfoLabel as ah, List as ai, MessageBar as aj, PositionedPopover as ak, SearchBar as al, SearchBox as am, SpinButton as an, Switch as ao, SyncedSliderInput as ap, Textarea as aq, TextInput as ar, ToggleButton as as, FactorGradientList as at, Color3GradientList as au, Color4GradientList as av, Pane as aw, BooleanBadgePropertyLine as ax, CheckboxPropertyLine as ay, Color3PropertyLine as az, ShellServiceIdentity as b, MakePopoverTeachingMoment as c, TeachingMoment as d, SidePaneContainer as e, SceneExplorerServiceIdentity as f, SettingsServiceIdentity as g, StatsServiceIdentity as h, StringDropdownPropertyLine as i, BoundProperty as j, LinkToEntityPropertyLine as k, BuiltInsExtensionFeed as l, useProperty as m, useVector3Property as n, useColor3Property as o, useColor4Property as p, useQuaternionProperty as q, MakePropertyHook as r, useInterceptObservable as s, useEventfulState as t, useExtensionManager as u, useObservableState as v, useObservableCollection as w, useOrderedObservableCollection as x, usePollingObservable as y, useResource as z };
9862
- //# sourceMappingURL=index-B-XOu4uI.js.map
9921
+ //# sourceMappingURL=index-ByzP7-y_.js.map