import React from 'react'; import type { RouteProps } from 'react-router-dom'; import type { Harmony, SlotRegistry } from '@teambit/harmony'; import { type LaneCompareProps as DefaultLaneCompareProps } from '@teambit/lanes.ui.compare.lane-compare'; import type { UiUI } from '@teambit/ui'; import type { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router'; import type { ScopeUI } from '@teambit/scope'; import type { WorkspaceUI } from '@teambit/workspace'; import type { ComponentUI } from '@teambit/component'; import { ComponentID } from '@teambit/component'; import type { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props'; import type { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu'; import type { LaneOverviewLine, LaneOverviewLineSlot } from '@teambit/lanes.ui.lane-overview'; import type { LanesNavPlugin, LanesOrderedNavigationSlot } from '@teambit/lanes.ui.menus.lanes-overview-menu'; import { LanesModel } from '@teambit/lanes.ui.models.lanes-model'; import type { IgnoreDerivingFromUrl, UseLanes } from '@teambit/lanes.hooks.use-lanes'; import { LanesProvider } from '@teambit/lanes.hooks.use-lanes'; import type { ComponentCompareUI } from '@teambit/component-compare'; import type { CommandBarUI } from '@teambit/command-bar'; export type LaneCompareProps = Partial; export type LaneProviderIgnoreSlot = SlotRegistry; /** * Stable, module-scope tabs list. Previously this array (and the `React.createElement(...)` for each * tab's element) was constructed inside `getLaneCompare`, which means every render produced a new * array and new tab-element references. Those flowed into `` → `resolvedTabs` * (useMemo keyed on input ref) → new value → new `allTabs` prop on every `InlineComponentCompare`, * defeating React.memo and forcing all 10 component panels (and their nested tabs) to re-render on * every parent re-render — including every `setViewMode` click. Hoisting the array to module scope * gives a single stable reference that survives any number of parent renders. */ /** * Slot signature for `LanesUI.registerCompareTab`. Kept for back-compat — the canonical inline * compare-tab list is now owned by `ComponentCompareUI` (so single-component compare and * lane-compare share one source). Tabs registered here are merged on top of that list. */ export type LaneCompareTabSlot = SlotRegistry; export declare function useComponentFilters(): { loading: boolean; log?: undefined; } | { loading: boolean; log: { head: string; }; }; export declare function useLaneComponentIdFromUrl(): ComponentID | undefined | null; export declare function useComponentId(): string | undefined; export declare class LanesUI { private componentUI; private componentCompareUI; private routeSlot; private navSlot; private menuWidgetSlot; /** * overview line slot to add new lines beneath the overview section */ private overviewSlot; private laneProviderIgnoreSlot; /** * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`; * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted * by `order` before being passed to ``. */ private compareTabSlot; private workspace?; private scope?; static dependencies: import("@teambit/harmony").Aspect[]; static runtime: import("@teambit/harmony").RuntimeDefinition; static slots: (((registerFn: () => string) => SlotRegistry) | ((registerFn: () => string) => SlotRegistry) | ((registerFn: () => string) => SlotRegistry) | ((registerFn: () => string) => SlotRegistry) | ((registerFn: () => string) => SlotRegistry))[]; constructor(componentUI: ComponentUI, componentCompareUI: ComponentCompareUI, routeSlot: RouteSlot, navSlot: LanesOrderedNavigationSlot, menuWidgetSlot: MenuWidgetSlot, /** * overview line slot to add new lines beneath the overview section */ overviewSlot: LaneOverviewLineSlot, laneProviderIgnoreSlot: LaneProviderIgnoreSlot, /** * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`; * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted * by `order` before being passed to ``. */ compareTabSlot: LaneCompareTabSlot, workspace?: WorkspaceUI | undefined, scope?: ScopeUI | undefined); private readonly lanesHost; private readonly hostAspect?; private readonly host; private registerHostAspectRoutes; getLaneRoutes(): { path: string; children: React.JSX.Element; }[]; overrideComputeLaneUrl(fn: () => { prefix: string; path: string; getLaneIdFromPathname: typeof LanesModel.getLaneIdFromPathname; getLaneUrl: typeof LanesModel.getLaneUrl; getLaneComponentUrl: typeof LanesModel.getLaneComponentUrl; }): void; getLaneComponent(): React.JSX.Element; getLaneComponentMenu(): React.JSX.Element; getLaneOverview(): React.JSX.Element; getLanesComparePage(): React.JSX.Element; getMenuRoutes(): { path: string; children: React.JSX.Element; }[]; getLanesOverviewMenu(): React.JSX.Element; registerMenuWidget(...menuItems: MenuWidget[]): this; registerLaneProviderIgnoreSlot(ignoreFn: IgnoreDerivingFromUrl): this; private registerLanesRoutes; private registerRoutes; getLanesSwitcher(): React.JSX.Element; getLanesProvider(): typeof LanesProvider; getUseLanes(): UseLanes; private registerLanesDropdown; private renderContext; registerRoute(route: RouteProps): this; /** * register a new line beneath the lane overview section. */ registerOverviewLine(...lines: LaneOverviewLine[]): this; registerNavigation(routes: LanesNavPlugin[]): void; /** * Register an inline compare tab. Aspects own their compare-tab entry and call this in their * own UI provider (e.g. the docs aspect registers `inline-docs` so it can pass its real * `titleBadges` / `overviewOptions` slots). Tabs are merged with the lanes-side fallback list, * deduped by `id`, and sorted by `order` at render time. */ registerCompareTab(tab: TabItem | TabItem[]): this; private _resolvedCompareTabs?; private _resolvedCompareTabsKey?; private resolveCompareTabs; getLaneCompare: (props: LaneCompareProps) => React.JSX.Element | null; static provider([uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI]: [ UiUI, ComponentUI, WorkspaceUI, ScopeUI, ComponentCompareUI, CommandBarUI ], _: any, [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot, compareTabSlot]: [ RouteSlot, LaneOverviewLineSlot, LanesOrderedNavigationSlot, MenuWidgetSlot, LaneProviderIgnoreSlot, LaneCompareTabSlot ], harmony: Harmony): Promise; } export default LanesUI;