@itwin/appui-react 5.34.0 → 5.35.1

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 (81) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts +6 -2
  3. package/lib/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
  4. package/lib/appui-react/configurableui/ConfigurableUiContent.js +9 -2
  5. package/lib/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
  6. package/lib/appui-react/framework/FrameworkFrontstages.d.ts +1 -0
  7. package/lib/appui-react/framework/FrameworkFrontstages.d.ts.map +1 -1
  8. package/lib/appui-react/framework/FrameworkFrontstages.js.map +1 -1
  9. package/lib/appui-react/framework/FrameworkVisibility.d.ts +3 -1
  10. package/lib/appui-react/framework/FrameworkVisibility.d.ts.map +1 -1
  11. package/lib/appui-react/framework/FrameworkVisibility.js.map +1 -1
  12. package/lib/appui-react/frontstage/InternalFrontstageManager.d.ts.map +1 -1
  13. package/lib/appui-react/frontstage/InternalFrontstageManager.js +6 -0
  14. package/lib/appui-react/frontstage/InternalFrontstageManager.js.map +1 -1
  15. package/lib/appui-react/keyboardshortcut/KeyboardShortcutUtilities.d.ts.map +1 -1
  16. package/lib/appui-react/keyboardshortcut/KeyboardShortcutUtilities.js +6 -1
  17. package/lib/appui-react/keyboardshortcut/KeyboardShortcutUtilities.js.map +1 -1
  18. package/lib/appui-react/layout/_widgetopacity.scss +1 -1
  19. package/lib/appui-react/layout/state/NineZoneAction.d.ts +3 -6
  20. package/lib/appui-react/layout/state/NineZoneAction.d.ts.map +1 -1
  21. package/lib/appui-react/layout/state/NineZoneAction.js.map +1 -1
  22. package/lib/appui-react/layout/state/NineZoneStateReducer.d.ts.map +1 -1
  23. package/lib/appui-react/layout/state/NineZoneStateReducer.js +5 -4
  24. package/lib/appui-react/layout/state/NineZoneStateReducer.js.map +1 -1
  25. package/lib/appui-react/layout/widget/Tab.d.ts.map +1 -1
  26. package/lib/appui-react/layout/widget/Tab.js +25 -28
  27. package/lib/appui-react/layout/widget/Tab.js.map +1 -1
  28. package/lib/appui-react/popup/CardPopup.d.ts.map +1 -1
  29. package/lib/appui-react/popup/CardPopup.js +3 -1
  30. package/lib/appui-react/popup/CardPopup.js.map +1 -1
  31. package/lib/appui-react/popup/ToolbarPopup.d.ts.map +1 -1
  32. package/lib/appui-react/popup/ToolbarPopup.js +3 -1
  33. package/lib/appui-react/popup/ToolbarPopup.js.map +1 -1
  34. package/lib/appui-react/shared/ToolItemDef.d.ts.map +1 -1
  35. package/lib/appui-react/shared/ToolItemDef.js +6 -5
  36. package/lib/appui-react/shared/ToolItemDef.js.map +1 -1
  37. package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.d.ts.map +1 -1
  38. package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.js +4 -2
  39. package/lib/appui-react/statusfields/toolassistance/ToolAssistanceField.js.map +1 -1
  40. package/lib/appui-react/theme/ThemeId.d.ts +3 -1
  41. package/lib/appui-react/theme/ThemeId.d.ts.map +1 -1
  42. package/lib/appui-react/theme/ThemeId.js +3 -1
  43. package/lib/appui-react/theme/ThemeId.js.map +1 -1
  44. package/lib/appui-react/toolbar/Toolbar.d.ts +3 -1
  45. package/lib/appui-react/toolbar/Toolbar.d.ts.map +1 -1
  46. package/lib/appui-react/toolbar/Toolbar.js.map +1 -1
  47. package/lib/appui-react/toolbar/ToolbarComposer.d.ts.map +1 -1
  48. package/lib/appui-react/toolbar/ToolbarComposer.js +13 -5
  49. package/lib/appui-react/toolbar/ToolbarComposer.js.map +1 -1
  50. package/lib/appui-react/toolbar/ToolbarWithOverflow.d.ts +3 -1
  51. package/lib/appui-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
  52. package/lib/appui-react/toolbar/ToolbarWithOverflow.js.map +1 -1
  53. package/lib/appui-react/toolbar/new-toolbars/Surface.d.ts.map +1 -1
  54. package/lib/appui-react/toolbar/new-toolbars/Surface.js +1 -0
  55. package/lib/appui-react/toolbar/new-toolbars/Surface.js.map +1 -1
  56. package/lib/appui-react/toolbar/new-toolbars/Surface.scss +1 -6
  57. package/lib/appui-react/tools/CoreToolDefinitions.d.ts.map +1 -1
  58. package/lib/appui-react/tools/CoreToolDefinitions.js +37 -133
  59. package/lib/appui-react/tools/CoreToolDefinitions.js.map +1 -1
  60. package/lib/appui-react/tools/defineToolIcons.d.ts +3 -0
  61. package/lib/appui-react/tools/defineToolIcons.d.ts.map +1 -0
  62. package/lib/appui-react/tools/defineToolIcons.js +45 -0
  63. package/lib/appui-react/tools/defineToolIcons.js.map +1 -0
  64. package/lib/appui-react/uistate/AppUiSettings.d.ts +6 -0
  65. package/lib/appui-react/uistate/AppUiSettings.d.ts.map +1 -1
  66. package/lib/appui-react/uistate/AppUiSettings.js +15 -0
  67. package/lib/appui-react/uistate/AppUiSettings.js.map +1 -1
  68. package/lib/appui-react/widgets/NavigationWidgetComposer.d.ts.map +1 -1
  69. package/lib/appui-react/widgets/NavigationWidgetComposer.js +4 -1
  70. package/lib/appui-react/widgets/NavigationWidgetComposer.js.map +1 -1
  71. package/lib/appui-react/widgets/ToolWidgetComposer.d.ts.map +1 -1
  72. package/lib/appui-react/widgets/ToolWidgetComposer.js +3 -1
  73. package/lib/appui-react/widgets/ToolWidgetComposer.js.map +1 -1
  74. package/lib/appui-react.d.ts.map +1 -1
  75. package/lib/appui-react.js +2 -0
  76. package/lib/appui-react.js.map +1 -1
  77. package/lib/cjs/appui-react/layout/_widgetopacity.scss +1 -1
  78. package/lib/cjs/appui-react/toolbar/new-toolbars/Surface.scss +1 -6
  79. package/lib/esm/appui-react/layout/_widgetopacity.scss +1 -1
  80. package/lib/esm/appui-react/toolbar/new-toolbars/Surface.scss +1 -6
  81. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarComposer.js","sourceRoot":"","sources":["../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":"A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,QAAQ;gBAAE,SAAS;YAExB,2CAA2C;YAC3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,4DAA4D;gBAC5D,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport { produce } from \"immer\";\nimport {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport { Logger, ProcessDetector } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport { ToolbarDragInteractionContext } from \"./DragInteraction.js\";\nimport type {\n CommonToolbarItem,\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem.js\";\nimport {\n isToolbarActionItem,\n isToolbarGroupItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem.js\";\nimport { Toolbar } from \"./Toolbar.js\";\nimport { useActiveStageProvidedToolbarItems } from \"./useActiveStageProvidedToolbarItems.js\";\nimport { useActiveToolId } from \"../hooks/useActiveToolId.js\";\nimport { ConditionalBooleanValue } from \"../shared/ConditionalValue.js\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher.js\";\n\nfunction addItemToSpecifiedParentGroup<T extends ToolbarItem>(\n items: readonly T[],\n groupChildren: Array<ToolbarActionItem | ToolbarGroupItem>\n): T[] {\n const outItems: T[] = [];\n for (const toolbarItem of items) {\n if (!isToolbarGroupItem(toolbarItem)) {\n outItems.push(toolbarItem);\n continue;\n }\n\n const newChildren = addItemToSpecifiedParentGroup(\n toolbarItem.items,\n groupChildren\n );\n const foundIndices: number[] = [];\n\n groupChildren.forEach((entry, index) => {\n if (entry.parentGroupItemId === toolbarItem.id) {\n foundIndices.push(index);\n }\n });\n\n if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort((a, b) => a - b)\n .reverse()\n .forEach((foundIndex) => {\n newChildren.push(groupChildren[foundIndex]);\n groupChildren.splice(foundIndex);\n });\n }\n\n outItems.push({ ...toolbarItem, items: newChildren });\n }\n return outItems;\n}\n\nfunction cloneGroup(inGroup: ToolbarGroupItem): ToolbarGroupItem {\n const childItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n inGroup.items.forEach((item) => {\n if (isToolbarGroupItem(item)) childItems.push(cloneGroup(item));\n else childItems.push(item);\n });\n\n const clonedGroup = { ...inGroup, items: childItems };\n return clonedGroup;\n}\n\nfunction getItemSortValue(item: ToolbarItem) {\n const groupValue = undefined === item.groupPriority ? 0 : item.groupPriority;\n return groupValue * 10000 + item.itemPriority;\n}\n\nfunction sortItems(items: ReadonlyArray<ToolbarItem>): ToolbarItem[] {\n return [...items]\n .sort((a, b) => getItemSortValue(a) - getItemSortValue(b))\n .map((i) => {\n if (isToolbarGroupItem(i)) {\n return { ...i, items: sortItems(i.items) };\n }\n return i;\n });\n}\n\n/**\n * Create a forEach handler that will add every element of an array of ToolbarItems\n * to a list of items that can then be replaced in its proper place, ensuring that\n * the same item, from different list, is not added multiple times.\n * @param items Output list of items\n * @param groupChildren Output list of group children to redistribute.\n * @returns Array<ToolbarItem>.forEach handler.\n */\nfunction addIfNotDuplicate(\n items: ToolbarItem[],\n groupChildren: (ToolbarActionItem | ToolbarGroupItem)[]\n): (value: ToolbarItem) => void {\n return (srcItem: ToolbarItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n // if the default item is a group that an addon may insert into copy it so we don't mess with original\n const toolbarItem = isToolbarGroupItem(srcItem)\n ? cloneGroup(srcItem)\n : srcItem;\n if (\n (isToolbarGroupItem(toolbarItem) || isToolbarActionItem(toolbarItem)) &&\n toolbarItem.parentGroupItemId\n )\n groupChildren.push(toolbarItem);\n else items.push(toolbarItem);\n }\n };\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n defaultItems: ReadonlyArray<ToolbarItem>,\n addonItems: ReadonlyArray<ToolbarItem>\n): ToolbarItem[] {\n let items: ToolbarItem[] = [];\n const groupChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n\n defaultItems.forEach(addIfNotDuplicate(items, groupChildren));\n addonItems.forEach(addIfNotDuplicate(items, groupChildren));\n\n // if an item from an addon has specified a parent group then try to find it and insert it. If no parent is found, add item at root level.\n if (groupChildren.length) {\n items = addItemToSpecifiedParentGroup(items, groupChildren);\n\n groupChildren.forEach((toolbarItem) => {\n Logger.logWarning(\n \"ToolbarComposer\",\n `Requested Parent Group [${toolbarItem.parentGroupItemId!}] not found, so item [${\n toolbarItem.id\n }] is added directly to toolbar.`\n );\n items.push(toolbarItem);\n });\n }\n\n return sortItems(items);\n}\n\nconst useProximityOpacitySetting = () => {\n const [proximityOpacity, setProximityOpacity] = React.useState(\n UiFramework.visibility.useProximityOpacity // eslint-disable-line @typescript-eslint/no-deprecated\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(\n () => setProximityOpacity(UiFramework.visibility.useProximityOpacity) // eslint-disable-line @typescript-eslint/no-deprecated\n );\n }, []);\n\n return proximityOpacity;\n};\n\nconst useSnapWidgetOpacitySetting = () => {\n const [snapWidgetOpacity, setSnapWidgetOpacity] = React.useState(\n UiFramework.visibility.snapWidgetOpacity\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(() =>\n setSnapWidgetOpacity(UiFramework.visibility.snapWidgetOpacity)\n );\n }, []);\n\n return snapWidgetOpacity;\n};\n\n/** Properties for the [[ToolbarComposer]] React components\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ToolbarComposer>`\n */\nexport interface ExtensibleToolbarProps {\n /** Toolbar items to be displayed in addition to the provided toolbar items. */\n items: ToolbarItem[];\n /** Toolbar usage based on which additional toolbar items are added from UI item providers. */\n usage: ToolbarUsage;\n /** Toolbar orientation. */\n orientation: ToolbarOrientation;\n /** Describes the ids of active toolbar items.\n * By default only the toolbar item with id that matches the active `Tool` id is active.\n * @note Property {@link CommonToolbarItem.isActiveCondition} takes precedence when determining the active state of a toolbar item.\n */\n activeItemIds?: string[];\n}\n\n/**\n * Toolbar that is populated and maintained by UI item providers.\n * @note Overrides {@link CommonToolbarItem.isActive} property based on the active tool id, unless {@link ExtensibleToolbarProps.activeItemIds} is specified.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function ToolbarComposer(props: ExtensibleToolbarProps) {\n const { usage, orientation, activeItemIds: activeItemIdsProp } = props;\n\n // process items from addon UI providers\n const addonItems = useActiveStageProvidedToolbarItems(usage, orientation);\n\n const allItems = React.useMemo(() => {\n return combineItems(props.items, addonItems);\n }, [props.items, addonItems]);\n\n const activeToolId = useActiveToolId();\n const activeItemIds = React.useMemo(\n () => activeItemIdsProp ?? (activeToolId ? [activeToolId] : []),\n [activeItemIdsProp, activeToolId]\n );\n const activeConditionalItemIds = useActiveConditionalItemIds(allItems);\n const items = React.useMemo(() => {\n return updateActiveItems(allItems, [\n ...activeItemIds,\n ...activeConditionalItemIds,\n ]);\n }, [allItems, activeItemIds, activeConditionalItemIds]);\n\n const isDragEnabled = React.useContext(ToolbarDragInteractionContext);\n const useProximityOpacity = useProximityOpacitySetting();\n const snapWidgetOpacity = useSnapWidgetOpacitySetting();\n\n const expandsTo = toExpandsTo(orientation, usage);\n const panelAlignment = toPanelAlignment(orientation, usage);\n return (\n <Toolbar\n enableOverflow={true}\n expandsTo={expandsTo}\n panelAlignment={panelAlignment}\n items={items}\n useDragInteraction={isDragEnabled}\n toolbarOpacitySetting={\n (useProximityOpacity || snapWidgetOpacity) &&\n !ProcessDetector.isMobileBrowser\n ? ToolbarOpacitySetting.Proximity\n : ToolbarOpacitySetting.Defaults\n }\n />\n );\n}\n\nfunction toExpandsTo(orientation: ToolbarOrientation, usage: ToolbarUsage) {\n if (orientation === ToolbarOrientation.Vertical) {\n if (usage === ToolbarUsage.ViewNavigation) return Direction.Left;\n return Direction.Right;\n }\n\n return Direction.Bottom;\n}\n\nfunction toPanelAlignment(\n orientation: ToolbarOrientation,\n usage: ToolbarUsage\n) {\n if (\n orientation === ToolbarOrientation.Horizontal &&\n usage === ToolbarUsage.ViewNavigation\n )\n return ToolbarPanelAlignment.End;\n\n return ToolbarPanelAlignment.Start;\n}\n\nfunction useActiveConditionalItemIds(items: ToolbarItem[]) {\n const [activeItemIds, setActiveItemIds] = React.useState<string[]>([]);\n const conditionalItems = React.useMemo(() => {\n const conditionals: ToolbarItem[] = [];\n const stack = [...items];\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (current.isActiveCondition) conditionals.push(current);\n\n if (isToolbarGroupItem(current)) {\n for (const child of current.items) {\n stack.push(child);\n }\n }\n }\n return conditionals;\n }, [items]);\n React.useEffect(() => {\n return SyncUiEventDispatcher.onSyncUiEvent.addListener((args) => {\n const newActiveIds: string[] = [];\n for (const item of conditionalItems) {\n ConditionalBooleanValue.refreshValue(\n item.isActiveCondition,\n args.eventIds\n );\n\n const isActive = ConditionalBooleanValue.getValue(\n item.isActiveCondition\n );\n if (isActive) newActiveIds.push(item.id);\n }\n setActiveItemIds(newActiveIds);\n });\n }, [conditionalItems]);\n React.useEffect(() => {\n const newActiveIds: string[] = [];\n for (const item of conditionalItems) {\n const isActive = ConditionalBooleanValue.getValue(item.isActiveCondition);\n if (isActive) newActiveIds.push(item.id);\n }\n setActiveItemIds(newActiveIds);\n }, [conditionalItems]);\n return activeItemIds;\n}\n\n/** @internal */\nexport function updateActiveItems(\n items: ToolbarItem[],\n activeItemIds: string[]\n) {\n return produce(items, (draft) => {\n // Iterative DFS with ancestor backtracking.\n const stack = draft.map((item) => [item, [] as typeof draft] as const);\n\n while (stack.length > 0) {\n const [current, ancestors] = stack.pop()!;\n\n const isActive = activeItemIds.includes(current.id);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n current.isActive = isActive;\n\n if (isToolbarGroupItem(current)) {\n for (const child of current.items) {\n stack.push([child, [...ancestors, current]]);\n }\n }\n\n if (!isActive) continue;\n\n // Mark ancestors of active item as active.\n for (const ancestor of ancestors) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ancestor.isActive = true;\n }\n }\n });\n}\n"]}
