@songsid/agend 2.4.0-beta.6 → 2.4.0-beta.7
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/agent-cli-instructions.md +2 -0
- package/dist/app-message-origin.d.ts +2 -0
- package/dist/app-message-origin.js +3 -0
- package/dist/app-message-origin.js.map +1 -0
- package/dist/auth-api.js +2 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend-availability.d.ts +22 -0
- package/dist/backend-availability.js +71 -2
- package/dist/backend-availability.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/adapters/telegram.d.ts +2 -0
- package/dist/channel/adapters/telegram.js +3 -0
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/cli-capability.d.ts +3 -0
- package/dist/cli-capability.js.map +1 -1
- package/dist/cli-registry-check.js +1 -1
- package/dist/cli-registry-check.js.map +1 -1
- package/dist/cli-registry.d.ts +1 -0
- package/dist/cli-spec-antigravity.d.ts +1 -0
- package/dist/cli-spec-antigravity.js +3 -1
- package/dist/cli-spec-antigravity.js.map +1 -1
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/connect/control.d.ts +20 -0
- package/dist/connect/control.js +236 -0
- package/dist/connect/control.js.map +1 -0
- package/dist/connect/install.d.ts +13 -0
- package/dist/connect/install.js +12 -0
- package/dist/connect/install.js.map +1 -0
- package/dist/connect/protocol.d.ts +38 -0
- package/dist/connect/protocol.js +36 -0
- package/dist/connect/protocol.js.map +1 -0
- package/dist/connect/service.d.ts +19 -0
- package/dist/connect/service.js +79 -0
- package/dist/connect/service.js.map +1 -0
- package/dist/connect/stdio-entry.d.ts +1 -0
- package/dist/connect/stdio-entry.js +6 -0
- package/dist/connect/stdio-entry.js.map +1 -0
- package/dist/connect/stdio.d.ts +5 -0
- package/dist/connect/stdio.js +39 -0
- package/dist/connect/stdio.js.map +1 -0
- package/dist/daemon.js +2 -0
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +12 -1
- package/dist/fleet-manager.js +75 -11
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.js +4 -2
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +2 -0
- package/dist/general-knowledge/skills/web-dashboard/SKILL.md +15 -1
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +2 -0
- package/dist/hub/group-policy/model.d.ts +23 -0
- package/dist/hub/group-policy/model.js +3 -3
- package/dist/hub/group-policy/model.js.map +1 -1
- package/dist/hub/group-policy/store.js +3 -3
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/team-subjects.d.ts +1 -1
- package/dist/hub/group-policy/team-subjects.js +1 -1
- package/dist/hub/group-policy/team-subjects.js.map +1 -1
- package/dist/hub/http/compose.js +3 -0
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/roles/change.js +4 -0
- package/dist/hub/roles/change.js.map +1 -1
- package/dist/hub/roles/convert.js +1 -1
- package/dist/hub/roles/convert.js.map +1 -1
- package/dist/hub/roles/delegation.js +4 -0
- package/dist/hub/roles/delegation.js.map +1 -1
- package/dist/hub/roles/evaluate.d.ts +2 -1
- package/dist/hub/roles/evaluate.js +14 -0
- package/dist/hub/roles/evaluate.js.map +1 -1
- package/dist/hub/roles/model.d.ts +23 -0
- package/dist/hub/roles/model.js +7 -2
- package/dist/hub/roles/model.js.map +1 -1
- package/dist/human-delivery-receipts.js +8 -0
- package/dist/human-delivery-receipts.js.map +1 -1
- package/dist/instructions.js +3 -0
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +50 -0
- package/dist/locale.js.map +1 -1
- package/dist/runtime-personal-answer.d.ts +25 -0
- package/dist/runtime-personal-answer.js +115 -0
- package/dist/runtime-personal-answer.js.map +1 -0
- package/dist/runtime-personal-profile.d.ts +34 -0
- package/dist/runtime-personal-profile.js +61 -0
- package/dist/runtime-personal-profile.js.map +1 -0
- package/dist/settings-api.js +5 -0
- package/dist/settings-api.js.map +1 -1
- package/dist/tool-progress.d.ts +9 -0
- package/dist/tool-progress.js +141 -32
- package/dist/tool-progress.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +2 -2
- package/dist/turn-reply-guard.js +3 -3
- package/dist/turn-reply-guard.js.map +1 -1
- package/dist/ui/fleet-office-skin.js +1 -1
- package/dist/ui/hub-quick-pairing.js +7 -2
- package/dist/ui/panel-settings.js +2 -1
- package/dist/ui/settings-connector-strings.js +23 -0
- package/dist/ui/settings-connector.js +39 -0
- package/dist/ui/shared/app-shell.js +6 -4
- package/dist/ui/shared/app-themes.js +2 -2
- package/dist/ui/shared/app.css +207 -139
- package/dist/ui/shared/chat-thread.js +3 -3
- package/dist/ui/shared/chat-work-bar.css +9 -1
- package/dist/ui/shared/connector-prompt.d.ts +2 -0
- package/dist/ui/shared/connector-prompt.js +10 -0
- package/dist/ui/shared/hub-chat.css +1 -1
- package/dist/ui/shared/hub-owner.css +1 -1
- package/dist/ui/shared/hub.css +5 -0
- package/dist/ui/shared/image-lightbox.js +35 -10
- package/dist/ui/shared/image-zoom.js +61 -9
- package/dist/ui/shared/instance-nav.js +35 -6
- package/dist/ui/shared/settings-connector.css +7 -0
- package/dist/ui/shared/theme.js +52 -0
- package/dist/ui/shared/tokens.css +27 -10
- package/dist/ui/shared/view-strings.js +6 -0
- package/dist/web-icons.js +3 -3
- package/dist/web-icons.js.map +1 -1
- package/dist/web-theme.js +2 -2
- package/package.json +1 -1
|
@@ -944,15 +944,15 @@ export function createThread(list, scroller, opts) {
|
|
|
944
944
|
setTimeout(() => { button.textContent = was; }, 1200);
|
|
945
945
|
}
|
|
946
946
|
/**
|
|
947
|
-
* A chat image: a plain left click (or Enter on it) shows it in the page — this
|
|
948
|
-
* clicked. With a modifier key the link does what the browser does (a new tab, a new window, a download); a middle
|
|
947
|
+
* A chat image: a plain left click (or Enter on it) shows it in the page — M-3210: every image in this chat's thread,
|
|
948
|
+
* in message order, from the one clicked (it was this message's alone). With a modifier key the link does what the browser does (a new tab, a new window, a download); a middle
|
|
949
949
|
* click is not a click event at all. True when it was an image (whether or not it opened).
|
|
950
950
|
*/
|
|
951
951
|
function onImageClick(e) {
|
|
952
952
|
const img = e.target && e.target.closest ? e.target.closest("a.att-img") : null;
|
|
953
953
|
if (!img || !list.contains(img)) return false;
|
|
954
954
|
if (opts.openImage && !e.defaultPrevented && (e.button ?? 0) === 0 && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey) {
|
|
955
|
-
const links = [...
|
|
955
|
+
const links = [...list.querySelectorAll("a.att-img")];
|
|
956
956
|
if (opts.openImage(links.length ? links : [img], img)) e.preventDefault();
|
|
957
957
|
}
|
|
958
958
|
return true;
|
|
@@ -49,6 +49,12 @@
|
|
|
49
49
|
/* Send is Stop while the box is empty and the agent works: one size in both, a full tap target (the box keeps one
|
|
50
50
|
width). Here, not in app.css: a tab on an older app.css links this file fresh. */
|
|
51
51
|
.p-chat .composer .btn-send { width: var(--tap); min-width: var(--tap); min-height: var(--tap); }
|
|
52
|
+
/* M-3222 (the user, iPhone): one line of text sat 3 px under the box's middle — the row aligns its items to the bottom, and
|
|
53
|
+
Send is a 44 px tap target while the one-line box was 38 px. The one-line box is as tall as Send now (more lines grow
|
|
54
|
+
it as before), its drawn placeholder on the same line, and 📎 a tap target of the same height. */
|
|
55
|
+
.p-chat .composer textarea { padding-block: calc((var(--tap) - var(--lh-md)) / 2); }
|
|
56
|
+
.p-chat .composer-ph { top: calc((var(--tap) - var(--lh-md)) / 2); }
|
|
57
|
+
.p-chat .composer > .icon-btn { width: var(--tap); height: var(--tap); }
|
|
52
58
|
.p-chat .work-bar .btn-stop .stop-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: nowrap; }
|
|
53
59
|
}
|
|
54
60
|
/* M-3167: between a phone and a wide desk the composer has the model (above), so the header's chips (backend, model,
|
|
@@ -78,7 +84,9 @@
|
|
|
78
84
|
.p-chat .dock:has(.composer-field textarea:placeholder-shown):not(:has(.pending-files)) .chat-meta-stop { display: none; } /* M-3198: files-only, Stop stays */
|
|
79
85
|
.p-chat .dock:has(.chat-meta.busy) .qa-line { display: none; }
|
|
80
86
|
.p-chat .dock:has(.chat-meta) .composer-row { display: none; }
|
|
81
|
-
|
|
87
|
+
/* Five lines, then it scrolls: the box's padding is in its height (border-box), and since M-3222 one line with its padding is
|
|
88
|
+
a tap target tall — so the cap is four more lines on top of that (Fable, #4038). */
|
|
89
|
+
.p-chat .composer textarea { max-height: calc(4 * var(--lh-md) + var(--tap)); overflow-y: auto; }
|
|
82
90
|
.p-chat .composer-box .pending-files { flex-wrap: nowrap; overflow-x: auto; }
|
|
83
91
|
}
|
|
84
92
|
/* M-3166 (Argon 2–3, the user's OK of round 2): a phone's chat header is "← name ● ⋯" in 44 px — the status is its 6 px dot
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Deterministic prompt rendering: command/args come from this computer, never a secret-bearing config dump. */
|
|
2
|
+
export function connectorPrompt(info, app, where, translate) {
|
|
3
|
+
const server = where === "windows" ? info.windows : info.local;
|
|
4
|
+
if (!server) return "";
|
|
5
|
+
const name = translate(app === "claude" ? "claude" : app === "codex" ? "codex" : "generic");
|
|
6
|
+
const config = app === "codex"
|
|
7
|
+
? `[mcp_servers.agend]\ncommand = ${JSON.stringify(server.command)}\nargs = ${JSON.stringify(server.args)}`
|
|
8
|
+
: JSON.stringify({ mcpServers: { agend: { command: server.command, args: server.args } } }, null, 2);
|
|
9
|
+
return `${translate("prompt").replace("{app}", name)}\n\n${translate("config")}:\n${config}`;
|
|
10
|
+
}
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
|
|
53
53
|
/* a name's letter on a tone (the same tones in both themes) */
|
|
54
54
|
.hub-av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 14px; color: #fff; flex: none; }
|
|
55
|
-
.hub-av.sm { width: 28px; height: 28px; font-size:
|
|
55
|
+
.hub-av.sm { width: 28px; height: 28px; font-size: var(--fs-xs); border-radius: 8px; }
|
|
56
56
|
.hub-av.lg { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
|
|
57
57
|
.hub-av.t0 { background: #4f6bd8; } .hub-av.t1 { background: #2f8f83; } .hub-av.t2 { background: #b4643a; }
|
|
58
58
|
.hub-av.t3 { background: #7b5bc4; } .hub-av.t4 { background: #6b7280; } .hub-av.t5 { background: #b8447a; }
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
.hub-danger h3 { color: var(--danger); }
|
|
55
55
|
.hub-steps { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); counter-reset: hub-step; }
|
|
56
56
|
.hub-steps > li { display: flex; align-items: flex-start; gap: var(--s-3); counter-increment: hub-step; }
|
|
57
|
-
.hub-steps > li::before { content: counter(hub-step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size:
|
|
57
|
+
.hub-steps > li::before { content: counter(hub-step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600;
|
|
58
58
|
background: var(--surface-2); color: var(--text-2); }
|
|
59
59
|
.hub-step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); text-align: start; }
|
|
60
60
|
.hub-steps > li.done::before { content: "✓"; background: var(--ok-bg, var(--surface)); color: var(--ok); }
|
package/dist/ui/shared/hub.css
CHANGED
|
@@ -20,6 +20,11 @@ a.hub-switch-item:focus-visible { outline: 2px solid var(--focus); outline-offse
|
|
|
20
20
|
.hub-fp-groups { font-family: var(--font-mono); font-size: var(--fs-md); letter-spacing: .04em; word-spacing: .3em; overflow-wrap: anywhere; }
|
|
21
21
|
.hub-fp-full { font-family: var(--font-mono); font-size: var(--fs-xs); overflow-wrap: anywhere; color: var(--text-2); }
|
|
22
22
|
.hub-security-notices { flex: none; max-height: 38vh; overflow: auto; }
|
|
23
|
+
/* M-3217: a notice is a column with even gaps, its action (Revoke here, or the link to review it in the Hub) a row of its own. */
|
|
24
|
+
[data-pairing-notice] { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
|
|
25
|
+
[data-pairing-notice] > p { margin: 0; } /* the gap is the only spacing (a flex column never collapses margins) */
|
|
26
|
+
[data-pairing-notice] > .tag { align-self: flex-start; } /* a revoked notice's 已撤銷: its own size, not a full-width bar */
|
|
27
|
+
[data-pairing-notice] > .hub-notice-actions { margin-top: var(--s-2); flex-wrap: wrap; }
|
|
23
28
|
.hub-fp .btn-link { justify-self: start; }
|
|
24
29
|
.hub-steps-lead { margin: var(--s-1) 0 0; }
|
|
25
30
|
.hub-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// A chat image, full size, in the page: a dark overlay with the image fitted to the viewport, ✕ to close, a click on
|
|
2
2
|
// the dark area or Esc closes it too, and focus goes back to the thumbnail. "Open original" opens the same URL in a
|
|
3
3
|
// new tab (the thumbnail's link, unchanged: a ctrl-, meta-, shift- or middle-click on it still does what the browser
|
|
4
|
-
// does). Several images
|
|
4
|
+
// does). Several images: previous / next, and the arrow keys — M-3210: every picture in this chat, in message order (it
|
|
5
|
+
// was the clicked message's alone), from the first to the last (no wrap). On a phone a picture that fits swipes:
|
|
6
|
+
// sideways to the previous or next one, up or down to close, the backdrop fading as it is pulled (image-zoom.js).
|
|
5
7
|
//
|
|
6
8
|
// The native <dialog> opened with showModal(): the browser traps focus and makes the rest inert. No style attribute
|
|
7
9
|
// (#1300): classes only. Only a file URL the chat itself rendered (/ui/file/<32 hex>, or a Hub room's
|
|
@@ -32,7 +34,7 @@ let seq = 0;
|
|
|
32
34
|
* is left out (and nothing opens if the clicked one is not).
|
|
33
35
|
*/
|
|
34
36
|
export function openLightbox(links, clicked, annotate = null) {
|
|
35
|
-
const items = [];
|
|
37
|
+
const items = [], thumbs = []; // thumbs[i]: items[i]'s thumbnail (focus goes back to the one last shown)
|
|
36
38
|
let index = -1;
|
|
37
39
|
for (const a of links) {
|
|
38
40
|
const src = a.getAttribute("href") || "";
|
|
@@ -40,10 +42,11 @@ export function openLightbox(links, clicked, annotate = null) {
|
|
|
40
42
|
if (a === clicked) index = items.length;
|
|
41
43
|
const img = a.querySelector("img");
|
|
42
44
|
items.push({ src, name: (img && img.getAttribute("alt")) || "" });
|
|
45
|
+
thumbs.push(a);
|
|
43
46
|
}
|
|
44
47
|
if (index < 0) return false;
|
|
45
48
|
// #3727: `annotate` — { targets: [{ key, label, quote(file) }], notice(text) } — only from a chat that can quote.
|
|
46
|
-
lightboxStore.set({ open: { items, index, opener: clicked, seq: ++seq, annotate: annotate && annotate.targets?.length ? annotate : null } });
|
|
49
|
+
lightboxStore.set({ open: { items, thumbs, index, opener: clicked, seq: ++seq, annotate: annotate && annotate.targets?.length ? annotate : null } });
|
|
47
50
|
return true;
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
@@ -66,10 +69,10 @@ export function LightboxHost({ owner } = {}) {
|
|
|
66
69
|
if (!owner) closeLightbox();
|
|
67
70
|
else if (owned.current !== null) closeLightbox(owned.current);
|
|
68
71
|
}, []);
|
|
69
|
-
return open && mine ? html`<${ImageLightbox} key=${open.seq} items=${open.items} index=${open.index} opener=${open.opener} annotate=${open.annotate} onClose=${() => closeLightbox(open.seq)} />` : null;
|
|
72
|
+
return open && mine ? html`<${ImageLightbox} key=${open.seq} items=${open.items} thumbs=${open.thumbs || []} index=${open.index} opener=${open.opener} annotate=${open.annotate} onClose=${() => closeLightbox(open.seq)} />` : null;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
function ImageLightbox({ items, index, opener, annotate = null, onClose }) {
|
|
75
|
+
function ImageLightbox({ items, thumbs = [], index, opener, annotate = null, onClose }) {
|
|
73
76
|
const [at, setAt] = useState(index);
|
|
74
77
|
const ref = useRef(null);
|
|
75
78
|
const close = useRef(null);
|
|
@@ -90,7 +93,11 @@ function ImageLightbox({ items, index, opener, annotate = null, onClose }) {
|
|
|
90
93
|
return Promise.resolve(typeof m.annotateCssReady === "function" ? m.annotateCssReady() : null).then(() => setEditor(() => m.AnnotateEditor));
|
|
91
94
|
}).catch(() => annotate?.notice?.(t("lbAnnotate.failed")));
|
|
92
95
|
};
|
|
93
|
-
|
|
96
|
+
// M-3210: from the first to the last, no wrap — a chat's pictures are a line, not a ring.
|
|
97
|
+
const step = (d) => setAt((n) => Math.min(items.length - 1, Math.max(0, n + d)));
|
|
98
|
+
const atRef = useRef(at); atRef.current = at;
|
|
99
|
+
const closeRef = useRef(onClose); closeRef.current = onClose;
|
|
100
|
+
const via = useRef(0); // the last step came by a swipe: ±1 (its slide), else 0
|
|
94
101
|
useLayoutEffect(() => {
|
|
95
102
|
const d = ref.current;
|
|
96
103
|
const root = typeof document !== "undefined" ? document.documentElement : null;
|
|
@@ -100,12 +107,21 @@ function ImageLightbox({ items, index, opener, annotate = null, onClose }) {
|
|
|
100
107
|
return () => {
|
|
101
108
|
if (root) root.classList.remove("lb-open");
|
|
102
109
|
if (d && d.open && typeof d.close === "function") d.close();
|
|
103
|
-
|
|
110
|
+
// M-3210: back on the picture last shown — a swipe through the chat may end far from the one opened — else the opener.
|
|
111
|
+
const shown = thumbs[atRef.current];
|
|
112
|
+
const back = shown && typeof shown.focus === "function" && document.contains?.(shown) ? shown : opener;
|
|
113
|
+
if (back && typeof back.focus === "function" && document.contains?.(back)) back.focus();
|
|
104
114
|
};
|
|
105
115
|
}, []);
|
|
106
116
|
useEffect(() => {
|
|
107
117
|
if (!stage.current || !img.current) return undefined;
|
|
108
|
-
const
|
|
118
|
+
const d = ref.current;
|
|
119
|
+
const pull = (p) => { if (d && d.style && typeof d.style.setProperty === "function") d.style.setProperty("--lb-pull", String(Math.round(p * 1000) / 1000)); };
|
|
120
|
+
const z = createZoom({ stage: stage.current, img: img.current, onChange: setLevel,
|
|
121
|
+
canSwipe: (dir) => atRef.current + dir >= 0 && atRef.current + dir < items.length,
|
|
122
|
+
onSwipe: (dir) => { via.current = dir; step(dir); },
|
|
123
|
+
onDismiss: () => closeRef.current(),
|
|
124
|
+
onPull: pull });
|
|
109
125
|
zoom.current = z;
|
|
110
126
|
return () => { z.destroy(); zoom.current = null; };
|
|
111
127
|
}, []);
|
|
@@ -120,6 +136,15 @@ function ImageLightbox({ items, index, opener, annotate = null, onClose }) {
|
|
|
120
136
|
const el = img.current;
|
|
121
137
|
if (el) el.classList.remove("lb-ready");
|
|
122
138
|
setLevel(null);
|
|
139
|
+
// A swipe's next picture slides in from the side it came from (app.css; none under reduced motion).
|
|
140
|
+
const st = stage.current;
|
|
141
|
+
if (st && st.classList && via.current) {
|
|
142
|
+
const cls = via.current > 0 ? "lb-in-next" : "lb-in-prev";
|
|
143
|
+
st.classList.remove("lb-in-next", "lb-in-prev");
|
|
144
|
+
st.classList.add(cls);
|
|
145
|
+
setTimeout(() => st.classList.remove(cls), 260);
|
|
146
|
+
}
|
|
147
|
+
via.current = 0;
|
|
123
148
|
if (el && el.complete && el.naturalWidth > 0 && zoom.current) zoom.current.reset();
|
|
124
149
|
}, [at]);
|
|
125
150
|
useEffect(() => {
|
|
@@ -175,8 +200,8 @@ function ImageLightbox({ items, index, opener, annotate = null, onClose }) {
|
|
|
175
200
|
<button type="button" class="icon-btn lb-close" ref=${close} aria-label=${t("chat.lbClose")} title=${t("chat.lbClose")} onClick=${onClose}><${Icon} name="close" /></button>
|
|
176
201
|
</div>
|
|
177
202
|
<div class="lb-stage" ref=${stage}><img class="lb-img" ref=${img} src=${item.src} alt=${item.name} draggable=${false} /></div>
|
|
178
|
-
${many ? html`<button type="button" class="icon-btn lb-nav lb-prev" aria-label=${t("chat.lbPrev")} title=${t("chat.lbPrev")} onClick=${() => step(-1)}><${Icon} name="back" /></button>
|
|
179
|
-
<button type="button" class="icon-btn lb-nav lb-next" aria-label=${t("chat.lbNext")} title=${t("chat.lbNext")} onClick=${() => step(1)}><${Icon} name="forward" /></button>` : null}
|
|
203
|
+
${many ? html`<button type="button" class="icon-btn lb-nav lb-prev" disabled=${at === 0} aria-label=${t("chat.lbPrev")} title=${t("chat.lbPrev")} onClick=${() => step(-1)}><${Icon} name="back" /></button>
|
|
204
|
+
<button type="button" class="icon-btn lb-nav lb-next" disabled=${at === items.length - 1} aria-label=${t("chat.lbNext")} title=${t("chat.lbNext")} onClick=${() => step(1)}><${Icon} name="forward" /></button>` : null}
|
|
180
205
|
</dialog>`;
|
|
181
206
|
}
|
|
182
207
|
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
// larger than the view a plain wheel scrolls it instead, so a tall sheet reads like a page. A mouse click on the image
|
|
8
8
|
// toggles fit ↔ 100% at that point; a drag pans. Touch: two fingers pinch (and pan), one finger pans, a double tap
|
|
9
9
|
// toggles fit ↔ 100%. A gesture that moved is never also a click (the lightbox closes on a click on the dark area).
|
|
10
|
+
//
|
|
11
|
+
// M-3210 (the user, phone): one finger on a picture that fits (not zoomed in) swipes, as a phone's photo viewer does —
|
|
12
|
+
// sideways to the previous or next picture (`onSwipe(±1)`), up or down to close (`onDismiss`); the picture follows the
|
|
13
|
+
// finger, and a pull reports how far it went (`onPull(0…1)`: the lightbox fades its backdrop). A short, slow one springs
|
|
14
|
+
// back; past the first or the last picture (`canSwipe(±1)` false) it gives a little and springs back. A zoomed-in picture
|
|
15
|
+
// pans as before, a second finger turns a swipe into a pinch, and a mouse or a pen never swipes (the desk has ← → Esc).
|
|
10
16
|
|
|
11
17
|
/** The largest zoom: 8× the picture's own pixels. */
|
|
12
18
|
export const MAX_SCALE = 8;
|
|
@@ -14,6 +20,9 @@ export const MAX_SCALE = 8;
|
|
|
14
20
|
export const STEP = 1.25;
|
|
15
21
|
/** A pointer that moved less than this (CSS px) clicked or tapped; more, it dragged. */
|
|
16
22
|
export const SLOP = 4;
|
|
23
|
+
/** A swipe: sideways past this share of the view's width, or up/down past this share of its height — or a flick (faster
|
|
24
|
+
* than FLICK px/ms over more than FLICK_PX) — steps or closes; less springs back. */
|
|
25
|
+
export const SWIPE_X = 0.22, SWIPE_Y = 0.14, FLICK = 0.5, FLICK_PX = 30;
|
|
17
26
|
/** Two taps within this long and this close are a double tap. */
|
|
18
27
|
export const DOUBLE_TAP_MS = 300;
|
|
19
28
|
export const DOUBLE_TAP_PX = 24;
|
|
@@ -61,6 +70,7 @@ export function overflows(z, view, img) {
|
|
|
61
70
|
return img.w * z.s > view.w + 0.5 || img.h * z.s > view.h + 0.5;
|
|
62
71
|
}
|
|
63
72
|
|
|
73
|
+
const now = () => (typeof performance !== "undefined" ? performance.now() : Date.now());
|
|
64
74
|
/** Wheel distance in CSS px (a line is 16, a page the view's height). */
|
|
65
75
|
function wheelPx(e, view) {
|
|
66
76
|
const unit = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? view.h : 1;
|
|
@@ -71,12 +81,13 @@ function wheelPx(e, view) {
|
|
|
71
81
|
* Drive one picture in one stage. `onChange({ scale, fit, mode })` after every change (mode: "fit" | "width" | "free").
|
|
72
82
|
* Returns { reset, fit, fitWidth, actual, zoomBy, toggle, destroy }. Nothing happens until the picture has loaded.
|
|
73
83
|
*/
|
|
74
|
-
export function createZoom({ stage, img, onChange }) {
|
|
84
|
+
export function createZoom({ stage, img, onChange, onSwipe = null, canSwipe = null, onDismiss = null, onPull = null }) {
|
|
75
85
|
let nat = null; // { w, h } once loaded
|
|
76
86
|
let z = { s: 1, tx: 0, ty: 0 };
|
|
77
87
|
let mode = "fit";
|
|
78
88
|
const pointers = new Map(); // pointerId → { x, y }
|
|
79
|
-
let gesture = null; // { kind: "drag" | "pinch", ... }
|
|
89
|
+
let gesture = null; // { kind: "drag" | "pinch" | "swipe" | "pull", ... }
|
|
90
|
+
let snapTimer = 0; // a swipe springing back (the picture eases to where it is)
|
|
80
91
|
let moved = false; // the gesture now ending moved: its click is not a click
|
|
81
92
|
let lastTap = null; // { t, x, y } of the last touch tap
|
|
82
93
|
let lastType = "mouse"; // the pointer type of the last press: a touch tap's click never toggles (double tap does);
|
|
@@ -90,12 +101,25 @@ export function createZoom({ stage, img, onChange }) {
|
|
|
90
101
|
return { x, y, w: Math.max(1, r.width - x - px("paddingRight")), h: Math.max(1, r.height - y - px("paddingBottom")) };
|
|
91
102
|
};
|
|
92
103
|
const at = (e) => { const r = stage.getBoundingClientRect(); return { x: e.clientX - r.left, y: e.clientY - r.top }; };
|
|
104
|
+
// A pointer: where it is in the stage (zoom and pinch points) and on the screen (cx, cy: how far a finger went). M-3210:
|
|
105
|
+
// a drag, swipe or pull is measured on the screen — the stage itself moves while the next picture slides in (200 ms),
|
|
106
|
+
// and a second swipe started then was measured against the moving stage: a slow 35 px swipe read as 135 px and stepped.
|
|
107
|
+
const pt = (e) => ({ ...at(e), cx: e.clientX, cy: e.clientY });
|
|
93
108
|
const apply = () => {
|
|
94
109
|
img.style.transform = `translate(${z.tx}px, ${z.ty}px) scale(${z.s})`;
|
|
95
110
|
stage.classList.toggle("lb-zoomed", !!nat && overflows(z, view(), nat));
|
|
96
111
|
if (onChange) onChange({ scale: z.s, fit: nat ? fitScale(view(), nat) : 1, mode });
|
|
97
112
|
};
|
|
98
113
|
const set = (next, m = "free") => { if (!nat) return; z = next; mode = m; apply(); };
|
|
114
|
+
// A swipe in progress: the picture drawn dx/dy off where it is (z itself unchanged).
|
|
115
|
+
const drawOff = (dx, dy) => { img.style.transform = `translate(${z.tx + dx}px, ${z.ty + dy}px) scale(${z.s})`; };
|
|
116
|
+
const snapBack = () => {
|
|
117
|
+
img.classList.add("lb-snap");
|
|
118
|
+
apply();
|
|
119
|
+
if (onPull) onPull(0);
|
|
120
|
+
if (snapTimer && typeof clearTimeout === "function") clearTimeout(snapTimer);
|
|
121
|
+
snapTimer = typeof setTimeout === "function" ? setTimeout(() => { snapTimer = 0; img.classList.remove("lb-snap"); }, 220) : 0;
|
|
122
|
+
};
|
|
99
123
|
|
|
100
124
|
const api = {
|
|
101
125
|
/** A new picture (or the first): read its size and fit it. */
|
|
@@ -124,6 +148,7 @@ export function createZoom({ stage, img, onChange }) {
|
|
|
124
148
|
if (mode === "fit" && Math.abs(z.s - 1) > 1e-6) api.actual(px, py); else api.fit();
|
|
125
149
|
},
|
|
126
150
|
destroy() {
|
|
151
|
+
if (snapTimer && typeof clearTimeout === "function") clearTimeout(snapTimer);
|
|
127
152
|
stage.removeEventListener("wheel", onWheel);
|
|
128
153
|
stage.removeEventListener("pointerdown", onDown);
|
|
129
154
|
stage.removeEventListener("pointermove", onMove);
|
|
@@ -154,11 +179,13 @@ export function createZoom({ stage, img, onChange }) {
|
|
|
154
179
|
function onDown(e) {
|
|
155
180
|
if (!nat || (e.pointerType === "mouse" && e.button !== 0)) return;
|
|
156
181
|
lastType = e.pointerType || "mouse";
|
|
157
|
-
pointers.set(e.pointerId,
|
|
182
|
+
pointers.set(e.pointerId, pt(e));
|
|
158
183
|
// No pointer capture yet: it would retarget the click to the stage, and a click on the picture is not one on the
|
|
159
184
|
// dark area. Captured only once the pointer moves (capture()).
|
|
160
|
-
if (pointers.size === 1) { moved = false; gesture = { kind: "drag", from:
|
|
185
|
+
if (pointers.size === 1) { moved = false; gesture = { kind: "drag", from: pt(e), z0: z, t0: now(), swipes: e.pointerType === "touch" && !!(onSwipe || onDismiss) }; }
|
|
161
186
|
else if (pointers.size === 2) {
|
|
187
|
+
// A swipe that gets a second finger: a pinch, from where the picture is.
|
|
188
|
+
if (gesture && (gesture.kind === "swipe" || gesture.kind === "pull")) { apply(); if (onPull) onPull(0); }
|
|
162
189
|
const [a, b] = [...pointers.values()];
|
|
163
190
|
gesture = { kind: "pinch", d0: Math.hypot(b.x - a.x, b.y - a.y) || 1, m0: { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 }, z0: z };
|
|
164
191
|
moved = true; // two fingers: never a tap
|
|
@@ -167,7 +194,7 @@ export function createZoom({ stage, img, onChange }) {
|
|
|
167
194
|
}
|
|
168
195
|
function onMove(e) {
|
|
169
196
|
if (!gesture || !pointers.has(e.pointerId)) return;
|
|
170
|
-
pointers.set(e.pointerId,
|
|
197
|
+
pointers.set(e.pointerId, pt(e));
|
|
171
198
|
const v = view();
|
|
172
199
|
if (gesture.kind === "pinch" && pointers.size >= 2) {
|
|
173
200
|
const [a, b] = [...pointers.values()];
|
|
@@ -179,11 +206,24 @@ export function createZoom({ stage, img, onChange }) {
|
|
|
179
206
|
set(clampPan({ s: zoomed.s, tx: zoomed.tx + (m.x - m0.x), ty: zoomed.ty + (m.y - m0.y) }, v, nat));
|
|
180
207
|
} else if (gesture.kind === "drag") {
|
|
181
208
|
const p = pointers.get(e.pointerId);
|
|
182
|
-
const dx = p.
|
|
209
|
+
const dx = p.cx - gesture.from.cx, dy = p.cy - gesture.from.cy;
|
|
183
210
|
if (!moved && Math.hypot(dx, dy) < SLOP) return;
|
|
184
211
|
if (!moved) capture(e.pointerId);
|
|
185
212
|
moved = true;
|
|
186
213
|
if (overflows(gesture.z0, v, nat)) set(clampPan({ s: gesture.z0.s, tx: gesture.z0.tx + dx, ty: gesture.z0.ty + dy }, v, nat), mode === "width" ? "width" : "free");
|
|
214
|
+
else if (gesture.swipes) {
|
|
215
|
+
// A picture that fits, under a finger: its first clear direction decides — sideways steps, up or down closes.
|
|
216
|
+
gesture = { ...gesture, kind: Math.abs(dx) > Math.abs(dy) ? "swipe" : "pull" };
|
|
217
|
+
onMove(e);
|
|
218
|
+
}
|
|
219
|
+
} else if (gesture.kind === "swipe") {
|
|
220
|
+
const dx = pointers.get(e.pointerId).cx - gesture.from.cx;
|
|
221
|
+
const dir = dx < 0 ? 1 : -1; // to the left: the next picture
|
|
222
|
+
drawOff(onSwipe && (!canSwipe || canSwipe(dir)) ? dx : dx * 0.3, 0);
|
|
223
|
+
} else if (gesture.kind === "pull") {
|
|
224
|
+
const dy = pointers.get(e.pointerId).cy - gesture.from.cy;
|
|
225
|
+
drawOff(0, dy);
|
|
226
|
+
if (onPull) onPull(Math.min(1, Math.abs(dy) / (v.h * 0.5)));
|
|
187
227
|
}
|
|
188
228
|
}
|
|
189
229
|
function onUp(e) {
|
|
@@ -197,17 +237,29 @@ export function createZoom({ stage, img, onChange }) {
|
|
|
197
237
|
return;
|
|
198
238
|
}
|
|
199
239
|
if (pointers.size > 0) return;
|
|
240
|
+
if (gesture && (gesture.kind === "swipe" || gesture.kind === "pull")) {
|
|
241
|
+
if (e.type === "pointercancel") { gesture = null; snapBack(); return; } // the browser took the touch back
|
|
242
|
+
const g = gesture, v = view(), dt = Math.max(1, now() - g.t0);
|
|
243
|
+
const d = g.kind === "swipe" ? p.cx - g.from.cx : p.cy - g.from.cy, span = g.kind === "swipe" ? v.w * SWIPE_X : v.h * SWIPE_Y;
|
|
244
|
+
const far = Math.abs(d) > span || (Math.abs(d) > FLICK_PX && Math.abs(d) / dt > FLICK);
|
|
245
|
+
gesture = null;
|
|
246
|
+
const dir = d < 0 ? 1 : -1;
|
|
247
|
+
if (far && g.kind === "swipe" && onSwipe && (!canSwipe || canSwipe(dir))) { onSwipe(dir); return; }
|
|
248
|
+
if (far && g.kind === "pull" && onDismiss) { onDismiss(); return; }
|
|
249
|
+
snapBack();
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
200
252
|
const tapped = !moved && gesture && gesture.kind === "drag";
|
|
201
253
|
gesture = null;
|
|
202
254
|
// Only a finger double-taps: a mouse or a pen clicks (onClick toggles), so a pen tap must not also count here.
|
|
203
255
|
if (!tapped || e.pointerType !== "touch") return;
|
|
204
256
|
// A touch tap: a second one soon and near is a double tap — fit ↔ 100% there.
|
|
205
|
-
const
|
|
206
|
-
if (lastTap &&
|
|
257
|
+
const t = now();
|
|
258
|
+
if (lastTap && t - lastTap.t < DOUBLE_TAP_MS && Math.hypot(p.x - lastTap.x, p.y - lastTap.y) < DOUBLE_TAP_PX) {
|
|
207
259
|
lastTap = null;
|
|
208
260
|
moved = true; // its click neither closes nor toggles again
|
|
209
261
|
api.toggle(p.x, p.y);
|
|
210
|
-
} else lastTap = { t
|
|
262
|
+
} else lastTap = { t, x: p.x, y: p.y };
|
|
211
263
|
}
|
|
212
264
|
/** A drag or pinch keeps its pointers even off the stage. */
|
|
213
265
|
function capture(id) {
|
|
@@ -348,6 +348,21 @@ export function setSidebarDensity(value) {
|
|
|
348
348
|
}
|
|
349
349
|
onPrefsChanged((keys) => { if (keys.has("nav.density")) sidebarDensityStore.set({ value: readSidebarDensity() }); });
|
|
350
350
|
|
|
351
|
+
// M-3212 (the user, 11-16): the phone's drawer — 滿版, the screen's width (the default since M-3211), or 窄版, 300 px with
|
|
352
|
+
// the page beside it (as before). This browser's own choice (localStorage, not a synced pref: a phone and a tablet may
|
|
353
|
+
// want different ones); a desk never shows the drawer, so it changes nothing there. Another tab's change follows.
|
|
354
|
+
const PHONE_DRAWER_KEY = "agend_phone_drawer";
|
|
355
|
+
const readPhoneDrawer = () => (stored(PHONE_DRAWER_KEY) === "narrow" ? "narrow" : "full");
|
|
356
|
+
export const phoneDrawerStore = createStore({ value: readPhoneDrawer() });
|
|
357
|
+
export function setPhoneDrawer(value) {
|
|
358
|
+
const v = value === "narrow" ? "narrow" : "full";
|
|
359
|
+
phoneDrawerStore.set({ value: v });
|
|
360
|
+
try { if (v === "narrow") localStorage.setItem(PHONE_DRAWER_KEY, v); else localStorage.removeItem(PHONE_DRAWER_KEY); } catch { /* storage off: this page only */ }
|
|
361
|
+
}
|
|
362
|
+
if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
|
|
363
|
+
window.addEventListener("storage", (e) => { if (!e || e.key === PHONE_DRAWER_KEY || e.key === null) phoneDrawerStore.set({ value: readPhoneDrawer() }); });
|
|
364
|
+
}
|
|
365
|
+
|
|
351
366
|
// ── #1722: both names — which one leads is a synced preference (#1665 "names.primary", default the nickname) ──
|
|
352
367
|
const NAMES_KEY = "agend_names_primary";
|
|
353
368
|
function readNamesPrimary() {
|
|
@@ -478,7 +493,7 @@ function byRecentReply(age) {
|
|
|
478
493
|
const RECENT_GROUP = "\u0000recent";
|
|
479
494
|
|
|
480
495
|
/** #2179: the sort button and its menu — how the list sorts, said on the button. */
|
|
481
|
-
function SortMenu({ sort }) {
|
|
496
|
+
function SortMenu({ sort, phone = false }) {
|
|
482
497
|
const [open, setOpen] = useState(false);
|
|
483
498
|
const box = useRef(null);
|
|
484
499
|
useLayoutEffect(() => {
|
|
@@ -494,13 +509,19 @@ function SortMenu({ sort }) {
|
|
|
494
509
|
const recent = sort.mode === "recent";
|
|
495
510
|
// M-3164: the list's density, the same synced choice as Settings (nav.density, M-3129): either place changes it at once, for both.
|
|
496
511
|
const density = useStore(sidebarDensityStore).value;
|
|
512
|
+
const drawer = useStore(phoneDrawerStore).value; // M-3212
|
|
513
|
+
const drawerRadio = (value, label) => html`<label class="nav-sort-opt"><input type="radio" name="nav-sort-drawer" value=${value}
|
|
514
|
+
checked=${drawer === value} onChange=${() => setPhoneDrawer(value)} /><span>${label}</span></label>`;
|
|
497
515
|
const densityRadio = (value, label) => html`<label class="nav-sort-opt"><input type="radio" name="nav-sort-density" value=${value}
|
|
498
516
|
checked=${density === value} onChange=${() => setSidebarDensity(value)} /><span>${label}</span></label>`;
|
|
499
517
|
const radio = (group, value, label, hint) => html`<label class="nav-sort-opt"><input type="radio" name=${`nav-sort-${group}`} value=${value}
|
|
500
518
|
checked=${sort[group] === value} onChange=${() => setNavSort({ [group]: value })} /><span>${label}${hint ? html`<span class="nav-sort-hint">${hint}</span>` : null}</span></label>`;
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
519
|
+
// M-3212: `phone` — the same menu from an icon beside the phone drawer's filter (its list header, with the chip, is hidden there).
|
|
520
|
+
return html`<div class=${`nav-sort${phone ? " nav-sort-phone" : ""}`} ref=${box}>
|
|
521
|
+
${phone ? html`<button type="button" class=${`icon-btn nav-sort-btn${recent ? " on" : ""}`} aria-haspopup="dialog" aria-expanded=${open ? "true" : "false"}
|
|
522
|
+
aria-label=${`${tn("sortTitle")}: ${tn(recent ? "sortRecent" : "sortCustom")}`} title=${tn("sortTitle")} onClick=${() => setOpen(!open)}><${Icon} name="sort" /></button>`
|
|
523
|
+
: html`<button type="button" class=${`chip-btn nav-sort-btn${recent ? " on" : ""}`} aria-haspopup="dialog" aria-expanded=${open ? "true" : "false"}
|
|
524
|
+
title=${tn("sortTitle")} onClick=${() => setOpen(!open)}><${Icon} name="sort" size=${12} /><span>${tn(recent ? "sortRecent" : "sortCustom")}</span></button>`}
|
|
504
525
|
${open ? html`<div class="nav-sort-menu" role="dialog" aria-label=${tn("sortTitle")}>
|
|
505
526
|
<fieldset><legend>${tn("sortTitle")}</legend>
|
|
506
527
|
${radio("mode", "custom", tn("sortCustom"), tn("sortCustomHint"))}
|
|
@@ -510,7 +531,11 @@ function SortMenu({ sort }) {
|
|
|
510
531
|
${radio("favs", "recent", tn("sortFavsRecent"), "")}</fieldset>
|
|
511
532
|
<fieldset><legend>${tn("sortDisplay")}</legend>
|
|
512
533
|
${densityRadio("detailed", tn("sortDisplayDetailed"))}
|
|
513
|
-
${densityRadio("compact", tn("sortDisplayCompact"))}
|
|
534
|
+
${densityRadio("compact", tn("sortDisplayCompact"))}
|
|
535
|
+
${/* M-3212: a phone's only (app.css hides it from 900 px): the drawer's width, this browser's own. */ ""}
|
|
536
|
+
<fieldset class="nav-sort-sub nav-sort-drawer"><legend>${tn("sortPhoneDrawer")}</legend>
|
|
537
|
+
${drawerRadio("full", tn("sortPhoneDrawerFull"))}
|
|
538
|
+
${drawerRadio("narrow", tn("sortPhoneDrawerNarrow"))}</fieldset></fieldset>
|
|
514
539
|
</div>` : null}
|
|
515
540
|
</div>`;
|
|
516
541
|
}
|
|
@@ -521,7 +546,7 @@ function SortMenu({ sort }) {
|
|
|
521
546
|
* `exec` / `awaiting`: live state by name (empty for the anonymous reader). `onPick`: a row was clicked (the drawer
|
|
522
547
|
* closes).
|
|
523
548
|
*/
|
|
524
|
-
export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting = {}, viewOnly = false, onPick }) {
|
|
549
|
+
export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting = {}, viewOnly = false, onPick, onNew = null }) {
|
|
525
550
|
const nav = useStore(navStore);
|
|
526
551
|
const workspace = useStore(appStore).chatWorkspace;
|
|
527
552
|
const styledMenus = typeof getComputedStyle === "function" && getComputedStyle(document.documentElement).getPropertyValue?.("--agent-menu-version")?.trim() === "1";
|
|
@@ -763,6 +788,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
763
788
|
${f.q ? html`<button type="button" class="icon-btn v-filter-clear" aria-label=${tn("filterClear")} title=${tn("filterClear")}
|
|
764
789
|
onClick=${() => { recordEdit(filterRef.current); setNavFilter({ q: "" }); filterRef.current && filterRef.current.focus(); }}><${Icon} name="close" size=${14} /></button>` : null}
|
|
765
790
|
</label>
|
|
791
|
+
${/* M-3212: 自訂 on a phone — beside the filter (app.css shows it in the phone drawer only). */ canStar && items.length ? html`<${SortMenu} sort=${nav.sort} phone=${true} />` : null}
|
|
792
|
+
${/* M-3217 (the user, beta.6, a Fleet in a Hub): + on a phone is in the filter's own row (app.css shows it in the phone
|
|
793
|
+
drawer only). It was placed at a fixed height under the brand, so the Hub switch's row put it on top of the switch. */
|
|
794
|
+
onNew ? html`<button type="button" class="icon-btn v-filter-new" aria-label=${t("app.newAgent")} title=${t("app.newAgent")} onClick=${onNew}><${Icon} name="plus" /></button>` : null}
|
|
766
795
|
<div class=${`nav-facets${stacked ? "" : " compact"}`}>
|
|
767
796
|
<div class="nav-facet-groups">
|
|
768
797
|
${viewOnly ? null : chips("status", STATUS_FACETS, tn("filterStatus"), statusText)}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.s-connector { display: flex; flex-direction: column; gap: var(--s-3); }
|
|
2
|
+
.s-connector .grid2 { align-items: end; }
|
|
3
|
+
.s-connector :is(input, select, .btn, summary) { min-height: var(--tap); min-width: var(--tap); }
|
|
4
|
+
.s-connector select, .s-connector textarea { width: 100%; min-width: 0; max-width: 100%; }
|
|
5
|
+
.s-connector .btn { align-self: flex-start; }
|
|
6
|
+
.s-connector summary { display: flex; align-items: center; cursor: pointer; }
|
|
7
|
+
@media (max-width: 599px) { .s-connector .grid2 { grid-template-columns: minmax(0, 1fr); } }
|
package/dist/ui/shared/theme.js
CHANGED
|
@@ -59,3 +59,55 @@
|
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
})();
|
|
62
|
+
|
|
63
|
+
// The installed window's title bar follows the page, including page themes and owner CSS.
|
|
64
|
+
// Read paint rather than the OS setting: a person can choose Dark on a light desktop.
|
|
65
|
+
(function () {
|
|
66
|
+
"use strict";
|
|
67
|
+
if (!document.head || typeof window.getComputedStyle !== "function") return;
|
|
68
|
+
var pending = false;
|
|
69
|
+
function fallback() {
|
|
70
|
+
var mode = window.AgendTheme.get();
|
|
71
|
+
if (mode === "system") mode = window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark";
|
|
72
|
+
return mode === "light" ? "#ffffff" : "#212121";
|
|
73
|
+
}
|
|
74
|
+
function color() {
|
|
75
|
+
var el = document.body || document.documentElement, top = Infinity;
|
|
76
|
+
var heads = document.querySelectorAll(".panel-head");
|
|
77
|
+
for (var i = 0; i < heads.length; i++) {
|
|
78
|
+
var h = heads[i];
|
|
79
|
+
if (h.getClientRects().length && h.getBoundingClientRect().top < top) { el = h; top = h.getBoundingClientRect().top; }
|
|
80
|
+
}
|
|
81
|
+
// Headers may be transparent: use the nearest painted surface behind them.
|
|
82
|
+
for (; el; el = el.parentElement) {
|
|
83
|
+
var bg = window.getComputedStyle(el).backgroundColor;
|
|
84
|
+
if (bg && bg !== "transparent" && !/^rgba\([^)]*,\s*0\s*\)$/.test(bg)) return bg;
|
|
85
|
+
}
|
|
86
|
+
return fallback();
|
|
87
|
+
}
|
|
88
|
+
function update() {
|
|
89
|
+
pending = false;
|
|
90
|
+
var tags = document.querySelectorAll('meta[name="theme-color"]'), tag = tags[0];
|
|
91
|
+
if (!tag) { tag = document.createElement("meta"); tag.setAttribute("name", "theme-color"); document.head.appendChild(tag); }
|
|
92
|
+
// Retire the old OS-qualified pair as well, for a tab crossing an upgrade.
|
|
93
|
+
for (var i = 1; i < tags.length; i++) tags[i].remove();
|
|
94
|
+
tag.removeAttribute("media");
|
|
95
|
+
var value = color();
|
|
96
|
+
if (tag.content !== value) tag.content = value;
|
|
97
|
+
}
|
|
98
|
+
function schedule() {
|
|
99
|
+
if (!pending) { pending = true; window.requestAnimationFrame(update); }
|
|
100
|
+
}
|
|
101
|
+
update();
|
|
102
|
+
window.AgendTheme.onChange(schedule);
|
|
103
|
+
window.matchMedia("(prefers-color-scheme: light)").addEventListener("change", schedule);
|
|
104
|
+
document.addEventListener("DOMContentLoaded", schedule);
|
|
105
|
+
document.addEventListener("transitionend", schedule, true);
|
|
106
|
+
document.addEventListener("load", schedule, true); // Stylesheet arrival / replacement, including owner CSS.
|
|
107
|
+
window.addEventListener("pageshow", schedule);
|
|
108
|
+
// Page palettes are applied to the shell; routes replace headers. Coalesce paints and
|
|
109
|
+
// ignore content attributes so updating this meta element cannot trigger itself.
|
|
110
|
+
new MutationObserver(schedule).observe(document.documentElement, {
|
|
111
|
+
subtree: true, childList: true, attributes: true, attributeFilter: ["class", "style", "data-theme", "data-agent"],
|
|
112
|
+
});
|
|
113
|
+
})();
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Themes follow /assets/theme.js: dark under :root; light under @media (prefers-color-scheme: light) for
|
|
7
7
|
* :root:not([data-theme="dark"]), and again under :root[data-theme="light"] for a browser that chose light. The two
|
|
8
8
|
* light blocks carry the same values (a test compares them). Every text colour meets WCAG AA (4.5:1) on the
|
|
9
|
-
* surfaces it is used on, and focus rings and strong borders meet 3:1 (tests/web-tokens-1408.test.ts).
|
|
9
|
+
* surfaces it is used on, and focus rings and strong borders meet 3:1 (tests/web-tokens-1408.test.ts). M-3216 (the user's phone
|
|
10
|
+
* contrast audit): on the dark page the secondary and tertiary greys also reach APCA Lc 60 on the page, the sidebar and a
|
|
11
|
+
* card, the floor for readable small text; WCAG alone passed them while 12–13px grey text still read dim on a phone.
|
|
10
12
|
*
|
|
11
13
|
* Inter is bundled (/assets/inter.woff2, SIL OFL 1.1 — see fonts/README.md): the CSP allows fonts from 'self' only,
|
|
12
14
|
* and nothing is loaded from another site. Chinese falls back to the system's CJK fonts, in the order below.
|
|
@@ -30,8 +32,16 @@
|
|
|
30
32
|
--font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", emoji;
|
|
31
33
|
--font-ui: Inter, "PingFang TC", "PingFang SC", "Noto Sans TC", "Noto Sans SC", "Noto Sans CJK TC", "Noto Sans CJK SC", "Microsoft JhengHei", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, var(--font-emoji);
|
|
32
34
|
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace, var(--font-emoji);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
/* M-3216: the two small sizes come from a base the phone layout raises one step; the text-size scopes in app.css
|
|
36
|
+
(the chat, Details, Fleet, Log, the drawer's agents) scale the same base, so they follow it too. */
|
|
37
|
+
--fs-3xs-base: 10px; /* M-3226: the two smallest steps (chart labels, badges, counts); font size only */
|
|
38
|
+
--fs-2xs-base: 11px;
|
|
39
|
+
--fs-xs-base: 12px; --lh-xs-base: 16px;
|
|
40
|
+
--fs-sm-base: 13px; --lh-sm-base: 18px;
|
|
41
|
+
--fs-3xs: var(--fs-3xs-base);
|
|
42
|
+
--fs-2xs: var(--fs-2xs-base);
|
|
43
|
+
--fs-xs: var(--fs-xs-base); --lh-xs: var(--lh-xs-base);
|
|
44
|
+
--fs-sm: var(--fs-sm-base); --lh-sm: var(--lh-sm-base);
|
|
35
45
|
--fs-md: 15px; --lh-md: 24px; /* message text */
|
|
36
46
|
--fs-lg: 17px; --lh-lg: 24px;
|
|
37
47
|
--fs-xl: 22px; --lh-xl: 28px;
|
|
@@ -60,8 +70,8 @@
|
|
|
60
70
|
--border: #3d3d3d; /* used rarely: tone separates areas */
|
|
61
71
|
--border-strong: #7a7a7a;
|
|
62
72
|
--text: #ececec;
|
|
63
|
-
--text-2: #
|
|
64
|
-
--text-3: #
|
|
73
|
+
--text-2: #cfcfcf; /* secondary: senders, labels */
|
|
74
|
+
--text-3: #bbbbbb; /* tertiary: times, hints, metadata */
|
|
65
75
|
--accent: #7ab7ff; /* links and selected text */
|
|
66
76
|
--accent-fill: #ececec; /* the primary button (Send) */
|
|
67
77
|
--on-accent: #0d0d0d;
|
|
@@ -95,8 +105,8 @@
|
|
|
95
105
|
--border: #e5e5e5;
|
|
96
106
|
--border-strong: #858585;
|
|
97
107
|
--text: #0d0d0d;
|
|
98
|
-
--text-2: #
|
|
99
|
-
--text-3: #
|
|
108
|
+
--text-2: #4d4d4d;
|
|
109
|
+
--text-3: #5d5d5d;
|
|
100
110
|
--accent: #0a62c2;
|
|
101
111
|
--accent-fill: #0d0d0d;
|
|
102
112
|
--on-accent: #ffffff;
|
|
@@ -130,8 +140,8 @@
|
|
|
130
140
|
--border: #e5e5e5;
|
|
131
141
|
--border-strong: #858585;
|
|
132
142
|
--text: #0d0d0d;
|
|
133
|
-
--text-2: #
|
|
134
|
-
--text-3: #
|
|
143
|
+
--text-2: #4d4d4d;
|
|
144
|
+
--text-3: #5d5d5d;
|
|
135
145
|
--accent: #0a62c2;
|
|
136
146
|
--accent-fill: #0d0d0d;
|
|
137
147
|
--on-accent: #ffffff;
|
|
@@ -161,6 +171,7 @@
|
|
|
161
171
|
canvas, image-annotate.js COLOURS). */
|
|
162
172
|
:root {
|
|
163
173
|
--media-ink: #ffffff;
|
|
174
|
+
--media-stage: rgba(0, 0, 0, 0.95); /* M-3210: the viewer's own dark, faded by a phone's pull-to-close (app.css .lb) */
|
|
164
175
|
--media-bar: rgba(0, 0, 0, 0.75);
|
|
165
176
|
--media-panel: rgba(0, 0, 0, 0.6);
|
|
166
177
|
--media-btn: rgba(255, 255, 255, 0.12);
|
|
@@ -178,8 +189,14 @@
|
|
|
178
189
|
the small type sizes are 16px ON the controls themselves, so every control sized from them (the filter, search,
|
|
179
190
|
settings fields, selects, the composer) computes to 16px, and a larger one (the sign-in code, 22px) stays as it is.
|
|
180
191
|
Pinch zoom is left alone (no maximum-scale / user-scalable in the viewport); the desktop look does not change. */
|
|
192
|
+
/* M-3216: on the phone layout the two small sizes are a step larger (12 → 13px, 13 → 14px): on a phone most of the
|
|
193
|
+
text (times, hints, labels, a card's lines) is set in them. The bases change, so every scope built on them (app.css's
|
|
194
|
+
text-size scopes) follows. Text fields keep the 16px rule below. */
|
|
195
|
+
@media (max-width: 899px) {
|
|
196
|
+
:root { --fs-3xs-base: 11px; --fs-2xs-base: 12px; --fs-xs-base: 13px; --lh-xs-base: 18px; --fs-sm-base: 14px; --lh-sm-base: 20px; }
|
|
197
|
+
}
|
|
181
198
|
@media (pointer: coarse), (max-width: 899px) {
|
|
182
|
-
input, select, textarea { --fs-xs: 16px; --fs-sm: 16px; --fs-md: 16px; }
|
|
199
|
+
input, select, textarea { --fs-3xs: 16px; --fs-2xs: 16px; --fs-xs: 16px; --fs-sm: 16px; --fs-md: 16px; }
|
|
183
200
|
}
|
|
184
201
|
/* #2478: the composer's drawn placeholder (a span over the box) is the box's text in size too. */
|
|
185
202
|
@media (pointer: coarse), (max-width: 899px) {
|