@william_jin/autobrowse 0.8.7 → 0.8.9
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/README.md +3 -1
- package/assets/live-view/hub.html +482 -38
- package/assets/overlay/bin/darwin-arm64/overlay-host +0 -0
- package/assets/overlay/bin/darwin-x64/overlay-host +0 -0
- package/assets/overlay/bin/win32-arm64/overlay-host.exe +0 -0
- package/assets/overlay/bin/win32-x64/overlay-host.exe +0 -0
- package/dist/app/cli-record.js +10 -0
- package/dist/app/cli-record.js.map +1 -1
- package/dist/browser/live-hub.d.ts +20 -5
- package/dist/browser/live-hub.js +61 -21
- package/dist/browser/live-hub.js.map +1 -1
- package/dist/browser/live-view.js +28 -2
- package/dist/browser/live-view.js.map +1 -1
- package/dist/explore/overlay-host.d.ts +7 -3
- package/dist/explore/overlay-host.js +64 -14
- package/dist/explore/overlay-host.js.map +1 -1
- package/dist/llms.txt +2 -1
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<!-- The live hub's page (designs/2026-11-25-live-view.md §Hub), served by `overlay-host hub` at abhub://localhost/.
|
|
7
7
|
A sidebar of sessions and panes; each pane is an iframe of its session's viewer. Talks only to the app (ipc). -->
|
|
8
8
|
<style>
|
|
9
|
-
:root{color-scheme:light;--accent:#6a5a93;--hair:color-mix(in srgb,var(--fg) 11%,transparent);--fill:color-mix(in srgb,var(--fg) 5%,transparent);--raise:0 0 0 1px var(--hair),0 1px 2px rgb(14 14 14/.04),0 4px 14px -6px rgb(40 30 70/.10);--bg:#ecebe8;--bar:#e3e2de;--side:#e7e6e2;--fg:#1d1d1b;--mut:#65635e;--rowh:color-mix(in srgb,var(--side),#000 5%);--rowon:color-mix(in srgb,var(--side),#000 8%);--line:rgba(0,0,0,.09);--needs:#fbefd2;--needsfg:#5c4307;--ring:var(--accent);--brand:var(--accent);--held:#8a5a00;--heldt:rgba(214,150,20,.17);--btn:rgba(0,0,0,.06);--btnh:rgba(0,0,0,.1);--seg:rgba(0,0,0,.06);--segon:#fbfbfa;--pane:#dcdbd7;--mkf:#fff;--mkt:#6b4ee6;--drop:color-mix(in srgb,var(--accent) 14%,transparent);--scrim:rgba(0,0,0,.3);--lift:0 12px 40px rgba(0,0,0,.25)}
|
|
10
|
-
:root[data-theme=dark],:root[data-look=dark]{color-scheme:dark;--accent:#a596d6;--raise:0 0 0 1px var(--hair),0 6px 18px -8px rgb(0 0 0/.6);--bg:#1c1c1b;--bar:#1f1f1e;--side:#212120;--fg:#ecebe6;--mut:#9b998f;--rowh:color-mix(in srgb,var(--side),#fff 5%);--rowon:color-mix(in srgb,var(--side),#fff 8%);--line:rgba(255,255,255,.08);--needs:#3e3216;--needsfg:#f3dfa8;--ring:var(--accent);--brand:var(--accent);--held:#f0c060;--heldt:rgba(240,192,96,.15);--btn:rgba(255,255,255,.07);--btnh:rgba(255,255,255,.12);--seg:rgba(255,255,255,.06);--segon:#3a3a38;--pane:#161615;--mkf:#16161a;--mkt:#a996ff;--drop:color-mix(in srgb,var(--accent) 16%,transparent);--scrim:rgba(0,0,0,.55)}
|
|
9
|
+
:root{color-scheme:light;--accent:#6a5a93;--hair:color-mix(in srgb,var(--fg) 11%,transparent);--fill:color-mix(in srgb,var(--fg) 5%,transparent);--raise:0 0 0 1px var(--hair),0 1px 2px rgb(14 14 14/.04),0 4px 14px -6px rgb(40 30 70/.10);--bg:#ecebe8;--bar:#e3e2de;--side:#e7e6e2;--fg:#1d1d1b;--mut:#65635e;--rowh:color-mix(in srgb,var(--side),#000 5%);--rowon:color-mix(in srgb,var(--side),#000 8%);--line:rgba(0,0,0,.09);--needs:#fbefd2;--needsfg:#5c4307;--needsbtn:rgba(0,0,0,.08);--ring:var(--accent);--brand:var(--accent);--held:#8a5a00;--heldt:rgba(214,150,20,.17);--btn:rgba(0,0,0,.06);--btnh:rgba(0,0,0,.1);--seg:rgba(0,0,0,.06);--segon:#fbfbfa;--pane:#dcdbd7;--mkf:#fff;--mkt:#6b4ee6;--drop:color-mix(in srgb,var(--accent) 14%,transparent);--scrim:rgba(0,0,0,.3);--lift:0 12px 40px rgba(0,0,0,.25)}
|
|
10
|
+
:root[data-theme=dark],:root[data-look=dark]{color-scheme:dark;--accent:#a596d6;--raise:0 0 0 1px var(--hair),0 6px 18px -8px rgb(0 0 0/.6);--bg:#1c1c1b;--bar:#1f1f1e;--side:#212120;--fg:#ecebe6;--mut:#9b998f;--rowh:color-mix(in srgb,var(--side),#fff 5%);--rowon:color-mix(in srgb,var(--side),#fff 8%);--line:rgba(255,255,255,.08);--needs:#3e3216;--needsfg:#f3dfa8;--needsbtn:rgba(0,0,0,.08);--ring:var(--accent);--brand:var(--accent);--held:#f0c060;--heldt:rgba(240,192,96,.15);--btn:rgba(255,255,255,.07);--btnh:rgba(255,255,255,.12);--seg:rgba(255,255,255,.06);--segon:#3a3a38;--pane:#161615;--mkf:#16161a;--mkt:#a996ff;--drop:color-mix(in srgb,var(--accent) 16%,transparent);--scrim:rgba(0,0,0,.55)}
|
|
11
11
|
*{box-sizing:border-box}
|
|
12
12
|
html,body{margin:0;height:100%;overflow:clip;background:var(--bg);color:var(--fg);font:13px/1.3 -apple-system,system-ui,sans-serif;-webkit-user-select:none;user-select:none;cursor:default}
|
|
13
13
|
button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:default}
|
|
@@ -19,7 +19,7 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
|
|
|
19
19
|
.nb{height:26px;min-width:26px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border-radius:7px;color:var(--mut);transition:background-color .15s,color .15s}
|
|
20
20
|
.nb:hover{background:var(--btnh);color:var(--fg)}
|
|
21
21
|
.nb.on{color:var(--fg)}
|
|
22
|
-
#seg{display:flex;margin:0;border:0;
|
|
22
|
+
#seg{display:flex;flex:none;margin:0;border:0;padding:2px;border-radius:8px;background:var(--seg)}
|
|
23
23
|
#seg button{height:22px;padding:0 9px;border-radius:6px;color:var(--mut);font-size:12px;font-weight:500;transition:background-color .15s,color .15s}
|
|
24
24
|
#seg button[aria-pressed=true]{background:var(--segon);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.12)}
|
|
25
25
|
#unmax{max-width:0;padding:0;opacity:0;overflow:hidden;white-space:nowrap;font-size:12px;font-weight:500;pointer-events:none;transition:max-width .15s cubic-bezier(.16,1,.3,1),padding .15s cubic-bezier(.16,1,.3,1),opacity .1s,background-color .15s,color .15s}
|
|
@@ -28,10 +28,20 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
|
|
|
28
28
|
/* sizer: the longer label, never seen */
|
|
29
29
|
#pauseall::after{content:"Resume all";height:0;overflow:hidden;visibility:hidden}
|
|
30
30
|
#pauseall:disabled{opacity:.4}
|
|
31
|
+
/* 390: traffic lights + all controls fit */
|
|
32
|
+
@media (max-width:759px){#top{gap:4px}#seg button{padding:0 7px}#pauseall{padding:0 8px}}
|
|
31
33
|
#main{position:absolute;inset:38px 0 0 0;display:flex}
|
|
32
|
-
#
|
|
33
|
-
|
|
34
|
-
#
|
|
34
|
+
#list{position:relative;list-style:none;margin:0;flex:1;overflow-y:auto;padding:2px 6px 44px;scrollbar-width:thin}
|
|
35
|
+
/* §Sidebar collapse: #side holds the room in the layout (full, rail or none); #sidein is the panel, --sidew wide, clipped to that room. The flyout unclips it over the stage, so the stage never resizes */
|
|
36
|
+
#side{position:relative;z-index:3;flex:none;width:var(--sidew,248px);background:var(--side);transition:width .2s cubic-bezier(.16,1,.3,1)}
|
|
37
|
+
.m-rail #side{width:52px}
|
|
38
|
+
.m-hidden #side{width:0}
|
|
39
|
+
#sidein{position:absolute;inset:0 auto 0 0;width:var(--sidew,248px);display:flex;flex-direction:column;background:var(--side);overflow:hidden;clip-path:inset(0 0 0 0);transition:clip-path .2s cubic-bezier(.16,1,.3,1),box-shadow .2s cubic-bezier(.16,1,.3,1)}
|
|
40
|
+
.m-rail #sidein{clip-path:inset(0 calc(100% - 52px) 0 0)}
|
|
41
|
+
.m-hidden #sidein{clip-path:inset(0 100% 0 0);pointer-events:none}
|
|
42
|
+
/* the flyout: unclipped, room on the right for its shadow */
|
|
43
|
+
.m-rail.peek #sidein{clip-path:inset(0 -60px 0 0);box-shadow:0 0 0 1px var(--hair),var(--lift);transition-duration:.18s}
|
|
44
|
+
.unpeek #side #sidein{transition-duration:.15s}
|
|
35
45
|
/* a leaving row or label: out of the flow, fading, while the rest slide up */
|
|
36
46
|
#list>.gone{position:absolute;left:6px;right:6px;opacity:0;pointer-events:none;transition:opacity .15s}
|
|
37
47
|
.sec{position:sticky;top:0;z-index:1;background:var(--side);transition:opacity .15s,transform .2s cubic-bezier(.16,1,.3,1)}
|
|
@@ -72,7 +82,7 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
|
|
|
72
82
|
@keyframes breathe-badge{50%{background:color-mix(in srgb,var(--brand) 35%,var(--rowbg))}}
|
|
73
83
|
.sec:first-child .sh{padding-top:6px}
|
|
74
84
|
.row .site{grid-column:2;font-weight:600;min-width:0;overflow-wrap:break-word;line-height:18px}
|
|
75
|
-
.row .meta{grid-column:2/-1;color:var(--mut);font-size:12px;display:flex;gap:5px;align-items:center;min-width:0;white-space:nowrap}
|
|
85
|
+
.row .meta{grid-column:2/-1;color:var(--mut);font-size:12px;display:flex;flex-wrap:wrap;gap:0 5px;align-items:center;min-width:0;white-space:nowrap}
|
|
76
86
|
.row .meta .k{margin-left:auto;padding-left:8px;opacity:.75}
|
|
77
87
|
.row.needs .meta{color:inherit;opacity:.8}
|
|
78
88
|
.row .job,.row .flow{grid-column:2/-1;color:var(--mut);font-size:12px;min-width:0;overflow-wrap:anywhere;transition:opacity .15s cubic-bezier(.16,1,.3,1)}
|
|
@@ -84,6 +94,27 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
|
|
|
84
94
|
.row .why:empty{display:none}
|
|
85
95
|
.row .title{grid-column:2/-1;color:var(--mut);font-size:12px;overflow-wrap:anywhere}
|
|
86
96
|
.row .title:empty{display:none}
|
|
97
|
+
/* a session's tabs: icons in the marker column, titles on the site's edge; a popup follows its opener */
|
|
98
|
+
.row .tabs{grid-column:1/-1;display:flex;flex-direction:column;gap:1px;margin:6px -4px 0}
|
|
99
|
+
.row .tabs:empty{display:none}
|
|
100
|
+
.row .tab{display:grid;grid-template-columns:18px minmax(0,1fr);gap:0 10px;align-items:start;width:100%;padding:3px 4px;border-radius:6px;font-size:12px;line-height:16px;text-align:left;color:var(--mut);transition:background-color .15s,color .15s,opacity .12s}
|
|
101
|
+
.row .tab:hover{background:var(--btnh)}
|
|
102
|
+
.row .tab.on{color:var(--fg);font-weight:500}
|
|
103
|
+
.row.needs .tab{color:inherit;opacity:.8}
|
|
104
|
+
.row.needs .tab.on{opacity:1}
|
|
105
|
+
.row.needs .tab:hover{background:var(--needsbtn)}
|
|
106
|
+
.row .tab.in,.row .tab.gone{opacity:0}
|
|
107
|
+
.row .tab.gone{transition-duration:.1s;pointer-events:none}
|
|
108
|
+
.row .tab .ti{position:relative;justify-self:center;width:14px;height:14px;margin-top:1px;border-radius:4px;background:var(--fill);box-shadow:inset 0 0 0 1px var(--hair)}
|
|
109
|
+
.row .tab .ti .lt{position:absolute;inset:0;display:grid;place-items:center;font-size:8.5px;font-weight:600;color:var(--mut)}
|
|
110
|
+
.row .tab .ti img{position:absolute;inset:0;width:14px;height:14px;object-fit:contain}
|
|
111
|
+
.row .tab .ti.has{background:transparent;box-shadow:none}
|
|
112
|
+
.row .tab .ti.has .lt{display:none}
|
|
113
|
+
.row .tab .tl{min-width:0;overflow-wrap:anywhere}
|
|
114
|
+
.row .tab.more .ti{background:none;box-shadow:none}
|
|
115
|
+
.row .tab.more{font-weight:500}
|
|
116
|
+
.sh .nn{display:inline-flex;align-items:center;height:16px;padding:0 6px;border-radius:8px;background:var(--needs);color:var(--needsfg);font-size:10.5px;font-weight:600;font-variant-numeric:tabular-nums}
|
|
117
|
+
.sh .nn:empty{display:none}
|
|
87
118
|
/* beside the name, never over the meta line; the negative margin keeps the name line's height */
|
|
88
119
|
.row .acts{grid-row:1;grid-column:3;align-self:start;display:flex;align-items:center;gap:2px;margin:-3px -2px -3px 0}
|
|
89
120
|
.row .t{font-variant-numeric:tabular-nums}
|
|
@@ -92,9 +123,12 @@ button:focus-visible,.row:focus-visible{outline:2px solid var(--ring);outline-of
|
|
|
92
123
|
.rb.ico{padding:0;width:24px;display:inline-flex;align-items:center;justify-content:center;background:none;color:var(--mut)}
|
|
93
124
|
.rb.ico:hover{background:var(--btnh);color:var(--fg)}
|
|
94
125
|
.rb.ico .ic{width:14px;height:14px}
|
|
95
|
-
.row.
|
|
126
|
+
.row .tab .ti .ic{position:absolute;right:-4px;bottom:-4px;width:10px;height:10px;padding:1px;border-radius:3px;background:var(--rowbg);color:var(--fg)}
|
|
127
|
+
.row .tab.more .ti .ic{position:static;width:12px;height:12px;padding:0;background:none;color:inherit;transition:transform .15s cubic-bezier(.16,1,.3,1)}
|
|
128
|
+
.row .tab.more[aria-expanded=false] .ti .ic{transform:rotate(-90deg)}
|
|
129
|
+
.row.needs .rb{background:var(--needsbtn);color:inherit}
|
|
96
130
|
/* Raycast's bottom bar: the Enter action of the row in focus, and the keys; the list runs under it */
|
|
97
|
-
#bar{position:absolute;left:0;right:0;bottom:0;height:36px;display:flex;align-items:center;gap:6px;padding:0 10px 0 14px;font-size:12px;color:var(--mut);background:var(--side);transition:opacity .15s cubic-bezier(.16,1,.3,1)}
|
|
131
|
+
#bar{position:absolute;z-index:2;left:0;right:0;bottom:0;height:36px;display:flex;align-items:center;gap:6px;padding:0 10px 0 14px;font-size:12px;color:var(--mut);background:var(--side);transition:opacity .15s cubic-bezier(.16,1,.3,1)}
|
|
98
132
|
/* rows fade out above the bar, never a hard cut */
|
|
99
133
|
#bar::before{content:"";position:absolute;left:0;right:0;bottom:100%;height:18px;background:linear-gradient(transparent,var(--side));pointer-events:none}
|
|
100
134
|
#barl{display:inline-flex;align-items:center;gap:6px}
|
|
@@ -143,12 +177,61 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
|
|
|
143
177
|
#keys kbd{min-width:22px;height:22px;padding:0 6px;border-radius:6px;font-size:12px}
|
|
144
178
|
/* biome-ignore lint/complexity/noImportantStyles: reduced motion beats every rule; fades stay, moves go (MO-27) */
|
|
145
179
|
@media (prefers-reduced-motion:reduce){*,*::before,*::after{transition-property:opacity,background-color,color,box-shadow!important;animation:none!important}#keys .s{transform:none}}
|
|
180
|
+
/* §Sidebar collapse: overrides, after the base rules */
|
|
181
|
+
#bar #more{justify-content:center;width:26px;padding:0}
|
|
182
|
+
#more[aria-expanded=true]{background:var(--btnh);color:var(--fg)}
|
|
183
|
+
/* the sidebar's actions (Raycast's Actions): a native popover, grown from its button */
|
|
184
|
+
#menu{position:fixed;inset:auto;margin:0;min-width:200px;padding:5px;border:1px solid transparent;border-radius:10px;background:var(--side);color:var(--fg);box-shadow:var(--raise),var(--lift);font-size:13px;transform-origin:var(--org,left bottom);transition:opacity .15s cubic-bezier(.16,1,.3,1),transform .15s cubic-bezier(.16,1,.3,1),display .15s allow-discrete,overlay .15s allow-discrete}
|
|
185
|
+
#menu:not(:popover-open){opacity:0;transform:scale(.97);transition-duration:.1s}
|
|
186
|
+
@starting-style{#menu:popover-open{opacity:0;transform:scale(.97)}}
|
|
187
|
+
#menu button{display:flex;align-items:center;gap:8px;width:100%;height:30px;padding:0 8px 0 6px;border-radius:6px;text-align:left;white-space:nowrap;transition:background-color .15s}
|
|
188
|
+
#menu button:hover:not(:disabled){background:var(--btnh)}
|
|
189
|
+
#menu button:disabled{opacity:.4;cursor:not-allowed}
|
|
190
|
+
#menu .ck{width:14px;height:14px;opacity:0}
|
|
191
|
+
#menu [aria-checked=true] .ck{opacity:1}
|
|
192
|
+
#menu .ks{margin-left:auto;padding-left:16px}
|
|
193
|
+
#menu hr{border:0;height:1px;margin:4px 6px;background:var(--line)}
|
|
194
|
+
#menu .mh{padding:6px 8px 2px 28px;font-size:11px;font-weight:600;color:var(--mut)}
|
|
195
|
+
/* the rail: one 40 px cell a row, the icon and its badge; the name stays for screen readers */
|
|
196
|
+
.railrows #list{scrollbar-width:none}
|
|
197
|
+
.railrows #list .row{display:flex;align-items:center;justify-content:center;width:40px;height:34px;padding:0}
|
|
198
|
+
.railrows #list .row>:not(.ico):not(.site){display:none}
|
|
199
|
+
.railrows #list .row .site,.railrows #list .sh .l{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
200
|
+
.railrows #list .sh{width:40px;justify-content:center;padding:8px 0 4px}
|
|
201
|
+
.railrows #list .sec:first-child .sh{padding-top:4px}
|
|
202
|
+
.railrows #list .sh::before{content:"";width:20px;height:1px;background:var(--line)}
|
|
203
|
+
.railrows #list .sec:first-child .sh::before{background:transparent}
|
|
204
|
+
.railrows #list .sh .n,.railrows #list .sh .ic,.railrows #list .sh .nn{display:none}
|
|
205
|
+
.railrows #list .sh[aria-expanded=true]{pointer-events:none}
|
|
206
|
+
.railrows #list .sh[aria-expanded=false]::before{display:none}
|
|
207
|
+
.railrows #list .sh[aria-expanded=false] .n{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:18px;padding:0 5px;border-radius:9px;background:var(--fill);box-shadow:inset 0 0 0 1px var(--hair);color:var(--fg);font-size:11px;opacity:1}
|
|
208
|
+
.railrows #bar{padding:0 6px;gap:0}
|
|
209
|
+
.railrows #barl,.railrows #bar .sp,.railrows #barkeys{display:none}
|
|
210
|
+
.railrows #bar #more{width:40px}
|
|
211
|
+
/* the edge: drag to size; neutral, never an accent stripe */
|
|
212
|
+
#grip{position:absolute;top:0;bottom:0;right:-3px;width:6px;z-index:4;cursor:col-resize;touch-action:none}
|
|
213
|
+
#grip::after{content:"";position:absolute;top:0;bottom:0;left:2px;width:2px;background:color-mix(in srgb,var(--fg) 22%,transparent);opacity:0;transition:opacity .15s}
|
|
214
|
+
#grip:hover::after,#grip:focus-visible::after,.sizing #grip::after{opacity:1}
|
|
215
|
+
#grip:focus-visible{outline:none}
|
|
216
|
+
#grip:focus-visible::after{opacity:1;background:var(--ring)}
|
|
217
|
+
.m-hidden #grip,.peek #grip,.narrow #grip{display:none}
|
|
218
|
+
/* a drag: 1:1 with the pointer, so no tweens; frames take no pointer */
|
|
219
|
+
.sizing,.sizing *{cursor:col-resize}
|
|
220
|
+
.sizing #side,.sizing #side #sidein,.sizing #stage .pane{transition:none}
|
|
221
|
+
.sizing iframe{pointer-events:none}
|
|
222
|
+
/* a snap mid-drag (rail, hidden, back): the edge leaves the pointer, so it eases */
|
|
223
|
+
.sizing.snap #side{transition:width .12s cubic-bezier(.16,1,.3,1)}
|
|
224
|
+
.sizing.snap #side #sidein{transition:clip-path .12s cubic-bezier(.16,1,.3,1)}
|
|
225
|
+
/* compact rows: one line; a needs-you reason stays */
|
|
226
|
+
#list .row .meta,#list .row .title{transition:opacity .1s}
|
|
227
|
+
.compacting .row :is(.meta,.job,.flow,.title,.tabs){opacity:0}
|
|
228
|
+
.compact #list .row :is(.meta,.job,.flow,.title,.tabs){display:none}
|
|
146
229
|
</style>
|
|
147
230
|
</head>
|
|
148
231
|
<body>
|
|
149
232
|
<svg width="0" height="0" style="position:absolute" aria-hidden="true"><symbol id="mark" viewBox="0 0 100 100"><g stroke-linecap="round" stroke-linejoin="round"><path d="M27.0 3.2C28.3 3.0 30.0 3.1 31.5 3.0C33.0 2.9 34.5 2.8 36.0 2.7C37.5 2.6 39.0 2.5 40.5 2.4C42.0 2.3 43.5 2.2 45.0 2.2C46.5 2.1 48.0 2.2 49.5 2.2C51.0 2.2 52.5 2.3 54.0 2.4C55.5 2.5 57.0 2.6 58.5 2.7C60.0 2.8 61.5 3.0 63.0 3.1C64.5 3.1 66.0 3.2 67.5 3.3C69.0 3.3 70.5 3.3 72.0 3.3C73.5 3.3 75.0 3.3 76.5 3.2C78.0 3.2 79.7 3.1 81.0 3.2C82.3 3.3 83.3 3.4 84.4 3.9C85.4 4.3 86.4 5.1 87.1 5.9C87.8 6.7 88.4 7.7 88.8 8.8C89.2 9.8 89.2 10.9 89.3 12.1C89.4 13.2 89.3 14.5 89.4 15.7C89.4 16.9 89.5 18.1 89.6 19.3C89.8 20.6 89.9 21.8 90.0 23.0C90.2 24.2 90.3 25.4 90.4 26.7C90.5 27.9 90.6 29.1 90.7 30.3C90.7 31.6 90.7 32.8 90.7 34.0C90.7 35.2 90.6 36.4 90.6 37.7C90.5 38.9 90.4 40.1 90.4 41.3C90.3 42.6 90.4 43.8 90.2 45.0C90.1 46.2 89.9 47.4 89.5 48.5C89.0 49.6 88.3 50.7 87.5 51.5C86.7 52.3 85.6 53.1 84.5 53.5C83.5 54.0 82.4 54.1 81.0 54.2C79.7 54.3 78.0 54.1 76.5 54.0C75.0 53.9 73.5 53.8 72.0 53.7C70.5 53.6 69.0 53.5 67.5 53.4C66.0 53.3 64.5 53.2 63.0 53.2C61.5 53.1 60.0 53.2 58.5 53.2C57.0 53.2 55.5 53.3 54.0 53.4C52.5 53.5 51.0 53.6 49.5 53.7C48.0 53.8 46.5 54.0 45.0 54.1C43.5 54.1 42.0 54.2 40.5 54.3C39.0 54.3 37.5 54.3 36.0 54.3C34.5 54.3 33.0 54.3 31.5 54.2C30.0 54.2 28.3 54.3 27.0 54.2C25.6 54.1 24.6 54.0 23.5 53.5C22.4 53.1 21.3 52.4 20.4 51.6C19.5 50.8 18.7 49.8 18.2 48.7C17.7 47.6 17.5 46.3 17.3 45.1C17.2 43.8 17.3 42.6 17.4 41.3C17.4 40.1 17.5 38.9 17.6 37.7C17.8 36.4 17.9 35.2 18.0 34.0C18.2 32.8 18.3 31.6 18.4 30.3C18.5 29.1 18.6 27.9 18.7 26.7C18.7 25.4 18.7 24.2 18.7 23.0C18.7 21.8 18.6 20.6 18.6 19.3C18.5 18.1 18.4 16.9 18.4 15.7C18.3 14.4 18.1 13.2 18.2 12.0C18.3 10.8 18.4 9.7 18.8 8.6C19.3 7.6 20.0 6.6 20.8 5.8C21.6 5.0 22.6 4.3 23.6 3.9C24.7 3.5 25.7 3.3 27.0 3.2Z" style="fill:var(--mkf)" stroke="currentColor" stroke-width="3.62"/><path d="M18.1 12.8C19.4 12.7 20.9 12.8 22.3 12.8C23.8 12.8 25.2 12.7 26.7 12.6C28.1 12.6 29.6 12.5 31.0 12.4C32.4 12.3 33.9 12.3 35.3 12.2C36.8 12.2 38.2 12.2 39.7 12.2C41.1 12.2 42.6 12.2 44.0 12.3C45.4 12.3 46.9 12.3 48.3 12.3C49.8 12.3 51.2 12.3 52.7 12.2C54.1 12.2 55.6 12.1 57.0 12.0C58.4 11.9 59.9 11.7 61.3 11.6C62.8 11.5 64.2 11.3 65.7 11.2C67.1 11.1 68.7 10.9 70.1 11.0C71.5 11.1 72.9 11.3 74.2 11.9C75.4 12.5 76.7 13.4 77.5 14.5C78.4 15.5 79.1 16.8 79.5 18.1C79.9 19.3 79.9 20.6 79.9 22.0C80.0 23.4 79.8 25.0 79.7 26.4C79.7 27.9 79.7 29.4 79.7 30.9C79.7 32.4 79.7 33.9 79.7 35.3C79.8 36.8 79.8 38.3 79.8 39.8C79.8 41.3 79.8 42.7 79.7 44.2C79.7 45.7 79.6 47.2 79.5 48.7C79.5 50.1 79.4 51.6 79.3 53.1C79.3 54.6 79.2 56.1 79.2 57.6C79.2 59.0 79.3 60.6 79.3 61.9C79.2 63.3 79.2 64.5 78.9 65.7C78.5 66.9 77.9 68.1 77.1 69.1C76.3 70.1 75.2 71.1 74.0 71.7C72.8 72.3 71.5 72.6 70.1 72.8C68.7 72.9 67.1 72.8 65.7 72.8C64.2 72.8 62.8 72.7 61.3 72.6C59.9 72.6 58.4 72.5 57.0 72.4C55.6 72.3 54.1 72.3 52.7 72.2C51.2 72.2 49.8 72.2 48.3 72.2C46.9 72.2 45.4 72.2 44.0 72.3C42.6 72.3 41.1 72.3 39.7 72.3C38.2 72.3 36.8 72.3 35.3 72.2C33.9 72.2 32.4 72.1 31.0 72.0C29.6 71.9 28.1 71.7 26.7 71.6C25.2 71.5 23.8 71.3 22.3 71.2C20.9 71.1 19.4 71.2 18.1 71.0C16.8 70.9 15.6 70.8 14.5 70.4C13.4 70.0 12.3 69.4 11.4 68.6C10.5 67.8 9.6 66.8 9.0 65.7C8.4 64.6 8.1 63.4 7.9 62.0C7.7 60.6 7.8 59.0 7.7 57.6C7.7 56.1 7.7 54.6 7.7 53.1C7.7 51.6 7.7 50.1 7.7 48.7C7.8 47.2 7.8 45.7 7.8 44.2C7.8 42.7 7.8 41.3 7.7 39.8C7.7 38.3 7.6 36.8 7.5 35.3C7.5 33.9 7.4 32.4 7.3 30.9C7.3 29.4 7.2 27.9 7.2 26.4C7.2 25.0 7.1 23.3 7.3 21.9C7.5 20.5 7.8 19.2 8.4 18.0C9.0 16.9 10.0 15.8 11.0 15.0C12.0 14.2 13.2 13.6 14.4 13.2C15.5 12.9 16.7 12.8 18.1 12.8Z" style="fill:var(--mkf)" stroke="currentColor" stroke-width="4.7"/><circle cx="18.0" cy="21" r="2.6" style="fill:none" stroke="currentColor" stroke-width="2.4"/><circle cx="25.5" cy="21" r="2.6" style="fill:none" stroke="currentColor" stroke-width="2.4"/><circle cx="33.0" cy="21" r="2.6" style="fill:none" stroke="currentColor" stroke-width="2.4"/><path d="M40.0 21.2C41.2 21.1 45.0 20.7 47.5 20.8C50.0 20.8 52.5 21.2 55.0 21.2C57.5 21.2 60.0 21.0 62.5 20.9C65.0 20.9 68.8 20.9 70.0 20.9" style="fill:none" stroke="currentColor" stroke-width="3.38"/><path d="M8.0 29.1C9.2 29.0 12.8 28.6 15.2 28.6C17.6 28.6 20.0 29.0 22.4 29.1C24.8 29.2 27.2 29.2 29.6 29.2C32.0 29.2 34.4 29.1 36.8 29.0C39.2 28.9 41.6 28.8 44.0 28.8C46.4 28.8 48.8 28.8 51.2 28.9C53.6 29.0 56.0 29.4 58.4 29.4C60.8 29.4 63.2 29.0 65.6 28.9C68.0 28.7 70.4 28.5 72.8 28.6C75.2 28.7 78.8 29.3 80.0 29.4" style="fill:none" stroke="currentColor" stroke-width="3.38"/><path d="M45 50H37M47.6 43.6L41.6 37.6M54 41V35" style="fill:none;stroke:var(--mkt)" stroke-width="4.5" /><path d="M54.0 50.0Q53.3 70.0 54.0 90.0Q58.4 85.3 63.3 81.3Q66.3 89.0 70.3 96.3Q73.9 94.4 77.7 93.1Q74.7 85.7 70.7 78.7Q76.8 78.4 83.0 79.0Q69.0 64.0 54.0 50.0Z" style="fill:var(--mkf)" stroke="currentColor" stroke-width="4.2"/></g></symbol></svg>
|
|
150
233
|
<div id="top">
|
|
151
|
-
<button type="button" class="nb" id="sidebtn" title="Sessions (⌘\)" aria-label="
|
|
234
|
+
<button type="button" class="nb" id="sidebtn" title="Sessions (⌘\)" aria-label="Collapse or expand the sidebar (⌘\)" aria-pressed="true"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="10" rx="2"/><path d="M6 3v10"/></svg></button>
|
|
152
235
|
<div class="sp" id="drag"></div>
|
|
153
236
|
<button type="button" class="nb" id="unmax" title="Restore the layout (⌘⇧↩)" tabindex="-1"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><path d="M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4"/></svg>Restore</button>
|
|
154
237
|
<fieldset id="seg" aria-label="Layout">
|
|
@@ -160,14 +243,17 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
|
|
|
160
243
|
<button type="button" class="nb" id="keysbtn" title="Keys" aria-label="Keys" aria-expanded="false"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><rect x="1.5" y="4" width="13" height="8.5" rx="1.8"/><path d="M4.5 7h.01M7 7h.01M9.5 7h.01M12 7h.01M5 10h6"/></svg></button>
|
|
161
244
|
</div>
|
|
162
245
|
<div id="main">
|
|
163
|
-
<nav id="side" aria-label="Sessions"><ul id="list"></ul>
|
|
164
|
-
<div id="bar" class="off"><span id="barl"></span><span class="sp"></span><button type="button" id="barkeys" title="Keys (⌘/)">Keys <span class="ks"><kbd>⌘</kbd><kbd>/</kbd></span></button></div>
|
|
246
|
+
<nav id="side" aria-label="Sessions"><div id="sidein"><ul id="list"></ul>
|
|
247
|
+
<div id="bar" class="off"><span id="barl"></span><span class="sp"></span><button type="button" id="barkeys" title="Keys (⌘/)">Keys <span class="ks"><kbd>⌘</kbd><kbd>/</kbd></span></button><button type="button" id="more" title="Sidebar actions" aria-label="Sidebar actions" aria-haspopup="menu" aria-expanded="false" aria-controls="menu" popovertarget="menu"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8h.01M8 8h.01M12.5 8h.01" stroke-width="2.4"/></svg></button></div></div>
|
|
248
|
+
<!-- biome-ignore lint/a11y/useSemanticElements: a focusable splitter (WAI-ARIA window splitter); <hr> is a static rule -->
|
|
249
|
+
<div id="grip" role="separator" tabindex="0" aria-orientation="vertical" aria-label="Sidebar width" aria-valuemin="0" aria-valuemax="420" aria-valuenow="248" title="Drag to resize; double-click to reset"></div>
|
|
165
250
|
</nav>
|
|
166
251
|
<div id="stage" class="single">
|
|
167
252
|
<div id="empty"><svg viewBox="0 0 100 100" aria-hidden="true"><use href="#mark"/></svg><div class="h">No sessions</div><div class="s"></div></div>
|
|
168
253
|
<div id="keys"><div class="s" role="dialog" aria-label="Keyboard shortcuts"><div class="hd"><svg aria-hidden="true" viewBox="0 0 100 100"><use href="#mark"/></svg>Keyboard shortcuts<button type="button" class="cl" id="keysx" title="Close (Esc)" aria-label="Close (Esc)"><kbd>esc</kbd></button></div><div class="g">Hub</div></div></div>
|
|
169
254
|
</div>
|
|
170
255
|
</div>
|
|
256
|
+
<div id="menu" popover role="menu" aria-label="Sidebar actions"></div>
|
|
171
257
|
<script>
|
|
172
258
|
'use strict';
|
|
173
259
|
const $ = (id) => document.getElementById(id);
|
|
@@ -189,12 +275,14 @@ const ICON = {
|
|
|
189
275
|
max: '<path d="M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5 9 7M2.5 13.5 7 9"/>',
|
|
190
276
|
min: '<path d="M13.5 6.5h-4v-4M2.5 9.5h4v4M9.5 6.5l4-4M6.5 9.5l-4 4"/>',
|
|
191
277
|
x: '<path d="M4 4l8 8M12 4l-8 8"/>',
|
|
278
|
+
// a page another page opened: a window over its opener
|
|
279
|
+
pop: '<rect x="5.25" y="2.25" width="8.5" height="7.5" rx="1.5"/><path d="M2.25 6.5v5.75c0 .83.67 1.5 1.5 1.5H9.5"/>',
|
|
192
280
|
eye: '<path d="M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8z"/><circle cx="8" cy="8" r="2"/>',
|
|
193
281
|
};
|
|
194
282
|
const FILLED = new Set(['pause', 'play']);
|
|
195
283
|
const icon = (n) => `<svg class="ic${FILLED.has(n) ? ' fill' : ''}" viewBox="0 0 16 16" aria-hidden="true">${ICON[n]}</svg>`;
|
|
196
284
|
/** the hub's keys: this sheet, and a group in each pane's ⌘/ sheet */
|
|
197
|
-
const HUB_KEYS = [['
|
|
285
|
+
const HUB_KEYS = [['Sidebar: full or collapsed', ['⌘', '\\']], ['Focus, Split, Grid', ['⌃', '⌘', '1–3']], ['Next pane', ['⌘', '⌥', '←→↑↓']], ['Maximize a pane', ['⌘', '⇧', '↩']], ['Session by row', ['⌘', '⌥', '1–9']], ['Sessions list', ['⌘', '⌥', '0']], ['Own window, dock back', ['⌘', '⇧', 'T']], ['Pause or resume all', ['⌘', '⇧', 'P']]];
|
|
198
286
|
/** a pane this wide or wider sizes its page; a narrower one scales it (pages under this go phone layout) */
|
|
199
287
|
const SIZE_MIN = 480;
|
|
200
288
|
|
|
@@ -206,7 +294,24 @@ let order = [];
|
|
|
206
294
|
let layout = CAP[store.get('hub.layout', 'focus')] ? store.get('hub.layout', 'focus') : 'focus';
|
|
207
295
|
/** placed panes, by key (`id`, or `id#own` for a second view of one session) */
|
|
208
296
|
let cells = [];
|
|
209
|
-
let cur = 0, max = false, hubOn = false
|
|
297
|
+
let cur = 0, max = false, hubOn = false;
|
|
298
|
+
// --- sidebar modes (§Sidebar collapse) ---
|
|
299
|
+
const RAIL = 52, WMIN = 200, WMAX = 420, WDEF = 248, SNAP = 140, HIDE = 26;
|
|
300
|
+
const clampW = (w) => Math.min(WMAX, Math.max(WMIN, Math.round(w)));
|
|
301
|
+
/** 'full' | 'rail' | 'hidden'; the old '1' and '0' read as full and hidden */
|
|
302
|
+
const modeOf = (v) => (v === '0' ? 'hidden' : v === 'rail' || v === 'hidden' ? v : 'full');
|
|
303
|
+
let mode = modeOf(store.get('hub.side', 'full'));
|
|
304
|
+
/** where ⌘\\ goes from full */
|
|
305
|
+
let collapsedTo = store.get('hub.collapsed', 'rail') === 'hidden' ? 'hidden' : 'rail';
|
|
306
|
+
let sidew = clampW(Number(store.get('hub.sidew', WDEF)) || WDEF);
|
|
307
|
+
let compact = store.get('hub.compact', '0') === '1';
|
|
308
|
+
/** flyout open by hover or focus; pinned open by ⌘\\ in a narrow window */
|
|
309
|
+
let peek = false, pin = false;
|
|
310
|
+
/** a drag on the grip: {x0, w0, m0, id, w, m} */
|
|
311
|
+
let sizing = null;
|
|
312
|
+
const narrowQ = matchMedia('(max-width: 759px)');
|
|
313
|
+
/** what shows: a narrow window shows full as the rail */
|
|
314
|
+
const shownMode = () => (narrowQ.matches && mode === 'full' ? 'rail' : mode);
|
|
210
315
|
/** key → {el, frame, url, title, at} ; a pane out of the layout stays a while, hidden, for a quick return */
|
|
211
316
|
const panes = new Map();
|
|
212
317
|
const KEEP = 4;
|
|
@@ -403,8 +508,7 @@ function target(e) {
|
|
|
403
508
|
|
|
404
509
|
// --- render --------------------------------------------------------------------------
|
|
405
510
|
function render() {
|
|
406
|
-
|
|
407
|
-
$('sidebtn').setAttribute('aria-pressed', String(side));
|
|
511
|
+
applySide();
|
|
408
512
|
for (const b of $('seg').children) b.setAttribute('aria-pressed', String(b.dataset.l === layout));
|
|
409
513
|
const single = max || (cells.length <= 1 && layout === 'focus');
|
|
410
514
|
stage.classList.toggle('single', single);
|
|
@@ -487,16 +591,57 @@ function stateOf(r) {
|
|
|
487
591
|
}
|
|
488
592
|
/** sections, in list order; ⌘⌥1–9 count in this order */
|
|
489
593
|
const SECS = [['needs', 'Needs you'], ['run', 'Running'], ['lazy', 'Not watched'], ['ended', 'Ended']];
|
|
490
|
-
function
|
|
594
|
+
function stateSec(r) {
|
|
491
595
|
if (r.ended) return 'ended';
|
|
492
596
|
if (r.needs) return 'needs';
|
|
493
597
|
return r.lazy && !r.url && !r.moved ? 'lazy' : 'run';
|
|
494
598
|
}
|
|
599
|
+
/** Group by (Linear's Display, PT-17): state sections, a task or an account; keys t:… a:… */
|
|
600
|
+
const GROUPS = [['state', 'State'], ['task', 'Task'], ['account', 'Account']];
|
|
601
|
+
let groupBy = store.get('hub.group', 'state');
|
|
602
|
+
if (!GROUPS.some(([k]) => k === groupBy)) groupBy = 'state';
|
|
603
|
+
/** the job, else the flow's label or name, else the kind */
|
|
604
|
+
function taskOf(r) {
|
|
605
|
+
const f = r.state?.flow && typeof r.state.flow.name === 'string' ? r.state.flow : null;
|
|
606
|
+
const t = [r.job?.name, f?.label, f?.name, kindWord(r, null)].find((x) => typeof x === 'string' && x.trim());
|
|
607
|
+
return t ? t.trim() : 'Other';
|
|
608
|
+
}
|
|
609
|
+
/** the profile's part after @; a site's plain profile is its main account */
|
|
610
|
+
const accountOf = (r) => typeof r.profile !== 'string' || !r.profile ? 'No profile' : r.profile.includes('@') ? r.profile.slice(r.profile.indexOf('@') + 1) : 'Main';
|
|
611
|
+
function secOf(r) {
|
|
612
|
+
if (groupBy === 'task') return `t:${taskOf(r)}`;
|
|
613
|
+
if (groupBy === 'account') return `a:${accountOf(r)}`;
|
|
614
|
+
return stateSec(r);
|
|
615
|
+
}
|
|
616
|
+
/** groups in list order, each with its rows; in Task and Account, needs-you rows first and ended rows last */
|
|
617
|
+
function groupList() {
|
|
618
|
+
const m = new Map(groupBy === 'state' ? SECS.map(([k, l]) => [k, { k, label: l, ids: [] }]) : []);
|
|
619
|
+
for (const id of order) {
|
|
620
|
+
const r = rows.get(id);
|
|
621
|
+
if (!r) continue;
|
|
622
|
+
const k = secOf(r);
|
|
623
|
+
if (!m.has(k)) m.set(k, { k, label: k.slice(2), ids: [] });
|
|
624
|
+
m.get(k).ids.push(id);
|
|
625
|
+
}
|
|
626
|
+
const rank = (id) => { const s = stateSec(rows.get(id)); return s === 'needs' ? 0 : s === 'ended' ? 2 : 1; };
|
|
627
|
+
if (groupBy !== 'state') for (const g of m.values()) g.ids.sort((a, b) => rank(a) - rank(b));
|
|
628
|
+
return [...m.values()].filter((g) => g.ids.length);
|
|
629
|
+
}
|
|
495
630
|
let fold = {};
|
|
496
631
|
try { fold = JSON.parse(store.get('hub.fold', '{}')) || {}; } catch {}
|
|
497
632
|
/** Needs you never folds; Not watched starts folded past 8 rows */
|
|
498
633
|
const folded = (sec, n) => sec !== 'needs' && (fold[sec] ?? (sec === 'lazy' && n > 8));
|
|
499
|
-
|
|
634
|
+
/** ⌥-click: every section goes the way this one turns (Finder's outline) */
|
|
635
|
+
function toggleFold(sec, n, all = false) {
|
|
636
|
+
const to = !folded(sec, n);
|
|
637
|
+
if (all) foldAll(to); else { fold[sec] = to; store.set('hub.fold', JSON.stringify(fold)); renderRows(); }
|
|
638
|
+
}
|
|
639
|
+
/** an explicit open per section, so Not watched stays open past 8 rows */
|
|
640
|
+
function foldAll(to) {
|
|
641
|
+
for (const g of groupList()) if (g.k !== 'needs') fold[g.k] = to;
|
|
642
|
+
store.set('hub.fold', JSON.stringify(fold));
|
|
643
|
+
renderRows();
|
|
644
|
+
}
|
|
500
645
|
/** the first grapheme of the host */
|
|
501
646
|
const seg = typeof Intl.Segmenter === 'function' ? new Intl.Segmenter() : null;
|
|
502
647
|
function letterOf(site) {
|
|
@@ -516,11 +661,16 @@ function enter(id) { const r = rows.get(id); if (enterOf(r) === 'Bring back') ac
|
|
|
516
661
|
function rowEl(id) {
|
|
517
662
|
const el = document.createElement('li');
|
|
518
663
|
el.className = 'row'; el.dataset.k = id; el.dataset.id = id; el.tabIndex = 0; el.draggable = true;
|
|
519
|
-
el.innerHTML = '<div class="ico"><span class="lt"></span><img alt=""><span class="dot"></span></div><div class="site" dir="auto"></div><div class="acts"></div><div class="meta"></div><div class="job" dir="auto"></div><div class="flow" dir="auto"></div><div class="why" dir="auto"></div><div class="title" dir="auto"></div>';
|
|
664
|
+
el.innerHTML = '<div class="ico"><span class="lt"></span><img alt=""><span class="dot"></span></div><div class="site" dir="auto"></div><div class="acts"></div><div class="meta"></div><div class="job" dir="auto"></div><div class="flow" dir="auto"></div><div class="why" dir="auto"></div><div class="title" dir="auto"></div><div class="tabs"></div>';
|
|
520
665
|
const img = el.querySelector('img');
|
|
521
666
|
img.addEventListener('load', () => el.querySelector('.ico').classList.add('has'));
|
|
522
667
|
img.addEventListener('error', () => el.querySelector('.ico').classList.remove('has'));
|
|
523
|
-
el.addEventListener('click', (e) => {
|
|
668
|
+
el.addEventListener('click', (e) => {
|
|
669
|
+
const b = e.target.closest('button');
|
|
670
|
+
if (b?.dataset.more) { if (allTabs.has(id)) allTabs.delete(id); else allTabs.add(id); renderRows(); return; }
|
|
671
|
+
if (b?.dataset.tab) { show(id); app({ t: 'tab', id, tab: Number(b.dataset.tab) }); return; }
|
|
672
|
+
if (b?.dataset.a) act(id, b.dataset.a); else show(id);
|
|
673
|
+
});
|
|
524
674
|
el.addEventListener('keydown', (e) => { if (e.key === 'Enter' && e.target === el) enter(id); });
|
|
525
675
|
el.addEventListener('dragstart', (e) => { e.dataTransfer.setData('text/plain', `row:${id}`); e.dataTransfer.effectAllowed = 'move'; });
|
|
526
676
|
el.style.opacity = '0';
|
|
@@ -533,13 +683,13 @@ function secEl(sec, label) {
|
|
|
533
683
|
// Needs you never folds: a label, not a button
|
|
534
684
|
el.innerHTML = sec === 'needs'
|
|
535
685
|
? `<div class="sh"><span class="l"></span><span class="n"></span></div>`
|
|
536
|
-
: `<button type="button" class="sh" aria-expanded="true"><span class="l"></span><span class="n"></span>${icon('caret')}</button>`;
|
|
686
|
+
: `<button type="button" class="sh" aria-expanded="true"><span class="l"></span><span class="n"></span><span class="nn"></span>${icon('caret')}</button>`;
|
|
537
687
|
el.querySelector('.l').textContent = label;
|
|
538
|
-
el.querySelector('button')?.addEventListener('click', () => toggleFold(sec, Number(el.dataset.n)));
|
|
688
|
+
el.querySelector('button')?.addEventListener('click', (e) => toggleFold(sec, Number(el.dataset.n), e.altKey));
|
|
539
689
|
return el;
|
|
540
690
|
}
|
|
541
691
|
function fillRow(el, r, onIds) {
|
|
542
|
-
const [dot, word] = stateOf(r), sec =
|
|
692
|
+
const [dot, word] = stateOf(r), sec = stateSec(r);
|
|
543
693
|
el.classList.toggle('needs', !!r.needs && !r.ended);
|
|
544
694
|
el.classList.toggle('ended', !!r.ended);
|
|
545
695
|
el.classList.toggle('on', onIds.has(r.id) && hubOn);
|
|
@@ -556,10 +706,10 @@ function fillRow(el, r, onIds) {
|
|
|
556
706
|
}
|
|
557
707
|
// a row's word never repeats its section; a part with no value drops out with its dot
|
|
558
708
|
const since = Number(r.since) > 0 ? Number(r.since) : 0;
|
|
559
|
-
const w = r.torn ? 'Own window' : sec === 'run' ? word : '';
|
|
709
|
+
const w = r.torn ? 'Own window' : sec === 'run' || (groupBy !== 'state' && sec !== 'needs') ? word : '';
|
|
560
710
|
// a flow, workflow or repair step in the session
|
|
561
711
|
const f = r.state?.flow && !r.ended && typeof r.state.flow.name === 'string' ? r.state.flow : null;
|
|
562
|
-
const kw = kindWord(r, f);
|
|
712
|
+
const kw = groupBy === 'task' && taskOf(r) === kindWord(r, f) ? '' : kindWord(r, f);
|
|
563
713
|
const meta = el.querySelector('.meta'), shape = `${r.torn ? 1 : 0}${w ? 1 : 0}${since ? 1 : 0}${kw ? 1 : 0}`;
|
|
564
714
|
if (meta.dataset.s !== shape) {
|
|
565
715
|
meta.dataset.s = shape;
|
|
@@ -581,7 +731,9 @@ function fillRow(el, r, onIds) {
|
|
|
581
731
|
else lineTo(fl, f ? `${icon('flow')}<span class="n">${esc(f.name)}</span>${label ? ` · <span class="l">${esc(label)}</span>` : ''} <span class="s">${esc(at)}</span>` : '');
|
|
582
732
|
fl.dataset.k = fk;
|
|
583
733
|
el.querySelector('.why').textContent = r.needs && !r.ended ? r.needs : '';
|
|
584
|
-
|
|
734
|
+
const tl = !r.ended && !r.moved && Array.isArray(r.state?.tabs) && r.state.tabs.length > 1 ? r.state.tabs : [];
|
|
735
|
+
el.querySelector('.title').textContent = tl.length ? '' : r.state?.title || '';
|
|
736
|
+
fillTabs(el.querySelector('.tabs'), tl, Array.isArray(r.state?.icons) ? r.state.icons : [], r.site, r.id);
|
|
585
737
|
const acts = el.querySelector('.acts');
|
|
586
738
|
let html = '';
|
|
587
739
|
if (r.ended) html = '';
|
|
@@ -590,17 +742,81 @@ function fillRow(el, r, onIds) {
|
|
|
590
742
|
else if (canPause(r)) html = `<button type="button" class="rb ico" data-a="pause" title="${r.state?.held ? 'Resume' : 'Pause'}" aria-label="${r.state?.held ? 'Resume the agent' : 'Pause the agent'}">${icon(r.state?.held ? 'play' : 'pause')}</button>`;
|
|
591
743
|
if (acts.dataset.h !== html) { acts.innerHTML = html; acts.dataset.h = html; }
|
|
592
744
|
}
|
|
745
|
+
/** tab order, but a popup right after its opener (depth first); a popup whose opener closed stays put */
|
|
746
|
+
function tabOrder(tabs) {
|
|
747
|
+
const ids = new Set(tabs.map((t) => t.id)), kids = new Map(), roots = [], out = [], seen = new Set();
|
|
748
|
+
for (const t of tabs) {
|
|
749
|
+
if (t.opener != null && t.opener !== t.id && ids.has(t.opener)) { if (!kids.has(t.opener)) kids.set(t.opener, []); kids.get(t.opener).push(t); }
|
|
750
|
+
else roots.push(t);
|
|
751
|
+
}
|
|
752
|
+
const walk = (t) => { if (seen.has(t.id)) return; seen.add(t.id); out.push(t); for (const k of kids.get(t.id) ?? []) walk(k); };
|
|
753
|
+
roots.forEach(walk);
|
|
754
|
+
for (const t of tabs) if (!seen.has(t.id)) out.push(t); // an opener loop
|
|
755
|
+
return out;
|
|
756
|
+
}
|
|
757
|
+
const hostOf = (u) => { try { return new URL(u).host.replace(/^www\./, ''); } catch { return ''; } };
|
|
758
|
+
/** past TAB_CAP tabs a row shows TAB_SOME and the shown tab, then "N more tabs" (Notion's More); per session, not stored */
|
|
759
|
+
const TAB_CAP = 8, TAB_SOME = 6, allTabs = new Set();
|
|
760
|
+
/** a row's tab lines, keyed by tab id: new lines fade in, closed ones fade out (rows below slide) */
|
|
761
|
+
function fillTabs(box, tabs, icons, site, rid) {
|
|
762
|
+
const order = tabOrder(tabs), cut = order.length > TAB_CAP && !allTabs.has(rid);
|
|
763
|
+
const want = cut ? order.filter((t, i) => i < TAB_SOME || t.on) : order;
|
|
764
|
+
const more = order.length > TAB_CAP ? (cut ? `${order.length - want.length} more tabs` : 'Show fewer') : '';
|
|
765
|
+
const have = new Map([...box.children].filter((b) => b.dataset.tab && !b.classList.contains('gone')).map((b) => [b.dataset.tab, b]));
|
|
766
|
+
const keep = new Set(want.map((t) => String(t.id)));
|
|
767
|
+
for (const [k, b] of have) {
|
|
768
|
+
if (keep.has(k)) continue;
|
|
769
|
+
b.classList.add('gone');
|
|
770
|
+
setTimeout(() => flipRows(() => b.remove(), 200), 100);
|
|
771
|
+
}
|
|
772
|
+
want.forEach((t, i) => {
|
|
773
|
+
let b = have.get(String(t.id));
|
|
774
|
+
if (!b) {
|
|
775
|
+
b = document.createElement('button');
|
|
776
|
+
b.type = 'button'; b.className = 'tab in'; b.dataset.tab = String(t.id);
|
|
777
|
+
b.innerHTML = '<span class="ti"><span class="lt"></span><img alt=""></span><span class="tl" dir="auto"></span>';
|
|
778
|
+
const img = b.querySelector('img');
|
|
779
|
+
img.addEventListener('load', () => b.querySelector('.ti').classList.add('has'));
|
|
780
|
+
img.addEventListener('error', () => b.querySelector('.ti').classList.remove('has'));
|
|
781
|
+
requestAnimationFrame(() => b.classList.remove('in'));
|
|
782
|
+
}
|
|
783
|
+
const live = [...box.children].filter((x) => x.dataset.tab && !x.classList.contains('gone'));
|
|
784
|
+
if (live[i] !== b) box.insertBefore(b, live[i] ?? null);
|
|
785
|
+
const on = !!t.on, title = (typeof t.title === 'string' && t.title.trim()) || hostOf(t.url) || 'New tab';
|
|
786
|
+
b.classList.toggle('on', on);
|
|
787
|
+
if (on) b.setAttribute('aria-current', 'true'); else b.removeAttribute('aria-current');
|
|
788
|
+
const pop = t.opener != null, k = `${pop ? 1 : 0}\n${title}`;
|
|
789
|
+
if (b.dataset.k !== k) {
|
|
790
|
+
b.dataset.k = k; b.querySelector('.tl').textContent = title;
|
|
791
|
+
const ti = b.querySelector('.ti'), g = ti.querySelector('.ic');
|
|
792
|
+
if (pop && !g) ti.insertAdjacentHTML('beforeend', icon('pop')); else if (!pop) g?.remove();
|
|
793
|
+
}
|
|
794
|
+
b.title = pop ? `Popup: ${t.url || title}` : t.url || title;
|
|
795
|
+
b.querySelector('.lt').textContent = letterOf(hostOf(t.url) || site);
|
|
796
|
+
const img = b.querySelector('img'), src = Number.isInteger(t.ic) && typeof icons[t.ic] === 'string' ? icons[t.ic] : '';
|
|
797
|
+
if (!src) { b.querySelector('.ti').classList.remove('has'); img.removeAttribute('src'); }
|
|
798
|
+
else if (img.getAttribute('src') !== src) img.src = src;
|
|
799
|
+
});
|
|
800
|
+
let mb = box.querySelector(':scope>.more');
|
|
801
|
+
if (!more) { mb?.remove(); return; }
|
|
802
|
+
if (!mb) {
|
|
803
|
+
mb = document.createElement('button');
|
|
804
|
+
mb.type = 'button'; mb.className = 'tab more'; mb.dataset.more = '1';
|
|
805
|
+
mb.innerHTML = `<span class="ti">${icon('caret')}</span><span class="tl"></span>`;
|
|
806
|
+
}
|
|
807
|
+
box.append(mb);
|
|
808
|
+
mb.querySelector('.tl').textContent = more;
|
|
809
|
+
mb.setAttribute('aria-expanded', String(!cut));
|
|
810
|
+
}
|
|
593
811
|
/** the list's live items: rows and labels not on their way out */
|
|
594
812
|
const live = () => [...list.children].filter((el) => !el.classList.contains('gone'));
|
|
595
813
|
function renderRows() {
|
|
596
|
-
const groups = new Map(
|
|
597
|
-
|
|
598
|
-
// the list as it should be: a label per non-empty section, then its rows unless folded
|
|
814
|
+
const gl = groupList(), groups = new Map(gl.map((g) => [g.k, g.ids]));
|
|
815
|
+
// the list as it should be: a label per non-empty group, then its rows unless folded
|
|
599
816
|
const want = [];
|
|
600
|
-
for (const
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
want.push({ k: `sec:${sec}`, sec, label, n: ids.length });
|
|
817
|
+
for (const { k: sec, label, ids } of gl) {
|
|
818
|
+
const nn = sec === 'needs' || groupBy === 'state' ? 0 : ids.filter((id) => stateSec(rows.get(id)) === 'needs').length;
|
|
819
|
+
want.push({ k: `sec:${sec}`, sec, label, n: ids.length, nn });
|
|
604
820
|
if (!folded(sec, ids.length)) for (const id of ids) want.push({ k: id, id });
|
|
605
821
|
}
|
|
606
822
|
const keep = new Set(want.map((w) => w.k));
|
|
@@ -610,7 +826,7 @@ function renderRows() {
|
|
|
610
826
|
if (keep.has(el.dataset.k)) continue;
|
|
611
827
|
const r = rows.get(el.dataset.k);
|
|
612
828
|
// a folded row, or one that already faded (ended): out at once; a label fades out of the flow
|
|
613
|
-
if (el.classList.contains('row') && (el.classList.contains('out') || (r && folded(secOf(r), groups.get(secOf(r))
|
|
829
|
+
if (el.classList.contains('row') && (el.classList.contains('out') || (r && folded(secOf(r), groups.get(secOf(r))?.length ?? 0)))) { el.remove(); continue; }
|
|
614
830
|
const top = el.offsetTop;
|
|
615
831
|
el.classList.add('gone'); el.style.top = `${top}px`;
|
|
616
832
|
list.append(el);
|
|
@@ -625,6 +841,8 @@ function renderRows() {
|
|
|
625
841
|
else {
|
|
626
842
|
el.dataset.n = w.n;
|
|
627
843
|
swapText(el.querySelector('.n'), String(w.n));
|
|
844
|
+
const nn = el.querySelector('.nn');
|
|
845
|
+
if (nn) nn.textContent = w.nn ? `${w.nn} need${w.nn > 1 ? '' : 's'} you` : '';
|
|
628
846
|
el.querySelector('button')?.setAttribute('aria-expanded', String(!folded(w.sec, w.n)));
|
|
629
847
|
}
|
|
630
848
|
});
|
|
@@ -664,7 +882,7 @@ function focusList() {
|
|
|
664
882
|
const all = shown();
|
|
665
883
|
const el = all.find((x) => x.dataset.id === idOf(cells[cur] || '')) || all[0];
|
|
666
884
|
if (!el) return;
|
|
667
|
-
if (
|
|
885
|
+
if (shownMode() === 'hidden') setMode('full');
|
|
668
886
|
window.focus(); el.focus(); el.scrollIntoView({ block: 'nearest' });
|
|
669
887
|
}
|
|
670
888
|
/** text changes ease: out 60 ms, in 60 ms; the first fill is instant */
|
|
@@ -734,7 +952,7 @@ function move(code) {
|
|
|
734
952
|
}
|
|
735
953
|
function key(k) {
|
|
736
954
|
const { code, shift, alt, ctrl } = k;
|
|
737
|
-
if (!shift && !alt && !ctrl && code === 'Backslash') {
|
|
955
|
+
if (!shift && !alt && !ctrl && code === 'Backslash') { toggleSide(); return true; }
|
|
738
956
|
if (ctrl && !alt && !shift && /^Digit[1-3]$/.test(code)) { setLayout(['focus', 'split', 'grid'][Number(code.slice(5)) - 1]); return true; }
|
|
739
957
|
if (alt && !ctrl && !shift && /^Arrow/.test(code)) { move(code); return true; }
|
|
740
958
|
if (alt && !ctrl && !shift && code === 'Digit0') { focusList(); return true; }
|
|
@@ -747,7 +965,11 @@ function key(k) {
|
|
|
747
965
|
}
|
|
748
966
|
addEventListener('keydown', (e) => {
|
|
749
967
|
if (e.metaKey && key({ code: e.code, shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey })) e.preventDefault();
|
|
750
|
-
else if (e.key === 'Escape')
|
|
968
|
+
else if (e.key === 'Escape') {
|
|
969
|
+
if (sizing) endSize(false);
|
|
970
|
+
else if ($('keys').classList.contains('on')) keys(false);
|
|
971
|
+
else if (peek || pin) { const inside = sidein.contains(document.activeElement); setPeek(false); if (inside) $('sidebtn').focus(); }
|
|
972
|
+
}
|
|
751
973
|
});
|
|
752
974
|
// a pane's words: only from a frame that is one of our panes
|
|
753
975
|
addEventListener('message', (e) => {
|
|
@@ -756,7 +978,7 @@ addEventListener('message', (e) => {
|
|
|
756
978
|
const hit = [...panes.entries()].find(([, p]) => p.frame.contentWindow === e.source);
|
|
757
979
|
if (!hit) return;
|
|
758
980
|
const [k, p] = hit;
|
|
759
|
-
if (m.t === 'focus') { const i = cells.indexOf(k); if (i >= 0 && i !== cur) { cur = i; render(); } }
|
|
981
|
+
if (m.t === 'focus') { closeFlyout(); const i = cells.indexOf(k); if (i >= 0 && i !== cur) { cur = i; render(); } }
|
|
760
982
|
else if (m.t === 'title' && typeof m.text === 'string') { p.title = m.text; p.el.querySelector('.tt').textContent = m.text; const ph = p.el.querySelector('.ph'); ph.title = `${ph.title.split(' · ')[0]} · ${m.text}`; }
|
|
761
983
|
else if (m.t === 'close') { cells = cells.filter((x) => x !== k); render(); }
|
|
762
984
|
else if (m.t === 'key') key(m);
|
|
@@ -789,8 +1011,230 @@ for (const el of [$('top'), $('drag')]) {
|
|
|
789
1011
|
el.addEventListener('mousedown', (e) => { if (e.target === e.currentTarget && e.button === 0 && e.detail === 1) app({ t: 'drag' }); });
|
|
790
1012
|
el.addEventListener('dblclick', (e) => { if (e.target === e.currentTarget) app({ t: 'zoom' }); });
|
|
791
1013
|
}
|
|
1014
|
+
// --- sidebar: modes, flyout, resize, menu (§Sidebar collapse) ------------------------------
|
|
1015
|
+
const root = document.documentElement, sidein = $('sidein'), grip = $('grip'), menu = $('menu'), more = $('more');
|
|
1016
|
+
let railT = 0, peekT = 0, unpeekT = 0, snapT = 0, booted = false, sizeRaf = 0, railAnim = null, clickHold = 0;
|
|
1017
|
+
const reduceQ = matchMedia('(prefers-reduced-motion: reduce)');
|
|
1018
|
+
/** rows slide from where they were (FLIP, Y only) */
|
|
1019
|
+
function flipRows(change, ms) {
|
|
1020
|
+
const els = live(), t0 = new Map(els.map((el) => [el, el.getBoundingClientRect().top]));
|
|
1021
|
+
change();
|
|
1022
|
+
if (reduceQ.matches) return;
|
|
1023
|
+
for (const el of els) {
|
|
1024
|
+
const d = t0.get(el) - el.getBoundingClientRect().top;
|
|
1025
|
+
if (d) el.animate?.([{ transform: `translateY(${d}px)` }, { transform: 'none' }], { duration: ms, easing: 'cubic-bezier(.16,1,.3,1)' });
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
function applySide() {
|
|
1029
|
+
const m = sizing ? sizing.m : shownMode(), open = m === 'rail' && (peek || pin);
|
|
1030
|
+
for (const k of ['full', 'rail', 'hidden']) root.classList.toggle(`m-${k}`, m === k);
|
|
1031
|
+
root.classList.toggle('narrow', narrowQ.matches);
|
|
1032
|
+
root.classList.toggle('peek', open);
|
|
1033
|
+
root.classList.toggle('compact', compact);
|
|
1034
|
+
root.style.setProperty('--sidew', `${sizing ? sizing.w : sidew}px`);
|
|
1035
|
+
railRows(m === 'rail' && !open);
|
|
1036
|
+
$('sidebtn').setAttribute('aria-pressed', String(m === 'full' || open));
|
|
1037
|
+
const now = m === 'full' ? Math.round(sizing ? sizing.w : sidew) : m === 'rail' ? RAIL : 0;
|
|
1038
|
+
grip.setAttribute('aria-valuenow', String(now));
|
|
1039
|
+
}
|
|
1040
|
+
/** rows turn to icons once the panel has clipped to the rail; back to full rows at once, under the opening clip */
|
|
1041
|
+
function railRows(on) {
|
|
1042
|
+
clearTimeout(railT); railAnim?.cancel(); railAnim = null;
|
|
1043
|
+
const is = root.classList.contains('railrows');
|
|
1044
|
+
if (on === is) return;
|
|
1045
|
+
if (!booted || sizing) { root.classList.toggle('railrows', on); return; }
|
|
1046
|
+
// to full rows (flyout, mode): each row slides from its icon cell; clicks wait until they land
|
|
1047
|
+
if (!on) { clickHold = performance.now() + 170; flipRows(() => root.classList.remove('railrows'), 150); return; }
|
|
1048
|
+
// to icons: once the clip has closed, rows fade out, icons fade in
|
|
1049
|
+
const swap = () => {
|
|
1050
|
+
if (!root.classList.contains('m-rail') || root.classList.contains('peek')) return;
|
|
1051
|
+
root.classList.add('railrows');
|
|
1052
|
+
if (!reduceQ.matches) list.animate?.([{ opacity: 0 }, { opacity: 1 }], { duration: 120, easing: 'ease-out' });
|
|
1053
|
+
};
|
|
1054
|
+
if (reduceQ.matches) { swap(); return; }
|
|
1055
|
+
railT = setTimeout(() => {
|
|
1056
|
+
railAnim = list.animate?.([{ opacity: 1 }, { opacity: 0 }], { duration: 80, easing: 'ease-in', fill: 'forwards' }) ?? null;
|
|
1057
|
+
if (!railAnim) { swap(); return; }
|
|
1058
|
+
railAnim.onfinish = () => { swap(); railAnim?.cancel(); railAnim = null; };
|
|
1059
|
+
}, 200);
|
|
1060
|
+
}
|
|
1061
|
+
function setMode(m) {
|
|
1062
|
+
if (m !== 'full') { collapsedTo = m; store.set('hub.collapsed', m); }
|
|
1063
|
+
mode = m; store.set('hub.side', m);
|
|
1064
|
+
peek = false; pin = false;
|
|
1065
|
+
render();
|
|
1066
|
+
}
|
|
1067
|
+
function toggleSide() {
|
|
1068
|
+
// a narrow window has no room: ⌘\ pins the flyout over the stage
|
|
1069
|
+
if (narrowQ.matches && mode !== 'hidden') { pin = !pin; setPeek(pin); if (pin) focusList(); return; }
|
|
1070
|
+
setMode(mode === 'full' ? collapsedTo : 'full');
|
|
1071
|
+
}
|
|
1072
|
+
function setPeek(on) {
|
|
1073
|
+
clearTimeout(peekT);
|
|
1074
|
+
if (on && document.activeElement === grip) return;
|
|
1075
|
+
if (!on) pin = false;
|
|
1076
|
+
if (peek === on) { applySide(); return; }
|
|
1077
|
+
// reduced motion: no clip sweep, a short fade
|
|
1078
|
+
if (reduceQ.matches) sidein.animate?.([{ opacity: 0 }, { opacity: 1 }], { duration: 120, easing: 'ease-out' });
|
|
1079
|
+
peek = on;
|
|
1080
|
+
clearTimeout(unpeekT);
|
|
1081
|
+
root.classList.toggle('unpeek', !on);
|
|
1082
|
+
if (!on) unpeekT = setTimeout(() => root.classList.remove('unpeek'), 150);
|
|
1083
|
+
applySide();
|
|
1084
|
+
}
|
|
1085
|
+
const menuOpen = () => menu.matches(':popover-open');
|
|
1086
|
+
function closeFlyout() { if ((peek || pin) && !menuOpen()) setPeek(false); }
|
|
1087
|
+
// hover: 300 ms in opens, 250 ms out closes; the menu holds it open
|
|
1088
|
+
sidein.addEventListener('pointerenter', () => {
|
|
1089
|
+
if (shownMode() !== 'rail' || sizing || peek) { clearTimeout(peekT); return; }
|
|
1090
|
+
peekT = setTimeout(() => setPeek(true), 300);
|
|
1091
|
+
});
|
|
1092
|
+
sidein.addEventListener('pointerleave', () => {
|
|
1093
|
+
clearTimeout(peekT);
|
|
1094
|
+
if (peek && !pin) peekT = setTimeout(() => { if (!menuOpen()) setPeek(false); }, 250);
|
|
1095
|
+
});
|
|
1096
|
+
sidein.addEventListener('focusin', () => { if (shownMode() === 'rail' && !peek) setPeek(true); });
|
|
1097
|
+
sidein.addEventListener('focusout', (e) => {
|
|
1098
|
+
if (sidein.contains(e.relatedTarget) || menu.contains(e.relatedTarget) || menuOpen()) return;
|
|
1099
|
+
if (pin && e.relatedTarget === null) return;
|
|
1100
|
+
closeFlyout();
|
|
1101
|
+
});
|
|
1102
|
+
// a row picked from the flyout: its pane comes up, the flyout goes
|
|
1103
|
+
list.addEventListener('click', (e) => { if (performance.now() < clickHold) { e.stopPropagation(); e.preventDefault(); } }, true);
|
|
1104
|
+
list.addEventListener('click', (e) => { if (e.target.closest('.row') && !e.target.closest('button')) closeFlyout(); });
|
|
1105
|
+
narrowQ.addEventListener('change', () => { peek = false; pin = false; render(); });
|
|
1106
|
+
|
|
1107
|
+
// the grip: a drag follows the pointer 1:1 (GS-2); past a limit it resists (GS-13)
|
|
1108
|
+
const rubber = (x, dim = 100, c = 0.55) => (x * dim * c) / (dim + c * Math.abs(x));
|
|
1109
|
+
grip.addEventListener('pointerdown', (e) => {
|
|
1110
|
+
if (e.button !== 0 || sizing) return;
|
|
1111
|
+
const m0 = shownMode();
|
|
1112
|
+
sizing = { x0: e.clientX, w0: m0 === 'rail' ? RAIL : sidew, m0, id: e.pointerId, w: sidew, m: m0 };
|
|
1113
|
+
grip.setPointerCapture(e.pointerId);
|
|
1114
|
+
clearTimeout(peekT); peek = false; pin = false;
|
|
1115
|
+
root.classList.add('sizing');
|
|
1116
|
+
e.preventDefault();
|
|
1117
|
+
});
|
|
1118
|
+
grip.addEventListener('pointermove', (e) => {
|
|
1119
|
+
if (!sizing || e.pointerId !== sizing.id) return;
|
|
1120
|
+
const raw = sizing.w0 + e.clientX - sizing.x0, m0 = sizing.m;
|
|
1121
|
+
if (raw < HIDE) sizing.m = 'hidden';
|
|
1122
|
+
else if (raw < SNAP) sizing.m = 'rail';
|
|
1123
|
+
else {
|
|
1124
|
+
sizing.m = 'full';
|
|
1125
|
+
sizing.w = raw > WMAX ? WMAX + rubber(raw - WMAX) : raw < WMIN ? WMIN - rubber(WMIN - raw) : raw;
|
|
1126
|
+
}
|
|
1127
|
+
if (sizing.m !== m0) { root.classList.add('snap'); clearTimeout(snapT); snapT = setTimeout(() => root.classList.remove('snap'), 140); }
|
|
1128
|
+
if (!sizeRaf) sizeRaf = requestAnimationFrame(() => { sizeRaf = 0; if (sizing) applySide(); });
|
|
1129
|
+
});
|
|
1130
|
+
function endSize(keep) {
|
|
1131
|
+
if (!sizing) return;
|
|
1132
|
+
const s = sizing;
|
|
1133
|
+
sizing = null;
|
|
1134
|
+
cancelAnimationFrame(sizeRaf); sizeRaf = 0;
|
|
1135
|
+
if (grip.hasPointerCapture?.(s.id)) grip.releasePointerCapture(s.id);
|
|
1136
|
+
root.classList.remove('sizing', 'snap'); clearTimeout(snapT);
|
|
1137
|
+
if (!keep) { render(); return; }
|
|
1138
|
+
// a width past a limit settles back to it (200 ms)
|
|
1139
|
+
if (s.m === 'full') { sidew = clampW(s.w); store.set('hub.sidew', String(sidew)); }
|
|
1140
|
+
setMode(s.m);
|
|
1141
|
+
}
|
|
1142
|
+
grip.addEventListener('pointerup', (e) => { if (sizing && e.pointerId === sizing.id) endSize(true); });
|
|
1143
|
+
grip.addEventListener('pointercancel', () => endSize(false));
|
|
1144
|
+
grip.addEventListener('lostpointercapture', () => endSize(false));
|
|
1145
|
+
addEventListener('blur', () => endSize(false));
|
|
1146
|
+
grip.addEventListener('dblclick', () => { sidew = WDEF; store.set('hub.sidew', String(sidew)); setMode('full'); });
|
|
1147
|
+
grip.addEventListener('keydown', (e) => {
|
|
1148
|
+
const m = shownMode(), step = e.shiftKey ? 64 : 16;
|
|
1149
|
+
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
|
|
1150
|
+
const d = e.key === 'ArrowRight' ? step : -step;
|
|
1151
|
+
if (m === 'rail') { if (d > 0) setMode('full'); else setMode('hidden'); }
|
|
1152
|
+
else if (m === 'full') {
|
|
1153
|
+
if (sidew + d < WMIN) setMode('rail');
|
|
1154
|
+
else { sidew = clampW(sidew + d); store.set('hub.sidew', String(sidew)); render(); }
|
|
1155
|
+
}
|
|
1156
|
+
} else if (e.key === 'Home') setMode('rail');
|
|
1157
|
+
else if (e.key === 'End') { sidew = WMAX; store.set('hub.sidew', String(sidew)); setMode('full'); }
|
|
1158
|
+
else if (e.key === 'Enter') setMode(m === 'full' ? 'rail' : 'full');
|
|
1159
|
+
else return;
|
|
1160
|
+
e.preventDefault();
|
|
1161
|
+
requestAnimationFrame(() => { if (shownMode() !== 'hidden') grip.focus(); });
|
|
1162
|
+
});
|
|
1163
|
+
|
|
1164
|
+
// the menu: built on open, so it always says what each item does now
|
|
1165
|
+
const CHECK = '<svg class="ic ck" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7"/></svg>';
|
|
1166
|
+
const kbds = (ks) => `<span class="ks">${ks.map((k) => `<kbd>${k}</kbd>`).join('')}</span>`;
|
|
1167
|
+
function menuItems() {
|
|
1168
|
+
const m = shownMode(), secs = groupList().filter((g) => g.k !== 'needs');
|
|
1169
|
+
const allFolded = secs.length > 0 && secs.every((g) => folded(g.k, g.ids.length)), anyFolded = secs.some((g) => folded(g.k, g.ids.length));
|
|
1170
|
+
const narrow = narrowQ.matches;
|
|
1171
|
+
const out = [
|
|
1172
|
+
{ a: 'collapse', l: 'Collapse all', off: !secs.length || allFolded },
|
|
1173
|
+
{ a: 'expand', l: 'Expand all', off: !anyFolded },
|
|
1174
|
+
{ a: 'compact', l: 'Compact rows', check: compact },
|
|
1175
|
+
null,
|
|
1176
|
+
{ h: 'Group by' },
|
|
1177
|
+
...GROUPS.map(([k, l]) => ({ a: `group:${k}`, l, radio: groupBy === k })),
|
|
1178
|
+
null,
|
|
1179
|
+
];
|
|
1180
|
+
if (m === 'full') out.push({ a: 'rail', l: 'Icon rail', k: collapsedTo === 'rail' }, { a: 'hidden', l: 'Hide sidebar', k: collapsedTo === 'hidden' });
|
|
1181
|
+
else out.push({ a: 'full', l: narrow ? 'Show sessions' : 'Full sidebar', k: true }, m === 'rail' ? { a: 'hidden', l: 'Hide sidebar' } : null);
|
|
1182
|
+
if (sidew !== WDEF && !narrow) out.push({ a: 'reset', l: 'Reset width' });
|
|
1183
|
+
return out.filter((x, i, a) => x || (i > 0 && a[i - 1]));
|
|
1184
|
+
}
|
|
1185
|
+
function fillMenu() {
|
|
1186
|
+
menu.innerHTML = menuItems().map((x) => !x ? '<hr>' : x.h ? `<div class="mh" role="presentation">${esc(x.h)}</div>`
|
|
1187
|
+
: `<button type="button" role="${'radio' in x ? 'menuitemradio' : 'check' in x ? 'menuitemcheckbox' : 'menuitem'}" data-a="${x.a}"${'check' in x || 'radio' in x ? ` aria-checked="${x.check ?? x.radio}"` : ''}${x.off ? ' disabled' : ''}>${'check' in x || 'radio' in x ? CHECK : '<span class="ck"></span>'}${esc(x.l)}${x.k ? kbds(['⌘', '\\']) : ''}</button>`).join('');
|
|
1188
|
+
}
|
|
1189
|
+
// placed before the first paint: anchored by its bottom edge, so no measure is needed
|
|
1190
|
+
menu.addEventListener('beforetoggle', (e) => {
|
|
1191
|
+
if (e.newState !== 'open') return;
|
|
1192
|
+
fillMenu();
|
|
1193
|
+
const r = more.getBoundingClientRect(), byRight = r.right > 216; // room for the 200 px menu to its left
|
|
1194
|
+
Object.assign(menu.style, { top: 'auto', bottom: `${innerHeight - r.top + 6}px`, left: byRight ? 'auto' : `${Math.max(8, r.left)}px`, right: byRight ? `${Math.max(8, innerWidth - r.right)}px` : 'auto' });
|
|
1195
|
+
menu.style.setProperty('--org', `${byRight ? 'right' : 'left'} bottom`);
|
|
1196
|
+
});
|
|
1197
|
+
menu.addEventListener('toggle', (e) => {
|
|
1198
|
+
const open = e.newState === 'open';
|
|
1199
|
+
more.setAttribute('aria-expanded', String(open));
|
|
1200
|
+
if (open) { menu.querySelector('button:not(:disabled)')?.focus(); return; }
|
|
1201
|
+
if (peek && !pin) {
|
|
1202
|
+
clearTimeout(peekT);
|
|
1203
|
+
peekT = setTimeout(() => { if (!sidein.matches(':hover') && !sidein.contains(document.activeElement) && !menuOpen()) setPeek(false); }, 250);
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
menu.addEventListener('keydown', (e) => {
|
|
1207
|
+
const all = [...menu.querySelectorAll('button:not(:disabled)')], at = all.indexOf(document.activeElement);
|
|
1208
|
+
const to = e.key === 'ArrowDown' ? all[(at + 1) % all.length] : e.key === 'ArrowUp' ? all[(at - 1 + all.length) % all.length]
|
|
1209
|
+
: e.key === 'Home' ? all[0] : e.key === 'End' ? all[all.length - 1] : null;
|
|
1210
|
+
if (to) { e.preventDefault(); to.focus(); }
|
|
1211
|
+
});
|
|
1212
|
+
menu.addEventListener('click', (e) => {
|
|
1213
|
+
const a = e.target.closest('button')?.dataset.a;
|
|
1214
|
+
if (!a) return;
|
|
1215
|
+
menu.hidePopover();
|
|
1216
|
+
if (a === 'collapse' || a === 'expand') foldAll(a === 'collapse');
|
|
1217
|
+
else if (a === 'compact') setCompact(!compact);
|
|
1218
|
+
else if (a.startsWith('group:')) { groupBy = a.slice(6); store.set('hub.group', groupBy); renderRows(); }
|
|
1219
|
+
else if (a === 'reset') { sidew = WDEF; store.set('hub.sidew', String(sidew)); setMode('full'); }
|
|
1220
|
+
else if (a === 'full' && narrowQ.matches) { pin = true; setPeek(true); }
|
|
1221
|
+
else setMode(a);
|
|
1222
|
+
if (e.detail === 0 && more.offsetParent && shownMode() !== 'hidden') more.focus(); else more.blur();
|
|
1223
|
+
});
|
|
1224
|
+
/** compact rows: lines fade (100 ms), then rows slide to their new places (FLIP 200 ms) */
|
|
1225
|
+
function setCompact(on) {
|
|
1226
|
+
compact = on; store.set('hub.compact', on ? '1' : '0');
|
|
1227
|
+
if (on) {
|
|
1228
|
+
root.classList.add('compacting');
|
|
1229
|
+
setTimeout(() => { flipRows(() => root.classList.toggle('compact', compact), 200); root.classList.remove('compacting'); }, 100);
|
|
1230
|
+
} else {
|
|
1231
|
+
flipRows(() => { root.classList.add('compacting'); root.classList.remove('compact'); }, 200);
|
|
1232
|
+
requestAnimationFrame(() => requestAnimationFrame(() => root.classList.remove('compacting')));
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
792
1235
|
new ResizeObserver(() => render()).observe(stage);
|
|
793
1236
|
render();
|
|
1237
|
+
booted = true;
|
|
794
1238
|
app({ t: 'ready' });
|
|
795
1239
|
</script>
|
|
796
1240
|
</body>
|