1
+ {"version":3,"file":"ToolbarComposer.js","sourceRoot":"","sources":["../../../src/appui-react/toolbar/ToolbarComposer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAOrE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,SAAS,6BAA6B,CACpC,KAAmB,EACnB,aAA0D;IAE1D,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,KAAK,MAAM,WAAW,IAAI,KAAK,EAAE,CAAC;QAChC,IAA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,SAAS,CAAC,GAAG,KAAK,CAAC,GAAG,EAAG,CAAC;YAE1C,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACpD,4DAA4D;YAC5D,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAE5B,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;gBAChC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;oBAClC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;gBAC/C,CAAC;YACH,CAAC;YAED,IAAI,CAAC,QAAQ;gBAAE,SAAS;YAExB,2CAA2C;YAC3C,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,4DAA4D;gBAC5D,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport { produce } from \"immer\";\nimport {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport { Logger, ProcessDetector } from \"@itwin/core-bentley\";\nimport { UiFramework } from \"../UiFramework.js\";\nimport { ToolbarDragInteractionContext } from \"./DragInteraction.js\";\nimport type {\n CommonToolbarItem,\n ToolbarActionItem,\n ToolbarGroupItem,\n ToolbarItem,\n} from \"./ToolbarItem.js\";\nimport {\n isToolbarActionItem,\n isToolbarGroupItem,\n ToolbarOrientation,\n ToolbarUsage,\n} from \"./ToolbarItem.js\";\nimport { Toolbar } from \"./Toolbar.js\";\nimport { useActiveStageProvidedToolbarItems } from \"./useActiveStageProvidedToolbarItems.js\";\nimport { useActiveToolId } from \"../hooks/useActiveToolId.js\";\nimport { ConditionalBooleanValue } from \"../shared/ConditionalValue.js\";\nimport { SyncUiEventDispatcher } from \"../syncui/SyncUiEventDispatcher.js\";\n\nfunction addItemToSpecifiedParentGroup<T extends ToolbarItem>(\n items: readonly T[],\n groupChildren: Array<ToolbarActionItem | ToolbarGroupItem>\n): T[] {\n const outItems: T[] = [];\n for (const toolbarItem of items) {\n if (!isToolbarGroupItem(toolbarItem)) {\n outItems.push(toolbarItem);\n continue;\n }\n\n const newChildren = addItemToSpecifiedParentGroup(\n toolbarItem.items,\n groupChildren\n );\n const foundIndices: number[] = [];\n\n groupChildren.forEach((entry, index) => {\n if (entry.parentGroupItemId === toolbarItem.id) {\n foundIndices.push(index);\n }\n });\n\n if (foundIndices.length) {\n // process in reverse order so groupChildren can be reduced as we find matches\n foundIndices\n .sort((a, b) => a - b)\n .reverse()\n .forEach((foundIndex) => {\n newChildren.push(groupChildren[foundIndex]);\n groupChildren.splice(foundIndex);\n });\n }\n\n outItems.push({ ...toolbarItem, items: newChildren });\n }\n return outItems;\n}\n\nfunction cloneGroup(inGroup: ToolbarGroupItem): ToolbarGroupItem {\n const childItems: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n inGroup.items.forEach((item) => {\n if (isToolbarGroupItem(item)) childItems.push(cloneGroup(item));\n else childItems.push(item);\n });\n\n const clonedGroup = { ...inGroup, items: childItems };\n return clonedGroup;\n}\n\nfunction getItemSortValue(item: ToolbarItem) {\n const groupValue = undefined === item.groupPriority ? 0 : item.groupPriority;\n return groupValue * 10000 + item.itemPriority;\n}\n\nfunction sortItems(items: ReadonlyArray<ToolbarItem>): ToolbarItem[] {\n return [...items]\n .sort((a, b) => getItemSortValue(a) - getItemSortValue(b))\n .map((i) => {\n if (isToolbarGroupItem(i)) {\n return { ...i, items: sortItems(i.items) };\n }\n return i;\n });\n}\n\n/**\n * Create a forEach handler that will add every element of an array of ToolbarItems\n * to a list of items that can then be replaced in its proper place, ensuring that\n * the same item, from different list, is not added multiple times.\n * @param items Output list of items\n * @param groupChildren Output list of group children to redistribute.\n * @returns Array<ToolbarItem>.forEach handler.\n */\nfunction addIfNotDuplicate(\n items: ToolbarItem[],\n groupChildren: (ToolbarActionItem | ToolbarGroupItem)[]\n): (value: ToolbarItem) => void {\n return (srcItem: ToolbarItem) => {\n if (-1 === items.findIndex((item) => item.id === srcItem.id)) {\n // if the default item is a group that an addon may insert into copy it so we don't mess with original\n const toolbarItem = isToolbarGroupItem(srcItem)\n ? cloneGroup(srcItem)\n : srcItem;\n if (\n (isToolbarGroupItem(toolbarItem) || isToolbarActionItem(toolbarItem)) &&\n toolbarItem.parentGroupItemId\n )\n groupChildren.push(toolbarItem);\n else items.push(toolbarItem);\n }\n };\n}\n\n/** local function to combine items from Stage and from Extensions */\nfunction combineItems(\n defaultItems: ReadonlyArray<ToolbarItem>,\n addonItems: ReadonlyArray<ToolbarItem>\n): ToolbarItem[] {\n let items: ToolbarItem[] = [];\n const groupChildren: Array<ToolbarActionItem | ToolbarGroupItem> = [];\n\n defaultItems.forEach(addIfNotDuplicate(items, groupChildren));\n addonItems.forEach(addIfNotDuplicate(items, groupChildren));\n\n // if an item from an addon has specified a parent group then try to find it and insert it. If no parent is found, add item at root level.\n if (groupChildren.length) {\n items = addItemToSpecifiedParentGroup(items, groupChildren);\n\n groupChildren.forEach((toolbarItem) => {\n Logger.logWarning(\n \"ToolbarComposer\",\n `Requested Parent Group [${toolbarItem.parentGroupItemId!}] not found, so item [${\n toolbarItem.id\n }] is added directly to toolbar.`\n );\n items.push(toolbarItem);\n });\n }\n\n return sortItems(items);\n}\n\nconst useProximityOpacitySetting = () => {\n const [proximityOpacity, setProximityOpacity] = React.useState(\n UiFramework.visibility.useProximityOpacity // eslint-disable-line @typescript-eslint/no-deprecated\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(\n () => setProximityOpacity(UiFramework.visibility.useProximityOpacity) // eslint-disable-line @typescript-eslint/no-deprecated\n );\n }, []);\n\n return proximityOpacity;\n};\n\nconst useSnapWidgetOpacitySetting = () => {\n const [snapWidgetOpacity, setSnapWidgetOpacity] = React.useState(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n UiFramework.visibility.snapWidgetOpacity\n );\n\n React.useEffect(() => {\n UiFramework.onUiVisibilityChanged.addListener(() =>\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n setSnapWidgetOpacity(UiFramework.visibility.snapWidgetOpacity)\n );\n }, []);\n\n return snapWidgetOpacity;\n};\n\n/** Properties for the [[ToolbarComposer]] React components\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ToolbarComposer>`\n */\nexport interface ExtensibleToolbarProps {\n /** Toolbar items to be displayed in addition to the provided toolbar items. */\n items: ToolbarItem[];\n /** Toolbar usage based on which additional toolbar items are added from UI item providers. */\n usage: ToolbarUsage;\n /** Toolbar orientation. */\n orientation: ToolbarOrientation;\n /** Describes the ids of active toolbar items.\n * By default only the toolbar item with id that matches the active `Tool` id is active.\n * @note Property {@link CommonToolbarItem.isActiveCondition} takes precedence when determining the active state of a toolbar item.\n */\n activeItemIds?: string[];\n}\n\n/**\n * Toolbar that is populated and maintained by UI item providers.\n * @note Overrides {@link CommonToolbarItem.isActive} property based on the active tool id, unless {@link ExtensibleToolbarProps.activeItemIds} is specified.\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function ToolbarComposer(props: ExtensibleToolbarProps) {\n const { usage, orientation, activeItemIds: activeItemIdsProp } = props;\n\n // process items from addon UI providers\n const addonItems = useActiveStageProvidedToolbarItems(usage, orientation);\n\n const allItems = React.useMemo(() => {\n return combineItems(props.items, addonItems);\n }, [props.items, addonItems]);\n\n const activeToolId = useActiveToolId();\n const activeItemIds = React.useMemo(\n () => activeItemIdsProp ?? (activeToolId ? [activeToolId] : []),\n [activeItemIdsProp, activeToolId]\n );\n const activeConditionalItemIds = useActiveConditionalItemIds(allItems);\n const items = React.useMemo(() => {\n return updateActiveItems(allItems, [\n ...activeItemIds,\n ...activeConditionalItemIds,\n ]);\n }, [allItems, activeItemIds, activeConditionalItemIds]);\n\n const isDragEnabled = React.useContext(ToolbarDragInteractionContext);\n const useProximityOpacity = useProximityOpacitySetting();\n const snapWidgetOpacity = useSnapWidgetOpacitySetting();\n\n const expandsTo = toExpandsTo(orientation, usage);\n const panelAlignment = toPanelAlignment(orientation, usage);\n return (\n <Toolbar\n enableOverflow={true}\n expandsTo={expandsTo}\n panelAlignment={panelAlignment}\n items={items}\n useDragInteraction={isDragEnabled}\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n toolbarOpacitySetting={\n (useProximityOpacity || snapWidgetOpacity) &&\n !ProcessDetector.isMobileBrowser\n ? // eslint-disable-next-line @typescript-eslint/no-deprecated\n ToolbarOpacitySetting.Proximity\n : // eslint-disable-next-line @typescript-eslint/no-deprecated\n ToolbarOpacitySetting.Defaults\n }\n />\n );\n}\n\nfunction toExpandsTo(orientation: ToolbarOrientation, usage: ToolbarUsage) {\n if (orientation === ToolbarOrientation.Vertical) {\n if (usage === ToolbarUsage.ViewNavigation) return Direction.Left;\n return Direction.Right;\n }\n\n return Direction.Bottom;\n}\n\nfunction toPanelAlignment(\n orientation: ToolbarOrientation,\n usage: ToolbarUsage\n) {\n if (\n orientation === ToolbarOrientation.Horizontal &&\n usage === ToolbarUsage.ViewNavigation\n )\n return ToolbarPanelAlignment.End;\n\n return ToolbarPanelAlignment.Start;\n}\n\nfunction useActiveConditionalItemIds(items: ToolbarItem[]) {\n const [activeItemIds, setActiveItemIds] = React.useState<string[]>([]);\n const conditionalItems = React.useMemo(() => {\n const conditionals: ToolbarItem[] = [];\n const stack = [...items];\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (current.isActiveCondition) conditionals.push(current);\n\n if (isToolbarGroupItem(current)) {\n for (const child of current.items) {\n stack.push(child);\n }\n }\n }\n return conditionals;\n }, [items]);\n React.useEffect(() => {\n return SyncUiEventDispatcher.onSyncUiEvent.addListener((args) => {\n const newActiveIds: string[] = [];\n for (const item of conditionalItems) {\n ConditionalBooleanValue.refreshValue(\n item.isActiveCondition,\n args.eventIds\n );\n\n const isActive = ConditionalBooleanValue.getValue(\n item.isActiveCondition\n );\n if (isActive) newActiveIds.push(item.id);\n }\n setActiveItemIds(newActiveIds);\n });\n }, [conditionalItems]);\n React.useEffect(() => {\n const newActiveIds: string[] = [];\n for (const item of conditionalItems) {\n const isActive = ConditionalBooleanValue.getValue(item.isActiveCondition);\n if (isActive) newActiveIds.push(item.id);\n }\n setActiveItemIds(newActiveIds);\n }, [conditionalItems]);\n return activeItemIds;\n}\n\n/** @internal */\nexport function updateActiveItems(\n items: ToolbarItem[],\n activeItemIds: string[]\n) {\n return produce(items, (draft) => {\n // Iterative DFS with ancestor backtracking.\n const stack = draft.map((item) => [item, [] as typeof draft] as const);\n\n while (stack.length > 0) {\n const [current, ancestors] = stack.pop()!;\n\n const isActive = activeItemIds.includes(current.id);\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n current.isActive = isActive;\n\n if (isToolbarGroupItem(current)) {\n for (const child of current.items) {\n stack.push([child, [...ancestors, current]]);\n }\n }\n\n if (!isActive) continue;\n\n // Mark ancestors of active item as active.\n for (const ancestor of ancestors) {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ancestor.isActive = true;\n }\n }\n });\n}\n"]}
@@ -20,7 +20,9 @@ export interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {
20
20
  panelAlignment?: ToolbarPanelAlignment;
21
21
  /** Use Drag Interaction to open popups with nest action buttons */
22
22
  useDragInteraction?: boolean;
23
- /** Determines whether to use mouse proximity to alter the opacity of the toolbar */
23
+ /** Determines whether to use mouse proximity to alter the opacity of the toolbar.
24
+ * @deprecated in 5.35.0. Use the default configuration.
25
+ */
24
26
  toolbarOpacitySetting?: ToolbarOpacitySetting;
25
27
  /** Optional function to call on any item execution */
26
28
  onItemExecuted?: OnItemExecutedFunc;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD;;GAEG;AAEH,MAAM,WAAW,wBAAyB,SAAQ,WAAW,EAAE,eAAe;IAC5E,2OAA2O;IAC3O,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,4GAA4G;IAC5G,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,uGAAuG;IACvG,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oFAAoF;IACpF,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,sDAAsD;IACtD,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,qBAGlE"}
1
+ {"version":3,"file":"ToolbarWithOverflow.d.ts","sourceRoot":"","sources":["../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OA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E,GAAG,KAAK,CAAC;IACrD,OAAO,oBAAC,OAAO,IAAC,cAAc,EAAE,EAAE,iBAAiB,EAAE,KAAM,YAAY,GAAI,CAAC;AAC9E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport type { OnItemExecutedFunc } from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport type {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport type { ToolbarItem } from \"./ToolbarItem.js\";\nimport { Toolbar } from \"./Toolbar.js\";\n\n/** Component that displays toolbar items.\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded, also defines the orientation of the toolbar (Top/Bottom will create an horizontal toolbar, Left/Right will create a vertical toolbar). Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: ToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar */\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays toolbar items, displaying only the elements that can fit in the available space,\n * and put the other items into a single panel.\n * @beta\n */\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const { overflowExpandsTo, ...toolbarProps } = props;\n return <Toolbar enableOverflow={{ overflowExpandsTo }} {...toolbarProps} />;\n}\n"]}
1
+ {"version":3,"file":"ToolbarWithOverflow.js","sourceRoot":"","sources":["../../../src/appui-react/toolbar/ToolbarWithOverflow.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA4BvC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,CAAC;IACrD,OAAO,oBAAC,OAAO,IAAC,cAAc,EAAE,EAAE,iBAAiB,EAAE,KAAM,YAAY,GAAI,CAAC;AAC9E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport * as React from \"react\";\nimport type { OnItemExecutedFunc } from \"@itwin/appui-abstract\";\nimport type { CommonProps, NoChildrenProps } from \"@itwin/core-react\";\nimport type {\n Direction,\n ToolbarOpacitySetting,\n ToolbarPanelAlignment,\n} from \"@itwin/components-react\";\nimport type { ToolbarItem } from \"./ToolbarItem.js\";\nimport { Toolbar } from \"./Toolbar.js\";\n\n/** Component that displays toolbar items.\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface ToolbarWithOverflowProps extends CommonProps, NoChildrenProps {\n /** Describes to which direction the popup panels are expanded, also defines the orientation of the toolbar (Top/Bottom will create an horizontal toolbar, Left/Right will create a vertical toolbar). Defaults to: [[Direction.Bottom]] */\n expandsTo?: Direction;\n /** Describes to which direction the overflow popup panels are expanded. Defaults to: [[Direction.Right]] */\n overflowExpandsTo?: Direction;\n /** Definitions for items of the toolbar. Items are expected to be already sorted by group and item. */\n items: ToolbarItem[];\n /** Describes how expanded panels are aligned. Defaults to: [[ToolbarPanelAlignment.Start]] */\n panelAlignment?: ToolbarPanelAlignment;\n /** Use Drag Interaction to open popups with nest action buttons */\n useDragInteraction?: boolean;\n /** Determines whether to use mouse proximity to alter the opacity of the toolbar.\n * @deprecated in 5.35.0. Use the default configuration.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n toolbarOpacitySetting?: ToolbarOpacitySetting;\n /** Optional function to call on any item execution */\n onItemExecuted?: OnItemExecutedFunc;\n /** Optional function to call on any KeyDown events processed by toolbar */\n onKeyDown?: (e: React.KeyboardEvent) => void;\n}\n\n/** Component that displays toolbar items, displaying only the elements that can fit in the available space,\n * and put the other items into a single panel.\n * @beta\n */\nexport function ToolbarWithOverflow(props: ToolbarWithOverflowProps) {\n const { overflowExpandsTo, ...toolbarProps } = props;\n return <Toolbar enableOverflow={{ overflowExpandsTo }} {...toolbarProps} />;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/new-toolbars/Surface.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,KAAK,mBAAmB,GAAG,WAAW,CACpC,KAAK,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CACzC,CAAC;AAEF,UAAU,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC;IACrE,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;CACjD;AAED,gBAAgB;AAChB,eAAO,MAAM,OAAO,kGAiCnB,CAAC"}
1
+ {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/new-toolbars/Surface.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,KAAK,mBAAmB,GAAG,WAAW,CACpC,KAAK,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CACzC,CAAC;AAEF,UAAU,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC;IACrE,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;CACjD;AAED,gBAAgB;AAChB,eAAO,MAAM,OAAO,kGAkCnB,CAAC"}
@@ -21,6 +21,7 @@ export const Surface = React.forwardRef(function Surface({ className, style, ori
21
21
  const calculateOpacity = useConditionalValue(() => {
22
22
  if (ProcessDetector.isMobileBrowser)
23
23
  return false;
24
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
24
25
  if (UiFramework.visibility.snapWidgetOpacity)
25
26
  return true;
26
27
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/new-toolbars/Surface.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,OAAO,EACP,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OA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QAAQ,WAAW,EAAE,EACrB,SAAS,CACV,EACD,GAAG,EAAE,IAAI,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport \"./Surface.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Surface as IUI_Surface } from \"@itwin/itwinui-react\";\nimport {\n calculateToolbarOpacity,\n getToolbarBackgroundColor,\n useRefs,\n useWidgetOpacityContext,\n} from \"@itwin/core-react/internal\";\nimport { UiFramework } from \"../../UiFramework.js\";\nimport { ProcessDetector } from \"@itwin/core-bentley\";\nimport { useConditionalValue } from \"../../hooks/useConditionalValue.js\";\nimport { SyncUiEventId } from \"../../syncui/UiSyncEvent.js\";\nimport type { ToolbarContext } from \"./Toolbar.js\";\n\ntype ToolbarContextProps = NonNullable<\n React.ContextType<typeof ToolbarContext>\n>;\n\ninterface SurfaceProps extends React.ComponentProps<typeof IUI_Surface> {\n orientation: ToolbarContextProps[\"orientation\"];\n}\n\n/** @internal */\nexport const Surface = React.forwardRef<HTMLDivElement, SurfaceProps>(\n function Surface({ className, style, orientation, ...rest }, forwardedRed) {\n const { ref, proximityScale } = useWidgetOpacityContext<HTMLDivElement>();\n const refs = useRefs(ref, forwardedRed);\n\n const calculateOpacity = useConditionalValue(() => {\n if (ProcessDetector.isMobileBrowser) return false;\n if (UiFramework.visibility.snapWidgetOpacity) return true;\n return false;\n }, [SyncUiEventId.ShowHideManagerSettingChange]);\n const opacity = React.useMemo(() => {\n if (!calculateOpacity) return undefined;\n return calculateToolbarOpacity(proximityScale);\n }, [proximityScale, calculateOpacity]);\n const backgroundColor =\n opacity === undefined ? undefined : getToolbarBackgroundColor(opacity);\n\n return (\n <IUI_Surface\n {...rest}\n style={{\n backgroundColor,\n ...style,\n }}\n className={classnames(\n \"uifw-toolbar-group-surface\",\n `uifw-${orientation}`,\n className\n )}\n ref={refs}\n />\n );\n }\n);\n"]}
1
+ {"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../../../src/appui-react/toolbar/new-toolbars/Surface.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,OAAO,EACP,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAW5D,gBAAgB;AAChB,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CACrC,SAAS,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY;IACvE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,uBAAuB,EAAkB,CAAC;IAC1E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAExC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,EAAE;QAChD,IAAI,eAAe,CAAC,eAAe;YAAE,OAAO,KAAK,CAAC;QAClD,4DAA4D;QAC5D,IAAI,WAAW,CAAC,UAAU,CAAC,iBAAiB;YAAE,OAAO,IAAI,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACjC,IAAI,CAAC,gBAAgB;YAAE,OAAO,SAAS,CAAC;QACxC,OAAO,uBAAuB,CAAC,cAAc,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACvC,MAAM,eAAe,GACnB,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAEzE,OAAO,CACL,oBAAC,WAAW,OACN,IAAI,EACR,KAAK,EAAE;YACL,eAAe;YACf,GAAG,KAAK;SACT,EACD,SAAS,EAAE,UAAU,CACnB,4BAA4B,EAC5B,QAAQ,WAAW,EAAE,EACrB,SAAS,CACV,EACD,GAAG,EAAE,IAAI,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Toolbar\n */\n\nimport \"./Surface.scss\";\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Surface as IUI_Surface } from \"@itwin/itwinui-react\";\nimport {\n calculateToolbarOpacity,\n getToolbarBackgroundColor,\n useRefs,\n useWidgetOpacityContext,\n} from \"@itwin/core-react/internal\";\nimport { UiFramework } from \"../../UiFramework.js\";\nimport { ProcessDetector } from \"@itwin/core-bentley\";\nimport { useConditionalValue } from \"../../hooks/useConditionalValue.js\";\nimport { SyncUiEventId } from \"../../syncui/UiSyncEvent.js\";\nimport type { ToolbarContext } from \"./Toolbar.js\";\n\ntype ToolbarContextProps = NonNullable<\n React.ContextType<typeof ToolbarContext>\n>;\n\ninterface SurfaceProps extends React.ComponentProps<typeof IUI_Surface> {\n orientation: ToolbarContextProps[\"orientation\"];\n}\n\n/** @internal */\nexport const Surface = React.forwardRef<HTMLDivElement, SurfaceProps>(\n function Surface({ className, style, orientation, ...rest }, forwardedRed) {\n const { ref, proximityScale } = useWidgetOpacityContext<HTMLDivElement>();\n const refs = useRefs(ref, forwardedRed);\n\n const calculateOpacity = useConditionalValue(() => {\n if (ProcessDetector.isMobileBrowser) return false;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if (UiFramework.visibility.snapWidgetOpacity) return true;\n return false;\n }, [SyncUiEventId.ShowHideManagerSettingChange]);\n const opacity = React.useMemo(() => {\n if (!calculateOpacity) return undefined;\n return calculateToolbarOpacity(proximityScale);\n }, [proximityScale, calculateOpacity]);\n const backgroundColor =\n opacity === undefined ? undefined : getToolbarBackgroundColor(opacity);\n\n return (\n <IUI_Surface\n {...rest}\n style={{\n backgroundColor,\n ...style,\n }}\n className={classnames(\n \"uifw-toolbar-group-surface\",\n `uifw-${orientation}`,\n className\n )}\n ref={refs}\n />\n );\n }\n);\n"]}
@@ -15,12 +15,7 @@
15
15
  // TODO: fixes an issues on Safari where borders and backgrounds are overlapped by the viewport.
16
16
  position: relative;
17
17
 
18
- @supports (backdrop-filter: blur(5px)) {
19
- background-color: hsl(
20
- var(--iui-color-background-hsl) / var(--iui-opacity-2)
21
- );
22
- backdrop-filter: blur(5px);
23
- }
18
+ background-color: var(--iui-color-background);
24
19
 
25
20
  &.uifw-vertical {
26
21
  flex-direction: column;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAiBvD;;;GAGG;AACH,qBAAa,SAAS;IACpB,WAAkB,yBAAyB,gBAW1C;IAED,WAAkB,cAAc,gBAa/B;IAED,WAAkB,iBAAiB,gBAYlC;IAED,WAAkB,eAAe,gBAYhC;IAED,WAAkB,cAAc,gBAY/B;IAED,WAAkB,iBAAiB,gBAoBlC;IAED,WAAkB,eAAe,gBAoBhC;IAED,WAAkB,oBAAoB,gBAQrC;IAED,WAAkB,mBAAmB,gBAQpC;IAED,WAAkB,uBAAuB,gBA2CxC;IAED,WAAkB,cAAc,gBAY/B;IAID,WAAkB,eAAe,gBAqBhC;IAED,WAAkB,eAAe,gBAqBhC;IAED,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,8BAA8B,gBAc/C;IAGD,WAAkB,4BAA4B,gBAc7C;IAGD,WAAkB,4BAA4B,gBAc7C;IAED,WAAkB,gBAAgB,iBA0BjC;IAED,WAAkB,yBAAyB,iBAuC1C;IAGD,WAAkB,0BAA0B,gBAU3C;IAGD,WAAkB,0BAA0B,gBAU3C;IAED,WAAkB,gBAAgB,iBAWjC;IAED,WAAkB,qBAAqB,mBAgBtC;IAED,WAAkB,qCAAqC,gBAUtD;CACF"}
1
+ {"version":3,"file":"CoreToolDefinitions.d.ts","sourceRoot":"","sources":["../../../src/appui-react/tools/CoreToolDefinitions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAgCH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAYvD;;;GAGG;AACH,qBAAa,SAAS;IACpB,WAAkB,yBAAyB,gBAW1C;IAED,WAAkB,cAAc,gBAS/B;IAED,WAAkB,iBAAiB,gBAQlC;IAED,WAAkB,eAAe,gBAQhC;IAED,WAAkB,cAAc,gBAQ/B;IAED,WAAkB,iBAAiB,gBAQlC;IAED,WAAkB,eAAe,gBAgBhC;IAED,WAAkB,oBAAoB,gBAErC;IAED,WAAkB,mBAAmB,gBAEpC;IAED,WAAkB,uBAAuB,gBA6BxC;IAED,WAAkB,cAAc,gBAQ/B;IAID,WAAkB,eAAe,gBAiBhC;IAED,WAAkB,eAAe,gBAiBhC;IAED,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,WAAkB,4BAA4B,gBAU7C;IAGD,WAAkB,8BAA8B,gBAU/C;IAGD,WAAkB,4BAA4B,gBAU7C;IAGD,WAAkB,4BAA4B,gBAU7C;IAED,WAAkB,gBAAgB,iBA0BjC;IAED,WAAkB,yBAAyB,iBAuC1C;IAGD,WAAkB,0BAA0B,gBAE3C;IAGD,WAAkB,0BAA0B,gBAE3C;IAED,WAAkB,gBAAgB,iBAWjC;IAED,WAAkB,qBAAqB,mBAgBtC;IAED,WAAkB,qCAAqC,gBAEtD;CACF"}
@@ -8,7 +8,7 @@
8
8
  import * as React from "react";
9
9
  import { FitViewTool, FlyViewTool, IModelApp, MeasureDistanceTool, MeasureLocationTool, PanViewTool, RotateViewTool, SelectionTool, SetupWalkCameraTool, ViewClipByElementTool, ViewClipByPlaneTool, ViewClipByRangeTool, ViewClipByShapeTool, ViewClipDecorationProvider, ViewRedoTool, ViewToggleCameraTool, ViewUndoTool, WalkViewTool, WindowAreaTool, ZoomViewTool, } from "@itwin/core-frontend";
10
10
  import { ConditionalBooleanValue, ConditionalStringValue, } from "@itwin/appui-abstract";
11
- import { SvgCameraAnimation, SvgCameraAnimationDisabled, } from "@itwin/itwinui-icons-react";
11
+ import { ToolUtilities } from "@itwin/imodel-components-react";
12
12
  import { getIsHiddenIfSelectionNotActive } from "../selection/SelectionContextItemDef.js";
13
13
  import { CommandItemDef } from "../shared/CommandItemDef.js";
14
14
  import { ToolItemDef } from "../shared/ToolItemDef.js";
@@ -16,11 +16,9 @@ import { SyncUiEventId } from "../syncui/UiSyncEvent.js";
16
16
  import { GroupItemDef } from "../toolbar/GroupItem.js";
17
17
  import { RestoreFrontstageLayoutTool } from "./RestoreLayoutTool.js";
18
18
  import { UiFramework } from "../UiFramework.js";
19
- import { SvgGyroscope } from "../icons/SvgGyroscope.js";
20
19
  import { SvgSectionTool } from "../icons/SvgSectionTool.js";
21
20
  import { SvgSelectionClear } from "../icons/SvgSelectionClear.js";
22
- import { SvgMeasure, SvgProcess, SvgRotateLeft, } from "@itwin/itwinui-icons-react";
23
- import { ConditionalIconItem } from "@itwin/core-react";
21
+ import { SvgMeasure, SvgProcess } from "@itwin/itwinui-icons-react";
24
22
  import { getActiveViewport } from "../utils/getActiveViewport.js";
25
23
  /* eslint-disable @typescript-eslint/no-deprecated */
26
24
  /** Utility Class that provides definitions of tools provided by the ($core-frontend) core. These definitions can be used to populate the UI.
@@ -39,65 +37,32 @@ export class CoreTools {
39
37
  });
40
38
  }
41
39
  static get fitViewCommand() {
42
- return new ToolItemDef({
43
- toolId: FitViewTool.toolId,
44
- iconSpec: FitViewTool.iconSpec,
45
- label: FitViewTool.flyover,
46
- description: FitViewTool.description,
40
+ return createForTool(FitViewTool, {
47
41
  execute: async () => IModelApp.tools.run(FitViewTool.toolId, IModelApp.viewManager.selectedView, true),
48
42
  });
49
43
  }
50
44
  static get windowAreaCommand() {
51
- return new ToolItemDef({
52
- toolId: WindowAreaTool.toolId,
53
- iconSpec: WindowAreaTool.iconSpec,
54
- label: WindowAreaTool.flyover,
55
- description: WindowAreaTool.description,
45
+ return createForTool(WindowAreaTool, {
56
46
  execute: async () => IModelApp.tools.run(WindowAreaTool.toolId, IModelApp.viewManager.selectedView),
57
47
  });
58
48
  }
59
49
  static get zoomViewCommand() {
60
- return new ToolItemDef({
61
- toolId: ZoomViewTool.toolId,
62
- iconSpec: ZoomViewTool.iconSpec,
63
- label: ZoomViewTool.flyover,
64
- description: ZoomViewTool.description,
50
+ return createForTool(ZoomViewTool, {
65
51
  execute: async () => IModelApp.tools.run(ZoomViewTool.toolId, IModelApp.viewManager.selectedView),
66
52
  });
67
53
  }
68
54
  static get panViewCommand() {
69
- return new ToolItemDef({
70
- toolId: PanViewTool.toolId,
71
- iconSpec: PanViewTool.iconSpec,
72
- label: PanViewTool.flyover,
73
- description: PanViewTool.description,
55
+ return createForTool(PanViewTool, {
74
56
  execute: async () => IModelApp.tools.run(PanViewTool.toolId, IModelApp.viewManager.selectedView),
75
57
  });
76
58
  }
77
59
  static get rotateViewCommand() {
78
- return new ToolItemDef({
79
- toolId: RotateViewTool.toolId,
80
- icon: new ConditionalIconItem(() => {
81
- const viewport = getActiveViewport();
82
- if (viewport?.view.is2d())
83
- return React.createElement(SvgRotateLeft, null);
84
- return React.createElement(SvgGyroscope, null);
85
- }, [
86
- SyncUiEventId.ActiveContentChanged,
87
- SyncUiEventId.ActiveViewportChanged,
88
- SyncUiEventId.ViewStateChanged,
89
- ]),
90
- label: RotateViewTool.flyover,
91
- description: RotateViewTool.description,
60
+ return createForTool(RotateViewTool, {
92
61
  execute: async () => IModelApp.tools.run(RotateViewTool.toolId, IModelApp.viewManager.selectedView),
93
62
  });
94
63
  }
95
64
  static get walkViewCommand() {
96
- return new ToolItemDef({
97
- toolId: WalkViewTool.toolId,
98
- iconSpec: WalkViewTool.iconSpec,
99
- label: WalkViewTool.flyover,
100
- description: WalkViewTool.description,
65
+ return createForTool(WalkViewTool, {
101
66
  isHidden: new ConditionalBooleanValue(() => {
102
67
  const viewport = getActiveViewport();
103
68
  return !!viewport?.view.is2d();
@@ -110,37 +75,13 @@ export class CoreTools {
110
75
  });
111
76
  }
112
77
  static get selectElementCommand() {
113
- return new ToolItemDef({
114
- toolId: SelectionTool.toolId,
115
- iconSpec: SelectionTool.iconSpec,
116
- label: SelectionTool.flyover,
117
- description: SelectionTool.description,
118
- execute: async () => IModelApp.tools.run(SelectionTool.toolId),
119
- });
78
+ return createForTool(SelectionTool);
120
79
  }
121
80
  static get setupCameraWalkTool() {
122
- return new ToolItemDef({
123
- toolId: SetupWalkCameraTool.toolId,
124
- iconSpec: SetupWalkCameraTool.iconSpec,
125
- label: SetupWalkCameraTool.flyover,
126
- description: SetupWalkCameraTool.description,
127
- execute: async () => IModelApp.tools.run(SetupWalkCameraTool.toolId),
128
- });
81
+ return createForTool(SetupWalkCameraTool);
129
82
  }
130
83
  static get toggleCameraViewCommand() {
131
- return new ToolItemDef({
132
- toolId: ViewToggleCameraTool.toolId,
133
- iconSpec: new ConditionalIconItem(() => {
134
- const viewport = getActiveViewport();
135
- if (viewport?.view.is3d() && viewport?.isCameraOn) {
136
- return React.createElement(SvgCameraAnimation, null);
137
- }
138
- return React.createElement(SvgCameraAnimationDisabled, null);
139
- }, [
140
- SyncUiEventId.ActiveContentChanged,
141
- SyncUiEventId.ActiveViewportChanged,
142
- SyncUiEventId.ViewStateChanged,
143
- ]),
84
+ return createForTool(ViewToggleCameraTool, {
144
85
  label: new ConditionalStringValue(() => {
145
86
  const viewport = getActiveViewport();
146
87
  if (viewport?.view.is3d() && viewport?.isCameraOn) {
@@ -152,7 +93,6 @@ export class CoreTools {
152
93
  SyncUiEventId.ActiveViewportChanged,
153
94
  SyncUiEventId.ViewStateChanged,
154
95
  ]),
155
- description: ViewToggleCameraTool.description,
156
96
  isHidden: new ConditionalBooleanValue(() => {
157
97
  const viewport = getActiveViewport();
158
98
  return !(viewport?.view.is3d() && viewport?.view.supportsCamera());
@@ -165,19 +105,14 @@ export class CoreTools {
165
105
  });
166
106
  }
167
107
  static get flyViewCommand() {
168
- return new ToolItemDef({
169
- toolId: FlyViewTool.toolId,
170
- iconSpec: FlyViewTool.iconSpec,
171
- label: FlyViewTool.flyover,
172
- description: FlyViewTool.description,
108
+ return createForTool(FlyViewTool, {
173
109
  execute: async () => IModelApp.tools.run(FlyViewTool.toolId, IModelApp.viewManager.selectedView),
174
110
  });
175
111
  }
176
112
  // TODO - Need to provide a sync message that is fired when the Undo/Redo button needs to be refreshed in the
177
113
  // active view.
178
114
  static get viewUndoCommand() {
179
- return new ToolItemDef({
180
- toolId: ViewUndoTool.toolId,
115
+ return createForTool(ViewUndoTool, {
181
116
  isDisabled: new ConditionalBooleanValue(() => {
182
117
  const viewport = getActiveViewport();
183
118
  if (!viewport)
@@ -188,18 +123,11 @@ export class CoreTools {
188
123
  SyncUiEventId.ActiveViewportChanged,
189
124
  SyncUiEventId.ViewStateChanged,
190
125
  ]),
191
- iconSpec: ViewUndoTool.iconSpec,
192
- label: ViewUndoTool.flyover,
193
- description: ViewUndoTool.description,
194
126
  execute: async () => IModelApp.tools.run(ViewUndoTool.toolId, IModelApp.viewManager.selectedView),
195
127
  });
196
128
  }
197
129
  static get viewRedoCommand() {
198
- return new ToolItemDef({
199
- toolId: ViewRedoTool.toolId,
200
- iconSpec: ViewRedoTool.iconSpec,
201
- label: ViewRedoTool.flyover,
202
- description: ViewRedoTool.description,
130
+ return createForTool(ViewRedoTool, {
203
131
  execute: async () => IModelApp.tools.run(ViewRedoTool.toolId, IModelApp.viewManager.selectedView),
204
132
  isDisabled: new ConditionalBooleanValue(() => {
205
133
  const viewport = getActiveViewport();
@@ -222,11 +150,7 @@ export class CoreTools {
222
150
  }
223
151
  // note current ViewClipByPlaneTool is not automatically registered so the app must call ViewClipByPlaneTool.register();
224
152
  static get sectionByPlaneCommandItemDef() {
225
- return new ToolItemDef({
226
- toolId: ViewClipByPlaneTool.toolId,
227
- iconSpec: ViewClipByPlaneTool.iconSpec,
228
- label: ViewClipByPlaneTool.flyover,
229
- description: ViewClipByPlaneTool.description,
153
+ return createForTool(ViewClipByPlaneTool, {
230
154
  execute: async () => {
231
155
  this.turnOnClipVolume();
232
156
  return IModelApp.tools.run(ViewClipByPlaneTool.toolId, ViewClipDecorationProvider.create());
@@ -235,11 +159,7 @@ export class CoreTools {
235
159
  }
236
160
  // note current ViewClipByElementTool is not automatically registered so the app must call ViewClipByElementTool.register();
237
161
  static get sectionByElementCommandItemDef() {
238
- return new ToolItemDef({
239
- toolId: ViewClipByElementTool.toolId,
240
- iconSpec: ViewClipByElementTool.iconSpec,
241
- label: ViewClipByElementTool.flyover,
242
- description: ViewClipByElementTool.description,
162
+ return createForTool(ViewClipByElementTool, {
243
163
  execute: async () => {
244
164
  this.turnOnClipVolume();
245
165
  return IModelApp.tools.run(ViewClipByElementTool.toolId, ViewClipDecorationProvider.create());
@@ -248,11 +168,7 @@ export class CoreTools {
248
168
  }
249
169
  // note current ViewClipByRangeTool is not automatically registered so the app must call ViewClipByRangeTool.register();
250
170
  static get sectionByRangeCommandItemDef() {
251
- return new ToolItemDef({
252
- toolId: ViewClipByRangeTool.toolId,
253
- iconSpec: ViewClipByRangeTool.iconSpec,
254
- label: ViewClipByRangeTool.flyover,
255
- description: ViewClipByRangeTool.description,
171
+ return createForTool(ViewClipByRangeTool, {
256
172
  execute: async () => {
257
173
  this.turnOnClipVolume();
258
174
  return IModelApp.tools.run(ViewClipByRangeTool.toolId, ViewClipDecorationProvider.create());
@@ -261,11 +177,7 @@ export class CoreTools {
261
177
  }
262
178
  // note current ViewClipByShapeTool is not automatically registered so the app must call ViewClipByShapeTool.register();
263
179
  static get sectionByShapeCommandItemDef() {
264
- return new ToolItemDef({
265
- toolId: ViewClipByShapeTool.toolId,
266
- iconSpec: ViewClipByShapeTool.iconSpec,
267
- label: ViewClipByShapeTool.flyover,
268
- description: ViewClipByShapeTool.description,
180
+ return createForTool(ViewClipByShapeTool, {
269
181
  execute: async () => {
270
182
  this.turnOnClipVolume();
271
183
  return IModelApp.tools.run(ViewClipByShapeTool.toolId, ViewClipDecorationProvider.create());
@@ -339,27 +251,11 @@ export class CoreTools {
339
251
  }
340
252
  // note current MeasureDistanceTool is not automatically registered so the app must call MeasureDistanceTool.register();
341
253
  static get measureDistanceToolItemDef() {
342
- return new ToolItemDef({
343
- toolId: MeasureDistanceTool.toolId,
344
- iconSpec: MeasureDistanceTool.iconSpec,
345
- label: MeasureDistanceTool.flyover,
346
- description: MeasureDistanceTool.description,
347
- execute: async () => {
348
- return IModelApp.tools.run(MeasureDistanceTool.toolId);
349
- },
350
- });
254
+ return createForTool(MeasureDistanceTool);
351
255
  }
352
256
  // note current MeasureLocationTool is not automatically registered so the app must call MeasureLocationTool.register();
353
257
  static get measureLocationToolItemDef() {
354
- return new ToolItemDef({
355
- toolId: MeasureLocationTool.toolId,
356
- iconSpec: MeasureLocationTool.iconSpec,
357
- label: MeasureLocationTool.flyover,
358
- description: MeasureLocationTool.description,
359
- execute: async () => {
360
- return IModelApp.tools.run(MeasureLocationTool.toolId);
361
- },
362
- });
258
+ return createForTool(MeasureLocationTool);
363
259
  }
364
260
  static get measureToolGroup() {
365
261
  MeasureDistanceTool.register();
@@ -392,15 +288,23 @@ export class CoreTools {
392
288
  });
393
289
  }
394
290
  static get restoreFrontstageLayoutCommandItemDef() {
395
- return new ToolItemDef({
396
- toolId: RestoreFrontstageLayoutTool.toolId,
397
- iconSpec: RestoreFrontstageLayoutTool.iconSpec,
398
- label: RestoreFrontstageLayoutTool.flyover,
399
- description: RestoreFrontstageLayoutTool.description,
400
- execute: async () => {
401
- return IModelApp.tools.run(RestoreFrontstageLayoutTool.toolId);
402
- },
403
- });
291
+ return createForTool(RestoreFrontstageLayoutTool);
404
292
  }
405
293
  }
294
+ function createForTool(toolType, overrides) {
295
+ const icon = ToolUtilities.isWithIcon(toolType)
296
+ ? toolType.iconElement
297
+ : undefined;
298
+ return new ToolItemDef({
299
+ toolId: toolType.toolId,
300
+ iconSpec: toolType.iconSpec,
301
+ label: toolType.flyover,
302
+ description: toolType.description,
303
+ execute: async () => {
304
+ return IModelApp.tools.run(toolType.toolId);
305
+ },
306
+ ...(icon ? { icon } : {}),
307
+ ...overrides,
308
+ });
309
+ }
406
310
  //# sourceMappingURL=CoreToolDefinitions.js.map