@teambit/workspace 0.0.964 → 0.0.966

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.
@@ -1,8 +1,13 @@
1
1
  import { ComponentsDrawer, ComponentFiltersSlot, DrawerWidgetSlot } from '@teambit/component.ui.component-drawer';
2
+ import { LanesModel } from '@teambit/lanes.ui.models.lanes-model';
2
3
  import { SidebarWidgetSlot } from './workspace.ui.runtime';
3
4
  export declare type WorkspaceDrawerProps = {
4
5
  treeWidgets: SidebarWidgetSlot;
5
6
  filtersSlot: ComponentFiltersSlot;
6
7
  drawerWidgetSlot: DrawerWidgetSlot;
8
+ overrideUseLanes?: () => {
9
+ lanesModel?: LanesModel;
10
+ loading?: boolean;
11
+ };
7
12
  };
8
- export declare const workspaceDrawer: ({ treeWidgets, filtersSlot, drawerWidgetSlot }: WorkspaceDrawerProps) => ComponentsDrawer;
13
+ export declare const workspaceDrawer: ({ treeWidgets, filtersSlot, drawerWidgetSlot, overrideUseLanes: useLanesFromProps, }: WorkspaceDrawerProps) => ComponentsDrawer;
@@ -50,54 +50,60 @@ function _lanesHooks2() {
50
50
  const workspaceDrawer = ({
51
51
  treeWidgets,
52
52
  filtersSlot,
53
- drawerWidgetSlot
54
- }) => new (_componentUi().ComponentsDrawer)({
55
- order: 0,
56
- id: 'workspace-components-drawer',
57
- name: 'COMPONENTS',
58
- plugins: {
59
- tree: {
60
- widgets: treeWidgets,
61
- customRenderer: treeNodeSlot => function TreeNode(props) {
62
- const children = props.node.children;
63
- if (!children) return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().ComponentView, (0, _extends2().default)({}, props, {
64
- treeNodeSlot: treeNodeSlot
65
- })); // non collapse
53
+ drawerWidgetSlot,
54
+ overrideUseLanes: useLanesFromProps
55
+ }) => {
56
+ const useLanes = useLanesFromProps || _lanesHooks().useLanes;
57
+ return new (_componentUi().ComponentsDrawer)({
58
+ order: 0,
59
+ id: 'workspace-components-drawer',
60
+ name: 'COMPONENTS',
61
+ plugins: {
62
+ tree: {
63
+ widgets: treeWidgets,
64
+ customRenderer: treeNodeSlot => function TreeNode(props) {
65
+ const children = props.node.children;
66
+ if (!children) return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().ComponentView, (0, _extends2().default)({}, props, {
67
+ treeNodeSlot: treeNodeSlot,
68
+ useLanes: useLanes
69
+ })); // non collapse
66
70
 
67
- if (props.node.payload instanceof _uiFoundationUi().ScopePayload) return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().ScopeTreeNode, props);
68
- return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().NamespaceTreeNode, props);
69
- }
71
+ if (props.node.payload instanceof _uiFoundationUi().ScopePayload) return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().ScopeTreeNode, props);
72
+ return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().NamespaceTreeNode, props);
73
+ }
74
+ },
75
+ filters: filtersSlot,
76
+ drawerWidgets: drawerWidgetSlot
70
77
  },
