dsh-islands-ui 1.2.0 → 1.2.1
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/CHANGELOG.md +8 -0
- package/client.js +145 -46
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.1 — 2026-11-16
|
|
4
|
+
|
|
5
|
+
### 修复
|
|
6
|
+
|
|
7
|
+
- 置顶会话的「定位」不再误触工作区菜单:旧逻辑在工作区行内查找 `[aria-expanded]`,命中的是 hover 才显示的「⋯」菜单触发器(隐藏时矩形为 0,0),于是工作区菜单在左上角弹出、分组没有展开,会话也无法定位。现在直接点击工作区行本身展开,并按 `data-row-key` 精确匹配会话行,不再依赖标题文本。
|
|
8
|
+
- 定位会同时切换到该会话:先 `openSession`,再展开、滚动与高亮,侧栏选中态和对话区保持一致;即使会话行因归档或筛选不可见,也会完成切换。
|
|
9
|
+
- 定位支持嵌套工作区与每组默认只渲染少量会话的 overflow:按需展开祖先分组、必要时展开「显示更多」,定位结束后恢复无关分组的折叠状态。会话行由宿主 HoverCard 包裹,分组归属按 `role=group` / `role=tree` 层级判断。
|
|
10
|
+
|
|
3
11
|
## 1.2.0 — 2026-11-16
|
|
4
12
|
|
|
5
13
|
### 界面
|
package/client.js
CHANGED
|
@@ -1863,53 +1863,143 @@ function uninstallCaretController() {
|
|
|
1863
1863
|
return h(PinGlyph);
|
|
1864
1864
|
}
|
|
1865
1865
|
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
const stateOf = (row) =>
|
|
1869
|
-
row.getAttribute('aria-expanded') ??
|
|
1870
|
-
row.querySelector('[aria-expanded]')?.getAttribute('aria-expanded');
|
|
1871
|
-
const expanded = (row) => stateOf(row) === 'true';
|
|
1872
|
-
const toggle = (row) => {
|
|
1873
|
-
const chevron = row.querySelector('[aria-expanded]');
|
|
1874
|
-
if (chevron instanceof HTMLElement) chevron.click();
|
|
1875
|
-
else row.click();
|
|
1876
|
-
};
|
|
1866
|
+
/** A second click while the list is still opening must not race the first. */
|
|
1867
|
+
let locating = false;
|
|
1877
1868
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1869
|
+
/**
|
|
1870
|
+
* Escape a value for a quoted attribute selector. Row keys are ids, but a
|
|
1871
|
+
* session id never gets concatenated into a selector without this.
|
|
1872
|
+
*/
|
|
1873
|
+
function rowKeyValue(value) {
|
|
1874
|
+
return String(value).replaceAll('\\', '\\\\').replaceAll('"', '\\"');
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/** One paint, with a timer fallback for a background window. */
|
|
1878
|
+
function nextFrame() {
|
|
1879
|
+
return new Promise((resolve) => {
|
|
1880
|
+
let settled = false;
|
|
1881
|
+
const done = () => {
|
|
1882
|
+
if (settled) return;
|
|
1883
|
+
settled = true;
|
|
1884
|
+
resolve();
|
|
1885
|
+
};
|
|
1886
|
+
requestAnimationFrame(done);
|
|
1887
|
+
window.setTimeout(done, 120);
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1882
1890
|
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1891
|
+
/**
|
|
1892
|
+
* Reveal a pinned session in the workspace list.
|
|
1893
|
+
*
|
|
1894
|
+
* The Workspace row is the host's `treeitem` and toggles on a plain click,
|
|
1895
|
+
* but its descendants also carry `aria-expanded`: the "..." context-menu
|
|
1896
|
+
* trigger and the overflow button. Expanding through a descendant lookup
|
|
1897
|
+
* therefore clicked the menu trigger, opened the Workspace menu at the
|
|
1898
|
+
* viewport origin (the row actions are hidden until hover, so the trigger
|
|
1899
|
+
* has no rect) and left the group collapsed. Match the session by its row
|
|
1900
|
+
* key instead of by title, and toggle the row itself.
|
|
1901
|
+
*/
|
|
1902
|
+
async function revealPinnedSession(sessionId, workspaceId) {
|
|
1903
|
+
if (locating) return;
|
|
1904
|
+
locating = true;
|
|
1905
|
+
try {
|
|
1906
|
+
const sessionSelector = `[data-row-key="session:${rowKeyValue(sessionId)}"]`;
|
|
1907
|
+
const findSession = () => document.querySelector(sessionSelector);
|
|
1908
|
+
const projectRows = () => [...document.querySelectorAll(HOST.WORKSPACE_ROW)];
|
|
1909
|
+
const expanded = (row) => row.getAttribute('aria-expanded') === 'true';
|
|
1910
|
+
const rowKey = (row) => row.getAttribute('data-row-key');
|
|
1911
|
+
const findWorkspace = (id) =>
|
|
1912
|
+
document.querySelector(`[data-row-key="workspace:${rowKeyValue(id)}"]`);
|
|
1913
|
+
// HoverCard wraps both Workspace and session anchors in a span, so a
|
|
1914
|
+
// row's parent is not its group section. A section is the child of the
|
|
1915
|
+
// tree itself or of an enclosing role=group.
|
|
1916
|
+
const sectionOf = (row) => {
|
|
1917
|
+
let node = row.parentElement;
|
|
1918
|
+
while (node !== null) {
|
|
1919
|
+
const parent = node.parentElement;
|
|
1920
|
+
if (parent === null) return null;
|
|
1921
|
+
const role = parent.getAttribute('role');
|
|
1922
|
+
if (role === 'group' || role === 'tree') return node;
|
|
1923
|
+
node = parent;
|
|
1924
|
+
}
|
|
1925
|
+
return null;
|
|
1926
|
+
};
|
|
1889
1927
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1928
|
+
let row = findSession();
|
|
1929
|
+
const reopened = new Set();
|
|
1930
|
+
|
|
1931
|
+
// Expand collapsed Workspaces until the target mounts. A single pass
|
|
1932
|
+
// is not enough: opening a nested Workspace mounts its children
|
|
1933
|
+
// collapsed, and those children need their own click.
|
|
1934
|
+
for (let pass = 0; row === null && pass < 16; pass += 1) {
|
|
1935
|
+
const collapsed = projectRows().filter((project) => !expanded(project));
|
|
1936
|
+
if (collapsed.length === 0) break;
|
|
1937
|
+
for (const project of collapsed) {
|
|
1938
|
+
if (!project.isConnected || expanded(project)) continue;
|
|
1939
|
+
project.click();
|
|
1940
|
+
reopened.add(rowKey(project));
|
|
1941
|
+
}
|
|
1942
|
+
await nextFrame();
|
|
1943
|
+
row = findSession();
|
|
1894
1944
|
}
|
|
1895
1945
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1946
|
+
// The host only paints a small window of sessions per group. The
|
|
1947
|
+
// target is normally pinned to the front, but when it sits behind the
|
|
1948
|
+
// overflow button, raise that group's watermark until the row exists.
|
|
1949
|
+
for (let step = 0; row === null && step < 10; step += 1) {
|
|
1950
|
+
const owner = workspaceId === undefined ? null : findWorkspace(workspaceId);
|
|
1951
|
+
const section = owner === null ? null : sectionOf(owner);
|
|
1952
|
+
const overflow =
|
|
1953
|
+
section?.querySelector(':scope > [data-row-key^="overflow:"]') ??
|
|
1954
|
+
(workspaceId === undefined
|
|
1955
|
+
? document.querySelector('[data-row-key="overflow:"]')
|
|
1956
|
+
: null);
|
|
1957
|
+
if (!(overflow instanceof HTMLElement)) break;
|
|
1958
|
+
overflow.click();
|
|
1959
|
+
await nextFrame();
|
|
1960
|
+
row = findSession();
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
// The owning Workspace is the project row in the same group section;
|
|
1964
|
+
// nested ancestors are the project rows above each enclosing
|
|
1965
|
+
// role=group. Keep them open after undoing the temporary expansion.
|
|
1966
|
+
const keep = new Set();
|
|
1967
|
+
if (row !== null) {
|
|
1968
|
+
let section = sectionOf(row);
|
|
1969
|
+
let owner = section?.querySelector(HOST.WORKSPACE_ROW) ?? null;
|
|
1970
|
+
while (section !== null && owner !== null) {
|
|
1971
|
+
keep.add(rowKey(owner));
|
|
1972
|
+
const group = section.parentElement;
|
|
1973
|
+
if (!(group instanceof HTMLElement) || group.getAttribute('role') !== 'group') break;
|
|
1974
|
+
section = group.parentElement;
|
|
1975
|
+
owner = section instanceof HTMLElement ? section.querySelector(HOST.WORKSPACE_ROW) : null;
|
|
1902
1976
|
}
|
|
1903
1977
|
}
|
|
1904
1978
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1979
|
+
// Restore the groups this run opened only to make the target
|
|
1980
|
+
// reachable. Walk deepest first so a child's expansion state is
|
|
1981
|
+
// reverted before its parent unmounts it.
|
|
1982
|
+
for (const key of [...reopened].reverse()) {
|
|
1983
|
+
if (keep.has(key)) continue;
|
|
1984
|
+
const project = projectRows().find((candidate) => rowKey(candidate) === key);
|
|
1985
|
+
if (project !== undefined && project.isConnected && expanded(project)) project.click();
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
if (row === null) return;
|
|
1989
|
+
await nextFrame();
|
|
1990
|
+
|
|
1991
|
+
const target = findSession();
|
|
1992
|
+
if (!(target instanceof HTMLElement)) return;
|
|
1993
|
+
target.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
1994
|
+
if (!target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');
|
|
1995
|
+
target.focus({ preventScroll: true });
|
|
1996
|
+
target.classList.add('isl-located');
|
|
1997
|
+
window.setTimeout(() => target.classList.remove('isl-located'), 1400);
|
|
1998
|
+
} catch {
|
|
1999
|
+
/* The sidebar belongs to the host; a failed locate leaves it as it is. */
|
|
2000
|
+
} finally {
|
|
2001
|
+
locating = false;
|
|
2002
|
+
}
|
|
1913
2003
|
}
|
|
1914
2004
|
|
|
1915
2005
|
function PinGlyph() {
|
|
@@ -3086,7 +3176,7 @@ function uninstallCaretController() {
|
|
|
3086
3176
|
}
|
|
3087
3177
|
|
|
3088
3178
|
/** One pinned row: hover reveals unpin + locate, and a clipped title marquees. */
|
|
3089
|
-
function PinnedRow({ session, copy, pinIcon }) {
|
|
3179
|
+
function PinnedRow({ session, workspaceId, copy, pinIcon }) {
|
|
3090
3180
|
const titleRef = React.useRef(null);
|
|
3091
3181
|
const frameRef = React.useRef(0);
|
|
3092
3182
|
const revealingRef = React.useRef(false);
|
|
@@ -3180,7 +3270,10 @@ function uninstallCaretController() {
|
|
|
3180
3270
|
'aria-label': copy.locate,
|
|
3181
3271
|
onClick: (event) => {
|
|
3182
3272
|
event.stopPropagation();
|
|
3183
|
-
|
|
3273
|
+
// Locating also makes the session current. Open first so the
|
|
3274
|
+
// switch still happens when the list cannot show the row.
|
|
3275
|
+
uiWorkspaceService?.openSession(id);
|
|
3276
|
+
revealPinnedSession(id, workspaceId);
|
|
3184
3277
|
},
|
|
3185
3278
|
},
|
|
3186
3279
|
h(LocateGlyph),
|
|
@@ -3196,6 +3289,7 @@ function uninstallCaretController() {
|
|
|
3196
3289
|
function IslandsPinnedSection({ useWorkspaces, useSessions }) {
|
|
3197
3290
|
const pinnedIds = useWorkspaces((state) => state.pinnedSessionIds ?? []);
|
|
3198
3291
|
const sessions = useSessions((state) => state.byId ?? {});
|
|
3292
|
+
const workspaceItems = useWorkspaces((state) => state.items ?? []);
|
|
3199
3293
|
const [host, setHost] = React.useState(null);
|
|
3200
3294
|
const [collapsed, setCollapsed] = React.useState(() => {
|
|
3201
3295
|
try {
|
|
@@ -3276,14 +3370,19 @@ function uninstallCaretController() {
|
|
|
3276
3370
|
: h(
|
|
3277
3371
|
'div',
|
|
3278
3372
|
{ className: 'isl-pinnedList' },
|
|
3279
|
-
rows.map((session) =>
|
|
3280
|
-
|
|
3281
|
-
|
|
3373
|
+
rows.map((session) => {
|
|
3374
|
+
const id = session.id ?? session.sessionId;
|
|
3375
|
+
const owner = workspaceItems.find(
|
|
3376
|
+
(item) => Array.isArray(item?.sessionIds) && item.sessionIds.includes(id),
|
|
3377
|
+
);
|
|
3378
|
+
return h(PinnedRow, {
|
|
3379
|
+
key: id,
|
|
3282
3380
|
session,
|
|
3381
|
+
workspaceId: owner?.workspaceId,
|
|
3283
3382
|
copy,
|
|
3284
3383
|
pinIcon,
|
|
3285
|
-
})
|
|
3286
|
-
),
|
|
3384
|
+
});
|
|
3385
|
+
}),
|
|
3287
3386
|
),
|
|
3288
3387
|
),
|
|
3289
3388
|
host,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-islands-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Islands UI — a floating-island interface skin for DeepSeek Harness: rounded panels, a persistent left rail, a pinned-session shelf and an adjustable accent color.",
|
|
5
5
|
"icon": "./assets/icon-180.png",
|
|
6
6
|
"type": "module",
|