@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.
- package/dist/{preview-1785260578779.js → preview-1785278532531.js} +2 -2
- package/dist/ui/workspace/use-workspace.js +179 -27
- package/dist/ui/workspace/use-workspace.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/index.d.ts +1 -1
- package/dist/ui/workspace/workspace-overview/index.js +5 -5
- package/dist/ui/workspace/workspace-overview/index.js.map +1 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.js +13 -143
- package/dist/ui/workspace/workspace-overview/workspace-overview.js.map +1 -1
- package/dist/ui/workspace/workspace-skeleton.d.ts +8 -0
- package/dist/ui/workspace/workspace-skeleton.js +73 -0
- package/dist/ui/workspace/workspace-skeleton.js.map +1 -0
- package/dist/ui/workspace/workspace-skeleton.module.scss +102 -0
- package/dist/ui/workspace/workspace.js +23 -7
- package/dist/ui/workspace/workspace.js.map +1 -1
- package/package.json +65 -74
- package/ui/workspace/use-workspace.ts +185 -27
- package/ui/workspace/workspace-overview/index.ts +1 -1
- package/ui/workspace/workspace-overview/workspace-overview.tsx +9 -102
- package/ui/workspace/workspace-skeleton.module.scss +102 -0
- package/ui/workspace/workspace-skeleton.tsx +35 -0
- package/ui/workspace/workspace.tsx +16 -5
- package/dist/ui/workspace/workspace-overview/card-overlays.d.ts +0 -5
- package/dist/ui/workspace/workspace-overview/card-overlays.js +0 -133
- package/dist/ui/workspace/workspace-overview/card-overlays.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/card-overlays.module.scss +0 -72
- package/dist/ui/workspace/workspace-overview/filter-utils.d.ts +0 -10
- package/dist/ui/workspace/workspace-overview/filter-utils.js +0 -40
- package/dist/ui/workspace/workspace-overview/filter-utils.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/hope-component-card.d.ts +0 -15
- package/dist/ui/workspace/workspace-overview/hope-component-card.js +0 -186
- package/dist/ui/workspace/workspace-overview/hope-component-card.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/hope-component-card.module.scss +0 -169
- package/dist/ui/workspace/workspace-overview/link-plugin.d.ts +0 -3
- package/dist/ui/workspace/workspace-overview/link-plugin.js +0 -14
- package/dist/ui/workspace/workspace-overview/link-plugin.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/namespace-header.d.ts +0 -9
- package/dist/ui/workspace/workspace-overview/namespace-header.js +0 -107
- package/dist/ui/workspace/workspace-overview/namespace-header.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/namespace-header.module.scss +0 -88
- package/dist/ui/workspace/workspace-overview/namespace-sort.d.ts +0 -8
- package/dist/ui/workspace/workspace-overview/namespace-sort.js +0 -47
- package/dist/ui/workspace/workspace-overview/namespace-sort.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/scope-sort.d.ts +0 -1
- package/dist/ui/workspace/workspace-overview/scope-sort.js +0 -14
- package/dist/ui/workspace/workspace-overview/scope-sort.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/use-query-param-with-default.d.ts +0 -6
- package/dist/ui/workspace/workspace-overview/use-query-param-with-default.js +0 -102
- package/dist/ui/workspace/workspace-overview/use-query-param-with-default.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.d.ts +0 -3
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js +0 -88
- package/dist/ui/workspace/workspace-overview/use-workspace-aggregation.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.d.ts +0 -13
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js +0 -110
- package/dist/ui/workspace/workspace-overview/workspace-filter-panel.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -91
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.d.ts +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js +0 -30
- package/dist/ui/workspace/workspace-overview/workspace-overview.sort.js.map +0 -1
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.d.ts +0 -28
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.js +0 -3
- package/dist/ui/workspace/workspace-overview/workspace-overview.types.js.map +0 -1
- package/ui/workspace/workspace-overview/card-overlays.module.scss +0 -72
- package/ui/workspace/workspace-overview/card-overlays.tsx +0 -66
- package/ui/workspace/workspace-overview/filter-utils.ts +0 -42
- package/ui/workspace/workspace-overview/hope-component-card.module.scss +0 -169
- package/ui/workspace/workspace-overview/hope-component-card.tsx +0 -152
- package/ui/workspace/workspace-overview/link-plugin.ts +0 -5
- package/ui/workspace/workspace-overview/namespace-header.module.scss +0 -88
- package/ui/workspace/workspace-overview/namespace-header.tsx +0 -72
- package/ui/workspace/workspace-overview/namespace-sort.ts +0 -44
- package/ui/workspace/workspace-overview/scope-sort.ts +0 -9
- package/ui/workspace/workspace-overview/use-query-param-with-default.ts +0 -115
- package/ui/workspace/workspace-overview/use-workspace-aggregation.ts +0 -79
- package/ui/workspace/workspace-overview/workspace-filter-panel.tsx +0 -109
- package/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -91
- package/ui/workspace/workspace-overview/workspace-overview.sort.ts +0 -29
- package/ui/workspace/workspace-overview/workspace-overview.types.ts +0 -30
|
@@ -1,169 +0,0 @@
|
|
|
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: var(--surface-color);
|
|
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
|
-
background-color: var(--surface01-color) !important;
|
|
163
|
-
color: var(--on-surface-color) !important;
|
|
164
|
-
border: 1px solid var(--border-medium-color);
|
|
165
|
-
|
|
166
|
-
&:hover {
|
|
167
|
-
background-color: var(--surface-hover-color) !important;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.LinkPlugin = void 0;
|
|
7
|
-
class LinkPlugin {
|
|
8
|
-
link(id) {
|
|
9
|
-
return `${id.fullName}?scope=${id.scope}`;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.LinkPlugin = LinkPlugin;
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=link-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["LinkPlugin","link","id","fullName","scope","exports"],"sources":["link-plugin.ts"],"sourcesContent":["export class LinkPlugin {\n link(id) {\n return `${id.fullName}?scope=${id.scope}`;\n }\n}\n"],"mappings":";;;;;;AAAO,MAAMA,UAAU,CAAC;EACtBC,IAAIA,CAACC,EAAE,EAAE;IACP,OAAO,GAAGA,EAAE,CAACC,QAAQ,UAAUD,EAAE,CAACE,KAAK,EAAE;EAC3C;AACF;AAACC,OAAA,CAAAL,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { WorkspaceItem } from './workspace-overview.types';
|
|
3
|
-
export interface NamespaceHeaderProps {
|
|
4
|
-
namespace: string;
|
|
5
|
-
items: WorkspaceItem[];
|
|
6
|
-
scopeIcon?: string;
|
|
7
|
-
scopeIconColor?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function NamespaceHeader({ namespace, items, scopeIcon, scopeIconColor }: NamespaceHeaderProps): React.JSX.Element;
|
|
@@ -1,107 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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;EAAA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AI,GAAG;IAC7E,oBACE3C,MAAA,GAAAQ,OAAA,CAAAa,aAAA;MAAKC,SAAS,EAAEC,gCAAM,CAACY,cAAe;MAACL,KAAK,EAAE;QAAEE,UAAU,EAAEnB;MAAe;IAAE,gBAC3Eb,MAAA,GAAAQ,OAAA,CAAAa,aAAA;MAAMC,SAAS,EAAEC,gCAAM,CAACqB;IAAa,GAAEL,OAAc,CAClD,CAAC;EAEV;EAEA,oBAAOvC,MAAA,GAAAQ,OAAA,CAAAa,aAAA;IAAMC,SAAS,EAAEC,gCAAM,CAACsB,GAAI;IAACf,KAAK,EAAE;MAAEE,UAAU,EAAElB;IAAO;EAAE,CAAE,CAAC;AACvE","ignoreList":[]}
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceItem } from './workspace-overview.types';
|
|
2
|
-
export declare const PRIORITY_HIGH: string[];
|
|
3
|
-
export declare const PRIORITY_MED: string[];
|
|
4
|
-
export declare const PRIORITY_LOW: string[];
|
|
5
|
-
export declare function getRootNamespace(ns: string): string;
|
|
6
|
-
export declare function namespacePriority(ns: string): number;
|
|
7
|
-
export declare function sortNamespacesAdvanced(list: string[]): string[];
|
|
8
|
-
export declare function sortItemsByNamespace(items: WorkspaceItem[]): WorkspaceItem[];
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PRIORITY_MED = exports.PRIORITY_LOW = exports.PRIORITY_HIGH = void 0;
|
|
7
|
-
exports.getRootNamespace = getRootNamespace;
|
|
8
|
-
exports.namespacePriority = namespacePriority;
|
|
9
|
-
exports.sortItemsByNamespace = sortItemsByNamespace;
|
|
10
|
-
exports.sortNamespacesAdvanced = sortNamespacesAdvanced;
|
|
11
|
-
const PRIORITY_HIGH = exports.PRIORITY_HIGH = ['ui', 'pages'];
|
|
12
|
-
const PRIORITY_MED = exports.PRIORITY_MED = ['design'];
|
|
13
|
-
const PRIORITY_LOW = exports.PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'];
|
|
14
|
-
function getRootNamespace(ns) {
|
|
15
|
-
if (!ns) return '';
|
|
16
|
-
return ns.split('/')[0];
|
|
17
|
-
}
|
|
18
|
-
function namespacePriority(ns) {
|
|
19
|
-
const root = getRootNamespace(ns);
|
|
20
|
-
|
|
21
|
-
// internal namespaces (starting with _) go last
|
|
22
|
-
if (root.startsWith('_')) return 4;
|
|
23
|
-
if (PRIORITY_HIGH.includes(root)) return 0;
|
|
24
|
-
if (PRIORITY_MED.includes(root)) return 1;
|
|
25
|
-
if (PRIORITY_LOW.includes(root)) return 3;
|
|
26
|
-
return 2;
|
|
27
|
-
}
|
|
28
|
-
function sortNamespacesAdvanced(list) {
|
|
29
|
-
return [...list].sort((a, b) => {
|
|
30
|
-
const pa = namespacePriority(a);
|
|
31
|
-
const pb = namespacePriority(b);
|
|
32
|
-
if (pa !== pb) return pa - pb;
|
|
33
|
-
return a.localeCompare(b);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function sortItemsByNamespace(items) {
|
|
37
|
-
return [...items].sort((a, b) => {
|
|
38
|
-
const na = a.component.id.namespace || '/';
|
|
39
|
-
const nb = b.component.id.namespace || '/';
|
|
40
|
-
const pa = namespacePriority(na);
|
|
41
|
-
const pb = namespacePriority(nb);
|
|
42
|
-
if (pa !== pb) return pa - pb;
|
|
43
|
-
return a.component.id.name.localeCompare(b.component.id.name);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=namespace-sort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PRIORITY_HIGH","exports","PRIORITY_MED","PRIORITY_LOW","getRootNamespace","ns","split","namespacePriority","root","startsWith","includes","sortNamespacesAdvanced","list","sort","a","b","pa","pb","localeCompare","sortItemsByNamespace","items","na","component","id","namespace","nb","name"],"sources":["namespace-sort.ts"],"sourcesContent":["import type { WorkspaceItem } from './workspace-overview.types';\n\nexport const PRIORITY_HIGH = ['ui', 'pages'] as string[];\nexport const PRIORITY_MED = ['design'] as string[];\nexport const PRIORITY_LOW = ['entities', 'provider', 'hooks', 'icons'] as string[];\n\nexport function getRootNamespace(ns: string): string {\n if (!ns) return '';\n return ns.split('/')[0]!;\n}\n\nexport function namespacePriority(ns: string): number {\n const root = getRootNamespace(ns);\n\n // internal namespaces (starting with _) go last\n if (root.startsWith('_')) return 4;\n\n if (PRIORITY_HIGH.includes(root)) return 0;\n if (PRIORITY_MED.includes(root)) return 1;\n if (PRIORITY_LOW.includes(root)) return 3;\n return 2;\n}\n\nexport function sortNamespacesAdvanced(list: string[]): string[] {\n return [...list].sort((a, b) => {\n const pa = namespacePriority(a);\n const pb = namespacePriority(b);\n if (pa !== pb) return pa - pb;\n return a.localeCompare(b);\n });\n}\n\nexport function sortItemsByNamespace(items: WorkspaceItem[]): WorkspaceItem[] {\n return [...items].sort((a, b) => {\n const na = a.component.id.namespace || '/';\n const nb = b.component.id.namespace || '/';\n\n const pa = namespacePriority(na);\n const pb = namespacePriority(nb);\n if (pa !== pb) return pa - pb;\n\n return a.component.id.name.localeCompare(b.component.id.name);\n });\n}\n"],"mappings":";;;;;;;;;;AAEO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,CAAC,IAAI,EAAE,OAAO,CAAa;AACjD,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,CAAC,QAAQ,CAAa;AAC3C,MAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAa;AAE3E,SAASC,gBAAgBA,CAACC,EAAU,EAAU;EACnD,IAAI,CAACA,EAAE,EAAE,OAAO,EAAE;EAClB,OAAOA,EAAE,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACzB;AAEO,SAASC,iBAAiBA,CAACF,EAAU,EAAU;EACpD,MAAMG,IAAI,GAAGJ,gBAAgB,CAACC,EAAE,CAAC;;EAEjC;EACA,IAAIG,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;EAElC,IAAIT,aAAa,CAACU,QAAQ,CAACF,IAAI,CAAC,EAAE,OAAO,CAAC;EAC1C,IAAIN,YAAY,CAACQ,QAAQ,CAACF,IAAI,CAAC,EAAE,OAAO,CAAC;EACzC,IAAIL,YAAY,CAACO,QAAQ,CAACF,IAAI,CAAC,EAAE,OAAO,CAAC;EACzC,OAAO,CAAC;AACV;AAEO,SAASG,sBAAsBA,CAACC,IAAc,EAAY;EAC/D,OAAO,CAAC,GAAGA,IAAI,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IAC9B,MAAMC,EAAE,GAAGT,iBAAiB,CAACO,CAAC,CAAC;IAC/B,MAAMG,EAAE,GAAGV,iBAAiB,CAACQ,CAAC,CAAC;IAC/B,IAAIC,EAAE,KAAKC,EAAE,EAAE,OAAOD,EAAE,GAAGC,EAAE;IAC7B,OAAOH,CAAC,CAACI,aAAa,CAACH,CAAC,CAAC;EAC3B,CAAC,CAAC;AACJ;AAEO,SAASI,oBAAoBA,CAACC,KAAsB,EAAmB;EAC5E,OAAO,CAAC,GAAGA,KAAK,CAAC,CAACP,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IAC/B,MAAMM,EAAE,GAAGP,CAAC,CAACQ,SAAS,CAACC,EAAE,CAACC,SAAS,IAAI,GAAG;IAC1C,MAAMC,EAAE,GAAGV,CAAC,CAACO,SAAS,CAACC,EAAE,CAACC,SAAS,IAAI,GAAG;IAE1C,MAAMR,EAAE,GAAGT,iBAAiB,CAACc,EAAE,CAAC;IAChC,MAAMJ,EAAE,GAAGV,iBAAiB,CAACkB,EAAE,CAAC;IAChC,IAAIT,EAAE,KAAKC,EAAE,EAAE,OAAOD,EAAE,GAAGC,EAAE;IAE7B,OAAOH,CAAC,CAACQ,SAAS,CAACC,EAAE,CAACG,IAAI,CAACR,aAAa,CAACH,CAAC,CAACO,SAAS,CAACC,EAAE,CAACG,IAAI,CAAC;EAC/D,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sortScopes(scopes: string[]): string[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sortScopes = sortScopes;
|
|
7
|
-
function sortScopes(scopes) {
|
|
8
|
-
const designPrefix = 'design';
|
|
9
|
-
const nonDesign = scopes.filter(s => !s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));
|
|
10
|
-
const design = scopes.filter(s => s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));
|
|
11
|
-
return [...nonDesign, ...design];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=scope-sort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["sortScopes","scopes","designPrefix","nonDesign","filter","s","includes","sort","a","b","localeCompare","design"],"sources":["scope-sort.ts"],"sourcesContent":["export function sortScopes(scopes: string[]) {\n const designPrefix = 'design';\n\n const nonDesign = scopes.filter((s) => !s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));\n\n const design = scopes.filter((s) => s.includes(designPrefix)).sort((a, b) => a.localeCompare(b));\n\n return [...nonDesign, ...design];\n}\n"],"mappings":";;;;;;AAAO,SAASA,UAAUA,CAACC,MAAgB,EAAE;EAC3C,MAAMC,YAAY,GAAG,QAAQ;EAE7B,MAAMC,SAAS,GAAGF,MAAM,CAACG,MAAM,CAAEC,CAAC,IAAK,CAACA,CAAC,CAACC,QAAQ,CAACJ,YAAY,CAAC,CAAC,CAACK,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;EAEpG,MAAME,MAAM,GAAGV,MAAM,CAACG,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACJ,YAAY,CAAC,CAAC,CAACK,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;EAEhG,OAAO,CAAC,GAAGN,SAAS,EAAE,GAAGQ,MAAM,CAAC;AAClC","ignoreList":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export interface QueryParamOptions {
|
|
2
|
-
/** persist value to localStorage across sessions. Default: true */
|
|
3
|
-
persist?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare function useQueryParamWithDefault<T extends string>(paramName: string, fallback: T, options?: QueryParamOptions): [T, (value: T | null) => void];
|
|
6
|
-
export declare function useListParamWithDefault(paramName: string, options?: QueryParamOptions): [string[], (values: string[]) => void];
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useListParamWithDefault = useListParamWithDefault;
|
|
7
|
-
exports.useQueryParamWithDefault = useQueryParamWithDefault;
|
|
8
|
-
function _react() {
|
|
9
|
-
const data = require("react");
|
|
10
|
-
_react = function () {
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
function _reactRouterDom() {
|
|
16
|
-
const data = require("react-router-dom");
|
|
17
|
-
_reactRouterDom = function () {
|
|
18
|
-
return data;
|
|
19
|
-
};
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
const STORAGE_KEY_PREFIX = 'workspace-overview:';
|
|
23
|
-
function useQueryParamWithDefault(paramName, fallback, options = {}) {
|
|
24
|
-
const {
|
|
25
|
-
persist = true
|
|
26
|
-
} = options;
|
|
27
|
-
const [searchParams, setSearchParams] = (0, _reactRouterDom().useSearchParams)();
|
|
28
|
-
const storageKey = STORAGE_KEY_PREFIX + paramName;
|
|
29
|
-
const value = (0, _react().useMemo)(() => {
|
|
30
|
-
const urlValue = searchParams.get(paramName);
|
|
31
|
-
if (urlValue) return urlValue;
|
|
32
|
-
if (persist) {
|
|
33
|
-
const stored = safeGetItem(storageKey);
|
|
34
|
-
if (stored) return stored;
|
|
35
|
-
}
|
|
36
|
-
return fallback;
|
|
37
|
-
}, [searchParams, paramName, storageKey, fallback, persist]);
|
|
38
|
-
const setValue = (0, _react().useCallback)(newValue => {
|
|
39
|
-
const newParams = new URLSearchParams(searchParams);
|
|
40
|
-
if (newValue === null) {
|
|
41
|
-
newParams.delete(paramName);
|
|
42
|
-
if (persist) safeRemoveItem(storageKey);
|
|
43
|
-
} else {
|
|
44
|
-
newParams.set(paramName, newValue);
|
|
45
|
-
if (persist) safeSetItem(storageKey, newValue);
|
|
46
|
-
}
|
|
47
|
-
setSearchParams(newParams);
|
|
48
|
-
}, [searchParams, setSearchParams, paramName, storageKey, persist]);
|
|
49
|
-
return [value, setValue];
|
|
50
|
-
}
|
|
51
|
-
function useListParamWithDefault(paramName, options = {}) {
|
|
52
|
-
const {
|
|
53
|
-
persist = false
|
|
54
|
-
} = options;
|
|
55
|
-
const [searchParams, setSearchParams] = (0, _reactRouterDom().useSearchParams)();
|
|
56
|
-
const storageKey = STORAGE_KEY_PREFIX + paramName;
|
|
57
|
-
const values = (0, _react().useMemo)(() => {
|
|
58
|
-
const urlValue = searchParams.get(paramName);
|
|
59
|
-
if (urlValue) return urlValue.split(',').filter(Boolean);
|
|
60
|
-
if (persist) {
|
|
61
|
-
const stored = safeGetItem(storageKey);
|
|
62
|
-
if (stored) return stored.split(',').filter(Boolean);
|
|
63
|
-
}
|
|
64
|
-
return [];
|
|
65
|
-
}, [searchParams, paramName, storageKey, persist]);
|
|
66
|
-
const setValues = (0, _react().useCallback)(newValues => {
|
|
67
|
-
const newParams = new URLSearchParams(searchParams);
|
|
68
|
-
const joined = newValues.filter(Boolean).join(',');
|
|
69
|
-
if (joined) {
|
|
70
|
-
newParams.set(paramName, joined);
|
|
71
|
-
if (persist) safeSetItem(storageKey, joined);
|
|
72
|
-
} else {
|
|
73
|
-
newParams.delete(paramName);
|
|
74
|
-
if (persist) safeRemoveItem(storageKey);
|
|
75
|
-
}
|
|
76
|
-
setSearchParams(newParams);
|
|
77
|
-
}, [searchParams, setSearchParams, paramName, storageKey, persist]);
|
|
78
|
-
return [values, setValues];
|
|
79
|
-
}
|
|
80
|
-
function safeGetItem(key) {
|
|
81
|
-
try {
|
|
82
|
-
return localStorage.getItem(key);
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function safeSetItem(key, value) {
|
|
88
|
-
try {
|
|
89
|
-
localStorage.setItem(key, value);
|
|
90
|
-
} catch {
|
|
91
|
-
// ignore storage errors
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function safeRemoveItem(key) {
|
|
95
|
-
try {
|
|
96
|
-
localStorage.removeItem(key);
|
|
97
|
-
} catch {
|
|
98
|
-
// ignore storage errors
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=use-query-param-with-default.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","require","_reactRouterDom","STORAGE_KEY_PREFIX","useQueryParamWithDefault","paramName","fallback","options","persist","searchParams","setSearchParams","useSearchParams","storageKey","value","useMemo","urlValue","get","stored","safeGetItem","setValue","useCallback","newValue","newParams","URLSearchParams","delete","safeRemoveItem","set","safeSetItem","useListParamWithDefault","values","split","filter","Boolean","setValues","newValues","joined","join","key","localStorage","getItem","setItem","removeItem"],"sources":["use-query-param-with-default.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { useSearchParams } from 'react-router-dom';\n\nconst STORAGE_KEY_PREFIX = 'workspace-overview:';\n\nexport interface QueryParamOptions {\n /** persist value to localStorage across sessions. Default: true */\n persist?: boolean;\n}\n\nexport function useQueryParamWithDefault<T extends string>(\n paramName: string,\n fallback: T,\n options: QueryParamOptions = {}\n): [T, (value: T | null) => void] {\n const { persist = true } = options;\n const [searchParams, setSearchParams] = useSearchParams();\n const storageKey = STORAGE_KEY_PREFIX + paramName;\n\n const value = useMemo((): T => {\n const urlValue = searchParams.get(paramName);\n if (urlValue) return urlValue as T;\n\n if (persist) {\n const stored = safeGetItem(storageKey);\n if (stored) return stored as T;\n }\n\n return fallback;\n }, [searchParams, paramName, storageKey, fallback, persist]);\n\n const setValue = useCallback(\n (newValue: T | null) => {\n const newParams = new URLSearchParams(searchParams);\n\n if (newValue === null) {\n newParams.delete(paramName);\n if (persist) safeRemoveItem(storageKey);\n } else {\n newParams.set(paramName, newValue);\n if (persist) safeSetItem(storageKey, newValue);\n }\n\n setSearchParams(newParams);\n },\n [searchParams, setSearchParams, paramName, storageKey, persist]\n );\n\n return [value, setValue];\n}\n\nexport function useListParamWithDefault(\n paramName: string,\n options: QueryParamOptions = {}\n): [string[], (values: string[]) => void] {\n const { persist = false } = options;\n const [searchParams, setSearchParams] = useSearchParams();\n const storageKey = STORAGE_KEY_PREFIX + paramName;\n\n const values = useMemo((): string[] => {\n const urlValue = searchParams.get(paramName);\n if (urlValue) return urlValue.split(',').filter(Boolean);\n\n if (persist) {\n const stored = safeGetItem(storageKey);\n if (stored) return stored.split(',').filter(Boolean);\n }\n\n return [];\n }, [searchParams, paramName, storageKey, persist]);\n\n const setValues = useCallback(\n (newValues: string[]) => {\n const newParams = new URLSearchParams(searchParams);\n const joined = newValues.filter(Boolean).join(',');\n\n if (joined) {\n newParams.set(paramName, joined);\n if (persist) safeSetItem(storageKey, joined);\n } else {\n newParams.delete(paramName);\n if (persist) safeRemoveItem(storageKey);\n }\n\n setSearchParams(newParams);\n },\n [searchParams, setSearchParams, paramName, storageKey, persist]\n );\n\n return [values, setValues];\n}\n\nfunction safeGetItem(key: string): string | null {\n try {\n return localStorage.getItem(key);\n } catch {\n return null;\n }\n}\n\nfunction safeSetItem(key: string, value: string): void {\n try {\n localStorage.setItem(key, value);\n } catch {\n // ignore storage errors\n }\n}\n\nfunction safeRemoveItem(key: string): void {\n try {\n localStorage.removeItem(key);\n } catch {\n // ignore storage errors\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,gBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,eAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,MAAMG,kBAAkB,GAAG,qBAAqB;AAOzC,SAASC,wBAAwBA,CACtCC,SAAiB,EACjBC,QAAW,EACXC,OAA0B,GAAG,CAAC,CAAC,EACC;EAChC,MAAM;IAAEC,OAAO,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,SAAS,EAAEO,UAAU,EAAEJ,OAAO,CAChE,CAAC;EAED,OAAO,CAACqB,MAAM,EAAEI,SAAS,CAAC;AAC5B;AAEA,SAASf,WAAWA,CAACmB,GAAW,EAAiB;EAC/C,IAAI;IACF,OAAOC,YAAY,CAACC,OAAO,CAACF,GAAG,CAAC;EAClC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEA,SAASV,WAAWA,CAACU,GAAW,EAAExB,KAAa,EAAQ;EACrD,IAAI;IACFyB,YAAY,CAACE,OAAO,CAACH,GAAG,EAAExB,KAAK,CAAC;EAClC,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ;AAEA,SAASY,cAAcA,CAACY,GAAW,EAAQ;EACzC,IAAI;IACFC,YAAY,CAACG,UAAU,CAACJ,GAAG,CAAC;EAC9B,CAAC,CAAC,MAAM;IACN;EAAA;AAEJ","ignoreList":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { type ActiveFilters } from './filter-utils';
|
|
2
|
-
import type { WorkspaceItem, AggregationType, AggregationResult } from './workspace-overview.types';
|
|
3
|
-
export declare function useWorkspaceAggregation(items: WorkspaceItem[], aggregation: AggregationType, filters: ActiveFilters): AggregationResult;
|