@teambit/workspace 1.0.843 → 1.0.845

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{preview-1765465587750.js → preview-1765561375887.js} +2 -2
  2. package/dist/ui/workspace/workspace-overview/filter-utils.d.ts +7 -0
  3. package/dist/ui/workspace/workspace-overview/filter-utils.js +24 -0
  4. package/dist/ui/workspace/workspace-overview/filter-utils.js.map +1 -0
  5. package/dist/ui/workspace/workspace-overview/namespace-sort.d.ts +8 -0
  6. package/dist/ui/workspace/workspace-overview/namespace-sort.js +44 -0
  7. package/dist/ui/workspace/workspace-overview/namespace-sort.js.map +1 -0
  8. package/dist/ui/workspace/workspace-overview/scope-sort.d.ts +1 -0
  9. package/dist/ui/workspace/workspace-overview/scope-sort.js +14 -0
  10. package/dist/ui/workspace/workspace-overview/scope-sort.js.map +1 -0
  11. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.d.ts +2 -0
  12. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js +84 -0
  13. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js.map +1 -0
  14. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.d.ts +7 -0
  15. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js +113 -0
  16. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js.map +1 -0
  17. package/dist/ui/workspace/workspace-overview/workspace-overview.js +91 -49
  18. package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
  19. package/dist/ui/workspace/workspace-overview/workspace-overview.module.scss +166 -12
  20. package/dist/ui/workspace/workspace-overview/workspace-overview.sort.d.ts +1 -0
  21. package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js +30 -0
  22. package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js.map +1 -0
  23. package/dist/ui/workspace/workspace-overview/workspace-overview.types.d.ts +22 -0
  24. package/dist/ui/workspace/workspace-overview/workspace-overview.types.js +3 -0
  25. package/dist/ui/workspace/workspace-overview/workspace-overview.types.js.map +1 -0
  26. package/package.json +22 -19
  27. package/ui/workspace/workspace-overview/filter-utils.ts +25 -0
  28. package/ui/workspace/workspace-overview/namespace-sort.ts +41 -0
  29. package/ui/workspace/workspace-overview/scope-sort.ts +9 -0
  30. package/ui/workspace/workspace-overview/use-workspace-aggregation.ts +72 -0
  31. package/ui/workspace/workspace-overview/workspace-filter-panel.tsx +112 -0
  32. package/ui/workspace/workspace-overview/workspace-overview.module.scss +166 -12
  33. package/ui/workspace/workspace-overview/workspace-overview.sort.ts +29 -0
  34. package/ui/workspace/workspace-overview/workspace-overview.tsx +53 -32
  35. package/ui/workspace/workspace-overview/workspace-overview.types.ts +24 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_explorerUiGallery","_workspaceUi","_previewUi","_designUi","_componentId","_cloudHooks","_scopes","_lodash","_workspaceUi2","_workspaceUi3","_workspaceContext","_workspaceOverviewModule","_interopRequireDefault","_linkPlugin","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","WorkspaceOverview","workspace","useContext","WorkspaceContext","isMinimal","useWorkspaceMode","compModelsById","Map","components","map","comp","id","toString","componentDescriptors","uniqueScopes","Set","c","scope","uniqueScopesArr","Array","from","cloudScopes","useCloudScopes","cloudScopesById","plugins","useCardPlugins","showPreview","length","createElement","EmptyWorkspace","name","compDescriptorById","componentsWithDescriptorAndScope","compact","component","deprecation","isDeprecate","componentDescriptor","cloudScope","ScopeID","isValid","fromString","undefined","className","styles","container","ComponentGrid","cardGrid","WorkspaceComponentCard","key","shouldShowPreviewState","serverUrlsSignature","React","useMemo","serversCount","values","filter","server","url","join","preview","Preview","shouldShowPreview","compModel","PreviewPlaceholder","previewBottomRight","PreviewBottomRight","env","envComponentId","ComponentID","rightPreviewPlugins","badge","Tooltip","delay","content","src","icon","envIcon","LinkPlugin","size"],"sources":["workspace-overview.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';\nimport { EmptyWorkspace } from '@teambit/workspace.ui.empty-workspace';\nimport { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';\nimport { Tooltip } from '@teambit/design.ui.tooltip';\nimport { ComponentID } from '@teambit/component-id';\nimport type { ComponentModel } from '@teambit/component';\nimport { useCloudScopes } from '@teambit/cloud.hooks.use-cloud-scopes';\nimport { ScopeID } from '@teambit/scopes.scope-id';\nimport { compact } from 'lodash';\nimport { WorkspaceComponentCard } from '@teambit/workspace.ui.workspace-component-card';\nimport type { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';\nimport { useWorkspaceMode } from '@teambit/workspace.ui.use-workspace-mode';\nimport { WorkspaceContext } from '../workspace-context';\nimport styles from './workspace-overview.module.scss';\nimport { LinkPlugin } from './link-plugin';\n\nexport function WorkspaceOverview() {\n const workspace = useContext(WorkspaceContext);\n const { isMinimal } = useWorkspaceMode();\n const compModelsById = new Map(workspace.components.map((comp) => [comp.id.toString(), comp]));\n const { components, componentDescriptors } = workspace;\n const uniqueScopes = new Set(components.map((c) => c.id.scope));\n const uniqueScopesArr = Array.from(uniqueScopes);\n const { cloudScopes = [] } = useCloudScopes(uniqueScopesArr);\n const cloudScopesById = new Map(cloudScopes.map((scope) => [scope.id.toString(), scope]));\n\n const plugins = useCardPlugins({ compModelsById, showPreview: isMinimal });\n\n if (!components || components.length === 0) return <EmptyWorkspace name={workspace.name} />;\n\n const compDescriptorById = new Map(componentDescriptors.map((comp) => [comp.id.toString(), comp]));\n const componentsWithDescriptorAndScope = compact(\n components.map((component) => {\n if (component.deprecation?.isDeprecate) return null;\n const componentDescriptor = compDescriptorById.get(component.id.toString());\n if (!componentDescriptor) return null;\n const cloudScope = cloudScopesById.get(component.id.scope);\n const scope =\n cloudScope ||\n (ScopeID.isValid(component.id.scope) && { id: ScopeID.fromString(component.id.scope) }) ||\n undefined;\n\n return { component, componentDescriptor, scope };\n })\n );\n\n return (\n <div className={styles.container}>\n <ComponentGrid className={styles.cardGrid}>\n {componentsWithDescriptorAndScope.map(({ component, componentDescriptor, scope }) => {\n return (\n <WorkspaceComponentCard\n key={component.id.toString()}\n componentDescriptor={componentDescriptor}\n component={component}\n plugins={plugins}\n scope={scope}\n shouldShowPreviewState={isMinimal}\n />\n );\n })}\n </ComponentGrid>\n </div>\n );\n}\n\nexport function useCardPlugins({\n compModelsById,\n showPreview,\n}: {\n compModelsById: Map<string, ComponentModel>;\n showPreview?: boolean;\n}): ComponentCardPluginType<PluginProps>[] {\n const serverUrlsSignature = React.useMemo(() => {\n const serversCount = Array.from(compModelsById.values())\n .filter((comp) => comp.server?.url)\n .map((comp) => comp.server?.url)\n .join(',');\n return serversCount;\n }, [compModelsById]);\n\n const plugins = React.useMemo(\n () => [\n {\n preview: function Preview({ component, shouldShowPreview }) {\n const compModel = compModelsById.get(component.id.toString());\n if (!compModel) return null;\n return (\n <PreviewPlaceholder\n componentDescriptor={component}\n component={compModel}\n shouldShowPreview={showPreview || shouldShowPreview}\n />\n );\n },\n },\n {\n previewBottomRight: function PreviewBottomRight({ component }) {\n const env = component.get('teambit.envs/envs');\n const envComponentId = env?.id ? ComponentID.fromString(env?.id) : undefined;\n\n return (\n <div className={styles.rightPreviewPlugins}>\n <div className={styles.badge}>\n <Tooltip delay={300} content={envComponentId?.name}>\n <img src={env?.icon} className={styles.envIcon} />\n </Tooltip>\n </div>\n </div>\n );\n },\n },\n new LinkPlugin(),\n ],\n [compModelsById.size, serverUrlsSignature, showPreview]\n );\n\n return plugins;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,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,UAAA,GAAA+F,kBAAkB;QACjB3B,mBAAmB,EAAEH,SAAU;QAC/BA,SAAS,EAAE6B,SAAU;QACrBD,iBAAiB,EAAEpC,WAAW,IAAIoC;MAAkB,CACrD,CAAC;IAEN;EACF,CAAC,EACD;IACEG,kBAAkB,EAAE,SAASC,kBAAkBA,CAAC;MAAEhC;IAAU,CAAC,EAAE;MAC7D,MAAMiC,GAAG,GAAGjC,SAAS,CAACzC,GAAG,CAAC,mBAAmB,CAAC;MAC9C,MAAM2E,cAAc,GAAGD,GAAG,EAAExD,EAAE,GAAG0D,0BAAW,CAAC5B,UAAU,CAAC0B,GAAG,EAAExD,EAAE,CAAC,GAAG+B,SAAS;MAE5E,oBACE/E,MAAA,GAAAoB,OAAA,CAAA6C,aAAA;QAAKe,SAAS,EAAEC,kCAAM,CAAC0B;MAAoB,gBACzC3G,MAAA,GAAAoB,OAAA,CAAA6C,aAAA;QAAKe,SAAS,EAAEC,kCAAM,CAAC2B;MAAM,gBAC3B5G,MAAA,GAAAoB,OAAA,CAAA6C,aAAA,CAAC1D,SAAA,GAAAsG,OAAO;QAACC,KAAK,EAAE,GAAI;QAACC,OAAO,EAAEN,cAAc,EAAEtC;MAAK,gBACjDnE,MAAA,GAAAoB,OAAA,CAAA6C,aAAA;QAAK+C,GAAG,EAAER,GAAG,EAAES,IAAK;QAACjC,SAAS,EAAEC,kCAAM,CAACiC;MAAQ,CAAE,CAC1C,CACN,CACF,CAAC;IAEV;EACF,CAAC,EACD,KAAIC,wBAAU,EAAC,CAAC,CACjB,EACD,CAACxE,cAAc,CAACyE,IAAI,EAAE5B,mBAAmB,EAAEzB,WAAW,CACxD,CAAC;EAED,OAAOF,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_explorerUiGallery","_workspaceUi","_previewUi","_designUi","_componentId","_lodash","_interopRequireDefault","_scopes","_cloudHooks","_reactRouterDom","_workspaceUi2","_workspaceUi3","_designUi2","_workspaceContext","_linkPlugin","_useWorkspaceAggregation","_workspaceFilterPanel","_workspaceOverviewModule","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","WorkspaceOverview","workspace","useContext","WorkspaceContext","components","componentDescriptors","length","createElement","EmptyWorkspace","name","isMinimal","useWorkspaceMode","compModelsById","useMemo","Map","map","c","id","toString","uniqueScopes","Set","scope","cloudScopes","useCloudScopes","cloudMap","s","compDescriptorMap","d","items","compact","component","deprecation","isDeprecate","descriptor","cloudScope","ScopeID","isValid","fromString","undefined","componentDescriptor","searchParams","useSearchParams","aggregation","groups","groupType","availableAggregations","filteredCount","useWorkspaceAggregation","plugins","useCardPlugins","showPreview","className","styles","container","WorkspaceFilterPanel","group","key","agg","H3","aggregationTitle","displayName","ComponentGrid","cardGrid","item","WorkspaceComponentCard","shouldShowPreviewState","serverUrlsSignature","React","serversCount","Array","from","values","filter","comp","server","url","join","preview","Preview","shouldShowPreview","compModel","PreviewPlaceholder","previewBottomRight","PreviewBottomRight","env","envComponentId","ComponentID","rightPreviewPlugins","badge","Tooltip","delay","content","src","icon","envIcon","LinkPlugin","size"],"sources":["workspace-overview.tsx"],"sourcesContent":["import React, { useContext, useMemo } from 'react';\nimport { ComponentGrid } from '@teambit/explorer.ui.gallery.component-grid';\nimport { EmptyWorkspace } from '@teambit/workspace.ui.empty-workspace';\nimport { PreviewPlaceholder } from '@teambit/preview.ui.preview-placeholder';\nimport { Tooltip } from '@teambit/design.ui.tooltip';\nimport { ComponentID } from '@teambit/component-id';\nimport type { ComponentModel } from '@teambit/component';\nimport compact from 'lodash.compact';\nimport { ScopeID } from '@teambit/scopes.scope-id';\nimport { useCloudScopes } from '@teambit/cloud.hooks.use-cloud-scopes';\nimport { useSearchParams } from 'react-router-dom';\nimport { WorkspaceComponentCard } from '@teambit/workspace.ui.workspace-component-card';\nimport type { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';\nimport { useWorkspaceMode } from '@teambit/workspace.ui.use-workspace-mode';\nimport { H3 } from '@teambit/design.ui.heading';\nimport { WorkspaceContext } from '../workspace-context';\nimport { LinkPlugin } from './link-plugin';\nimport { useWorkspaceAggregation } from './use-workspace-aggregation';\nimport { WorkspaceFilterPanel } from './workspace-filter-panel';\nimport styles from './workspace-overview.module.scss';\n\nexport function WorkspaceOverview() {\n const workspace = useContext(WorkspaceContext);\n const { components, componentDescriptors } = workspace;\n\n if (!components.length) return <EmptyWorkspace name={workspace.name} />;\n\n const { isMinimal } = useWorkspaceMode();\n const compModelsById = useMemo(() => new Map(components.map((c) => [c.id.toString(), c])), [components]);\n\n const uniqueScopes = [...new Set(components.map((c) => c.id.scope))];\n const { cloudScopes } = useCloudScopes(uniqueScopes);\n const cloudMap = new Map((cloudScopes || []).map((s) => [s.id.toString(), s]));\n\n const compDescriptorMap = new Map(componentDescriptors.map((d) => [d.id.toString(), d]));\n\n const items = compact(\n components.map((component) => {\n if (component.deprecation?.isDeprecate) return null;\n\n const descriptor = compDescriptorMap.get(component.id.toString());\n if (!descriptor) return null;\n\n const cloudScope = cloudMap.get(component.id.scope);\n const scope =\n cloudScope ||\n (ScopeID.isValid(component.id.scope) && { id: ScopeID.fromString(component.id.scope) }) ||\n undefined;\n\n return { component, componentDescriptor: descriptor, scope: (scope && { id: scope.id }) || undefined };\n })\n );\n\n const [searchParams] = useSearchParams();\n const aggregation = (searchParams.get('aggregation') as any) || 'namespaces';\n\n const { groups, groupType, availableAggregations, filteredCount } = useWorkspaceAggregation(items, aggregation);\n\n const plugins = useCardPlugins({ compModelsById, showPreview: isMinimal });\n\n return (\n <div className={styles.container}>\n <WorkspaceFilterPanel aggregation={aggregation} availableAggregations={availableAggregations} items={items} />\n\n {filteredCount === 0 && <EmptyWorkspace name={workspace.name} />}\n\n {groups.map((group) => (\n <section key={group.name} className={styles.agg}>\n {groupType !== 'none' && <H3 className={styles.aggregationTitle}>{group.displayName}</H3>}\n\n <ComponentGrid className={styles.cardGrid}>\n {group.items.map((item) => (\n <WorkspaceComponentCard\n key={item.component.id.toString()}\n component={item.component}\n componentDescriptor={item.componentDescriptor}\n scope={item.scope}\n plugins={plugins}\n shouldShowPreviewState={isMinimal}\n />\n ))}\n </ComponentGrid>\n </section>\n ))}\n </div>\n );\n}\n\nexport function useCardPlugins({\n compModelsById,\n showPreview,\n}: {\n compModelsById: Map<string, ComponentModel>;\n showPreview?: boolean;\n}): ComponentCardPluginType<PluginProps>[] {\n const serverUrlsSignature = React.useMemo(() => {\n const serversCount = Array.from(compModelsById.values())\n .filter((comp) => comp.server?.url)\n .map((comp) => comp.server?.url)\n .join(',');\n return serversCount;\n }, [compModelsById]);\n\n const plugins = React.useMemo(\n () => [\n {\n preview: function Preview({ component, shouldShowPreview }) {\n const compModel = compModelsById.get(component.id.toString());\n if (!compModel) return null;\n return (\n <PreviewPlaceholder\n componentDescriptor={component}\n component={compModel}\n shouldShowPreview={showPreview || shouldShowPreview}\n />\n );\n },\n },\n {\n previewBottomRight: function PreviewBottomRight({ component }) {\n const env = component.get('teambit.envs/envs');\n const envComponentId = env?.id ? ComponentID.fromString(env?.id) : undefined;\n\n return (\n <div className={styles.rightPreviewPlugins}>\n <div className={styles.badge}>\n <Tooltip delay={300} content={envComponentId?.name}>\n <img src={env?.icon} className={styles.envIcon} />\n </Tooltip>\n </div>\n </div>\n );\n },\n },\n new LinkPlugin(),\n ],\n [compModelsById.size, serverUrlsSignature, showPreview]\n );\n\n return plugins;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,mBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAA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AAOF,OAAO;AAChB","ignoreList":[]}
@@ -3,15 +3,11 @@
3
3
  overflow-y: auto;
4
4
  height: 100%;
5
5
  box-sizing: border-box;
6
+ z-index: 1;
6
7
  }
7
8
 
8
9
  .rightPreviewPlugins {
9
- // background-color: var(--surface-color);
10
10
  display: flex;
11
- // box-shadow: 0px 2px 48px rgb(0 0 0 / 89%);
12
- // box-shadow: 0px 2px 160px rgb(0 0 0 / 52%);
13
- // border-radius: 8px;
14
- // padding: 4px;
15
11
  align-items: flex-end;
16
12
  justify-content: flex-end;
17
13
  width: 100%;
@@ -19,10 +15,7 @@
19
15
  }
20
16
 
21
17
  .envIcon {
22
- // padding-right: 4px;
23
- // height: 24px;
24
18
  height: 14px;
25
- // padding-top: 2px;
26
19
  }
27
20
 
28
21
  .badge {
@@ -37,12 +30,173 @@
37
30
  }
38
31
 
39
32
  .cardGrid {
40
- grid-column-gap: 10px;
41
- grid-gap: 32px 24px;
42
- -moz-column-gap: 10px;
43
- column-gap: 10px;
44
33
  display: grid;
45
34
  gap: 32px 24px;
46
35
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
47
36
  max-width: 1280px;
37
+ grid-column-gap: 28px;
38
+ grid-row-gap: 32px;
39
+ }
40
+
41
+ .filterPanel {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: space-between;
45
+ margin-bottom: 24px;
46
+ position: relative;
47
+ z-index: 100000;
48
+ }
49
+
50
+ .aggButtons {
51
+ display: inline-flex;
52
+ background: var(--surface-1-color);
53
+ border: 1px solid var(--border-medium-color);
54
+ border-radius: 8px;
55
+ padding: 2px;
56
+ height: 34px;
57
+ }
58
+
59
+ .aggButton,
60
+ .aggActive {
61
+ padding: 4px 12px;
62
+ font-size: 14px;
63
+ border-radius: 6px;
64
+ background: transparent;
65
+ cursor: pointer;
66
+ border: none;
67
+ display: flex;
68
+ align-items: center;
69
+ }
70
+
71
+ .aggButton:hover {
72
+ background: var(--surface-hover-color);
73
+ }
74
+
75
+ .aggActive {
76
+ background: var(--brand-primary-color);
77
+ color: white;
78
+ }
79
+
80
+ .dropdownList {
81
+ max-height: 260px;
82
+ overflow-y: auto;
83
+ padding: 0 12px;
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 8px;
87
+ }
88
+
89
+ .dropdownItem {
90
+ display: flex;
91
+ align-items: center;
92
+ gap: 8px;
93
+ font-size: 14px;
94
+ cursor: pointer;
95
+ }
96
+
97
+ .dropdownItem input {
98
+ width: 16px;
99
+ height: 16px;
100
+ }
101
+
102
+ .count {
103
+ opacity: 0.55;
104
+ }
105
+
106
+ .agg {
107
+ margin-bottom: 28px;
108
+ }
109
+
110
+ .aggregationTitle {
111
+ margin-top: 0;
112
+ margin-bottom: 15px;
113
+ }
114
+
115
+ :global(.componentGrid) {
116
+ grid-row-gap: 24px !important;
117
+ grid-column-gap: 16px !important;
118
+ }
119
+
120
+ .filterPanel :global(.baseFilter) {
121
+ max-width: 220px;
122
+ height: 32px;
123
+ }
124
+
125
+ .filterPanel :global(.control) {
126
+ border-radius: 8px !important;
127
+ height: 32px;
128
+ padding: 0 10px !important;
129
+ }
130
+
131
+ .filterPanel :global(.menu) {
132
+ z-index: 200000 !important;
133
+ border-radius: 8px !important;
134
+ padding: 8px 0 !important;
135
+ }
136
+
137
+ .filterDropdown :global(.baseFilter) {
138
+ height: 32px;
139
+ max-width: 240px;
140
+ font-size: 14px;
141
+ }
142
+
143
+ .filterDropdown :global(.baseFilter .control) {
144
+ padding: 8px 12px;
145
+ border-radius: 8px;
146
+ }
147
+
148
+ .filterDropdown :global(.menu) {
149
+ margin-top: 10px;
150
+ padding: 12px 0;
151
+ min-width: 260px;
152
+ border-radius: 12px;
153
+
154
+ box-shadow: var(--bit-shadow-hover-low, 0 2px 8px rgba(0, 0, 0, 0.1));
155
+ border: 1px solid var(--border-medium-color, #ededed);
156
+ }
157
+
158
+ .filterDropdown :global(.checkboxContainer) {
159
+ padding-left: 14px;
160
+ }
161
+
162
+ .filterDropdown :global(.checkbox) {
163
+ margin-right: 12px;
164
+ accent-color: var(--bit-accent-color, #6c5ce7);
165
+ }
166
+
167
+ .filterDropdown :global(.buttonsSection) {
168
+ padding: 12px 16px;
169
+ border-top: 1px solid var(--border-medium-color, #ededed);
170
+ }
171
+
172
+ .filterDropdown :global(.placeholder > span:not(:first-child)) {
173
+ margin-left: 8px;
174
+ }
175
+
176
+ .filterPanel {
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: space-between;
180
+ margin-bottom: 24px;
181
+ gap: 16px;
182
+ }
183
+
184
+ .leftFilters {
185
+ display: flex;
186
+ gap: 12px;
187
+ align-items: center;
188
+ }
189
+
190
+ .rightAggToggle {
191
+ display: flex;
192
+ align-items: center;
193
+ margin-left: auto;
194
+ }
195
+
196
+ .cardGrid {
197
+ display: grid;
198
+ grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
199
+ grid-row-gap: 32px;
200
+ grid-column-gap: 24px;
201
+ max-width: 1280px;
48
202
  }
@@ -0,0 +1 @@
1
+ export declare function sortNamespacesAdvanced(arr: string[]): string[];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sortNamespacesAdvanced = sortNamespacesAdvanced;
7
+ const PRIORITY_HIGH = ['ui', 'pages'];
8
+ const PRIORITY_MED = ['design'];
9
+ const PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'];
10
+ function root(ns) {
11
+ if (!ns) return '';
12
+ return ns.split('/')[0];
13
+ }
14
+ function priorityOf(ns) {
15
+ const r = root(ns);
16
+ if (PRIORITY_HIGH.includes(r)) return 0;
17
+ if (PRIORITY_MED.includes(r)) return 1;
18
+ if (PRIORITY_LOW.includes(r)) return 3;
19
+ return 2;
20
+ }
21
+ function sortNamespacesAdvanced(arr) {
22
+ return [...arr].sort((a, b) => {
23
+ const pa = priorityOf(a);
24
+ const pb = priorityOf(b);
25
+ if (pa !== pb) return pa - pb;
26
+ return a.localeCompare(b);
27
+ });
28
+ }
29
+
30
+ //# sourceMappingURL=workspace-overview.sort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PRIORITY_HIGH","PRIORITY_MED","PRIORITY_LOW","root","ns","split","priorityOf","r","includes","sortNamespacesAdvanced","arr","sort","a","b","pa","pb","localeCompare"],"sources":["workspace-overview.sort.ts"],"sourcesContent":["const PRIORITY_HIGH = ['ui', 'pages'];\nconst PRIORITY_MED = ['design'];\nconst PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'];\n\nfunction root(ns: string) {\n if (!ns) return '';\n return ns.split('/')[0];\n}\n\nfunction priorityOf(ns: string) {\n const r = root(ns);\n\n if (PRIORITY_HIGH.includes(r)) return 0;\n if (PRIORITY_MED.includes(r)) return 1;\n if (PRIORITY_LOW.includes(r)) return 3;\n\n return 2;\n}\n\nexport function sortNamespacesAdvanced(arr: string[]) {\n return [...arr].sort((a, b) => {\n const pa = priorityOf(a);\n const pb = priorityOf(b);\n\n if (pa !== pb) return pa - pb;\n\n return a.localeCompare(b);\n });\n}\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;AACrC,MAAMC,YAAY,GAAG,CAAC,QAAQ,CAAC;AAC/B,MAAMC,YAAY,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC;AAE/D,SAASC,IAAIA,CAACC,EAAU,EAAE;EACxB,IAAI,CAACA,EAAE,EAAE,OAAO,EAAE;EAClB,OAAOA,EAAE,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACzB;AAEA,SAASC,UAAUA,CAACF,EAAU,EAAE;EAC9B,MAAMG,CAAC,GAAGJ,IAAI,CAACC,EAAE,CAAC;EAElB,IAAIJ,aAAa,CAACQ,QAAQ,CAACD,CAAC,CAAC,EAAE,OAAO,CAAC;EACvC,IAAIN,YAAY,CAACO,QAAQ,CAACD,CAAC,CAAC,EAAE,OAAO,CAAC;EACtC,IAAIL,YAAY,CAACM,QAAQ,CAACD,CAAC,CAAC,EAAE,OAAO,CAAC;EAEtC,OAAO,CAAC;AACV;AAEO,SAASE,sBAAsBA,CAACC,GAAa,EAAE;EACpD,OAAO,CAAC,GAAGA,GAAG,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IAC7B,MAAMC,EAAE,GAAGR,UAAU,CAACM,CAAC,CAAC;IACxB,MAAMG,EAAE,GAAGT,UAAU,CAACO,CAAC,CAAC;IAExB,IAAIC,EAAE,KAAKC,EAAE,EAAE,OAAOD,EAAE,GAAGC,EAAE;IAE7B,OAAOH,CAAC,CAACI,aAAa,CAACH,CAAC,CAAC;EAC3B,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ import type { ComponentModel } from '@teambit/component';
2
+ import type { ComponentDescriptor } from '@teambit/component-descriptor';
3
+ import type { ScopeID } from '@teambit/scopes.scope-id';
4
+ export interface WorkspaceItem {
5
+ component: ComponentModel;
6
+ componentDescriptor: ComponentDescriptor;
7
+ scope?: {
8
+ id: ScopeID;
9
+ };
10
+ }
11
+ export type AggregationType = 'namespaces' | 'scopes' | 'none';
12
+ export interface AggregationGroup {
13
+ name: string;
14
+ displayName: string;
15
+ items: WorkspaceItem[];
16
+ }
17
+ export interface AggregationResult {
18
+ groups: AggregationGroup[];
19
+ groupType: AggregationType;
20
+ availableAggregations: AggregationType[];
21
+ filteredCount: number;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ //# sourceMappingURL=workspace-overview.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["workspace-overview.types.ts"],"sourcesContent":["import type { ComponentModel } from '@teambit/component';\nimport type { ComponentDescriptor } from '@teambit/component-descriptor';\nimport type { ScopeID } from '@teambit/scopes.scope-id';\n\nexport interface WorkspaceItem {\n component: ComponentModel;\n componentDescriptor: ComponentDescriptor;\n scope?: { id: ScopeID };\n}\n\nexport type AggregationType = 'namespaces' | 'scopes' | 'none';\n\nexport interface AggregationGroup {\n name: string;\n displayName: string;\n items: WorkspaceItem[];\n}\n\nexport interface AggregationResult {\n groups: AggregationGroup[];\n groupType: AggregationType;\n availableAggregations: AggregationType[];\n filteredCount: number;\n}\n"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "1.0.843",
3
+ "version": "1.0.845",
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.843"
9
+ "version": "1.0.845"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -94,7 +94,10 @@
94
94
  "@teambit/workspace.hooks.use-navigation-message-listener": "0.0.1",
95
95
  "@teambit/workspace.hooks.use-url-change-broadcaster": "0.0.1",
96
96
  "@teambit/workspace.ui.preserve-workspace-mode": "0.0.2",
97
+ "@teambit/component.filters.base-filter": "0.0.6",
98
+ "@teambit/design.inputs.toggle-button": "0.0.13",
97
99
  "@teambit/cloud.hooks.use-cloud-scopes": "0.0.15",
100
+ "@teambit/design.ui.heading": "1.0.26",
98
101
  "@teambit/design.ui.tooltip": "0.0.382",
99
102
  "@teambit/explorer.ui.component-card": "0.0.51",
100
103
  "@teambit/explorer.ui.gallery.component-grid": "0.0.496",
@@ -102,23 +105,23 @@
102
105
  "@teambit/scopes.scope-id": "0.0.9",
103
106
  "@teambit/workspace.ui.empty-workspace": "0.0.509",
104
107
  "@teambit/workspace.ui.workspace-component-card": "0.0.565",
105
- "@teambit/component": "1.0.843",
106
- "@teambit/dependency-resolver": "1.0.843",
107
- "@teambit/envs": "1.0.843",
108
- "@teambit/objects": "0.0.350",
109
- "@teambit/scope": "1.0.843",
110
- "@teambit/graph": "1.0.843",
111
- "@teambit/isolator": "1.0.843",
112
- "@teambit/component-tree": "1.0.843",
113
- "@teambit/watcher": "1.0.843",
114
- "@teambit/aspect-loader": "1.0.843",
115
- "@teambit/graphql": "1.0.843",
116
- "@teambit/bundler": "1.0.843",
117
- "@teambit/ui": "1.0.843",
118
- "@teambit/command-bar": "1.0.843",
119
- "@teambit/sidebar": "1.0.843",
120
- "@teambit/pubsub": "1.0.843",
121
- "@teambit/deprecation": "1.0.843"
108
+ "@teambit/component": "1.0.845",
109
+ "@teambit/dependency-resolver": "1.0.845",
110
+ "@teambit/envs": "1.0.845",
111
+ "@teambit/objects": "0.0.352",
112
+ "@teambit/scope": "1.0.845",
113
+ "@teambit/graph": "1.0.845",
114
+ "@teambit/isolator": "1.0.845",
115
+ "@teambit/component-tree": "1.0.845",
116
+ "@teambit/watcher": "1.0.845",
117
+ "@teambit/aspect-loader": "1.0.845",
118
+ "@teambit/graphql": "1.0.845",
119
+ "@teambit/bundler": "1.0.845",
120
+ "@teambit/ui": "1.0.845",
121
+ "@teambit/command-bar": "1.0.845",
122
+ "@teambit/sidebar": "1.0.845",
123
+ "@teambit/pubsub": "1.0.845",
124
+ "@teambit/deprecation": "1.0.845"
122
125
  },
123
126
  "devDependencies": {
124
127
  "@types/lodash": "4.14.165",
@@ -0,0 +1,25 @@
1
+ import type { WorkspaceItem } from './workspace-overview.types';
2
+
3
+ export interface ActiveFilters {
4
+ namespaces: string[];
5
+ scopes: string[];
6
+ }
7
+
8
+ export function parseActiveFilters(search: URLSearchParams): ActiveFilters {
9
+ return {
10
+ namespaces: (search.get('ns') || '').split(',').filter(Boolean),
11
+ scopes: (search.get('scopes') || '').split(',').filter(Boolean),
12
+ };
13
+ }
14
+
15
+ export function filterItems(items: WorkspaceItem[], filters: ActiveFilters): WorkspaceItem[] {
16
+ return items.filter((item) => {
17
+ const ns = item.component.id.namespace || '/';
18
+ const sc = item.component.id.scope;
19
+
20
+ if (filters.namespaces.length && !filters.namespaces.includes(ns)) return false;
21
+ if (filters.scopes.length && !filters.scopes.includes(sc)) return false;
22
+
23
+ return true;
24
+ });
25
+ }
@@ -0,0 +1,41 @@
1
+ import type { WorkspaceItem } from './workspace-overview.types';
2
+
3
+ export const PRIORITY_HIGH = ['ui', 'pages'] as string[];
4
+ export const PRIORITY_MED = ['design'] as string[];
5
+ export const PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'] as string[];
6
+
7
+ export function getRootNamespace(ns: string): string {
8
+ if (!ns) return '';
9
+ return ns.split('/')[0]!;
10
+ }
11
+
12
+ export function namespacePriority(ns: string): number {
13
+ const root = getRootNamespace(ns);
14
+
15
+ if (PRIORITY_HIGH.includes(root)) return 0;
16
+ if (PRIORITY_MED.includes(root)) return 1;
17
+ if (PRIORITY_LOW.includes(root)) return 3;
18
+ return 2;
19
+ }
20
+
21
+ export function sortNamespacesAdvanced(list: string[]): string[] {
22
+ return [...list].sort((a, b) => {
23
+ const pa = namespacePriority(a);
24
+ const pb = namespacePriority(b);
25
+ if (pa !== pb) return pa - pb;
26
+ return a.localeCompare(b);
27
+ });
28
+ }
29
+
30
+ export function sortItemsByNamespace(items: WorkspaceItem[]): WorkspaceItem[] {
31
+ return [...items].sort((a, b) => {
32
+ const na = a.component.id.namespace || '/';
33
+ const nb = b.component.id.namespace || '/';
34
+
35
+ const pa = namespacePriority(na);
36
+ const pb = namespacePriority(nb);
37
+ if (pa !== pb) return pa - pb;
38
+
39
+ return a.component.id.name.localeCompare(b.component.id.name);
40
+ });
41
+ }
@@ -0,0 +1,9 @@
1
+ export function sortScopes(scopes: string[]) {
2
+ const designPrefix = 'design';
3
+
4
+ const nonDesign = scopes.filter((s) => !s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));
5
+
6
+ const design = scopes.filter((s) => s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));
7
+
8
+ return [...nonDesign, ...design];
9
+ }
@@ -0,0 +1,72 @@
1
+ import { useMemo } from 'react';
2
+ import { sortNamespacesAdvanced, sortItemsByNamespace } from './namespace-sort';
3
+ import { filterItems, parseActiveFilters } from './filter-utils';
4
+ import type { WorkspaceItem, AggregationType, AggregationGroup, AggregationResult } from './workspace-overview.types';
5
+
6
+ export function useWorkspaceAggregation(items: WorkspaceItem[], aggregation: AggregationType): AggregationResult {
7
+ const search = new URLSearchParams(window.location.search);
8
+ const filters = parseActiveFilters(search);
9
+
10
+ const filtered = useMemo(() => filterItems(items, filters), [items, filters]);
11
+
12
+ if (aggregation === 'none') {
13
+ return {
14
+ groups: [
15
+ {
16
+ name: 'all',
17
+ displayName: '',
18
+ items: sortItemsByNamespace(filtered),
19
+ },
20
+ ],
21
+ groupType: 'none',
22
+ availableAggregations: ['namespaces', 'scopes', 'none'],
23
+ filteredCount: filtered.length,
24
+ };
25
+ }
26
+
27
+ if (aggregation === 'namespaces') {
28
+ const map = new Map<string, WorkspaceItem[]>();
29
+ for (const item of filtered) {
30
+ const ns = item.component.id.namespace || '/';
31
+ if (!map.has(ns)) map.set(ns, []);
32
+ map.get(ns)!.push(item);
33
+ }
34
+
35
+ const sortedKeys = sortNamespacesAdvanced([...map.keys()]);
36
+
37
+ const groups: AggregationGroup[] = sortedKeys.map((ns) => ({
38
+ name: ns,
39
+ displayName: ns,
40
+ items: sortItemsByNamespace(map.get(ns)!),
41
+ }));
42
+
43
+ return {
44
+ groups,
45
+ groupType: 'namespaces',
46
+ availableAggregations: ['namespaces', 'scopes', 'none'],
47
+ filteredCount: filtered.length,
48
+ };
49
+ }
50
+
51
+ const map = new Map<string, WorkspaceItem[]>();
52
+ for (const item of filtered) {
53
+ const scope = item.component.id.scope;
54
+ if (!map.has(scope)) map.set(scope, []);
55
+ map.get(scope)!.push(item);
56
+ }
57
+
58
+ const sortedScopes = [...map.keys()].sort();
59
+
60
+ const groups: AggregationGroup[] = sortedScopes.map((sc) => ({
61
+ name: sc,
62
+ displayName: sc,
63
+ items: sortItemsByNamespace(map.get(sc)!),
64
+ }));
65
+
66
+ return {
67
+ groups,
68
+ groupType: 'scopes',
69
+ availableAggregations: ['namespaces', 'scopes', 'none'],
70
+ filteredCount: filtered.length,
71
+ };
72
+ }