@teambit/workspace 1.0.121 → 1.0.123

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.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "1.0.121",
3
+ "version": "1.0.123",
4
4
  "homepage": "https://bit.cloud/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "1.0.121"
9
+ "version": "1.0.123"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -35,7 +35,6 @@
35
35
  "@teambit/legacy-bit-id": "1.1.0",
36
36
  "@teambit/dependencies.modules.packages-excluder": "1.0.8",
37
37
  "@teambit/design.ui.tree": "0.0.15",
38
- "@teambit/lanes.hooks.use-lane-components": "0.0.253",
39
38
  "@teambit/lanes.hooks.use-lanes": "0.0.254",
40
39
  "@teambit/lanes.ui.models.lanes-model": "0.0.207",
41
40
  "@teambit/ui-foundation.ui.side-bar": "0.0.871",
@@ -61,37 +60,39 @@
61
60
  "@teambit/explorer.ui.component-card": "0.0.30",
62
61
  "@teambit/explorer.ui.gallery.component-grid": "0.0.496",
63
62
  "@teambit/workspace.ui.empty-workspace": "0.0.508",
64
- "@teambit/component": "1.0.121",
65
- "@teambit/dependency-resolver": "1.0.121",
66
- "@teambit/envs": "1.0.121",
67
- "@teambit/logger": "0.0.937",
68
- "@teambit/scope": "1.0.121",
69
- "@teambit/graph": "1.0.121",
70
- "@teambit/cli": "0.0.844",
71
- "@teambit/isolator": "1.0.121",
72
- "@teambit/component-tree": "1.0.121",
63
+ "@teambit/component": "1.0.123",
64
+ "@teambit/dependency-resolver": "1.0.123",
65
+ "@teambit/envs": "1.0.123",
66
+ "@teambit/logger": "0.0.938",
67
+ "@teambit/scope": "1.0.123",
68
+ "@teambit/graph": "1.0.123",
69
+ "@teambit/cli": "0.0.845",
70
+ "@teambit/isolator": "1.0.123",
71
+ "@teambit/component-tree": "1.0.123",
73
72
  "@teambit/harmony.modules.resolved-component": "0.0.497",
74
- "@teambit/watcher": "1.0.121",
75
- "@teambit/aspect-loader": "1.0.121",
76
- "@teambit/config": "0.0.872",
77
- "@teambit/global-config": "0.0.847",
73
+ "@teambit/watcher": "1.0.123",
74
+ "@teambit/aspect-loader": "1.0.123",
75
+ "@teambit/config": "0.0.874",
76
+ "@teambit/global-config": "0.0.848",
78
77
  "@teambit/harmony.modules.requireable-component": "0.0.497",
79
78
  "@teambit/toolbox.modules.module-resolver": "0.0.7",
80
79
  "@teambit/workspace.modules.node-modules-linker": "0.0.161",
81
- "@teambit/graphql": "1.0.121",
82
- "@teambit/bundler": "1.0.121",
83
- "@teambit/pubsub": "1.0.121",
84
- "@teambit/ui": "1.0.121",
85
- "@teambit/variants": "0.0.965",
80
+ "@teambit/graphql": "1.0.123",
81
+ "@teambit/bundler": "1.0.123",
82
+ "@teambit/pubsub": "1.0.123",
83
+ "@teambit/ui": "1.0.123",
84
+ "@teambit/variants": "0.0.967",
86
85
  "@teambit/component-issues": "0.0.140",
87
86
  "@teambit/workspace.modules.match-pattern": "0.0.504",
88
87
  "@teambit/component.ui.component-drawer": "0.0.385",
89
- "@teambit/command-bar": "1.0.121",
90
- "@teambit/sidebar": "1.0.121",
91
- "@teambit/deprecation": "1.0.121",
88
+ "@teambit/lanes.hooks.use-lane-components": "0.0.255",
89
+ "@teambit/command-bar": "1.0.123",
90
+ "@teambit/sidebar": "1.0.123",
91
+ "@teambit/deprecation": "1.0.123",
92
92
  "@teambit/component-descriptor": "0.0.412",
93
93
  "@teambit/cloud.hooks.use-cloud-scopes": "0.0.3",
94
- "@teambit/preview.ui.preview-placeholder": "0.0.507"
94
+ "@teambit/preview.ui.preview-placeholder": "0.0.508",
95
+ "@teambit/workspace.ui.workspace-component-card": "0.0.517"
95
96
  },
96
97
  "devDependencies": {
97
98
  "@types/lodash": "4.14.165",
@@ -35,3 +35,14 @@
35
35
  margin-bottom: 4px;
36
36
  box-shadow: 0px 2px 18px rgb(0 0 0 / 10%);
37
37
  }
38
+
39
+ .cardGrid {
40
+ grid-column-gap: 10px;
41
+ grid-gap: 32px 24px;
42
+ -moz-column-gap: 10px;
43
+ column-gap: 10px;
44
+ display: grid;
45
+ gap: 32px 24px;
46
+ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
47
+ max-width: 1280px;
48
+ }
@@ -7,7 +7,9 @@ import { ComponentID } from '@teambit/component-id';
7
7
  import { ComponentModel } from '@teambit/component';
8
8
  import { useCloudScopes } from '@teambit/cloud.hooks.use-cloud-scopes';
9
9
  import { ScopeID } from '@teambit/scopes.scope-id';
