@teambit/workspace 1.0.1079 → 1.0.1081

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 (77) hide show
  1. package/dist/{preview-1785260578779.js → preview-1785278532531.js} +2 -2
  2. package/dist/ui/workspace/use-workspace.js +179 -27
  3. package/dist/ui/workspace/use-workspace.js.map +1 -1
  4. package/dist/ui/workspace/workspace-overview/index.d.ts +1 -1
  5. package/dist/ui/workspace/workspace-overview/index.js +5 -5
  6. package/dist/ui/workspace/workspace-overview/index.js.map +1 -1
  7. package/dist/ui/workspace/workspace-overview/workspace-overview.js +13 -143
  8. package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
  9. package/dist/ui/workspace/workspace-skeleton.d.ts +8 -0
  10. package/dist/ui/workspace/workspace-skeleton.js +73 -0
  11. package/dist/ui/workspace/workspace-skeleton.js.map +1 -0
  12. package/dist/ui/workspace/workspace-skeleton.module.scss +102 -0
  13. package/dist/ui/workspace/workspace.js +23 -7
  14. package/dist/ui/workspace/workspace.js.map +1 -1
  15. package/package.json +65 -74
  16. package/ui/workspace/use-workspace.ts +185 -27
  17. package/ui/workspace/workspace-overview/index.ts +1 -1
  18. package/ui/workspace/workspace-overview/workspace-overview.tsx +9 -102
  19. package/ui/workspace/workspace-skeleton.module.scss +102 -0
  20. package/ui/workspace/workspace-skeleton.tsx +35 -0
  21. package/ui/workspace/workspace.tsx +16 -5
  22. package/dist/ui/workspace/workspace-overview/card-overlays.d.ts +0 -5
  23. package/dist/ui/workspace/workspace-overview/card-overlays.js +0 -133
  24. package/dist/ui/workspace/workspace-overview/card-overlays.js.map +0 -1
  25. package/dist/ui/workspace/workspace-overview/card-overlays.module.scss +0 -72
  26. package/dist/ui/workspace/workspace-overview/filter-utils.d.ts +0 -10
  27. package/dist/ui/workspace/workspace-overview/filter-utils.js +0 -40
  28. package/dist/ui/workspace/workspace-overview/filter-utils.js.map +0 -1
  29. package/dist/ui/workspace/workspace-overview/hope-component-card.d.ts +0 -15
  30. package/dist/ui/workspace/workspace-overview/hope-component-card.js +0 -186
  31. package/dist/ui/workspace/workspace-overview/hope-component-card.js.map +0 -1
  32. package/dist/ui/workspace/workspace-overview/hope-component-card.module.scss +0 -169
  33. package/dist/ui/workspace/workspace-overview/link-plugin.d.ts +0 -3
  34. package/dist/ui/workspace/workspace-overview/link-plugin.js +0 -14
  35. package/dist/ui/workspace/workspace-overview/link-plugin.js.map +0 -1
  36. package/dist/ui/workspace/workspace-overview/namespace-header.d.ts +0 -9
  37. package/dist/ui/workspace/workspace-overview/namespace-header.js +0 -107
  38. package/dist/ui/workspace/workspace-overview/namespace-header.js.map +0 -1
  39. package/dist/ui/workspace/workspace-overview/namespace-header.module.scss +0 -88
  40. package/dist/ui/workspace/workspace-overview/namespace-sort.d.ts +0 -8
  41. package/dist/ui/workspace/workspace-overview/namespace-sort.js +0 -47
  42. package/dist/ui/workspace/workspace-overview/namespace-sort.js.map +0 -1
  43. package/dist/ui/workspace/workspace-overview/scope-sort.d.ts +0 -1
  44. package/dist/ui/workspace/workspace-overview/scope-sort.js +0 -14
  45. package/dist/ui/workspace/workspace-overview/scope-sort.js.map +0 -1
  46. package/dist/ui/workspace/workspace-overview/use-query-param-with-default.d.ts +0 -6
  47. package/dist/ui/workspace/workspace-overview/use-query-param-with-default.js +0 -102
  48. package/dist/ui/workspace/workspace-overview/use-query-param-with-default.js.map +0 -1
  49. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.d.ts +0 -3
  50. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js +0 -88
  51. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js.map +0 -1
  52. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.d.ts +0 -13
  53. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js +0 -110
  54. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js.map +0 -1
  55. package/dist/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -91
  56. package/dist/ui/workspace/workspace-overview/workspace-overview.sort.d.ts +0 -1
  57. package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js +0 -30
  58. package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js.map +0 -1
  59. package/dist/ui/workspace/workspace-overview/workspace-overview.types.d.ts +0 -28
  60. package/dist/ui/workspace/workspace-overview/workspace-overview.types.js +0 -3
  61. package/dist/ui/workspace/workspace-overview/workspace-overview.types.js.map +0 -1
  62. package/ui/workspace/workspace-overview/card-overlays.module.scss +0 -72
  63. package/ui/workspace/workspace-overview/card-overlays.tsx +0 -66
  64. package/ui/workspace/workspace-overview/filter-utils.ts +0 -42
  65. package/ui/workspace/workspace-overview/hope-component-card.module.scss +0 -169
  66. package/ui/workspace/workspace-overview/hope-component-card.tsx +0 -152
  67. package/ui/workspace/workspace-overview/link-plugin.ts +0 -5
  68. package/ui/workspace/workspace-overview/namespace-header.module.scss +0 -88
  69. package/ui/workspace/workspace-overview/namespace-header.tsx +0 -72
  70. package/ui/workspace/workspace-overview/namespace-sort.ts +0 -44
  71. package/ui/workspace/workspace-overview/scope-sort.ts +0 -9
  72. package/ui/workspace/workspace-overview/use-query-param-with-default.ts +0 -115
  73. package/ui/workspace/workspace-overview/use-workspace-aggregation.ts +0 -79
  74. package/ui/workspace/workspace-overview/workspace-filter-panel.tsx +0 -109
  75. package/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -91
  76. package/ui/workspace/workspace-overview/workspace-overview.sort.ts +0 -29
  77. package/ui/workspace/workspace-overview/workspace-overview.types.ts +0 -30
