@peasant-labs/fairtrade 0.0.3 → 0.0.4
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/lib/ChartLine-Dlp6-CLL.js +264 -0
- package/dist/lib/InUseShell-DZvmRdj-.js +1532 -0
- package/dist/lib/analytics.css +1 -0
- package/dist/lib/analytics.js +1052 -0
- package/dist/lib/commons.css +1 -0
- package/dist/lib/commons.js +3275 -0
- package/dist/lib/components.css +1 -1
- package/dist/lib/graph.css +1 -0
- package/dist/lib/graph.js +823 -0
- package/dist/lib/types/Intensity.d.ts +3 -3
- package/dist/lib/types/MapCanvas.d.ts +37 -5
- package/dist/lib/types/RoleRoster.d.ts +12 -1
- package/dist/lib/types/analytics/ChartCard.d.ts +18 -0
- package/dist/lib/types/analytics/ContributorTable.d.ts +16 -0
- package/dist/lib/types/analytics/ProjectOverview.d.ts +40 -0
- package/dist/lib/types/analytics/format.d.ts +48 -0
- package/dist/lib/types/analytics/index.d.ts +24 -0
- package/dist/lib/types/analytics/metrics.d.ts +130 -0
- package/dist/lib/types/analytics/stats.d.ts +23 -0
- package/dist/lib/types/analytics/time.d.ts +32 -0
- package/dist/lib/types/analytics/types.d.ts +453 -0
- package/dist/lib/types/commons/Explore.d.ts +6 -0
- package/dist/lib/types/commons/Manage.d.ts +34 -0
- package/dist/lib/types/commons/index.d.ts +24 -0
- package/dist/lib/types/commons/providers.d.ts +8 -0
- package/dist/lib/types/commons/types.d.ts +356 -0
- package/dist/lib/types/graph/ChangeDetail.d.ts +28 -0
- package/dist/lib/types/graph/Changes.d.ts +21 -0
- package/dist/lib/types/graph/CodeMap.d.ts +49 -0
- package/dist/lib/types/graph/CodeMapComposition.d.ts +85 -0
- package/dist/lib/types/graph/changeGraph.d.ts +106 -0
- package/dist/lib/types/graph/index.d.ts +30 -0
- package/dist/lib/types/graph/types.d.ts +579 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/inuse/InUseShell.d.ts +50 -0
- package/dist/lib/ui-oBFnHPFe.js +11146 -0
- package/dist/lib/ui.js +4 -12693
- package/package.json +37 -6
|
@@ -0,0 +1,823 @@
|
|
|
1
|
+
import { d as e, l as t, n, r, s as i, t as a, u as o } from "./InUseShell-DZvmRdj-.js";
|
|
2
|
+
import { useMemo as s, useRef as c, useState as l } from "react";
|
|
3
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
import { Box as f, Check as p, ChevronDown as m, ChevronRight as h, Coins as g, CornerDownRight as _, FileDiff as v, FileText as y, GitMerge as b, Hash as x, MessageSquare as S, RotateCw as C, Share2 as w, Tag as T, TriangleAlert as E, X as D } from "lucide-react";
|
|
5
|
+
//#region src/ui/graph/changeGraph.js
|
|
6
|
+
var O = 6e4, k = 60 * O, A = 24 * k, j = 7 * A;
|
|
7
|
+
function M(e, t) {
|
|
8
|
+
if (e == null) return "";
|
|
9
|
+
let n = Math.max(0, t - e);
|
|
10
|
+
return n < k ? `${Math.max(1, Math.floor(n / O))}m ago` : n < A ? `${Math.floor(n / k)}h ago` : n < j ? `${Math.floor(n / A)}d ago` : `${Math.floor(n / j)}wk ago`;
|
|
11
|
+
}
|
|
12
|
+
function N(e, { nowMs: t }) {
|
|
13
|
+
let n = e.recentCommits ?? [], r = e.changes ?? [], i = e.defaultBranch, a = r.filter((e) => !e.merged).slice().sort((e, t) => P(t) - P(e) || e.branch.localeCompare(t.branch)), o = r.filter((e) => e.merged && !e.reverted), s = r.filter((e) => e.merged && e.reverted), c = new Map(o.filter((e) => e.mergeCommitHash).map((e) => [e.mergeCommitHash, e])), l = a.map((e, t) => ({
|
|
14
|
+
change: e,
|
|
15
|
+
lane: t + 1,
|
|
16
|
+
baseHash: e.baseHash,
|
|
17
|
+
tipMs: e.tipCommitMs ?? null
|
|
18
|
+
})), u = [], d = /* @__PURE__ */ new Set(), f = (e) => {
|
|
19
|
+
for (let n of l) {
|
|
20
|
+
if (d.has(n.lane)) continue;
|
|
21
|
+
let r = n.tipMs;
|
|
22
|
+
if (!(r == null ? e === null : e !== null && r >= e)) continue;
|
|
23
|
+
d.add(n.lane);
|
|
24
|
+
let i = n.change;
|
|
25
|
+
u.push({
|
|
26
|
+
id: `tip:${i.branch}`,
|
|
27
|
+
lane: n.lane,
|
|
28
|
+
parents: n.baseHash ? [n.baseHash] : [],
|
|
29
|
+
message: i.branch,
|
|
30
|
+
branch: i.branch,
|
|
31
|
+
session: (i.sessionCount ?? 0) > 0,
|
|
32
|
+
tip: !0,
|
|
33
|
+
time: M(n.tipMs, t)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return f(null), n.forEach((e, r) => {
|
|
38
|
+
f(e.timeMs ?? -Infinity);
|
|
39
|
+
let a = n[r + 1], o = a ? [a.hash] : [], s = c.get(e.hash);
|
|
40
|
+
s && o.push(`tip:${s.branch}`), u.push({
|
|
41
|
+
id: e.hash,
|
|
42
|
+
lane: 0,
|
|
43
|
+
parents: o,
|
|
44
|
+
message: e.subject,
|
|
45
|
+
branch: i,
|
|
46
|
+
session: e.hasSession,
|
|
47
|
+
merged: s ? !0 : void 0,
|
|
48
|
+
time: M(e.timeMs, t)
|
|
49
|
+
});
|
|
50
|
+
}), f(-Infinity), {
|
|
51
|
+
commits: u,
|
|
52
|
+
reverted: s.map((e) => ({
|
|
53
|
+
branch: e.branch,
|
|
54
|
+
mergedAtMs: e.mergedAtMs ?? null,
|
|
55
|
+
when: M(e.mergedAtMs, t)
|
|
56
|
+
})),
|
|
57
|
+
openCount: a.length,
|
|
58
|
+
mergedCount: o.length + s.length
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function P(e) {
|
|
62
|
+
return e.tipCommitMs ?? Infinity;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/ui/graph/Changes.jsx
|
|
66
|
+
function F({ payload: t, projectLabel: n, selectedId: r, onSelectChange: i, onOpenMap: a, hasMore: o = !1, onShowOlder: c, nowMs: l }) {
|
|
67
|
+
let p = l ?? Date.now(), { commits: m, reverted: h, openCount: g, mergedCount: _ } = s(() => N(t, { nowMs: p }), [t, p]), v = t.defaultBranch;
|
|
68
|
+
return /* @__PURE__ */ d("div", {
|
|
69
|
+
className: "gmp-root gmp-changes-root",
|
|
70
|
+
children: [/* @__PURE__ */ d("div", {
|
|
71
|
+
className: "gmp-changes-head",
|
|
72
|
+
children: [/* @__PURE__ */ d("div", { children: [n && /* @__PURE__ */ d("span", {
|
|
73
|
+
className: "label",
|
|
74
|
+
children: ["lines of work · ", n]
|
|
75
|
+
}), /* @__PURE__ */ d("div", {
|
|
76
|
+
className: "gmp-changes-sub mono",
|
|
77
|
+
children: [
|
|
78
|
+
v ? `default branch ${v} · ` : "",
|
|
79
|
+
g,
|
|
80
|
+
" open · ",
|
|
81
|
+
_,
|
|
82
|
+
" merged"
|
|
83
|
+
]
|
|
84
|
+
})] }), /* @__PURE__ */ d("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
className: "btn btn-secondary btn-sm",
|
|
87
|
+
onClick: () => a?.(),
|
|
88
|
+
children: [/* @__PURE__ */ u(f, {
|
|
89
|
+
size: 14,
|
|
90
|
+
"aria-hidden": "true"
|
|
91
|
+
}), " open the map"]
|
|
92
|
+
})]
|
|
93
|
+
}), /* @__PURE__ */ d("div", {
|
|
94
|
+
className: "gmp-changes-body",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ u(e, {
|
|
97
|
+
className: "gmp-cg",
|
|
98
|
+
commits: m,
|
|
99
|
+
selectedId: r,
|
|
100
|
+
label: "default-branch commit history",
|
|
101
|
+
onSelect: (e) => i?.(e),
|
|
102
|
+
hasMore: o,
|
|
103
|
+
onShowOlder: c
|
|
104
|
+
}),
|
|
105
|
+
h.length > 0 && /* @__PURE__ */ d("div", {
|
|
106
|
+
className: "gmp-merged-sec",
|
|
107
|
+
children: [/* @__PURE__ */ u("div", {
|
|
108
|
+
className: "sb-head gmp-merged-head",
|
|
109
|
+
children: "already merged in"
|
|
110
|
+
}), /* @__PURE__ */ u("div", {
|
|
111
|
+
className: "gmp-merged-list",
|
|
112
|
+
children: h.map((e) => /* @__PURE__ */ d("button", {
|
|
113
|
+
type: "button",
|
|
114
|
+
className: "gmp-merged-chip gmp-merged-revert",
|
|
115
|
+
onClick: () => i?.({
|
|
116
|
+
id: `revert:${e.branch}`,
|
|
117
|
+
branch: e.branch
|
|
118
|
+
}),
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ u(b, {
|
|
121
|
+
size: 13,
|
|
122
|
+
"aria-hidden": "true"
|
|
123
|
+
}),
|
|
124
|
+
" reverted · ",
|
|
125
|
+
e.branch,
|
|
126
|
+
" · then undone · ",
|
|
127
|
+
e.when
|
|
128
|
+
]
|
|
129
|
+
}, e.branch))
|
|
130
|
+
})]
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ d("div", {
|
|
133
|
+
className: "gmp-changes-legend",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ d("span", {
|
|
136
|
+
className: "gmp-legend-item",
|
|
137
|
+
children: [/* @__PURE__ */ u("span", {
|
|
138
|
+
className: "cg-dot cg-dot-filled",
|
|
139
|
+
style: {
|
|
140
|
+
width: 9,
|
|
141
|
+
height: 9
|
|
142
|
+
},
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
}), " commit with a recorded session"]
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ d("span", {
|
|
147
|
+
className: "gmp-legend-item",
|
|
148
|
+
children: [/* @__PURE__ */ u("span", {
|
|
149
|
+
className: "cg-dot cg-dot-hollow",
|
|
150
|
+
style: {
|
|
151
|
+
width: 9,
|
|
152
|
+
height: 9
|
|
153
|
+
},
|
|
154
|
+
"aria-hidden": "true"
|
|
155
|
+
}), " no session captured"]
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ u("span", {
|
|
158
|
+
className: "gmp-legend-item gmp-legend-dim",
|
|
159
|
+
children: "a filled dot also flies a sparkle · select a commit to open it"
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/ui/graph/ChangeDetail.jsx
|
|
169
|
+
var I = {
|
|
170
|
+
M: "changed",
|
|
171
|
+
A: "added",
|
|
172
|
+
D: "deleted",
|
|
173
|
+
R: "renamed"
|
|
174
|
+
}, L = {
|
|
175
|
+
A: "chip-ok",
|
|
176
|
+
M: "",
|
|
177
|
+
D: "chip-err",
|
|
178
|
+
R: "chip-warn"
|
|
179
|
+
}, R = {
|
|
180
|
+
context: "ctx",
|
|
181
|
+
add: "add",
|
|
182
|
+
del: "del"
|
|
183
|
+
};
|
|
184
|
+
function z(e) {
|
|
185
|
+
let t = (e.split("/").pop() ?? e).replace(/[-_]+/g, " ").trim();
|
|
186
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
187
|
+
}
|
|
188
|
+
var B = (e) => e >= 1e3 ? `≈${(e / 1e3).toFixed(1)}k` : String(e);
|
|
189
|
+
function V(e) {
|
|
190
|
+
let t = e.oldStart, n = e.newStart, r = e.lines.map((e) => {
|
|
191
|
+
let r = R[e.kind] ?? "ctx";
|
|
192
|
+
return r === "add" ? {
|
|
193
|
+
type: r,
|
|
194
|
+
newNo: n++,
|
|
195
|
+
text: e.text
|
|
196
|
+
} : r === "del" ? {
|
|
197
|
+
type: r,
|
|
198
|
+
oldNo: t++,
|
|
199
|
+
text: e.text
|
|
200
|
+
} : {
|
|
201
|
+
type: r,
|
|
202
|
+
oldNo: t++,
|
|
203
|
+
newNo: n++,
|
|
204
|
+
text: e.text
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
header: e.header ?? `-${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines}`,
|
|
209
|
+
lines: r
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function H({ file: e, diff: t, open: n, onToggle: r }) {
|
|
213
|
+
let i = e.status, a = t ? new Set(t.hunks.map((e) => e.sessionId).filter(Boolean)).size : null;
|
|
214
|
+
return /* @__PURE__ */ d("div", {
|
|
215
|
+
className: "gmp-file",
|
|
216
|
+
children: [/* @__PURE__ */ d("button", {
|
|
217
|
+
type: "button",
|
|
218
|
+
className: "gmp-file-head",
|
|
219
|
+
"aria-expanded": n,
|
|
220
|
+
onClick: r,
|
|
221
|
+
children: [
|
|
222
|
+
u(n ? m : h, {
|
|
223
|
+
size: 14,
|
|
224
|
+
"aria-hidden": "true"
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ u("span", {
|
|
227
|
+
className: "mono gmp-file-path",
|
|
228
|
+
children: e.path
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ u("span", {
|
|
231
|
+
className: "chip gmp-file-status " + (L[i] ?? ""),
|
|
232
|
+
children: I[i] ?? i
|
|
233
|
+
}),
|
|
234
|
+
a != null && a > 0 && /* @__PURE__ */ d("span", {
|
|
235
|
+
className: "gmp-file-convos metaitem",
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ u(S, {
|
|
238
|
+
size: 13,
|
|
239
|
+
"aria-hidden": "true"
|
|
240
|
+
}),
|
|
241
|
+
" ",
|
|
242
|
+
/* @__PURE__ */ u("span", {
|
|
243
|
+
className: "tnum",
|
|
244
|
+
children: a
|
|
245
|
+
})
|
|
246
|
+
]
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
}), n && /* @__PURE__ */ u("div", {
|
|
250
|
+
className: "gmp-file-body",
|
|
251
|
+
children: t ? t.error ? /* @__PURE__ */ u("p", {
|
|
252
|
+
className: "gmp-diff-state gmp-diff-error mono",
|
|
253
|
+
children: t.error
|
|
254
|
+
}) : t.binary ? /* @__PURE__ */ u("p", {
|
|
255
|
+
className: "gmp-diff-state mono",
|
|
256
|
+
children: "binary file — no textual diff."
|
|
257
|
+
}) : t.hunks.length === 0 ? /* @__PURE__ */ u("p", {
|
|
258
|
+
className: "gmp-diff-state mono",
|
|
259
|
+
children: "no line changes."
|
|
260
|
+
}) : t.hunks.map((e, n) => /* @__PURE__ */ d("div", {
|
|
261
|
+
className: "gmp-hunk",
|
|
262
|
+
children: [
|
|
263
|
+
e.sessionTitle && /* @__PURE__ */ d("div", {
|
|
264
|
+
className: "gmp-hunk-attrib",
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ u(_, {
|
|
267
|
+
size: 13,
|
|
268
|
+
"aria-hidden": "true"
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ u("span", {
|
|
271
|
+
className: "gmp-hunk-from",
|
|
272
|
+
children: "from"
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ u("span", {
|
|
275
|
+
className: "gmp-hunk-link",
|
|
276
|
+
children: e.sessionTitle
|
|
277
|
+
}),
|
|
278
|
+
e.sessionId && /* @__PURE__ */ u("span", {
|
|
279
|
+
className: "mono gmp-hunk-hash",
|
|
280
|
+
children: e.sessionId.slice(0, 7)
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
}),
|
|
284
|
+
/* @__PURE__ */ u(o, {
|
|
285
|
+
file: "",
|
|
286
|
+
hunks: [V(e)],
|
|
287
|
+
className: "gmp-hunk-diff"
|
|
288
|
+
}),
|
|
289
|
+
t.truncated && n === t.hunks.length - 1 && /* @__PURE__ */ u("p", {
|
|
290
|
+
className: "gmp-diff-state mono",
|
|
291
|
+
children: "diff truncated (file exceeds the size cap)."
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
}, n)) : /* @__PURE__ */ u("p", {
|
|
295
|
+
className: "gmp-diff-state mono",
|
|
296
|
+
children: "loading diff…"
|
|
297
|
+
})
|
|
298
|
+
})]
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function U({ payload: e, getDiff: t, title: n, annotation: r = "", onSaveAnnotation: i, onRemoveAnnotation: a, onOpenMap: o, onShare: s, onCopyRecap: m, initialOpenFiles: _ = {} }) {
|
|
302
|
+
let [b, S] = l(_), [O, k] = l(null), [A, j] = l(!1), [M, N] = l(""), P = c({}), F = c(null), I = n ?? z(e.branch), L = e.work.length, R = e.newEdges.length, V = e.removedEdges.length, U = (e) => S((t) => ({
|
|
303
|
+
...t,
|
|
304
|
+
[e]: !t[e]
|
|
305
|
+
}));
|
|
306
|
+
function W(e, t) {
|
|
307
|
+
if (k(e), t) {
|
|
308
|
+
S((e) => ({
|
|
309
|
+
...e,
|
|
310
|
+
[t]: !0
|
|
311
|
+
}));
|
|
312
|
+
let e = P.current[t], n = F.current;
|
|
313
|
+
if (e && n) {
|
|
314
|
+
let t = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
315
|
+
n.scrollTo({
|
|
316
|
+
top: e.offsetTop - 12,
|
|
317
|
+
behavior: t ? "auto" : "smooth"
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function G(e) {
|
|
323
|
+
e.preventDefault();
|
|
324
|
+
let t = M.trim();
|
|
325
|
+
t && i?.(t), j(!1), N("");
|
|
326
|
+
}
|
|
327
|
+
let K = e.files[0]?.path;
|
|
328
|
+
return /* @__PURE__ */ d("div", {
|
|
329
|
+
className: "gmp-root gmp-detail-root",
|
|
330
|
+
ref: F,
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ d("div", {
|
|
333
|
+
className: "gmp-detail-head",
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ d("div", {
|
|
336
|
+
className: "crumb",
|
|
337
|
+
children: [
|
|
338
|
+
"review ",
|
|
339
|
+
/* @__PURE__ */ u(h, {
|
|
340
|
+
size: 13,
|
|
341
|
+
"aria-hidden": "true"
|
|
342
|
+
}),
|
|
343
|
+
" ",
|
|
344
|
+
e.defaultBranch,
|
|
345
|
+
" ",
|
|
346
|
+
/* @__PURE__ */ u(h, {
|
|
347
|
+
size: 13,
|
|
348
|
+
"aria-hidden": "true"
|
|
349
|
+
}),
|
|
350
|
+
" ",
|
|
351
|
+
/* @__PURE__ */ u("span", {
|
|
352
|
+
className: "cur",
|
|
353
|
+
children: e.branch
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ u("div", {
|
|
358
|
+
className: "gmp-detail-title",
|
|
359
|
+
children: I
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ d("p", {
|
|
362
|
+
className: "gmp-caption",
|
|
363
|
+
children: [
|
|
364
|
+
"this line of work touched",
|
|
365
|
+
" ",
|
|
366
|
+
/* @__PURE__ */ d("button", {
|
|
367
|
+
type: "button",
|
|
368
|
+
className: "gmp-frag" + (O === "files" ? " gmp-frag-on" : ""),
|
|
369
|
+
onClick: () => W("files", K),
|
|
370
|
+
children: [e.filesChanged, " files"]
|
|
371
|
+
}),
|
|
372
|
+
" ",
|
|
373
|
+
"across",
|
|
374
|
+
" ",
|
|
375
|
+
/* @__PURE__ */ d("button", {
|
|
376
|
+
type: "button",
|
|
377
|
+
className: "gmp-frag" + (O === "conversations" ? " gmp-frag-on" : ""),
|
|
378
|
+
onClick: () => W("conversations"),
|
|
379
|
+
children: [L, " conversations"]
|
|
380
|
+
}),
|
|
381
|
+
", reshaping",
|
|
382
|
+
" ",
|
|
383
|
+
/* @__PURE__ */ d("button", {
|
|
384
|
+
type: "button",
|
|
385
|
+
className: "gmp-frag" + (O === "conn" ? " gmp-frag-on" : ""),
|
|
386
|
+
onClick: () => W("conn"),
|
|
387
|
+
children: [
|
|
388
|
+
"+",
|
|
389
|
+
R,
|
|
390
|
+
"/−",
|
|
391
|
+
V,
|
|
392
|
+
" connections"
|
|
393
|
+
]
|
|
394
|
+
}),
|
|
395
|
+
"."
|
|
396
|
+
]
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ u("span", {
|
|
399
|
+
className: "gmp-caption-hint mono",
|
|
400
|
+
children: "click any number to jump to its proof"
|
|
401
|
+
})
|
|
402
|
+
]
|
|
403
|
+
}),
|
|
404
|
+
(e.frictions.length > 0 || e.violations.length > 0) && /* @__PURE__ */ d("div", {
|
|
405
|
+
className: "gmp-signals",
|
|
406
|
+
children: [e.frictions.map((e, t) => /* @__PURE__ */ d("span", {
|
|
407
|
+
className: "gmp-signal",
|
|
408
|
+
children: [
|
|
409
|
+
/* @__PURE__ */ u(C, {
|
|
410
|
+
size: 14,
|
|
411
|
+
"aria-hidden": "true"
|
|
412
|
+
}),
|
|
413
|
+
" ",
|
|
414
|
+
e.label,
|
|
415
|
+
" · ",
|
|
416
|
+
/* @__PURE__ */ u("span", {
|
|
417
|
+
className: "mono",
|
|
418
|
+
children: e.file
|
|
419
|
+
}),
|
|
420
|
+
" ",
|
|
421
|
+
/* @__PURE__ */ d("b", {
|
|
422
|
+
className: "tnum",
|
|
423
|
+
children: [e.count, "×"]
|
|
424
|
+
}),
|
|
425
|
+
" across ",
|
|
426
|
+
e.sessions,
|
|
427
|
+
" conversations"
|
|
428
|
+
]
|
|
429
|
+
}, t)), e.violations.length > 0 && /* @__PURE__ */ d("span", {
|
|
430
|
+
className: "gmp-signal gmp-signal-warn",
|
|
431
|
+
children: [
|
|
432
|
+
/* @__PURE__ */ u(E, {
|
|
433
|
+
size: 14,
|
|
434
|
+
"aria-hidden": "true"
|
|
435
|
+
}),
|
|
436
|
+
" ",
|
|
437
|
+
/* @__PURE__ */ u("b", {
|
|
438
|
+
className: "tnum",
|
|
439
|
+
children: e.violations.length
|
|
440
|
+
}),
|
|
441
|
+
" rule breaks"
|
|
442
|
+
]
|
|
443
|
+
})]
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ d("div", {
|
|
446
|
+
className: "gmp-totals",
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ d("span", {
|
|
449
|
+
className: "metaitem tnum",
|
|
450
|
+
children: [
|
|
451
|
+
/* @__PURE__ */ u(v, {
|
|
452
|
+
size: 14,
|
|
453
|
+
"aria-hidden": "true"
|
|
454
|
+
}),
|
|
455
|
+
" ",
|
|
456
|
+
e.filesChanged,
|
|
457
|
+
" files touched"
|
|
458
|
+
]
|
|
459
|
+
}),
|
|
460
|
+
/* @__PURE__ */ d("span", {
|
|
461
|
+
className: "metaitem tnum",
|
|
462
|
+
children: [
|
|
463
|
+
/* @__PURE__ */ d("span", {
|
|
464
|
+
className: "gmp-add",
|
|
465
|
+
children: ["+", R]
|
|
466
|
+
}),
|
|
467
|
+
"/",
|
|
468
|
+
/* @__PURE__ */ d("span", {
|
|
469
|
+
className: "gmp-del",
|
|
470
|
+
children: ["−", V]
|
|
471
|
+
}),
|
|
472
|
+
" connections"
|
|
473
|
+
]
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ d("span", {
|
|
476
|
+
className: "metaitem tnum",
|
|
477
|
+
children: [
|
|
478
|
+
/* @__PURE__ */ u(x, {
|
|
479
|
+
size: 14,
|
|
480
|
+
"aria-hidden": "true"
|
|
481
|
+
}),
|
|
482
|
+
" ai wrote ",
|
|
483
|
+
B(e.outputTokens),
|
|
484
|
+
" tokens"
|
|
485
|
+
]
|
|
486
|
+
}),
|
|
487
|
+
e.costUsd != null && /* @__PURE__ */ d("span", {
|
|
488
|
+
className: "metaitem tnum",
|
|
489
|
+
children: [
|
|
490
|
+
/* @__PURE__ */ u(g, {
|
|
491
|
+
size: 14,
|
|
492
|
+
"aria-hidden": "true"
|
|
493
|
+
}),
|
|
494
|
+
" est. spend $",
|
|
495
|
+
e.costUsd.toFixed(2)
|
|
496
|
+
]
|
|
497
|
+
})
|
|
498
|
+
]
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ d("div", {
|
|
501
|
+
className: "gmp-detail-sec",
|
|
502
|
+
children: [/* @__PURE__ */ u("div", {
|
|
503
|
+
className: "sb-head gmp-detail-sechead",
|
|
504
|
+
children: "files changed · click a path to open its diff"
|
|
505
|
+
}), /* @__PURE__ */ u("div", {
|
|
506
|
+
className: "gmp-files",
|
|
507
|
+
children: e.files.map((e) => /* @__PURE__ */ u("div", {
|
|
508
|
+
ref: (t) => {
|
|
509
|
+
P.current[e.path] = t;
|
|
510
|
+
},
|
|
511
|
+
children: /* @__PURE__ */ u(H, {
|
|
512
|
+
file: e,
|
|
513
|
+
diff: b[e.path] ? t?.(e) : void 0,
|
|
514
|
+
open: !!b[e.path],
|
|
515
|
+
onToggle: () => U(e.path)
|
|
516
|
+
})
|
|
517
|
+
}, e.path))
|
|
518
|
+
})]
|
|
519
|
+
}),
|
|
520
|
+
/* @__PURE__ */ d("div", {
|
|
521
|
+
className: "gmp-detail-sec",
|
|
522
|
+
children: [/* @__PURE__ */ u("div", {
|
|
523
|
+
className: "sb-head gmp-detail-sechead",
|
|
524
|
+
children: "your annotation"
|
|
525
|
+
}), /* @__PURE__ */ d("div", {
|
|
526
|
+
className: "gmp-annot",
|
|
527
|
+
children: [
|
|
528
|
+
r && /* @__PURE__ */ d("span", {
|
|
529
|
+
className: "gmp-label-chip gmp-annot-chip",
|
|
530
|
+
children: [
|
|
531
|
+
/* @__PURE__ */ u(T, {
|
|
532
|
+
size: 12,
|
|
533
|
+
"aria-hidden": "true"
|
|
534
|
+
}),
|
|
535
|
+
" ",
|
|
536
|
+
r,
|
|
537
|
+
/* @__PURE__ */ u("button", {
|
|
538
|
+
type: "button",
|
|
539
|
+
className: "gmp-annot-x",
|
|
540
|
+
"aria-label": "remove annotation",
|
|
541
|
+
onClick: () => a?.(),
|
|
542
|
+
children: /* @__PURE__ */ u(D, {
|
|
543
|
+
size: 11,
|
|
544
|
+
"aria-hidden": "true"
|
|
545
|
+
})
|
|
546
|
+
})
|
|
547
|
+
]
|
|
548
|
+
}),
|
|
549
|
+
/* @__PURE__ */ d("button", {
|
|
550
|
+
type: "button",
|
|
551
|
+
className: "gmp-annot-add",
|
|
552
|
+
"aria-expanded": A,
|
|
553
|
+
onClick: () => j((e) => !e),
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ u(T, {
|
|
556
|
+
size: 13,
|
|
557
|
+
"aria-hidden": "true"
|
|
558
|
+
}),
|
|
559
|
+
" ",
|
|
560
|
+
r ? "change label" : "add a label"
|
|
561
|
+
]
|
|
562
|
+
}),
|
|
563
|
+
A && /* @__PURE__ */ d("form", {
|
|
564
|
+
className: "gmp-annot-pop",
|
|
565
|
+
onSubmit: G,
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ u("span", {
|
|
568
|
+
className: "label",
|
|
569
|
+
children: "user.custom_label"
|
|
570
|
+
}),
|
|
571
|
+
/* @__PURE__ */ u("input", {
|
|
572
|
+
className: "input",
|
|
573
|
+
type: "text",
|
|
574
|
+
autoFocus: !0,
|
|
575
|
+
value: M,
|
|
576
|
+
onChange: (e) => N(e.target.value),
|
|
577
|
+
placeholder: "e.g. good handoff",
|
|
578
|
+
"aria-label": "annotation value"
|
|
579
|
+
}),
|
|
580
|
+
/* @__PURE__ */ d("div", {
|
|
581
|
+
className: "gmp-annot-pop-foot",
|
|
582
|
+
children: [/* @__PURE__ */ u("button", {
|
|
583
|
+
type: "button",
|
|
584
|
+
className: "btn btn-ghost btn-sm",
|
|
585
|
+
onClick: () => j(!1),
|
|
586
|
+
children: "cancel"
|
|
587
|
+
}), /* @__PURE__ */ d("button", {
|
|
588
|
+
type: "submit",
|
|
589
|
+
className: "btn btn-primary btn-sm",
|
|
590
|
+
children: [/* @__PURE__ */ u(p, {
|
|
591
|
+
size: 13,
|
|
592
|
+
"aria-hidden": "true"
|
|
593
|
+
}), " save"]
|
|
594
|
+
})]
|
|
595
|
+
})
|
|
596
|
+
]
|
|
597
|
+
})
|
|
598
|
+
]
|
|
599
|
+
})]
|
|
600
|
+
}),
|
|
601
|
+
/* @__PURE__ */ d("div", {
|
|
602
|
+
className: "gmp-exits",
|
|
603
|
+
children: [
|
|
604
|
+
/* @__PURE__ */ d("button", {
|
|
605
|
+
type: "button",
|
|
606
|
+
className: "btn btn-secondary btn-sm",
|
|
607
|
+
onClick: () => o?.(),
|
|
608
|
+
children: [/* @__PURE__ */ u(f, {
|
|
609
|
+
size: 14,
|
|
610
|
+
"aria-hidden": "true"
|
|
611
|
+
}), " see this work on the code map"]
|
|
612
|
+
}),
|
|
613
|
+
/* @__PURE__ */ d("button", {
|
|
614
|
+
type: "button",
|
|
615
|
+
className: "btn btn-secondary btn-sm",
|
|
616
|
+
onClick: () => s?.(),
|
|
617
|
+
children: [
|
|
618
|
+
/* @__PURE__ */ u(w, {
|
|
619
|
+
size: 14,
|
|
620
|
+
"aria-hidden": "true"
|
|
621
|
+
}),
|
|
622
|
+
" share ",
|
|
623
|
+
L,
|
|
624
|
+
" conversations…"
|
|
625
|
+
]
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ d("button", {
|
|
628
|
+
type: "button",
|
|
629
|
+
className: "btn btn-secondary btn-sm",
|
|
630
|
+
onClick: () => m?.(),
|
|
631
|
+
children: [/* @__PURE__ */ u(y, {
|
|
632
|
+
size: 14,
|
|
633
|
+
"aria-hidden": "true"
|
|
634
|
+
}), " copy recap"]
|
|
635
|
+
}),
|
|
636
|
+
/* @__PURE__ */ d("code", {
|
|
637
|
+
className: "gmp-gitdiff mono",
|
|
638
|
+
children: [
|
|
639
|
+
"git diff ",
|
|
640
|
+
e.defaultBranch,
|
|
641
|
+
"...",
|
|
642
|
+
e.branch
|
|
643
|
+
]
|
|
644
|
+
})
|
|
645
|
+
]
|
|
646
|
+
}),
|
|
647
|
+
/* @__PURE__ */ u("p", {
|
|
648
|
+
className: "gmp-boundary mono",
|
|
649
|
+
children: "shows what changed and the recorded work behind it, not whether the change is correct or secure."
|
|
650
|
+
})
|
|
651
|
+
]
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region src/ui/graph/CodeMap.jsx
|
|
656
|
+
var W = Object.freeze({
|
|
657
|
+
project: "overview",
|
|
658
|
+
package: "folders",
|
|
659
|
+
file: "files"
|
|
660
|
+
}), G = Object.freeze({
|
|
661
|
+
overview: "project",
|
|
662
|
+
folders: "package",
|
|
663
|
+
files: "file"
|
|
664
|
+
});
|
|
665
|
+
function K({ payload: e, zoom: n, onZoomChange: r, selectedId: i, onSelect: a, onExpand: o, highlightedIds: l, nodeDeltas: d, structureEdgeDeltas: f, height: p = 520, ariaLabel: m = "code map", className: h = "" }) {
|
|
666
|
+
let g = s(() => {
|
|
667
|
+
let t = /* @__PURE__ */ new Map();
|
|
668
|
+
for (let n of e?.nodes ?? []) t.set(n.id, n);
|
|
669
|
+
return t;
|
|
670
|
+
}, [e?.nodes]), _ = s(() => q(e), [e]), v = W[n?.level ?? "package"] ?? "folders", y = n?.expanded ?? [], b = n?.level !== void 0, x = c(v);
|
|
671
|
+
return b && (x.current = v), /* @__PURE__ */ u(t, {
|
|
672
|
+
data: _,
|
|
673
|
+
grain: v,
|
|
674
|
+
expandedIds: y,
|
|
675
|
+
selectedId: i,
|
|
676
|
+
highlightedIds: l,
|
|
677
|
+
nodeDeltas: d,
|
|
678
|
+
edgeDeltas: f,
|
|
679
|
+
onSelect: (e) => a?.(e, e ? g.get(e) ?? null : null),
|
|
680
|
+
onExpand: o,
|
|
681
|
+
onGrainChange: (e) => {
|
|
682
|
+
x.current = e, r?.({
|
|
683
|
+
level: G[e] ?? "package",
|
|
684
|
+
expanded: []
|
|
685
|
+
});
|
|
686
|
+
},
|
|
687
|
+
onExpandedIdsChange: (e) => {
|
|
688
|
+
r?.({
|
|
689
|
+
level: G[x.current] ?? "package",
|
|
690
|
+
expanded: e
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
height: p,
|
|
694
|
+
ariaLabel: m,
|
|
695
|
+
className: h
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
function q(e) {
|
|
699
|
+
let t = e?.nodes ?? [], n = Y(e?.violations ?? []);
|
|
700
|
+
return {
|
|
701
|
+
nodes: t.map((e) => ({
|
|
702
|
+
id: e.id,
|
|
703
|
+
label: e.name || e.id,
|
|
704
|
+
kind: e.kind === "file" ? "file" : "folder",
|
|
705
|
+
loc: e.loc ?? 0,
|
|
706
|
+
coverage: J(e.recordedFiles, e.totalFiles),
|
|
707
|
+
parent: e.parent || void 0,
|
|
708
|
+
violations: n.get(e.id) ?? 0,
|
|
709
|
+
layer: e.layer,
|
|
710
|
+
order: e.order
|
|
711
|
+
})),
|
|
712
|
+
edges: (e?.structureEdges ?? []).map((e) => ({
|
|
713
|
+
from: e.from,
|
|
714
|
+
to: e.to,
|
|
715
|
+
kind: "structure",
|
|
716
|
+
weight: e.count ?? 1
|
|
717
|
+
}))
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function J(e, t) {
|
|
721
|
+
let n = Number(t) || 0;
|
|
722
|
+
if (n <= 0) return 0;
|
|
723
|
+
let r = Math.max(0, Math.min(1, (Number(e) || 0) / n));
|
|
724
|
+
return Math.max(0, Math.min(4, Math.round(r * 4)));
|
|
725
|
+
}
|
|
726
|
+
function Y(e) {
|
|
727
|
+
let t = /* @__PURE__ */ new Map();
|
|
728
|
+
for (let n of e) X(t, n.from), X(t, n.to);
|
|
729
|
+
return t;
|
|
730
|
+
}
|
|
731
|
+
function X(e, t) {
|
|
732
|
+
t && e.set(t, (e.get(t) ?? 0) + 1);
|
|
733
|
+
}
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/ui/graph/CodeMapComposition.jsx
|
|
736
|
+
function Z({ payload: e, zoom: t, onZoomChange: n, selectedId: r, onSelect: a, onExpand: o, highlightedIds: s, nodeDeltas: c, structureEdgeDeltas: l, height: f = 480, ariaLabel: p = "code map", canvasSlot: m, rail: h, toolbar: g, sheetTitle: _ = "code area", sheetMeta: v, railSide: y = "right", legend: b, canvasWrapperClassName: x = "", canvasWrapperStyle: S, className: C = "" }) {
|
|
737
|
+
return /* @__PURE__ */ u("div", {
|
|
738
|
+
className: ["gmp-root", C].filter(Boolean).join(" "),
|
|
739
|
+
children: /* @__PURE__ */ d(i, {
|
|
740
|
+
toolbar: g,
|
|
741
|
+
rail: h,
|
|
742
|
+
sheetTitle: _,
|
|
743
|
+
sheetMeta: v,
|
|
744
|
+
railSide: y,
|
|
745
|
+
children: [/* @__PURE__ */ u("div", {
|
|
746
|
+
className: ["gmp-map-canvas-region", x].filter(Boolean).join(" "),
|
|
747
|
+
style: S,
|
|
748
|
+
"data-testid": "gmp-map-canvas-region",
|
|
749
|
+
children: m ?? /* @__PURE__ */ u(K, {
|
|
750
|
+
payload: e,
|
|
751
|
+
zoom: t,
|
|
752
|
+
onZoomChange: n,
|
|
753
|
+
selectedId: r,
|
|
754
|
+
onSelect: a,
|
|
755
|
+
onExpand: o,
|
|
756
|
+
highlightedIds: s,
|
|
757
|
+
nodeDeltas: c,
|
|
758
|
+
structureEdgeDeltas: l,
|
|
759
|
+
height: f,
|
|
760
|
+
ariaLabel: p
|
|
761
|
+
})
|
|
762
|
+
}), b !== !1 && (b ?? /* @__PURE__ */ u(Q, {}))]
|
|
763
|
+
})
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function Q() {
|
|
767
|
+
return /* @__PURE__ */ d("p", {
|
|
768
|
+
className: "gmp-map-legend",
|
|
769
|
+
children: [
|
|
770
|
+
/* @__PURE__ */ d("span", {
|
|
771
|
+
className: "gmp-legend-item",
|
|
772
|
+
children: [/* @__PURE__ */ u("span", {
|
|
773
|
+
className: "gmp-map-swatch",
|
|
774
|
+
"aria-hidden": "true"
|
|
775
|
+
}), " code area (folder or file)"]
|
|
776
|
+
}),
|
|
777
|
+
/* @__PURE__ */ d("span", {
|
|
778
|
+
className: "gmp-legend-item gmp-legend-dim",
|
|
779
|
+
children: [/* @__PURE__ */ u("span", {
|
|
780
|
+
className: "gmp-map-swatch gmp-map-swatch--empty",
|
|
781
|
+
"aria-hidden": "true"
|
|
782
|
+
}), " no saved conversation behind it"]
|
|
783
|
+
}),
|
|
784
|
+
/* @__PURE__ */ u("span", {
|
|
785
|
+
className: "gmp-legend-item gmp-legend-dim",
|
|
786
|
+
children: "brighter = more of it built with AI on record"
|
|
787
|
+
}),
|
|
788
|
+
/* @__PURE__ */ d("span", {
|
|
789
|
+
className: "gmp-legend-item gmp-legend-dim",
|
|
790
|
+
children: [/* @__PURE__ */ u("span", {
|
|
791
|
+
className: "gmp-map-swatch gmp-map-swatch--edge",
|
|
792
|
+
"aria-hidden": "true"
|
|
793
|
+
}), " one area uses another"]
|
|
794
|
+
}),
|
|
795
|
+
/* @__PURE__ */ u("span", {
|
|
796
|
+
className: "gmp-legend-item gmp-map-legend-danger",
|
|
797
|
+
children: "⚠ tangle — two areas that depend on each other"
|
|
798
|
+
}),
|
|
799
|
+
/* @__PURE__ */ u("span", {
|
|
800
|
+
className: "gmp-legend-item gmp-legend-dim",
|
|
801
|
+
children: "double-click a folder to open its files"
|
|
802
|
+
})
|
|
803
|
+
]
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
//#endregion
|
|
807
|
+
//#region src/ui/graph/types.js
|
|
808
|
+
var $ = Object.freeze([
|
|
809
|
+
"module",
|
|
810
|
+
"package",
|
|
811
|
+
"file"
|
|
812
|
+
]), ee = Object.freeze(["bound", "candidate"]), te = Object.freeze(["cycle", "wrong_way"]), ne = Object.freeze([
|
|
813
|
+
"M",
|
|
814
|
+
"A",
|
|
815
|
+
"D",
|
|
816
|
+
"R"
|
|
817
|
+
]), re = Object.freeze([
|
|
818
|
+
"context",
|
|
819
|
+
"add",
|
|
820
|
+
"del"
|
|
821
|
+
]);
|
|
822
|
+
//#endregion
|
|
823
|
+
export { ee as CHANGE_BINDINGS, U as ChangeDetail, F as Changes, K as CodeMap, Z as CodeMapComposition, re as DIFF_LINE_KINDS, Q as DefaultMapLegend, te as EDGE_VIOLATION_KINDS, ne as FILE_CHANGE_STATUSES, a as GRAPH_APP_SECTIONS, n as GraphAppShell, r as GraphSectionNav, $ as MAP_NODE_KINDS, N as buildChangesGraph, q as codeMapPayloadToMapData, M as humanizeAge };
|