71
- filters: filtersSlot,
72
- drawerWidgets: drawerWidgetSlot
73
- },
74
- emptyMessage: 'Workspace is empty',
75
- useComponents: () => {
76
- var _lanesModel$viewedLan;
77
- const {
78
- lanesModel,
79
- loading: lanesLoading
80
- } = (0, _lanesHooks().useLanes)();
81
- const viewedLaneId = lanesModel === null || lanesModel === void 0 ? void 0 : (_lanesModel$viewedLan = lanesModel.viewedLane) === null || _lanesModel$viewedLan === void 0 ? void 0 : _lanesModel$viewedLan.id;
82
- const defaultLane = lanesModel === null || lanesModel === void 0 ? void 0 : lanesModel.getDefaultLane();
83
- const isViewingDefaultLane = viewedLaneId && (defaultLane === null || defaultLane === void 0 ? void 0 : defaultLane.id.isEqual(viewedLaneId));
84
- const {
85
- components: laneComponents = [],
86
- loading: laneCompsLoading
87
- } = (0, _lanesHooks2().useLaneComponents)(viewedLaneId);
88
- const {
89
- components: mainComponents = [],
90
- loading: mainCompsLoading
91
- } = (0, _lanesHooks2().useLaneComponents)(!isViewingDefaultLane ? defaultLane === null || defaultLane === void 0 ? void 0 : defaultLane.id : undefined);
78
+ emptyMessage: 'Workspace is empty',
79
+ useLanes,
80
+ useComponents: () => {
81
+ var _lanesModel$viewedLan;
82
+ const {
83
+ lanesModel,
84
+ loading: lanesLoading
85
+ } = useLanes();
86
+ const viewedLaneId = lanesModel === null || lanesModel === void 0 ? void 0 : (_lanesModel$viewedLan = lanesModel.viewedLane) === null || _lanesModel$viewedLan === void 0 ? void 0 : _lanesModel$viewedLan.id;
87
+ const defaultLane = lanesModel === null || lanesModel === void 0 ? void 0 : lanesModel.getDefaultLane();
88
+ const isViewingDefaultLane = viewedLaneId && (defaultLane === null || defaultLane === void 0 ? void 0 : defaultLane.id.isEqual(viewedLaneId));
89
+ const {
90
+ components: laneComponents = [],
91
+ loading: laneCompsLoading
92
+ } = (0, _lanesHooks2().useLaneComponents)(viewedLaneId);
93
+ const {
94
+ components: mainComponents = [],
95
+ loading: mainCompsLoading
96
+ } = (0, _lanesHooks2().useLaneComponents)(!isViewingDefaultLane ? defaultLane === null || defaultLane === void 0 ? void 0 : defaultLane.id : undefined);
92
97
 
93
- // lane components + main components
94
- const components = isViewingDefaultLane ? laneComponents : mergeComponents(mainComponents, laneComponents);
95
- return {
96
- loading: lanesLoading || laneCompsLoading || mainCompsLoading,
97
- components
98
- };
99
- }
100
- });
98
+ // lane components + main components
99
+ const components = isViewingDefaultLane ? laneComponents : mergeComponents(mainComponents, laneComponents);
100
+ return {
101
+ loading: lanesLoading || laneCompsLoading || mainCompsLoading,
102
+ components
103
+ };
104
+ }
105
+ });
106
+ };
101
107
  exports.workspaceDrawer = workspaceDrawer;
