@teambit/lanes 1.0.1100 → 1.0.1102

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.
@@ -8,6 +8,7 @@ import type { ScopeUI } from '@teambit/scope';
8
8
  import type { WorkspaceUI } from '@teambit/workspace';
9
9
  import type { ComponentUI } from '@teambit/component';
10
10
  import { ComponentID } from '@teambit/component';
11
+ import type { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
11
12
  import type { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';
12
13
  import type { LaneOverviewLine, LaneOverviewLineSlot } from '@teambit/lanes.ui.lane-overview';
13
14
  import type { LanesNavPlugin, LanesOrderedNavigationSlot } from '@teambit/lanes.ui.menus.lanes-overview-menu';
@@ -18,6 +19,21 @@ import type { ComponentCompareUI } from '@teambit/component-compare';
18
19
  import type { CommandBarUI } from '@teambit/command-bar';
19
20
  export type LaneCompareProps = Partial<DefaultLaneCompareProps>;
20
21
  export type LaneProviderIgnoreSlot = SlotRegistry<IgnoreDerivingFromUrl>;
22
+ /**
23
+ * Stable, module-scope tabs list. Previously this array (and the `React.createElement(...)` for each
24
+ * tab's element) was constructed inside `getLaneCompare`, which means every render produced a new
25
+ * array and new tab-element references. Those flowed into `<LaneCompare tabs={...}>` → `resolvedTabs`
26
+ * (useMemo keyed on input ref) → new value → new `allTabs` prop on every `InlineComponentCompare`,
27
+ * defeating React.memo and forcing all 10 component panels (and their nested tabs) to re-render on
28
+ * every parent re-render — including every `setViewMode` click. Hoisting the array to module scope
29
+ * gives a single stable reference that survives any number of parent renders.
30
+ */
31
+ /**
32
+ * Slot signature for `LanesUI.registerCompareTab`. Kept for back-compat — the canonical inline
33
+ * compare-tab list is now owned by `ComponentCompareUI` (so single-component compare and
34
+ * lane-compare share one source). Tabs registered here are merged on top of that list.
35
+ */
36
+ export type LaneCompareTabSlot = SlotRegistry<TabItem | TabItem[]>;
21
37
  export declare function useComponentFilters(): {
22
38
  loading: boolean;
23
39
  log?: undefined;
@@ -40,16 +56,28 @@ export declare class LanesUI {
40
56
  */
41
57
  private overviewSlot;
42
58
  private laneProviderIgnoreSlot;
59
+ /**
60
+ * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`;
61
+ * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted
62
+ * by `order` before being passed to `<LaneCompare>`.
63
+ */
64
+ private compareTabSlot;
43
65
  private workspace?;
44
66
  private scope?;
45
67
  static dependencies: import("@teambit/harmony").Aspect[];
46
68
  static runtime: import("@teambit/harmony").RuntimeDefinition;
47
- static slots: (((registerFn: () => string) => SlotRegistry<LaneOverviewLineSlot>) | ((registerFn: () => string) => SlotRegistry<LaneProviderIgnoreSlot>) | ((registerFn: () => string) => SlotRegistry<NavigationSlot>) | ((registerFn: () => string) => SlotRegistry<RouteProps>))[];
69
+ static slots: (((registerFn: () => string) => SlotRegistry<LaneOverviewLineSlot>) | ((registerFn: () => string) => SlotRegistry<LaneProviderIgnoreSlot>) | ((registerFn: () => string) => SlotRegistry<NavigationSlot>) | ((registerFn: () => string) => SlotRegistry<RouteProps>) | ((registerFn: () => string) => SlotRegistry<TabItem[] | TabItem>))[];
48
70
  constructor(componentUI: ComponentUI, componentCompareUI: ComponentCompareUI, routeSlot: RouteSlot, navSlot: LanesOrderedNavigationSlot, menuWidgetSlot: MenuWidgetSlot,
49
71
  /**
50
72
  * overview line slot to add new lines beneath the overview section
51
73
  */
52
- overviewSlot: LaneOverviewLineSlot, laneProviderIgnoreSlot: LaneProviderIgnoreSlot, workspace?: WorkspaceUI | undefined, scope?: ScopeUI | undefined);
74
+ overviewSlot: LaneOverviewLineSlot, laneProviderIgnoreSlot: LaneProviderIgnoreSlot,
75
+ /**
76
+ * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`;
77
+ * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted
78
+ * by `order` before being passed to `<LaneCompare>`.
79
+ */
80
+ compareTabSlot: LaneCompareTabSlot, workspace?: WorkspaceUI | undefined, scope?: ScopeUI | undefined);
53
81
  private readonly lanesHost;
54
82
  private readonly hostAspect?;
55
83
  private readonly host;
@@ -89,6 +117,16 @@ export declare class LanesUI {
89
117
  */
90
118
  registerOverviewLine(...lines: LaneOverviewLine[]): this;
91
119
  registerNavigation(routes: LanesNavPlugin[]): void;
120
+ /**
121
+ * Register an inline compare tab. Aspects own their compare-tab entry and call this in their
122
+ * own UI provider (e.g. the docs aspect registers `inline-docs` so it can pass its real
123
+ * `titleBadges` / `overviewOptions` slots). Tabs are merged with the lanes-side fallback list,
124
+ * deduped by `id`, and sorted by `order` at render time.
125
+ */
126
+ registerCompareTab(tab: TabItem | TabItem[]): this;
127
+ private _resolvedCompareTabs?;
128
+ private _resolvedCompareTabsKey?;
129
+ private resolveCompareTabs;
92
130
  getLaneCompare: (props: LaneCompareProps) => React.JSX.Element | null;
93
131
  static provider([uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI]: [
94
132
  UiUI,
@@ -97,12 +135,13 @@ export declare class LanesUI {
97
135
  ScopeUI,
98
136
  ComponentCompareUI,
99
137
  CommandBarUI
100
- ], _: any, [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot]: [
138
+ ], _: any, [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot, compareTabSlot]: [
101
139
  RouteSlot,
102
140
  LaneOverviewLineSlot,
103
141
  LanesOrderedNavigationSlot,
104
142
  MenuWidgetSlot,
105
- LaneProviderIgnoreSlot
143
+ LaneProviderIgnoreSlot,
144
+ LaneCompareTabSlot
106
145
  ], harmony: Harmony): Promise<LanesUI>;
107
146
  }
108
147
  export default LanesUI;
@@ -70,6 +70,13 @@ function _component() {
70
70
  };
71
71
  return data;
72
72
  }
73
+ function _lodash() {
74
+ const data = require("lodash");
75
+ _lodash = function () {
76
+ return data;
77
+ };
78
+ return data;
79
+ }
73
80
  function _lanesUi() {
74
81
  const data = require("@teambit/lanes.ui.lane-overview");
75
82
  _lanesUi = function () {
@@ -174,6 +181,21 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
174
181
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
175
182
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
176
183
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
184
+ /**
185
+ * Stable, module-scope tabs list. Previously this array (and the `React.createElement(...)` for each
186
+ * tab's element) was constructed inside `getLaneCompare`, which means every render produced a new
187
+ * array and new tab-element references. Those flowed into `<LaneCompare tabs={...}>` → `resolvedTabs`
188
+ * (useMemo keyed on input ref) → new value → new `allTabs` prop on every `InlineComponentCompare`,
189
+ * defeating React.memo and forcing all 10 component panels (and their nested tabs) to re-render on
190
+ * every parent re-render — including every `setViewMode` click. Hoisting the array to module scope
191
+ * gives a single stable reference that survives any number of parent renders.
192
+ */
193
+ /**
194
+ * Slot signature for `LanesUI.registerCompareTab`. Kept for back-compat — the canonical inline
195
+ * compare-tab list is now owned by `ComponentCompareUI` (so single-component compare and
196
+ * lane-compare share one source). Tabs registered here are merged on top of that list.
197
+ */
198
+
177
199
  function useComponentFilters() {
178
200
  const idFromLocation = (0, _component().useIdFromLocation)(undefined, true);
179
201
  const {
@@ -221,7 +243,13 @@ class LanesUI {
221
243
  /**
222
244
  * overview line slot to add new lines beneath the overview section
223
245
  */
224
- overviewSlot, laneProviderIgnoreSlot, workspace, scope) {
246
+ overviewSlot, laneProviderIgnoreSlot,
247
+ /**
248
+ * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`;
249
+ * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted
250
+ * by `order` before being passed to `<LaneCompare>`.
251
+ */
252
+ compareTabSlot, workspace, scope) {
225
253
  this.componentUI = componentUI;
226
254
  this.componentCompareUI = componentCompareUI;
227
255
  this.routeSlot = routeSlot;
@@ -229,6 +257,7 @@ class LanesUI {
229
257
  this.menuWidgetSlot = menuWidgetSlot;
230
258
  this.overviewSlot = overviewSlot;
231
259
  this.laneProviderIgnoreSlot = laneProviderIgnoreSlot;
260
+ this.compareTabSlot = compareTabSlot;
232
261
  this.workspace = workspace;
233
262
  this.scope = scope;
234
263
  _defineProperty(this, "lanesHost", void 0);
@@ -242,14 +271,20 @@ class LanesUI {
242
271
  ignoreDerivingFromUrl: ignoreFns
243
272
  }, children);
244
273
  });
274
+ // memoize the resolved tab list — same identity across renders unless a new registration lands.
275
+ // The base list is owned by component-compare (so the single-component compare page and
276
+ // lane-compare share one source). We additionally merge in anything registered on this aspect's
277
+ // legacy `compareTabSlot` for back-compat.
278
+ _defineProperty(this, "_resolvedCompareTabs", void 0);
279
+ _defineProperty(this, "_resolvedCompareTabsKey", void 0);
245
280
  _defineProperty(this, "getLaneCompare", props => {
246
- const tabs = this.componentCompareUI.tabs;
247
281
  if (!props.base || !props.compare) return null;
248
282
  return /*#__PURE__*/_react().default.createElement(_lanesUiCompare().LaneCompare, _extends({}, props, {
249
283
  base: props.base,
250
284
  compare: props.compare,
251
285
  host: props.host || this.host,
252
- tabs: props.tabs || tabs
286
+ tabs: props.tabs || this.resolveCompareTabs(),
287
+ apiDiffInsights: props.apiDiffInsights || this.componentCompareUI.getApiDiffInsights()
253
288
  }));
254
289
  });
255
290
  this.hostAspect = workspace || scope;
@@ -440,7 +475,33 @@ class LanesUI {
440
475
  registerNavigation(routes) {
441
476
  this.navSlot.register(routes);
442
477
  }
443
- static async provider([uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI], _, [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot], harmony) {
478
+
479
+ /**
480
+ * Register an inline compare tab. Aspects own their compare-tab entry and call this in their
481
+ * own UI provider (e.g. the docs aspect registers `inline-docs` so it can pass its real
482
+ * `titleBadges` / `overviewOptions` slots). Tabs are merged with the lanes-side fallback list,
483
+ * deduped by `id`, and sorted by `order` at render time.
484
+ */
485
+ registerCompareTab(tab) {
486
+ this.compareTabSlot.register(tab);
487
+ return this;
488
+ }
489
+ resolveCompareTabs() {
490
+ const fromComponentCompare = this.componentCompareUI.resolveCompareTabs();
491
+ const slotEntries = this.compareTabSlot.toArray();
492
+ const localRegistered = (0, _lodash().flatten)(slotEntries.map(([, value]) => value).filter(Boolean));
493
+ const cacheKey = `${fromComponentCompare.map(t => `${t.id}:${t.order ?? 0}`).join(',')}|${localRegistered.map(t => `${t.id}:${t.order ?? 0}`).join(',')}`;
494
+ if (this._resolvedCompareTabs && this._resolvedCompareTabsKey === cacheKey) {
495
+ return this._resolvedCompareTabs;
496
+ }
497
+ const localIds = new Set(localRegistered.map(t => t.id));
498
+ // local registrations take precedence over the component-compare list.
499
+ const merged = [...localRegistered, ...fromComponentCompare.filter(t => !localIds.has(t.id))].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
500
+ this._resolvedCompareTabs = merged;
501
+ this._resolvedCompareTabsKey = cacheKey;
502
+ return merged;
503
+ }
504
+ static async provider([uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI], _, [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot, compareTabSlot], harmony) {
444
505
  const {
445
506
  config
446
507
  } = harmony;
@@ -453,7 +514,7 @@ class LanesUI {
453
514
  if (host === _scope().ScopeAspect.id) {
454
515
  scope = scopeUi;
455
516
  }
456
- const lanesUi = new LanesUI(componentUI, componentCompareUI, routeSlot, navSlot, menuWidgetSlot, overviewSlot, laneProviderIgnoreSlot, workspace, scope);
517
+ const lanesUi = new LanesUI(componentUI, componentCompareUI, routeSlot, navSlot, menuWidgetSlot, overviewSlot, laneProviderIgnoreSlot, compareTabSlot, workspace, scope);
457
518
  if (uiUi) uiUi.registerRenderHooks({
458
519
  reactContext: lanesUi.renderContext
459
520
  });
@@ -485,7 +546,7 @@ class LanesUI {
485
546
  exports.LanesUI = LanesUI;
486
547
  _defineProperty(LanesUI, "dependencies", [_ui().UIAspect, _component().ComponentAspect, _workspace().WorkspaceAspect, _scope().ScopeAspect, _componentCompare().ComponentCompareAspect, _commandBar().CommandBarAspect]);
487
548
  _defineProperty(LanesUI, "runtime", _ui().UIRuntime);
488
- _defineProperty(LanesUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
549
+ _defineProperty(LanesUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
489
550
  var _default = exports.default = LanesUI;
490
551
  _lanes().LanesAspect.addRuntime(LanesUI);
491
552
 
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_reactRouterDom","_harmony","_lanesUiCompare","_ui","_designUiPages","_scope","_workspace","_component","_lanesUi","_lanesUiMenus","_uiFoundationUiReactRouter","_lanesUiMenus2","_lanesUiModels","_lanesHooks","_lanesUiNavigation","_lanesHooks2","_componentCompare","_lanesUiCompare2","_scopeUi","_commandBar","_lanes","_lanesUiModule","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","useComponentFilters","idFromLocation","useIdFromLocation","undefined","lanesModel","loading","useLanes","laneFromUrl","useViewedLaneFromUrl","laneComponentId","isDefault","resolveComponentFromUrl","log","head","version","useLaneComponentIdFromUrl","query","useQuery","componentVersion","compIdFromLocation","ComponentID","tryFromString","lanesComp","changeVersion","useComponentId","toString","LanesUI","constructor","componentUI","componentCompareUI","routeSlot","navSlot","menuWidgetSlot","overviewSlot","laneProviderIgnoreSlot","workspace","scope","children","ignoreFns","values","createElement","LanesProvider","ignoreDerivingFromUrl","props","tabs","base","compare","LaneCompare","host","hostAspect","lanesHost","WorkspaceAspect","id","ScopeAspect","registerHostAspectRoutes","registerRoutes","getLaneRoutes","registerMenuRoutes","getMenuRoutes","path","LanesModel","lanesPrefix","Fragment","Route","lanePath","index","element","getLaneOverview","getLaneComponent","getLanesComparePage","NotFoundPage","overrideComputeLaneUrl","fn","prefix","getLaneComponentUrl","getLaneIdFromPathname","getLaneUrl","getComponentUI","componentId","getLaneComponentMenu","getMenu","LaneOverview","LaneComparePage","getLaneCompare","groupByScope","getLanesOverviewMenu","LanesOverviewMenu","navigationSlot","widgetSlot","registerMenuWidget","menuItems","register","registerLaneProviderIgnoreSlot","ignoreFn","registerLanesRoutes","registerNavigation","href","exact","order","hide","viewedLane","lanes","getLanesSwitcher","mainIcon","useContext","ScopeContext","ScopeIcon","size","scopeImage","icon","bgColor","backgroundIconColor","className","styles","mainLaneIcon","LanesSwitcher","LaneSwitcher","getLanesProvider","getUseLanes","registerLanesDropdown","registerSidebarLink","component","Gallery","weight","registerRoute","route","registerOverviewLine","lines","routes","provider","uiUi","workspaceUi","scopeUi","commandBarUI","_","harmony","config","lanesUi","registerRenderHooks","reactContext","renderContext","currentLane","UseLaneMenu","actionName","actionIcon","viewedLaneId","currentLaneId","CommandBarButton","exports","UIAspect","ComponentAspect","ComponentCompareAspect","CommandBarAspect","UIRuntime","Slot","withType","_default","LanesAspect","addRuntime"],"sources":["lanes.ui.runtime.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport React, { useContext } from 'react';\nimport type { RouteProps } from 'react-router-dom';\nimport { Route } from 'react-router-dom';\nimport type { Harmony, SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport { LaneCompare, type LaneCompareProps as DefaultLaneCompareProps } from '@teambit/lanes.ui.compare.lane-compare';\nimport type { UiUI } from '@teambit/ui';\nimport { UIRuntime, UIAspect } from '@teambit/ui';\nimport type { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { NotFoundPage } from '@teambit/design.ui.pages.not-found';\nimport type { ScopeUI } from '@teambit/scope';\nimport { ScopeAspect, ScopeContext } from '@teambit/scope';\nimport type { WorkspaceUI } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { ComponentUI } from '@teambit/component';\nimport { ComponentAspect, useIdFromLocation, ComponentID } from '@teambit/component';\nimport type { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';\nimport type { LaneOverviewLine, LaneOverviewLineSlot } from '@teambit/lanes.ui.lane-overview';\nimport { LaneOverview } from '@teambit/lanes.ui.lane-overview';\nimport type { LanesNavPlugin, LanesOrderedNavigationSlot } from '@teambit/lanes.ui.menus.lanes-overview-menu';\nimport { LanesOverviewMenu } from '@teambit/lanes.ui.menus.lanes-overview-menu';\nimport { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { UseLaneMenu } from '@teambit/lanes.ui.menus.use-lanes-menu';\nimport type { LanesHost } from '@teambit/lanes.ui.models.lanes-model';\nimport { LanesModel } from '@teambit/lanes.ui.models.lanes-model';\nimport type { IgnoreDerivingFromUrl, UseLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { LanesProvider, useLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { LaneSwitcher } from '@teambit/lanes.ui.navigation.lane-switcher';\nimport { useViewedLaneFromUrl } from '@teambit/lanes.hooks.use-viewed-lane-from-url';\nimport type { ComponentCompareUI } from '@teambit/component-compare';\nimport { ComponentCompareAspect } from '@teambit/component-compare';\nimport { LaneComparePage } from '@teambit/lanes.ui.compare.lane-compare-page';\nimport { ScopeIcon } from '@teambit/scope.ui.scope-icon';\nimport type { CommandBarUI } from '@teambit/command-bar';\nimport { CommandBarAspect } from '@teambit/command-bar';\n\nimport { LanesAspect } from './lanes.aspect';\nimport styles from './lanes.ui.module.scss';\n\nexport type LaneCompareProps = Partial<DefaultLaneCompareProps>;\nexport type LaneProviderIgnoreSlot = SlotRegistry<IgnoreDerivingFromUrl>;\nexport function useComponentFilters() {\n const idFromLocation = useIdFromLocation(undefined, true);\n const { lanesModel, loading } = useLanes();\n const laneFromUrl = useViewedLaneFromUrl();\n const laneComponentId =\n idFromLocation && !laneFromUrl?.isDefault()\n ? (lanesModel?.resolveComponentFromUrl(idFromLocation, laneFromUrl) ?? null)\n : null;\n\n if (laneComponentId === null || loading) {\n return {\n loading: true,\n };\n }\n\n return {\n loading: false,\n log: {\n head: laneComponentId.version,\n },\n };\n}\n\nexport function useLaneComponentIdFromUrl(): ComponentID | undefined | null {\n const idFromLocation = useIdFromLocation(undefined, true);\n const { lanesModel, loading } = useLanes();\n const laneFromUrl = useViewedLaneFromUrl();\n const query = useQuery();\n const componentVersion = query.get('version');\n\n if (!idFromLocation) return null;\n\n const compIdFromLocation = ComponentID.tryFromString(\n `${idFromLocation}${componentVersion ? `@${componentVersion}` : ''}`\n );\n\n if (compIdFromLocation) return compIdFromLocation;\n if (loading) return undefined;\n\n const lanesComp = (lanesModel?.resolveComponentFromUrl(idFromLocation, laneFromUrl) as any | undefined) ?? null;\n\n if (componentVersion) {\n return lanesComp?.changeVersion(componentVersion);\n }\n\n return lanesComp;\n}\n\nexport function useComponentId() {\n return useLaneComponentIdFromUrl()?.toString();\n}\n\nexport class LanesUI {\n static dependencies = [\n UIAspect,\n ComponentAspect,\n WorkspaceAspect,\n ScopeAspect,\n ComponentCompareAspect,\n CommandBarAspect,\n ];\n\n static runtime = UIRuntime;\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<LaneOverviewLineSlot>(),\n Slot.withType<NavigationSlot>(),\n Slot.withType<MenuWidgetSlot>(),\n Slot.withType<LaneProviderIgnoreSlot>(),\n ];\n\n constructor(\n private componentUI: ComponentUI,\n private componentCompareUI: ComponentCompareUI,\n private routeSlot: RouteSlot,\n private navSlot: LanesOrderedNavigationSlot,\n private menuWidgetSlot: MenuWidgetSlot,\n /**\n * overview line slot to add new lines beneath the overview section\n */\n private overviewSlot: LaneOverviewLineSlot,\n private laneProviderIgnoreSlot: LaneProviderIgnoreSlot,\n private workspace?: WorkspaceUI,\n private scope?: ScopeUI\n ) {\n this.hostAspect = workspace || scope;\n this.lanesHost = workspace ? 'workspace' : 'scope';\n this.host = workspace ? WorkspaceAspect.id : ScopeAspect.id;\n }\n\n private readonly lanesHost: LanesHost;\n private readonly hostAspect?: WorkspaceUI | ScopeUI;\n private readonly host: string;\n\n private registerHostAspectRoutes() {\n if (!this.hostAspect) return;\n this.hostAspect.registerRoutes(this.getLaneRoutes());\n this.hostAspect.registerMenuRoutes(this.getMenuRoutes());\n }\n\n getLaneRoutes() {\n return [\n {\n path: LanesModel.lanesPrefix,\n children: (\n <>\n <Route path={LanesModel.lanePath}>\n <Route index element={this.getLaneOverview()} />\n <Route path=\"~component/*\" element={this.getLaneComponent()} />\n <Route path=\"~compare/*\" element={this.getLanesComparePage()} />\n <Route path=\"*\" element={<NotFoundPage />} />\n </Route>\n <Route path=\"*\" element={<NotFoundPage />} />\n </>\n ),\n },\n ];\n }\n\n overrideComputeLaneUrl(\n fn: () => {\n prefix: string;\n path: string;\n getLaneIdFromPathname: typeof LanesModel.getLaneIdFromPathname;\n getLaneUrl: typeof LanesModel.getLaneUrl;\n getLaneComponentUrl: typeof LanesModel.getLaneComponentUrl;\n }\n ) {\n const { prefix, path, getLaneComponentUrl, getLaneIdFromPathname, getLaneUrl } = fn();\n LanesModel.lanesPrefix = prefix;\n LanesModel.lanePath = path;\n LanesModel.getLaneComponentUrl = getLaneComponentUrl;\n LanesModel.getLaneUrl = getLaneUrl;\n LanesModel.getLaneIdFromPathname = getLaneIdFromPathname;\n }\n\n getLaneComponent() {\n return this.componentUI.getComponentUI(this.host, {\n componentId: useComponentId,\n useComponentFilters,\n });\n }\n\n getLaneComponentMenu() {\n return this.componentUI.getMenu(this.host, {\n componentId: useComponentId,\n useComponentFilters,\n });\n }\n\n getLaneOverview() {\n return (\n <LaneOverview\n routeSlot={this.routeSlot}\n overviewSlot={this.overviewSlot}\n host={this.lanesHost}\n useLanes={useLanes}\n />\n );\n }\n\n getLanesComparePage() {\n return <LaneComparePage getLaneCompare={this.getLaneCompare} groupByScope={this.lanesHost === 'workspace'} />;\n }\n\n getMenuRoutes() {\n return [\n {\n path: LanesModel.lanesPrefix,\n children: (\n <Route path={`${LanesModel.lanePath}/*`}>\n <Route path={'*'} element={this.getLanesOverviewMenu()} />\n <Route path=\"~component/*\" element={this.getLaneComponentMenu()} />\n </Route>\n ),\n },\n ];\n }\n\n getLanesOverviewMenu() {\n return <LanesOverviewMenu navigationSlot={this.navSlot} widgetSlot={this.menuWidgetSlot} />;\n }\n\n registerMenuWidget(...menuItems: MenuWidget[]) {\n this.menuWidgetSlot.register(menuItems);\n return this;\n }\n\n registerLaneProviderIgnoreSlot(ignoreFn: IgnoreDerivingFromUrl) {\n this.laneProviderIgnoreSlot.register(ignoreFn);\n return this;\n }\n\n private registerLanesRoutes() {\n this.registerNavigation([\n // {\n // props: {\n // href: '.',\n // exact: true,\n // children: 'README',\n // },\n // order: 1,\n // hide: () => {\n // const { lanesModel } = useLanes();\n // return !lanesModel?.viewedLane?.readmeComponent;\n // },\n // },\n {\n props: {\n href: '.',\n exact: true,\n children: 'Overview',\n },\n order: 1,\n },\n {\n props: {\n href: '~compare',\n children: 'Compare',\n },\n order: 2,\n hide: () => {\n const { lanesModel } = useLanes();\n return !lanesModel?.viewedLane || lanesModel?.lanes.length < 2;\n },\n },\n ]);\n }\n\n private registerRoutes() {\n this.registerHostAspectRoutes();\n this.registerLanesRoutes();\n }\n\n getLanesSwitcher() {\n const mainIcon = () => {\n const scope = useContext(ScopeContext);\n return (\n <ScopeIcon\n size={24}\n scopeImage={scope.icon}\n bgColor={scope.backgroundIconColor}\n className={styles.mainLaneIcon}\n />\n );\n };\n\n const LanesSwitcher = (\n <LaneSwitcher\n groupByScope={this.lanesHost === 'workspace'}\n mainIcon={this.lanesHost === 'scope' ? mainIcon : undefined}\n // @ts-ignore @todo - fix this\n useLanes={useLanes}\n />\n );\n\n return LanesSwitcher;\n }\n\n getLanesProvider() {\n return LanesProvider;\n }\n\n getUseLanes(): UseLanes {\n return useLanes;\n }\n\n private registerLanesDropdown() {\n const LanesSwitcher = this.getLanesSwitcher();\n\n this.hostAspect?.registerSidebarLink({\n component: function Gallery() {\n return LanesSwitcher;\n },\n weight: 1000,\n });\n }\n\n private renderContext = ({ children }: { children: ReactNode }) => {\n const ignoreFns = this.laneProviderIgnoreSlot.values();\n\n return <LanesProvider ignoreDerivingFromUrl={ignoreFns}>{children}</LanesProvider>;\n };\n\n registerRoute(route: RouteProps) {\n this.routeSlot.register(route);\n return this;\n }\n\n /**\n * register a new line beneath the lane overview section.\n */\n registerOverviewLine(...lines: LaneOverviewLine[]) {\n this.overviewSlot.register(lines);\n return this;\n }\n\n registerNavigation(routes: LanesNavPlugin[]) {\n this.navSlot.register(routes);\n }\n\n getLaneCompare = (props: LaneCompareProps) => {\n const tabs = this.componentCompareUI.tabs;\n\n if (!props.base || !props.compare) return null;\n\n return (\n <LaneCompare\n {...props}\n base={props.base}\n compare={props.compare}\n host={props.host || this.host}\n tabs={props.tabs || tabs}\n />\n );\n };\n\n static async provider(\n [uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI]: [\n UiUI,\n ComponentUI,\n WorkspaceUI,\n ScopeUI,\n ComponentCompareUI,\n CommandBarUI,\n ],\n _,\n [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot]: [\n RouteSlot,\n LaneOverviewLineSlot,\n LanesOrderedNavigationSlot,\n MenuWidgetSlot,\n LaneProviderIgnoreSlot,\n ],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n let workspace: WorkspaceUI | undefined;\n let scope: ScopeUI | undefined;\n if (host === WorkspaceAspect.id) {\n workspace = workspaceUi;\n }\n if (host === ScopeAspect.id) {\n scope = scopeUi;\n }\n const lanesUi = new LanesUI(\n componentUI,\n componentCompareUI,\n routeSlot,\n navSlot,\n menuWidgetSlot,\n overviewSlot,\n laneProviderIgnoreSlot,\n workspace,\n scope\n );\n if (uiUi) uiUi.registerRenderHooks({ reactContext: lanesUi.renderContext });\n lanesUi.registerRoutes();\n lanesUi.registerMenuWidget(() => {\n const { lanesModel } = useLanes();\n if (!lanesModel?.viewedLane) return null;\n const { viewedLane, currentLane } = lanesModel;\n return (\n <UseLaneMenu\n actionName={'Import'}\n actionIcon={'terminal'}\n host={lanesUi.lanesHost}\n viewedLaneId={viewedLane.id}\n currentLaneId={currentLane?.id}\n />\n );\n });\n lanesUi.registerLanesDropdown();\n if (workspace) {\n lanesUi.registerMenuWidget(commandBarUI.CommandBarButton);\n }\n return lanesUi;\n }\n}\n\nexport default LanesUI;\n\nLanesAspect.addRuntime(LanesUI);\n"],"mappings":";;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,IAAA;EAAA,MAA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yF,OAAO,CAACvF,SAAU;QACxB+F,YAAY,EAAE7C,UAAU,CAAChD,EAAG;QAC5B8F,aAAa,EAAEL,WAAW,EAAEzF;MAAG,CAChC,CAAC;IAEN,CAAC,CAAC;IACFqF,OAAO,CAAClB,qBAAqB,CAAC,CAAC;IAC/B,IAAIpF,SAAS,EAAE;MACbsG,OAAO,CAAChD,kBAAkB,CAAC4C,YAAY,CAACc,gBAAgB,CAAC;IAC3D;IACA,OAAOV,OAAO;EAChB;AACF;AAACW,OAAA,CAAA1H,OAAA,GAAAA,OAAA;AAAAtC,eAAA,CAvUYsC,OAAO,kBACI,CACpB2H,cAAQ,EACRC,4BAAe,EACfnG,4BAAe,EACfE,oBAAW,EACXkG,0CAAsB,EACtBC,8BAAgB,CACjB;AAAApK,eAAA,CARUsC,OAAO,aAUD+H,eAAS;AAAArK,eAAA,CAVfsC,OAAO,WAWH,CACbgI,eAAI,CAACC,QAAQ,CAAa,CAAC,EAC3BD,eAAI,CAACC,QAAQ,CAAuB,CAAC,EACrCD,eAAI,CAACC,QAAQ,CAAiB,CAAC,EAC/BD,eAAI,CAACC,QAAQ,CAAiB,CAAC,EAC/BD,eAAI,CAACC,QAAQ,CAAyB,CAAC,CACxC;AAAA,IAAAC,QAAA,GAAAR,OAAA,CAAAvL,OAAA,GAwTY6D,OAAO;AAEtBmI,oBAAW,CAACC,UAAU,CAACpI,OAAO,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_reactRouterDom","_harmony","_lanesUiCompare","_ui","_designUiPages","_scope","_workspace","_component","_lodash","_lanesUi","_lanesUiMenus","_uiFoundationUiReactRouter","_lanesUiMenus2","_lanesUiModels","_lanesHooks","_lanesUiNavigation","_lanesHooks2","_componentCompare","_lanesUiCompare2","_scopeUi","_commandBar","_lanes","_lanesUiModule","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","_defineProperty","_toPropertyKey","value","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","useComponentFilters","idFromLocation","useIdFromLocation","undefined","lanesModel","loading","useLanes","laneFromUrl","useViewedLaneFromUrl","laneComponentId","isDefault","resolveComponentFromUrl","log","head","version","useLaneComponentIdFromUrl","query","useQuery","componentVersion","compIdFromLocation","ComponentID","tryFromString","lanesComp","changeVersion","useComponentId","toString","LanesUI","constructor","componentUI","componentCompareUI","routeSlot","navSlot","menuWidgetSlot","overviewSlot","laneProviderIgnoreSlot","compareTabSlot","workspace","scope","children","ignoreFns","values","createElement","LanesProvider","ignoreDerivingFromUrl","props","base","compare","LaneCompare","host","tabs","resolveCompareTabs","apiDiffInsights","getApiDiffInsights","hostAspect","lanesHost","WorkspaceAspect","id","ScopeAspect","registerHostAspectRoutes","registerRoutes","getLaneRoutes","registerMenuRoutes","getMenuRoutes","path","LanesModel","lanesPrefix","Fragment","Route","lanePath","index","element","getLaneOverview","getLaneComponent","getLanesComparePage","NotFoundPage","overrideComputeLaneUrl","fn","prefix","getLaneComponentUrl","getLaneIdFromPathname","getLaneUrl","getComponentUI","componentId","getLaneComponentMenu","getMenu","LaneOverview","LaneComparePage","getLaneCompare","groupByScope","getLanesOverviewMenu","LanesOverviewMenu","navigationSlot","widgetSlot","registerMenuWidget","menuItems","register","registerLaneProviderIgnoreSlot","ignoreFn","registerLanesRoutes","registerNavigation","href","exact","order","hide","viewedLane","lanes","getLanesSwitcher","mainIcon","useContext","ScopeContext","ScopeIcon","size","scopeImage","icon","bgColor","backgroundIconColor","className","styles","mainLaneIcon","LanesSwitcher","LaneSwitcher","getLanesProvider","getUseLanes","registerLanesDropdown","registerSidebarLink","component","Gallery","weight","registerRoute","route","registerOverviewLine","lines","routes","registerCompareTab","tab","fromComponentCompare","slotEntries","toArray","localRegistered","flatten","map","filter","Boolean","cacheKey","join","_resolvedCompareTabs","_resolvedCompareTabsKey","localIds","Set","merged","sort","a","b","provider","uiUi","workspaceUi","scopeUi","commandBarUI","_","harmony","config","lanesUi","registerRenderHooks","reactContext","renderContext","currentLane","UseLaneMenu","actionName","actionIcon","viewedLaneId","currentLaneId","CommandBarButton","exports","UIAspect","ComponentAspect","ComponentCompareAspect","CommandBarAspect","UIRuntime","Slot","withType","_default","LanesAspect","addRuntime"],"sources":["lanes.ui.runtime.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport React, { useContext } from 'react';\nimport type { RouteProps } from 'react-router-dom';\nimport { Route } from 'react-router-dom';\nimport type { Harmony, SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport { LaneCompare, type LaneCompareProps as DefaultLaneCompareProps } from '@teambit/lanes.ui.compare.lane-compare';\nimport type { UiUI } from '@teambit/ui';\nimport { UIRuntime, UIAspect } from '@teambit/ui';\nimport type { NavigationSlot, RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { NotFoundPage } from '@teambit/design.ui.pages.not-found';\nimport type { ScopeUI } from '@teambit/scope';\nimport { ScopeAspect, ScopeContext } from '@teambit/scope';\nimport type { WorkspaceUI } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { ComponentUI } from '@teambit/component';\nimport { ComponentAspect, useIdFromLocation, ComponentID } from '@teambit/component';\nimport type { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';\nimport { flatten } from 'lodash';\nimport type { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';\nimport type { LaneOverviewLine, LaneOverviewLineSlot } from '@teambit/lanes.ui.lane-overview';\nimport { LaneOverview } from '@teambit/lanes.ui.lane-overview';\nimport type { LanesNavPlugin, LanesOrderedNavigationSlot } from '@teambit/lanes.ui.menus.lanes-overview-menu';\nimport { LanesOverviewMenu } from '@teambit/lanes.ui.menus.lanes-overview-menu';\nimport { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { UseLaneMenu } from '@teambit/lanes.ui.menus.use-lanes-menu';\nimport type { LanesHost } from '@teambit/lanes.ui.models.lanes-model';\nimport { LanesModel } from '@teambit/lanes.ui.models.lanes-model';\nimport type { IgnoreDerivingFromUrl, UseLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { LanesProvider, useLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { LaneSwitcher } from '@teambit/lanes.ui.navigation.lane-switcher';\nimport { useViewedLaneFromUrl } from '@teambit/lanes.hooks.use-viewed-lane-from-url';\nimport type { ComponentCompareUI } from '@teambit/component-compare';\nimport { ComponentCompareAspect } from '@teambit/component-compare';\nimport { LaneComparePage } from '@teambit/lanes.ui.compare.lane-compare-page';\nimport { ScopeIcon } from '@teambit/scope.ui.scope-icon';\nimport type { CommandBarUI } from '@teambit/command-bar';\nimport { CommandBarAspect } from '@teambit/command-bar';\n\nimport { LanesAspect } from './lanes.aspect';\nimport styles from './lanes.ui.module.scss';\n\nexport type LaneCompareProps = Partial<DefaultLaneCompareProps>;\nexport type LaneProviderIgnoreSlot = SlotRegistry<IgnoreDerivingFromUrl>;\n\n/**\n * Stable, module-scope tabs list. Previously this array (and the `React.createElement(...)` for each\n * tab's element) was constructed inside `getLaneCompare`, which means every render produced a new\n * array and new tab-element references. Those flowed into `<LaneCompare tabs={...}>` → `resolvedTabs`\n * (useMemo keyed on input ref) → new value → new `allTabs` prop on every `InlineComponentCompare`,\n * defeating React.memo and forcing all 10 component panels (and their nested tabs) to re-render on\n * every parent re-render — including every `setViewMode` click. Hoisting the array to module scope\n * gives a single stable reference that survives any number of parent renders.\n */\n/**\n * Slot signature for `LanesUI.registerCompareTab`. Kept for back-compat — the canonical inline\n * compare-tab list is now owned by `ComponentCompareUI` (so single-component compare and\n * lane-compare share one source). Tabs registered here are merged on top of that list.\n */\nexport type LaneCompareTabSlot = SlotRegistry<TabItem | TabItem[]>;\n\nexport function useComponentFilters() {\n const idFromLocation = useIdFromLocation(undefined, true);\n const { lanesModel, loading } = useLanes();\n const laneFromUrl = useViewedLaneFromUrl();\n const laneComponentId =\n idFromLocation && !laneFromUrl?.isDefault()\n ? (lanesModel?.resolveComponentFromUrl(idFromLocation, laneFromUrl) ?? null)\n : null;\n\n if (laneComponentId === null || loading) {\n return {\n loading: true,\n };\n }\n\n return {\n loading: false,\n log: {\n head: laneComponentId.version,\n },\n };\n}\n\nexport function useLaneComponentIdFromUrl(): ComponentID | undefined | null {\n const idFromLocation = useIdFromLocation(undefined, true);\n const { lanesModel, loading } = useLanes();\n const laneFromUrl = useViewedLaneFromUrl();\n const query = useQuery();\n const componentVersion = query.get('version');\n\n if (!idFromLocation) return null;\n\n const compIdFromLocation = ComponentID.tryFromString(\n `${idFromLocation}${componentVersion ? `@${componentVersion}` : ''}`\n );\n\n if (compIdFromLocation) return compIdFromLocation;\n if (loading) return undefined;\n\n const lanesComp = (lanesModel?.resolveComponentFromUrl(idFromLocation, laneFromUrl) as any | undefined) ?? null;\n\n if (componentVersion) {\n return lanesComp?.changeVersion(componentVersion);\n }\n\n return lanesComp;\n}\n\nexport function useComponentId() {\n return useLaneComponentIdFromUrl()?.toString();\n}\n\nexport class LanesUI {\n static dependencies = [\n UIAspect,\n ComponentAspect,\n WorkspaceAspect,\n ScopeAspect,\n ComponentCompareAspect,\n CommandBarAspect,\n ];\n\n static runtime = UIRuntime;\n static slots = [\n Slot.withType<RouteProps>(),\n Slot.withType<LaneOverviewLineSlot>(),\n Slot.withType<NavigationSlot>(),\n Slot.withType<MenuWidgetSlot>(),\n Slot.withType<LaneProviderIgnoreSlot>(),\n Slot.withType<TabItem | TabItem[]>(),\n ];\n\n constructor(\n private componentUI: ComponentUI,\n private componentCompareUI: ComponentCompareUI,\n private routeSlot: RouteSlot,\n private navSlot: LanesOrderedNavigationSlot,\n private menuWidgetSlot: MenuWidgetSlot,\n /**\n * overview line slot to add new lines beneath the overview section\n */\n private overviewSlot: LaneOverviewLineSlot,\n private laneProviderIgnoreSlot: LaneProviderIgnoreSlot,\n /**\n * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`;\n * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted\n * by `order` before being passed to `<LaneCompare>`.\n */\n private compareTabSlot: LaneCompareTabSlot,\n private workspace?: WorkspaceUI,\n private scope?: ScopeUI\n ) {\n this.hostAspect = workspace || scope;\n this.lanesHost = workspace ? 'workspace' : 'scope';\n this.host = workspace ? WorkspaceAspect.id : ScopeAspect.id;\n }\n\n private readonly lanesHost: LanesHost;\n private readonly hostAspect?: WorkspaceUI | ScopeUI;\n private readonly host: string;\n\n private registerHostAspectRoutes() {\n if (!this.hostAspect) return;\n this.hostAspect.registerRoutes(this.getLaneRoutes());\n this.hostAspect.registerMenuRoutes(this.getMenuRoutes());\n }\n\n getLaneRoutes() {\n return [\n {\n path: LanesModel.lanesPrefix,\n children: (\n <>\n <Route path={LanesModel.lanePath}>\n <Route index element={this.getLaneOverview()} />\n <Route path=\"~component/*\" element={this.getLaneComponent()} />\n <Route path=\"~compare/*\" element={this.getLanesComparePage()} />\n <Route path=\"*\" element={<NotFoundPage />} />\n </Route>\n <Route path=\"*\" element={<NotFoundPage />} />\n </>\n ),\n },\n ];\n }\n\n overrideComputeLaneUrl(\n fn: () => {\n prefix: string;\n path: string;\n getLaneIdFromPathname: typeof LanesModel.getLaneIdFromPathname;\n getLaneUrl: typeof LanesModel.getLaneUrl;\n getLaneComponentUrl: typeof LanesModel.getLaneComponentUrl;\n }\n ) {\n const { prefix, path, getLaneComponentUrl, getLaneIdFromPathname, getLaneUrl } = fn();\n LanesModel.lanesPrefix = prefix;\n LanesModel.lanePath = path;\n LanesModel.getLaneComponentUrl = getLaneComponentUrl;\n LanesModel.getLaneUrl = getLaneUrl;\n LanesModel.getLaneIdFromPathname = getLaneIdFromPathname;\n }\n\n getLaneComponent() {\n return this.componentUI.getComponentUI(this.host, {\n componentId: useComponentId,\n useComponentFilters,\n });\n }\n\n getLaneComponentMenu() {\n return this.componentUI.getMenu(this.host, {\n componentId: useComponentId,\n useComponentFilters,\n });\n }\n\n getLaneOverview() {\n return (\n <LaneOverview\n routeSlot={this.routeSlot}\n overviewSlot={this.overviewSlot}\n host={this.lanesHost}\n useLanes={useLanes}\n />\n );\n }\n\n getLanesComparePage() {\n return <LaneComparePage getLaneCompare={this.getLaneCompare} groupByScope={this.lanesHost === 'workspace'} />;\n }\n\n getMenuRoutes() {\n return [\n {\n path: LanesModel.lanesPrefix,\n children: (\n <Route path={`${LanesModel.lanePath}/*`}>\n <Route path={'*'} element={this.getLanesOverviewMenu()} />\n <Route path=\"~component/*\" element={this.getLaneComponentMenu()} />\n </Route>\n ),\n },\n ];\n }\n\n getLanesOverviewMenu() {\n return <LanesOverviewMenu navigationSlot={this.navSlot} widgetSlot={this.menuWidgetSlot} />;\n }\n\n registerMenuWidget(...menuItems: MenuWidget[]) {\n this.menuWidgetSlot.register(menuItems);\n return this;\n }\n\n registerLaneProviderIgnoreSlot(ignoreFn: IgnoreDerivingFromUrl) {\n this.laneProviderIgnoreSlot.register(ignoreFn);\n return this;\n }\n\n private registerLanesRoutes() {\n this.registerNavigation([\n // {\n // props: {\n // href: '.',\n // exact: true,\n // children: 'README',\n // },\n // order: 1,\n // hide: () => {\n // const { lanesModel } = useLanes();\n // return !lanesModel?.viewedLane?.readmeComponent;\n // },\n // },\n {\n props: {\n href: '.',\n exact: true,\n children: 'Overview',\n },\n order: 1,\n },\n {\n props: {\n href: '~compare',\n children: 'Compare',\n },\n order: 2,\n hide: () => {\n const { lanesModel } = useLanes();\n return !lanesModel?.viewedLane || lanesModel?.lanes.length < 2;\n },\n },\n ]);\n }\n\n private registerRoutes() {\n this.registerHostAspectRoutes();\n this.registerLanesRoutes();\n }\n\n getLanesSwitcher() {\n const mainIcon = () => {\n const scope = useContext(ScopeContext);\n return (\n <ScopeIcon\n size={24}\n scopeImage={scope.icon}\n bgColor={scope.backgroundIconColor}\n className={styles.mainLaneIcon}\n />\n );\n };\n\n const LanesSwitcher = (\n <LaneSwitcher\n groupByScope={this.lanesHost === 'workspace'}\n mainIcon={this.lanesHost === 'scope' ? mainIcon : undefined}\n // @ts-ignore @todo - fix this\n useLanes={useLanes}\n />\n );\n\n return LanesSwitcher;\n }\n\n getLanesProvider() {\n return LanesProvider;\n }\n\n getUseLanes(): UseLanes {\n return useLanes;\n }\n\n private registerLanesDropdown() {\n const LanesSwitcher = this.getLanesSwitcher();\n\n this.hostAspect?.registerSidebarLink({\n component: function Gallery() {\n return LanesSwitcher;\n },\n weight: 1000,\n });\n }\n\n private renderContext = ({ children }: { children: ReactNode }) => {\n const ignoreFns = this.laneProviderIgnoreSlot.values();\n\n return <LanesProvider ignoreDerivingFromUrl={ignoreFns}>{children}</LanesProvider>;\n };\n\n registerRoute(route: RouteProps) {\n this.routeSlot.register(route);\n return this;\n }\n\n /**\n * register a new line beneath the lane overview section.\n */\n registerOverviewLine(...lines: LaneOverviewLine[]) {\n this.overviewSlot.register(lines);\n return this;\n }\n\n registerNavigation(routes: LanesNavPlugin[]) {\n this.navSlot.register(routes);\n }\n\n /**\n * Register an inline compare tab. Aspects own their compare-tab entry and call this in their\n * own UI provider (e.g. the docs aspect registers `inline-docs` so it can pass its real\n * `titleBadges` / `overviewOptions` slots). Tabs are merged with the lanes-side fallback list,\n * deduped by `id`, and sorted by `order` at render time.\n */\n registerCompareTab(tab: TabItem | TabItem[]) {\n this.compareTabSlot.register(tab);\n return this;\n }\n\n // memoize the resolved tab list — same identity across renders unless a new registration lands.\n // The base list is owned by component-compare (so the single-component compare page and\n // lane-compare share one source). We additionally merge in anything registered on this aspect's\n // legacy `compareTabSlot` for back-compat.\n private _resolvedCompareTabs?: TabItem[];\n private _resolvedCompareTabsKey?: string;\n private resolveCompareTabs(): TabItem[] {\n const fromComponentCompare = this.componentCompareUI.resolveCompareTabs();\n const slotEntries = this.compareTabSlot.toArray();\n const localRegistered = flatten(\n slotEntries.map(([, value]) => value).filter(Boolean) as Array<TabItem | TabItem[]>\n );\n const cacheKey = `${fromComponentCompare.map((t) => `${t.id}:${t.order ?? 0}`).join(',')}|${localRegistered\n .map((t) => `${t.id}:${t.order ?? 0}`)\n .join(',')}`;\n if (this._resolvedCompareTabs && this._resolvedCompareTabsKey === cacheKey) {\n return this._resolvedCompareTabs;\n }\n const localIds = new Set(localRegistered.map((t) => t.id));\n // local registrations take precedence over the component-compare list.\n const merged = [...localRegistered, ...fromComponentCompare.filter((t) => !localIds.has(t.id))].sort(\n (a, b) => (a.order ?? 0) - (b.order ?? 0)\n );\n this._resolvedCompareTabs = merged;\n this._resolvedCompareTabsKey = cacheKey;\n return merged;\n }\n\n getLaneCompare = (props: LaneCompareProps) => {\n if (!props.base || !props.compare) return null;\n\n return (\n <LaneCompare\n {...props}\n base={props.base}\n compare={props.compare}\n host={props.host || this.host}\n tabs={props.tabs || this.resolveCompareTabs()}\n apiDiffInsights={props.apiDiffInsights || this.componentCompareUI.getApiDiffInsights()}\n />\n );\n };\n\n static async provider(\n [uiUi, componentUI, workspaceUi, scopeUi, componentCompareUI, commandBarUI]: [\n UiUI,\n ComponentUI,\n WorkspaceUI,\n ScopeUI,\n ComponentCompareUI,\n CommandBarUI,\n ],\n _,\n [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot, compareTabSlot]: [\n RouteSlot,\n LaneOverviewLineSlot,\n LanesOrderedNavigationSlot,\n MenuWidgetSlot,\n LaneProviderIgnoreSlot,\n LaneCompareTabSlot,\n ],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n let workspace: WorkspaceUI | undefined;\n let scope: ScopeUI | undefined;\n if (host === WorkspaceAspect.id) {\n workspace = workspaceUi;\n }\n if (host === ScopeAspect.id) {\n scope = scopeUi;\n }\n const lanesUi = new LanesUI(\n componentUI,\n componentCompareUI,\n routeSlot,\n navSlot,\n menuWidgetSlot,\n overviewSlot,\n laneProviderIgnoreSlot,\n compareTabSlot,\n workspace,\n scope\n );\n if (uiUi) uiUi.registerRenderHooks({ reactContext: lanesUi.renderContext });\n lanesUi.registerRoutes();\n lanesUi.registerMenuWidget(() => {\n const { lanesModel } = useLanes();\n if (!lanesModel?.viewedLane) return null;\n const { viewedLane, currentLane } = lanesModel;\n return (\n <UseLaneMenu\n actionName={'Import'}\n actionIcon={'terminal'}\n host={lanesUi.lanesHost}\n viewedLaneId={viewedLane.id}\n currentLaneId={currentLane?.id}\n />\n );\n });\n lanesUi.registerLanesDropdown();\n if (workspace) {\n lanesUi.registerMenuWidget(commandBarUI.CommandBarButton);\n }\n return lanesUi;\n }\n}\n\nexport default LanesUI;\n\nLanesAspect.addRuntime(LanesUI);\n"],"mappings":";;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,gBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,gBAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,IAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAO,eAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,cAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAA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,OAAA,CAAA/M,OAAA,GAsWY6D,OAAO;AAEtB2J,oBAAW,CAACC,UAAU,CAAC5J,OAAO,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.lanes_lanes@1.0.1100/dist/lanes.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.lanes_lanes@1.0.1100/dist/lanes.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.lanes_lanes@1.0.1102/dist/lanes.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.lanes_lanes@1.0.1102/dist/lanes.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -15,6 +15,8 @@ import type { WorkspaceUI } from '@teambit/workspace';
15
15
  import { WorkspaceAspect } from '@teambit/workspace';
16
16
  import type { ComponentUI } from '@teambit/component';
17
17
  import { ComponentAspect, useIdFromLocation, ComponentID } from '@teambit/component';
18
+ import type { TabItem } from '@teambit/component.ui.component-compare.models.component-compare-props';
19
+ import { flatten } from 'lodash';
18
20
  import type { MenuWidget, MenuWidgetSlot } from '@teambit/ui-foundation.ui.menu';
19
21
  import type { LaneOverviewLine, LaneOverviewLineSlot } from '@teambit/lanes.ui.lane-overview';
20
22
  import { LaneOverview } from '@teambit/lanes.ui.lane-overview';
@@ -40,6 +42,23 @@ import styles from './lanes.ui.module.scss';
40
42
 
41
43
  export type LaneCompareProps = Partial<DefaultLaneCompareProps>;
42
44
  export type LaneProviderIgnoreSlot = SlotRegistry<IgnoreDerivingFromUrl>;
45
+
46
+ /**
47
+ * Stable, module-scope tabs list. Previously this array (and the `React.createElement(...)` for each
48
+ * tab's element) was constructed inside `getLaneCompare`, which means every render produced a new
49
+ * array and new tab-element references. Those flowed into `<LaneCompare tabs={...}>` → `resolvedTabs`
50
+ * (useMemo keyed on input ref) → new value → new `allTabs` prop on every `InlineComponentCompare`,
51
+ * defeating React.memo and forcing all 10 component panels (and their nested tabs) to re-render on
52
+ * every parent re-render — including every `setViewMode` click. Hoisting the array to module scope
53
+ * gives a single stable reference that survives any number of parent renders.
54
+ */
55
+ /**
56
+ * Slot signature for `LanesUI.registerCompareTab`. Kept for back-compat — the canonical inline
57
+ * compare-tab list is now owned by `ComponentCompareUI` (so single-component compare and
58
+ * lane-compare share one source). Tabs registered here are merged on top of that list.
59
+ */
60
+ export type LaneCompareTabSlot = SlotRegistry<TabItem | TabItem[]>;
61
+
43
62
  export function useComponentFilters() {
44
63
  const idFromLocation = useIdFromLocation(undefined, true);
45
64
  const { lanesModel, loading } = useLanes();
@@ -109,6 +128,7 @@ export class LanesUI {
109
128
  Slot.withType<NavigationSlot>(),
110
129
  Slot.withType<MenuWidgetSlot>(),
111
130
  Slot.withType<LaneProviderIgnoreSlot>(),
131
+ Slot.withType<TabItem | TabItem[]>(),
112
132
  ];
113
133
 
114
134
  constructor(
@@ -122,6 +142,12 @@ export class LanesUI {
122
142
  */
123
143
  private overviewSlot: LaneOverviewLineSlot,
124
144
  private laneProviderIgnoreSlot: LaneProviderIgnoreSlot,
145
+ /**
146
+ * compare-tab slot. Aspects register their inline-compare tab via `registerCompareTab(...)`;
147
+ * the registered tabs are merged with the local fallback list, deduped by `id`, and sorted
148
+ * by `order` before being passed to `<LaneCompare>`.
149
+ */
150
+ private compareTabSlot: LaneCompareTabSlot,
125
151
  private workspace?: WorkspaceUI,
126
152
  private scope?: ScopeUI
127
153
  ) {
@@ -341,9 +367,46 @@ export class LanesUI {
341
367
  this.navSlot.register(routes);
342
368
  }
343
369
 
344
- getLaneCompare = (props: LaneCompareProps) => {
345
- const tabs = this.componentCompareUI.tabs;
370
+ /**
371
+ * Register an inline compare tab. Aspects own their compare-tab entry and call this in their
372
+ * own UI provider (e.g. the docs aspect registers `inline-docs` so it can pass its real
373
+ * `titleBadges` / `overviewOptions` slots). Tabs are merged with the lanes-side fallback list,
374
+ * deduped by `id`, and sorted by `order` at render time.
375
+ */
376
+ registerCompareTab(tab: TabItem | TabItem[]) {
377
+ this.compareTabSlot.register(tab);
378
+ return this;
379
+ }
346
380
 
381
+ // memoize the resolved tab list — same identity across renders unless a new registration lands.
382
+ // The base list is owned by component-compare (so the single-component compare page and
383
+ // lane-compare share one source). We additionally merge in anything registered on this aspect's
384
+ // legacy `compareTabSlot` for back-compat.
385
+ private _resolvedCompareTabs?: TabItem[];
386
+ private _resolvedCompareTabsKey?: string;
387
+ private resolveCompareTabs(): TabItem[] {
388
+ const fromComponentCompare = this.componentCompareUI.resolveCompareTabs();
389
+ const slotEntries = this.compareTabSlot.toArray();
390
+ const localRegistered = flatten(
391
+ slotEntries.map(([, value]) => value).filter(Boolean) as Array<TabItem | TabItem[]>
392
+ );
393
+ const cacheKey = `${fromComponentCompare.map((t) => `${t.id}:${t.order ?? 0}`).join(',')}|${localRegistered
394
+ .map((t) => `${t.id}:${t.order ?? 0}`)
395
+ .join(',')}`;
396
+ if (this._resolvedCompareTabs && this._resolvedCompareTabsKey === cacheKey) {
397
+ return this._resolvedCompareTabs;
398
+ }
399
+ const localIds = new Set(localRegistered.map((t) => t.id));
400
+ // local registrations take precedence over the component-compare list.
401
+ const merged = [...localRegistered, ...fromComponentCompare.filter((t) => !localIds.has(t.id))].sort(
402
+ (a, b) => (a.order ?? 0) - (b.order ?? 0)
403
+ );
404
+ this._resolvedCompareTabs = merged;
405
+ this._resolvedCompareTabsKey = cacheKey;
406
+ return merged;
407
+ }
408
+
409
+ getLaneCompare = (props: LaneCompareProps) => {
347
410
  if (!props.base || !props.compare) return null;
348
411
 
349
412
  return (
@@ -352,7 +415,8 @@ export class LanesUI {
352
415
  base={props.base}
353
416
  compare={props.compare}
354
417
  host={props.host || this.host}
355
- tabs={props.tabs || tabs}
418
+ tabs={props.tabs || this.resolveCompareTabs()}
419
+ apiDiffInsights={props.apiDiffInsights || this.componentCompareUI.getApiDiffInsights()}
356
420
  />
357
421
  );
358
422
  };
@@ -367,12 +431,13 @@ export class LanesUI {
367
431
  CommandBarUI,
368
432
  ],
369
433
  _,
370
- [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot]: [
434
+ [routeSlot, overviewSlot, navSlot, menuWidgetSlot, laneProviderIgnoreSlot, compareTabSlot]: [
371
435
  RouteSlot,
372
436
  LaneOverviewLineSlot,
373
437
  LanesOrderedNavigationSlot,
374
438
  MenuWidgetSlot,
375
439
  LaneProviderIgnoreSlot,
440
+ LaneCompareTabSlot,
376
441
  ],
377
442
  harmony: Harmony
378
443
  ) {
@@ -394,6 +459,7 @@ export class LanesUI {
394
459
  menuWidgetSlot,
395
460
  overviewSlot,
396
461
  laneProviderIgnoreSlot,
462
+ compareTabSlot,
397
463
  workspace,
398
464
  scope
399
465
  );