10
- import { ComponentCard, ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
10
+ import { compact } from 'lodash';
11
+ import { WorkspaceComponentCard } from '@teambit/workspace.ui.workspace-component-card';
12
+ import { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
11
13
  import { WorkspaceContext } from '../workspace-context';
12
14
  import styles from './workspace-overview.module.scss';
13
15
  import { LinkPlugin } from './link-plugin';
@@ -20,27 +22,37 @@ export function WorkspaceOverview() {
20
22
  const uniqueScopesArr = Array.from(uniqueScopes);
21
23
  const { cloudScopes = [] } = useCloudScopes(uniqueScopesArr);
22
24
  const cloudScopesById = new Map(cloudScopes.map((scope) => [scope.id.toString(), scope]));
25
+
23
26
  const plugins = useCardPlugins({ compModelsById });
27
+
24
28
  if (!components || components.length === 0) return <EmptyWorkspace name={workspace.name} />;
29
+
25
30
  const compDescriptorById = new Map(componentDescriptors.map((comp) => [comp.id.toString(), comp]));
31
+ const componentsWithDescriptorAndScope = compact(
32
+ components.map((component) => {
33
+ if (component.deprecation?.isDeprecate) return null;
34
+ const componentDescriptor = compDescriptorById.get(component.id.toString());
35
+ if (!componentDescriptor) return null;
36
+ const cloudScope = cloudScopesById.get(component.id.scope);
37
+ const scope =
38
+ cloudScope ||
39
+ (ScopeID.isValid(component.id.scope) && { id: ScopeID.fromString(component.id.scope) }) ||
40
+ undefined;
41
+
42
+ return { component, componentDescriptor, scope };
43
+ })
44
+ );
45
+
26
46
  return (
27
47
  <div className={styles.container}>
28
- <ComponentGrid>
29
- {components.map((component) => {
30
- if (component.deprecation?.isDeprecate) return null;
31
- const compDescriptor = compDescriptorById.get(component.id.toString());
32
- if (!compDescriptor) return null;
33
- const cloudScope = cloudScopesById.get(component.id.scope);
34
- const scope =
35
- cloudScope ||
36
- (ScopeID.isValid(component.id.scope) && { id: ScopeID.fromString(component.id.scope) }) ||
37
- undefined;
48
+ <ComponentGrid className={styles.cardGrid}>
49
+ {componentsWithDescriptorAndScope.map(({ component, componentDescriptor, scope }) => {
38
50
  return (
39
- <ComponentCard
51
+ <WorkspaceComponentCard
40
52
  key={component.id.toString()}
41
- component={compDescriptor}
53
+ componentDescriptor={componentDescriptor}
54
+ component={component}
42
55
  plugins={plugins}
43
- displayOwnerDetails="all"
44
56
  scope={scope}
45
57
  />
46
58
  );
@@ -58,10 +70,16 @@ export function useCardPlugins({
58
70
  const plugins = React.useMemo(
59
71
  () => [
60
72
  {
61
- preview: function Preview({ component }) {
73
+ preview: function Preview({ component, shouldShowPreview }) {
62
74
  const compModel = compModelsById.get(component.id.toString());
63
75
  if (!compModel) return null;
64
- return <PreviewPlaceholder componentDescriptor={component} component={compModel} />;
76
+ return (
77
+ <PreviewPlaceholder
78
+ componentDescriptor={component}
79
+ component={compModel}
80
+ shouldShowPreview={shouldShowPreview}
81
+ />
82
+ );
65
83
  },
66
84
  },
67
85
  {
@@ -18,6 +18,7 @@ import { AspectLoaderMain } from '@teambit/aspect-loader';
18
18
  import { createInMemoryCache } from '@teambit/legacy/dist/cache/cache-factory';
19
19
  import ComponentNotFoundInPath from '@teambit/legacy/dist/consumer/component/exceptions/component-not-found-in-path';
20
20
  import { ComponentLoadOptions as LegacyComponentLoadOptions } from '@teambit/legacy/dist/consumer/component/component-loader';
21
+ import { pMapPool } from '@teambit/legacy/dist/utils/promise-with-concurrent';
21
22
  import { Workspace } from '../workspace';
22
23
  import { WorkspaceComponent } from './workspace-component';
23
24
  import { MergeConfigConflict } from '../exceptions/merge-config-conflict';
@@ -140,6 +141,9 @@ export class WorkspaceComponentLoader {
140
141
  const components = [...loadedComponents, ...loadOrCached.fromCache];
141
142
 
142
143
  // this.logger.clearStatusLine();
144
+ components.forEach((comp) => {
145
+ this.saveInCache(comp, { loadExtensions: true, executeLoadSlot: true });
146
+ });
143
147
  return { components, invalidComponents };
144
148
  }
145
149
 
@@ -288,7 +292,7 @@ export class WorkspaceComponentLoader {
288
292
  await this.workspace.loadComponentsExtensions(mergedExtensions);
289
293
  let wsComponentsWithAspects = workspaceComponents;
290
294
  // if (loadOpts.seeders) {
291
- wsComponentsWithAspects = await pMap(workspaceComponents, (component) => this.executeLoadSlot(component), {
295
+ wsComponentsWithAspects = await pMapPool(workspaceComponents, (component) => this.executeLoadSlot(component), {
292
296
  concurrency: concurrentComponentsLimit(),
293
297
  });
294
298
  await this.warnAboutMisconfiguredEnvs(wsComponentsWithAspects);
@@ -828,7 +832,7 @@ export class WorkspaceComponentLoader {
828
832
  }
829
833
 
830
834
  function createComponentCacheKey(id: ComponentID, loadOpts?: ComponentLoadOptions): string {
831
- const relevantOpts = pick(loadOpts, ['loadExtensions', 'executeLoadSlot']);
835
+ const relevantOpts = pick(loadOpts, ['loadExtensions', 'executeLoadSlot', 'loadDocs', 'loadCompositions']);
832
836
  return `${id.toString()}:${JSON.stringify(sortKeys(relevantOpts ?? {}))}`;
833
837
  }
834
838