@@ -1,79 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { sortNamespacesAdvanced, sortItemsByNamespace } from './namespace-sort';
3
- import { filterItems, type ActiveFilters } from './filter-utils';
4
- import type { WorkspaceItem, AggregationType, AggregationGroup, AggregationResult } from './workspace-overview.types';
5
-
6
- export function useWorkspaceAggregation(
7
- items: WorkspaceItem[],
8
- aggregation: AggregationType,
9
- filters: ActiveFilters
10
- ): AggregationResult {
11
- const filtered = useMemo(() => filterItems(items, filters), [items, filters]);
12
-
13
- if (aggregation === 'none') {
14
- return {
15
- groups: [
16
- {
17
- name: 'all',
18
- displayName: '',
19
- items: sortItemsByNamespace(filtered),
20
- },
21
- ],
22
- groupType: 'none',
23
- availableAggregations: ['namespaces', 'scopes', 'none'],
24
- filteredCount: filtered.length,
25
- };
26
- }
27
-
28
- if (aggregation === 'namespaces') {
29
- const map = new Map<string, WorkspaceItem[]>();
30
- for (const item of filtered) {
31
- const ns = item.component.id.namespace || '/';
32
- if (!map.has(ns)) map.set(ns, []);
33
- map.get(ns)!.push(item);
34
- }
35
-
36
- const sortedKeys = sortNamespacesAdvanced([...map.keys()]);
37
-
38
- const groups: AggregationGroup[] = sortedKeys.map((ns) => ({
39
- name: ns,
40
- displayName: ns,
41
- items: sortItemsByNamespace(map.get(ns)!),
42
- }));
43
-
44
- return {
45
- groups,
46
- groupType: 'namespaces',
47
- availableAggregations: ['namespaces', 'scopes', 'none'],
48
- filteredCount: filtered.length,
49
- };
50
- }
51
-
52
- const map = new Map<string, WorkspaceItem[]>();
53
- for (const item of filtered) {
54
- const scope = item.component.id.scope;
55
- if (!map.has(scope)) map.set(scope, []);
56
- map.get(scope)!.push(item);
57
- }
58
-
59
- const sortedScopes = [...map.keys()].sort();
60
-
61
- const groups: AggregationGroup[] = sortedScopes.map((sc) => {
62
- const groupItems = map.get(sc)!;
63
- const sampleScope = groupItems.find((i) => i.scope?.icon)?.scope;
64
- return {
65
- name: sc,
66
- displayName: sc,
67
- items: sortItemsByNamespace(groupItems),
68
- scopeIcon: sampleScope?.icon,
69
- scopeIconColor: sampleScope?.backgroundIconColor,
70
- };
71
- });
72
-
73
- return {
74
- groups,
75
- groupType: 'scopes',
76
- availableAggregations: ['namespaces', 'scopes', 'none'],
77
- filteredCount: filtered.length,
78
- };
79
- }
@@ -1,109 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { ToggleButton } from '@teambit/design.inputs.toggle-button';
3
- import { BaseFilter } from '@teambit/component.filters.base-filter';
4
- import type { WorkspaceItem, AggregationType } from './workspace-overview.types';
5
- import styles from './workspace-overview.module.scss';
6
-
7
- export interface WorkspaceFilterPanelProps {
8
- aggregation: AggregationType;
9
- onAggregationChange: (agg: AggregationType) => void;
10
- availableAggregations: AggregationType[];
11
- items: WorkspaceItem[];
12
- activeNamespaces: string[];
13
- onNamespacesChange: (namespaces: string[]) => void;
14
- activeScopes: string[];
15
- onScopesChange: (scopes: string[]) => void;
16
- }
17
-
18
- const LABELS: Record<AggregationType, string> = {
19
- namespaces: 'Namespaces',
20
- scopes: 'Scopes',
21
- none: 'None',
22
- };
23
-
24
- export function WorkspaceFilterPanel({
25
- aggregation,
26
- onAggregationChange,
27
- availableAggregations,
28
- items,
29
- activeNamespaces,
30
- onNamespacesChange,
31
- activeScopes,
32
- onScopesChange,
33
- }: WorkspaceFilterPanelProps) {
34
- const namespaceOptions = useMemo(
35
- () =>
36
- [...new Set(items.map((i) => i.component.id.namespace || '/'))].map((v) => ({
37
- value: v,
38
- })),
39
- [items]
40
- );
41
-
42
- const scopeOptions = useMemo(
43
- () =>
44
- [...new Set(items.map((i) => i.component.id.scope))].map((v) => ({
45
- value: v,
46
- })),
47
- [items]
48
- );
49
-
50
- const activeNsOptions = activeNamespaces.map((v) => ({ value: v }));
51
- const activeScopeOptions = activeScopes.map((v) => ({ value: v }));
52
-
53
- const applyNs = (opts: readonly { value?: string }[] | { value?: string } | null) => {
54
- const arr = Array.isArray(opts) ? opts : opts ? [opts] : [];
55
- const list = arr.map((o) => o.value).filter((v): v is string => typeof v === 'string');
56
- onNamespacesChange(list);
57
- };
58
-
59
- const applyScopes = (opts: readonly { value?: string }[] | { value?: string } | null) => {
60
- const arr = Array.isArray(opts) ? opts : opts ? [opts] : [];
61
- const list = arr.map((o) => o.value).filter((v): v is string => typeof v === 'string');
62
- onScopesChange(list);
63
- };
64
-
65
- const currentIndex = Math.max(
66
- 0,
67
- availableAggregations.findIndex((a) => a === aggregation)
68
- );
69
-
70
- const applyAgg = (i: number) => {
71
- const agg = availableAggregations[i];
72
- onAggregationChange(agg);
73
- };
74
-
75
- return (
76
- <div className={styles.commandBar}>
77
- <div className={styles.leftCluster}>
78
- <BaseFilter
79
- id="namespaces"
80
- placeholder="Namespaces"
81
- options={namespaceOptions}
82
- activeOptions={activeNsOptions}
83
- onChange={applyNs}
84
- isSearchable
85
- />
86
- <BaseFilter
87
- id="scopes"
88
- placeholder="Scopes"
89
- options={scopeOptions}
90
- activeOptions={activeScopeOptions}
91
- onChange={applyScopes}
92
- isSearchable
93
- />
94
- </div>
95
-
96
- <div className={styles.rightCluster}>
97
- <ToggleButton
98
- className={styles.aggToggle}
99
- defaultIndex={currentIndex}
100
- onOptionSelect={(idx) => applyAgg(idx)}
101
- options={availableAggregations.map((agg) => ({
102
- value: agg,
103
- element: LABELS[agg],
104
- }))}
105
- />
106
- </div>
107
- </div>
108
- );
109
- }
@@ -1,91 +0,0 @@
1
- @import '@teambit/ui-foundation.ui.constants.z-indexes/z-indexes.module.scss';
2
-
3
- .container {
4
- overflow-y: auto;
5
- height: 100%;
6
- box-sizing: border-box;
7
- z-index: 1;
8
- }
9
-
10
- .content {
11
- padding: 20px 40px 80px;
12
- }
13
-
14
- /* ---- Command bar ---- */
15
-
16
- .commandBar {
17
- display: flex;
18
- align-items: center;
19
- justify-content: space-between;
20
- gap: 12px;
21
- flex-wrap: wrap;
22
- padding: 12px 40px;
23
- background: color-mix(in srgb, var(--bit-accent-color, #6c5ce7) 3%, var(--background-color, #fff));
24
- border-bottom: 1px solid var(--border-medium-color);
25
- position: sticky;
26
- top: 0;
27
- z-index: $modal-z-index - 1;
28
- }
29
-
30
- .leftCluster {
31
- display: flex;
32
- align-items: center;
33
- gap: 8px;
34
- flex-wrap: wrap;
35
- }
36
-
37
- .rightCluster {
38
- display: flex;
39
- align-items: center;
40
- gap: 8px;
41
- margin-left: auto;
42
- }
43
-
44
- .aggToggle {
45
- height: 32px !important;
46
- font-size: 12.5px;
47
- --surface02-color: color-mix(in srgb, var(--bit-accent-color, #6c5ce7) 20%, var(--surface-color, #f5f5f5));
48
- }
49
-
50
- /* ---- Base filter overrides ---- */
51
-
52
- .commandBar :global(.baseFilter) {
53
- max-width: 220px;
54
- height: 32px;
55
- }
56
-
57
- .commandBar :global(.control) {
58
- border-radius: 8px !important;
59
- height: 32px;
60
- padding: 0 10px !important;
61
- }
62
-
63
- .commandBar :global(.menu) {
64
- z-index: $modal-z-index - 1 !important;
65
- border-radius: 14px !important;
66
- padding: 8px 0 !important;
67
- width: 260px;
68
- box-shadow: 0 24px 60px -12px rgba(20, 0, 104, 0.2);
69
- }
70
-
71
- /* ---- Section ---- */
72
-
73
- .section {
74
- margin-bottom: 40px;
75
- }
76
-
77
- .sectionHeader {
78
- position: sticky;
79
- top: 57px;
80
- z-index: $nav-z-index;
81
- background: var(--background-color);
82
- padding: 12px 0 18px;
83
- }
84
-
85
- /* ---- Card grid ---- */
86
-
87
- .cardGrid {
88
- display: grid;
89
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
90
- gap: 14px;
91
- }
@@ -1,29 +0,0 @@
1
- const PRIORITY_HIGH = ['ui', 'pages'];
2
- const PRIORITY_MED = ['design'];
3
- const PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'];
4
-
5
- function root(ns: string) {
6
- if (!ns) return '';
7
- return ns.split('/')[0];
8
- }
9
-
10
- function priorityOf(ns: string) {
11
- const r = root(ns);
12
-
13
- if (PRIORITY_HIGH.includes(r)) return 0;
14
- if (PRIORITY_MED.includes(r)) return 1;
15
- if (PRIORITY_LOW.includes(r)) return 3;
16
-
17
- return 2;
18
- }
19
-
20
- export function sortNamespacesAdvanced(arr: string[]) {
21
- return [...arr].sort((a, b) => {
22
- const pa = priorityOf(a);
23
- const pb = priorityOf(b);
24
-
25
- if (pa !== pb) return pa - pb;
26
-
27
- return a.localeCompare(b);
28
- });
29
- }
@@ -1,30 +0,0 @@
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
-
5
- export interface WorkspaceItem {
6
- component: ComponentModel;
7
- componentDescriptor: ComponentDescriptor;
8
- scope?: { id: ScopeID; icon?: string; backgroundIconColor?: string };
9
- }
10
-
11
- export type AggregationType = 'namespaces' | 'scopes' | 'none';
12
-
13
- export type Density = 'compact' | 'comfy';
14
-
15
- export type ComponentStatus = 'built' | 'changed' | 'building' | 'queued';
16
-
17
- export interface AggregationGroup {
18
- name: string;
19
- displayName: string;
20
- items: WorkspaceItem[];
21
- scopeIcon?: string;
22
- scopeIconColor?: string;
23
- }
24
-
25
- export interface AggregationResult {
26
- groups: AggregationGroup[];
27
- groupType: AggregationType;
28
- availableAggregations: AggregationType[];
29
- filteredCount: number;
30
- }