102
108
  function mergeComponents(mainComponents, laneComponents) {
103
109
  const mainComponentsThatAreNotOnLane = mainComponents.filter(mainComponent => {
@@ -1 +1 @@
1
- {"version":3,"names":["workspaceDrawer","treeWidgets","filtersSlot","drawerWidgetSlot","ComponentsDrawer","order","id","name","plugins","tree","widgets","customRenderer","treeNodeSlot","TreeNode","props","children","node","payload","ScopePayload","filters","drawerWidgets","emptyMessage","useComponents","lanesModel","loading","lanesLoading","useLanes","viewedLaneId","viewedLane","defaultLane","getDefaultLane","isViewingDefaultLane","isEqual","components","laneComponents","laneCompsLoading","useLaneComponents","mainComponents","mainCompsLoading","undefined","mergeComponents","mainComponentsThatAreNotOnLane","filter","mainComponent","find","laneComponent","toStringWithoutVersion","concat"],"sources":["workspace.ui.drawer.tsx"],"sourcesContent":["import React from 'react';\nimport { ComponentsDrawer, ComponentFiltersSlot, DrawerWidgetSlot } from '@teambit/component.ui.component-drawer';\nimport {\n ComponentView,\n NamespaceTreeNode,\n PayloadType,\n ScopePayload,\n ScopeTreeNode,\n} from '@teambit/ui-foundation.ui.side-bar';\nimport { useLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { useLaneComponents } from '@teambit/lanes.hooks.use-lane-components';\nimport { TreeNodeProps } from '@teambit/design.ui.tree';\nimport { ComponentModel } from '@teambit/component';\nimport { SidebarWidgetSlot } from './workspace.ui.runtime';\n\nexport type WorkspaceDrawerProps = {\n treeWidgets: SidebarWidgetSlot;\n filtersSlot: ComponentFiltersSlot;\n drawerWidgetSlot: DrawerWidgetSlot;\n};\n\nexport const workspaceDrawer = ({ treeWidgets, filtersSlot, drawerWidgetSlot }: WorkspaceDrawerProps) =>\n new ComponentsDrawer({\n order: 0,\n id: 'workspace-components-drawer',\n name: 'COMPONENTS',\n plugins: {\n tree: {\n widgets: treeWidgets,\n customRenderer: (treeNodeSlot) =>\n function TreeNode(props: TreeNodeProps<PayloadType>) {\n const children = props.node.children;\n\n if (!children) return <ComponentView {...props} treeNodeSlot={treeNodeSlot} />; // non collapse\n\n if (props.node.payload instanceof ScopePayload) return <ScopeTreeNode {...props} />;\n\n return <NamespaceTreeNode {...props} />;\n },\n },\n filters: filtersSlot,\n drawerWidgets: drawerWidgetSlot,\n },\n emptyMessage: 'Workspace is empty',\n useComponents: () => {\n const { lanesModel, loading: lanesLoading } = useLanes();\n const viewedLaneId = lanesModel?.viewedLane?.id;\n const defaultLane = lanesModel?.getDefaultLane();\n const isViewingDefaultLane = viewedLaneId && defaultLane?.id.isEqual(viewedLaneId);\n\n const { components: laneComponents = [], loading: laneCompsLoading } = useLaneComponents(viewedLaneId);\n const { components: mainComponents = [], loading: mainCompsLoading } = useLaneComponents(\n !isViewingDefaultLane ? defaultLane?.id : undefined\n );\n\n // lane components + main components\n const components = isViewingDefaultLane ? laneComponents : mergeComponents(mainComponents, laneComponents);\n\n return {\n loading: lanesLoading || laneCompsLoading || mainCompsLoading,\n components,\n };\n },\n });\n\nfunction mergeComponents(mainComponents: ComponentModel[], laneComponents: ComponentModel[]): ComponentModel[] {\n const mainComponentsThatAreNotOnLane = mainComponents.filter((mainComponent) => {\n return !laneComponents.find(\n (laneComponent) => laneComponent.id.toStringWithoutVersion() === mainComponent.id.toStringWithoutVersion()\n );\n });\n return laneComponents.concat(mainComponentsThatAreNotOnLane);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWO,MAAMA,eAAe,GAAG,CAAC;EAAEC,WAAW;EAAEC,WAAW;EAAEC;AAAuC,CAAC,KAClG,KAAIC,+BAAgB,EAAC;EACnBC,KAAK,EAAE,CAAC;EACRC,EAAE,EAAE,6BAA6B;EACjCC,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAE;IACPC,IAAI,EAAE;MACJC,OAAO,EAAET,WAAW;MACpBU,cAAc,EAAGC,YAAY,IAC3B,SAASC,QAAQ,CAACC,KAAiC,EAAE;QACnD,MAAMC,QAAQ,GAAGD,KAAK,CAACE,IAAI,CAACD,QAAQ;QAEpC,IAAI,CAACA,QAAQ,EAAE,oBAAO,+BAAC,+BAA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gBAAgB;MAC7DL;IACF,CAAC;EACH;AACF,CAAC,CAAC;AAAC;AAEL,SAASO,eAAe,CAACH,cAAgC,EAAEH,cAAgC,EAAoB;EAC7G,MAAMO,8BAA8B,GAAGJ,cAAc,CAACK,MAAM,CAAEC,aAAa,IAAK;IAC9E,OAAO,CAACT,cAAc,CAACU,IAAI,CACxBC,aAAa,IAAKA,aAAa,CAACvC,EAAE,CAACwC,sBAAsB,EAAE,KAAKH,aAAa,CAACrC,EAAE,CAACwC,sBAAsB,EAAE,CAC3G;EACH,CAAC,CAAC;EACF,OAAOZ,cAAc,CAACa,MAAM,CAACN,8BAA8B,CAAC;AAC9D"}
1
+ {"version":3,"names":["workspaceDrawer","treeWidgets","filtersSlot","drawerWidgetSlot","overrideUseLanes","useLanesFromProps","useLanes","defaultUseLanesHook","ComponentsDrawer","order","id","name","plugins","tree","widgets","customRenderer","treeNodeSlot","TreeNode","props","children","node","payload","ScopePayload","filters","drawerWidgets","emptyMessage","useComponents","lanesModel","loading","lanesLoading","viewedLaneId","viewedLane","defaultLane","getDefaultLane","isViewingDefaultLane","isEqual","components","laneComponents","laneCompsLoading","useLaneComponents","mainComponents","mainCompsLoading","undefined","mergeComponents","mainComponentsThatAreNotOnLane","filter","mainComponent","find","laneComponent","toStringWithoutVersion","concat"],"sources":["workspace.ui.drawer.tsx"],"sourcesContent":["import React from 'react';\nimport { ComponentsDrawer, ComponentFiltersSlot, DrawerWidgetSlot } from '@teambit/component.ui.component-drawer';\nimport {\n ComponentView,\n NamespaceTreeNode,\n PayloadType,\n ScopePayload,\n ScopeTreeNode,\n} from '@teambit/ui-foundation.ui.side-bar';\nimport { useLanes as defaultUseLanesHook } from '@teambit/lanes.hooks.use-lanes';\nimport { useLaneComponents } from '@teambit/lanes.hooks.use-lane-components';\nimport { TreeNodeProps } from '@teambit/design.ui.tree';\nimport { ComponentModel } from '@teambit/component';\nimport { LanesModel } from '@teambit/lanes.ui.models.lanes-model';\nimport { SidebarWidgetSlot } from './workspace.ui.runtime';\n\nexport type WorkspaceDrawerProps = {\n treeWidgets: SidebarWidgetSlot;\n filtersSlot: ComponentFiltersSlot;\n drawerWidgetSlot: DrawerWidgetSlot;\n overrideUseLanes?: () => { lanesModel?: LanesModel; loading?: boolean };\n};\n\nexport const workspaceDrawer = ({\n treeWidgets,\n filtersSlot,\n drawerWidgetSlot,\n overrideUseLanes: useLanesFromProps,\n}: WorkspaceDrawerProps) => {\n const useLanes = useLanesFromProps || defaultUseLanesHook;\n\n return new ComponentsDrawer({\n order: 0,\n id: 'workspace-components-drawer',\n name: 'COMPONENTS',\n plugins: {\n tree: {\n widgets: treeWidgets,\n customRenderer: (treeNodeSlot) =>\n function TreeNode(props: TreeNodeProps<PayloadType>) {\n const children = props.node.children;\n\n if (!children) return <ComponentView {...props} treeNodeSlot={treeNodeSlot} useLanes={useLanes} />; // non collapse\n\n if (props.node.payload instanceof ScopePayload) return <ScopeTreeNode {...props} />;\n\n return <NamespaceTreeNode {...props} />;\n },\n },\n filters: filtersSlot,\n drawerWidgets: drawerWidgetSlot,\n },\n emptyMessage: 'Workspace is empty',\n useLanes,\n useComponents: () => {\n const { lanesModel, loading: lanesLoading } = useLanes();\n const viewedLaneId = lanesModel?.viewedLane?.id;\n const defaultLane = lanesModel?.getDefaultLane();\n const isViewingDefaultLane = viewedLaneId && defaultLane?.id.isEqual(viewedLaneId);\n\n const { components: laneComponents = [], loading: laneCompsLoading } = useLaneComponents(viewedLaneId);\n const { components: mainComponents = [], loading: mainCompsLoading } = useLaneComponents(\n !isViewingDefaultLane ? defaultLane?.id : undefined\n );\n\n // lane components + main components\n const components = isViewingDefaultLane ? laneComponents : mergeComponents(mainComponents, laneComponents);\n\n return {\n loading: lanesLoading || laneCompsLoading || mainCompsLoading,\n components,\n };\n },\n });\n};\n\nfunction mergeComponents(mainComponents: ComponentModel[], laneComponents: ComponentModel[]): ComponentModel[] {\n const mainComponentsThatAreNotOnLane = mainComponents.filter((mainComponent) => {\n return !laneComponents.find(\n (laneComponent) => laneComponent.id.toStringWithoutVersion() === mainComponent.id.toStringWithoutVersion()\n );\n });\n return laneComponents.concat(mainComponentsThatAreNotOnLane);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAaO,MAAMA,eAAe,GAAG,CAAC;EAC9BC,WAAW;EACXC,WAAW;EACXC,gBAAgB;EAChBC,gBAAgB,EAAEC;AACE,CAAC,KAAK;EAC1B,MAAMC,QAAQ,GAAGD,iBAAiB,IAAIE,sBAAmB;EAEzD,OAAO,KAAIC,+BAAgB,EAAC;IAC1BC,KAAK,EAAE,CAAC;IACRC,EAAE,EAAE,6BAA6B;IACjCC,IAAI,EAAE,YAAY;IAClBC,OAAO,EAAE;MACPC,IAAI,EAAE;QACJC,OAAO,EAAEb,WAAW;QACpBc,cAAc,EAAGC,YAAY,IAC3B,SAASC,QAAQ,CAACC,KAAiC,EAAE;UACnD,MAAMC,QAAQ,GAAGD,KAAK,CAACE,IAAI,CAACD,QAAQ;UAEpC,IAAI,CAACA,QAAQ,EAAE,oBAAO,+BAAC,+BAAa,+BAAKD,KAAK;YAAE,YAAY,EAAEF,YAAa;YAAC,QAAQ,EAAEV;UAAS,GAAG,CAAC,CAAC;;UAEpG,IAAIY,KAAK,CAACE,IAAI,CAACC,OAAO,YAAYC,8BAAY,EAAE,oBAAO,+BAAC,+BAAa,EAAKJ,KAAK,CAAI;UAEnF,oBAAO,+BAAC,mCAAiB,EAAKA,KAAK,CAAI;QACzC;MACJ,CAAC;MACDK,OAAO,EAAErB,WAAW;MACpBsB,aAAa,EAAErB;IACjB,CAAC;IACDsB,YAAY,EAAE,oBAAoB;IAClCnB,QAAQ;IACRoB,aAAa,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H,CAAC,CAAC;EACF,OAAOZ,cAAc,CAACa,MAAM,CAACN,8BAA8B,CAAC;AAC9D"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "0.0.964",
3
+ "version": "0.0.966",
4
4
  "homepage": "https://bit.dev/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "0.0.964"
9
+ "version": "0.0.966"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -33,50 +33,51 @@
33
33
  "@teambit/design.ui.surfaces.menu.link-item": "1.0.0",
34
34
  "@teambit/base-ui.surfaces.split-pane.hover-splitter": "1.0.0",
35
35
  "@teambit/base-ui.surfaces.split-pane.split-pane": "1.0.0",
36
- "@teambit/component": "0.0.964",
37
- "@teambit/envs": "0.0.964",
36
+ "@teambit/component": "0.0.966",
37
+ "@teambit/envs": "0.0.966",
38
38
  "@teambit/bit-error": "0.0.402",
39
39
  "@teambit/component-id": "0.0.425",
40
- "@teambit/lane-id": "0.0.164",
41
- "@teambit/dependency-resolver": "0.0.964",
42
- "@teambit/logger": "0.0.740",
43
- "@teambit/scope": "0.0.964",
44
- "@teambit/graph": "0.0.964",
45
- "@teambit/cli": "0.0.647",
46
- "@teambit/isolator": "0.0.964",
47
- "@teambit/component-tree": "0.0.752",
40
+ "@teambit/lane-id": "0.0.166",
41
+ "@teambit/dependency-resolver": "0.0.966",
42
+ "@teambit/logger": "0.0.742",
43
+ "@teambit/scope": "0.0.966",
44
+ "@teambit/graph": "0.0.966",
45
+ "@teambit/cli": "0.0.649",
46
+ "@teambit/isolator": "0.0.966",
47
+ "@teambit/component-tree": "0.0.754",
48
48
  "@teambit/component.ui.component-status-resolver": "0.0.504",
49
- "@teambit/lanes.hooks.use-lanes": "0.0.110",
49
+ "@teambit/lanes.hooks.use-lanes": "0.0.112",
50
50
  "@teambit/harmony.modules.resolved-component": "0.0.491",
51
- "@teambit/compiler": "0.0.964",
52
- "@teambit/graphql": "0.0.964",
53
- "@teambit/aspect-loader": "0.0.964",
54
- "@teambit/bundler": "0.0.964",
55
- "@teambit/pubsub": "0.0.964",
56
- "@teambit/ui": "0.0.964",
57
- "@teambit/variants": "0.0.752",
58
- "@teambit/component-issues": "0.0.85",
59
- "@teambit/config": "0.0.660",
51
+ "@teambit/compiler": "0.0.966",
52
+ "@teambit/graphql": "0.0.966",
53
+ "@teambit/aspect-loader": "0.0.966",
54
+ "@teambit/bundler": "0.0.966",
55
+ "@teambit/pubsub": "0.0.966",
56
+ "@teambit/ui": "0.0.966",
57
+ "@teambit/variants": "0.0.754",
58
+ "@teambit/component-issues": "0.0.86",
59
+ "@teambit/config": "0.0.662",
60
60
  "@teambit/harmony.modules.requireable-component": "0.0.491",
61
61
  "@teambit/legacy-bit-id": "0.0.421",
62
62
  "@teambit/workspace.modules.match-pattern": "0.0.498",
63
- "@teambit/component.ui.component-drawer": "0.0.205",
63
+ "@teambit/component.ui.component-drawer": "0.0.207",
64
64
  "@teambit/design.ui.tree": "0.0.16",
65
- "@teambit/lanes.hooks.use-lane-components": "0.0.109",
66
- "@teambit/ui-foundation.ui.side-bar": "0.0.722",
67
- "@teambit/command-bar": "0.0.964",
68
- "@teambit/component.ui.component-filters.component-filter-context": "0.0.79",
69
- "@teambit/component.ui.component-filters.deprecate-filter": "0.0.79",
70
- "@teambit/component.ui.component-filters.env-filter": "0.0.85",
71
- "@teambit/component.ui.component-filters.show-main-filter": "0.0.72",
72
- "@teambit/sidebar": "0.0.964",
65
+ "@teambit/lanes.hooks.use-lane-components": "0.0.111",
66
+ "@teambit/lanes.ui.models.lanes-model": "0.0.74",
67
+ "@teambit/ui-foundation.ui.side-bar": "0.0.724",
68
+ "@teambit/command-bar": "0.0.966",
69
+ "@teambit/component.ui.component-filters.component-filter-context": "0.0.81",
70
+ "@teambit/component.ui.component-filters.deprecate-filter": "0.0.81",
71
+ "@teambit/component.ui.component-filters.env-filter": "0.0.87",
72
+ "@teambit/component.ui.component-filters.show-main-filter": "0.0.74",
73
+ "@teambit/sidebar": "0.0.966",
73
74
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.497",
74
75
  "@teambit/ui-foundation.ui.menu": "0.0.497",
75
76
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.501",
76
77
  "@teambit/ui-foundation.ui.tree.drawer": "0.0.511",
77
78
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.500",
78
- "@teambit/component-descriptor": "0.0.216",
79
- "@teambit/deprecation": "0.0.964",
79
+ "@teambit/component-descriptor": "0.0.218",
80
+ "@teambit/deprecation": "0.0.966",
80
81
  "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.498",
81
82
  "@teambit/ui-foundation.ui.buttons.collapser": "0.0.206",
82
83
  "@teambit/ui-foundation.ui.corner": "0.0.507",
@@ -103,7 +104,7 @@
103
104
  "peerDependencies": {
104
105
  "react-router-dom": "^6.0.0",
105
106
  "@apollo/client": "^3.6.0",
106
- "@teambit/legacy": "1.0.427",
107
+ "@teambit/legacy": "1.0.430",
107
108
  "react": "^16.8.0 || ^17.0.0",
108
109
  "react-dom": "^16.8.0 || ^17.0.0"
109
110
  },
@@ -7,20 +7,29 @@ import {
7
7
  ScopePayload,
8
8
  ScopeTreeNode,
9
9
  } from '@teambit/ui-foundation.ui.side-bar';
10
- import { useLanes } from '@teambit/lanes.hooks.use-lanes';
10
+ import { useLanes as defaultUseLanesHook } from '@teambit/lanes.hooks.use-lanes';
11
11
  import { useLaneComponents } from '@teambit/lanes.hooks.use-lane-components';
12
12
  import { TreeNodeProps } from '@teambit/design.ui.tree';
13
13
  import { ComponentModel } from '@teambit/component';
14
+ import { LanesModel } from '@teambit/lanes.ui.models.lanes-model';
14
15
  import { SidebarWidgetSlot } from './workspace.ui.runtime';
15
16
 
16
17
  export type WorkspaceDrawerProps = {
17
18
  treeWidgets: SidebarWidgetSlot;
18
19
  filtersSlot: ComponentFiltersSlot;
19
20
  drawerWidgetSlot: DrawerWidgetSlot;
21
+ overrideUseLanes?: () => { lanesModel?: LanesModel; loading?: boolean };
20
22
  };
21
23
 
22
- export const workspaceDrawer = ({ treeWidgets, filtersSlot, drawerWidgetSlot }: WorkspaceDrawerProps) =>
23
- new ComponentsDrawer({
24
+ export const workspaceDrawer = ({
25
+ treeWidgets,
26
+ filtersSlot,
27
+ drawerWidgetSlot,
28
+ overrideUseLanes: useLanesFromProps,
29
+ }: WorkspaceDrawerProps) => {
30
+ const useLanes = useLanesFromProps || defaultUseLanesHook;
31
+
32
+ return new ComponentsDrawer({
24
33
  order: 0,
25
34
  id: 'workspace-components-drawer',
26
35
  name: 'COMPONENTS',
@@ -31,7 +40,7 @@ export const workspaceDrawer = ({ treeWidgets, filtersSlot, drawerWidgetSlot }:
31
40
  function TreeNode(props: TreeNodeProps<PayloadType>) {
32
41
  const children = props.node.children;
33
42
 
34
- if (!children) return <ComponentView {...props} treeNodeSlot={treeNodeSlot} />; // non collapse
43
+ if (!children) return <ComponentView {...props} treeNodeSlot={treeNodeSlot} useLanes={useLanes} />; // non collapse
35
44
 
36
45
  if (props.node.payload instanceof ScopePayload) return <ScopeTreeNode {...props} />;
37
46
 
@@ -42,6 +51,7 @@ export const workspaceDrawer = ({ treeWidgets, filtersSlot, drawerWidgetSlot }:
42
51
  drawerWidgets: drawerWidgetSlot,
43
52
  },
44
53
  emptyMessage: 'Workspace is empty',
54
+ useLanes,
45
55
  useComponents: () => {
46
56
  const { lanesModel, loading: lanesLoading } = useLanes();
47
57
  const viewedLaneId = lanesModel?.viewedLane?.id;
@@ -62,6 +72,7 @@ export const workspaceDrawer = ({ treeWidgets, filtersSlot, drawerWidgetSlot }:
62
72
  };
63
73
  },
64
74
  });
75
+ };
65
76
 
66
77
  function mergeComponents(mainComponents: ComponentModel[], laneComponents: ComponentModel[]): ComponentModel[] {
67
78
  const mainComponentsThatAreNotOnLane = mainComponents.filter((mainComponent) => {