@teambit/workspace 1.0.983 → 1.0.985

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 (45) hide show
  1. package/dist/{preview-1778621260574.js → preview-1778686821215.js} +2 -2
  2. package/dist/ui/workspace/use-workspace.d.ts +7 -6
  3. package/dist/ui/workspace/workspace-overview/card-overlays.d.ts +4 -0
  4. package/dist/ui/workspace/workspace-overview/card-overlays.js +133 -0
  5. package/dist/ui/workspace/workspace-overview/card-overlays.js.map +1 -0
  6. package/dist/ui/workspace/workspace-overview/card-overlays.module.scss +72 -0
  7. package/dist/ui/workspace/workspace-overview/filter-utils.d.ts +4 -1
  8. package/dist/ui/workspace/workspace-overview/filter-utils.js +17 -1
  9. package/dist/ui/workspace/workspace-overview/filter-utils.js.map +1 -1
  10. package/dist/ui/workspace/workspace-overview/hope-component-card.d.ts +14 -0
  11. package/dist/ui/workspace/workspace-overview/hope-component-card.js +186 -0
  12. package/dist/ui/workspace/workspace-overview/hope-component-card.js.map +1 -0
  13. package/dist/ui/workspace/workspace-overview/hope-component-card.module.scss +162 -0
  14. package/dist/ui/workspace/workspace-overview/namespace-header.d.ts +8 -0
  15. package/dist/ui/workspace/workspace-overview/namespace-header.js +107 -0
  16. package/dist/ui/workspace/workspace-overview/namespace-header.js.map +1 -0
  17. package/dist/ui/workspace/workspace-overview/namespace-header.module.scss +88 -0
  18. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js +11 -5
  19. package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js.map +1 -1
  20. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js +8 -6
  21. package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js.map +1 -1
  22. package/dist/ui/workspace/workspace-overview/workspace-overview.d.ts +0 -6
  23. package/dist/ui/workspace/workspace-overview/workspace-overview.js +38 -105
  24. package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
  25. package/dist/ui/workspace/workspace-overview/workspace-overview.module.scss +38 -158
  26. package/dist/ui/workspace/workspace-overview/workspace-overview.types.d.ts +6 -0
  27. package/dist/ui/workspace/workspace-overview/workspace-overview.types.js.map +1 -1
  28. package/dist/ui/workspace/workspace.js +22 -5
  29. package/dist/ui/workspace/workspace.js.map +1 -1
  30. package/dist/ui/workspace/workspace.module.scss +38 -30
  31. package/package.json +43 -44
  32. package/ui/workspace/workspace-overview/card-overlays.module.scss +72 -0
  33. package/ui/workspace/workspace-overview/card-overlays.tsx +66 -0
  34. package/ui/workspace/workspace-overview/filter-utils.ts +18 -1
  35. package/ui/workspace/workspace-overview/hope-component-card.module.scss +162 -0
  36. package/ui/workspace/workspace-overview/hope-component-card.tsx +152 -0
  37. package/ui/workspace/workspace-overview/namespace-header.module.scss +88 -0
  38. package/ui/workspace/workspace-overview/namespace-header.tsx +72 -0
  39. package/ui/workspace/workspace-overview/use-workspace-aggregation.ts +11 -5
  40. package/ui/workspace/workspace-overview/workspace-filter-panel.tsx +10 -9
  41. package/ui/workspace/workspace-overview/workspace-overview.module.scss +38 -158
  42. package/ui/workspace/workspace-overview/workspace-overview.tsx +40 -88
  43. package/ui/workspace/workspace-overview/workspace-overview.types.ts +7 -1
  44. package/ui/workspace/workspace.module.scss +38 -30
  45. package/ui/workspace/workspace.tsx +24 -7
