@songsid/agend 2.4.0-beta.1 → 2.4.0-beta.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/dist/build-provenance.json +1 -1
- package/dist/daemon.js +2 -1
- package/dist/daemon.js.map +1 -1
- package/dist/delivery-consumed-watch.d.ts +2 -0
- package/dist/delivery-consumed-watch.js +1 -1
- package/dist/delivery-consumed-watch.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +3 -2
- package/dist/hub/http/compose.js +22 -3
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/http/schema.js +2 -0
- package/dist/hub/http/schema.js.map +1 -1
- package/dist/hub/person-prefs.d.ts +22 -0
- package/dist/hub/person-prefs.js +34 -0
- package/dist/hub/person-prefs.js.map +1 -0
- package/dist/transcript-needles.d.ts +4 -2
- package/dist/transcript-needles.js +35 -4
- package/dist/transcript-needles.js.map +1 -1
- package/dist/ui/hub-client.js +5 -0
- package/dist/ui/hub-room-favorites.js +63 -5
- package/dist/ui/panel-hub.js +3 -1
- package/dist/ui/shared/app-shell.js +37 -3
- package/package.json +1 -1
|
@@ -13,9 +13,10 @@ export declare function markerConsumed(kind: TranscriptMarkerKind | null | undef
|
|
|
13
13
|
export declare function transcriptDeltaDeliveryMarker(rawDelta: string, backend: string, deliveryId: string): TranscriptMarkerKind | null;
|
|
14
14
|
/**
|
|
15
15
|
* #3030: the same reading for any unique leading marker — a delivery's `[agend-delivery-id:…]` or a person's
|
|
16
|
-
* `[hid:…] / [agend-human-id:…]` (both lead the pasted body).
|
|
16
|
+
* `[hid:…] / [agend-human-id:…]` (both lead the pasted body). With `wire` (the exact text pasted), also a message the
|
|
17
|
+
* CLI merged into one user entry with others (#3898, mergedWithWire).
|
|
17
18
|
*/
|
|
18
|
-
export declare function transcriptDeltaMarkerKind(rawDelta: string, backend: string, marker: string): TranscriptMarkerKind | null;
|
|
19
|
+
export declare function transcriptDeltaMarkerKind(rawDelta: string, backend: string, marker: string, wire?: string): TranscriptMarkerKind | null;
|
|
19
20
|
/**
|
|
20
21
|
* What a transcript proof looks for: an enveloped delivery's id marker (a delivery id string), or — for a raw paste,
|
|
21
22
|
* which carries no envelope (a silent schedule, a system command) — its exact text (#1647).
|
|
@@ -24,6 +25,7 @@ export type TranscriptNeedle = string | {
|
|
|
24
25
|
readonly rawText: string;
|
|
25
26
|
} | {
|
|
26
27
|
readonly marker: string;
|
|
28
|
+
readonly wire?: string;
|
|
27
29
|
};
|
|
28
30
|
/**
|
|
29
31
|
* #1647: a raw paste's exact text as a user entry of the CLI's own — a message that, whitespace aside and without Claude
|
|
@@ -61,11 +61,39 @@ function claudeAbsorbedText(value) {
|
|
|
61
61
|
export function transcriptDeltaDeliveryMarker(rawDelta, backend, deliveryId) {
|
|
62
62
|
return transcriptDeltaMarkerKind(rawDelta, backend, ENTER_MARKER(deliveryId));
|
|
63
63
|
}
|
|
64
|
+
/** AgEnD's own lead markers: a delivery's `[agend-delivery-id:…]`, a person's `[hid:…]` or `[agend-human-id:…]`. */
|
|
65
|
+
const AGEND_LEAD_MARKER = /^\[(?:agend-(?:delivery|human)-id|hid):[^\]\r\n]+\]/;
|
|
66
|
+
/**
|
|
67
|
+
* #3898: queued messages the CLI merged into ONE user entry. Claude Code re-sends a turn whose request had no answer
|
|
68
|
+
* yet with a message queued meanwhile appended (2.1.325: `…</pasted_content id="…">\n\n[hid:…]…`, one entry); Codex
|
|
69
|
+
* 0.16x submitted several queued messages as one input_text, back to back (`…)[agend-delivery-id:…]`). A later message's
|
|
70
|
+
* marker then never leads the entry. It counts only where the entry is AgEnD's own (it leads with one of AgEnD's
|
|
71
|
+
* markers) and holds this message's exact pasted text, whole — its unique marker with every byte after it — ending
|
|
72
|
+
* the entry or followed by whitespace or the next piece (`[`, `<`). A marker alone inside a body (a quote) never does.
|
|
73
|
+
*/
|
|
74
|
+
function mergedWithWire(texts, backend, marker, wire) {
|
|
75
|
+
const whole = wire.trimEnd();
|
|
76
|
+
const first = texts[0];
|
|
77
|
+
if (first === undefined || !whole.startsWith(marker))
|
|
78
|
+
return false;
|
|
79
|
+
const opened = backend === "claude-code" ? CLAUDE_PASTE_WRAPPER.exec(first) : null;
|
|
80
|
+
if (!AGEND_LEAD_MARKER.test(first.slice(opened ? opened[0].length : 0)))
|
|
81
|
+
return false;
|
|
82
|
+
return texts.some((text, block) => {
|
|
83
|
+
for (let at = text.indexOf(whole, block === 0 ? 1 : 0); at >= 0; at = text.indexOf(whole, at + 1)) {
|
|
84
|
+
const next = text.charAt(at + whole.length);
|
|
85
|
+
if (next === "" || /\s/.test(next) || next === "[" || next === "<")
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
64
91
|
/**
|
|
65
92
|
* #3030: the same reading for any unique leading marker — a delivery's `[agend-delivery-id:…]` or a person's
|
|
66
|
-
* `[hid:…] / [agend-human-id:…]` (both lead the pasted body).
|
|
93
|
+
* `[hid:…] / [agend-human-id:…]` (both lead the pasted body). With `wire` (the exact text pasted), also a message the
|
|
94
|
+
* CLI merged into one user entry with others (#3898, mergedWithWire).
|
|
67
95
|
*/
|
|
68
|
-
export function transcriptDeltaMarkerKind(rawDelta, backend, marker) {
|
|
96
|
+
export function transcriptDeltaMarkerKind(rawDelta, backend, marker, wire) {
|
|
69
97
|
let queued = false;
|
|
70
98
|
let absorbed = false;
|
|
71
99
|
for (const line of rawDelta.split(/\r?\n/)) {
|
|
@@ -73,9 +101,12 @@ export function transcriptDeltaMarkerKind(rawDelta, backend, marker) {
|
|
|
73
101
|
continue;
|
|
74
102
|
try {
|
|
75
103
|
const entry = JSON.parse(line);
|
|
76
|
-
const
|
|
104
|
+
const userTexts = userTextsFromEntry(entry, backend);
|
|
105
|
+
const firstUserText = userTexts[0];
|
|
77
106
|
if (firstUserText !== undefined && leadsWithMarker(firstUserText, backend, marker))
|
|
78
107
|
return "user";
|
|
108
|
+
if (wire !== undefined && mergedWithWire(userTexts, backend, marker, wire))
|
|
109
|
+
return "user";
|
|
79
110
|
const value = entry;
|
|
80
111
|
if (backend !== "claude-code" || !value || typeof value !== "object")
|
|
81
112
|
continue;
|
|
@@ -153,7 +184,7 @@ export function transcriptDeltaNeedle(rawDelta, backend, needle) {
|
|
|
153
184
|
if (typeof needle === "string")
|
|
154
185
|
return transcriptDeltaDeliveryMarker(rawDelta, backend, needle);
|
|
155
186
|
if ("marker" in needle)
|
|
156
|
-
return transcriptDeltaMarkerKind(rawDelta, backend, needle.marker);
|
|
187
|
+
return transcriptDeltaMarkerKind(rawDelta, backend, needle.marker, needle.wire);
|
|
157
188
|
return transcriptDeltaHasRawText(rawDelta, backend, needle.rawText) ? "user" : null;
|
|
158
189
|
}
|
|
159
190
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-needles.js","sourceRoot":"","sources":["../src/transcript-needles.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,sBAAsB,UAAU,GAAG,CAAC;AACjF,SAAS,kBAAkB,CAAC,KAAc,EAAE,OAAe;IACzD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACnD,MAAM,KAAK,GAAG,KAA4B,CAAC;IAC3C,IAAI,OAAO,KAAK,aAAa,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,EAAE,IAAI,KAAK,MAAM;YAAE,OAAO,EAAE,CAAC;QACjE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAChC,IAAI,OAAO,OAAO,KAAK,QAAQ;YAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KA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K,CAAC,IAAI,CAAY,EAAE,OAAO,CAAC,CAAC;YAChE,IAAI,IAAI,KAAK,IAAI,IAAI,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAC;QACrG,CAAC;QAAC,MAAM,CAAC,CAAC,6CAA6C,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAE,OAAe,EAAE,MAAwB;IAC/F,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,6BAA6B,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChG,IAAI,QAAQ,IAAI,MAAM;QAAE,OAAO,yBAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACxG,OAAO,yBAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACtF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAAC,QAAgB,EAAE,OAAe,EAAE,UAAkB;IACpG,OAAO,cAAc,CAAC,6BAA6B,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AACtF,CAAC"}
|
package/dist/ui/hub-client.js
CHANGED
|
@@ -361,6 +361,11 @@ export function createHubWebClient({ fetchImpl = (...a) => fetch(...a), readTime
|
|
|
361
361
|
async session() { const r = await call("GET", "/hub/v1/session"); if (r.ok) { csrf = r.signedIn ? r.csrf || null : null; codeNotices = r.signedIn === true && r.features?.includes("enrolment-code-v1") === true; roomsLive = r.signedIn === true && r.features?.includes(ROOMS_FEATURE) === true; teamsLive = r.signedIn === true && r.features?.includes(TEAMS_FEATURE) === true; } return r; },
|
|
362
362
|
async signIn(login, password) { retireReads(); teamsLive = false; const r = await call("POST", "/hub/v1/session", { login, password }); if (r.ok) { csrf = r.csrf || null; codeNotices = r.features?.includes("enrolment-code-v1") === true; roomsLive = r.features?.includes(ROOMS_FEATURE) === true; teamsLive = r.features?.includes(TEAMS_FEATURE) === true; } return r; },
|
|
363
363
|
async signOut() { retireReads(); const r = await call("DELETE", "/hub/v1/session"); csrf = null; codeNotices = false; roomsLive = false; teamsLive = false; return r; },
|
|
364
|
+
// A source captures the session CSRF: a queued write from a previous sign-in cannot use the new person's cookie.
|
|
365
|
+
personPrefs(sessionCsrf) { return sessionCsrf && sessionCsrf === csrf ? call("GET", "/hub/v1/me/prefs") : Promise.resolve(retired()); },
|
|
366
|
+
savePersonPrefs(sessionCsrf, favorites, onlyIfUnset = false) {
|
|
367
|
+
return sessionCsrf && sessionCsrf === csrf ? call("PUT", "/hub/v1/me/prefs", { favorites, onlyIfUnset }) : Promise.resolve(retired());
|
|
368
|
+
},
|
|
364
369
|
catalog() { return call("GET", "/hub/v1/exposures"); },
|
|
365
370
|
sharingPauseV1: true,
|
|
366
371
|
sharing(exposureId, revision, sharingEpoch, paused) { return call("POST", `/hub/v1/exposures/${id(exposureId)}/sharing`, { revision, sharingEpoch, paused }); },
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
// 「最愛」 above 「房間」 and 「Agent」 in the order they were starred (or moved in Edit), at most MAX_FAVORITES, and one that
|
|
4
4
|
// is gone from the list (left, removed) is dropped on the next change, never shown.
|
|
5
5
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// apart); another tab follows through the storage event. A Hub-side store replaces the source, not this module's rules.
|
|
6
|
+
// A Hub with person-prefs-v1 keeps them per directory person. This browser's old list seeds an unset Hub record once;
|
|
7
|
+
// an older Hub still uses local storage. The source changes, not the list's rules.
|
|
9
8
|
import { useEffect, useState } from "/assets/app-html.js";
|
|
10
9
|
import { createStore, useStore } from "/assets/app-store.js";
|
|
11
10
|
import { MAX_FAVORITES } from "/assets/instance-nav.js";
|
|
@@ -36,9 +35,68 @@ export const localFavoritesSource = {
|
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
let source = localFavoritesSource;
|
|
39
|
-
/** Tests
|
|
38
|
+
/** Tests swap where favourites are kept. */
|
|
40
39
|
export function setFavoritesSource(next) { source = next || localFavoritesSource; }
|
|
41
40
|
|
|
41
|
+
/** A session-owned cache: serialized writes, first-write migration, and refresh on focus or another tab's write. */
|
|
42
|
+
export function createHubFavoritesSource(client, session) {
|
|
43
|
+
let ids = [], ready = false, active = false, pending = null, writing = null, refreshing = null, revision = 0, edits = 0;
|
|
44
|
+
let changed = () => {};
|
|
45
|
+
const apply = (out) => {
|
|
46
|
+
if (!active || !out.ok || !Number.isSafeInteger(out.revision) || out.revision < revision) return;
|
|
47
|
+
revision = out.revision; ids = cleanIds(out.favorites); ready = true;
|
|
48
|
+
localFavoritesSource.write(session.login, ids);
|
|
49
|
+
changed();
|
|
50
|
+
};
|
|
51
|
+
const drain = () => writing ??= (async () => {
|
|
52
|
+
while (active && ready && pending) {
|
|
53
|
+
const sent = pending;
|
|
54
|
+
let out;
|
|
55
|
+
try { out = await client.savePersonPrefs(session.csrf, sent); } catch { break; }
|
|
56
|
+
if (!active || !out.ok) break; // retain the pending change for focus/the next edit
|
|
57
|
+
if (pending === sent) { pending = null; apply(out); }
|
|
58
|
+
else revision = Math.max(revision, out.revision || 0);
|
|
59
|
+
}
|
|
60
|
+
})().finally(() => { writing = null; });
|
|
61
|
+
const refresh = () => refreshing ??= (async () => {
|
|
62
|
+
await drain();
|
|
63
|
+
if (!active || pending) return;
|
|
64
|
+
const before = edits;
|
|
65
|
+
let out;
|
|
66
|
+
try {
|
|
67
|
+
out = await client.personPrefs(session.csrf);
|
|
68
|
+
if (!active || !out.ok || edits !== before) return;
|
|
69
|
+
if (!out.initialized) out = await client.savePersonPrefs(session.csrf, localFavoritesSource.read(session.login), true);
|
|
70
|
+
} catch { return; }
|
|
71
|
+
if (edits === before) apply(out);
|
|
72
|
+
})().finally(() => { refreshing = null; });
|
|
73
|
+
return {
|
|
74
|
+
ready: () => ready,
|
|
75
|
+
read: () => ids,
|
|
76
|
+
write(_login, value) { ids = cleanIds(value); pending = ids; edits++; void drain(); },
|
|
77
|
+
watch(_login, onChange) {
|
|
78
|
+
active = true; changed = onChange;
|
|
79
|
+
const unwatch = localFavoritesSource.watch(session.login, () => { void refresh(); });
|
|
80
|
+
const focus = () => { void refresh(); };
|
|
81
|
+
globalThis.addEventListener?.("focus", focus);
|
|
82
|
+
void refresh();
|
|
83
|
+
return () => { active = false; changed = () => {}; unwatch(); globalThis.removeEventListener?.("focus", focus); };
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let configuredClient, configuredCsrf;
|
|
89
|
+
/** Called by the session owner; optional from the shell so an older cached module still loads. */
|
|
90
|
+
export function configureHubFavorites(client, session) {
|
|
91
|
+
const remote = session?.features?.includes("person-prefs-v1") && typeof client.personPrefs === "function" && typeof client.savePersonPrefs === "function";
|
|
92
|
+
const csrf = remote ? session.csrf : null;
|
|
93
|
+
if (configuredClient === client && configuredCsrf === csrf) return;
|
|
94
|
+
configuredClient = client; configuredCsrf = csrf;
|
|
95
|
+
loadFavorites(null); // retire the previous person's listener and late responses
|
|
96
|
+
source = remote ? createHubFavoritesSource(client, session) : localFavoritesSource;
|
|
97
|
+
loadFavorites(session?.login);
|
|
98
|
+
}
|
|
99
|
+
|
|
42
100
|
/** { login, ids }: whose favourites are loaded, and their ids in order. */
|
|
43
101
|
export const favoritesStore = createStore({ login: null, ids: [] });
|
|
44
102
|
let unwatch = () => {};
|
|
@@ -83,7 +141,7 @@ export function useRoomStar(rooms, login) {
|
|
|
83
141
|
const fav = useStore(favoritesStore);
|
|
84
142
|
const [editing, setEditing] = useState(false);
|
|
85
143
|
useEffect(() => { loadFavorites(login); }, [login]);
|
|
86
|
-
if (!login || fav.login !== login) return null;
|
|
144
|
+
if (!login || fav.login !== login || source.ready?.(login) === false) return null;
|
|
87
145
|
const known = new Set((Array.isArray(rooms) ? rooms : []).map((r) => r && r.id).filter(Boolean));
|
|
88
146
|
return { ids: liveFavorites(known, fav.ids), editing, setEditing,
|
|
89
147
|
toggle: (id) => toggleFavorite(id, known), move: (id, delta) => moveFavorite(id, delta, known) };
|
package/dist/ui/panel-hub.js
CHANGED
|
@@ -35,7 +35,8 @@ import { compareGroups, hubClient } from "./hub-client.js";
|
|
|
35
35
|
import { hw, linkHubCss } from "./hub-strings.js";
|
|
36
36
|
import { hc, linkHubChatCss } from "./hub-chat-strings.js";
|
|
37
37
|
import { HubRoomRows, readRoomList } from "./hub-room-list.js";
|
|
38
|
-
import
|
|
38
|
+
import * as roomFavorites from "./hub-room-favorites.js";
|
|
39
|
+
const { useRoomStar } = roomFavorites;
|
|
39
40
|
import { HubRoomPage } from "./hub-room-thread.js";
|
|
40
41
|
import { hroom } from "./hub-room-strings.js";
|
|
41
42
|
import { hr } from "./hub-read-strings.js";
|
|
@@ -102,6 +103,7 @@ const sessionSubs = new Set();
|
|
|
102
103
|
function setSession(next) {
|
|
103
104
|
const was = session;
|
|
104
105
|
session = next;
|
|
106
|
+
roomFavorites.configureHubFavorites?.(hubClient(), next);
|
|
105
107
|
// #3226 B: the conversation list is this person's: cleared when no one is signed in, read again when someone is.
|
|
106
108
|
if (!next) roomsStore.set({ loaded: false, rooms: [], error: null });
|
|
107
109
|
else if (!was || was.login !== next.login) void refreshRooms();
|
|
@@ -1215,6 +1215,35 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
1215
1215
|
// in has lost focus or left the page (a composition can end without its compositionend: #2517 review).
|
|
1216
1216
|
let width = -1, tallest = 0, held = false, lowest = 0, upLowest = 0, composing = null;
|
|
1217
1217
|
const coarse = () => typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches;
|
|
1218
|
+
// M-3111 (iPhone, alpha.4): with the keyboard up, and while it rises or falls, the shell is the visible view itself —
|
|
1219
|
+
// its height and where the browser has panned it, set on the shell itself only then (its stylesheet height otherwise:
|
|
1220
|
+
// no transform the rest of the time, so nothing fixed inside it moves; a browser without dvh is untouched). The page's own height
|
|
1221
|
+
// (100dvh) is not that view then: iOS (under this page's interactive-widget=resizes-content) sized it a toolbar short of
|
|
1222
|
+
// the keyboard, so the page's background showed between the composer and the keyboard, and on the way down it stayed
|
|
1223
|
+
// short until the keyboard had gone, then snapped. Pinch-zoomed, the view is not the screen: nothing is set then.
|
|
1224
|
+
// The keyboard rises and falls over a few hundred ms, and the view's resize comes when it has settled (iOS): for that
|
|
1225
|
+
// long after a field gains or loses focus the shell follows the view every frame — both ways — instead of jumping.
|
|
1226
|
+
const FOLLOW_MS = 800;
|
|
1227
|
+
let raf = 0, followUntil = 0;
|
|
1228
|
+
const now = () => (typeof performance !== "undefined" ? performance.now() : Date.now());
|
|
1229
|
+
const frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : null;
|
|
1230
|
+
const unfit = (el) => { if (el?.style) { el.style.removeProperty("height"); el.style.removeProperty("transform"); } };
|
|
1231
|
+
const fit = () => {
|
|
1232
|
+
const el = root.current;
|
|
1233
|
+
if (!el?.style) return;
|
|
1234
|
+
const on = coarse() && (shellStore.get().keyboard || now() < followUntil) && Math.abs((Number(vv.scale) || 1) - 1) < 0.01;
|
|
1235
|
+
if (!on) { unfit(el); return; }
|
|
1236
|
+
el.style.setProperty("height", `${Math.round(vv.height)}px`);
|
|
1237
|
+
const top = Math.max(0, Math.round(Number(vv.offsetTop) || 0));
|
|
1238
|
+
if (top) el.style.setProperty("transform", `translateY(${top}px)`); else el.style.removeProperty("transform");
|
|
1239
|
+
};
|
|
1240
|
+
const follow = () => {
|
|
1241
|
+
if (!frame || !coarse()) return;
|
|
1242
|
+
followUntil = now() + FOLLOW_MS;
|
|
1243
|
+
if (raf) return;
|
|
1244
|
+
const step = () => { raf = 0; check(); if (now() < followUntil) raf = frame(step); };
|
|
1245
|
+
raf = frame(step);
|
|
1246
|
+
};
|
|
1218
1247
|
const check = () => {
|
|
1219
1248
|
if (composing && composing.isConnected !== false && document.activeElement === composing) return;
|
|
1220
1249
|
composing = null;
|
|
@@ -1234,17 +1263,22 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
1234
1263
|
if (!up && was && typing && h - upLowest <= KEYBOARD_MIN_PX) up = true; // a bar's height, not the keyboard
|
|
1235
1264
|
upLowest = up ? (was ? Math.min(upLowest, h) : h) : 0;
|
|
1236
1265
|
if (up !== was) shellStore.set({ keyboard: up });
|
|
1266
|
+
fit();
|
|
1237
1267
|
};
|
|
1268
|
+
const focusChanged = () => { check(); follow(); };
|
|
1238
1269
|
const start = (e) => { composing = (e && e.target) || document.activeElement || null; };
|
|
1239
1270
|
const end = () => { composing = null; check(); };
|
|
1240
1271
|
check();
|
|
1241
1272
|
vv.addEventListener("resize", check);
|
|
1242
|
-
|
|
1243
|
-
document.addEventListener("
|
|
1273
|
+
vv.addEventListener("scroll", fit);
|
|
1274
|
+
document.addEventListener("focusin", focusChanged);
|
|
1275
|
+
document.addEventListener("focusout", focusChanged);
|
|
1244
1276
|
document.addEventListener("compositionstart", start, true);
|
|
1245
1277
|
document.addEventListener("compositionend", end, true);
|
|
1246
1278
|
return () => {
|
|
1247
|
-
vv.removeEventListener("resize", check); document.removeEventListener("focusin",
|
|
1279
|
+
vv.removeEventListener("resize", check); vv.removeEventListener("scroll", fit); document.removeEventListener("focusin", focusChanged); document.removeEventListener("focusout", focusChanged);
|
|
1280
|
+
if (raf && typeof cancelAnimationFrame === "function") cancelAnimationFrame(raf);
|
|
1281
|
+
unfit(root.current);
|
|
1248
1282
|
document.removeEventListener("compositionstart", start, true); document.removeEventListener("compositionend", end, true);
|
|
1249
1283
|
};
|
|
1250
1284
|
}, []);
|