dsh-ui-tweaks 0.10.0 → 0.10.2

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/lib/client.js CHANGED
@@ -224,6 +224,8 @@ __modules["./gitbar.js"] = function(module, exports, require, __load_) {
224
224
  Object.defineProperty(exports, "__esModule", { value: true });
225
225
  exports.GITBAR_CSS = void 0;
226
226
  exports.installGitBarStyles = installGitBarStyles;
227
+ exports.warmGitStatus = warmGitStatus;
228
+ exports.GitWarmup = GitWarmup;
227
229
  exports.BranchChipEntry = BranchChipEntry;
228
230
  exports.DiffPanel = DiffPanel;
229
231
  exports.TerminalPanel = TerminalPanel;
@@ -518,7 +520,10 @@ exports.GITBAR_CSS = `
518
520
  .gbar-side{
519
521
  position:fixed;right:0;top:0;bottom:0;z-index:80;
520
522
  display:flex;flex-direction:column;overflow:hidden;
521
- background:var(--dsw-alias-bg-layer-1);
523
+ /* bg-base instead of bg-layer-1: in dark mode layer-1 (#232324) reads gray
524
+ next to the conversation's base (#151517); base matches it exactly, and in
525
+ light mode both aliases are #fff so nothing changes. */
526
+ background:var(--dsw-alias-bg-base);
522
527
  border-left:1px solid var(--dsw-alias-border-l2);
523
528
  box-shadow:var(--dsw-shadow-lv2);
524
529
  animation:gbar-in .18s cubic-bezier(.32,.72,0,1);
@@ -881,6 +886,44 @@ function statusClass(status) {
881
886
  * panel paint instantly instead of waiting for its own /status round-trip.
882
887
  */
883
888
  const snapshotCache = new Map();
889
+ // A localStorage mirror of this cache existed briefly and was retired; sweep
890
+ // away any copy an older build left behind in this browser.
891
+ try {
892
+ window.localStorage.removeItem('dsh-ui-tweaks.git.snapshots.v1');
893
+ }
894
+ catch { /* storage unavailable */ }
895
+ /** In-flight warmups keyed by target, so the dock warmup and a mounting chip
896
+ * never double-fetch the same target. */
897
+ const warmInflight = new Map();
898
+ /**
899
+ * Fetch a target's status into the shared cache WITHOUT rendering anything.
900
+ *
901
+ * The session-header chips mount only after the conversation projection
902
+ * finishes loading — seconds on large inactive sessions — so their own fetch
903
+ * would start just as late. This warmup runs from the input dock, which mounts
904
+ * immediately on session switch: by the time the header chip appears it reads
905
+ * a warm cache and paints folder+branch instantly.
906
+ */
907
+ function warmGitStatus(target) {
908
+ const key = target.session ?? target.ws ?? '';
909
+ if (key === '' || snapshotCache.has(key) || warmInflight.has(key))
910
+ return;
911
+ const flight = apiGet(`${GIT_ROUTE}/status?${targetQuery(target)}`)
912
+ .then(next => { snapshotCache.set(key, next); })
913
+ .catch(() => {
914
+ // Warmup is best-effort; the mounting chip re-fetches anyway.
915
+ })
916
+ .finally(() => { warmInflight.delete(key); });
917
+ warmInflight.set(key, flight);
918
+ }
919
+ /** Input-dock seat for {@link warmGitStatus}: mounts immediately on session
920
+ * switch (long before the session header does) and kicks off the prefetch. */
921
+ function GitWarmup({ sessionId }) {
922
+ (0, react_1.useEffect)(() => {
923
+ warmGitStatus({ session: String(sessionId) });
924
+ }, [sessionId]);
925
+ return null;
926
+ }
884
927
  /** Load the git snapshot on session change, then poll; returns [snapshot, refresh]. */
885
928
  function useGitStatus(enabled, target) {
886
929
  const key = target.session ?? target.ws ?? '';
@@ -931,11 +974,17 @@ function useGitStatus(enabled, target) {
931
974
  }, [target.session, target.ws]);
932
975
  return [snapshot, refresh];
933
976
  }
934
- function BranchChipEntry({ sessionId, controller, t }) {
977
+ function BranchChipEntry({ sessionId, sessionsService, controller, t }) {
935
978
  const settingsState = (0, react_1.useSyncExternalStore)(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
936
979
  const enabled = settingsState.value?.gitBarEnabled ?? true;
937
980
  const sessionStr = String(sessionId);
938
981
  const target = { session: sessionStr };
982
+ // Folder straight off the live sessions list feed (the same rows the left
983
+ // sidebar shows) — zero network, correct from the very first paint even
984
+ // before /status answers.
985
+ const list = sessionsService.list;
986
+ const subscribeList = (0, react_1.useMemo)(() => list.subscribe.bind(list), [list]);
987
+ const feedCwd = (0, react_1.useSyncExternalStore)(subscribeList, () => list.getSnapshot().byId[sessionId]?.cwd, () => undefined);
939
988
  const [snapshot, refresh] = useGitStatus(enabled, target);
940
989
  const [branchOpen, setBranchOpen] = (0, react_1.useState)(false);
941
990
  const [branches, setBranches] = (0, react_1.useState)(null);
@@ -1107,10 +1156,19 @@ function BranchChipEntry({ sessionId, controller, t }) {
1107
1156
  }, [branchOpen]);
1108
1157
  if (!enabled || sessionStr === undefined)
1109
1158
  return null;
1110
- if (snapshot === null || !snapshot.isRepo)
1159
+ if (snapshot !== null && !snapshot.isRepo)
1111
1160
  return null;
1161
+ // While the first /status round-trip is in flight, paint the folder alone
1162
+ // straight off the sessions-list feed (the sidebar's own rows — zero
1163
+ // network) so the seat never sits empty; the branch capsule joins the
1164
+ // moment the usually-pre-warmed snapshot lands.
1165
+ if (snapshot === null) {
1166
+ if (feedCwd === undefined || feedCwd === '')
1167
+ return null;
1168
+ return ((0, jsx_runtime_1.jsx)("span", { className: "gbar", "data-slot-plugin": "dsh-ui-tweaks-gitbar", children: (0, jsx_runtime_1.jsxs)("span", { className: "gbar-fchip", title: feedCwd, children: [(0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z" }) }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-folder", children: basenameOf(feedCwd) })] }) }));
1169
+ }
1112
1170
  const dirty = !snapshot.clean;
1113
- return ((0, jsx_runtime_1.jsxs)("span", { className: "gbar", "data-slot-plugin": "dsh-ui-tweaks-gitbar", children: [(0, jsx_runtime_1.jsxs)("span", { className: "gbar-fchip", title: snapshot.cwd, children: [(0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z" }) }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-folder", children: basenameOf(snapshot.cwd) })] }), (0, jsx_runtime_1.jsxs)("span", { className: "gbar-bwrap", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", ref: branchRef, className: 'gbar-chip' + (branchOpen ? ' gbar-open' : ''), onClick: toggleBranch, title: dirty ? t('dirty') : t('clean'), "aria-expanded": branchOpen, children: [(0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "3.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "12.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "5.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.5 5.3v5.4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 7.3c0 3-3.5 4.8-7.5 3.4" })] }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-bname", children: snapshot.branch ?? snapshot.detachedHead ?? '—' })] }), branchOpen ? ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-pop", role: "menu", "aria-label": snapshot.branch ?? 'git', ref: branchPopRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-pop-head", children: [(0, jsx_runtime_1.jsxs)("span", { className: "gbar-curname", title: dirty ? t('dirty') : t('clean'), children: [(0, jsx_runtime_1.jsxs)("svg", { className: "gbar-bicon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "3.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "12.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "5.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.5 5.3v5.4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 7.3c0 3-3.5 4.8-7.5 3.4" })] }), (0, jsx_runtime_1.jsx)("span", { children: snapshot.branch ?? snapshot.detachedHead ?? '—' })] }), (0, jsx_runtime_1.jsxs)("span", { className: "gbar-state", children: [(0, jsx_runtime_1.jsx)("span", { className: 'gbar-dot ' + (dirty ? 'gbar-dirty' : 'gbar-clean'), "aria-hidden": true }), snapshot.ahead > 0 ? (0, jsx_runtime_1.jsxs)("span", { children: ["\u2191", snapshot.ahead] }) : null, snapshot.behind > 0 ? (0, jsx_runtime_1.jsxs)("span", { children: ["\u2193", snapshot.behind] }) : null] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-pop-body", children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-sec", children: [t('branchLocal'), branches !== null ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-count", children: branches.local.length }) : null] }), branches === null ? ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-loading", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-spin" }), t('loading')] })) : branches.local.map(name => ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-rowwrap", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: 'gbar-row' + (name === branches.current ? ' gbar-cur' : ''), onClick: () => { pickBranch(name); }, children: [(0, jsx_runtime_1.jsxs)("svg", { className: "gbar-bicon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "3.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "12.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.5 5.3v5.4" }), (0, jsx_runtime_1.jsx)("path", { d: "M11.5 3.7v3a2.6 2.6 0 0 1-2.6 2.6H4.5" })] }), (0, jsx_runtime_1.jsx)("span", { children: name }), name === branches.current ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-check", "aria-hidden": true, children: "\u2713" }) : null] }), name !== branches.current && !isProtectedBranch(name) ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: 'gbar-del' + (confirmDelete === name ? ' gbar-arm' : ''), onClick: () => { deleteBranch(name); }, title: t('branchDelete'), children: confirmDelete === name ? t('branchDeleteConfirm') : ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.5 4.5h11" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2" }), (0, jsx_runtime_1.jsx)("path", { d: "M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2" })] })) })) : null] }, name))), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-sec", children: [t('branchRemote'), branches !== null ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-count", children: branches.remote.length }) : null] }), branches?.remote.map(name => ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-rowwrap", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: 'gbar-row' + (name === branches.current ? ' gbar-cur' : ''), onClick: () => { pickBranch(name); }, children: [(0, jsx_runtime_1.jsx)("svg", { className: "gbar-bicon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M5.2 13a3.2 3.2 0 1 1 .5-6.36 4 4 0 0 1 7.75 1.06 2.65 2.65 0 0 1-.55 5.3H5.2Z" }) }), (0, jsx_runtime_1.jsx)("span", { children: shortBranch(name) }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-rm", children: name.split('/')[0] })] }), !isProtectedBranch(shortBranch(name)) ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: 'gbar-del' + (confirmDelete === name ? ' gbar-arm' : ''), onClick: () => { deleteRemoteBranch(name); }, title: t('branchRemoteDelete'), children: confirmDelete === name ? t('branchDeleteConfirm') : ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.5 4.5h11" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2" }), (0, jsx_runtime_1.jsx)("path", { d: "M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2" })] })) })) : null] }, name)))] }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-actions", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: "gbar-act", onClick: openNewBranch, children: [(0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M7.4 2.6a1.2 1.2 0 1 1 2.2 0l3.2 1.6a1.2 1.2 0 1 1-1.1 2.1l-2.3-1.2a2.6 2.6 0 0 1-1.1.8l.6 4.2a1.2 1.2 0 1 1-1.7.2l-.6-4.2a2.6 2.6 0 0 1-1.2-.7l-2.9 1.5a1.2 1.2 0 1 1-1.1-2.1l2.9-1.5a2.6 2.6 0 0 1 .2-1.5l-3.2-1.6a1.2 1.2 0 1 1 1.1-2.1z" }) }), t('branchNew')] }), (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "gbar-act", onClick: openGraph, children: [(0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M3 1.5v3.4a4.4 4.4 0 0 0 4.4 4.4h5.1" }), (0, jsx_runtime_1.jsx)("path", { d: "M13 1.5v4.9a3.2 3.2 0 0 1-3.2 3.2H3" }), (0, jsx_runtime_1.jsx)("circle", { cx: "3", cy: "1.5", r: "1.2", fill: "currentColor", stroke: "none" }), (0, jsx_runtime_1.jsx)("circle", { cx: "13", cy: "12", r: "1.2", fill: "currentColor", stroke: "none" })] }), t('branchGraph')] })] })] })) : null] }), newBranchOpen ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: "gbar-modal-wrap", onMouseDown: event => { if (event.target === event.currentTarget)
1171
+ return ((0, jsx_runtime_1.jsxs)("span", { className: "gbar", "data-slot-plugin": "dsh-ui-tweaks-gitbar", children: [(0, jsx_runtime_1.jsxs)("span", { className: "gbar-fchip", title: feedCwd ?? snapshot.cwd, children: [(0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M1.5 4A1.5 1.5 0 0 1 3 2.5h3l1.5 2H13A1.5 1.5 0 0 1 14.5 6v6A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V4Z" }) }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-folder", children: basenameOf(feedCwd ?? snapshot.cwd) })] }), (0, jsx_runtime_1.jsxs)("span", { className: "gbar-bwrap", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", ref: branchRef, className: 'gbar-chip' + (branchOpen ? ' gbar-open' : ''), onClick: toggleBranch, title: dirty ? t('dirty') : t('clean'), "aria-expanded": branchOpen, children: [(0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "3.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "12.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "5.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.5 5.3v5.4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 7.3c0 3-3.5 4.8-7.5 3.4" })] }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-bname", children: snapshot.branch ?? snapshot.detachedHead ?? '—' })] }), branchOpen ? ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-pop", role: "menu", "aria-label": snapshot.branch ?? 'git', ref: branchPopRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-pop-head", children: [(0, jsx_runtime_1.jsxs)("span", { className: "gbar-curname", title: dirty ? t('dirty') : t('clean'), children: [(0, jsx_runtime_1.jsxs)("svg", { className: "gbar-bicon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "3.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "12.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "5.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.5 5.3v5.4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 7.3c0 3-3.5 4.8-7.5 3.4" })] }), (0, jsx_runtime_1.jsx)("span", { children: snapshot.branch ?? snapshot.detachedHead ?? '—' })] }), (0, jsx_runtime_1.jsxs)("span", { className: "gbar-state", children: [(0, jsx_runtime_1.jsx)("span", { className: 'gbar-dot ' + (dirty ? 'gbar-dirty' : 'gbar-clean'), "aria-hidden": true }), snapshot.ahead > 0 ? (0, jsx_runtime_1.jsxs)("span", { children: ["\u2191", snapshot.ahead] }) : null, snapshot.behind > 0 ? (0, jsx_runtime_1.jsxs)("span", { children: ["\u2193", snapshot.behind] }) : null] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-pop-body", children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-sec", children: [t('branchLocal'), branches !== null ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-count", children: branches.local.length }) : null] }), branches === null ? ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-loading", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-spin" }), t('loading')] })) : branches.local.map(name => ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-rowwrap", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: 'gbar-row' + (name === branches.current ? ' gbar-cur' : ''), onClick: () => { pickBranch(name); }, children: [(0, jsx_runtime_1.jsxs)("svg", { className: "gbar-bicon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "3.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("circle", { cx: "4.5", cy: "12.5", r: "1.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M4.5 5.3v5.4" }), (0, jsx_runtime_1.jsx)("path", { d: "M11.5 3.7v3a2.6 2.6 0 0 1-2.6 2.6H4.5" })] }), (0, jsx_runtime_1.jsx)("span", { children: name }), name === branches.current ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-check", "aria-hidden": true, children: "\u2713" }) : null] }), name !== branches.current && !isProtectedBranch(name) ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: 'gbar-del' + (confirmDelete === name ? ' gbar-arm' : ''), onClick: () => { deleteBranch(name); }, title: t('branchDelete'), children: confirmDelete === name ? t('branchDeleteConfirm') : ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.5 4.5h11" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2" }), (0, jsx_runtime_1.jsx)("path", { d: "M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2" })] })) })) : null] }, name))), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-sec", children: [t('branchRemote'), branches !== null ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-count", children: branches.remote.length }) : null] }), branches?.remote.map(name => ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-rowwrap", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: 'gbar-row' + (name === branches.current ? ' gbar-cur' : ''), onClick: () => { pickBranch(name); }, children: [(0, jsx_runtime_1.jsx)("svg", { className: "gbar-bicon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M5.2 13a3.2 3.2 0 1 1 .5-6.36 4 4 0 0 1 7.75 1.06 2.65 2.65 0 0 1-.55 5.3H5.2Z" }) }), (0, jsx_runtime_1.jsx)("span", { children: shortBranch(name) }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-rm", children: name.split('/')[0] })] }), !isProtectedBranch(shortBranch(name)) ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: 'gbar-del' + (confirmDelete === name ? ' gbar-arm' : ''), onClick: () => { deleteRemoteBranch(name); }, title: t('branchRemoteDelete'), children: confirmDelete === name ? t('branchDeleteConfirm') : ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.5 4.5h11" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.5 4.5V3.3c0-.44.36-.8.8-.8h3.4c.44 0 .8.36.8.8v1.2" }), (0, jsx_runtime_1.jsx)("path", { d: "M4 4.5l.6 8.2c.04.5.45.8.95.8h4.9c.5 0 .91-.3.95-.8l.6-8.2" })] })) })) : null] }, name)))] }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-actions", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: "gbar-act", onClick: openNewBranch, children: [(0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true, children: (0, jsx_runtime_1.jsx)("path", { d: "M7.4 2.6a1.2 1.2 0 1 1 2.2 0l3.2 1.6a1.2 1.2 0 1 1-1.1 2.1l-2.3-1.2a2.6 2.6 0 0 1-1.1.8l.6 4.2a1.2 1.2 0 1 1-1.7.2l-.6-4.2a2.6 2.6 0 0 1-1.2-.7l-2.9 1.5a1.2 1.2 0 1 1-1.1-2.1l2.9-1.5a2.6 2.6 0 0 1 .2-1.5l-3.2-1.6a1.2 1.2 0 1 1 1.1-2.1z" }) }), t('branchNew')] }), (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "gbar-act", onClick: openGraph, children: [(0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M3 1.5v3.4a4.4 4.4 0 0 0 4.4 4.4h5.1" }), (0, jsx_runtime_1.jsx)("path", { d: "M13 1.5v4.9a3.2 3.2 0 0 1-3.2 3.2H3" }), (0, jsx_runtime_1.jsx)("circle", { cx: "3", cy: "1.5", r: "1.2", fill: "currentColor", stroke: "none" }), (0, jsx_runtime_1.jsx)("circle", { cx: "13", cy: "12", r: "1.2", fill: "currentColor", stroke: "none" })] }), t('branchGraph')] })] })] })) : null] }), newBranchOpen ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: "gbar-modal-wrap", onMouseDown: event => { if (event.target === event.currentTarget)
1114
1172
  setNewBranchOpen(false); }, children: (0, jsx_runtime_1.jsxs)("div", { className: "gbar-modal", role: "dialog", "aria-label": t('branchNew'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-head", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-title", children: t('branchNew') }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-branch", children: snapshot.branch ?? snapshot.detachedHead ?? '—' }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "gbar-x", onClick: () => { setNewBranchOpen(false); }, "aria-label": "\u2715", children: "\u2715" })] }), (0, jsx_runtime_1.jsx)("input", { value: newBranchName, onChange: event => { setNewBranchName(event.target.value); }, onKeyDown: event => { if (event.key === 'Enter')
1115
1173
  createBranch(); }, placeholder: t('branchNewPlaceholder'), "aria-label": t('branchNew'), autoFocus: true }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-baserow", children: [(0, jsx_runtime_1.jsx)("label", { className: "gbar-baselabel", htmlFor: "gbar-base-dlg", children: t('branchFrom') }), (0, jsx_runtime_1.jsxs)("select", { id: "gbar-base-dlg", className: "gbar-base", value: baseBranch, onChange: event => { setBaseBranch(event.target.value); }, "aria-label": t('branchFrom'), children: [(0, jsx_runtime_1.jsx)("option", { value: "", children: t('branchFromHead') }), branches?.local.map(name => (0, jsx_runtime_1.jsx)("option", { value: name, children: name }, name)), branches?.remote.map(name => (0, jsx_runtime_1.jsx)("option", { value: name, children: name }, name))] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-pushrow", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: 'gbar-chk' + (pushToRemote ? '' : ' gbar-off'), onClick: () => { setPushToRemote(value => !value); }, "aria-label": t('branchPushRemote'), children: pushToRemote ? '✓' : '✕' }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-pushlabel", children: t('branchPushRemote') })] }), (0, jsx_runtime_1.jsxs)("div", { className: "gbar-foot", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "gbar-btn gbar-ghost", onClick: () => { setNewBranchOpen(false); }, children: t('branchCancel') }), (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "gbar-btn gbar-primary", onClick: createBranch, disabled: busy !== null || newBranchName.trim() === '', children: [busy === 'create' || busy === 'create-push' ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-spin" }) : null, " ", t('branchCreate')] })] })] }) }), document.body) : null, graphOpen ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: "gbar-modal-wrap", onMouseDown: event => { if (event.target === event.currentTarget)
1116
1174
  setGraphOpen(false); }, children: (0, jsx_runtime_1.jsxs)("div", { className: "gbar-modal gbar-graph-modal", role: "dialog", "aria-label": t('graphTitle'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-head", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-title", children: t('graphTitle') }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-branch", children: snapshot.branch ?? snapshot.detachedHead ?? '—' }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-spacer" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "gbar-x gbar-refresh", onClick: fetchGraph, "aria-label": t('branchRefresh'), title: t('branchRefresh'), disabled: graphBusy, children: graphBusy ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-spin" }) : ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [(0, jsx_runtime_1.jsx)("path", { d: "M13.4 8a5.4 5.4 0 1 1-1.6-3.8" }), (0, jsx_runtime_1.jsx)("path", { d: "M13.4 1.5v3h-3" })] })) }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "gbar-x", onClick: () => { setGraphOpen(false); }, "aria-label": "\u2715", children: "\u2715" })] }), graph === null ? ((0, jsx_runtime_1.jsx)("div", { className: "gbar-graph-empty", children: graphBusy ? t('loading') : t('noChanges') })) : graph.commits.length === 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "gbar-graph-empty", children: t('noChanges') })) : ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-graph-table", role: "table", "aria-label": t('graphTitle'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "gbar-graph-row gbar-graph-head", role: "row", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-c-hash", role: "columnheader", children: t('graphColCommit') }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-c-subject", role: "columnheader", children: t('graphColSubject') }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-c-author", role: "columnheader", children: t('graphColAuthor') }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-c-date", role: "columnheader", children: t('graphColDate') })] }), graph.commits.map(commit => ((0, jsx_runtime_1.jsxs)("div", { className: "gbar-graph-row", role: "row", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-c-hash", role: "cell", children: (0, jsx_runtime_1.jsx)("code", { className: "gbar-hash", children: commit.hash }) }), (0, jsx_runtime_1.jsxs)("span", { className: "gbar-c-subject", role: "cell", children: [(0, jsx_runtime_1.jsx)("span", { className: "gbar-subject", children: commit.subject }), commit.refs !== '' ? (0, jsx_runtime_1.jsx)("span", { className: "gbar-refs", children: commit.refs }) : null] }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-c-author", role: "cell", children: commit.author }), (0, jsx_runtime_1.jsx)("span", { className: "gbar-c-date", role: "cell", title: commit.date, children: commit.dateRelative })] }, commit.fullHash)))] }))] }) }), document.body) : null, notice !== null ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: 'gbar-notice gbar-' + notice.kind, role: "status", children: notice.text }), document.body) : null] }));
@@ -3023,8 +3081,19 @@ function apply(ctx) {
3023
3081
  id: 'gitbar-branch',
3024
3082
  order: 10,
3025
3083
  locale: NS,
3026
- inject: () => ({ controller }),
3084
+ inject: () => ({ controller, sessionsService: ctx.sessions }),
3027
3085
  }, gitbar_tsx_1.BranchChipEntry));
3086
+ // Warmup: the header chips mount only after the conversation projection
3087
+ // finishes loading (seconds on large inactive sessions). The input dock
3088
+ // mounts immediately on session switch, so a null-rendering seat there
3089
+ // prefetches the status into the shared cache right away — the chips then
3090
+ // paint folder+branch from the warm cache the moment they appear.
3091
+ ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({
3092
+ name: 'conversation.input.dock',
3093
+ id: 'gitbar-warmup',
3094
+ order: 41,
3095
+ inject: () => ({}),
3096
+ }, gitbar_tsx_1.GitWarmup));
3028
3097
  ctx.slots.inject('conversation.session.header.utilities', () => ctx.slots.register({
3029
3098
  name: 'conversation.session.header.utilities',
3030
3099
  id: 'gitbar-utils',