@@ -0,0 +1,162 @@
1
+ .card {
2
+ position: relative;
3
+ border-radius: 10px;
4
+ overflow: hidden;
5
+ background: var(--surface-color);
6
+ border: 1px solid var(--border-medium-color);
7
+ cursor: pointer;
8
+ transition:
9
+ box-shadow 0.15s ease,
10
+ border-color 0.15s ease;
11
+
12
+ &:hover {
13
+ box-shadow: 0 4px 14px rgba(20, 0, 104, 0.06);
14
+ }
15
+ }
16
+
17
+ .cardBuilding {
18
+ composes: card;
19
+
20
+ &:hover {
21
+ box-shadow: none;
22
+ }
23
+ }
24
+
25
+ .linkWrapper {
26
+ text-decoration: none;
27
+ color: inherit;
28
+ display: block;
29
+ }
30
+
31
+ /* ---- Preview ---- */
32
+
33
+ .preview {
34
+ height: 180px;
35
+ position: relative;
36
+ overflow: hidden;
37
+ background: white;
38
+ border-bottom: 1px solid var(--border-medium-color);
39
+ }
40
+
41
+ .previewQueued {
42
+ composes: preview;
43
+ background: var(--surface01-color);
44
+ }
45
+
46
+ .previewInner {
47
+ position: absolute;
48
+ inset: 0;
49
+ overflow: hidden;
50
+ }
51
+
52
+ /* ---- Env badge ---- */
53
+
54
+ .envBadge {
55
+ position: absolute;
56
+ bottom: 8px;
57
+ right: 8px;
58
+ background: var(--surface-color);
59
+ padding: 4px;
60
+ border-radius: 8px;
61
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ width: 24px;
66
+ height: 24px;
67
+ z-index: 3;
68
+ }
69
+
70
+ .envIcon {
71
+ height: 14px;
72
+ display: block;
73
+ }
74
+
75
+ /* ---- Status corner ---- */
76
+
77
+ .statusCorner {
78
+ position: absolute;
79
+ top: 10px;
80
+ right: 10px;
81
+ z-index: 2;
82
+ }
83
+
84
+ /* ---- Footer ---- */
85
+
86
+ .footer {
87
+ padding: 8px 12px;
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 8px;
91
+ }
92
+
93
+ .name {
94
+ flex: 1;
95
+ min-width: 0;
96
+ font-size: 12.5px;
97
+ font-weight: 500;
98
+ font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
99
+ color: var(--on-background-color);
100
+ overflow: hidden;
101
+ text-overflow: ellipsis;
102
+ white-space: nowrap;
103
+ letter-spacing: -0.01em;
104
+ }
105
+
106
+ .nameQueued {
107
+ composes: name;
108
+ color: var(--on-background-medium-color);
109
+ }
110
+
111
+ .hash {
112
+ font-size: 10.5px;
113
+ padding: 1px 6px;
114
+ border-radius: 4px;
115
+ background: var(--surface01-color);
116
+ font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
117
+ color: var(--on-background-low-color);
118
+ flex-shrink: 0;
119
+ }
120
+
121
+ .scopeBadge {
122
+ width: 20px;
123
+ height: 20px;
124
+ border-radius: 5px;
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ flex-shrink: 0;
129
+ overflow: hidden;
130
+ }
131
+
132
+ .scopeBadgeIcon {
133
+ width: 12px;
134
+ height: 12px;
135
+ object-fit: contain;
136
+ filter: brightness(0) invert(1);
137
+ }
138
+
139
+ .scopeBadgeInitial {
140
+ font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
141
+ font-size: 10px;
142
+ font-weight: 700;
143
+ color: white;
144
+ line-height: 1;
145
+ }
146
+
147
+ .buildingLabel {
148
+ font-size: 10px;
149
+ font-weight: 600;
150
+ letter-spacing: 0.06em;
151
+ text-transform: uppercase;
152
+ flex-shrink: 0;
153
+ }
154
+
155
+ /* ---- Load preview button ---- */
156
+
157
+ .loadPreview {
158
+ position: absolute;
159
+ right: 4px !important;
160
+ left: unset !important;
161
+ z-index: 4;
162
+ }
@@ -0,0 +1,8 @@
1
+ import type { WorkspaceItem } from './workspace-overview.types';
2
+ export interface NamespaceHeaderProps {
3
+ namespace: string;
4
+ items: WorkspaceItem[];
5
+ scopeIcon?: string;
6
+ scopeIconColor?: string;
7
+ }
8
+ export declare function NamespaceHeader({ namespace, items, scopeIcon, scopeIconColor }: NamespaceHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NamespaceHeader = NamespaceHeader;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _filterUtils() {
15
+ const data = require("./filter-utils");
16
+ _filterUtils = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _namespaceHeaderModule() {
22
+ const data = _interopRequireDefault(require("./namespace-header.module.scss"));
23
+ _namespaceHeaderModule = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
29
+ function NamespaceHeader({
30
+ namespace,
31
+ items,
32
+ scopeIcon,
33
+ scopeIconColor
34
+ }) {
35
+ const accent = 'var(--bit-accent-color, #6c5ce7)';
36
+ const tint = 'color-mix(in srgb, var(--bit-accent-color, #6c5ce7) 12%, transparent)';
37
+ let buildingCount = 0;
38
+ let readyCount = 0;
39
+ for (const item of items) {
40
+ const s = (0, _filterUtils().getComponentStatus)(item);
41
+ if (s === 'building') buildingCount++;
42
+ if (s === 'built' || s === 'changed') readyCount++;
43
+ }
44
+ return /*#__PURE__*/_react().default.createElement("header", {
45
+ className: _namespaceHeaderModule().default.header
46
+ }, /*#__PURE__*/_react().default.createElement(HeaderIcon, {
47
+ scopeIcon: scopeIcon,
48
+ scopeIconColor: scopeIconColor,
49
+ namespace: namespace,
50
+ accent: accent
51
+ }), /*#__PURE__*/_react().default.createElement("span", {
52
+ className: _namespaceHeaderModule().default.name
53
+ }, namespace), /*#__PURE__*/_react().default.createElement("span", {
54
+ className: _namespaceHeaderModule().default.count
55
+ }, readyCount, "/", items.length), buildingCount > 0 && /*#__PURE__*/_react().default.createElement("span", {
56
+ className: _namespaceHeaderModule().default.buildingPill,
57
+ style: {
58
+ color: accent,
59
+ background: tint
60
+ }
61
+ }, /*#__PURE__*/_react().default.createElement("span", {
62
+ className: _namespaceHeaderModule().default.buildingDot,
63
+ style: {
64
+ background: accent
65
+ }
66
+ }), "building"), /*#__PURE__*/_react().default.createElement("div", {
67
+ className: _namespaceHeaderModule().default.divider
68
+ }));
69
+ }
70
+ function HeaderIcon({
71
+ scopeIcon,
72
+ scopeIconColor,
73
+ namespace,
74
+ accent
75
+ }) {
76
+ if (scopeIcon) {
77
+ return /*#__PURE__*/_react().default.createElement("div", {
78
+ className: _namespaceHeaderModule().default.scopeIconBadge,
79
+ style: {
80
+ background: scopeIconColor || accent
81
+ }
82
+ }, /*#__PURE__*/_react().default.createElement("img", {
83
+ src: scopeIcon,
84
+ className: _namespaceHeaderModule().default.scopeIconImg,
85
+ alt: ""
86
+ }));
87
+ }
88
+ if (scopeIconColor) {
89
+ const initial = namespace.split(/[./]/).pop()?.charAt(0).toUpperCase() || '?';
90
+ return /*#__PURE__*/_react().default.createElement("div", {
91
+ className: _namespaceHeaderModule().default.scopeIconBadge,
92
+ style: {
93
+ background: scopeIconColor
94
+ }
95
+ }, /*#__PURE__*/_react().default.createElement("span", {
96
+ className: _namespaceHeaderModule().default.scopeInitial
97
+ }, initial));
98
+ }
99
+ return /*#__PURE__*/_react().default.createElement("span", {
100
+ className: _namespaceHeaderModule().default.dot,
101
+ style: {
102
+ background: accent
103
+ }
104
+ });
105
+ }
106
+
107
+ //# sourceMappingURL=namespace-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","_filterUtils","_namespaceHeaderModule","e","__esModule","default","NamespaceHeader","namespace","items","scopeIcon","scopeIconColor","accent","tint","buildingCount","readyCount","item","s","getComponentStatus","createElement","className","styles","header","HeaderIcon","name","count","length","buildingPill","style","color","background","buildingDot","divider","scopeIconBadge","src","scopeIconImg","alt","initial","split","pop","charAt","toUpperCase","scopeInitial","dot"],"sources":["namespace-header.tsx"],"sourcesContent":["import React from 'react';\nimport { getComponentStatus } from './filter-utils';\nimport type { WorkspaceItem } from './workspace-overview.types';\nimport styles from './namespace-header.module.scss';\n\nexport interface NamespaceHeaderProps {\n namespace: string;\n items: WorkspaceItem[];\n scopeIcon?: string;\n scopeIconColor?: string;\n}\n\nexport function NamespaceHeader({ namespace, items, scopeIcon, scopeIconColor }: NamespaceHeaderProps) {\n const accent = 'var(--bit-accent-color, #6c5ce7)';\n const tint = 'color-mix(in srgb, var(--bit-accent-color, #6c5ce7) 12%, transparent)';\n\n let buildingCount = 0;\n let readyCount = 0;\n for (const item of items) {\n const s = getComponentStatus(item);\n if (s === 'building') buildingCount++;\n if (s === 'built' || s === 'changed') readyCount++;\n }\n\n return (\n <header className={styles.header}>\n <HeaderIcon scopeIcon={scopeIcon} scopeIconColor={scopeIconColor} namespace={namespace} accent={accent} />\n <span className={styles.name}>{namespace}</span>\n <span className={styles.count}>\n {readyCount}/{items.length}\n </span>\n {buildingCount > 0 && (\n <span className={styles.buildingPill} style={{ color: accent, background: tint }}>\n <span className={styles.buildingDot} style={{ background: accent }} />\n building\n </span>\n )}\n <div className={styles.divider} />\n </header>\n );\n}\n\nfunction HeaderIcon({\n scopeIcon,\n scopeIconColor,\n namespace,\n accent,\n}: {\n scopeIcon?: string;\n scopeIconColor?: string;\n namespace: string;\n accent: string;\n}) {\n if (scopeIcon) {\n return (\n <div className={styles.scopeIconBadge} style={{ background: scopeIconColor || accent }}>\n <img src={scopeIcon} className={styles.scopeIconImg} alt=\"\" />\n </div>\n );\n }\n\n if (scopeIconColor) {\n const initial = namespace.split(/[./]/).pop()?.charAt(0).toUpperCase() || '?';\n return (\n <div className={styles.scopeIconBadge} style={{ background: scopeIconColor }}>\n <span className={styles.scopeInitial}>{initial}</span>\n </div>\n );\n }\n\n return <span className={styles.dot} style={{ background: accent }} />;\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,uBAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,sBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAC,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,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0,0 +1,88 @@
1
+ .header {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 10px;
5
+ }
6
+
7
+ .dot {
8
+ width: 10px;
9
+ height: 10px;
10
+ border-radius: 3px;
11
+ flex-shrink: 0;
12
+ }
13
+
14
+ .name {
15
+ font-size: 20px;
16
+ font-weight: 600;
17
+ letter-spacing: 0.02em;
18
+ color: var(--on-background-color);
19
+ flex-shrink: 0;
20
+ }
21
+
22
+ .count {
23
+ font-size: 12px;
24
+ color: var(--on-background-low-color);
25
+ flex-shrink: 0;
26
+ }
27
+
28
+ .buildingPill {
29
+ display: inline-flex;
30
+ align-items: center;
31
+ gap: 5px;
32
+ font-size: 10.5px;
33
+ font-weight: 500;
34
+ padding: 1px 8px;
35
+ border-radius: 999px;
36
+ margin-left: 4px;
37
+ flex-shrink: 0;
38
+ }
39
+
40
+ .buildingDot {
41
+ width: 5px;
42
+ height: 5px;
43
+ border-radius: 50%;
44
+ animation: pulse 1.4s ease-in-out infinite;
45
+ }
46
+
47
+ .scopeIconBadge {
48
+ width: 24px;
49
+ height: 24px;
50
+ border-radius: 6px;
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ flex-shrink: 0;
55
+ overflow: hidden;
56
+ }
57
+
58
+ .scopeIconImg {
59
+ width: 14px;
60
+ height: 14px;
61
+ object-fit: contain;
62
+ filter: brightness(0) invert(1);
63
+ }
64
+
65
+ .scopeInitial {
66
+ font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
67
+ font-size: 11px;
68
+ font-weight: 700;
69
+ color: white;
70
+ line-height: 1;
71
+ }
72
+
73
+ .divider {
74
+ flex: 1;
75
+ height: 1px;
76
+ background: var(--border-medium-color);
77
+ margin-left: 4px;
78
+ }
79
+
80
+ @keyframes pulse {
81
+ 0%,
82
+ 100% {
83
+ opacity: 1;
84
+ }
85
+ 50% {
86
+ opacity: 0.55;
87
+ }
88
+ }
@@ -66,11 +66,17 @@ function useWorkspaceAggregation(items, aggregation, filters) {
66
66
  map.get(scope).push(item);
67
67
  }
68
68
  const sortedScopes = [...map.keys()].sort();
69
- const groups = sortedScopes.map(sc => ({
70
- name: sc,
71
- displayName: sc,
72
- items: (0, _namespaceSort().sortItemsByNamespace)(map.get(sc))
73
- }));
69
+ const groups = sortedScopes.map(sc => {
70
+ const groupItems = map.get(sc);
71
+ const sampleScope = groupItems.find(i => i.scope?.icon)?.scope;
72
+ return {
73
+ name: sc,
74
+ displayName: sc,
75
+ items: (0, _namespaceSort().sortItemsByNamespace)(groupItems),
76
+ scopeIcon: sampleScope?.icon,
77
+ scopeIconColor: sampleScope?.backgroundIconColor
78
+ };
79
+ });
74
80
  return {
75
81
  groups,
76
82
  groupType: 'scopes',
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","require","_namespaceSort","_filterUtils","useWorkspaceAggregation","items","aggregation","filters","filtered","useMemo","filterItems","groups","name","displayName","sortItemsByNamespace","groupType","availableAggregations","filteredCount","length","map","Map","item","ns","component","id","namespace","has","set","get","push","sortedKeys","sortNamespacesAdvanced","keys","scope","sortedScopes","sort","sc"],"sources":["use-workspace-aggregation.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { sortNamespacesAdvanced, sortItemsByNamespace } from './namespace-sort';\nimport { filterItems, type ActiveFilters } from './filter-utils';\nimport type { WorkspaceItem, AggregationType, AggregationGroup, AggregationResult } from './workspace-overview.types';\n\nexport function useWorkspaceAggregation(\n items: WorkspaceItem[],\n aggregation: AggregationType,\n filters: ActiveFilters\n): AggregationResult {\n const filtered = useMemo(() => filterItems(items, filters), [items, filters]);\n\n if (aggregation === 'none') {\n return {\n groups: [\n {\n name: 'all',\n displayName: '',\n items: sortItemsByNamespace(filtered),\n },\n ],\n groupType: 'none',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n }\n\n if (aggregation === 'namespaces') {\n const map = new Map<string, WorkspaceItem[]>();\n for (const item of filtered) {\n const ns = item.component.id.namespace || '/';\n if (!map.has(ns)) map.set(ns, []);\n map.get(ns)!.push(item);\n }\n\n const sortedKeys = sortNamespacesAdvanced([...map.keys()]);\n\n const groups: AggregationGroup[] = sortedKeys.map((ns) => ({\n name: ns,\n displayName: ns,\n items: sortItemsByNamespace(map.get(ns)!),\n }));\n\n return {\n groups,\n groupType: 'namespaces',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n }\n\n const map = new Map<string, WorkspaceItem[]>();\n for (const item of filtered) {\n const scope = item.component.id.scope;\n if (!map.has(scope)) map.set(scope, []);\n map.get(scope)!.push(item);\n }\n\n const sortedScopes = [...map.keys()].sort();\n\n const groups: AggregationGroup[] = sortedScopes.map((sc) => ({\n name: sc,\n displayName: sc,\n items: sortItemsByNamespace(map.get(sc)!),\n }));\n\n return {\n groups,\n groupType: 'scopes',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,eAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,SAASI,uBAAuBA,CACrCC,KAAsB,EACtBC,WAA4B,EAC5BC,OAAsB,EACH;EACnB,MAAMC,QAAQ,GAAG,IAAAC,gBAAO,EAAC,MAAM,IAAAC,0BAAW,EAACL,KAAK,EAAEE,OAAO,CAAC,EAAE,CAACF,KAAK,EAAEE,OAAO,CAAC,CAAC;EAE7E,IAAID,WAAW,KAAK,MAAM,EAAE;IAC1B,OAAO;MACLK,M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,MAAMC,IAAI,IAAIb,QAAQ,EAAE;IAC3B,MAAMyB,KAAK,GAAGZ,IAAI,CAACE,SAAS,CAACC,EAAE,CAACS,KAAK;IACrC,IAAI,CAACd,GAAG,CAACO,GAAG,CAACO,KAAK,CAAC,EAAEd,GAAG,CAACQ,GAAG,CAACM,KAAK,EAAE,EAAE,CAAC;IACvCd,GAAG,CAACS,GAAG,CAACK,KAAK,CAAC,CAAEJ,IAAI,CAACR,IAAI,CAAC;EAC5B;EAEA,MAAMa,YAAY,GAAG,CAAC,GAAGf,GAAG,CAACa,IAAI,CAAC,CAAC,CAAC,CAACG,IAAI,CAAC,CAAC;EAE3C,MAAMxB,MAA0B,GAAGuB,YAAY,CAACf,GAAG,CAAEiB,EAAE,KAAM;IAC3DxB,IAAI,EAAEwB,EAAE;IACRvB,WAAW,EAAEuB,EAAE;IACf/B,KAAK,EAAE,IAAAS,qCAAoB,EAACK,GAAG,CAACS,GAAG,CAACQ,EAAE,CAAE;EAC1C,CAAC,CAAC,CAAC;EAEH,OAAO;IACLzB,MAAM;IACNI,SAAS,EAAE,QAAQ;IACnBC,qBAAqB,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC;IACvDC,aAAa,EAAET,QAAQ,CAACU;EAC1B,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","require","_namespaceSort","_filterUtils","useWorkspaceAggregation","items","aggregation","filters","filtered","useMemo","filterItems","groups","name","displayName","sortItemsByNamespace","groupType","availableAggregations","filteredCount","length","map","Map","item","ns","component","id","namespace","has","set","get","push","sortedKeys","sortNamespacesAdvanced","keys","scope","sortedScopes","sort","sc","groupItems","sampleScope","find","i","icon","scopeIcon","scopeIconColor","backgroundIconColor"],"sources":["use-workspace-aggregation.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { sortNamespacesAdvanced, sortItemsByNamespace } from './namespace-sort';\nimport { filterItems, type ActiveFilters } from './filter-utils';\nimport type { WorkspaceItem, AggregationType, AggregationGroup, AggregationResult } from './workspace-overview.types';\n\nexport function useWorkspaceAggregation(\n items: WorkspaceItem[],\n aggregation: AggregationType,\n filters: ActiveFilters\n): AggregationResult {\n const filtered = useMemo(() => filterItems(items, filters), [items, filters]);\n\n if (aggregation === 'none') {\n return {\n groups: [\n {\n name: 'all',\n displayName: '',\n items: sortItemsByNamespace(filtered),\n },\n ],\n groupType: 'none',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n }\n\n if (aggregation === 'namespaces') {\n const map = new Map<string, WorkspaceItem[]>();\n for (const item of filtered) {\n const ns = item.component.id.namespace || '/';\n if (!map.has(ns)) map.set(ns, []);\n map.get(ns)!.push(item);\n }\n\n const sortedKeys = sortNamespacesAdvanced([...map.keys()]);\n\n const groups: AggregationGroup[] = sortedKeys.map((ns) => ({\n name: ns,\n displayName: ns,\n items: sortItemsByNamespace(map.get(ns)!),\n }));\n\n return {\n groups,\n groupType: 'namespaces',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n }\n\n const map = new Map<string, WorkspaceItem[]>();\n for (const item of filtered) {\n const scope = item.component.id.scope;\n if (!map.has(scope)) map.set(scope, []);\n map.get(scope)!.push(item);\n }\n\n const sortedScopes = [...map.keys()].sort();\n\n const groups: AggregationGroup[] = sortedScopes.map((sc) => {\n const groupItems = map.get(sc)!;\n const sampleScope = groupItems.find((i) => i.scope?.icon)?.scope;\n return {\n name: sc,\n displayName: sc,\n items: sortItemsByNamespace(groupItems),\n scopeIcon: sampleScope?.icon,\n scopeIconColor: sampleScope?.backgroundIconColor,\n };\n });\n\n return {\n groups,\n groupType: 'scopes',\n availableAggregations: ['namespaces', 'scopes', 'none'],\n filteredCount: filtered.length,\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA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B,EAAE;MACf/B,KAAK,EAAE,IAAAS,qCAAoB,EAACuB,UAAU,CAAC;MACvCK,SAAS,EAAEJ,WAAW,EAAEG,IAAI;MAC5BE,cAAc,EAAEL,WAAW,EAAEM;IAC/B,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACLjC,MAAM;IACNI,SAAS,EAAE,QAAQ;IACnBC,qBAAqB,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC;IACvDC,aAAa,EAAET,QAAQ,CAACU;EAC1B,CAAC;AACH","ignoreList":[]}
@@ -62,11 +62,13 @@ function WorkspaceFilterPanel({
62
62
  value: v
63
63
  }));
64
64
  const applyNs = opts => {
65
- const list = opts.map(o => o.value).filter(v => typeof v === 'string');
65
+ const arr = Array.isArray(opts) ? opts : opts ? [opts] : [];
66
+ const list = arr.map(o => o.value).filter(v => typeof v === 'string');
66
67
  onNamespacesChange(list);
67
68
  };
68
69
  const applyScopes = opts => {
69
- const list = opts.map(o => o.value).filter(v => typeof v === 'string');
70
+ const arr = Array.isArray(opts) ? opts : opts ? [opts] : [];
71
+ const list = arr.map(o => o.value).filter(v => typeof v === 'string');
70
72
  onScopesChange(list);
71
73
  };
72
74
  const currentIndex = Math.max(0, availableAggregations.findIndex(a => a === aggregation));
@@ -75,9 +77,9 @@ function WorkspaceFilterPanel({
75
77
  onAggregationChange(agg);
76
78
  };
77
79
  return /*#__PURE__*/_react().default.createElement("div", {
78
- className: _workspaceOverviewModule().default.filterPanel
80
+ className: _workspaceOverviewModule().default.commandBar
79
81
  }, /*#__PURE__*/_react().default.createElement("div", {
80
- className: _workspaceOverviewModule().default.leftFilters
82
+ className: _workspaceOverviewModule().default.leftCluster
81
83
  }, /*#__PURE__*/_react().default.createElement(_componentFilters().BaseFilter, {
82
84
  id: "namespaces",
83
85
  placeholder: "Namespaces",
@@ -93,9 +95,9 @@ function WorkspaceFilterPanel({
93
95
  onChange: applyScopes,
94
96
  isSearchable: true
95
97
  })), /*#__PURE__*/_react().default.createElement("div", {
96
- className: _workspaceOverviewModule().default.rightAggToggle
98
+ className: _workspaceOverviewModule().default.rightCluster
97
99
  }, /*#__PURE__*/_react().default.createElement(_designInputs().ToggleButton, {
98
- className: _workspaceOverviewModule().default.toggleBtn,
100
+ className: _workspaceOverviewModule().default.aggToggle,
99
101
  defaultIndex: currentIndex,
100
102
  onOptionSelect: idx => applyAgg(idx),
101
103
  options: availableAggregations.map(agg => ({
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_designInputs","_componentFilters","_workspaceOverviewModule","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LABELS","namespaces","scopes","none","WorkspaceFilterPanel","aggregation","onAggregationChange","availableAggregations","items","activeNamespaces","onNamespacesChange","activeScopes","onScopesChange","namespaceOptions","useMemo","Set","map","component","id","namespace","v","value","scopeOptions","scope","activeNsOptions","activeScopeOptions","applyNs","opts","list","filter","applyScopes","currentIndex","Math","max","findIndex","a","applyAgg","agg","createElement","className","styles","filterPanel","leftFilters","BaseFilter","placeholder","options","activeOptions","onChange","isSearchable","rightAggToggle","ToggleButton","toggleBtn","defaultIndex","onOptionSelect","idx","element"],"sources":["workspace-filter-panel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { ToggleButton } from '@teambit/design.inputs.toggle-button';\nimport { BaseFilter } from '@teambit/component.filters.base-filter';\nimport type { WorkspaceItem, AggregationType } from './workspace-overview.types';\nimport styles from './workspace-overview.module.scss';\n\nexport interface WorkspaceFilterPanelProps {\n aggregation: AggregationType;\n onAggregationChange: (agg: AggregationType) => void;\n availableAggregations: AggregationType[];\n items: WorkspaceItem[];\n activeNamespaces: string[];\n onNamespacesChange: (namespaces: string[]) => void;\n activeScopes: string[];\n onScopesChange: (scopes: string[]) => void;\n}\n\nconst LABELS: Record<AggregationType, string> = {\n namespaces: 'Namespaces',\n scopes: 'Scopes',\n none: 'None',\n};\n\nexport function WorkspaceFilterPanel({\n aggregation,\n onAggregationChange,\n availableAggregations,\n items,\n activeNamespaces,\n onNamespacesChange,\n activeScopes,\n onScopesChange,\n}: WorkspaceFilterPanelProps) {\n const namespaceOptions = useMemo(\n () =>\n [...new Set(items.map((i) => i.component.id.namespace || '/'))].map((v) => ({\n value: v,\n })),\n [items]\n );\n\n const scopeOptions = useMemo(\n () =>\n [...new Set(items.map((i) => i.component.id.scope))].map((v) => ({\n value: v,\n })),\n [items]\n );\n\n const activeNsOptions = activeNamespaces.map((v) => ({ value: v }));\n const activeScopeOptions = activeScopes.map((v) => ({ value: v }));\n\n const applyNs = (opts) => {\n const list = opts.map((o) => o.value).filter((v): v is string => typeof v === 'string');\n onNamespacesChange(list);\n };\n\n const applyScopes = (opts) => {\n const list = opts.map((o) => o.value).filter((v): v is string => typeof v === 'string');\n onScopesChange(list);\n };\n\n const currentIndex = Math.max(\n 0,\n availableAggregations.findIndex((a) => a === aggregation)\n );\n\n const applyAgg = (i: number) => {\n const agg = availableAggregations[i];\n onAggregationChange(agg);\n };\n\n return (\n <div className={styles.filterPanel}>\n <div className={styles.leftFilters}>\n <BaseFilter\n id=\"namespaces\"\n placeholder=\"Namespaces\"\n options={namespaceOptions}\n activeOptions={activeNsOptions}\n onChange={applyNs}\n isSearchable\n />\n\n <BaseFilter\n id=\"scopes\"\n placeholder=\"Scopes\"\n options={scopeOptions}\n activeOptions={activeScopeOptions}\n onChange={applyScopes}\n isSearchable\n />\n </div>\n\n <div className={styles.rightAggToggle}>\n <ToggleButton\n className={styles.toggleBtn}\n defaultIndex={currentIndex}\n onOptionSelect={(idx) => applyAgg(idx)}\n options={availableAggregations.map((agg) => ({\n value: agg,\n element: LABELS[agg],\n }))}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,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eAAgB;IAC/BuB,QAAQ,EAAErB,OAAQ;IAClBsB,YAAY;EAAA,CACb,CAAC,eAEF3E,MAAA,GAAAU,OAAA,CAAAuD,aAAA,CAAC5D,iBAAA,GAAAiE,UAAU;IACTzB,EAAE,EAAC,QAAQ;IACX0B,WAAW,EAAC,QAAQ;IACpBC,OAAO,EAAEvB,YAAa;IACtBwB,aAAa,EAAErB,kBAAmB;IAClCsB,QAAQ,EAAEjB,WAAY;IACtBkB,YAAY;EAAA,CACb,CACE,CAAC,eAEN3E,MAAA,GAAAU,OAAA,CAAAuD,aAAA;IAAKC,SAAS,EAAEC,kCAAM,CAACS;EAAe,gBACpC5E,MAAA,GAAAU,OAAA,CAAAuD,aAAA,CAAC7D,aAAA,GAAAyE,YAAY;IACXX,SAAS,EAAEC,kCAAM,CAACW,SAAU;IAC5BC,YAAY,EAAErB,YAAa;IAC3BsB,cAAc,EAAGC,GAAG,IAAKlB,QAAQ,CAACkB,GAAG,CAAE;IACvCT,OAAO,EAAEtC,qBAAqB,CAACS,GAAG,CAAEqB,GAAG,KAAM;MAC3ChB,KAAK,EAAEgB,GAAG;MACVkB,OAAO,EAAEvD,MAAM,CAACqC,GAAG;IACrB,CAAC,CAAC;EAAE,CACL,CACE,CACF,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_designInputs","_componentFilters","_workspaceOverviewModule","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LABELS","namespaces","scopes","none","WorkspaceFilterPanel","aggregation","onAggregationChange","availableAggregations","items","activeNamespaces","onNamespacesChange","activeScopes","onScopesChange","namespaceOptions","useMemo","Set","map","component","id","namespace","v","value","scopeOptions","scope","activeNsOptions","activeScopeOptions","applyNs","opts","arr","Array","isArray","list","filter","applyScopes","currentIndex","Math","max","findIndex","a","applyAgg","agg","createElement","className","styles","commandBar","leftCluster","BaseFilter","placeholder","options","activeOptions","onChange","isSearchable","rightCluster","ToggleButton","aggToggle","defaultIndex","onOptionSelect","idx","element"],"sources":["workspace-filter-panel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { ToggleButton } from '@teambit/design.inputs.toggle-button';\nimport { BaseFilter } from '@teambit/component.filters.base-filter';\nimport type { WorkspaceItem, AggregationType } from './workspace-overview.types';\nimport styles from './workspace-overview.module.scss';\n\nexport interface WorkspaceFilterPanelProps {\n aggregation: AggregationType;\n onAggregationChange: (agg: AggregationType) => void;\n availableAggregations: AggregationType[];\n items: WorkspaceItem[];\n activeNamespaces: string[];\n onNamespacesChange: (namespaces: string[]) => void;\n activeScopes: string[];\n onScopesChange: (scopes: string[]) => void;\n}\n\nconst LABELS: Record<AggregationType, string> = {\n namespaces: 'Namespaces',\n scopes: 'Scopes',\n none: 'None',\n};\n\nexport function WorkspaceFilterPanel({\n aggregation,\n onAggregationChange,\n availableAggregations,\n items,\n activeNamespaces,\n onNamespacesChange,\n activeScopes,\n onScopesChange,\n}: WorkspaceFilterPanelProps) {\n const namespaceOptions = useMemo(\n () =>\n [...new Set(items.map((i) => i.component.id.namespace || '/'))].map((v) => ({\n value: v,\n })),\n [items]\n );\n\n const scopeOptions = useMemo(\n () =>\n [...new Set(items.map((i) => i.component.id.scope))].map((v) => ({\n value: v,\n })),\n [items]\n );\n\n const activeNsOptions = activeNamespaces.map((v) => ({ value: v }));\n const activeScopeOptions = activeScopes.map((v) => ({ value: v }));\n\n const applyNs = (opts: readonly { value?: string }[] | { value?: string } | null) => {\n const arr = Array.isArray(opts) ? opts : opts ? [opts] : [];\n const list = arr.map((o) => o.value).filter((v): v is string => typeof v === 'string');\n onNamespacesChange(list);\n };\n\n const applyScopes = (opts: readonly { value?: string }[] | { value?: string } | null) => {\n const arr = Array.isArray(opts) ? opts : opts ? [opts] : [];\n const list = arr.map((o) => o.value).filter((v): v is string => typeof v === 'string');\n onScopesChange(list);\n };\n\n const currentIndex = Math.max(\n 0,\n availableAggregations.findIndex((a) => a === aggregation)\n );\n\n const applyAgg = (i: number) => {\n const agg = availableAggregations[i];\n onAggregationChange(agg);\n };\n\n return (\n <div className={styles.commandBar}>\n <div className={styles.leftCluster}>\n <BaseFilter\n id=\"namespaces\"\n placeholder=\"Namespaces\"\n options={namespaceOptions}\n activeOptions={activeNsOptions}\n onChange={applyNs}\n isSearchable\n />\n <BaseFilter\n id=\"scopes\"\n placeholder=\"Scopes\"\n options={scopeOptions}\n activeOptions={activeScopeOptions}\n onChange={applyScopes}\n isSearchable\n />\n </div>\n\n <div className={styles.rightCluster}>\n <ToggleButton\n className={styles.aggToggle}\n defaultIndex={currentIndex}\n onOptionSelect={(idx) => applyAgg(idx)}\n options={availableAggregations.map((agg) => ({\n value: agg,\n element: LABELS[agg],\n }))}\n />\n </div>\n </div>\n );\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,cAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,kBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAK,yBAAA;EAAA,MAAAL,IAAA,GAAAM,sBAAA,CAAAJ,OAAA;EAAAG,wBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAsD,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAA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AAU,OAAA,CAAA0D,aAAA;IAAKC,SAAS,EAAEC,kCAAM,CAACS;EAAa,gBAClC/E,MAAA,GAAAU,OAAA,CAAA0D,aAAA,CAAChE,aAAA,GAAA4E,YAAY;IACXX,SAAS,EAAEC,kCAAM,CAACW,SAAU;IAC5BC,YAAY,EAAErB,YAAa;IAC3BsB,cAAc,EAAGC,GAAG,IAAKlB,QAAQ,CAACkB,GAAG,CAAE;IACvCT,OAAO,EAAEzC,qBAAqB,CAACS,GAAG,CAAEwB,GAAG,KAAM;MAC3CnB,KAAK,EAAEmB,GAAG;MACVkB,OAAO,EAAE1D,MAAM,CAACwC,GAAG;IACrB,CAAC,CAAC;EAAE,CACL,CACE,CACF,CAAC;AAEV","ignoreList":[]}
@@ -1,7 +1 @@
1
- import type { ComponentModel } from '@teambit/component';
2
- import type { ComponentCardPluginType, PluginProps } from '@teambit/explorer.ui.component-card';
3
1
  export declare function WorkspaceOverview(): import("react/jsx-runtime").JSX.Element;
4
- export declare function useCardPlugins({ compModelsById, showPreview, }: {
5
- compModelsById: Map<string, ComponentModel>;
6
- showPreview?: boolean;
7
- }): ComponentCardPluginType<PluginProps>[];