@useonsite/vite 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +264 -2
- package/dist/index.d.mts +213 -0
- package/dist/index.mjs +5130 -0
- package/dist/overlay.js +4443 -0
- package/package.json +39 -4
package/dist/overlay.js
ADDED
|
@@ -0,0 +1,4443 @@
|
|
|
1
|
+
// ../core/src/contracts.ts
|
|
2
|
+
var e = "data-onsite-src", t = "data-onsite-comp", n = 8192, r = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, i = (e) => e.split("/").pop() ?? e, a = (e) => {
|
|
3
|
+
let t = e.lastIndexOf("/");
|
|
4
|
+
return t < 0 ? "" : e.slice(0, t + 1);
|
|
5
|
+
}, o = (e) => e.replace(/:\d+(:\d+)?$/, ""), s = (e) => /:(\d+)(?::\d+)?$/.exec(e)?.[1] ?? "";
|
|
6
|
+
function c(e) {
|
|
7
|
+
let t = s(e);
|
|
8
|
+
return `${i(o(e))}${t ? `:${t}` : ""}`;
|
|
9
|
+
}
|
|
10
|
+
function l(e) {
|
|
11
|
+
let t = s(e.src), n = `${o(e.src)}${t ? `:${t}` : ""}`;
|
|
12
|
+
return e.comp ? `${e.comp} · ${n}` : n;
|
|
13
|
+
}
|
|
14
|
+
var u = (e) => `Take ${e}`;
|
|
15
|
+
function d(e) {
|
|
16
|
+
return `Queued · ${[
|
|
17
|
+
"next",
|
|
18
|
+
"2nd",
|
|
19
|
+
"3rd"
|
|
20
|
+
][e] ?? `${e + 1}th`}`;
|
|
21
|
+
}
|
|
22
|
+
function f(e) {
|
|
23
|
+
return e.length === 0 ? "" : e.length === 1 ? u(e[0]) : `Takes ${e.slice(0, -1).join(", ")} and ${e.at(-1)}`;
|
|
24
|
+
}
|
|
25
|
+
function p(e, t = !1) {
|
|
26
|
+
return t && e.label ? `${u(e.no)} · ${e.label}` : u(e.no);
|
|
27
|
+
}
|
|
28
|
+
function m(e, t, n) {
|
|
29
|
+
let r = new Set(t.map((e) => e.of)).size > 1, i = n.indexOf(e.of) + 1;
|
|
30
|
+
return r && i > 0 ? `${u(e.no)} · ask ${i}` : u(e.no);
|
|
31
|
+
}
|
|
32
|
+
var h = "Older code";
|
|
33
|
+
function g(e) {
|
|
34
|
+
return `${u(e.no)} was made on an older version of ${_(e.stale ?? [])}. Showing it may break the page.`;
|
|
35
|
+
}
|
|
36
|
+
function _(e) {
|
|
37
|
+
let t = e.map(i);
|
|
38
|
+
return t.length < 2 ? t[0] ?? "" : `${t.slice(0, -1).join(", ")} and ${t.at(-1)}`;
|
|
39
|
+
}
|
|
40
|
+
function ee(e, t, n) {
|
|
41
|
+
if (!e.covered?.length) return null;
|
|
42
|
+
let r = /* @__PURE__ */ new Map();
|
|
43
|
+
for (let i of e.covered) {
|
|
44
|
+
let e = t.find((e) => e.id === i.by), a = e ? n.indexOf(e.of) + 1 : 0, o = r.get(a) ?? {
|
|
45
|
+
take: e,
|
|
46
|
+
paths: []
|
|
47
|
+
};
|
|
48
|
+
o.paths.push(i.path), r.set(a, o);
|
|
49
|
+
}
|
|
50
|
+
let i = (e) => e > 0 ? `ask ${e}` : "a newer ask", a = _(e.covered.map((e) => e.path)), o = r.size === 1 ? `${te(i([...r.keys()][0]))} holds ${a}` : `Newer asks hold ${a}`, s = [...r].map(([e, t]) => `${_(t.paths)} shows ${t.take ? `${u(t.take.no)} of ${i(e)}` : i(e)}, which is newer.`), c = r.size === 1 ? `Show the original for ${i([...r.keys()][0])} to see ${u(e.no)}'s version.` : `Show the original for those asks to see ${u(e.no)}'s version.`;
|
|
51
|
+
return {
|
|
52
|
+
text: o,
|
|
53
|
+
title: [...s, c].join(" ")
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var te = (e) => e.charAt(0).toUpperCase() + e.slice(1);
|
|
57
|
+
function ne(e) {
|
|
58
|
+
return `${u(e.no)} was made on an older version of ${_(e.stale ?? [])}, so Onsite shows the original.`;
|
|
59
|
+
}
|
|
60
|
+
function v(e, t) {
|
|
61
|
+
if (e.tool === "src_read") return `Read ${i(e.path)}`;
|
|
62
|
+
if (e.tool === "src_list") return `Listed ${e.path || "the source folder"}`;
|
|
63
|
+
let n = "";
|
|
64
|
+
e.from !== void 0 && e.to !== void 0 && (n = e.from > e.to ? ` · removed lines at ${e.from}` : e.from === e.to ? ` · line ${e.from}` : ` · lines ${e.from}–${e.to}`);
|
|
65
|
+
let r = t && e.take ? ` · ${u(e.take)}` : "";
|
|
66
|
+
return `${i(e.path)}${n}${r}`;
|
|
67
|
+
}
|
|
68
|
+
function re(e, t) {
|
|
69
|
+
let n = Date.parse(t ?? "") - Date.parse(e ?? "");
|
|
70
|
+
return !Number.isFinite(n) || n < 0 ? "" : n < 6e4 ? `${(n / 1e3).toFixed(1)} s` : `${Math.floor(n / 6e4)} min ${Math.round(n % 6e4 / 1e3)} s`;
|
|
71
|
+
}
|
|
72
|
+
var ie = (e) => e === void 0 ? "" : `$${e < .01 && e > 0 ? e.toFixed(3) : e.toFixed(2)}`;
|
|
73
|
+
function ae(e) {
|
|
74
|
+
return new Set(e.flatMap((e) => e.files.map((e) => e.path))).size;
|
|
75
|
+
}
|
|
76
|
+
function oe(e, t, n) {
|
|
77
|
+
let i = e.takes ?? [], a = n.filter((t) => t.of === e.id && i.includes(t.no)), o = e.files?.length ?? ae(a), s = [i.length ? f(i) : "No take", o ? r(o, "file") : ""];
|
|
78
|
+
return s.push(re(t?.at, e.at), ie(e.costUSD)), s.filter(Boolean).join(" · ");
|
|
79
|
+
}
|
|
80
|
+
function se(e, t) {
|
|
81
|
+
let n = e.takes ?? [], i = ae(t.filter((t) => t.of === e.id && n.includes(t.no)));
|
|
82
|
+
return !n.length || !i ? "Stopped before any change" : `Stopped · ${n.length === 1 ? u(n[0]) : "The takes"} ${n.length === 1 ? "keeps" : "keep"} the ${r(i, "file")} written so far`;
|
|
83
|
+
}
|
|
84
|
+
function ce(e) {
|
|
85
|
+
let t = e.take ? u(e.take) : "the take", n = e.files?.length ?? 0;
|
|
86
|
+
return e.kind === "keep" ? `Kept ${t}${n ? ` · ${r(n, "file")} written` : ""}` : e.kind === "skip" ? `Skipped ${t} · no file changed` : "Undone";
|
|
87
|
+
}
|
|
88
|
+
var le = {
|
|
89
|
+
pages: "Pages",
|
|
90
|
+
components: "Components",
|
|
91
|
+
styles: "Styles",
|
|
92
|
+
other: "Other"
|
|
93
|
+
};
|
|
94
|
+
// src/base.ts
|
|
95
|
+
function ue(e, t) {
|
|
96
|
+
let n = (t) => e.takes.find((e) => e.id === t), r = (t) => t?.state === "open" && t.of !== e.running && !e.queue?.includes(t.of), i = e.showing.flatMap((e) => {
|
|
97
|
+
let t = n(e);
|
|
98
|
+
return t?.state === "open" ? [t] : [];
|
|
99
|
+
}), a = /* @__PURE__ */ new Set();
|
|
100
|
+
for (let e of t) {
|
|
101
|
+
let t = e ? o(e) : "", n = t ? i.findLast((e) => e.files.some((e) => e.path === t)) : void 0;
|
|
102
|
+
n && a.add(n);
|
|
103
|
+
}
|
|
104
|
+
if (a.size > 0) {
|
|
105
|
+
let e = i.filter((e) => a.has(e)).findLast(r);
|
|
106
|
+
return e ? {
|
|
107
|
+
take: e,
|
|
108
|
+
asks: new Set([...a].map((e) => e.of)).size
|
|
109
|
+
} : void 0;
|
|
110
|
+
}
|
|
111
|
+
let s = e.shown ? n(e.shown) : void 0;
|
|
112
|
+
return r(s) ? {
|
|
113
|
+
take: s,
|
|
114
|
+
asks: 0
|
|
115
|
+
} : void 0;
|
|
116
|
+
}
|
|
117
|
+
function de(e, t, n, r) {
|
|
118
|
+
let i = n.indexOf(e.take.of) + 1, a = e.asks > 1 && i > 0, o = a ? `${u(e.take.no)} of ask ${i}` : t;
|
|
119
|
+
return r ? `it builds on ${o}` : a ? `On ${o}, the newer ask` : `On ${o}`;
|
|
120
|
+
}
|
|
121
|
+
// src/client.ts
|
|
122
|
+
var fe = class extends Error {
|
|
123
|
+
code;
|
|
124
|
+
status;
|
|
125
|
+
constructor(e, t, n) {
|
|
126
|
+
super(t), this.name = "RouteError", this.code = e, this.status = n;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
function pe(e = {}) {
|
|
130
|
+
let t = e.prefix ?? "/__onsite/";
|
|
131
|
+
return { async call(n, r) {
|
|
132
|
+
let [i, a] = n.split(" "), o = t + a, s = {
|
|
133
|
+
method: i,
|
|
134
|
+
credentials: "same-origin",
|
|
135
|
+
headers: { Accept: "application/json" }
|
|
136
|
+
};
|
|
137
|
+
if (i === "GET") {
|
|
138
|
+
let e = new URLSearchParams();
|
|
139
|
+
for (let [t, n] of Object.entries(r)) n !== void 0 && e.set(t, String(n));
|
|
140
|
+
let t = e.toString();
|
|
141
|
+
t && (o += `?${t}`);
|
|
142
|
+
} else s.headers = {
|
|
143
|
+
Accept: "application/json",
|
|
144
|
+
"Content-Type": "application/json"
|
|
145
|
+
}, s.body = JSON.stringify(r);
|
|
146
|
+
let c;
|
|
147
|
+
try {
|
|
148
|
+
c = await (e.fetch ?? fetch)(o, s);
|
|
149
|
+
} catch (e) {
|
|
150
|
+
throw new fe("internal", `Onsite did not answer: ${e.message}`, 0);
|
|
151
|
+
}
|
|
152
|
+
let l = await c.json().catch(() => null);
|
|
153
|
+
if (!c.ok) {
|
|
154
|
+
let e = l?.error;
|
|
155
|
+
throw new fe(e?.code ?? "internal", e?.message ?? `Onsite answered ${c.status}.`, c.status);
|
|
156
|
+
}
|
|
157
|
+
return l;
|
|
158
|
+
} };
|
|
159
|
+
}
|
|
160
|
+
async function me(e = "/__onsite/overlay.js") {
|
|
161
|
+
try {
|
|
162
|
+
return (await import(
|
|
163
|
+
/* @vite-ignore */
|
|
164
|
+
"/@vite/client"
|
|
165
|
+
)).createHotContext?.(e) ?? null;
|
|
166
|
+
} catch {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function he(e, t, n) {
|
|
171
|
+
e.on(t, (e) => n(e));
|
|
172
|
+
}
|
|
173
|
+
function ge(e, t, n) {
|
|
174
|
+
let r = -1, i = 0, a = (e) => {
|
|
175
|
+
e.seq < r || (r = e.seq, n.state(e));
|
|
176
|
+
}, o = async () => {
|
|
177
|
+
let t = i;
|
|
178
|
+
try {
|
|
179
|
+
let a = await e.call("GET state", {});
|
|
180
|
+
if (i !== t && a.seq < r) return;
|
|
181
|
+
r = a.seq, n.state(a);
|
|
182
|
+
} catch (e) {
|
|
183
|
+
n.error?.(e);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return t && (he(t, "onsite:state", (e) => {
|
|
187
|
+
i += 1, a(e);
|
|
188
|
+
}), he(t, "onsite:text", (e) => n.text(e)), he(t, "onsite:flash", (e) => n.flash(e)), t.on("vite:afterUpdate", () => n.afterUpdate()), t.on("vite:ws:connect", () => void o())), o(), { refresh: o };
|
|
189
|
+
}
|
|
190
|
+
// src/context/cut.ts
|
|
191
|
+
var _e = new TextEncoder(), ve = new TextDecoder();
|
|
192
|
+
function ye(e, t) {
|
|
193
|
+
let n = _e.encode(e);
|
|
194
|
+
if (n.length <= t) return {
|
|
195
|
+
text: e,
|
|
196
|
+
cut: !1
|
|
197
|
+
};
|
|
198
|
+
let r = t;
|
|
199
|
+
for (; r > 0 && ((n[r] ?? 0) & 192) == 128;) r--;
|
|
200
|
+
return {
|
|
201
|
+
text: ve.decode(n.subarray(0, r)),
|
|
202
|
+
cut: !0
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function be(e) {
|
|
206
|
+
for (let t = e; t; t = t.parentElement) for (let e of Object.keys(t)) if (e.startsWith("__reactFiber$") || e.startsWith("__reactInternalInstance$")) return t[e] ?? null;
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
function y(e, t = 0) {
|
|
210
|
+
if (t > 3 || !e) return null;
|
|
211
|
+
if (typeof e == "function") {
|
|
212
|
+
let t = e;
|
|
213
|
+
return typeof t.displayName == "string" && t.displayName || typeof t.name == "string" && t.name || null;
|
|
214
|
+
}
|
|
215
|
+
if (typeof e == "object") {
|
|
216
|
+
let n = e;
|
|
217
|
+
return typeof n.displayName == "string" && n.displayName ? n.displayName : y(n.render, t + 1) ?? y(n.type, t + 1);
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
function xe(e) {
|
|
222
|
+
return typeof e.type == "function" || typeof e.type == "object" && e.type !== null && y(e.type) !== null;
|
|
223
|
+
}
|
|
224
|
+
var b = Symbol("left out"), Se = 8, Ce = 100;
|
|
225
|
+
function we(e) {
|
|
226
|
+
let t = e.$$typeof;
|
|
227
|
+
return typeof t == "symbol" || typeof t == "number";
|
|
228
|
+
}
|
|
229
|
+
function Te(e) {
|
|
230
|
+
let t = e;
|
|
231
|
+
return typeof t.nodeType == "number" && typeof t.nodeName == "string";
|
|
232
|
+
}
|
|
233
|
+
function Ee(e, t = [], n = 0) {
|
|
234
|
+
if (e === null || typeof e == "boolean" || typeof e == "string") return e;
|
|
235
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
236
|
+
if (typeof e == "bigint") return e.toString();
|
|
237
|
+
if (typeof e != "object" || t.includes(e) || we(e) || Te(e)) return b;
|
|
238
|
+
if (n >= Se) return "…";
|
|
239
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e.toISOString();
|
|
240
|
+
if (e instanceof RegExp) return String(e);
|
|
241
|
+
t.push(e);
|
|
242
|
+
try {
|
|
243
|
+
if (Array.isArray(e) || e instanceof Set) {
|
|
244
|
+
let r = [];
|
|
245
|
+
for (let i of e) {
|
|
246
|
+
if (r.length >= Ce) break;
|
|
247
|
+
let e = Ee(i, t, n + 1);
|
|
248
|
+
e !== b && r.push(e);
|
|
249
|
+
}
|
|
250
|
+
return r;
|
|
251
|
+
}
|
|
252
|
+
let r = e instanceof Map ? [...e].map(([e, t]) => [String(e), t]) : Object.keys(e).map((e) => [e, void 0]), i = {}, a = 0;
|
|
253
|
+
for (let [o, s] of r) {
|
|
254
|
+
if (a >= Ce) break;
|
|
255
|
+
let r = s;
|
|
256
|
+
if (!(e instanceof Map)) try {
|
|
257
|
+
r = e[o];
|
|
258
|
+
} catch {
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
let c = Ee(r, t, n + 1);
|
|
262
|
+
c !== b && (i[o] = c, a++);
|
|
263
|
+
}
|
|
264
|
+
return i;
|
|
265
|
+
} finally {
|
|
266
|
+
t.pop();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function De(e, t = 2048) {
|
|
270
|
+
let n = Ee(e), { text: r, cut: i } = ye(JSON.stringify(n === b ? {} : n) ?? "{}", t);
|
|
271
|
+
return {
|
|
272
|
+
json: r,
|
|
273
|
+
cut: i
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function Oe(e) {
|
|
277
|
+
let t = [], n = b, r = 0;
|
|
278
|
+
for (let i = be(e); i && t.length < 3 && r < 500; i = i.return ?? null, r++) {
|
|
279
|
+
if (!xe(i)) continue;
|
|
280
|
+
let e = y(i.type) ?? "Anonymous";
|
|
281
|
+
if (i.memoizedProps === n || t.at(-1)?.comp === e) continue;
|
|
282
|
+
n = i.memoizedProps;
|
|
283
|
+
let { json: r, cut: a } = De(i.memoizedProps ?? {}), o = {
|
|
284
|
+
comp: e,
|
|
285
|
+
json: r,
|
|
286
|
+
cut: a
|
|
287
|
+
}, s = i._debugSource;
|
|
288
|
+
s?.fileName && s.lineNumber && (o.src = `${s.fileName}:${s.lineNumber}:${s.columnNumber ?? 1}`), t.push(o);
|
|
289
|
+
}
|
|
290
|
+
return t;
|
|
291
|
+
}
|
|
292
|
+
// src/context/snapshot.ts
|
|
293
|
+
var ke = /* @__PURE__ */ new Set([
|
|
294
|
+
"SCRIPT",
|
|
295
|
+
"STYLE",
|
|
296
|
+
"NOSCRIPT",
|
|
297
|
+
"TEMPLATE",
|
|
298
|
+
"HEAD",
|
|
299
|
+
"META",
|
|
300
|
+
"LINK",
|
|
301
|
+
"svg",
|
|
302
|
+
"SVG",
|
|
303
|
+
"IFRAME",
|
|
304
|
+
"OBJECT"
|
|
305
|
+
]), Ae = /* @__PURE__ */ new Set(/* @__PURE__ */ "ADDRESS.ARTICLE.ASIDE.BLOCKQUOTE.BODY.DD.DETAILS.DIALOG.DIV.DL.DT.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.H1.H2.H3.H4.H5.H6.HEADER.HR.LI.MAIN.NAV.OL.P.PRE.SECTION.SUMMARY.TABLE.TD.TH.TR.UL".split(".")), je = {
|
|
306
|
+
HEADER: "header",
|
|
307
|
+
NAV: "nav",
|
|
308
|
+
MAIN: "main",
|
|
309
|
+
ASIDE: "aside",
|
|
310
|
+
FOOTER: "footer",
|
|
311
|
+
FORM: "form",
|
|
312
|
+
DIALOG: "dialog"
|
|
313
|
+
}, Me = /* @__PURE__ */ new Set([
|
|
314
|
+
"banner",
|
|
315
|
+
"navigation",
|
|
316
|
+
"main",
|
|
317
|
+
"complementary",
|
|
318
|
+
"contentinfo",
|
|
319
|
+
"region",
|
|
320
|
+
"search",
|
|
321
|
+
"form",
|
|
322
|
+
"dialog",
|
|
323
|
+
"alertdialog",
|
|
324
|
+
"toolbar",
|
|
325
|
+
"tablist",
|
|
326
|
+
"menu",
|
|
327
|
+
"group"
|
|
328
|
+
]), Ne = 80, Pe = 400, Fe = 6, x = (e) => (e ?? "").replace(/\s+/g, " ").trim(), S = (e) => e.length > Ne ? `${e.slice(0, 79)}…` : e, Ie = class {
|
|
329
|
+
doc;
|
|
330
|
+
host;
|
|
331
|
+
seen = /* @__PURE__ */ new Map();
|
|
332
|
+
view;
|
|
333
|
+
w;
|
|
334
|
+
h;
|
|
335
|
+
constructor(e, t) {
|
|
336
|
+
this.doc = e, this.host = t, this.view = e.defaultView ?? window, this.w = this.view.innerWidth, this.h = this.view.innerHeight;
|
|
337
|
+
}
|
|
338
|
+
visible(e) {
|
|
339
|
+
let t = this.seen.get(e);
|
|
340
|
+
if (t !== void 0) return t;
|
|
341
|
+
let n = !0;
|
|
342
|
+
if (e === this.host || ke.has(e.tagName)) n = !1;
|
|
343
|
+
else if (e.hasAttribute("hidden") || e.getAttribute("aria-hidden") === "true") n = !1;
|
|
344
|
+
else {
|
|
345
|
+
let t = this.view.getComputedStyle(e);
|
|
346
|
+
if (t.display === "none" || t.visibility === "hidden" || t.visibility === "collapse") n = !1;
|
|
347
|
+
else {
|
|
348
|
+
let t = e.getBoundingClientRect();
|
|
349
|
+
(t.width > 0 || t.height > 0) && (t.bottom < 0 || t.right < 0 || t.top > this.h || t.left > this.w) && (n = !1);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return n && e.parentElement && e.parentElement !== this.doc.documentElement && (n = this.visible(e.parentElement)), this.seen.set(e, n), n;
|
|
353
|
+
}
|
|
354
|
+
kids(e) {
|
|
355
|
+
return [...e.children].filter((e) => this.visible(e));
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
function C(e) {
|
|
359
|
+
let t = e.getAttribute("role");
|
|
360
|
+
if (t) return t.split(/\s+/)[0] ?? "";
|
|
361
|
+
let n = e.tagName;
|
|
362
|
+
if (/^H[1-6]$/.test(n)) return "heading";
|
|
363
|
+
if (n === "BUTTON" || n === "SUMMARY") return "button";
|
|
364
|
+
if (n === "A" && e.hasAttribute("href")) return "link";
|
|
365
|
+
if (n === "TABLE") return "table";
|
|
366
|
+
if (n === "UL" || n === "OL") return "list";
|
|
367
|
+
if (n === "SELECT") return "combobox";
|
|
368
|
+
if (n === "TEXTAREA") return "textbox";
|
|
369
|
+
if (n === "IMG") return e.getAttribute("alt") ? "img" : "";
|
|
370
|
+
if (n === "INPUT") {
|
|
371
|
+
let t = e.type;
|
|
372
|
+
return [
|
|
373
|
+
"button",
|
|
374
|
+
"submit",
|
|
375
|
+
"reset"
|
|
376
|
+
].includes(t) ? "button" : t === "hidden" ? "" : t === "search" ? "searchbox" : t === "checkbox" ? "checkbox" : t === "radio" ? "radio" : "textbox";
|
|
377
|
+
}
|
|
378
|
+
return "";
|
|
379
|
+
}
|
|
380
|
+
function w(e) {
|
|
381
|
+
let t = x(e.getAttribute("aria-label"));
|
|
382
|
+
if (t) return S(t);
|
|
383
|
+
let n = e.getAttribute("aria-labelledby");
|
|
384
|
+
if (n) {
|
|
385
|
+
let t = x(n.split(/\s+/).map((t) => e.ownerDocument.getElementById(t)?.textContent ?? "").join(" "));
|
|
386
|
+
if (t) return S(t);
|
|
387
|
+
}
|
|
388
|
+
if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) {
|
|
389
|
+
let t = x(e.labels?.[0]?.textContent);
|
|
390
|
+
if (t) return S(t);
|
|
391
|
+
let n = x(e.getAttribute("placeholder"));
|
|
392
|
+
return n ? S(n) : e instanceof HTMLInputElement && [
|
|
393
|
+
"button",
|
|
394
|
+
"submit",
|
|
395
|
+
"reset"
|
|
396
|
+
].includes(e.type) ? S(x(e.value)) : S(x(e.getAttribute("name")));
|
|
397
|
+
}
|
|
398
|
+
return e.tagName === "IMG" ? S(x(e.getAttribute("alt"))) : S(x(e.textContent) || x(e.getAttribute("title")));
|
|
399
|
+
}
|
|
400
|
+
function Le(e, t) {
|
|
401
|
+
let n = je[e.tagName], r = x(e.getAttribute("aria-label"));
|
|
402
|
+
return t && Me.has(t) ? r ? `${t} "${S(r)}"` : t : n ? r ? `${n} "${S(r)}"` : n : e.tagName === "SECTION" && r ? `region "${S(r)}"` : "";
|
|
403
|
+
}
|
|
404
|
+
function Re(e) {
|
|
405
|
+
let t = [...e.classList].slice(0, 2).join(".");
|
|
406
|
+
return e.tagName.toLowerCase() + (t ? `.${t}` : "");
|
|
407
|
+
}
|
|
408
|
+
var ze = class {
|
|
409
|
+
page;
|
|
410
|
+
lines = [];
|
|
411
|
+
full = !1;
|
|
412
|
+
constructor(e) {
|
|
413
|
+
this.page = e;
|
|
414
|
+
}
|
|
415
|
+
add(e, t) {
|
|
416
|
+
this.lines.length >= Pe ? this.full = !0 : this.lines.push(`${" ".repeat(e)}${t}`);
|
|
417
|
+
}
|
|
418
|
+
children(e, t) {
|
|
419
|
+
let n = this.page.kids(e), r = /* @__PURE__ */ new Map();
|
|
420
|
+
for (let e of n) {
|
|
421
|
+
let t = Re(e), n = r.get(t);
|
|
422
|
+
n ? n.push(e) : r.set(t, [e]);
|
|
423
|
+
}
|
|
424
|
+
let i = /* @__PURE__ */ new Set();
|
|
425
|
+
for (let e of n) {
|
|
426
|
+
let n = Re(e), a = r.get(n) ?? [e];
|
|
427
|
+
a.length < 3 || !this.repeatable(e) ? this.element(e, t) : i.has(n) || (i.add(n), this.repeated(a, n, t));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
repeatable(e) {
|
|
431
|
+
let t = C(e);
|
|
432
|
+
return t !== "heading" && !Le(e, t);
|
|
433
|
+
}
|
|
434
|
+
repeated(e, t, n) {
|
|
435
|
+
let r = C(e[0]);
|
|
436
|
+
if (r === "button" || r === "link") {
|
|
437
|
+
let t = e.slice(0, Fe).map((e) => `"${w(e)}"`);
|
|
438
|
+
e.length > Fe && t.push("…"), this.add(n, `${r}s: ${e.length} (${t.join(", ")})`);
|
|
439
|
+
} else this.add(n, `repeated ${t}: ${e.length} items, the first:`), this.element(e[0], n + 1);
|
|
440
|
+
}
|
|
441
|
+
element(e, t) {
|
|
442
|
+
let n = C(e), r = Le(e, n);
|
|
443
|
+
if (r) this.add(t, r), this.children(e, t + 1);
|
|
444
|
+
else {
|
|
445
|
+
switch (n) {
|
|
446
|
+
case "heading": {
|
|
447
|
+
let n = /^H([1-6])$/.exec(e.tagName)?.[1] ?? e.getAttribute("aria-level") ?? "2";
|
|
448
|
+
this.add(t, `h${n}: ${w(e)}`);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
case "button":
|
|
452
|
+
case "link":
|
|
453
|
+
case "checkbox":
|
|
454
|
+
case "radio":
|
|
455
|
+
case "combobox":
|
|
456
|
+
case "img":
|
|
457
|
+
this.add(t, `${n === "img" ? "image" : n}: ${w(e)}`);
|
|
458
|
+
return;
|
|
459
|
+
case "textbox":
|
|
460
|
+
case "searchbox":
|
|
461
|
+
this.add(t, `${n === "searchbox" ? "search field" : "field"}: ${w(e)}`);
|
|
462
|
+
return;
|
|
463
|
+
case "table":
|
|
464
|
+
case "grid": {
|
|
465
|
+
let n = e.querySelectorAll("tbody tr, [role=row]").length || e.querySelectorAll("tr").length, r = [...e.querySelectorAll("th, [role=columnheader]")].slice(0, 8).map((e) => x(e.textContent));
|
|
466
|
+
this.add(t, `table: ${n} rows${r.length ? ` (${r.filter(Boolean).join(" · ")})` : ""}`);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
case "list": {
|
|
470
|
+
let n = [...e.children].filter((e) => e.tagName === "LI" || e.getAttribute("role") === "listitem"), r = n.map((e) => {
|
|
471
|
+
let t = this.page.kids(e);
|
|
472
|
+
return t.length === 1 && ["link", "button"].includes(C(t[0])) ? t[0] : null;
|
|
473
|
+
});
|
|
474
|
+
if (n.length && r.every(Boolean)) {
|
|
475
|
+
let e = r.slice(0, Fe).map((e) => `"${w(e)}"`);
|
|
476
|
+
n.length > Fe && e.push("…"), this.add(t, `list: ${n.length} items (${e.join(", ")})`);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
this.add(t, `list: ${n.length} items${n.length > 1 ? ", the first:" : ""}`), n[0] && this.page.visible(n[0]) && this.children(n[0], t + 1);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
this.children(e, t);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
function Be(e) {
|
|
488
|
+
let t = e.doc, n = t.body;
|
|
489
|
+
if (!n) return "";
|
|
490
|
+
let r = t.createTreeWalker(n, NodeFilter.SHOW_TEXT), i = [], a = null;
|
|
491
|
+
for (let t = r.nextNode(); t; t = r.nextNode()) {
|
|
492
|
+
let n = x(t.nodeValue), r = t.parentElement;
|
|
493
|
+
if (!n || !r || !e.visible(r)) continue;
|
|
494
|
+
let o = r;
|
|
495
|
+
for (; o && !Ae.has(o.tagName);) o = o.parentElement;
|
|
496
|
+
if (i.length && o !== a) {
|
|
497
|
+
let e = o?.parentElement && o.parentElement === a?.parentElement;
|
|
498
|
+
i.push(e && (o?.tagName === "TD" || o?.tagName === "TH") ? " · " : "\n");
|
|
499
|
+
} else i.length && i.push(" ");
|
|
500
|
+
i.push(n), a = o;
|
|
501
|
+
}
|
|
502
|
+
return i.join("").replace(/ *\n */g, "\n").replace(/\n{2,}/g, "\n");
|
|
503
|
+
}
|
|
504
|
+
function Ve(e = {}) {
|
|
505
|
+
let t = e.doc ?? document, r = t.defaultView ?? window, i = new Ie(t, e.host ?? null), a = new ze(i);
|
|
506
|
+
t.body && a.children(t.body, 0);
|
|
507
|
+
let o = ye(a.lines.join("\n"), n), s = ye(Be(i), n), c = r.location;
|
|
508
|
+
return {
|
|
509
|
+
route: c.pathname + c.search + c.hash,
|
|
510
|
+
title: t.title,
|
|
511
|
+
viewport: {
|
|
512
|
+
w: r.innerWidth,
|
|
513
|
+
h: r.innerHeight
|
|
514
|
+
},
|
|
515
|
+
scheme: e.scheme ?? "light",
|
|
516
|
+
outline: o.text,
|
|
517
|
+
text: s.text,
|
|
518
|
+
cut: o.cut || s.cut || a.full
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
// src/context/index.ts
|
|
522
|
+
var He = RegExp(` (?:${e}|${t})="[^"]*"`, "g");
|
|
523
|
+
function Ue(e) {
|
|
524
|
+
let n = { src: e.getAttribute("data-onsite-src") ?? "" }, r = e.getAttribute(t);
|
|
525
|
+
r && (n.comp = r), n.tag = e.tagName.toLowerCase(), n.html = e.outerHTML.replace(He, "").slice(0, 1500);
|
|
526
|
+
let i = e.getBoundingClientRect();
|
|
527
|
+
n.w = Math.round(i.width), n.h = Math.round(i.height);
|
|
528
|
+
let a = Oe(e);
|
|
529
|
+
return a.length && (n.props = a), n;
|
|
530
|
+
}
|
|
531
|
+
function We(e, t = {}) {
|
|
532
|
+
return {
|
|
533
|
+
selection: e.filter((e) => e.isConnected).map(Ue),
|
|
534
|
+
page: Ve(t)
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
// src/dock.ts
|
|
538
|
+
var Ge = [
|
|
539
|
+
"top-left",
|
|
540
|
+
"top-center",
|
|
541
|
+
"top-right",
|
|
542
|
+
"bottom-left",
|
|
543
|
+
"bottom-center",
|
|
544
|
+
"bottom-right"
|
|
545
|
+
], Ke = "bottom-right";
|
|
546
|
+
function qe(e) {
|
|
547
|
+
return typeof e == "string" && Ge.includes(e);
|
|
548
|
+
}
|
|
549
|
+
function Je(e) {
|
|
550
|
+
return qe(e) ? e : Ke;
|
|
551
|
+
}
|
|
552
|
+
var T = (e) => e.startsWith("top") ? "top" : "bottom", E = (e) => e.endsWith("left") ? "left" : e.endsWith("right") ? "right" : "center", D = [
|
|
553
|
+
"left",
|
|
554
|
+
"center",
|
|
555
|
+
"right"
|
|
556
|
+
], O = (e, t) => `${e}-${t}`;
|
|
557
|
+
function Ye(e, t, n) {
|
|
558
|
+
let r = e === "left" ? 24 : e === "right" ? n.w - 24 - t : (n.w - t) / 2;
|
|
559
|
+
return Math.max(0, r);
|
|
560
|
+
}
|
|
561
|
+
function k(e, t) {
|
|
562
|
+
let n = T(e) === "top" ? 24 : t.h - 24 - 48;
|
|
563
|
+
return {
|
|
564
|
+
left: Ye(E(e), 48, t),
|
|
565
|
+
top: Math.max(0, n),
|
|
566
|
+
width: 48,
|
|
567
|
+
height: 48
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function Xe(e, t) {
|
|
571
|
+
let n = k(e, t);
|
|
572
|
+
return {
|
|
573
|
+
x: n.left + n.width / 2,
|
|
574
|
+
y: n.top + n.height / 2
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function Ze(e, t, n, r = 12) {
|
|
578
|
+
let i = Math.max(0, Math.min(n, t.w - 48)), a = Ye(E(e), i, t), o = 72 + r, s = Math.max(0, t.h - o - 24);
|
|
579
|
+
return T(e) === "top" ? {
|
|
580
|
+
left: a,
|
|
581
|
+
width: i,
|
|
582
|
+
top: o,
|
|
583
|
+
maxHeight: s
|
|
584
|
+
} : {
|
|
585
|
+
left: a,
|
|
586
|
+
width: i,
|
|
587
|
+
bottom: o,
|
|
588
|
+
maxHeight: s
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function Qe(e, t, n, r, i = 12) {
|
|
592
|
+
let a = Ze(e, t, n, i), o = Math.min(r, a.maxHeight), s = a.top ?? t.h - (a.bottom ?? 0) - o;
|
|
593
|
+
return {
|
|
594
|
+
left: a.left,
|
|
595
|
+
top: s,
|
|
596
|
+
width: a.width,
|
|
597
|
+
height: o
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function $e(e, t, n) {
|
|
601
|
+
let r = Ke, i = 1e400;
|
|
602
|
+
for (let a of Ge) {
|
|
603
|
+
let o = Xe(a, n), s = (o.x - e) ** 2 + (o.y - t) ** 2;
|
|
604
|
+
s < i && (r = a, i = s);
|
|
605
|
+
}
|
|
606
|
+
return r;
|
|
607
|
+
}
|
|
608
|
+
function et(e, t) {
|
|
609
|
+
let n = D.indexOf(E(e));
|
|
610
|
+
return t === "ArrowLeft" ? O(T(e), D[Math.max(0, n - 1)] ?? "left") : t === "ArrowRight" ? O(T(e), D[Math.min(2, n + 1)] ?? "right") : t === "ArrowUp" ? O("top", E(e)) : t === "ArrowDown" ? O("bottom", E(e)) : e;
|
|
611
|
+
}
|
|
612
|
+
function tt(e, t) {
|
|
613
|
+
let n = Math.max(0, e.left), r = Math.max(0, e.top), i = Math.min(t.w, e.left + e.width), a = Math.min(t.h, e.top + e.height);
|
|
614
|
+
return i > n && a > r ? {
|
|
615
|
+
left: n,
|
|
616
|
+
top: r,
|
|
617
|
+
width: i - n,
|
|
618
|
+
height: a - r
|
|
619
|
+
} : null;
|
|
620
|
+
}
|
|
621
|
+
function nt(e, t) {
|
|
622
|
+
let n = Math.min(e.left + e.width, t.left + t.width) - Math.max(e.left, t.left), r = Math.min(e.top + e.height, t.top + t.height) - Math.max(e.top, t.top);
|
|
623
|
+
return n > 0 && r > 0 ? n * r : 0;
|
|
624
|
+
}
|
|
625
|
+
function rt(e, t) {
|
|
626
|
+
return Math.abs(D.indexOf(E(e)) - D.indexOf(E(t))) + (T(e) === T(t) ? 0 : 1);
|
|
627
|
+
}
|
|
628
|
+
function it(e, t, n) {
|
|
629
|
+
let r = (e) => {
|
|
630
|
+
let r = 0;
|
|
631
|
+
for (let i of t(e)) for (let e of n) r += nt(i, e);
|
|
632
|
+
return r;
|
|
633
|
+
};
|
|
634
|
+
if (r(e) === 0) return e;
|
|
635
|
+
let i = Ge.map((t, n) => ({
|
|
636
|
+
a: t,
|
|
637
|
+
key: [
|
|
638
|
+
r(t),
|
|
639
|
+
T(t) === T(e) ? 0 : 1,
|
|
640
|
+
rt(t, e),
|
|
641
|
+
t === "bottom-right" ? 0 : 1,
|
|
642
|
+
n
|
|
643
|
+
]
|
|
644
|
+
}));
|
|
645
|
+
return i.sort((e, t) => {
|
|
646
|
+
for (let n = 0; n < e.key.length; n++) {
|
|
647
|
+
let r = (e.key[n] ?? 0) - (t.key[n] ?? 0);
|
|
648
|
+
if (r !== 0) return r;
|
|
649
|
+
}
|
|
650
|
+
return 0;
|
|
651
|
+
}), i[0]?.a ?? e;
|
|
652
|
+
}
|
|
653
|
+
// src/dom.ts
|
|
654
|
+
function at(e, t) {
|
|
655
|
+
for (let n of t) n != null && n !== !1 && (Array.isArray(n) ? at(e, n) : e.appendChild(typeof n == "string" || typeof n == "number" ? document.createTextNode(String(n)) : n));
|
|
656
|
+
}
|
|
657
|
+
function A(e, t, ...n) {
|
|
658
|
+
let r = document.createElement(e);
|
|
659
|
+
for (let [e, n] of Object.entries(t ?? {})) if (e === "on") for (let [e, t] of Object.entries(n)) r.addEventListener(e, t);
|
|
660
|
+
else n === !0 ? r.setAttribute(e, "") : n !== !1 && n != null && r.setAttribute(e, String(n));
|
|
661
|
+
return at(r, n), r;
|
|
662
|
+
}
|
|
663
|
+
var ot = /* @__PURE__ */ new Map();
|
|
664
|
+
function j(e) {
|
|
665
|
+
let t = ot.get(e);
|
|
666
|
+
if (!t) {
|
|
667
|
+
let n = document.createElement("template");
|
|
668
|
+
n.innerHTML = e.trim(), t = n.content.firstElementChild ?? document.createElement("span"), ot.set(e, t);
|
|
669
|
+
}
|
|
670
|
+
return t.cloneNode(!0);
|
|
671
|
+
}
|
|
672
|
+
function st(e, t, n = 0) {
|
|
673
|
+
e.style.left = `${t.left - n}px`, e.style.top = `${t.top - n}px`, e.style.width = `${t.width + n * 2}px`, e.style.height = `${t.height + n * 2}px`;
|
|
674
|
+
}
|
|
675
|
+
var M = () => new Promise((e) => requestAnimationFrame(() => e())), ct = (e) => new Promise((t) => setTimeout(t, e));
|
|
676
|
+
function N() {
|
|
677
|
+
try {
|
|
678
|
+
return matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
679
|
+
} catch {
|
|
680
|
+
return !1;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
function lt() {
|
|
684
|
+
return /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
685
|
+
}
|
|
686
|
+
function P() {
|
|
687
|
+
return lt() ? "⌥" : "Alt";
|
|
688
|
+
}
|
|
689
|
+
function ut(e) {
|
|
690
|
+
return e ? e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? !0 : e instanceof HTMLInputElement ? ![
|
|
691
|
+
"button",
|
|
692
|
+
"submit",
|
|
693
|
+
"checkbox",
|
|
694
|
+
"radio",
|
|
695
|
+
"reset"
|
|
696
|
+
].includes(e.type) : e.isContentEditable === !0 : !1;
|
|
697
|
+
}
|
|
698
|
+
// src/icons.ts
|
|
699
|
+
var dt = "<path d=\"M5 11V5h6\"/><path d=\"M21 5h6v6\"/><path d=\"M27 21v6h-6\"/><path d=\"M11 27H5v-6\"/>";
|
|
700
|
+
function F(e, t, n = !1) {
|
|
701
|
+
return `<svg width="${e}" height="${e}" viewBox="0 0 32 32" aria-hidden="true" style="overflow:visible"><g fill="none" stroke="var(--os-ink)" stroke-width="${t}" stroke-linecap="round" stroke-linejoin="round">${dt}</g>${n ? "<circle class=\"dotpulse\" cx=\"16\" cy=\"16\" r=\"4.5\" fill=\"var(--os-mark)\"/>" : ""}<circle cx="16" cy="16" r="4.5" fill="var(--os-mark)"/></svg>`;
|
|
702
|
+
}
|
|
703
|
+
var I = (e, t = 14, n = "") => `<svg width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"${n}>${e}</svg>`, L = {
|
|
704
|
+
select: I("<path d=\"M4 4l7 17 2.5-7.5L21 11z\"/>"),
|
|
705
|
+
alt: I("<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"3\" stroke-dasharray=\"3 3\"/>"),
|
|
706
|
+
scheme: I("<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M12 3.5v17\"/><path d=\"M12 3.5a8.5 8.5 0 0 1 0 17z\" fill=\"currentColor\" stroke=\"none\"/>", 15),
|
|
707
|
+
close: I("<path d=\"M6 9l6 6 6-6\"/>", 16),
|
|
708
|
+
read: I("<path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>"),
|
|
709
|
+
list: I("<path d=\"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01\"/>"),
|
|
710
|
+
write: I("<path d=\"M4 20h4L19 9l-4-4L4 16z\"/>", 14, " style=\"color:var(--os-accent-text)\""),
|
|
711
|
+
done: I("<path d=\"M5 12l5 5 9-10\"/>", 14, " style=\"color:var(--os-add)\" stroke-width=\"2.4\""),
|
|
712
|
+
error: I("<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 7v6M12 16.5v.5\"/>", 14),
|
|
713
|
+
keep: I("<path d=\"M12 4v12M6 10l6 6 6-6M5 20h14\"/>", 14),
|
|
714
|
+
undo: I("<path d=\"M9 14L4 9l5-5\"/><path d=\"M4 9h10a6 6 0 0 1 0 12h-3\"/>", 14),
|
|
715
|
+
more: I("<path d=\"M6 9l6 6 6-6\"/>", 12),
|
|
716
|
+
dots: I("<circle cx=\"5\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"19\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/>", 14),
|
|
717
|
+
back: I("<path d=\"M15 6l-6 6 6 6\"/>", 16),
|
|
718
|
+
next: I("<path d=\"M9 6l6 6-6 6\"/>", 14),
|
|
719
|
+
export: I("<path d=\"M12 15V4M7 9l5-5 5 5M5 14v5h14v-5\"/>", 14),
|
|
720
|
+
skills: I("<path d=\"M4 5a2 2 0 0 1 2-2h13v15H6a2 2 0 0 0-2 2z\"/><path d=\"M4 20a2 2 0 0 0 2 2h13v-4\"/>", 14),
|
|
721
|
+
preset: I("<path d=\"M13 3L5 14h6l-1 7 8-11h-6z\"/>", 14),
|
|
722
|
+
settings: I("<circle cx=\"12\" cy=\"12\" r=\"3\"/><path d=\"M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z\"/>", 14),
|
|
723
|
+
hide: I("<path d=\"M3 3l18 18\"/><path d=\"M10.6 5.1A10 10 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-3.2 4.1M6.6 6.6C3.9 8.4 2 12 2 12s3.5 7 10 7a9.7 9.7 0 0 0 5.4-1.6\"/><path d=\"M9.9 9.9a3 3 0 0 0 4.2 4.2\"/>", 14),
|
|
724
|
+
show: I("<path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z\"/><circle cx=\"12\" cy=\"12\" r=\"3\"/>", 14),
|
|
725
|
+
edit: I("<path d=\"M4 20h4L19 9l-4-4L4 16z\"/>", 14),
|
|
726
|
+
trash: I("<path d=\"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3\"/>", 14),
|
|
727
|
+
plus: I("<path d=\"M12 5v14M5 12h14\"/>", 14),
|
|
728
|
+
layers: I("<path d=\"M12 3l9 5-9 5-9-5z\"/><path d=\"M3 13l9 5 9-5\"/>", 12),
|
|
729
|
+
original: I("<path d=\"M14 3H6v18h12V7z\"/><path d=\"M14 3v4h4\"/>", 14),
|
|
730
|
+
send: I("<path d=\"m5 12 7-7 7 7\"/><path d=\"M12 19V5\"/>", 18),
|
|
731
|
+
queue: I("<path d=\"M11 12H3\"/><path d=\"M16 6H3\"/><path d=\"M16 18H3\"/><path d=\"M18 9v6\"/><path d=\"M21 12h-6\"/>", 17),
|
|
732
|
+
pinComment: I("<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/><path d=\"M12 7v6\"/><path d=\"M9 10h6\"/>", 16),
|
|
733
|
+
takes: I("<path d=\"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z\"/><path d=\"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65\"/><path d=\"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65\"/>", 16),
|
|
734
|
+
stop: I("<rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" fill=\"currentColor\"/>", 16),
|
|
735
|
+
x: I("<path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>", 12),
|
|
736
|
+
element: I("<path d=\"M3 7V5a2 2 0 0 1 2-2h2\"/><path d=\"M17 3h2a2 2 0 0 1 2 2v2\"/><path d=\"M21 17v2a2 2 0 0 1-2 2h-2\"/><path d=\"M7 21H5a2 2 0 0 1-2-2v-2\"/>", 12),
|
|
737
|
+
commentChip: I("<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>", 12),
|
|
738
|
+
comment: I("<path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\"/>", 14),
|
|
739
|
+
mouse: I("<rect x=\"6\" y=\"3\" width=\"12\" height=\"18\" rx=\"6\"/><path d=\"M12 3v6\"/><path d=\"M12 3a6 6 0 0 0-6 6h6z\" fill=\"currentColor\" stroke=\"none\"/>", 14)
|
|
740
|
+
};
|
|
741
|
+
// src/frames.ts
|
|
742
|
+
function ft(e, t) {
|
|
743
|
+
let n = [];
|
|
744
|
+
for (let r of e.entries) {
|
|
745
|
+
if (r.who !== "person" || t.has(r.id)) continue;
|
|
746
|
+
let i = e.running === r.id, a = (e.queue?.indexOf(r.id) ?? -1) + 1, o = e.takes.filter((e) => e.of === r.id && e.state === "open").sort((e, t) => e.no - t.no);
|
|
747
|
+
(i || a || o.length !== 0) && n.push({
|
|
748
|
+
run: r.id,
|
|
749
|
+
running: i,
|
|
750
|
+
queued: a,
|
|
751
|
+
takes: o,
|
|
752
|
+
selected: (r.selection ?? []).map((e) => e.src).filter(Boolean),
|
|
753
|
+
step: pt(r.steps, r.kind === "takes")
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
return n;
|
|
757
|
+
}
|
|
758
|
+
function pt(e, t) {
|
|
759
|
+
let n = e?.at(-1);
|
|
760
|
+
if (!n) return "Working…";
|
|
761
|
+
if (n.tool === "src_read") return `Reading ${i(n.path)}`;
|
|
762
|
+
if (n.tool === "src_list") return `Looking through ${n.path || "the source folder"}`;
|
|
763
|
+
let r = t && n.take ? ` · ${u(n.take)}` : "";
|
|
764
|
+
return `Editing ${i(n.path)}${r}`;
|
|
765
|
+
}
|
|
766
|
+
function mt(e, t, n) {
|
|
767
|
+
let r = t.find((e) => e.id === n);
|
|
768
|
+
return r ? r.of === e : n.startsWith(`${e}-`);
|
|
769
|
+
}
|
|
770
|
+
var R = (e) => e.showing ?? (e.shown ? [e.shown] : []);
|
|
771
|
+
function ht(e, t, n) {
|
|
772
|
+
return n.find((n) => mt(e, t, n)) ?? "";
|
|
773
|
+
}
|
|
774
|
+
function gt(e, t, n, r) {
|
|
775
|
+
let i = {
|
|
776
|
+
stamps: [],
|
|
777
|
+
selectors: []
|
|
778
|
+
}, a = {
|
|
779
|
+
stamps: [],
|
|
780
|
+
selectors: []
|
|
781
|
+
}, o = ht(e, t, r);
|
|
782
|
+
for (let r of n?.groups ?? []) {
|
|
783
|
+
let n = r.takes.filter((n) => mt(e, t, n));
|
|
784
|
+
n.length !== 0 && (z(i, r), o && n.includes(o) && z(a, r));
|
|
785
|
+
}
|
|
786
|
+
return {
|
|
787
|
+
all: i,
|
|
788
|
+
strong: a
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
function z(e, t) {
|
|
792
|
+
for (let n of t.stamps ?? []) e.stamps.includes(n) || e.stamps.push(n);
|
|
793
|
+
for (let n of t.selectors ?? []) e.selectors.includes(n) || e.selectors.push(n);
|
|
794
|
+
}
|
|
795
|
+
function _t(e, t) {
|
|
796
|
+
if (t === "") return "";
|
|
797
|
+
let n = e.filter((e) => !e.running && !e.queued);
|
|
798
|
+
return t && n.some((e) => e.run === t) ? t : e.findLast((e) => !e.queued)?.running ? "" : n.at(-1)?.run ?? "";
|
|
799
|
+
}
|
|
800
|
+
function vt(e, t, n) {
|
|
801
|
+
let r = Math.max(8, Math.min(e.left, n.w - t.w - 8)), i = e.top - 8 - t.h;
|
|
802
|
+
if (i >= 8) return {
|
|
803
|
+
left: r,
|
|
804
|
+
top: i,
|
|
805
|
+
side: "above"
|
|
806
|
+
};
|
|
807
|
+
let a = e.top + e.height + 8;
|
|
808
|
+
if (a + t.h <= n.h - 8) return {
|
|
809
|
+
left: r,
|
|
810
|
+
top: a,
|
|
811
|
+
side: "below"
|
|
812
|
+
};
|
|
813
|
+
let o = Math.max(8, Math.min(e.top + 8, n.h - t.h - 8)), s = e.left - 8 - t.w;
|
|
814
|
+
if (s >= 8) return {
|
|
815
|
+
left: s,
|
|
816
|
+
top: o,
|
|
817
|
+
side: "left"
|
|
818
|
+
};
|
|
819
|
+
let c = e.left + e.width + 8;
|
|
820
|
+
return c + t.w <= n.w - 8 ? {
|
|
821
|
+
left: c,
|
|
822
|
+
top: o,
|
|
823
|
+
side: "right"
|
|
824
|
+
} : {
|
|
825
|
+
left: r,
|
|
826
|
+
top: Math.max(8, Math.min(e.top + e.height - 8 - t.h, n.h - t.h - 8)),
|
|
827
|
+
side: "inside"
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function yt(e, t, n) {
|
|
831
|
+
let r = { ...e }, i = (e) => r.left < e.left + e.width && r.left + r.width > e.left && r.top < e.top + e.height && r.top + r.height > e.top;
|
|
832
|
+
for (let a = 0; a < 12; a++) {
|
|
833
|
+
let a = t.find(i);
|
|
834
|
+
if (!a) break;
|
|
835
|
+
r.left = a.left + a.width + 4, r.left + r.width > n.w - 8 && (r.left = e.left, r.top = Math.min(a.top + a.height + 4, n.h - r.height - 8));
|
|
836
|
+
}
|
|
837
|
+
return r;
|
|
838
|
+
}
|
|
839
|
+
var B = (e, t) => e.left < t.left + t.width && e.left + e.width > t.left && e.top < t.top + t.height && e.top + e.height > t.top, bt = (e, t) => e.left <= t.left && e.top <= t.top && e.left + e.width >= t.left + t.width && e.top + e.height >= t.top + t.height, xt = (e, t) => Math.max(0, t.left - (e.left + e.width), e.left - (t.left + t.width)) + Math.max(0, t.top - (e.top + e.height), e.top - (t.top + t.height));
|
|
840
|
+
function St(e, t) {
|
|
841
|
+
let n = [];
|
|
842
|
+
return e.map((r, i) => {
|
|
843
|
+
let { anchor: a, size: o } = r, s = e.flatMap((e, t) => t === i ? [] : e.own), c = s.filter((e) => bt(e, a)), l = s.filter((e) => !bt(e, a)), u = (e, n) => ({
|
|
844
|
+
left: Math.max(4, Math.min(e, t.w - o.w - 4)),
|
|
845
|
+
top: Math.max(4, Math.min(n, t.h - o.h - 4)),
|
|
846
|
+
width: o.w,
|
|
847
|
+
height: o.h
|
|
848
|
+
}), d = [], f = (e) => {
|
|
849
|
+
d.push(u(a.left + a.width - o.w, e), u(a.left, e));
|
|
850
|
+
for (let t of n) d.push(u(t.left - 4 - o.w, e), u(t.left + t.width + 4, e));
|
|
851
|
+
}, p = (e) => {
|
|
852
|
+
d.push(u(e, a.top));
|
|
853
|
+
for (let t of n) d.push(u(e, t.top + t.height + 4));
|
|
854
|
+
};
|
|
855
|
+
for (let e = 0; e < 3; e++) f(a.top - 4 - o.h - e * (o.h + 4)), f(a.top + a.height + 4 + e * (o.h + 4)), e === 0 && (p(a.left - 4 - o.w), p(a.left + a.width + 4));
|
|
856
|
+
d.push(u(a.left + a.width - 4 - o.w, a.top + a.height - 4 - o.h));
|
|
857
|
+
let m = null, h = 1e400;
|
|
858
|
+
for (let [e, t] of d.entries()) {
|
|
859
|
+
if (n.some((e) => B(t, e))) continue;
|
|
860
|
+
let i = (r.own.some((e) => B(t, e)) ? 1e3 : 0) + 100 * l.filter((e) => B(t, e)).length + 20 * c.filter((e) => B(t, e)).length + xt(t, a) + e / 1e3;
|
|
861
|
+
i < h && (m = t, h = i);
|
|
862
|
+
}
|
|
863
|
+
let g = m ?? yt(d[0], n, t);
|
|
864
|
+
return n.push(g), g;
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
function V(e, t, n, r) {
|
|
868
|
+
return t.find((e) => n.includes(e.id)) ?? t.find((t) => t.id === r.get(e)) ?? t[0];
|
|
869
|
+
}
|
|
870
|
+
var Ct = (e, t) => !e.some((e) => t.includes(e.id));
|
|
871
|
+
function wt(e) {
|
|
872
|
+
return A("div", {
|
|
873
|
+
class: "frametag",
|
|
874
|
+
"data-frametag": e.run,
|
|
875
|
+
role: "status"
|
|
876
|
+
}, A("span", {
|
|
877
|
+
class: "spin",
|
|
878
|
+
"aria-hidden": "true"
|
|
879
|
+
}), A("span", null, e.step));
|
|
880
|
+
}
|
|
881
|
+
function Tt(e, t) {
|
|
882
|
+
return A("div", {
|
|
883
|
+
class: "framequeue",
|
|
884
|
+
"data-framequeue": e.run
|
|
885
|
+
}, A("span", null, d(e.queued - 1)), A("button", {
|
|
886
|
+
type: "button",
|
|
887
|
+
"aria-label": "Cancel this ask. It has not started.",
|
|
888
|
+
title: "Cancel this ask. It has not started.",
|
|
889
|
+
"data-fkey": `cancel:${e.run}`,
|
|
890
|
+
"data-frame-cancel": "",
|
|
891
|
+
on: { click: (n) => {
|
|
892
|
+
n.stopPropagation(), t.cancel(e.run);
|
|
893
|
+
} }
|
|
894
|
+
}, "×"));
|
|
895
|
+
}
|
|
896
|
+
function Et(e, t) {
|
|
897
|
+
let n = f(e.takes.map((e) => e.no));
|
|
898
|
+
return A("button", {
|
|
899
|
+
class: "framefold",
|
|
900
|
+
type: "button",
|
|
901
|
+
"aria-label": `Open the bar of ${n}`,
|
|
902
|
+
title: `${n}: switch, keep or skip`,
|
|
903
|
+
"data-framefold": e.run,
|
|
904
|
+
"data-fkey": `fold:${e.run}`,
|
|
905
|
+
on: { click: (n) => {
|
|
906
|
+
n.stopPropagation(), t.openFrame(e.run);
|
|
907
|
+
} }
|
|
908
|
+
}, n, j(L.more));
|
|
909
|
+
}
|
|
910
|
+
function Dt(e, t, n, r) {
|
|
911
|
+
return A("div", {
|
|
912
|
+
class: "framebar",
|
|
913
|
+
role: "toolbar",
|
|
914
|
+
tabindex: 0,
|
|
915
|
+
"aria-label": `${e.takes.length > 1 ? "Takes" : "Take"} of this change. Left and Right switch takes, O shows the original, Enter keeps, Escape closes.`,
|
|
916
|
+
"data-framebar": e.run,
|
|
917
|
+
"aria-busy": n ? "true" : null,
|
|
918
|
+
"data-fkey": `bar:${e.run}`
|
|
919
|
+
}, A("span", {
|
|
920
|
+
class: "framemark",
|
|
921
|
+
"aria-hidden": "true"
|
|
922
|
+
}, j(F(14, 3.2))), Ot(e.run, e.takes, t, r, `f:${e.run}`), A("button", {
|
|
923
|
+
class: "btn ghost icon",
|
|
924
|
+
type: "button",
|
|
925
|
+
"aria-label": "Hide this frame. The takes stay open.",
|
|
926
|
+
title: "Hide this frame. The takes stay open.",
|
|
927
|
+
"data-fkey": `hide:${e.run}`,
|
|
928
|
+
"data-frame-hide": "",
|
|
929
|
+
on: { click: () => r.hideFrame(e.run) }
|
|
930
|
+
}, "×"));
|
|
931
|
+
}
|
|
932
|
+
function Ot(e, t, n, r, i) {
|
|
933
|
+
let a = V(e, t, n.showing, n.picked), o = Ct(t, n.showing), s = !o && a ? ee(a, n.all, n.asks) : null, c = document.createDocumentFragment();
|
|
934
|
+
return c.append(A("button", {
|
|
935
|
+
class: "btn origin",
|
|
936
|
+
type: "button",
|
|
937
|
+
"aria-pressed": String(o),
|
|
938
|
+
title: o ? `Showing your code as it is on disk. Press to show ${a ? u(a.no) : "the take"} again.` : "Show your code as it is on disk",
|
|
939
|
+
"data-fkey": `orig:${i}`,
|
|
940
|
+
"data-original": "",
|
|
941
|
+
on: { click: () => r.toggleOriginal(e) }
|
|
942
|
+
}, "Original"), A("div", {
|
|
943
|
+
class: `seg${o ? " dim" : ""}`,
|
|
944
|
+
role: "group",
|
|
945
|
+
"aria-label": "Takes"
|
|
946
|
+
}, t.map((e) => A("button", {
|
|
947
|
+
type: "button",
|
|
948
|
+
...e.stale?.length ? { class: "stale" } : {},
|
|
949
|
+
"aria-pressed": String(e.id === a?.id),
|
|
950
|
+
"aria-label": e.stale?.length ? `${u(e.no)}, ${h.toLowerCase()}` : u(e.no),
|
|
951
|
+
title: [[
|
|
952
|
+
p(e, !0),
|
|
953
|
+
e.stopped ? "stopped" : "",
|
|
954
|
+
e.stale?.length ? h : ""
|
|
955
|
+
].filter(Boolean).join(" · "), e.note ?? ""].filter(Boolean).join("\n"),
|
|
956
|
+
"data-fkey": `seg:${i}:${e.id}`,
|
|
957
|
+
"data-take": e.id,
|
|
958
|
+
on: { click: () => r.show(e.id) }
|
|
959
|
+
}, String(e.no)))), ...s ? [A("span", {
|
|
960
|
+
class: "covered",
|
|
961
|
+
title: s.title,
|
|
962
|
+
"data-covered": ""
|
|
963
|
+
}, j(L.layers), s.text)] : [], ...a?.stale?.length ? [A("button", {
|
|
964
|
+
class: "btn ghost",
|
|
965
|
+
type: "button",
|
|
966
|
+
title: `Ask again on the new code. ${u(a.no)} was made on an older version of ${_(a.stale)}.`,
|
|
967
|
+
"data-fkey": `again:${i}`,
|
|
968
|
+
"data-frame-again": "",
|
|
969
|
+
on: { click: () => r.again(a) }
|
|
970
|
+
}, "Ask again")] : [], A("button", {
|
|
971
|
+
class: "btn ghost",
|
|
972
|
+
type: "button",
|
|
973
|
+
"aria-disabled": a ? null : "true",
|
|
974
|
+
title: a ? `Drop ${u(a.no)}. No file changes.` : "No take to skip",
|
|
975
|
+
"data-fkey": `skip:${i}`,
|
|
976
|
+
"data-frame-skip": "",
|
|
977
|
+
on: { click: () => a && r.skip(a) }
|
|
978
|
+
}, "Skip"), A("button", {
|
|
979
|
+
class: "btn primary",
|
|
980
|
+
type: "button",
|
|
981
|
+
"aria-disabled": a ? null : "true",
|
|
982
|
+
title: a ? `Write ${u(a.no)} to your files` : "No take to keep",
|
|
983
|
+
"data-fkey": `keep:${i}`,
|
|
984
|
+
"data-frame-keep": "",
|
|
985
|
+
on: { click: () => a && r.keep(a) }
|
|
986
|
+
}, a && t.length > 1 ? `Keep ${a.no}` : "Keep")), c;
|
|
987
|
+
}
|
|
988
|
+
function kt(e, t, n) {
|
|
989
|
+
if (e.queued) return;
|
|
990
|
+
let r = V(e.run, e.takes, t, n);
|
|
991
|
+
return r?.note ? r : void 0;
|
|
992
|
+
}
|
|
993
|
+
function At(e, t, n, r) {
|
|
994
|
+
let i = u(t.no);
|
|
995
|
+
return A("button", {
|
|
996
|
+
class: `notepin${n ? " on" : ""}`,
|
|
997
|
+
type: "button",
|
|
998
|
+
"aria-label": `Note on ${i}`,
|
|
999
|
+
"aria-expanded": String(n),
|
|
1000
|
+
title: n ? `Close the note on ${i}` : `Read the idea of ${i}`,
|
|
1001
|
+
"data-notepin": e.run,
|
|
1002
|
+
"data-fkey": `note:${e.run}`,
|
|
1003
|
+
on: { click: (e) => {
|
|
1004
|
+
e.stopPropagation(), r();
|
|
1005
|
+
} }
|
|
1006
|
+
}, j(L.comment));
|
|
1007
|
+
}
|
|
1008
|
+
function jt(e, t) {
|
|
1009
|
+
return A("div", {
|
|
1010
|
+
class: "popover notecard",
|
|
1011
|
+
role: "dialog",
|
|
1012
|
+
"aria-label": `Note on ${u(t.no)}`,
|
|
1013
|
+
"data-notecard": e.run
|
|
1014
|
+
}, A("div", { class: "notehead" }, p(t, !0)), A("div", { class: "text" }, t.note ?? ""));
|
|
1015
|
+
}
|
|
1016
|
+
function Mt(e, t, n, r = 24) {
|
|
1017
|
+
let i = r / 2, a = (e, t) => ({
|
|
1018
|
+
left: Math.max(4, Math.min(e, n.w - r - 4)),
|
|
1019
|
+
top: Math.max(4, Math.min(t, n.h - r - 4)),
|
|
1020
|
+
width: r,
|
|
1021
|
+
height: r
|
|
1022
|
+
}), o = e.left + e.width, s = e.top + e.height, c = [
|
|
1023
|
+
a(e.left - i, e.top - i),
|
|
1024
|
+
a(e.left - i, s - i),
|
|
1025
|
+
a(o - i, s - i),
|
|
1026
|
+
a(o - i, e.top - i)
|
|
1027
|
+
];
|
|
1028
|
+
return c.find((e) => !t.some((t) => B(e, t))) ?? yt(c[0], t, n);
|
|
1029
|
+
}
|
|
1030
|
+
function Nt(e, t, n, r) {
|
|
1031
|
+
let i = Math.max(8, Math.min(e.left, n.w - t.w - 8));
|
|
1032
|
+
r && i + t.w > r.left && i < r.left + r.width && (i = Math.max(8, r.left - t.w - 8));
|
|
1033
|
+
let a = e.top + e.height + 4, o = e.top - 4 - t.h, s = a + t.h <= n.h - 8 || o < 8 ? a : o;
|
|
1034
|
+
return {
|
|
1035
|
+
left: i,
|
|
1036
|
+
top: Math.max(8, Math.min(s, n.h - t.h - 8))
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
// src/styles.ts
|
|
1040
|
+
var Pt = {
|
|
1041
|
+
panel: "#17181b",
|
|
1042
|
+
surface: "#1f2024",
|
|
1043
|
+
soft: "#1b1c20",
|
|
1044
|
+
seg: "#26272c",
|
|
1045
|
+
ink: "#eceae6",
|
|
1046
|
+
muted: "#a3a09a",
|
|
1047
|
+
line: "#2e2f34",
|
|
1048
|
+
hover: "rgba(255,255,255,.06)",
|
|
1049
|
+
accent: "#f2a65e",
|
|
1050
|
+
"accent-hover": "#f6b97c",
|
|
1051
|
+
"on-accent": "#2a1403",
|
|
1052
|
+
"accent-text": "#f2a65e",
|
|
1053
|
+
mark: "#f2a65e",
|
|
1054
|
+
"mark-tint": "rgba(242,166,94,.10)",
|
|
1055
|
+
"on-mark": "#2a1403",
|
|
1056
|
+
bubble: "#2f3036",
|
|
1057
|
+
"on-bubble": "#eceae6",
|
|
1058
|
+
"chip-bg": "#3a2a1a",
|
|
1059
|
+
"chip-ink": "#f6c591",
|
|
1060
|
+
add: "#6fd49b",
|
|
1061
|
+
del: "#ff8a7a",
|
|
1062
|
+
shadow: "0 24px 60px rgba(0,0,0,.6)",
|
|
1063
|
+
"shadow-sm": "0 1px 2px rgba(0,0,0,.4)",
|
|
1064
|
+
"shadow-md": "0 8px 24px rgba(0,0,0,.45)"
|
|
1065
|
+
}, Ft = {
|
|
1066
|
+
panel: "#f7f7f6",
|
|
1067
|
+
surface: "#ffffff",
|
|
1068
|
+
soft: "#f1f1ef",
|
|
1069
|
+
seg: "#e8e8e6",
|
|
1070
|
+
ink: "#17181b",
|
|
1071
|
+
muted: "#5e5c58",
|
|
1072
|
+
line: "#deddda",
|
|
1073
|
+
hover: "rgba(0,0,0,.05)",
|
|
1074
|
+
accent: "#f2a65e",
|
|
1075
|
+
"accent-hover": "#ee9746",
|
|
1076
|
+
"on-accent": "#2a1403",
|
|
1077
|
+
"accent-text": "#9a4f0b",
|
|
1078
|
+
mark: "#c96a10",
|
|
1079
|
+
"mark-tint": "rgba(201,106,16,.08)",
|
|
1080
|
+
"on-mark": "#1d0f02",
|
|
1081
|
+
bubble: "#17181b",
|
|
1082
|
+
"on-bubble": "#eceae6",
|
|
1083
|
+
"chip-bg": "#f6e3cc",
|
|
1084
|
+
"chip-ink": "#6b3608",
|
|
1085
|
+
add: "#1f7a4a",
|
|
1086
|
+
del: "#c0262d",
|
|
1087
|
+
shadow: "0 24px 60px rgba(17,18,20,.18)",
|
|
1088
|
+
"shadow-sm": "0 1px 2px rgba(17,18,20,.14)",
|
|
1089
|
+
"shadow-md": "0 8px 24px rgba(17,18,20,.16)"
|
|
1090
|
+
}, It = (e) => Object.entries(e).map(([e, t]) => `--os-${e}:${t};`).join(""), H = "cubic-bezier(.2,.8,.2,1)", U = {
|
|
1091
|
+
panel: 180,
|
|
1092
|
+
step: 140,
|
|
1093
|
+
flash: 720,
|
|
1094
|
+
swap: 160,
|
|
1095
|
+
alt: 90,
|
|
1096
|
+
press: 80,
|
|
1097
|
+
snap: 240,
|
|
1098
|
+
tip: 140,
|
|
1099
|
+
stillFlash: 900,
|
|
1100
|
+
ants: 900
|
|
1101
|
+
}, W = "Inter, system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif", G = "\"JetBrains Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace", Lt = `
|
|
1102
|
+
:host { all: initial; }
|
|
1103
|
+
:host([data-scheme="dark"]), .page[data-scheme="dark"] { ${It(Pt)} }
|
|
1104
|
+
:host([data-scheme="light"]), .page[data-scheme="light"] { ${It(Ft)} }
|
|
1105
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
1106
|
+
.ui, .page { font-family: ${W}; color: var(--os-ink); -webkit-font-smoothing: antialiased; font-size: 13px; line-height: 1.4; }
|
|
1107
|
+
.mono { font-family: ${G}; }
|
|
1108
|
+
button { font: inherit; color: inherit; }
|
|
1109
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
1110
|
+
[hidden] { display: none !important; }
|
|
1111
|
+
|
|
1112
|
+
/* Buttons */
|
|
1113
|
+
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 8px;
|
|
1114
|
+
border: 1px solid var(--os-line); background: var(--os-surface); color: var(--os-ink); font: 500 13px/1 ${W}; cursor: pointer;
|
|
1115
|
+
white-space: nowrap; flex: 0 0 auto;
|
|
1116
|
+
transition: background-color .12s ${H}, border-color .12s ${H}, color .12s ${H}, transform ${U.press}ms ${H}; }
|
|
1117
|
+
.btn:hover { background: var(--os-hover); }
|
|
1118
|
+
.btn:active { transform: scale(.96); }
|
|
1119
|
+
.btn:disabled { opacity: .5; cursor: default; transform: none; }
|
|
1120
|
+
.btn[aria-pressed="true"] { background: var(--os-ink); border-color: var(--os-ink); color: var(--os-panel); }
|
|
1121
|
+
.btn .key { font-family: ${G}; opacity: .65; font-size: 11px; }
|
|
1122
|
+
.primary { background: var(--os-accent); border-color: var(--os-accent); color: var(--os-on-accent); font-weight: 600; }
|
|
1123
|
+
.primary:hover { background: var(--os-accent-hover); border-color: var(--os-accent-hover); }
|
|
1124
|
+
.ghost { border-color: transparent; background: transparent; }
|
|
1125
|
+
.ghost:hover { background: var(--os-hover); }
|
|
1126
|
+
.icon { width: 36px; padding: 0; }
|
|
1127
|
+
.link { border: 0; background: none; padding: 0; color: var(--os-accent-text); font: 500 12px/1.4 ${W}; cursor: pointer; }
|
|
1128
|
+
.link:hover { text-decoration: underline; }
|
|
1129
|
+
.btn:focus-visible, .tab:focus-visible, .seg button:focus-visible, .link:focus-visible, .altlabel:focus-visible,
|
|
1130
|
+
.menu button:focus-visible, .cpin:focus-visible, .row:focus-visible, textarea:focus-visible, .check input:focus-visible, .grip:focus-visible {
|
|
1131
|
+
outline: 2px solid var(--os-accent); outline-offset: 2px; }
|
|
1132
|
+
|
|
1133
|
+
/* Tabs and segmented controls */
|
|
1134
|
+
.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--os-seg); }
|
|
1135
|
+
.tab { min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--os-muted);
|
|
1136
|
+
font: 500 13px/1 ${W}; cursor: pointer; white-space: nowrap; transition: background-color .12s ${H}, color .12s ${H}; }
|
|
1137
|
+
.tab:hover { color: var(--os-ink); }
|
|
1138
|
+
.tab[aria-selected="true"] { background: var(--os-surface); color: var(--os-ink); box-shadow: var(--os-shadow-sm); }
|
|
1139
|
+
.tab .count { color: var(--os-accent-text); margin-left: 4px; }
|
|
1140
|
+
.seg { display: flex; flex-wrap: nowrap; padding: 3px; gap: 2px; border-radius: 9px; background: var(--os-seg); min-width: 0; }
|
|
1141
|
+
.seg button { flex: 1 0 auto; min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--os-muted);
|
|
1142
|
+
font: 500 12.5px/1 ${W}; cursor: pointer; white-space: nowrap; transition: background-color .14s ${H}, color .14s ${H}; }
|
|
1143
|
+
.seg button:hover { color: var(--os-ink); }
|
|
1144
|
+
.seg button[aria-pressed="true"] { background: var(--os-surface); color: var(--os-ink); box-shadow: var(--os-shadow-sm); }
|
|
1145
|
+
.seg button:disabled { cursor: default; opacity: .6; }
|
|
1146
|
+
.seg.small button { min-height: 26px; padding: 0 8px; font-size: 12px; }
|
|
1147
|
+
|
|
1148
|
+
/* Chips */
|
|
1149
|
+
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 5px; background: var(--os-chip-bg);
|
|
1150
|
+
color: var(--os-chip-ink); font: 500 11.5px/1 ${G}; white-space: nowrap; max-width: 100%; }
|
|
1151
|
+
.chip > span { overflow: hidden; text-overflow: ellipsis; }
|
|
1152
|
+
.chip button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; font: 600 13px/1 ${W}; cursor: pointer; opacity: .7; }
|
|
1153
|
+
.chip button:hover { opacity: 1; }
|
|
1154
|
+
.chip-dark { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 5px; background: rgba(255,255,255,.12);
|
|
1155
|
+
color: var(--os-on-bubble); font: 500 11px/1 ${G}; }
|
|
1156
|
+
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
1157
|
+
|
|
1158
|
+
/* The mover holds the dock and the panel. A drag moves it with a transform;
|
|
1159
|
+
the code sets each box's place for the anchor (dock.ts). */
|
|
1160
|
+
.mover { position: fixed; inset: 0; pointer-events: none; }
|
|
1161
|
+
.mover.dragging, .mover.dragging * { cursor: grabbing !important; }
|
|
1162
|
+
.snapping { transition: transform ${U.snap}ms ${H} !important; }
|
|
1163
|
+
.snaphint { position: fixed; width: 48px; height: 48px; border-radius: 50%; border: 1.5px dashed var(--os-accent); background: var(--os-mark-tint);
|
|
1164
|
+
pointer-events: none; opacity: .8; animation: os-fade ${U.alt}ms ${H}; }
|
|
1165
|
+
|
|
1166
|
+
/* Dock */
|
|
1167
|
+
.dock { position: fixed; display: inline-flex; touch-action: none; user-select: none; -webkit-user-select: none; align-items: center; justify-content: center; width: 48px; height: 48px;
|
|
1168
|
+
padding: 0; border-radius: 50%; border: 1px solid var(--os-line); background: var(--os-panel); cursor: pointer; box-shadow: var(--os-shadow);
|
|
1169
|
+
transition: transform .12s ${H}, background-color .2s ${H}, border-color .2s ${H}; pointer-events: auto; }
|
|
1170
|
+
.dock:hover { transform: scale(1.06); }
|
|
1171
|
+
.dock:active { transform: scale(.96); }
|
|
1172
|
+
.dock:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 3px; }
|
|
1173
|
+
.dock .badge { position: absolute; top: -4px; right: -4px; display: inline-flex; align-items: center; justify-content: center; min-width: 20px;
|
|
1174
|
+
height: 20px; padding: 0 5px; border-radius: 10px; background: var(--os-accent); color: var(--os-on-accent); border: 2px solid var(--os-panel);
|
|
1175
|
+
font: 700 11px/1 ${W}; }
|
|
1176
|
+
.dotpulse { transform-origin: center; transform-box: fill-box; animation: os-dotpulse 1.4s ${H} infinite; }
|
|
1177
|
+
|
|
1178
|
+
/* The menu button on the dock's corner: it shows on hover or focus, and stays a moment so the pointer can reach it */
|
|
1179
|
+
.dockmore { position: fixed; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0;
|
|
1180
|
+
border-radius: 50%; border: 1px solid var(--os-line); background: var(--os-panel); color: var(--os-ink); cursor: pointer;
|
|
1181
|
+
box-shadow: var(--os-shadow-sm); pointer-events: auto; opacity: 0; visibility: hidden;
|
|
1182
|
+
transition: opacity ${U.tip}ms ${H}, visibility 0s linear 400ms; }
|
|
1183
|
+
.dock:hover + .dockmore, .dock:focus-visible + .dockmore, .dockmore:hover, .dockmore:focus-visible, .dockmore[aria-expanded="true"] {
|
|
1184
|
+
opacity: 1; visibility: visible; transition-delay: 0s; }
|
|
1185
|
+
.dockmore:hover { background: var(--os-surface); }
|
|
1186
|
+
.dockmore:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; }
|
|
1187
|
+
|
|
1188
|
+
/* The menu on the Onsite button (menu.ts): a root list, and Skills, Presets and Settings as sections */
|
|
1189
|
+
.smenu { position: fixed; display: flex; flex-direction: column; border-radius: 12px; background: var(--os-panel); border: 1px solid var(--os-line);
|
|
1190
|
+
box-shadow: var(--os-shadow); color: var(--os-ink); overflow: hidden; pointer-events: auto; }
|
|
1191
|
+
.smenu.opening { animation: os-pop ${U.panel}ms ${H}; }
|
|
1192
|
+
.mover[data-row="top"] ~ .smenu.opening { animation-name: os-drop; }
|
|
1193
|
+
.mbrand { display: flex; align-items: center; gap: 7px; padding: 12px 14px 6px; font: 700 13px/1 ${W}; letter-spacing: -.01em; }
|
|
1194
|
+
.mbrand .mhint { margin-left: auto; font-weight: 500; }
|
|
1195
|
+
.mlist { display: flex; flex-direction: column; padding: 4px 6px 6px; }
|
|
1196
|
+
.mitem { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent;
|
|
1197
|
+
color: var(--os-ink); font: 500 13px/1 ${W}; cursor: pointer; text-align: left; }
|
|
1198
|
+
.mitem:hover, .mitem:focus-visible { background: var(--os-hover); }
|
|
1199
|
+
.mitem svg { flex: 0 0 auto; color: var(--os-muted); }
|
|
1200
|
+
.mitem .grow { flex-grow: 1; }
|
|
1201
|
+
.mhint { font: 500 11.5px/1.3 ${W}; color: var(--os-muted); }
|
|
1202
|
+
.msep { height: 1px; margin: 4px 8px; background: var(--os-line); }
|
|
1203
|
+
.mhead { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 6px; border-bottom: 1px solid var(--os-line); }
|
|
1204
|
+
.mhead h2 { margin: 0; font: 600 13.5px/1 ${W}; }
|
|
1205
|
+
.mhead .icon { width: 32px; min-height: 32px; }
|
|
1206
|
+
.sbody { display: flex; flex-direction: column; gap: 14px; padding: 12px 14px 14px; overflow-y: auto; min-height: 0; }
|
|
1207
|
+
.mnote { margin: 0; font-size: 12.5px; line-height: 18px; color: var(--os-muted); }
|
|
1208
|
+
.mgroup { display: flex; flex-direction: column; gap: 6px; }
|
|
1209
|
+
.mgroup h3 { display: flex; align-items: baseline; gap: 8px; margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
|
|
1210
|
+
color: var(--os-muted); }
|
|
1211
|
+
.mgroup h3 .mhint { letter-spacing: 0; text-transform: none; font-weight: 500; font-size: 11px; }
|
|
1212
|
+
.mgroup > .btn { align-self: flex-start; margin-top: 2px; }
|
|
1213
|
+
.mrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--os-surface); border: 1px solid var(--os-line); min-width: 0; }
|
|
1214
|
+
.mrow .grow { flex-grow: 1; min-width: 0; }
|
|
1215
|
+
.mrow .icon { width: 30px; min-height: 30px; color: var(--os-muted); }
|
|
1216
|
+
.mrow .danger { min-height: 30px; padding: 0 8px; color: var(--os-del); font-size: 12px; }
|
|
1217
|
+
.mname { display: block; font: 600 12.5px/1.3 ${W}; color: var(--os-ink); }
|
|
1218
|
+
.mname .mhint { margin-left: 6px; white-space: nowrap; }
|
|
1219
|
+
.mname.mono { font: 600 12px/1.3 ${G}; }
|
|
1220
|
+
.mdesc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: 12px; line-height: 17px;
|
|
1221
|
+
color: var(--os-muted); }
|
|
1222
|
+
.mrun { display: flex; flex-direction: column; align-items: stretch; flex-grow: 1; min-width: 0; padding: 2px; border: 0; border-radius: 6px; background: none;
|
|
1223
|
+
color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
1224
|
+
.mrun:hover .mname { color: var(--os-accent-text); }
|
|
1225
|
+
.switch { position: relative; flex: 0 0 auto; width: 32px; height: 18px; padding: 0; border: 0; border-radius: 9px; background: var(--os-seg); cursor: pointer;
|
|
1226
|
+
box-shadow: inset 0 0 0 1px var(--os-line); transition: background-color .14s ${H}; }
|
|
1227
|
+
.switch .knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--os-surface);
|
|
1228
|
+
box-shadow: var(--os-shadow-sm); transition: transform .14s ${H}; }
|
|
1229
|
+
.switch[aria-checked="true"] { background: var(--os-accent); box-shadow: none; }
|
|
1230
|
+
.switch[aria-checked="true"] .knob { transform: translateX(14px); background: #fff; }
|
|
1231
|
+
.mform { display: flex; flex-direction: column; gap: 10px; }
|
|
1232
|
+
.mform label, .mfield { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--os-muted); }
|
|
1233
|
+
.mform input, .mform textarea, .mset select { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--os-line); background: var(--os-surface);
|
|
1234
|
+
color: var(--os-ink); font: 400 13px/1.4 ${W}; outline: none; resize: vertical; }
|
|
1235
|
+
.mform input:focus-visible, .mform textarea:focus-visible, .mset select:focus-visible { border-color: var(--os-accent); box-shadow: 0 0 0 2px var(--os-mark-tint); }
|
|
1236
|
+
.mfield .seg { align-self: flex-start; }
|
|
1237
|
+
.mset { display: flex; flex-direction: column; gap: 6px; }
|
|
1238
|
+
.mset > label, .mset > span { font-size: 12px; font-weight: 600; color: var(--os-ink); }
|
|
1239
|
+
.mset .seg { align-self: flex-start; }
|
|
1240
|
+
.mset .mhint { margin: 0; }
|
|
1241
|
+
.mset select { appearance: auto; }
|
|
1242
|
+
.anchors { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(2, 22px); gap: 2px; justify-content: space-between;
|
|
1243
|
+
width: 132px; padding: 4px; border-radius: 8px; border: 1px solid var(--os-line); background: var(--os-soft); }
|
|
1244
|
+
.anchors button { display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
|
|
1245
|
+
.anchors button:nth-child(-n+3) { align-items: flex-start; }
|
|
1246
|
+
.anchors button:nth-child(n+4) { align-items: flex-end; }
|
|
1247
|
+
.anchors button:hover { background: var(--os-hover); }
|
|
1248
|
+
.anchors .dot { width: 12px; height: 12px; margin: 2px; border-radius: 50%; border: 1.5px solid var(--os-muted); }
|
|
1249
|
+
.anchors button[aria-pressed="true"] .dot { border-color: var(--os-accent); background: var(--os-accent); }
|
|
1250
|
+
.minfo { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 2px 0 0; padding-top: 12px; border-top: 1px solid var(--os-line); font-size: 12px; }
|
|
1251
|
+
.minfo dt { color: var(--os-muted); }
|
|
1252
|
+
.minfo dd { margin: 0; color: var(--os-ink); overflow-wrap: anywhere; }
|
|
1253
|
+
.mitem:focus-visible, .mrun:focus-visible, .switch:focus-visible, .anchors button:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 1px; }
|
|
1254
|
+
.hiddenbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--os-line); background: var(--os-soft);
|
|
1255
|
+
font-size: 12px; color: var(--os-muted); }
|
|
1256
|
+
.hiddenbar .grow { flex-grow: 1; min-width: 0; }
|
|
1257
|
+
.hiddenbar .link { white-space: nowrap; }
|
|
1258
|
+
|
|
1259
|
+
/* The dock's tooltip: the shortcuts */
|
|
1260
|
+
.tip { position: fixed; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 11px; border-radius: 10px; background: var(--os-panel);
|
|
1261
|
+
border: 1px solid var(--os-line); box-shadow: var(--os-shadow); color: var(--os-ink); pointer-events: none;
|
|
1262
|
+
animation: os-tip ${U.tip}ms ${H}; }
|
|
1263
|
+
.mover[data-row="top"] .tip { animation-name: os-tip-down; }
|
|
1264
|
+
.tip .brand { display: flex; align-items: center; gap: 7px; font: 700 13px/1 ${W}; letter-spacing: -.01em; }
|
|
1265
|
+
.tip dl { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 12px; margin: 0; }
|
|
1266
|
+
.tip dt { font-size: 12px; color: var(--os-muted); }
|
|
1267
|
+
.tip dd { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 0; font-size: 11.5px; color: var(--os-muted); white-space: nowrap; }
|
|
1268
|
+
.tip dd svg { color: var(--os-ink); }
|
|
1269
|
+
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px;
|
|
1270
|
+
border: 1px solid var(--os-line); border-bottom-width: 2px; background: var(--os-surface); color: var(--os-ink); font: 500 12px/1 ${W}; }
|
|
1271
|
+
|
|
1272
|
+
/* Panel */
|
|
1273
|
+
.panel { position: fixed; display: flex; flex-direction: column; border-radius: 14px; background: var(--os-panel); border: 1px solid var(--os-line);
|
|
1274
|
+
box-shadow: var(--os-shadow); overflow: hidden; pointer-events: auto; transition: background-color .2s ${H}, border-color .2s ${H}; }
|
|
1275
|
+
.panel.opening { animation: os-pop ${U.panel}ms ${H}; }
|
|
1276
|
+
.mover[data-row="top"] .panel.opening { animation-name: os-drop; }
|
|
1277
|
+
.head { display: flex; align-items: center; gap: 6px; padding: 10px 6px 10px 10px; border-bottom: 1px solid var(--os-line); min-width: 0;
|
|
1278
|
+
cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
|
|
1279
|
+
.grip { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px;
|
|
1280
|
+
background: transparent; cursor: grab; flex: 0 0 auto; touch-action: none; }
|
|
1281
|
+
.grip:hover { background: var(--os-hover); }
|
|
1282
|
+
.head .grow { flex-grow: 1; min-width: 0; }
|
|
1283
|
+
.head .tab { padding: 0 8px; }
|
|
1284
|
+
.head .icon { width: 32px; }
|
|
1285
|
+
.scheme { padding: 0 6px; gap: 4px; font-size: 11.5px; color: var(--os-muted); flex: 0 1 auto; min-width: 0; overflow: hidden; }
|
|
1286
|
+
.modes { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--os-line); }
|
|
1287
|
+
.modes .btn { padding: 0 10px; }
|
|
1288
|
+
.body { flex: 1 1 auto; min-height: 220px; max-height: 420px; overflow-y: auto; padding: 14px; }
|
|
1289
|
+
.scroll { scrollbar-width: thin; scrollbar-color: var(--os-line) transparent; }
|
|
1290
|
+
.empty { display: flex; flex-direction: column; gap: 10px; padding: 18px 6px; color: var(--os-muted); font-size: 13px; line-height: 20px; }
|
|
1291
|
+
.empty p { margin: 0; }
|
|
1292
|
+
.empty .lead { color: var(--os-ink); font-weight: 600; }
|
|
1293
|
+
.muted { color: var(--os-muted); }
|
|
1294
|
+
.note { margin: 0; font-size: 13px; line-height: 20px; color: var(--os-muted); }
|
|
1295
|
+
|
|
1296
|
+
/* Thread */
|
|
1297
|
+
.thread { display: flex; flex-direction: column; gap: 18px; }
|
|
1298
|
+
.turn { display: flex; flex-direction: column; gap: 10px; }
|
|
1299
|
+
.ask { align-self: flex-end; max-width: 90%; padding: 10px 12px; border-radius: 10px 10px 3px 10px; background: var(--os-bubble);
|
|
1300
|
+
color: var(--os-on-bubble); font-size: 13px; line-height: 19px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1301
|
+
.ask .chips { margin-top: 8px; }
|
|
1302
|
+
.steps { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
|
|
1303
|
+
.step { display: flex; align-items: center; gap: 8px; min-height: 24px; font: 12px/1.3 ${G}; color: var(--os-muted); min-width: 0; }
|
|
1304
|
+
.step > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1305
|
+
.step.write { color: var(--os-ink); }
|
|
1306
|
+
.step svg { flex: 0 0 auto; }
|
|
1307
|
+
.reply { margin: 0; font-size: 13.5px; line-height: 21px; color: var(--os-ink); overflow-wrap: anywhere; }
|
|
1308
|
+
.reply p { margin: 0 0 8px; white-space: pre-wrap; }
|
|
1309
|
+
.reply p:last-child { margin-bottom: 0; }
|
|
1310
|
+
.reply code { font: 12px/1 ${G}; padding: 2px 4px; border-radius: 4px; background: var(--os-seg); }
|
|
1311
|
+
.reply pre { margin: 0 0 8px; padding: 10px; border-radius: 8px; background: var(--os-soft); border: 1px solid var(--os-line);
|
|
1312
|
+
font: 11.5px/17px ${G}; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1313
|
+
.reply pre code { padding: 0; background: none; font: inherit; }
|
|
1314
|
+
.status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--os-muted); }
|
|
1315
|
+
.status .qdot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px dashed var(--os-mark); }
|
|
1316
|
+
.status .square { width: 10px; height: 10px; border-radius: 2px; background: var(--os-muted); }
|
|
1317
|
+
.system { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--os-muted); }
|
|
1318
|
+
.system.error { color: var(--os-del); }
|
|
1319
|
+
.caret { display: inline-block; width: 7px; height: 14px; margin-left: 2px; vertical-align: -2px; background: var(--os-accent);
|
|
1320
|
+
animation: os-blink 1s steps(1) infinite; }
|
|
1321
|
+
.spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--os-line); border-top-color: var(--os-accent);
|
|
1322
|
+
animation: os-rot .7s linear infinite; }
|
|
1323
|
+
.in { animation: os-in ${U.step}ms ${H}; }
|
|
1324
|
+
|
|
1325
|
+
/* Changes */
|
|
1326
|
+
.view { display: flex; flex-direction: column; gap: 16px; }
|
|
1327
|
+
.group { display: flex; flex-direction: column; gap: 6px; }
|
|
1328
|
+
.group h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--os-muted); }
|
|
1329
|
+
.card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--os-surface);
|
|
1330
|
+
border: 1px solid var(--os-line); min-width: 0; }
|
|
1331
|
+
.row { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; }
|
|
1332
|
+
.line { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
1333
|
+
.line .grow { flex-grow: 1; }
|
|
1334
|
+
.fname { font: 500 12.5px/1.3 ${G}; color: var(--os-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1335
|
+
.fdir { font: 12px/1.3 ${G}; color: var(--os-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1336
|
+
.new { font-size: 11px; font-weight: 600; color: var(--os-add); }
|
|
1337
|
+
.add { font: 12px/1 ${G}; color: var(--os-add); }
|
|
1338
|
+
.del { font: 12px/1 ${G}; color: var(--os-del); }
|
|
1339
|
+
.meta { font-size: 12px; color: var(--os-muted); }
|
|
1340
|
+
.diff { margin: 0; max-height: 220px; overflow: auto; padding: 8px 0; border-radius: 8px; background: var(--os-soft); border: 1px solid var(--os-line);
|
|
1341
|
+
font: 11.5px/17px ${G}; color: var(--os-ink); }
|
|
1342
|
+
.diff span { display: block; padding: 0 10px; white-space: pre; }
|
|
1343
|
+
.diff .plus { color: var(--os-add); }
|
|
1344
|
+
.diff .minus { color: var(--os-del); }
|
|
1345
|
+
.diff .hunk { color: var(--os-muted); }
|
|
1346
|
+
.note-no { flex: 0 0 22px; display: inline-flex; align-items: center; justify-content: center; height: 22px; border-radius: 11px 11px 11px 3px;
|
|
1347
|
+
background: var(--os-bubble); color: var(--os-on-bubble); font-size: 11px; font-weight: 700; }
|
|
1348
|
+
.comment { display: flex; gap: 10px; }
|
|
1349
|
+
.comment .text { font-size: 13px; line-height: 19px; overflow-wrap: anywhere; }
|
|
1350
|
+
.comment .where { font: 11.5px/1.3 ${G}; color: var(--os-muted); overflow-wrap: anywhere; }
|
|
1351
|
+
.comment.resolved .text { text-decoration: line-through; color: var(--os-muted); }
|
|
1352
|
+
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
|
|
1353
|
+
|
|
1354
|
+
/* Export */
|
|
1355
|
+
.picks { display: flex; flex-direction: column; gap: 6px; }
|
|
1356
|
+
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; line-height: 18px; cursor: pointer; min-width: 0; }
|
|
1357
|
+
.check input { margin: 2px 0 0; accent-color: var(--os-accent); }
|
|
1358
|
+
.check span { overflow-wrap: anywhere; }
|
|
1359
|
+
.prompt { margin: 0; max-height: 210px; overflow: auto; padding: 12px; border-radius: 8px; background: var(--os-soft); border: 1px solid var(--os-line);
|
|
1360
|
+
color: var(--os-ink); font: 11.5px/17px ${G}; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1361
|
+
.buttons { display: flex; gap: 8px; }
|
|
1362
|
+
.buttons .grow { flex-grow: 1; }
|
|
1363
|
+
|
|
1364
|
+
/* Take bar */
|
|
1365
|
+
.takebar { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--os-line);
|
|
1366
|
+
background: var(--os-soft); min-width: 0; }
|
|
1367
|
+
.takebar .seg { flex: 0 1 auto; overflow: hidden; }
|
|
1368
|
+
.takebar .seg button { flex: 0 0 auto; min-width: 32px; padding: 0 8px; }
|
|
1369
|
+
.takebar .btn { padding: 0 10px; }
|
|
1370
|
+
.takebar [data-frame-skip] { margin-left: auto; }
|
|
1371
|
+
.takebar .takeof { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--os-muted); white-space: nowrap; }
|
|
1372
|
+
.askstep { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 26px; padding: 0; border: 0; border-radius: 5px;
|
|
1373
|
+
background: none; color: var(--os-muted); cursor: pointer; }
|
|
1374
|
+
.askstep:hover { background: var(--os-hover); color: var(--os-ink); }
|
|
1375
|
+
.askstep:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 1px; }
|
|
1376
|
+
/* The take switch (frames.ts): Original is a toggle apart from the takes. While it is on, the chosen take keeps a quiet mark. */
|
|
1377
|
+
.origin[aria-pressed="true"] { background: var(--os-ink); border-color: var(--os-ink); color: var(--os-panel); }
|
|
1378
|
+
.seg button.stale { opacity: .5; }
|
|
1379
|
+
.seg button.stale[aria-pressed="true"] { opacity: .7; }
|
|
1380
|
+
.seg.dim button[aria-pressed="true"] { background: transparent; box-shadow: inset 0 0 0 1px var(--os-line); color: var(--os-ink); }
|
|
1381
|
+
/* A newer ask's shown take holds a file of this take (T-019). */
|
|
1382
|
+
.covered { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 180px; padding: 0 4px; font-size: 11.5px;
|
|
1383
|
+
font-weight: 500; color: var(--os-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
|
|
1384
|
+
.covered svg { flex: 0 0 auto; }
|
|
1385
|
+
|
|
1386
|
+
/* The composer (T-025), version A "Pill": a round box with the text and icon buttons. The buttons show only the icon, with no
|
|
1387
|
+
fill in any state. One outline (four 1 px drop shadows) wraps the box and the quick chat's tab as one shape. In the panel the
|
|
1388
|
+
chips sit inside the box. In the quick chat (quick.ts), two or more elements or a chosen comment ride on a tab that docks to
|
|
1389
|
+
the element's frame; its corners curve inward into the box. */
|
|
1390
|
+
.composer { padding: 10px 12px 12px; border-top: 1px solid var(--os-line); background: var(--os-panel); }
|
|
1391
|
+
.pill { --ol: color-mix(in srgb, var(--os-ink) 20%, transparent); --sh: rgba(17,18,20,.10); position: relative; display: flex;
|
|
1392
|
+
flex-direction: column; align-items: flex-start;
|
|
1393
|
+
filter: drop-shadow(1px 0 0 var(--ol)) drop-shadow(-1px 0 0 var(--ol)) drop-shadow(0 1px 0 var(--ol)) drop-shadow(0 -1px 0 var(--ol))
|
|
1394
|
+
drop-shadow(0 6px 14px var(--sh)); }
|
|
1395
|
+
:host([data-scheme="dark"]) .pill { --ol: color-mix(in srgb, var(--os-ink) 22%, transparent); --sh: rgba(0,0,0,.45); }
|
|
1396
|
+
.pill:focus-within, :host([data-scheme="dark"]) .pill:focus-within { --ol: var(--os-mark); }
|
|
1397
|
+
.pbox { align-self: stretch; display: flex; flex-direction: column; gap: 4px; min-height: 44px; padding: 6px 6px 6px 16px; border-radius: 22px;
|
|
1398
|
+
background: var(--os-surface); }
|
|
1399
|
+
.pbox > .chips { padding: 4px 10px 0 0; }
|
|
1400
|
+
.prow { display: flex; align-items: flex-end; gap: 2px; min-width: 0; }
|
|
1401
|
+
.prow .field { display: flex; flex: 1 1 auto; align-self: center; min-width: 0; }
|
|
1402
|
+
.pill textarea { display: block; width: 100%; min-height: 32px; max-height: 120px; padding: 6px 0; border: 0; outline: none; resize: none;
|
|
1403
|
+
background: transparent; color: var(--os-ink); font: 400 14px/20px ${W}; overflow-y: auto; scrollbar-width: thin; }
|
|
1404
|
+
.pill textarea::placeholder { color: var(--os-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
1405
|
+
.pill textarea:focus-visible { outline: none; }
|
|
1406
|
+
.tools { display: flex; align-items: center; flex: 0 0 auto; }
|
|
1407
|
+
.ib { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0;
|
|
1408
|
+
border-radius: 8px; background: none; color: var(--os-muted); cursor: pointer; flex: 0 0 auto;
|
|
1409
|
+
transition: color .12s ${H}, opacity .12s ${H}, transform ${U.press}ms ${H}; }
|
|
1410
|
+
.ib:hover { color: var(--os-ink); }
|
|
1411
|
+
.ib:active { transform: scale(.9); }
|
|
1412
|
+
.ib:focus-visible { outline: 2px solid var(--os-accent); outline-offset: -1px; color: var(--os-ink); }
|
|
1413
|
+
.ib[aria-disabled="true"] { color: var(--os-muted); opacity: .45; cursor: default; transform: none; }
|
|
1414
|
+
.ib.go { color: var(--os-accent-text); }
|
|
1415
|
+
.ib.go:hover, .ib.go:focus-visible { color: color-mix(in srgb, var(--os-accent-text) 72%, var(--os-ink)); }
|
|
1416
|
+
.ib.go[aria-disabled="true"] { color: var(--os-muted); opacity: .55; }
|
|
1417
|
+
.ib.stop { color: var(--os-ink); }
|
|
1418
|
+
.ib .tbadge { position: absolute; top: 1px; right: -3px; min-width: 20px; height: 16px; padding: 0 3px; border-radius: 8px; background: var(--os-seg);
|
|
1419
|
+
color: var(--os-muted); font: 700 10.5px/16px ${W}; text-align: center; box-shadow: 0 0 0 2px var(--os-surface); pointer-events: none; }
|
|
1420
|
+
.ib.takes[data-n="2"] .tbadge, .ib.takes[data-n="3"] .tbadge { background: var(--os-accent); color: var(--os-on-accent); }
|
|
1421
|
+
.ib.takes.bump .tbadge { animation: os-bump 220ms ${H}; }
|
|
1422
|
+
.pill .chips { gap: 4px; }
|
|
1423
|
+
.pill .chip { gap: 5px; padding: 0 2px 0 7px; border-radius: 6px; }
|
|
1424
|
+
.pill .chip > svg { flex: 0 0 auto; opacity: .8; }
|
|
1425
|
+
.pill .chip .x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0;
|
|
1426
|
+
border-radius: 4px; background: none; color: inherit; opacity: .65; cursor: pointer; }
|
|
1427
|
+
.pill .chip .x:hover { opacity: 1; }
|
|
1428
|
+
.pill .chip .x:focus-visible { opacity: 1; outline: 2px solid var(--os-accent); outline-offset: 0; }
|
|
1429
|
+
/* The tab: white, out of the box's top edge, at --tab-x from the card's left edge (quick.ts, TAB_INSET at least) */
|
|
1430
|
+
.ptab { position: relative; margin-left: var(--tab-x, 30px); max-width: calc(100% - var(--tab-x, 30px) - 30px); padding: 5px 5px 3px;
|
|
1431
|
+
border-radius: 10px 10px 0 0; background: var(--os-surface); }
|
|
1432
|
+
.ptab::before, .ptab::after { content: ""; position: absolute; bottom: 0; width: 10px; height: 10px; }
|
|
1433
|
+
.ptab::before { right: 100%; background: radial-gradient(circle at 0 0, transparent 10px, var(--os-surface) 10.5px); }
|
|
1434
|
+
.ptab::after { left: 100%; background: radial-gradient(circle at 100% 0, transparent 10px, var(--os-surface) 10.5px); }
|
|
1435
|
+
|
|
1436
|
+
/* The quick chat (quick.ts): the composer in a card beside the selected element. Only the box and the tab take the pointer. */
|
|
1437
|
+
.quick { position: fixed; pointer-events: none; }
|
|
1438
|
+
.quick .composer { padding: 0; border: 0; background: none; }
|
|
1439
|
+
.quick .pbox, .quick .ptab { pointer-events: auto; }
|
|
1440
|
+
.quick.opening { animation: os-dock-down ${U.step}ms ${H}; }
|
|
1441
|
+
.quick[data-side="above"].opening { animation-name: os-dock-up; }
|
|
1442
|
+
/* Above the element, the tab sits on the box's bottom edge and touches the frame's top edge. */
|
|
1443
|
+
.quick[data-side="above"] .pill { flex-direction: column-reverse; }
|
|
1444
|
+
.quick[data-side="above"] .ptab { padding: 3px 5px 5px; border-radius: 0 0 10px 10px; }
|
|
1445
|
+
.quick[data-side="above"] .ptab::before, .quick[data-side="above"] .ptab::after { top: 0; bottom: auto; }
|
|
1446
|
+
.quick[data-side="above"] .ptab::before { background: radial-gradient(circle at 0 100%, transparent 10px, var(--os-surface) 10.5px); }
|
|
1447
|
+
.quick[data-side="above"] .ptab::after { background: radial-gradient(circle at 100% 100%, transparent 10px, var(--os-surface) 10.5px); }
|
|
1448
|
+
|
|
1449
|
+
/* The tooltip of the composer's icon buttons (tooltip.ts): the label, the keys, and a line with more words */
|
|
1450
|
+
.icontip { position: fixed; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: 260px; padding: 6px 8px;
|
|
1451
|
+
border-radius: 7px; background: var(--os-bubble); color: var(--os-on-bubble); font: 500 12.5px/1.3 ${W}; box-shadow: var(--os-shadow-md);
|
|
1452
|
+
pointer-events: none; animation: os-in ${U.tip}ms ${H}; }
|
|
1453
|
+
.icontip .tl { margin-right: 2px; }
|
|
1454
|
+
.icontip kbd { min-width: 18px; height: 18px; padding: 0 4px; border: 0; border-radius: 4px; background: rgba(255,255,255,.14); color: inherit;
|
|
1455
|
+
font: 600 11.5px/1 ${W}; }
|
|
1456
|
+
.icontip .tm { flex-basis: 100%; color: color-mix(in srgb, var(--os-on-bubble) 72%, transparent); font-weight: 400; }
|
|
1457
|
+
@keyframes os-bump { 50% { transform: scale(1.25); } }
|
|
1458
|
+
@keyframes os-dock-down { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
|
|
1459
|
+
@keyframes os-dock-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
|
|
1460
|
+
|
|
1461
|
+
/* Menus and toasts */
|
|
1462
|
+
.menu { position: fixed; z-index: 3; width: 220px; padding: 6px; border-radius: 10px; background: var(--os-panel); border: 1px solid var(--os-line);
|
|
1463
|
+
box-shadow: var(--os-shadow); pointer-events: auto; animation: os-pop 140ms ${H}; }
|
|
1464
|
+
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 34px; padding: 0 10px;
|
|
1465
|
+
border: 0; border-radius: 6px; background: transparent; color: var(--os-ink); font: 500 13px/1 ${W}; cursor: pointer; text-align: left; }
|
|
1466
|
+
.menu button:hover, .menu button[aria-checked="true"] { background: var(--os-hover); }
|
|
1467
|
+
.menu button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1468
|
+
.menu .on { color: var(--os-accent-text); flex: 0 0 auto; }
|
|
1469
|
+
.menu .hint { padding: 6px 10px 2px; font-size: 11px; color: var(--os-muted); }
|
|
1470
|
+
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
|
|
1471
|
+
padding: 10px 10px 10px 16px; border-radius: 10px; background: var(--os-panel); border: 1px solid var(--os-line); color: var(--os-ink);
|
|
1472
|
+
font-size: 13px; box-shadow: var(--os-shadow); pointer-events: auto; animation: os-toast 200ms ${H}; }
|
|
1473
|
+
[data-toast="top"] > .toast { top: 28px; bottom: auto; }
|
|
1474
|
+
.toast.plain { padding-right: 16px; }
|
|
1475
|
+
.toast .btn { min-height: 30px; color: var(--os-accent-text); }
|
|
1476
|
+
|
|
1477
|
+
/* The page layer: everything drawn over the app */
|
|
1478
|
+
.page { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
|
|
1479
|
+
.box { position: fixed; pointer-events: none; border-radius: 8px; }
|
|
1480
|
+
.hover { background: var(--os-mark-tint); box-shadow: inset 0 0 0 2px var(--os-mark); }
|
|
1481
|
+
.tag { position: absolute; left: 0; bottom: calc(100% + 6px); padding: 6px 8px; border-radius: 5px; background: var(--os-panel);
|
|
1482
|
+
border: 1px solid var(--os-mark); color: var(--os-ink); font: 500 11px/1 ${G}; white-space: nowrap;
|
|
1483
|
+
display: inline-flex; align-items: center; }
|
|
1484
|
+
.tag .walk { display: inline-flex; gap: 2px; margin-left: 8px; }
|
|
1485
|
+
.tag kbd { min-width: 15px; height: 15px; padding: 0 3px; border-radius: 4px; border-bottom-width: 1px; color: var(--os-muted); font: 600 10px/1 ${W}; }
|
|
1486
|
+
.pinned { box-shadow: inset 0 0 0 2px var(--os-mark); animation: os-fade 100ms ${H}; }
|
|
1487
|
+
.pinno { position: absolute; top: -11px; left: -11px; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
|
|
1488
|
+
border-radius: 50%; background: var(--os-mark); color: var(--os-on-mark); font: 700 11px/1 ${W}; }
|
|
1489
|
+
.flash { animation: os-flash ${U.flash}ms ${H} forwards; }
|
|
1490
|
+
.flash .updated { position: absolute; left: 0; bottom: calc(100% + 4px); padding: 4px 6px; border-radius: 5px; background: var(--os-mark);
|
|
1491
|
+
color: var(--os-on-mark); font: 600 11px/1 ${G}; white-space: nowrap; }
|
|
1492
|
+
.swap { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: os-swap ${U.swap}ms ${H} forwards; }
|
|
1493
|
+
.alt { border: 1.5px dashed var(--os-mark); animation: os-fade ${U.alt}ms ${H}; }
|
|
1494
|
+
.altlabel { position: fixed; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 5px; border: 0;
|
|
1495
|
+
background: var(--os-mark); color: var(--os-on-mark); font: 600 11px/1 ${G}; cursor: pointer; pointer-events: auto; white-space: nowrap;
|
|
1496
|
+
animation: os-in ${U.alt}ms ${H}; }
|
|
1497
|
+
.cpin { position: fixed; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
|
|
1498
|
+
border-radius: 12px 12px 12px 3px; background: var(--os-panel); border: 1px solid var(--os-line); color: var(--os-ink); font: 700 11px/1 ${W};
|
|
1499
|
+
box-shadow: var(--os-shadow-sm); cursor: pointer; pointer-events: auto; }
|
|
1500
|
+
.cpin.on { background: var(--os-mark); border-color: var(--os-mark); color: var(--os-on-mark); }
|
|
1501
|
+
.popover { position: fixed; width: 260px; padding: 12px; border-radius: 10px; background: var(--os-panel); border: 1px solid var(--os-line);
|
|
1502
|
+
box-shadow: var(--os-shadow); pointer-events: auto; display: flex; flex-direction: column; gap: 8px; animation: os-pop 140ms ${H}; }
|
|
1503
|
+
/* The frame of a run (frames.ts): a moving dashed border while it works, a still outline after it */
|
|
1504
|
+
.frame { border-radius: 4px; }
|
|
1505
|
+
.frame.fresh { animation: os-fade ${U.alt}ms ${H}; }
|
|
1506
|
+
.frame.working {
|
|
1507
|
+
background:
|
|
1508
|
+
linear-gradient(90deg, var(--os-mark) 60%, transparent 0) 0 0 / 10px 1.5px repeat-x,
|
|
1509
|
+
linear-gradient(90deg, var(--os-mark) 60%, transparent 0) 0 100% / 10px 1.5px repeat-x,
|
|
1510
|
+
linear-gradient(0deg, var(--os-mark) 60%, transparent 0) 0 0 / 1.5px 10px repeat-y,
|
|
1511
|
+
linear-gradient(0deg, var(--os-mark) 60%, transparent 0) 100% 0 / 1.5px 10px repeat-y;
|
|
1512
|
+
animation: os-ants ${U.ants}ms linear infinite; }
|
|
1513
|
+
.frame.done { box-shadow: inset 0 0 0 1.5px var(--os-mark); }
|
|
1514
|
+
/* An ask that waits in the queue (T-016): a still, faint dashed border, and a tag with × to cancel. */
|
|
1515
|
+
.frame.queued { border: 1.5px dashed color-mix(in srgb, var(--os-mark) 55%, transparent); }
|
|
1516
|
+
.framequeue { position: fixed; display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 2px 0 8px; border-radius: 5px;
|
|
1517
|
+
border: 1px solid var(--os-mark); background: var(--os-panel); color: var(--os-ink); font: 600 11px/1 ${G}; white-space: nowrap;
|
|
1518
|
+
pointer-events: auto; box-shadow: var(--os-shadow-sm); animation: os-in ${U.alt}ms ${H}; }
|
|
1519
|
+
.framequeue button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--os-muted);
|
|
1520
|
+
font-size: 14px; line-height: 1; cursor: pointer; }
|
|
1521
|
+
.framequeue button:hover { background: var(--os-hover); color: var(--os-ink); }
|
|
1522
|
+
.framequeue button:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 1px; }
|
|
1523
|
+
/* A write inside a frame: the frame glows once, with no tint over the change. */
|
|
1524
|
+
.framepulse { border-radius: 4px; box-shadow: 0 0 0 1.5px var(--os-mark), 0 0 14px 2px var(--os-mark-tint);
|
|
1525
|
+
animation: os-framepulse ${U.flash}ms ${H} forwards; }
|
|
1526
|
+
@keyframes os-framepulse { from { opacity: 1; } to { opacity: 0; } }
|
|
1527
|
+
.frametag { position: fixed; display: inline-flex; align-items: center; gap: 6px; height: 24px; max-width: 320px; padding: 0 8px; border-radius: 5px;
|
|
1528
|
+
background: var(--os-mark); color: var(--os-on-mark); font: 600 11px/1 ${G}; white-space: nowrap; pointer-events: none;
|
|
1529
|
+
animation: os-in ${U.alt}ms ${H}; }
|
|
1530
|
+
.frametag > span:last-child { overflow: hidden; text-overflow: ellipsis; }
|
|
1531
|
+
.frametag .spin { width: 10px; height: 10px; border-width: 1.5px; border-color: rgba(0,0,0,.18); border-top-color: var(--os-on-mark); flex: 0 0 auto; }
|
|
1532
|
+
.framefold { position: fixed; display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 6px 0 8px; border-radius: 5px;
|
|
1533
|
+
border: 1px solid var(--os-mark); background: var(--os-panel); color: var(--os-ink); font: 600 11px/1 ${G}; cursor: pointer;
|
|
1534
|
+
pointer-events: auto; white-space: nowrap; box-shadow: var(--os-shadow-sm); animation: os-in ${U.alt}ms ${H}; }
|
|
1535
|
+
.framefold:hover { background: var(--os-surface); }
|
|
1536
|
+
.framebar { position: fixed; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 10px; background: var(--os-panel);
|
|
1537
|
+
border: 1px solid var(--os-line); box-shadow: var(--os-shadow-md); pointer-events: auto; white-space: nowrap;
|
|
1538
|
+
animation: os-in ${U.step}ms ${H}; }
|
|
1539
|
+
.framebar .framemark { display: inline-flex; padding: 0 4px 0 5px; }
|
|
1540
|
+
.framebar .seg { padding: 2px; border-radius: 7px; }
|
|
1541
|
+
.framebar .seg button { flex: 0 0 auto; min-width: 28px; min-height: 26px; padding: 0 9px; border-radius: 5px; font-size: 12px; }
|
|
1542
|
+
.framebar .btn { min-height: 30px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; }
|
|
1543
|
+
.framebar .icon { width: 30px; padding: 0; font-size: 16px; color: var(--os-muted); }
|
|
1544
|
+
.framebar [aria-disabled="true"] { opacity: .45; cursor: default; }
|
|
1545
|
+
.framebar[aria-busy="true"], .framebar[aria-busy="true"] button { cursor: progress; }
|
|
1546
|
+
.framebar .btn[aria-disabled="true"]:active { transform: none; }
|
|
1547
|
+
.framebar:focus-visible, .framefold:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; }
|
|
1548
|
+
/* The note of a take (T-024): a speech-bubble pin in the mark colour, the shape of a comment pin, and its card */
|
|
1549
|
+
.notepin { position: fixed; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
|
|
1550
|
+
border-radius: 12px 12px 12px 3px; background: var(--os-mark); border: 1px solid var(--os-mark); color: var(--os-on-mark);
|
|
1551
|
+
box-shadow: var(--os-shadow-sm); cursor: pointer; pointer-events: auto; }
|
|
1552
|
+
.notepin svg { width: 13px; height: 13px; }
|
|
1553
|
+
.notepin:hover, .notepin.on { box-shadow: 0 0 0 3px var(--os-mark-tint), var(--os-shadow-sm); }
|
|
1554
|
+
.notepin:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; }
|
|
1555
|
+
.notehead { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; line-height: 16px; overflow-wrap: anywhere; }
|
|
1556
|
+
.notehead::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--os-mark); }
|
|
1557
|
+
/* The question card (question.ts): asks before a stale take shows */
|
|
1558
|
+
.question { position: fixed; display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 10px; background: var(--os-panel);
|
|
1559
|
+
border: 1px solid var(--os-line); box-shadow: var(--os-shadow); color: var(--os-ink); pointer-events: auto; z-index: 1;
|
|
1560
|
+
animation: os-pop ${U.step}ms ${H}; }
|
|
1561
|
+
.question[data-side="below"] { animation-name: os-drop; }
|
|
1562
|
+
.question .text { margin: 0; font-size: 13px; line-height: 19px; overflow-wrap: anywhere; }
|
|
1563
|
+
.question .btn { min-height: 32px; }
|
|
1564
|
+
.popover .text { font-size: 13px; line-height: 19px; overflow-wrap: anywhere; }
|
|
1565
|
+
.popover .where { font: 11.5px/1.3 ${G}; color: var(--os-muted); overflow-wrap: anywhere; }
|
|
1566
|
+
|
|
1567
|
+
@keyframes os-dotpulse { 0% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(2.6); } }
|
|
1568
|
+
@keyframes os-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
|
|
1569
|
+
@keyframes os-drop { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
|
|
1570
|
+
@keyframes os-tip { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
|
|
1571
|
+
@keyframes os-tip-down { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
|
|
1572
|
+
@keyframes os-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
|
|
1573
|
+
@keyframes os-fade { from { opacity: 0; } to { opacity: 1; } }
|
|
1574
|
+
@keyframes os-swap { from { opacity: 1; } to { opacity: 0; } }
|
|
1575
|
+
@keyframes os-blink { 50% { opacity: 0; } }
|
|
1576
|
+
@keyframes os-rot { to { transform: rotate(360deg); } }
|
|
1577
|
+
@keyframes os-toast { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
|
|
1578
|
+
@keyframes os-flash { 0% { background: var(--os-mark-tint); box-shadow: 0 0 0 0 var(--os-mark); }
|
|
1579
|
+
35% { box-shadow: 0 0 0 4px var(--os-mark); } 100% { background: transparent; box-shadow: 0 0 0 14px transparent; } }
|
|
1580
|
+
@keyframes os-still { 0% { box-shadow: inset 0 0 0 2px var(--os-mark); } 100% { box-shadow: none; } }
|
|
1581
|
+
@keyframes os-ants { to { background-position: 10px 0, -10px 100%, 0 -10px, 100% 10px; } }
|
|
1582
|
+
|
|
1583
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1584
|
+
.panel.opening, .in, .menu, .toast, .pinned, .alt, .altlabel, .popover, .caret, .dotpulse, .swap, .tip, .snaphint,
|
|
1585
|
+
.frame.fresh, .frame.working, .frametag, .framefold, .framebar, .framepulse, .framequeue, .smenu.opening, .quick.opening,
|
|
1586
|
+
.question { animation: none; }
|
|
1587
|
+
.switch, .switch .knob { transition: none; }
|
|
1588
|
+
/* No fade, but the menu button still stays a moment so the pointer can reach it. */
|
|
1589
|
+
.dockmore { transition: visibility 0s linear 400ms; }
|
|
1590
|
+
.dotpulse, .swap { display: none; }
|
|
1591
|
+
.flash { animation: os-still ${U.stillFlash}ms steps(1) forwards; }
|
|
1592
|
+
.spin { animation-duration: 2s; }
|
|
1593
|
+
.btn, .tab, .seg button, .dock, .panel { transition: none; }
|
|
1594
|
+
.snapping { transition: none !important; }
|
|
1595
|
+
.btn:active, .dock:hover, .dock:active { transform: none; }
|
|
1596
|
+
/* The composer (T-025) */
|
|
1597
|
+
.quick.opening, .quick[data-side="above"].opening, .ib.takes.bump .tbadge, .icontip { animation: none; }
|
|
1598
|
+
.ib { transition: none; }
|
|
1599
|
+
.ib:active { transform: none; }
|
|
1600
|
+
}
|
|
1601
|
+
`;
|
|
1602
|
+
function K(t, n, r = 30) {
|
|
1603
|
+
let i = /* @__PURE__ */ new Set(), a = (e) => {
|
|
1604
|
+
let t = 0;
|
|
1605
|
+
for (let a of e) {
|
|
1606
|
+
if (t >= r) return;
|
|
1607
|
+
a === document.documentElement || a === document.body || a === n || n?.contains(a) || (i.add(a), t++);
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
for (let n of t.stamps ?? []) a(document.querySelectorAll(`[${e}="${CSS.escape(n)}"]`));
|
|
1611
|
+
for (let e of t.selectors ?? []) try {
|
|
1612
|
+
a(document.querySelectorAll(e));
|
|
1613
|
+
} catch {}
|
|
1614
|
+
return [...i];
|
|
1615
|
+
}
|
|
1616
|
+
function q(t) {
|
|
1617
|
+
return t instanceof Element ? t.closest(`[${e}]`) : null;
|
|
1618
|
+
}
|
|
1619
|
+
function Rt(e, t, n, r) {
|
|
1620
|
+
let i = Math.max(4, Math.min(e.left, n.w - t.w - 4)), a = e.top - r - t.h, o = e.top + e.height + r, s = a >= 4 ? a : o + t.h <= n.h - 4 ? o : Math.max(4, Math.min(e.top + r, n.h - t.h - 4));
|
|
1621
|
+
return {
|
|
1622
|
+
left: i - e.left,
|
|
1623
|
+
top: s - e.top
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
function zt(e, t, n) {
|
|
1627
|
+
let r = e.box.querySelector(":scope > .tag, :scope > .updated");
|
|
1628
|
+
if (!r) return;
|
|
1629
|
+
let i = r.classList.contains("updated") ? 4 : 6, a = Rt({
|
|
1630
|
+
left: t.left - n,
|
|
1631
|
+
top: t.top - n,
|
|
1632
|
+
width: t.width + n * 2,
|
|
1633
|
+
height: t.height + n * 2
|
|
1634
|
+
}, {
|
|
1635
|
+
w: r.offsetWidth,
|
|
1636
|
+
h: r.offsetHeight
|
|
1637
|
+
}, {
|
|
1638
|
+
w: innerWidth,
|
|
1639
|
+
h: innerHeight
|
|
1640
|
+
}, i);
|
|
1641
|
+
r.style.left = `${a.left}px`, r.style.top = `${a.top}px`, r.style.bottom = "auto";
|
|
1642
|
+
}
|
|
1643
|
+
function Bt(e) {
|
|
1644
|
+
let t = e.getRootNode();
|
|
1645
|
+
return q(e.parentElement ?? (t instanceof ShadowRoot ? t.host : null));
|
|
1646
|
+
}
|
|
1647
|
+
function Vt(t) {
|
|
1648
|
+
return t.querySelector(`[${e}]`);
|
|
1649
|
+
}
|
|
1650
|
+
var J = (e) => e.width > 0 && e.height > 0 && e.bottom > 0 && e.right > 0 && e.top < innerHeight && e.left < innerWidth, Ht = class {
|
|
1651
|
+
host;
|
|
1652
|
+
read;
|
|
1653
|
+
act;
|
|
1654
|
+
root;
|
|
1655
|
+
drawn = [];
|
|
1656
|
+
temp = [];
|
|
1657
|
+
frameId = 0;
|
|
1658
|
+
altGroups = [];
|
|
1659
|
+
menu = null;
|
|
1660
|
+
card = null;
|
|
1661
|
+
frames = [];
|
|
1662
|
+
ctls = /* @__PURE__ */ new Map();
|
|
1663
|
+
framesKey = "";
|
|
1664
|
+
seen = /* @__PURE__ */ new Map();
|
|
1665
|
+
redrawId = 0;
|
|
1666
|
+
openNote = "";
|
|
1667
|
+
outside = (e) => {
|
|
1668
|
+
let t = e.composedPath(), n = this.frames.find((e) => e.run === this.openNote);
|
|
1669
|
+
[n?.note, n?.noteCard].some((e) => e && t.includes(e)) || this.toggleNote("");
|
|
1670
|
+
};
|
|
1671
|
+
toggleNote(e) {
|
|
1672
|
+
this.openNote = e, e ? window.addEventListener("pointerdown", this.outside, !0) : window.removeEventListener("pointerdown", this.outside, !0), this.draw();
|
|
1673
|
+
}
|
|
1674
|
+
constructor(e, t, n) {
|
|
1675
|
+
this.host = e, this.read = t, this.act = n, this.root = A("div", {
|
|
1676
|
+
class: "page",
|
|
1677
|
+
"data-layer": "page",
|
|
1678
|
+
"aria-live": "off"
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
draw() {
|
|
1682
|
+
let e = this.read();
|
|
1683
|
+
this.root.dataset.scheme = e.pageScheme;
|
|
1684
|
+
let n = this.root.isConnected ? this.root.getRootNode().activeElement : null, r = n && this.root.contains(n) ? n.getAttribute("data-fkey") : null;
|
|
1685
|
+
for (let e of this.drawn) e.box.remove();
|
|
1686
|
+
for (let e of this.altGroups) e.label.remove();
|
|
1687
|
+
for (let e of this.frames) e.note?.remove(), e.noteCard?.remove();
|
|
1688
|
+
if (this.menu?.remove(), this.card?.box.remove(), this.drawn = [], this.altGroups = [], this.frames = [], this.menu = null, this.card = null, e.alt === "off" ? this.drawFrames(e) : (this.dropCtls(/* @__PURE__ */ new Set()), e.altMarks && this.drawAlt(e)), e.pins.forEach((e, t) => {
|
|
1689
|
+
let n = A("div", { class: "box pinned" }, A("span", { class: "pinno" }, String(t + 1)));
|
|
1690
|
+
this.keep({
|
|
1691
|
+
el: e,
|
|
1692
|
+
box: n,
|
|
1693
|
+
pad: 4
|
|
1694
|
+
});
|
|
1695
|
+
}), e.hover && !e.pins.includes(e.hover)) {
|
|
1696
|
+
let n = e.hover.getAttribute("data-onsite-src") ?? "", r = e.hover.getAttribute(t), i = [Bt(e.hover) && "↑", Vt(e.hover) && "↓"].filter((e) => !!e), a = A("div", { class: "box hover" }, A("span", { class: "tag" }, `${r ? `${r} · ` : ""}${c(n)}`, ...i.length ? [A("span", {
|
|
1697
|
+
class: "walk",
|
|
1698
|
+
"data-walk": i.join(""),
|
|
1699
|
+
"aria-hidden": "true"
|
|
1700
|
+
}, ...i.map((e) => A("kbd", null, e)))] : []));
|
|
1701
|
+
this.keep({
|
|
1702
|
+
el: e.hover,
|
|
1703
|
+
box: a,
|
|
1704
|
+
pad: 4
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
this.drawCommentPins(e), this.position(), r && [...this.root.querySelectorAll("[data-fkey]")].find((e) => e.getAttribute("data-fkey") === r)?.focus({ preventScroll: !0 });
|
|
1708
|
+
let i = this.frames.map((e) => `${e.run}:${e.els.length}:${e.ctl.className}`).join(" ");
|
|
1709
|
+
i !== this.framesKey && (this.framesKey = i, this.act.framesChanged());
|
|
1710
|
+
}
|
|
1711
|
+
drawFrames(e) {
|
|
1712
|
+
let t = `-${Math.round(performance.now() % U.ants)}ms`;
|
|
1713
|
+
for (let n of e.frames) {
|
|
1714
|
+
let r = K({ stamps: n.selected }, this.host);
|
|
1715
|
+
if (r.length === 0) {
|
|
1716
|
+
let t = gt(n.run, n.takes, e.frameMarks, e.showing), i = e.liveMarks.get(n.run);
|
|
1717
|
+
i && z(t.all, i), r = K(t.all, this.host).slice(0, 1);
|
|
1718
|
+
}
|
|
1719
|
+
let i = r[0];
|
|
1720
|
+
if (!i) {
|
|
1721
|
+
let e = this.ctls.get(n.run);
|
|
1722
|
+
e && (e.hidden = !0);
|
|
1723
|
+
continue;
|
|
1724
|
+
}
|
|
1725
|
+
let a = this.seen.get(n.run);
|
|
1726
|
+
a || (a = /* @__PURE__ */ new WeakSet(), this.seen.set(n.run, a));
|
|
1727
|
+
for (let e of r) {
|
|
1728
|
+
let r = A("div", {
|
|
1729
|
+
class: `box frame ${n.running ? "working" : n.queued ? "queued" : "done"}${a.has(e) ? "" : " fresh"}`,
|
|
1730
|
+
"data-frame": n.run
|
|
1731
|
+
});
|
|
1732
|
+
n.running && (r.style.animationDelay = t), a.add(e), this.keep({
|
|
1733
|
+
el: e,
|
|
1734
|
+
box: r,
|
|
1735
|
+
pad: 4
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
let o = this.keepCtl(n.run, n.running ? wt(n) : n.queued ? Tt(n, this.act) : n.run === e.barRun ? Dt(n, {
|
|
1739
|
+
showing: e.showing,
|
|
1740
|
+
picked: e.picked,
|
|
1741
|
+
all: e.takes,
|
|
1742
|
+
asks: e.asks
|
|
1743
|
+
}, e.busy, this.act) : Et(n, this.act)), s = {
|
|
1744
|
+
run: n.run,
|
|
1745
|
+
els: r,
|
|
1746
|
+
main: i,
|
|
1747
|
+
ctl: o
|
|
1748
|
+
}, c = kt(n, e.showing, e.picked);
|
|
1749
|
+
if (c) {
|
|
1750
|
+
let e = this.openNote === n.run;
|
|
1751
|
+
s.note = At(n, c, e, () => this.toggleNote(e ? "" : n.run)), this.root.append(s.note), e && (s.noteCard = this.root.appendChild(jt(n, c)));
|
|
1752
|
+
}
|
|
1753
|
+
this.frames.push(s);
|
|
1754
|
+
}
|
|
1755
|
+
this.dropCtls(new Set(e.frames.map((e) => e.run))), this.openNote && !this.frames.some((e) => e.run === this.openNote && e.note) && (this.openNote = "", window.removeEventListener("pointerdown", this.outside, !0));
|
|
1756
|
+
}
|
|
1757
|
+
keepCtl(e, t) {
|
|
1758
|
+
let n = N() ? 2e3 : 700;
|
|
1759
|
+
for (let e of t.querySelectorAll(".spin")) e.style.animationDelay = `-${Math.round(performance.now() % n)}ms`;
|
|
1760
|
+
let r = this.ctls.get(e);
|
|
1761
|
+
if (!r || r.tagName !== t.tagName || r.className !== t.className) return r?.remove(), this.root.append(t), this.ctls.set(e, t), t;
|
|
1762
|
+
for (let e of [...r.attributes]) t.hasAttribute(e.name) || r.removeAttribute(e.name);
|
|
1763
|
+
for (let e of [...t.attributes]) r.getAttribute(e.name) !== e.value && r.setAttribute(e.name, e.value);
|
|
1764
|
+
return r.replaceChildren(...t.childNodes), r.hidden = !1, r.isConnected || this.root.append(r), r;
|
|
1765
|
+
}
|
|
1766
|
+
dropCtls(e) {
|
|
1767
|
+
for (let [t, n] of this.ctls) e.has(t) || (n.remove(), this.ctls.delete(t));
|
|
1768
|
+
}
|
|
1769
|
+
frameTargets() {
|
|
1770
|
+
let e = this.read(), t = this.frames.find((t) => t.run === e.barRun) ?? this.frames.find((t) => e.frames.some((e) => e.run === t.run && e.running));
|
|
1771
|
+
return t ? [t.main, t.ctl] : [];
|
|
1772
|
+
}
|
|
1773
|
+
frameKey(e) {
|
|
1774
|
+
if (e.key === "Escape" && this.openNote && e.composedPath().some((e) => e instanceof HTMLElement && (e.hasAttribute("data-notepin") || e.hasAttribute("data-notecard")))) return this.toggleNote(""), !0;
|
|
1775
|
+
let t = e.composedPath().find((e) => e instanceof HTMLElement && e.hasAttribute("data-framebar"));
|
|
1776
|
+
if (!t) return !1;
|
|
1777
|
+
let n = this.read(), r = n.frames.find((e) => e.run === t.getAttribute("data-framebar"));
|
|
1778
|
+
if (!r) return !1;
|
|
1779
|
+
let i = V(r.run, r.takes, n.showing, n.picked);
|
|
1780
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
1781
|
+
let t = Math.max(0, r.takes.findIndex((e) => e.id === i?.id)), a = r.takes[Math.max(0, Math.min(r.takes.length - 1, t + (e.key === "ArrowLeft" ? -1 : 1)))];
|
|
1782
|
+
return a && !n.showing.includes(a.id) && !n.busy && this.act.show(a.id), !0;
|
|
1783
|
+
}
|
|
1784
|
+
if (e.key === "o" || e.key === "O") return n.busy || this.act.toggleOriginal(r.run), !0;
|
|
1785
|
+
if (e.key === "Enter") {
|
|
1786
|
+
let t = e.composedPath()[0];
|
|
1787
|
+
return t instanceof HTMLElement && t.matches("button:not([data-frame-keep])") ? !1 : (i && !n.busy && this.act.keep(i), !0);
|
|
1788
|
+
}
|
|
1789
|
+
return e.key === "Escape" && (this.act.openFrame(""), !0);
|
|
1790
|
+
}
|
|
1791
|
+
keep(e) {
|
|
1792
|
+
this.root.append(e.box), this.drawn.push(e);
|
|
1793
|
+
}
|
|
1794
|
+
drawCommentPins(e) {
|
|
1795
|
+
let t = /* @__PURE__ */ new Map();
|
|
1796
|
+
e.comments.forEach((n, r) => {
|
|
1797
|
+
if (n.resolved) return;
|
|
1798
|
+
let i = K({ stamps: [n.stamp.src] }, this.host, 1)[0];
|
|
1799
|
+
if (!i) return;
|
|
1800
|
+
let a = t.get(i) ?? 0;
|
|
1801
|
+
t.set(i, a + 1);
|
|
1802
|
+
let o = r + 1, s = A("button", {
|
|
1803
|
+
class: `cpin${e.chosen.includes(n.id) || e.openComment === n.id ? " on" : ""}`,
|
|
1804
|
+
type: "button",
|
|
1805
|
+
"aria-label": `Comment ${o}: ${n.text}`,
|
|
1806
|
+
title: n.text,
|
|
1807
|
+
on: { click: (t) => {
|
|
1808
|
+
t.stopPropagation(), this.act.openComment(e.openComment === n.id ? "" : n.id);
|
|
1809
|
+
} }
|
|
1810
|
+
}, String(o));
|
|
1811
|
+
this.keep({
|
|
1812
|
+
el: i,
|
|
1813
|
+
box: s,
|
|
1814
|
+
pad: 0,
|
|
1815
|
+
at: (e) => ({
|
|
1816
|
+
left: e.right - 36 - a * 30,
|
|
1817
|
+
top: e.top - 12
|
|
1818
|
+
})
|
|
1819
|
+
}), e.openComment === n.id && this.drawCard(i, n, o, e);
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1822
|
+
drawCard(e, t, n, r) {
|
|
1823
|
+
let i = r.chosen.includes(t.id), a = r.takes.find((e) => e.id === t.take), o = r.takes.filter((e) => e.state === "open" || e.state === "kept"), s = t.take ? `on ${a ? m(a, o, r.asks) : u(t.takeNo ?? 0)}` : "on the original", c = A("div", {
|
|
1824
|
+
class: "popover",
|
|
1825
|
+
role: "dialog",
|
|
1826
|
+
"aria-label": `Comment ${n}`
|
|
1827
|
+
}, A("div", { class: "text" }, t.text), A("div", { class: "where" }, `${l(t.stamp)} · ${s}`), A("div", { class: "actions" }, A("button", {
|
|
1828
|
+
class: "btn",
|
|
1829
|
+
type: "button",
|
|
1830
|
+
on: { click: () => this.act.chooseComment(t.id) }
|
|
1831
|
+
}, i ? "Leave out of the ask" : "Add to the ask"), A("button", {
|
|
1832
|
+
class: "btn ghost",
|
|
1833
|
+
type: "button",
|
|
1834
|
+
on: { click: () => this.act.resolve(t.id) }
|
|
1835
|
+
}, "Resolve")));
|
|
1836
|
+
this.root.append(c), this.card = {
|
|
1837
|
+
el: e,
|
|
1838
|
+
box: c
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1841
|
+
drawAlt(e) {
|
|
1842
|
+
let t = e.altMarks, n = /* @__PURE__ */ new Set();
|
|
1843
|
+
for (let r of t.groups) {
|
|
1844
|
+
let t = K(r, this.host);
|
|
1845
|
+
if (!t.length) continue;
|
|
1846
|
+
for (let e of t) n.has(e) || (n.add(e), this.keep({
|
|
1847
|
+
el: e,
|
|
1848
|
+
box: A("div", { class: "box alt" }),
|
|
1849
|
+
pad: 4
|
|
1850
|
+
}));
|
|
1851
|
+
let a = [...r.takes].sort().join(" "), s = r.stamps[0], c = s ? i(o(s)) : r.selectors[0] ?? "Styles", l = A("button", {
|
|
1852
|
+
class: "altlabel",
|
|
1853
|
+
type: "button",
|
|
1854
|
+
"aria-haspopup": "menu",
|
|
1855
|
+
"aria-expanded": String(e.altMenu === a),
|
|
1856
|
+
"aria-label": `Versions of ${c}`,
|
|
1857
|
+
on: { click: (e) => {
|
|
1858
|
+
e.stopPropagation(), this.act.toggleAltMenu(a);
|
|
1859
|
+
} }
|
|
1860
|
+
}, `${c} · ${r.takes.length + 1} versions ▾`);
|
|
1861
|
+
this.root.append(l), this.altGroups.push({
|
|
1862
|
+
key: a,
|
|
1863
|
+
takes: r.takes,
|
|
1864
|
+
els: t,
|
|
1865
|
+
label: l
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
let r = this.altGroups.find((t) => t.key === e.altMenu);
|
|
1869
|
+
r && (this.menu = this.root.appendChild(this.versionMenu(r.takes, e)));
|
|
1870
|
+
}
|
|
1871
|
+
versionMenu(e, t) {
|
|
1872
|
+
let n = e.map((e) => t.takes.find((t) => t.id === e)).filter((e) => !!e).sort((e, t) => e.no - t.no), r = t.showing.findLast((t) => e.includes(t)) ?? "", i = (t, n) => A("button", {
|
|
1873
|
+
type: "button",
|
|
1874
|
+
role: "menuitemradio",
|
|
1875
|
+
"aria-checked": String(t === r),
|
|
1876
|
+
on: { click: (n) => {
|
|
1877
|
+
n.stopPropagation(), t === "" ? r && this.act.hideTakes(e) : this.act.show(t);
|
|
1878
|
+
} }
|
|
1879
|
+
}, A("span", null, n), A("span", { class: "on" }, t === r ? "Shown" : ""));
|
|
1880
|
+
return A("div", {
|
|
1881
|
+
class: "menu",
|
|
1882
|
+
role: "menu",
|
|
1883
|
+
"aria-label": "Versions"
|
|
1884
|
+
}, i("", "Original"), n.map((e) => i(e.id, [m(e, n, t.asks), e.label].filter(Boolean).join(" · "))), t.alt === "held" ? A("div", { class: "hint" }, `Release ${this.act.altKeyName()} to close`) : null);
|
|
1885
|
+
}
|
|
1886
|
+
position() {
|
|
1887
|
+
let e = /* @__PURE__ */ new Map(), t = (t) => {
|
|
1888
|
+
let n = e.get(t);
|
|
1889
|
+
return n || (n = t.isConnected ? t.getBoundingClientRect() : new DOMRect(), e.set(t, n)), n;
|
|
1890
|
+
};
|
|
1891
|
+
for (let e of [...this.drawn, ...this.temp]) {
|
|
1892
|
+
let n = t(e.el), r = e.el.isConnected && (J(n) || e.at !== void 0 && n.width + n.height > 0);
|
|
1893
|
+
if (e.box.hidden = !r, r) {
|
|
1894
|
+
if (e.at) {
|
|
1895
|
+
let t = e.at(n, e.box);
|
|
1896
|
+
if (!t) {
|
|
1897
|
+
e.box.hidden = !0;
|
|
1898
|
+
continue;
|
|
1899
|
+
}
|
|
1900
|
+
e.box.style.left = `${Math.max(2, Math.min(t.left, innerWidth - 28))}px`, e.box.style.top = `${Math.max(2, t.top)}px`;
|
|
1901
|
+
} else st(e.box, n, e.pad), zt(e, n, e.pad);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
if (this.positionAlt(t), this.positionFrames(t), this.card) {
|
|
1905
|
+
let e = t(this.card.el), n = Math.max(8, Math.min(e.right - 260, innerWidth - 268)), r = this.read().avoid;
|
|
1906
|
+
r && n + 260 > r.left && (n = Math.max(8, r.left - 268));
|
|
1907
|
+
let i = e.top + 18, a = this.card.box.offsetHeight || 120;
|
|
1908
|
+
this.card.box.style.left = `${n}px`, this.card.box.style.top = `${Math.max(8, Math.min(i, innerHeight - a - 8))}px`;
|
|
1909
|
+
}
|
|
1910
|
+
this.act.positioned?.();
|
|
1911
|
+
}
|
|
1912
|
+
positionAlt(e) {
|
|
1913
|
+
let t = null, n = this.read().altMenu, r = (e) => ({
|
|
1914
|
+
left: e.left - 4,
|
|
1915
|
+
top: e.top - 4,
|
|
1916
|
+
width: e.width + 8,
|
|
1917
|
+
height: e.height + 8
|
|
1918
|
+
}), i = [], a = [];
|
|
1919
|
+
for (let t of this.altGroups) {
|
|
1920
|
+
let n = null, o = [];
|
|
1921
|
+
for (let i of t.els) {
|
|
1922
|
+
let t = e(i);
|
|
1923
|
+
J(t) && (o.push(r(t)), (!n || t.top < n.top - 1 || Math.abs(t.top - n.top) <= 1 && t.left < n.left) && (n = t));
|
|
1924
|
+
}
|
|
1925
|
+
t.label.hidden = !n, n && (i.push({
|
|
1926
|
+
anchor: r(n),
|
|
1927
|
+
own: o,
|
|
1928
|
+
size: {
|
|
1929
|
+
w: t.label.offsetWidth || 160,
|
|
1930
|
+
h: t.label.offsetHeight || 24
|
|
1931
|
+
}
|
|
1932
|
+
}), a.push(t));
|
|
1933
|
+
}
|
|
1934
|
+
let o = St(i, {
|
|
1935
|
+
w: document.documentElement.clientWidth || innerWidth,
|
|
1936
|
+
h: document.documentElement.clientHeight || innerHeight
|
|
1937
|
+
});
|
|
1938
|
+
for (let [e, r] of a.entries()) {
|
|
1939
|
+
let i = o[e];
|
|
1940
|
+
r.label.style.left = `${i.left}px`, r.label.style.top = `${i.top}px`, r.key === n && (t = {
|
|
1941
|
+
left: i.left + i.width - 220,
|
|
1942
|
+
top: i.top + i.height + 4
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
if (this.menu && (this.menu.hidden = !t, t)) {
|
|
1946
|
+
let e = this.menu.offsetHeight || 140;
|
|
1947
|
+
this.menu.style.left = `${Math.max(2, Math.min(t.left, innerWidth - 224))}px`, this.menu.style.top = `${Math.max(2, Math.min(t.top, innerHeight - e - 4))}px`;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
positionFrames(e) {
|
|
1951
|
+
let t = {
|
|
1952
|
+
w: document.documentElement.clientWidth || innerWidth,
|
|
1953
|
+
h: document.documentElement.clientHeight || innerHeight
|
|
1954
|
+
}, n = !1, r = [];
|
|
1955
|
+
for (let i of [...this.frames].reverse()) {
|
|
1956
|
+
i.els.some((e) => !e.isConnected) && (n = !0);
|
|
1957
|
+
let a = [i.main, ...i.els].find((t) => t.isConnected && J(e(t)));
|
|
1958
|
+
if (i.ctl.hidden = !a, !a) continue;
|
|
1959
|
+
let o = e(a), s = {
|
|
1960
|
+
w: i.ctl.offsetWidth || 120,
|
|
1961
|
+
h: i.ctl.offsetHeight || 32
|
|
1962
|
+
}, c = vt({
|
|
1963
|
+
left: o.left - 4,
|
|
1964
|
+
top: o.top - 4,
|
|
1965
|
+
width: o.width + 8,
|
|
1966
|
+
height: o.height + 8
|
|
1967
|
+
}, s, t), l = yt({
|
|
1968
|
+
left: c.left,
|
|
1969
|
+
top: c.top,
|
|
1970
|
+
width: s.w,
|
|
1971
|
+
height: s.h
|
|
1972
|
+
}, r, t);
|
|
1973
|
+
r.push(l), i.ctl.style.left = `${l.left}px`, i.ctl.style.top = `${l.top}px`, i.ctl.dataset.side = c.side;
|
|
1974
|
+
}
|
|
1975
|
+
this.positionNotes(e, r, t), n && !this.redrawId && (this.redrawId = requestAnimationFrame(() => {
|
|
1976
|
+
this.redrawId = 0, this.draw();
|
|
1977
|
+
}));
|
|
1978
|
+
}
|
|
1979
|
+
positionNotes(e, t, n) {
|
|
1980
|
+
let r = (e) => ({
|
|
1981
|
+
left: Number.parseFloat(e.style.left) || 0,
|
|
1982
|
+
top: Number.parseFloat(e.style.top) || 0,
|
|
1983
|
+
width: e.offsetWidth || 24,
|
|
1984
|
+
height: e.offsetHeight || 24
|
|
1985
|
+
}), i = [...t, ...this.drawn.filter((e) => e.box.classList.contains("cpin") && !e.box.hidden).map((e) => r(e.box))], a = this.read().avoid;
|
|
1986
|
+
for (let t of [...this.frames].reverse()) {
|
|
1987
|
+
if (!t.note) continue;
|
|
1988
|
+
let r = t.ctl.hidden ? void 0 : [t.main, ...t.els].find((t) => t.isConnected && J(e(t)));
|
|
1989
|
+
if (t.note.hidden = !r, t.noteCard && (t.noteCard.hidden = !r), !r) continue;
|
|
1990
|
+
let o = e(r), s = Mt({
|
|
1991
|
+
left: o.left - 4,
|
|
1992
|
+
top: o.top - 4,
|
|
1993
|
+
width: o.width + 8,
|
|
1994
|
+
height: o.height + 8
|
|
1995
|
+
}, i, n);
|
|
1996
|
+
if (i.push(s), t.note.style.left = `${s.left}px`, t.note.style.top = `${s.top}px`, t.noteCard) {
|
|
1997
|
+
let e = Nt(s, {
|
|
1998
|
+
w: t.noteCard.offsetWidth || 260,
|
|
1999
|
+
h: t.noteCard.offsetHeight || 120
|
|
2000
|
+
}, n, a ? {
|
|
2001
|
+
left: a.left,
|
|
2002
|
+
top: a.top,
|
|
2003
|
+
width: a.width,
|
|
2004
|
+
height: a.height
|
|
2005
|
+
} : null);
|
|
2006
|
+
t.noteCard.style.left = `${e.left}px`, t.noteCard.style.top = `${e.top}px`;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
schedule() {
|
|
2011
|
+
this.frameId ||= requestAnimationFrame(() => {
|
|
2012
|
+
this.frameId = 0, this.position();
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
menuTargets() {
|
|
2016
|
+
let e = this.read().altMenu;
|
|
2017
|
+
return e ? this.altGroups.find((t) => t.key === e)?.els ?? [] : [];
|
|
2018
|
+
}
|
|
2019
|
+
busy() {
|
|
2020
|
+
return this.drawn.length > 0 || this.temp.length > 0;
|
|
2021
|
+
}
|
|
2022
|
+
flash(e) {
|
|
2023
|
+
let t = N(), n = K(e, this.host).filter((e) => J(e.getBoundingClientRect()) || !Ut()), r = this.frames.flatMap((e) => e.els), i = /* @__PURE__ */ new Set(), a = n.filter((e) => {
|
|
2024
|
+
let t = r.find((t) => t === e || t.contains(e) || e.contains(t));
|
|
2025
|
+
return t && i.add(t), !t;
|
|
2026
|
+
});
|
|
2027
|
+
for (let e of i) this.addTemp({
|
|
2028
|
+
el: e,
|
|
2029
|
+
box: A("div", {
|
|
2030
|
+
class: "box framepulse",
|
|
2031
|
+
"data-pulse": ""
|
|
2032
|
+
}),
|
|
2033
|
+
pad: 4
|
|
2034
|
+
}, t ? U.stillFlash : U.flash);
|
|
2035
|
+
return a.forEach((e, n) => {
|
|
2036
|
+
let r = A("div", {
|
|
2037
|
+
class: "box flash",
|
|
2038
|
+
"data-flash": ""
|
|
2039
|
+
}, n === 0 ? A("span", { class: "updated" }, "updated") : null);
|
|
2040
|
+
this.addTemp({
|
|
2041
|
+
el: e,
|
|
2042
|
+
box: r,
|
|
2043
|
+
pad: 6
|
|
2044
|
+
}, t ? U.stillFlash : U.flash);
|
|
2045
|
+
}), this.position(), a.length + i.size;
|
|
2046
|
+
}
|
|
2047
|
+
swap(e) {
|
|
2048
|
+
if (!N()) {
|
|
2049
|
+
for (let t of e.slice(0, 30)) this.addTemp({
|
|
2050
|
+
el: t,
|
|
2051
|
+
box: A("div", { class: "box swap" }),
|
|
2052
|
+
pad: 4
|
|
2053
|
+
}, U.swap);
|
|
2054
|
+
this.position();
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
addTemp(e, t) {
|
|
2058
|
+
this.root.append(e.box), this.temp.push(e), setTimeout(() => {
|
|
2059
|
+
e.box.remove(), this.temp = this.temp.filter((t) => t !== e);
|
|
2060
|
+
}, t + 40);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
function Ut() {
|
|
2064
|
+
let e = document.documentElement.getBoundingClientRect();
|
|
2065
|
+
return e.width > 0 || e.height > 0;
|
|
2066
|
+
}
|
|
2067
|
+
// src/menu.ts
|
|
2068
|
+
var Wt = [
|
|
2069
|
+
"claude-haiku-4-5",
|
|
2070
|
+
"claude-sonnet-5-5",
|
|
2071
|
+
"claude-opus-5-5"
|
|
2072
|
+
], Gt = {
|
|
2073
|
+
skills: "Skills",
|
|
2074
|
+
presets: "Presets",
|
|
2075
|
+
settings: "Settings"
|
|
2076
|
+
}, Kt = {
|
|
2077
|
+
"top-left": "Top left",
|
|
2078
|
+
"top-center": "Top middle",
|
|
2079
|
+
"top-right": "Top right",
|
|
2080
|
+
"bottom-left": "Bottom left",
|
|
2081
|
+
"bottom-center": "Bottom middle",
|
|
2082
|
+
"bottom-right": "Bottom right"
|
|
2083
|
+
}, qt = class {
|
|
2084
|
+
o;
|
|
2085
|
+
el;
|
|
2086
|
+
open = !1;
|
|
2087
|
+
view = "root";
|
|
2088
|
+
info = null;
|
|
2089
|
+
skills = null;
|
|
2090
|
+
presets = null;
|
|
2091
|
+
failed = /* @__PURE__ */ new Set();
|
|
2092
|
+
draft = null;
|
|
2093
|
+
confirmDelete = "";
|
|
2094
|
+
confirmTimer = 0;
|
|
2095
|
+
constructor(e) {
|
|
2096
|
+
this.o = e, this.el = A("div", {
|
|
2097
|
+
class: "smenu",
|
|
2098
|
+
hidden: !0,
|
|
2099
|
+
"data-menu": ""
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
2102
|
+
show() {
|
|
2103
|
+
this.o.open && this.o.setOpen(!1), this.o.setTip(!1), this.open = !0, this.view = "root", this.draft = null, this.confirmDelete = "", this.el.hidden = !1, this.el.classList.add("opening"), this.draw(), this.o.place(), this.focusFirst(), this.load();
|
|
2104
|
+
}
|
|
2105
|
+
close(e = !1) {
|
|
2106
|
+
this.open && (this.open = !1, this.draft = null, this.el.hidden = !0, this.el.replaceChildren(), clearTimeout(this.confirmTimer), e && this.o.focusDock());
|
|
2107
|
+
}
|
|
2108
|
+
toggle() {
|
|
2109
|
+
this.open ? this.close(!0) : this.show();
|
|
2110
|
+
}
|
|
2111
|
+
async load() {
|
|
2112
|
+
let e = this.o.client, [t, n, r] = await Promise.allSettled([
|
|
2113
|
+
e.call("GET info", {}),
|
|
2114
|
+
e.call("GET skills", {}),
|
|
2115
|
+
e.call("GET presets", {})
|
|
2116
|
+
]);
|
|
2117
|
+
this.failed.clear(), t.status === "fulfilled" ? this.info = t.value : this.failed.add("info"), n.status === "fulfilled" ? this.skills = n.value.skills : this.failed.add("skills"), r.status === "fulfilled" ? this.presets = r.value.presets : this.failed.add("presets"), this.open && this.draw();
|
|
2118
|
+
}
|
|
2119
|
+
go(e) {
|
|
2120
|
+
let t = this.view;
|
|
2121
|
+
this.view = e, this.draft = null, this.confirmDelete = "", this.draw(), e === "root" && t !== "root" ? this.focus(`[data-mkey="item:${t}"]`) : this.focusFirst();
|
|
2122
|
+
}
|
|
2123
|
+
draw() {
|
|
2124
|
+
if (!this.open) return;
|
|
2125
|
+
this.readDraft();
|
|
2126
|
+
let e = this.o.shadow.activeElement, t = e && this.el.contains(e) ? e.getAttribute("data-mkey") : null, n = this.el.querySelector(".sbody")?.scrollTop ?? 0, r = this.el.dataset.view === this.view;
|
|
2127
|
+
if (this.el.dataset.view = this.view, this.el.setAttribute("role", this.view === "root" ? "menu" : "dialog"), this.el.setAttribute("aria-label", this.view === "root" ? "Onsite menu" : Gt[this.view]), this.el.replaceChildren(...this.view === "root" ? this.root() : this.section(this.view)), r) {
|
|
2128
|
+
let e = this.el.querySelector(".sbody");
|
|
2129
|
+
e && (e.scrollTop = n);
|
|
2130
|
+
}
|
|
2131
|
+
t && this.focus(`[data-mkey="${CSS.escape(t)}"]`), setTimeout(() => this.el.classList.remove("opening"), 200);
|
|
2132
|
+
}
|
|
2133
|
+
root() {
|
|
2134
|
+
let e = this.skills?.filter((e) => e.enabled).length, t = this.presets?.length, n = (e, t, n, r) => A("button", {
|
|
2135
|
+
class: "mitem",
|
|
2136
|
+
type: "button",
|
|
2137
|
+
role: "menuitem",
|
|
2138
|
+
"aria-haspopup": r.sub ? "dialog" : null,
|
|
2139
|
+
"data-mnav": "",
|
|
2140
|
+
"data-mkey": `item:${e}`,
|
|
2141
|
+
...r.sub ? { "data-sub": e } : {},
|
|
2142
|
+
on: { click: r.click }
|
|
2143
|
+
}, j(t), A("span", { class: "grow" }, n), r.hint ? A("span", { class: "mhint" }, r.hint) : null, r.sub ? j(L.next) : null), r = this.o.hidden, i = this.o.everywhere();
|
|
2144
|
+
return [A("div", {
|
|
2145
|
+
class: "mbrand",
|
|
2146
|
+
"aria-hidden": "true"
|
|
2147
|
+
}, j(F(14, 3.2)), A("span", null, "onsite"), this.info ? A("span", { class: "mhint" }, `v${this.info.version}`) : null), A("div", { class: "mlist" }, n("changes", L.alt, "Changes", { click: () => this.openTab("changes") }), n("export", L.export, "Export", { click: () => this.openTab("export") }), i ? n("original", i === "original" ? L.original : L.undo, i === "original" ? "Show the original everywhere" : "Show the takes again", {
|
|
2148
|
+
hint: this.everywhereHint(i),
|
|
2149
|
+
click: () => void this.toggleEverywhere()
|
|
2150
|
+
}) : null, A("div", {
|
|
2151
|
+
class: "msep",
|
|
2152
|
+
role: "separator"
|
|
2153
|
+
}), n("skills", L.skills, "Skills", {
|
|
2154
|
+
sub: !0,
|
|
2155
|
+
hint: e === void 0 ? "" : `${e} on`,
|
|
2156
|
+
click: () => this.go("skills")
|
|
2157
|
+
}), n("presets", L.preset, "Presets", {
|
|
2158
|
+
sub: !0,
|
|
2159
|
+
hint: t === void 0 ? "" : String(t),
|
|
2160
|
+
click: () => this.go("presets")
|
|
2161
|
+
}), n("settings", L.settings, "Settings", {
|
|
2162
|
+
sub: !0,
|
|
2163
|
+
click: () => this.go("settings")
|
|
2164
|
+
}), A("div", {
|
|
2165
|
+
class: "msep",
|
|
2166
|
+
role: "separator"
|
|
2167
|
+
}), n("hide", r ? L.show : L.hide, r ? "Show icon" : "Hide icon", {
|
|
2168
|
+
hint: r ? "" : `2× ${P()} opens`,
|
|
2169
|
+
click: () => {
|
|
2170
|
+
this.close(), this.o.setHidden(!r);
|
|
2171
|
+
}
|
|
2172
|
+
}))];
|
|
2173
|
+
}
|
|
2174
|
+
everywhereHint(e) {
|
|
2175
|
+
let t = this.o, n = e === "original" ? R(t.thread) : t.beforeOriginal?.showing ?? [];
|
|
2176
|
+
return r(new Set(n.map((e) => t.thread.takes.find((t) => t.id === e)?.of ?? e)).size, "ask");
|
|
2177
|
+
}
|
|
2178
|
+
async toggleEverywhere() {
|
|
2179
|
+
await this.o.toggleEverywhere(), this.draw();
|
|
2180
|
+
}
|
|
2181
|
+
openTab(e) {
|
|
2182
|
+
this.close(), this.o.setOpen(!0), this.o.setTab(e);
|
|
2183
|
+
}
|
|
2184
|
+
section(e) {
|
|
2185
|
+
let t = A("div", { class: "mhead" }, A("button", {
|
|
2186
|
+
class: "btn ghost icon",
|
|
2187
|
+
type: "button",
|
|
2188
|
+
"aria-label": "Back to the menu",
|
|
2189
|
+
"data-mnav": "",
|
|
2190
|
+
"data-mkey": "back",
|
|
2191
|
+
on: { click: () => this.go("root") }
|
|
2192
|
+
}, j(L.back)), A("h2", null, Gt[e])), n = A("div", { class: "sbody scroll" });
|
|
2193
|
+
return e === "skills" ? n.append(...this.skillsView()) : e === "presets" ? n.append(...this.presetsView()) : n.append(...this.settingsView()), [t, n];
|
|
2194
|
+
}
|
|
2195
|
+
skillsView() {
|
|
2196
|
+
if (!this.skills) return [this.waiting("skills")];
|
|
2197
|
+
let e = A("p", { class: "mnote" }, "The agent sees the name and description of each skill that is on, and reads it when your ask matches. Onsite never runs a skill's scripts.");
|
|
2198
|
+
if (this.skills.length === 0) return [e, A("p", { class: "mnote" }, "No skills found. Add a folder with a SKILL.md to .claude/skills/ in your project, or to ~/.claude/skills/.")];
|
|
2199
|
+
let t = (e, t, n) => {
|
|
2200
|
+
let r = this.skills.filter((t) => t.source === e);
|
|
2201
|
+
return r.length ? A("section", { class: "mgroup" }, A("h3", null, t, A("span", { class: "mhint" }, n)), r.map((e) => this.skillRow(e))) : null;
|
|
2202
|
+
};
|
|
2203
|
+
return [e, ...[t("project", "This project", ".claude/skills"), t("user", "Your own", "~/.claude/skills · off by default")].filter((e) => e !== null)];
|
|
2204
|
+
}
|
|
2205
|
+
skillRow(e) {
|
|
2206
|
+
let t = `os-skill-${e.id.replace(/[^A-Za-z0-9_-]/g, "-")}`;
|
|
2207
|
+
return A("div", { class: "mrow" }, A("div", { class: "grow" }, A("div", {
|
|
2208
|
+
class: "mname mono",
|
|
2209
|
+
id: t
|
|
2210
|
+
}, e.name), A("div", {
|
|
2211
|
+
class: "mdesc",
|
|
2212
|
+
title: e.path
|
|
2213
|
+
}, e.description)), A("button", {
|
|
2214
|
+
class: "switch",
|
|
2215
|
+
type: "button",
|
|
2216
|
+
role: "switch",
|
|
2217
|
+
"aria-checked": String(e.enabled),
|
|
2218
|
+
"aria-labelledby": t,
|
|
2219
|
+
"data-mnav": "",
|
|
2220
|
+
"data-mkey": `skill:${e.id}`,
|
|
2221
|
+
on: { click: () => void this.toggleSkill(e) }
|
|
2222
|
+
}, A("span", {
|
|
2223
|
+
class: "knob",
|
|
2224
|
+
"aria-hidden": "true"
|
|
2225
|
+
})));
|
|
2226
|
+
}
|
|
2227
|
+
async toggleSkill(e) {
|
|
2228
|
+
let t = !e.enabled;
|
|
2229
|
+
e.enabled = t, this.draw();
|
|
2230
|
+
try {
|
|
2231
|
+
await this.o.savePrefs({ skills: { [e.id]: t } });
|
|
2232
|
+
} catch (n) {
|
|
2233
|
+
e.enabled = !t, this.draw(), this.o.showToast(`Could not change the skill: ${n.message}`);
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
presetsView() {
|
|
2237
|
+
if (!this.presets) return [this.waiting("presets")];
|
|
2238
|
+
if (this.draft) return [this.presetForm(this.draft)];
|
|
2239
|
+
let e = this.o.pins.length, t = A("p", { class: "mnote" }, e ? `A preset runs as an ask on the ${r(e, "selected element")}.` : `A preset runs as an ask. Select elements first (${P()}-click) to aim it.`), n = this.presets.filter((e) => e.source === "builtin"), i = this.presets.filter((e) => e.source === "project");
|
|
2240
|
+
return [
|
|
2241
|
+
t,
|
|
2242
|
+
A("section", { class: "mgroup" }, A("h3", null, "Onsite"), n.map((e) => this.presetRow(e))),
|
|
2243
|
+
A("section", { class: "mgroup" }, A("h3", null, "This project", A("span", { class: "mhint" }, ".onsite/presets.json")), i.length ? i.map((e) => this.presetRow(e)) : A("p", { class: "mnote" }, "None yet."), A("button", {
|
|
2244
|
+
class: "btn",
|
|
2245
|
+
type: "button",
|
|
2246
|
+
"data-mnav": "",
|
|
2247
|
+
"data-mkey": "preset:new",
|
|
2248
|
+
on: { click: () => this.edit({
|
|
2249
|
+
name: "",
|
|
2250
|
+
message: ""
|
|
2251
|
+
}) }
|
|
2252
|
+
}, j(L.plus), "New preset"))
|
|
2253
|
+
];
|
|
2254
|
+
}
|
|
2255
|
+
presetRow(e) {
|
|
2256
|
+
let t = e.count ?? this.o.takes, n = A("button", {
|
|
2257
|
+
class: "mrun",
|
|
2258
|
+
type: "button",
|
|
2259
|
+
title: e.message,
|
|
2260
|
+
"data-mnav": "",
|
|
2261
|
+
"data-mkey": `preset:${e.id}`,
|
|
2262
|
+
on: { click: () => void this.runPreset(e) }
|
|
2263
|
+
}, A("span", { class: "mname" }, e.name, A("span", { class: "mhint" }, r(t, "take"))), A("span", { class: "mdesc" }, e.message));
|
|
2264
|
+
if (e.source !== "project") return A("div", { class: "mrow" }, n);
|
|
2265
|
+
let i = this.confirmDelete === e.id;
|
|
2266
|
+
return A("div", { class: "mrow" }, n, A("button", {
|
|
2267
|
+
class: "btn ghost icon",
|
|
2268
|
+
type: "button",
|
|
2269
|
+
"aria-label": `Edit ${e.name}`,
|
|
2270
|
+
title: "Edit",
|
|
2271
|
+
"data-mkey": `edit:${e.id}`,
|
|
2272
|
+
on: { click: () => this.edit({
|
|
2273
|
+
id: e.id,
|
|
2274
|
+
name: e.name,
|
|
2275
|
+
message: e.message,
|
|
2276
|
+
...e.count ? { count: e.count } : {}
|
|
2277
|
+
}) }
|
|
2278
|
+
}, j(L.edit)), A("button", {
|
|
2279
|
+
class: `btn ghost${i ? " danger" : " icon"}`,
|
|
2280
|
+
type: "button",
|
|
2281
|
+
"aria-label": i ? `Delete ${e.name}: press again to delete` : `Delete ${e.name}`,
|
|
2282
|
+
title: i ? "Press again to delete" : "Delete",
|
|
2283
|
+
"data-mkey": `delete:${e.id}`,
|
|
2284
|
+
on: { click: () => void this.deletePreset(e) }
|
|
2285
|
+
}, i ? "Delete?" : j(L.trash)));
|
|
2286
|
+
}
|
|
2287
|
+
presetForm(e) {
|
|
2288
|
+
let t = (t, n) => A("button", {
|
|
2289
|
+
type: "button",
|
|
2290
|
+
"aria-pressed": String(e.count === t),
|
|
2291
|
+
"data-mkey": `count:${t ?? "default"}`,
|
|
2292
|
+
on: { click: () => {
|
|
2293
|
+
e.count = t, this.draw();
|
|
2294
|
+
} }
|
|
2295
|
+
}, n);
|
|
2296
|
+
return A("form", {
|
|
2297
|
+
class: "mform",
|
|
2298
|
+
"aria-label": e.id ? "Edit the preset" : "New preset",
|
|
2299
|
+
on: { submit: (e) => {
|
|
2300
|
+
e.preventDefault(), this.savePreset();
|
|
2301
|
+
} }
|
|
2302
|
+
}, A("label", null, A("span", null, "Name"), A("input", {
|
|
2303
|
+
type: "text",
|
|
2304
|
+
name: "name",
|
|
2305
|
+
maxlength: 60,
|
|
2306
|
+
required: !0,
|
|
2307
|
+
value: e.name,
|
|
2308
|
+
"data-mkey": "f:name"
|
|
2309
|
+
})), A("label", null, A("span", null, "Ask"), A("textarea", {
|
|
2310
|
+
name: "message",
|
|
2311
|
+
rows: 4,
|
|
2312
|
+
maxlength: 4e3,
|
|
2313
|
+
required: !0,
|
|
2314
|
+
"data-mkey": "f:message"
|
|
2315
|
+
}, e.message)), A("div", { class: "mfield" }, A("span", null, "Takes"), A("div", {
|
|
2316
|
+
class: "seg small",
|
|
2317
|
+
role: "group",
|
|
2318
|
+
"aria-label": "Takes"
|
|
2319
|
+
}, t(void 0, `Default (${this.o.takes})`), Array.from({ length: 3 }, (e, n) => t(n + 1, String(n + 1))))), A("div", { class: "buttons" }, A("span", { class: "grow" }), A("button", {
|
|
2320
|
+
class: "btn ghost",
|
|
2321
|
+
type: "button",
|
|
2322
|
+
"data-mkey": "f:cancel",
|
|
2323
|
+
on: { click: () => this.edit(null) }
|
|
2324
|
+
}, "Cancel"), A("button", {
|
|
2325
|
+
class: "btn primary",
|
|
2326
|
+
type: "submit",
|
|
2327
|
+
"data-mkey": "f:save"
|
|
2328
|
+
}, e.id ? "Save" : "Add preset")));
|
|
2329
|
+
}
|
|
2330
|
+
readDraft() {
|
|
2331
|
+
let e = this.el.querySelector(".mform");
|
|
2332
|
+
e && this.draft && (this.draft.name = e.elements.namedItem("name")?.value ?? this.draft.name, this.draft.message = e.elements.namedItem("message")?.value ?? this.draft.message);
|
|
2333
|
+
}
|
|
2334
|
+
edit(e) {
|
|
2335
|
+
this.el.querySelector(".mform")?.remove(), this.draft = e, this.confirmDelete = "", this.draw(), e ? this.focus("[data-mkey=\"f:name\"]") : this.focusFirst();
|
|
2336
|
+
}
|
|
2337
|
+
async savePreset() {
|
|
2338
|
+
this.readDraft();
|
|
2339
|
+
let e = this.draft;
|
|
2340
|
+
if (e) try {
|
|
2341
|
+
let t = await this.o.client.call("POST preset", {
|
|
2342
|
+
...e.id ? { id: e.id } : {},
|
|
2343
|
+
name: e.name,
|
|
2344
|
+
message: e.message,
|
|
2345
|
+
...e.count ? { count: e.count } : {}
|
|
2346
|
+
}), n = this.presets ?? [], r = n.findIndex((e) => e.id === t.id);
|
|
2347
|
+
this.presets = r >= 0 ? n.map((e) => e.id === t.id ? t : e) : [...n, t], this.draft = null, this.draw(), this.focus(`[data-mkey="preset:${CSS.escape(t.id)}"]`);
|
|
2348
|
+
} catch (e) {
|
|
2349
|
+
this.o.showToast(e.message);
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
async deletePreset(e) {
|
|
2353
|
+
if (this.confirmDelete !== e.id) this.confirmDelete = e.id, this.draw(), clearTimeout(this.confirmTimer), this.confirmTimer = window.setTimeout(() => {
|
|
2354
|
+
this.confirmDelete === e.id && (this.confirmDelete = "", this.draw());
|
|
2355
|
+
}, 4e3);
|
|
2356
|
+
else {
|
|
2357
|
+
this.confirmDelete = "";
|
|
2358
|
+
try {
|
|
2359
|
+
await this.o.client.call("POST delete-preset", { id: e.id }), this.presets = (this.presets ?? []).filter((t) => t.id !== e.id), this.draw(), this.focus("[data-mkey=\"preset:new\"]"), this.o.showToast(`Deleted the preset ${e.name}`);
|
|
2360
|
+
} catch (e) {
|
|
2361
|
+
this.draw(), this.o.showToast(e.message);
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
async runPreset(e) {
|
|
2366
|
+
this.o.thread.running ? this.o.showToast("A change is running. Wait for it, or stop it.") : (this.close(), this.o.setOpen(!0), await this.o.ask(e.message, e.count ?? this.o.takes));
|
|
2367
|
+
}
|
|
2368
|
+
settingsView() {
|
|
2369
|
+
let e = this.o, t = this.info, n = A("select", {
|
|
2370
|
+
id: "os-model",
|
|
2371
|
+
"data-mkey": "set:model",
|
|
2372
|
+
on: { change: (e) => void this.setModel(e.target.value) }
|
|
2373
|
+
}, A("option", { value: "" }, t?.pluginModel ? `Plugin default · ${t.pluginModel}` : "Plugin default"), Wt.map((e) => A("option", { value: e }, e)));
|
|
2374
|
+
e.model && !Wt.includes(e.model) && n.append(A("option", { value: e.model }, e.model)), n.value = e.model ?? "";
|
|
2375
|
+
let r = (e, t, n, r) => A("div", {
|
|
2376
|
+
class: "seg small",
|
|
2377
|
+
role: "group",
|
|
2378
|
+
"aria-label": e
|
|
2379
|
+
}, n.map(([n, i]) => A("button", {
|
|
2380
|
+
type: "button",
|
|
2381
|
+
"aria-pressed": String(t === n),
|
|
2382
|
+
"data-mkey": `set:${e}:${n}`,
|
|
2383
|
+
on: { click: () => r(n) }
|
|
2384
|
+
}, i))), i = (e, t, n, r) => A("div", { class: "mset" }, r ? A("label", { for: r }, e) : A("span", null, e), t, n ? A("p", { class: "mhint" }, n) : null), a = A("div", {
|
|
2385
|
+
class: "anchors",
|
|
2386
|
+
role: "group",
|
|
2387
|
+
"aria-label": "Dock position"
|
|
2388
|
+
}, Ge.map((t) => A("button", {
|
|
2389
|
+
type: "button",
|
|
2390
|
+
"aria-pressed": String(e.saved === t),
|
|
2391
|
+
"aria-label": Kt[t],
|
|
2392
|
+
title: Kt[t],
|
|
2393
|
+
"data-mkey": `set:dock:${t}`,
|
|
2394
|
+
on: { click: () => {
|
|
2395
|
+
e.moveDock(t), this.draw();
|
|
2396
|
+
} }
|
|
2397
|
+
}, A("span", {
|
|
2398
|
+
class: "dot",
|
|
2399
|
+
"aria-hidden": "true"
|
|
2400
|
+
})))), o = t ? `Next runs use ${t.model || "the Agent SDK's default"}.` : null;
|
|
2401
|
+
return [
|
|
2402
|
+
i("Model", n, this.failed.has("info") ? "Could not read the current model." : o, "os-model"),
|
|
2403
|
+
i("Default takes", r("Default takes", e.takes, [
|
|
2404
|
+
1,
|
|
2405
|
+
2,
|
|
2406
|
+
3
|
|
2407
|
+
].map((e) => [e, String(e)]), (e) => void this.setTakes(e)), "How many takes the composer asks for, until you change it."),
|
|
2408
|
+
i("Scheme", r("Scheme", e.pref, [
|
|
2409
|
+
["auto", "Auto"],
|
|
2410
|
+
["light", "Light"],
|
|
2411
|
+
["dark", "Dark"]
|
|
2412
|
+
], (t) => {
|
|
2413
|
+
e.setScheme(t), this.draw();
|
|
2414
|
+
}), "Auto follows the page under the icon."),
|
|
2415
|
+
i("Dock position", a, "Or drag the icon, or press Shift and an arrow key."),
|
|
2416
|
+
A("dl", { class: "minfo" }, A("dt", null, "Version"), A("dd", { class: "mono" }, t?.version ?? "…"), A("dt", null, "Source folders"), A("dd", { class: "mono" }, t ? t.src.join(", ") : "…"))
|
|
2417
|
+
];
|
|
2418
|
+
}
|
|
2419
|
+
async setModel(e) {
|
|
2420
|
+
try {
|
|
2421
|
+
await this.o.savePrefs({ model: e || null }), this.info = await this.o.client.call("GET info", {});
|
|
2422
|
+
} catch (e) {
|
|
2423
|
+
this.o.showToast(`Could not change the model: ${e.message}`);
|
|
2424
|
+
}
|
|
2425
|
+
this.draw();
|
|
2426
|
+
}
|
|
2427
|
+
async setTakes(e) {
|
|
2428
|
+
try {
|
|
2429
|
+
await this.o.savePrefs({ takes: e }), this.o.setCount(e);
|
|
2430
|
+
} catch (e) {
|
|
2431
|
+
this.o.showToast(`Could not change the default takes: ${e.message}`);
|
|
2432
|
+
}
|
|
2433
|
+
this.draw();
|
|
2434
|
+
}
|
|
2435
|
+
waiting(e) {
|
|
2436
|
+
return A("p", { class: "mnote" }, this.failed.has(e) ? `Could not read the ${e}. Close the menu and open it again.` : "Reading…");
|
|
2437
|
+
}
|
|
2438
|
+
focus(e) {
|
|
2439
|
+
this.el.querySelector(e)?.focus({ preventScroll: !0 });
|
|
2440
|
+
}
|
|
2441
|
+
focusFirst() {
|
|
2442
|
+
this.el.querySelector("[data-mnav]")?.focus({ preventScroll: !0 });
|
|
2443
|
+
}
|
|
2444
|
+
key(e) {
|
|
2445
|
+
if (!this.open) return !1;
|
|
2446
|
+
let t = e.composedPath()[0], n = t instanceof Element && ut(t);
|
|
2447
|
+
if (e.key === "Escape") return this.draft ? this.edit(null) : this.view === "root" ? this.close(!0) : this.go("root"), !0;
|
|
2448
|
+
if (n || !(t instanceof Node && this.el.contains(t))) return !1;
|
|
2449
|
+
let r = [...this.el.querySelectorAll("[data-mnav]")], i = r.indexOf(t), a = (e) => r[(e + r.length) % r.length]?.focus({ preventScroll: !0 });
|
|
2450
|
+
if (e.key === "ArrowDown") a(i + 1);
|
|
2451
|
+
else if (e.key === "ArrowUp") a(i < 0 ? r.length - 1 : i - 1);
|
|
2452
|
+
else if (e.key === "Home") a(0);
|
|
2453
|
+
else if (e.key === "End") a(r.length - 1);
|
|
2454
|
+
else if (e.key === "ArrowRight" && t instanceof HTMLElement && t.dataset.sub) this.go(t.dataset.sub);
|
|
2455
|
+
else if (e.key === "ArrowLeft" && this.view !== "root") this.go("root");
|
|
2456
|
+
else return !1;
|
|
2457
|
+
return !0;
|
|
2458
|
+
}
|
|
2459
|
+
}, Jt = (e) => e.w >= 384 ? 12 : 8, Yt = (e) => Math.max(200, Math.min(360, e.w - Jt(e) * 2));
|
|
2460
|
+
function Xt(e, t, n, r = {
|
|
2461
|
+
edge: 8,
|
|
2462
|
+
y: 8,
|
|
2463
|
+
x: 8,
|
|
2464
|
+
left: e.left
|
|
2465
|
+
}) {
|
|
2466
|
+
let { edge: i, y: a, x: o } = r, s = Math.max(i, Math.min(r.left, n.w - t.w - i)), c = e.top + e.height + a;
|
|
2467
|
+
if (c + t.h <= n.h - i) return {
|
|
2468
|
+
left: s,
|
|
2469
|
+
top: c,
|
|
2470
|
+
side: "below"
|
|
2471
|
+
};
|
|
2472
|
+
let l = e.top - a - t.h;
|
|
2473
|
+
if (l >= i) return {
|
|
2474
|
+
left: s,
|
|
2475
|
+
top: l,
|
|
2476
|
+
side: "above"
|
|
2477
|
+
};
|
|
2478
|
+
let u = Math.max(i, Math.min(e.top, n.h - t.h - i)), d = e.left + e.width + o;
|
|
2479
|
+
if (d + t.w <= n.w - i) return {
|
|
2480
|
+
left: d,
|
|
2481
|
+
top: u,
|
|
2482
|
+
side: "right"
|
|
2483
|
+
};
|
|
2484
|
+
let f = e.left - o - t.w;
|
|
2485
|
+
return f >= i ? {
|
|
2486
|
+
left: f,
|
|
2487
|
+
top: u,
|
|
2488
|
+
side: "left"
|
|
2489
|
+
} : {
|
|
2490
|
+
left: s,
|
|
2491
|
+
top: Math.max(i, Math.min(e.top + e.height - o - t.h, n.h - t.h - i)),
|
|
2492
|
+
side: "inside"
|
|
2493
|
+
};
|
|
2494
|
+
}
|
|
2495
|
+
function Zt(e, t, n) {
|
|
2496
|
+
let r = t.tab, i = Xt(e, t, n, {
|
|
2497
|
+
edge: Jt(n),
|
|
2498
|
+
y: r ? 0 : 6,
|
|
2499
|
+
x: 6,
|
|
2500
|
+
left: r ? e.left - 30 : e.left
|
|
2501
|
+
});
|
|
2502
|
+
if (!r) return {
|
|
2503
|
+
...i,
|
|
2504
|
+
tabX: 0
|
|
2505
|
+
};
|
|
2506
|
+
let a = i.side === "below" || i.side === "above" ? Math.max(30, Math.min(e.left - i.left, t.w - r.w - 30)) : 30;
|
|
2507
|
+
return {
|
|
2508
|
+
...i,
|
|
2509
|
+
tabX: a
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
var Qt = ["data-fkey", "data-mkey"];
|
|
2513
|
+
function $t(e, t, n, r) {
|
|
2514
|
+
let i = (e) => Math.max(8, Math.min(e, r.w - n.w - 8)), a = (e) => Math.max(8, Math.min(e, r.h - n.h - 8));
|
|
2515
|
+
return t ? {
|
|
2516
|
+
left: i(t.left + (t.width - n.w) / 2),
|
|
2517
|
+
top: a(t.top + (t.height - n.h) / 2),
|
|
2518
|
+
side: "center"
|
|
2519
|
+
} : e ? Xt(e, n, r) : {
|
|
2520
|
+
left: i((r.w - n.w) / 2),
|
|
2521
|
+
top: a((r.h - n.h) / 2),
|
|
2522
|
+
side: "center"
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
var en = class {
|
|
2526
|
+
shadow;
|
|
2527
|
+
viewport;
|
|
2528
|
+
el;
|
|
2529
|
+
last = null;
|
|
2530
|
+
open = null;
|
|
2531
|
+
back = null;
|
|
2532
|
+
constructor(e, t) {
|
|
2533
|
+
this.shadow = e, this.viewport = t, this.el = A("div", { "data-questionbox": "" });
|
|
2534
|
+
let n = (e) => {
|
|
2535
|
+
let t = e.composedPath()[0];
|
|
2536
|
+
t instanceof Element && !this.el.contains(t) && (this.last = t.closest("button, [tabindex], a, input") ?? t);
|
|
2537
|
+
};
|
|
2538
|
+
e.addEventListener("pointerdown", n, !0), e.addEventListener("keydown", n, !0);
|
|
2539
|
+
}
|
|
2540
|
+
get asking() {
|
|
2541
|
+
return this.open !== null;
|
|
2542
|
+
}
|
|
2543
|
+
ask(e) {
|
|
2544
|
+
this.close(!1);
|
|
2545
|
+
let t = this.control(), n = tn(t);
|
|
2546
|
+
return new Promise((r) => {
|
|
2547
|
+
let i = "os-question-text", a = A("button", {
|
|
2548
|
+
class: "btn ghost",
|
|
2549
|
+
type: "button",
|
|
2550
|
+
"data-question-no": "",
|
|
2551
|
+
on: { click: () => this.close(!1) }
|
|
2552
|
+
}, "Cancel"), o = A("button", {
|
|
2553
|
+
class: "btn primary",
|
|
2554
|
+
type: "button",
|
|
2555
|
+
"data-question-yes": "",
|
|
2556
|
+
on: { click: () => this.close(!0) }
|
|
2557
|
+
}, e.yes), s = A("div", {
|
|
2558
|
+
class: "question",
|
|
2559
|
+
role: "alertdialog",
|
|
2560
|
+
"aria-modal": "false",
|
|
2561
|
+
"aria-label": e.label,
|
|
2562
|
+
"aria-describedby": i,
|
|
2563
|
+
"data-question": ""
|
|
2564
|
+
}, A("p", {
|
|
2565
|
+
class: "text",
|
|
2566
|
+
id: i
|
|
2567
|
+
}, e.text), A("div", { class: "buttons" }, A("span", { class: "grow" }), a, o));
|
|
2568
|
+
this.open = {
|
|
2569
|
+
card: s,
|
|
2570
|
+
yes: o,
|
|
2571
|
+
no: a,
|
|
2572
|
+
answer: r,
|
|
2573
|
+
from: t,
|
|
2574
|
+
key: n,
|
|
2575
|
+
at: {
|
|
2576
|
+
control: null,
|
|
2577
|
+
panel: null
|
|
2578
|
+
}
|
|
2579
|
+
}, this.el.replaceChildren(s), this.place(), addEventListener("pointerdown", this.onOutside, !0), o.focus({ preventScroll: !0 });
|
|
2580
|
+
});
|
|
2581
|
+
}
|
|
2582
|
+
close(e) {
|
|
2583
|
+
let t = this.open;
|
|
2584
|
+
t && (this.open = null, removeEventListener("pointerdown", this.onOutside, !0), this.el.replaceChildren(), this.back = {
|
|
2585
|
+
from: t.from,
|
|
2586
|
+
key: t.key
|
|
2587
|
+
}, this.refocus(), t.answer(e));
|
|
2588
|
+
}
|
|
2589
|
+
refocus() {
|
|
2590
|
+
let e = this.back;
|
|
2591
|
+
if (!e) return;
|
|
2592
|
+
let t = e.from?.isConnected ? e.from : null;
|
|
2593
|
+
!t && e.key && (t = [...this.shadow.querySelectorAll(`[${e.key.attr}]`)].find((t) => t.getAttribute(e.key.attr) === e.key.value) ?? null), t instanceof HTMLElement && t.focus({ preventScroll: !0 });
|
|
2594
|
+
}
|
|
2595
|
+
key(e) {
|
|
2596
|
+
let t = this.open;
|
|
2597
|
+
if (!t) return !1;
|
|
2598
|
+
let n = e.composedPath()[0];
|
|
2599
|
+
return e.key === "Escape" ? (this.close(!1), !0) : e.key === "Enter" ? (e.repeat || (n === t.yes ? this.close(!0) : n === t.no && this.close(!1)), !0) : e.key === "Tab" && ((n === t.yes ? t.no : t.yes).focus({ preventScroll: !0 }), !0);
|
|
2600
|
+
}
|
|
2601
|
+
place() {
|
|
2602
|
+
let e = this.open;
|
|
2603
|
+
if (!e) return;
|
|
2604
|
+
let t = this.viewport(), n = Math.max(200, Math.min(300, t.w - 16));
|
|
2605
|
+
if (e.card.style.width = `${n}px`, e.from?.isConnected) {
|
|
2606
|
+
let t = e.from.closest(".panel"), n = e.from.getBoundingClientRect();
|
|
2607
|
+
e.at = {
|
|
2608
|
+
control: n.width > 0 || n.height > 0 ? nn(n, 4) : null,
|
|
2609
|
+
panel: t ? nn(t.getBoundingClientRect()) : null
|
|
2610
|
+
};
|
|
2611
|
+
}
|
|
2612
|
+
let r = $t(e.at.control, e.at.panel, {
|
|
2613
|
+
w: n,
|
|
2614
|
+
h: e.card.offsetHeight || 110
|
|
2615
|
+
}, t);
|
|
2616
|
+
e.card.style.left = `${r.left}px`, e.card.style.top = `${r.top}px`, e.card.dataset.side = r.side;
|
|
2617
|
+
}
|
|
2618
|
+
control() {
|
|
2619
|
+
return this.last?.isConnected ? this.last : this.shadow.activeElement;
|
|
2620
|
+
}
|
|
2621
|
+
onOutside = (e) => {
|
|
2622
|
+
this.open && !e.composedPath().includes(this.open.card) && this.close(!1);
|
|
2623
|
+
};
|
|
2624
|
+
};
|
|
2625
|
+
function tn(e) {
|
|
2626
|
+
for (let t of Qt) {
|
|
2627
|
+
let n = e?.getAttribute(t);
|
|
2628
|
+
if (n) return {
|
|
2629
|
+
attr: t,
|
|
2630
|
+
value: n
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
return null;
|
|
2634
|
+
}
|
|
2635
|
+
var nn = (e, t = 0) => ({
|
|
2636
|
+
left: e.left - t,
|
|
2637
|
+
top: e.top - t,
|
|
2638
|
+
width: e.width + t * 2,
|
|
2639
|
+
height: e.height + t * 2
|
|
2640
|
+
}), Y = (e, t) => e.endsWith("%") ? Number.parseFloat(e) / 100 * t : Number.parseFloat(e);
|
|
2641
|
+
function rn(e) {
|
|
2642
|
+
let t = e.trim().toLowerCase();
|
|
2643
|
+
if (t === "" || t === "transparent" || t === "none") return {
|
|
2644
|
+
r: 0,
|
|
2645
|
+
g: 0,
|
|
2646
|
+
b: 0,
|
|
2647
|
+
a: 0
|
|
2648
|
+
};
|
|
2649
|
+
if (t.startsWith("#")) {
|
|
2650
|
+
let e = t.slice(1), n = e.length === 3 || e.length === 4 ? [...e].map((e) => e + e).join("") : e.length === 6 || e.length === 8 ? e : "";
|
|
2651
|
+
if (!n || /[^0-9a-f]/.test(n)) return null;
|
|
2652
|
+
let r = (e) => Number.parseInt(n.slice(e, e + 2), 16);
|
|
2653
|
+
return {
|
|
2654
|
+
r: r(0),
|
|
2655
|
+
g: r(2),
|
|
2656
|
+
b: r(4),
|
|
2657
|
+
a: n.length === 8 ? r(6) / 255 : 1
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
let n = /^([a-z]+)\((.*)\)$/.exec(t);
|
|
2661
|
+
if (!n) return null;
|
|
2662
|
+
let [, r = "", i = ""] = n, [a = "", o] = i.split("/"), s = a.replace(/,/g, " ").trim().split(/\s+/), c = 1;
|
|
2663
|
+
if (o === void 0 ? (r === "rgba" || r === "rgb") && s.length === 4 && (c = Y(s[3] ?? "1", 1)) : c = Y(o.trim(), 1), Number.isNaN(c) && (c = 1), r === "rgb" || r === "rgba") {
|
|
2664
|
+
let [e, t, n] = s.slice(0, 3).map((e) => Y(e, 255));
|
|
2665
|
+
return e === void 0 || t === void 0 || n === void 0 || [
|
|
2666
|
+
e,
|
|
2667
|
+
t,
|
|
2668
|
+
n
|
|
2669
|
+
].some(Number.isNaN) ? null : {
|
|
2670
|
+
r: e,
|
|
2671
|
+
g: t,
|
|
2672
|
+
b: n,
|
|
2673
|
+
a: c
|
|
2674
|
+
};
|
|
2675
|
+
}
|
|
2676
|
+
if (r === "color" && s[0] === "srgb") {
|
|
2677
|
+
let [e, t, n] = s.slice(1, 4).map((e) => Y(e, 1) * 255);
|
|
2678
|
+
return e === void 0 || t === void 0 || n === void 0 || [
|
|
2679
|
+
e,
|
|
2680
|
+
t,
|
|
2681
|
+
n
|
|
2682
|
+
].some(Number.isNaN) ? null : {
|
|
2683
|
+
r: e,
|
|
2684
|
+
g: t,
|
|
2685
|
+
b: n,
|
|
2686
|
+
a: c
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2689
|
+
let l = NaN;
|
|
2690
|
+
if ((r === "oklch" || r === "oklab") && (l = Y(s[0] ?? "", 1)), (r === "lab" || r === "lch") && (l = Y(s[0] ?? "", 100) / 100), Number.isNaN(l)) return null;
|
|
2691
|
+
let u = Math.round(Math.max(0, Math.min(1, r.startsWith("ok") ? l ** 3 : an(l))) ** (1 / 2.2) * 255);
|
|
2692
|
+
return {
|
|
2693
|
+
r: u,
|
|
2694
|
+
g: u,
|
|
2695
|
+
b: u,
|
|
2696
|
+
a: c
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2699
|
+
function an(e) {
|
|
2700
|
+
let t = e * 100;
|
|
2701
|
+
return t > 8 ? ((t + 16) / 116) ** 3 : t / 903.3;
|
|
2702
|
+
}
|
|
2703
|
+
function on(e) {
|
|
2704
|
+
let t = (e) => {
|
|
2705
|
+
let t = e / 255;
|
|
2706
|
+
return t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
2707
|
+
};
|
|
2708
|
+
return .2126 * t(e.r) + .7152 * t(e.g) + .0722 * t(e.b);
|
|
2709
|
+
}
|
|
2710
|
+
function sn() {
|
|
2711
|
+
try {
|
|
2712
|
+
return matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2713
|
+
} catch {
|
|
2714
|
+
return "light";
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
function cn(e) {
|
|
2718
|
+
let { x: t, y: n } = e.point(), r = typeof e.doc.elementsFromPoint == "function" ? e.doc.elementsFromPoint(t, n) : [];
|
|
2719
|
+
for (let t of r) if (t !== e.host && !e.host?.contains(t)) return t;
|
|
2720
|
+
return e.doc.body ?? e.doc.documentElement;
|
|
2721
|
+
}
|
|
2722
|
+
function ln(e) {
|
|
2723
|
+
let t = e.doc.defaultView ?? window, n = e.doc.documentElement, r = e.doc.body, i = (e) => {
|
|
2724
|
+
if (!e) return null;
|
|
2725
|
+
let n = rn(t.getComputedStyle(e).backgroundColor);
|
|
2726
|
+
return n && n.a >= .99 ? n : null;
|
|
2727
|
+
}, a = (e) => on(e) < .4 ? "dark" : "light";
|
|
2728
|
+
for (let t = cn(e); t && t !== n; t = t.parentElement) {
|
|
2729
|
+
let e = i(t);
|
|
2730
|
+
if (e) return a(e);
|
|
2731
|
+
}
|
|
2732
|
+
let o = i(n) ?? i(r);
|
|
2733
|
+
return o ? a(o) : sn();
|
|
2734
|
+
}
|
|
2735
|
+
function un(e, t) {
|
|
2736
|
+
let n = e.doc.defaultView ?? window, r = ln(e), i = 0, a = () => {
|
|
2737
|
+
i = 0;
|
|
2738
|
+
let n = ln(e);
|
|
2739
|
+
n !== r && (r = n, d.scheme = n, t(n));
|
|
2740
|
+
}, o = () => {
|
|
2741
|
+
i ||= n.setTimeout(a, 0), n.setTimeout(a, 300);
|
|
2742
|
+
}, s = new n.MutationObserver(o), c = (e) => e && s.observe(e, {
|
|
2743
|
+
attributes: !0,
|
|
2744
|
+
attributeFilter: [
|
|
2745
|
+
"class",
|
|
2746
|
+
"data-theme",
|
|
2747
|
+
"style"
|
|
2748
|
+
]
|
|
2749
|
+
});
|
|
2750
|
+
c(e.doc.documentElement), c(e.doc.body);
|
|
2751
|
+
let l = pn(n, o), u = null;
|
|
2752
|
+
try {
|
|
2753
|
+
u = n.matchMedia("(prefers-color-scheme: dark)"), u.addEventListener?.("change", o);
|
|
2754
|
+
} catch {
|
|
2755
|
+
u = null;
|
|
2756
|
+
}
|
|
2757
|
+
let d = {
|
|
2758
|
+
scheme: r,
|
|
2759
|
+
recheck: o,
|
|
2760
|
+
stop() {
|
|
2761
|
+
s.disconnect(), l(), u?.removeEventListener?.("change", o), i && n.clearTimeout(i);
|
|
2762
|
+
}
|
|
2763
|
+
};
|
|
2764
|
+
return d;
|
|
2765
|
+
}
|
|
2766
|
+
var dn = "onsite:route", fn = /* @__PURE__ */ new WeakSet();
|
|
2767
|
+
function pn(e, t) {
|
|
2768
|
+
let n = e.history;
|
|
2769
|
+
if (n && !fn.has(n)) {
|
|
2770
|
+
fn.add(n);
|
|
2771
|
+
for (let t of ["pushState", "replaceState"]) {
|
|
2772
|
+
let r = n[t];
|
|
2773
|
+
n[t] = function(...t) {
|
|
2774
|
+
let n = r.apply(this, t);
|
|
2775
|
+
return e.dispatchEvent(new Event(dn)), n;
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
return e.addEventListener(dn, t), e.addEventListener("popstate", t), () => {
|
|
2780
|
+
e.removeEventListener(dn, t), e.removeEventListener("popstate", t);
|
|
2781
|
+
};
|
|
2782
|
+
}
|
|
2783
|
+
// src/tooltip.ts
|
|
2784
|
+
var mn = "os-icontip", X = 8, hn = (e) => e instanceof Element ? e.closest("[data-tip]") : null, gn = class {
|
|
2785
|
+
root;
|
|
2786
|
+
el;
|
|
2787
|
+
at = null;
|
|
2788
|
+
timer = 0;
|
|
2789
|
+
constructor(e) {
|
|
2790
|
+
this.root = e, this.el = A("div", {
|
|
2791
|
+
class: "icontip",
|
|
2792
|
+
id: mn,
|
|
2793
|
+
role: "tooltip",
|
|
2794
|
+
hidden: !0,
|
|
2795
|
+
"data-icontip": ""
|
|
2796
|
+
}), e.addEventListener("pointerover", (e) => {
|
|
2797
|
+
let t = hn(e.target);
|
|
2798
|
+
if (!t) return this.hide();
|
|
2799
|
+
t !== this.at && (this.at ? this.show(t) : this.soon(t));
|
|
2800
|
+
}), e.addEventListener("pointerout", (e) => {
|
|
2801
|
+
hn(e.relatedTarget) || this.hide();
|
|
2802
|
+
}), e.addEventListener("focusin", (e) => {
|
|
2803
|
+
let t = hn(e.target);
|
|
2804
|
+
t?.matches(":focus-visible") && this.show(t);
|
|
2805
|
+
}), e.addEventListener("focusout", (e) => {
|
|
2806
|
+
e.target === this.at && this.hide();
|
|
2807
|
+
}), e.addEventListener("pointerdown", () => this.hide());
|
|
2808
|
+
}
|
|
2809
|
+
soon(e) {
|
|
2810
|
+
clearTimeout(this.timer), this.timer = window.setTimeout(() => {
|
|
2811
|
+
let t = this.current(e);
|
|
2812
|
+
t && this.show(t);
|
|
2813
|
+
}, 250);
|
|
2814
|
+
}
|
|
2815
|
+
current(e) {
|
|
2816
|
+
if (e.isConnected) return e;
|
|
2817
|
+
let t = e.dataset.tipKey;
|
|
2818
|
+
return t ? this.root.querySelector(`[data-tip-key="${t}"]`) : null;
|
|
2819
|
+
}
|
|
2820
|
+
show(e) {
|
|
2821
|
+
clearTimeout(this.timer), this.at && this.at !== e && this.at.removeAttribute("aria-describedby"), this.at = e;
|
|
2822
|
+
let t = (e.dataset.tipKeys ?? "").split(" ").filter(Boolean), n = e.dataset.tipMore;
|
|
2823
|
+
this.el.replaceChildren(A("span", { class: "tl" }, e.dataset.tip ?? ""), ...t.map((e) => A("kbd", null, e))), n && this.el.append(A("span", { class: "tm" }, n)), n && e.setAttribute("aria-describedby", mn), this.el.hidden = !1, this.place();
|
|
2824
|
+
}
|
|
2825
|
+
place() {
|
|
2826
|
+
let e = this.at;
|
|
2827
|
+
if (!e) return;
|
|
2828
|
+
let t = e.getBoundingClientRect(), n = this.el.offsetWidth, r = this.el.offsetHeight, i = t.top - X - r;
|
|
2829
|
+
i < X && (i = t.bottom + X);
|
|
2830
|
+
let a = Math.max(X, Math.min(t.left + t.width / 2 - n / 2, innerWidth - n - X));
|
|
2831
|
+
this.el.style.left = `${a}px`, this.el.style.top = `${i}px`;
|
|
2832
|
+
}
|
|
2833
|
+
hide() {
|
|
2834
|
+
clearTimeout(this.timer), this.at?.removeAttribute("aria-describedby"), this.at = null, this.el.hidden = !0;
|
|
2835
|
+
}
|
|
2836
|
+
refresh() {
|
|
2837
|
+
let e = this.at;
|
|
2838
|
+
if (!e || e.isConnected) return;
|
|
2839
|
+
let t = this.current(e);
|
|
2840
|
+
t ? this.show(t) : this.hide();
|
|
2841
|
+
}
|
|
2842
|
+
}, _n = /(`[^`\n]+`)/, vn = /(`[^`\n]+`|\*\*(?=\S)(?:`[^`\n]+`|[^`\n])+?(?<=\S)\*\*)/;
|
|
2843
|
+
function yn(e, t, n = !0) {
|
|
2844
|
+
t.split(n ? vn : _n).forEach((t, n) => {
|
|
2845
|
+
if (n % 2 == 0) t && e.append(document.createTextNode(t));
|
|
2846
|
+
else if (t.startsWith("`")) {
|
|
2847
|
+
let n = document.createElement("code");
|
|
2848
|
+
n.textContent = t.slice(1, -1), e.append(n);
|
|
2849
|
+
} else {
|
|
2850
|
+
let n = document.createElement("strong");
|
|
2851
|
+
yn(n, t.slice(2, -2), !1), e.append(n);
|
|
2852
|
+
}
|
|
2853
|
+
});
|
|
2854
|
+
}
|
|
2855
|
+
function bn(e) {
|
|
2856
|
+
let t = document.createDocumentFragment();
|
|
2857
|
+
return e.split(/```[^\n`]*\n?([\s\S]*?)(?:```|$)/).forEach((e, n) => {
|
|
2858
|
+
if (n % 2 == 1) {
|
|
2859
|
+
let n = document.createElement("pre"), r = document.createElement("code");
|
|
2860
|
+
r.textContent = e.replace(/\n$/, ""), n.append(r), t.append(n);
|
|
2861
|
+
} else for (let n of e.split(/\n{2,}/)) {
|
|
2862
|
+
if (!n.trim()) continue;
|
|
2863
|
+
let e = document.createElement("p");
|
|
2864
|
+
yn(e, n.replace(/^\n+|\n+$/g, "")), t.append(e);
|
|
2865
|
+
}
|
|
2866
|
+
}), t;
|
|
2867
|
+
}
|
|
2868
|
+
// src/views.ts
|
|
2869
|
+
function xn(e) {
|
|
2870
|
+
let t = !!e.thread.running, n = e.openTakes().length, i = e.thread.queue?.length ?? 0, a = t ? ` · working${i ? `, ${i} waiting` : ""}` : n ? ` · ${r(n, "take")} to keep or skip` : "";
|
|
2871
|
+
return [A("button", {
|
|
2872
|
+
class: "dock",
|
|
2873
|
+
type: "button",
|
|
2874
|
+
"aria-label": e.open ? "Close Onsite · drag to move" : `Open Onsite${a} · drag to move`,
|
|
2875
|
+
"aria-expanded": String(e.open),
|
|
2876
|
+
"aria-describedby": e.open ? null : Cn,
|
|
2877
|
+
"data-dock": "",
|
|
2878
|
+
on: {
|
|
2879
|
+
click: () => e.dockClick(),
|
|
2880
|
+
contextmenu: (t) => {
|
|
2881
|
+
t.preventDefault(), e.menu.show();
|
|
2882
|
+
},
|
|
2883
|
+
pointerdown: (t) => e.dragStart(t, "dock"),
|
|
2884
|
+
pointerenter: (t) => e.tipSoon(t),
|
|
2885
|
+
pointerleave: () => e.setTip(!1),
|
|
2886
|
+
focus: () => e.tipFocus(),
|
|
2887
|
+
blur: () => e.setTip(!1)
|
|
2888
|
+
}
|
|
2889
|
+
}, j(F(26, 2.8, t)), t && i ? A("span", {
|
|
2890
|
+
class: "badge",
|
|
2891
|
+
"aria-hidden": "true",
|
|
2892
|
+
title: `1 working, ${i} waiting`
|
|
2893
|
+
}, String(i + 1)) : !t && n ? A("span", {
|
|
2894
|
+
class: "badge",
|
|
2895
|
+
"aria-hidden": "true"
|
|
2896
|
+
}, String(n)) : null), Sn(e, "dockmore")];
|
|
2897
|
+
}
|
|
2898
|
+
function Sn(e, t) {
|
|
2899
|
+
return A("button", {
|
|
2900
|
+
class: t,
|
|
2901
|
+
type: "button",
|
|
2902
|
+
"aria-label": "Onsite menu: changes, export, skills, presets, settings",
|
|
2903
|
+
title: t === "dockmore" ? null : "Menu",
|
|
2904
|
+
"aria-haspopup": "menu",
|
|
2905
|
+
"aria-expanded": String(e.menu.open),
|
|
2906
|
+
"data-menu-button": "",
|
|
2907
|
+
...t === "dockmore" ? { "data-dockmore": "" } : {},
|
|
2908
|
+
on: { click: (t) => {
|
|
2909
|
+
t.stopPropagation(), e.menu.toggle();
|
|
2910
|
+
} }
|
|
2911
|
+
}, j(L.dots));
|
|
2912
|
+
}
|
|
2913
|
+
var Cn = "os-tip";
|
|
2914
|
+
function wn() {
|
|
2915
|
+
let e = P(), t = (e) => A("kbd", null, e), n = (e, ...t) => [A("dt", null, e), A("dd", null, ...t)];
|
|
2916
|
+
return A("div", {
|
|
2917
|
+
class: "tip",
|
|
2918
|
+
id: Cn,
|
|
2919
|
+
role: "tooltip",
|
|
2920
|
+
hidden: !0,
|
|
2921
|
+
"data-tip": ""
|
|
2922
|
+
}, A("div", { class: "brand" }, j(F(14, 3.2)), A("span", null, "onsite")), A("dl", null, n("Open", "2×", t(e)), n("Select", j(L.mouse), A("span", { class: "sr" }, "click"), "+", t(e)), n("Changes", "hold", t(e)), n("Comment", "type, then", t(e), "+", t("↵")), n("Menu", "right-click or ⋯"), n("Move", "drag or", t("⇧"), "+", t("arrows"))));
|
|
2923
|
+
}
|
|
2924
|
+
function Tn(e) {
|
|
2925
|
+
let t = e.toast;
|
|
2926
|
+
if (!t) return null;
|
|
2927
|
+
let n = t.undo;
|
|
2928
|
+
return A("div", {
|
|
2929
|
+
class: `toast${n ? "" : " plain"}`,
|
|
2930
|
+
role: "status"
|
|
2931
|
+
}, A("span", null, t.text), n ? A("button", {
|
|
2932
|
+
class: "btn ghost",
|
|
2933
|
+
type: "button",
|
|
2934
|
+
on: { click: () => void e.undo(n) }
|
|
2935
|
+
}, "Undo") : null);
|
|
2936
|
+
}
|
|
2937
|
+
function En(e, t) {
|
|
2938
|
+
return A("aside", {
|
|
2939
|
+
class: `panel scroll${t ? " opening" : ""}`,
|
|
2940
|
+
"aria-label": "Onsite",
|
|
2941
|
+
"data-panel": ""
|
|
2942
|
+
}, Dn(e), e.hidden ? A("div", {
|
|
2943
|
+
class: "hiddenbar",
|
|
2944
|
+
"data-hiddenbar": ""
|
|
2945
|
+
}, j(L.hide), A("span", { class: "grow" }, `The icon is hidden. Double-tap ${P()} opens Onsite.`), A("button", {
|
|
2946
|
+
class: "link",
|
|
2947
|
+
type: "button",
|
|
2948
|
+
on: { click: () => void e.setHidden(!1) }
|
|
2949
|
+
}, "Show icon")) : null, On(e), A("div", {
|
|
2950
|
+
class: "body scroll",
|
|
2951
|
+
id: "os-view",
|
|
2952
|
+
role: "tabpanel",
|
|
2953
|
+
"aria-label": e.tab
|
|
2954
|
+
}, e.tab === "thread" ? Mn(e) : e.tab === "changes" ? In(e) : Rn(e)), Bn(e), Wn(e));
|
|
2955
|
+
}
|
|
2956
|
+
function Dn(e) {
|
|
2957
|
+
let t = (t, n, r) => A("button", {
|
|
2958
|
+
class: "tab",
|
|
2959
|
+
type: "button",
|
|
2960
|
+
role: "tab",
|
|
2961
|
+
"aria-selected": String(e.tab === t),
|
|
2962
|
+
"aria-controls": "os-view",
|
|
2963
|
+
on: { click: () => e.setTab(t) }
|
|
2964
|
+
}, n, r ? A("span", { class: "count" }, r) : null), n = (e.changes?.groups.reduce((e, t) => e + t.files.length, 0) ?? 0) + kn(e).length, r = {
|
|
2965
|
+
auto: "Auto",
|
|
2966
|
+
dark: "Dark",
|
|
2967
|
+
light: "Light"
|
|
2968
|
+
}, i = e.pref === "auto" ? `Auto · ${r[e.pageScheme]}` : r[e.pref];
|
|
2969
|
+
return A("div", {
|
|
2970
|
+
class: "head",
|
|
2971
|
+
"data-head": "",
|
|
2972
|
+
on: { pointerdown: (t) => e.dragStart(t, "head") }
|
|
2973
|
+
}, A("button", {
|
|
2974
|
+
class: "grip",
|
|
2975
|
+
type: "button",
|
|
2976
|
+
"aria-label": "Move Onsite: drag to move, or press Shift and an arrow key",
|
|
2977
|
+
"data-grip": ""
|
|
2978
|
+
}, j(F(18, 3))), A("div", {
|
|
2979
|
+
class: "tabs",
|
|
2980
|
+
role: "tablist",
|
|
2981
|
+
"aria-label": "Onsite views"
|
|
2982
|
+
}, t("thread", "Thread"), t("changes", "Changes", n ? String(n) : ""), t("export", "Export")), A("span", { class: "grow" }), Sn(e, "btn ghost icon"), A("button", {
|
|
2983
|
+
class: "btn ghost scheme",
|
|
2984
|
+
type: "button",
|
|
2985
|
+
"aria-label": `Onsite's scheme: ${r[e.pref]}. Change it`,
|
|
2986
|
+
title: "Auto follows the page. Pin Dark or Light here.",
|
|
2987
|
+
"data-scheme-button": "",
|
|
2988
|
+
on: { click: () => void e.cycleScheme() }
|
|
2989
|
+
}, j(L.scheme), i), A("button", {
|
|
2990
|
+
class: "btn ghost icon",
|
|
2991
|
+
type: "button",
|
|
2992
|
+
"aria-label": "Close Onsite",
|
|
2993
|
+
on: { click: () => e.setOpen(!1) }
|
|
2994
|
+
}, j(L.close)));
|
|
2995
|
+
}
|
|
2996
|
+
function On(e) {
|
|
2997
|
+
let t = P(), n = (e, t, n, r, i, a) => A("button", {
|
|
2998
|
+
class: "btn",
|
|
2999
|
+
type: "button",
|
|
3000
|
+
"aria-pressed": String(e),
|
|
3001
|
+
title: i,
|
|
3002
|
+
on: { click: a }
|
|
3003
|
+
}, j(t), n, A("span", {
|
|
3004
|
+
class: "key",
|
|
3005
|
+
"aria-hidden": "true"
|
|
3006
|
+
}, r));
|
|
3007
|
+
return A("div", { class: "modes" }, n(e.mode === "select", L.select, "Select", t, `Click elements to mention them. ${t}-click works too.`, () => e.setMode(e.mode === "select" ? "idle" : "select")), n(e.alt !== "off", L.alt, "Changes", `hold ${t}`, `Outline what the takes changed. Hold ${t} to peek.`, () => e.toggleAltView()));
|
|
3008
|
+
}
|
|
3009
|
+
var kn = (e) => e.thread.comments.filter((e) => !e.resolved), An = (e, t) => e.thread.comments.findIndex((e) => e.id === t) + 1;
|
|
3010
|
+
function jn(e, t) {
|
|
3011
|
+
return e.drawn.has(t) ? "" : (e.drawn.add(t), " in");
|
|
3012
|
+
}
|
|
3013
|
+
function Mn(e) {
|
|
3014
|
+
let { entries: t } = e.thread;
|
|
3015
|
+
if (!t.length) return A("div", { class: "empty" }, A("p", { class: "lead" }, "Point at the page, then say what to change."), A("p", null, `Hold ${P()} and click elements to mention them. Every change lands as a take you can switch, keep or skip. Nothing reaches your files until you keep it.`));
|
|
3016
|
+
let n = A("div", {
|
|
3017
|
+
class: "thread",
|
|
3018
|
+
role: "log",
|
|
3019
|
+
"aria-label": "Thread"
|
|
3020
|
+
}), r = /* @__PURE__ */ new Map();
|
|
3021
|
+
for (let e of t) e.who !== "person" && r.set(`${e.id}:${e.who}`, e);
|
|
3022
|
+
let i = new Set(t.filter((e) => e.who === "person").map((e) => e.id)), a = e.lastChange();
|
|
3023
|
+
for (let o of t) if (o.who === "person") n.append(Nn(e, o, r.get(`${o.id}:agent`), r.get(`${o.id}:error`)));
|
|
3024
|
+
else if (i.has(o.id)) continue;
|
|
3025
|
+
else o.who === "error" ? n.append(A("div", { class: `system error${jn(e, `x:${o.id}`)}` }, j(L.error), o.text)) : n.append(Fn(e, o, o.id === a));
|
|
3026
|
+
return n;
|
|
3027
|
+
}
|
|
3028
|
+
function Nn(e, t, n, i) {
|
|
3029
|
+
let a = e.thread.running === t.id, o = t.kind === "takes" || (n?.takes?.length ?? 0) > 1, s = t.steps ?? [], f = [...(t.selection ?? []).map((e) => A("span", {
|
|
3030
|
+
class: "chip-dark",
|
|
3031
|
+
title: l(e)
|
|
3032
|
+
}, c(e.src))), ...(t.comments ?? []).map((t) => A("span", { class: "chip-dark" }, `Comment ${An(e, t) || "?"}`))], p = A("div", {
|
|
3033
|
+
class: `turn${jn(e, `t:${t.id}`)}`,
|
|
3034
|
+
"data-run": t.id
|
|
3035
|
+
}, A("div", { class: "ask" }, t.text, f.length ? A("div", { class: "chips" }, f) : null)), m = (n) => A("ul", {
|
|
3036
|
+
class: "steps",
|
|
3037
|
+
"aria-label": "Steps"
|
|
3038
|
+
}, (n ? s : []).map((n, r) => {
|
|
3039
|
+
let i = n.tool === "src_write" || n.tool === "src_edit";
|
|
3040
|
+
return A("li", { class: `step${i ? " write" : ""}${jn(e, `s:${t.id}:${r}`)}` }, j(i ? L.write : n.tool === "src_list" ? L.list : L.read), A("span", null, v(n, o)));
|
|
3041
|
+
}));
|
|
3042
|
+
a && s.length && p.append(m(!0));
|
|
3043
|
+
let h = a ? e.live?.run === t.id ? e.live.text : "" : n?.text ?? "";
|
|
3044
|
+
if (a) p.append(A("p", {
|
|
3045
|
+
class: "reply",
|
|
3046
|
+
"data-live": "",
|
|
3047
|
+
"aria-live": "off"
|
|
3048
|
+
}, h, A("span", {
|
|
3049
|
+
class: "caret",
|
|
3050
|
+
"aria-hidden": "true"
|
|
3051
|
+
})));
|
|
3052
|
+
else if (h) {
|
|
3053
|
+
let e = A("div", { class: "reply" });
|
|
3054
|
+
e.append(bn(h)), p.append(e);
|
|
3055
|
+
}
|
|
3056
|
+
let g = A("div", {
|
|
3057
|
+
class: "status",
|
|
3058
|
+
role: a ? "status" : null
|
|
3059
|
+
}), _ = e.thread.queue?.indexOf(t.id) ?? -1;
|
|
3060
|
+
if (_ >= 0) g.classList.add("queued"), g.append(A("span", {
|
|
3061
|
+
class: "qdot",
|
|
3062
|
+
"aria-hidden": "true"
|
|
3063
|
+
}), A("span", null, d(_)), A("button", {
|
|
3064
|
+
class: "link",
|
|
3065
|
+
type: "button",
|
|
3066
|
+
"data-cancel": t.id,
|
|
3067
|
+
on: { click: () => void e.cancel(t.id) }
|
|
3068
|
+
}, "Cancel"));
|
|
3069
|
+
else if (a) {
|
|
3070
|
+
let t = s.filter((e) => e.take).at(-1)?.take ?? Pn(e);
|
|
3071
|
+
g.append(A("span", {
|
|
3072
|
+
class: "spin",
|
|
3073
|
+
"aria-hidden": "true"
|
|
3074
|
+
}), A("span", null, `Working on ${u(t)}`));
|
|
3075
|
+
} else i ? (g.classList.add("error"), g.append(j(L.error), A("span", null, i.text))) : n?.stopped ? g.append(A("span", {
|
|
3076
|
+
class: "square",
|
|
3077
|
+
"aria-hidden": "true"
|
|
3078
|
+
}), A("span", null, se(n, e.thread.takes))) : n && g.append(j(L.done), A("span", null, oe(n, t, e.thread.takes)));
|
|
3079
|
+
if (!a && s.length) {
|
|
3080
|
+
let n = e.openSteps.has(t.id);
|
|
3081
|
+
g.append(A("button", {
|
|
3082
|
+
class: "link",
|
|
3083
|
+
type: "button",
|
|
3084
|
+
"aria-expanded": String(n),
|
|
3085
|
+
on: { click: () => {
|
|
3086
|
+
n ? e.openSteps.delete(t.id) : e.openSteps.add(t.id), e.render();
|
|
3087
|
+
} }
|
|
3088
|
+
}, r(s.length, "step")));
|
|
3089
|
+
}
|
|
3090
|
+
return g.childNodes.length && p.append(g), !a && e.openSteps.has(t.id) && p.append(m(!0)), p;
|
|
3091
|
+
}
|
|
3092
|
+
function Pn(e) {
|
|
3093
|
+
let t = e.thread.running, n = e.thread.takes.filter((e) => e.of === t);
|
|
3094
|
+
return n.length ? Math.max(...n.map((e) => e.no)) : 1;
|
|
3095
|
+
}
|
|
3096
|
+
function Fn(e, t, n) {
|
|
3097
|
+
let r = t.kind === "undo" ? L.undo : L.keep, i = t.text && !/^(Kept|Skipped|Undone)\.?$/.test(t.text) ? t.text : "";
|
|
3098
|
+
return A("div", { class: `system${jn(e, `c:${t.id}`)}` }, j(r), A("span", null, ce(t)), t.undone ? A("span", null, "· undone") : null, n ? A("button", {
|
|
3099
|
+
class: "link",
|
|
3100
|
+
type: "button",
|
|
3101
|
+
disabled: !!e.busy,
|
|
3102
|
+
on: { click: () => void e.undo(t.id) }
|
|
3103
|
+
}, "Undo") : null, i ? A("span", { class: "muted" }, i) : null);
|
|
3104
|
+
}
|
|
3105
|
+
function In(e) {
|
|
3106
|
+
let t = A("div", { class: "view" }), n = (e.changes?.groups ?? []).filter((e) => e.files.length), r = kn(e);
|
|
3107
|
+
if (!n.length && !r.length) return t.append(A("p", { class: "note" }, "No open takes yet. When a take changes files, they show here by kind, with the takes that touch each one.")), t;
|
|
3108
|
+
for (let r of n) t.append(A("section", { class: "group" }, A("h3", null, le[r.kind]), r.files.map((t) => Ln(e, t))));
|
|
3109
|
+
return r.length && t.append(A("section", { class: "group" }, A("h3", null, "Comments"), r.map((t) => {
|
|
3110
|
+
let n = An(e, t.id), r = e.chosen.includes(t.id), i = t.take ? ` · on ${Z(e, t.take)}` : "";
|
|
3111
|
+
return A("div", { class: "card" }, A("div", { class: "comment" }, A("span", { class: "note-no" }, String(n)), A("div", {
|
|
3112
|
+
class: "line",
|
|
3113
|
+
style: "flex-direction:column;align-items:stretch;gap:4px;flex-grow:1"
|
|
3114
|
+
}, A("span", { class: "text" }, t.text), A("span", { class: "where" }, `${l(t.stamp)}${i}`), A("div", { class: "actions" }, A("button", {
|
|
3115
|
+
class: "link",
|
|
3116
|
+
type: "button",
|
|
3117
|
+
on: { click: () => e.chooseComment(t.id) }
|
|
3118
|
+
}, r ? "Leave out of the ask" : "Add to the ask"), A("button", {
|
|
3119
|
+
class: "link",
|
|
3120
|
+
type: "button",
|
|
3121
|
+
on: { click: () => void e.resolve(t.id, !0) }
|
|
3122
|
+
}, "Resolve")))));
|
|
3123
|
+
}))), t;
|
|
3124
|
+
}
|
|
3125
|
+
function Ln(e, t) {
|
|
3126
|
+
let n = e.openFile === t.path, o = t.takes.reduce((e, t) => Math.max(e, t.added), 0), s = t.takes.reduce((e, t) => Math.max(e, t.removed), 0), c = A("div", { class: "card" }, A("button", {
|
|
3127
|
+
class: "row",
|
|
3128
|
+
type: "button",
|
|
3129
|
+
"aria-expanded": String(n),
|
|
3130
|
+
title: t.path,
|
|
3131
|
+
on: { click: () => e.toggleFile(t.path) }
|
|
3132
|
+
}, A("span", { class: "line" }, A("span", { class: "fname" }, i(t.path)), t.status === "added" ? A("span", { class: "new" }, "new") : null, t.status === "deleted" ? A("span", { class: "del" }, "deleted") : null, A("span", { class: "grow" }), o ? A("span", { class: "add" }, `+${o}`) : null, s ? A("span", { class: "del" }, `−${s}`) : null), A("span", { class: "line" }, A("span", { class: "fdir" }, a(t.path)), A("span", { class: "grow" }), t.takes.map((t) => A("span", { class: "chip" }, Z(e, t.take)))), t.comps.length || t.comments.length ? A("span", { class: "meta" }, [t.comps.length ? t.comps.join(", ") : "", t.comments.length ? r(t.comments.length, "comment") : ""].filter(Boolean).join(" · ")) : null));
|
|
3133
|
+
if (n) {
|
|
3134
|
+
let n = A("div", { class: "actions" }, t.takes.map((n) => {
|
|
3135
|
+
let r = e.diff?.path === t.path && e.diff.take === n.take;
|
|
3136
|
+
return A("button", {
|
|
3137
|
+
class: "btn",
|
|
3138
|
+
type: "button",
|
|
3139
|
+
"aria-pressed": String(r),
|
|
3140
|
+
on: { click: () => void e.openDiff(t.path, n.take) }
|
|
3141
|
+
}, `${Z(e, n.take)} `, A("span", { class: "add" }, `+${n.added}`), A("span", { class: "del" }, `−${n.removed}`));
|
|
3142
|
+
}));
|
|
3143
|
+
c.append(n);
|
|
3144
|
+
let r = e.diff?.path === t.path ? e.diff : null;
|
|
3145
|
+
if (r) {
|
|
3146
|
+
let t = A("pre", {
|
|
3147
|
+
class: "diff scroll",
|
|
3148
|
+
"aria-label": `Diff of ${i(r.path)}`
|
|
3149
|
+
});
|
|
3150
|
+
for (let e of r.diff.split("\n")) {
|
|
3151
|
+
let n = e.startsWith("@@") ? "hunk" : e.startsWith("+") && !e.startsWith("+++") ? "plus" : e.startsWith("-") && !e.startsWith("---") ? "minus" : "";
|
|
3152
|
+
t.append(A("span", n ? { class: n } : null, e || " "));
|
|
3153
|
+
}
|
|
3154
|
+
let n = e.thread.takes.find((e) => e.id === r.take), a = R(e.thread).includes(r.take);
|
|
3155
|
+
c.append(t), n && n.state === "open" && c.append(A("div", { class: "actions" }, A("button", {
|
|
3156
|
+
class: "btn",
|
|
3157
|
+
type: "button",
|
|
3158
|
+
disabled: a || !!e.busy,
|
|
3159
|
+
on: { click: () => void e.show(r.take) }
|
|
3160
|
+
}, a ? `${Z(e, n.id)} shows` : `Show ${Z(e, n.id)}`)));
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
return c;
|
|
3164
|
+
}
|
|
3165
|
+
function Z(e, t) {
|
|
3166
|
+
let n = e.thread.takes.find((e) => e.id === t);
|
|
3167
|
+
if (!n) return "Take";
|
|
3168
|
+
let r = e.thread.entries.filter((e) => e.who === "person").map((e) => e.id);
|
|
3169
|
+
return m(n, e.exportable(), r);
|
|
3170
|
+
}
|
|
3171
|
+
function Rn(e) {
|
|
3172
|
+
let t = e.exportable(), n = e.exportChosen(), r = kn(e), i = e.exportCommentsChosen(), a = A("div", {
|
|
3173
|
+
class: "view",
|
|
3174
|
+
style: "gap:12px"
|
|
3175
|
+
}, A("p", { class: "note" }, "One prompt for your own coding agent: what you asked, the takes as a design reference, your comments, and how to build it properly in this repository."));
|
|
3176
|
+
t.length && a.append(A("div", {
|
|
3177
|
+
class: "seg",
|
|
3178
|
+
role: "group",
|
|
3179
|
+
"aria-label": "Takes to export"
|
|
3180
|
+
}, t.map((t) => A("button", {
|
|
3181
|
+
type: "button",
|
|
3182
|
+
"aria-pressed": String(n.includes(t.id)),
|
|
3183
|
+
title: [t.label, t.state === "kept" ? "kept" : ""].filter(Boolean).join(" · ") || null,
|
|
3184
|
+
on: { click: () => e.toggleExportTake(t.id) }
|
|
3185
|
+
}, `${Z(e, t.id)}${t.state === "kept" ? " · kept" : ""}`)))), r.length && a.append(A("div", {
|
|
3186
|
+
class: "picks",
|
|
3187
|
+
role: "group",
|
|
3188
|
+
"aria-label": "Comments to export"
|
|
3189
|
+
}, r.map((t) => A("label", { class: "check" }, A("input", {
|
|
3190
|
+
type: "checkbox",
|
|
3191
|
+
checked: i.includes(t.id),
|
|
3192
|
+
on: { change: () => e.toggleExportComment(t.id) }
|
|
3193
|
+
}), A("span", null, `${An(e, t.id)}. ${t.text}`)))));
|
|
3194
|
+
let o = e.exportOut?.markdown ?? "";
|
|
3195
|
+
return a.append(A("pre", {
|
|
3196
|
+
class: "prompt scroll",
|
|
3197
|
+
"aria-label": "The prompt",
|
|
3198
|
+
tabindex: 0
|
|
3199
|
+
}, o || "Building the prompt…"), A("div", { class: "buttons" }, A("button", {
|
|
3200
|
+
class: "btn primary grow",
|
|
3201
|
+
type: "button",
|
|
3202
|
+
disabled: !o,
|
|
3203
|
+
on: { click: () => void e.copyExport() }
|
|
3204
|
+
}, e.copied ? "Copied" : "Copy prompt"), A("button", {
|
|
3205
|
+
class: "btn",
|
|
3206
|
+
type: "button",
|
|
3207
|
+
disabled: !o,
|
|
3208
|
+
title: "Download the prompt as a Markdown file",
|
|
3209
|
+
on: { click: () => e.downloadExport() }
|
|
3210
|
+
}, "Save as .md"), A("button", {
|
|
3211
|
+
class: "btn ghost",
|
|
3212
|
+
type: "button",
|
|
3213
|
+
title: "Save the prompt in the project, under .onsite/exports/",
|
|
3214
|
+
on: { click: () => void e.saveExport() }
|
|
3215
|
+
}, "Save to .onsite"))), a;
|
|
3216
|
+
}
|
|
3217
|
+
function zn(e, t, n) {
|
|
3218
|
+
let r = (t) => A("button", {
|
|
3219
|
+
class: "askstep",
|
|
3220
|
+
type: "button",
|
|
3221
|
+
"aria-label": t < 0 ? "Takes of the previous ask" : "Takes of the next ask",
|
|
3222
|
+
title: t < 0 ? "Takes of the previous ask" : "Takes of the next ask",
|
|
3223
|
+
"data-askstep": String(t),
|
|
3224
|
+
on: { click: () => e.stepAsk(t) }
|
|
3225
|
+
}, j(t < 0 ? L.back : L.next));
|
|
3226
|
+
return A("span", { class: "takeof" }, r(-1), A("span", { title: n }, `Ask ${t}`), r(1));
|
|
3227
|
+
}
|
|
3228
|
+
function Bn(e) {
|
|
3229
|
+
let t = e.takeRun();
|
|
3230
|
+
if (!t) return null;
|
|
3231
|
+
let n = e.openTakes(), r = n.filter((e) => e.of === t).sort((e, t) => e.no - t.no), i = new Set(n.map((e) => e.of)).size, a = e.thread.entries.filter((e) => e.who === "person"), o = a.findIndex((e) => e.id === t) + 1, s = {
|
|
3232
|
+
show: (t, n) => void e.show(t, n),
|
|
3233
|
+
toggleOriginal: (t) => e.toggleOriginal(t),
|
|
3234
|
+
keep: (t) => void e.keep(t),
|
|
3235
|
+
skip: (t) => void e.skip(t),
|
|
3236
|
+
hideFrame: (t) => e.hideFrame(t),
|
|
3237
|
+
openFrame: (t) => e.openFrame(t),
|
|
3238
|
+
cancel: (t) => void e.cancel(t),
|
|
3239
|
+
again: (t) => void e.again(t)
|
|
3240
|
+
}, c = A("div", {
|
|
3241
|
+
class: "takebar",
|
|
3242
|
+
role: "group",
|
|
3243
|
+
"aria-label": i > 1 && o ? `Takes of ask ${o}` : "Takes",
|
|
3244
|
+
"aria-busy": e.busy ? "true" : null,
|
|
3245
|
+
"data-takebar": t
|
|
3246
|
+
}, i > 1 && o ? zn(e, o, a[o - 1]?.text ?? "") : null), l = {
|
|
3247
|
+
showing: R(e.thread),
|
|
3248
|
+
picked: e.picked,
|
|
3249
|
+
all: e.thread.takes,
|
|
3250
|
+
asks: a.map((e) => e.id)
|
|
3251
|
+
};
|
|
3252
|
+
if (c.append(Ot(t, r, l, s, `p:${t}`)), t === e.thread.running) for (let e of c.querySelectorAll("[data-frame-skip], [data-frame-keep]")) e.remove();
|
|
3253
|
+
return c;
|
|
3254
|
+
}
|
|
3255
|
+
function Vn(e) {
|
|
3256
|
+
let t = A("button", {
|
|
3257
|
+
class: `ib${e.cls ? ` ${e.cls}` : ""}`,
|
|
3258
|
+
type: "button",
|
|
3259
|
+
"aria-label": e.label,
|
|
3260
|
+
"aria-disabled": e.off ? "true" : null,
|
|
3261
|
+
"aria-keyshortcuts": e.shortcut ?? null,
|
|
3262
|
+
"data-tip": e.label,
|
|
3263
|
+
"data-tip-more": e.more || null,
|
|
3264
|
+
"data-tip-keys": e.keys?.join(" ") || null,
|
|
3265
|
+
"data-tip-key": e.hook,
|
|
3266
|
+
[e.hook]: "",
|
|
3267
|
+
on: { click: () => {
|
|
3268
|
+
t.getAttribute("aria-disabled") !== "true" && e.click();
|
|
3269
|
+
} }
|
|
3270
|
+
}, j(e.icon), e.extra);
|
|
3271
|
+
return t;
|
|
3272
|
+
}
|
|
3273
|
+
function Hn(e) {
|
|
3274
|
+
let t = (e, t, n, r, i) => A("span", {
|
|
3275
|
+
class: "chip",
|
|
3276
|
+
"data-tip": n || null
|
|
3277
|
+
}, j(e), A("span", null, t), A("button", {
|
|
3278
|
+
class: "x",
|
|
3279
|
+
type: "button",
|
|
3280
|
+
"aria-label": r,
|
|
3281
|
+
"data-tip": r,
|
|
3282
|
+
on: { click: i }
|
|
3283
|
+
}, j(L.x)));
|
|
3284
|
+
return [...e.pins.map((n, r) => {
|
|
3285
|
+
let i = n.getAttribute("data-onsite-src") ?? "", a = n.getAttribute("data-onsite-comp") ?? void 0;
|
|
3286
|
+
return t(L.element, `${r + 1} · ${a ?? c(i)}`, l({
|
|
3287
|
+
src: i,
|
|
3288
|
+
comp: a
|
|
3289
|
+
}), `Leave out element ${r + 1}`, () => e.togglePin(n));
|
|
3290
|
+
}), ...e.chosen.map((n) => {
|
|
3291
|
+
let r = An(e, n), i = e.thread.comments.find((e) => e.id === n)?.text ?? "";
|
|
3292
|
+
return t(L.commentChip, `Comment ${r}`, i, `Leave out comment ${r}`, () => e.chooseComment(n));
|
|
3293
|
+
})];
|
|
3294
|
+
}
|
|
3295
|
+
var Un = /* @__PURE__ */ new WeakMap();
|
|
3296
|
+
function Wn(e) {
|
|
3297
|
+
let t = e.basePick(), n = !!e.thread.running, i = e.thread.entries.filter((e) => e.who === "person").map((e) => e.id), a = t ? Z(e, t.take.id) : "", o = (e) => t ? de(t, a, i, e) : "", s = e.pins[0], l = s ? s.getAttribute("data-onsite-comp") ?? c(s.getAttribute("data-onsite-src") ?? "") : "", u = e.textarea;
|
|
3298
|
+
u.value !== e.draft && (u.value = e.draft), u.rows = 1, u.placeholder = e.mode === "select" ? "Click elements to mention them" : t ? `Refine ${a}, or ask for something else` : "Say what to change";
|
|
3299
|
+
let d = e.pins.length > 1 ? ` and ${r(e.pins.length - 1, "more element")}` : "";
|
|
3300
|
+
u.setAttribute("aria-label", s ? `Message to Onsite about ${l}${d}` : "Message to Onsite");
|
|
3301
|
+
let f = lt(), p = e.count, m = Un.has(e) && Un.get(e) !== p;
|
|
3302
|
+
Un.set(e, p);
|
|
3303
|
+
let h = Vn({
|
|
3304
|
+
label: `Takes to make: ${p}`,
|
|
3305
|
+
more: `Click for ${p % 3 + 1}`,
|
|
3306
|
+
icon: L.takes,
|
|
3307
|
+
cls: `takes${m ? " bump" : ""}`,
|
|
3308
|
+
hook: "data-takes",
|
|
3309
|
+
click: () => e.setCount(e.count % 3 + 1),
|
|
3310
|
+
extra: A("b", {
|
|
3311
|
+
class: "tbadge",
|
|
3312
|
+
"aria-hidden": "true"
|
|
3313
|
+
}, `×${p}`)
|
|
3314
|
+
});
|
|
3315
|
+
h.dataset.n = String(p);
|
|
3316
|
+
let g = Vn({
|
|
3317
|
+
label: "Pin as comment",
|
|
3318
|
+
more: s ? e.pins.length > 1 ? `Pins on ${l}, the first selected element. It starts no run.` : `Pins on ${l}. It starts no run.` : "Choose an element to pin a comment on it",
|
|
3319
|
+
keys: f ? ["⌥", "↵"] : ["Alt", "↵"],
|
|
3320
|
+
shortcut: "Alt+Enter",
|
|
3321
|
+
icon: L.pinComment,
|
|
3322
|
+
hook: "data-pin-comment",
|
|
3323
|
+
off: !e.canPin(),
|
|
3324
|
+
click: () => void e.pinComment()
|
|
3325
|
+
}), _ = f ? ["⌘", "↵"] : ["Ctrl", "↵"], ee = n ? Vn({
|
|
3326
|
+
label: "Stop",
|
|
3327
|
+
more: "The takes keep what the agent wrote.",
|
|
3328
|
+
icon: L.stop,
|
|
3329
|
+
cls: "stop",
|
|
3330
|
+
hook: "data-stop",
|
|
3331
|
+
click: () => void e.stop()
|
|
3332
|
+
}) : null, te = Vn(n ? {
|
|
3333
|
+
label: "Queue",
|
|
3334
|
+
more: e.queueFull() ? "3 asks wait already. Send again when one starts." : t ? `Waits its turn, and ${o(!0)}` : "Waits its turn: it starts when the run before it ends",
|
|
3335
|
+
keys: _,
|
|
3336
|
+
shortcut: "Control+Enter Meta+Enter",
|
|
3337
|
+
icon: L.queue,
|
|
3338
|
+
cls: "go",
|
|
3339
|
+
hook: "data-send",
|
|
3340
|
+
off: !e.canSend(),
|
|
3341
|
+
click: () => void e.send()
|
|
3342
|
+
} : {
|
|
3343
|
+
label: "Send",
|
|
3344
|
+
more: o(!1),
|
|
3345
|
+
keys: _,
|
|
3346
|
+
shortcut: "Control+Enter Meta+Enter",
|
|
3347
|
+
icon: L.send,
|
|
3348
|
+
cls: "go",
|
|
3349
|
+
hook: "data-send",
|
|
3350
|
+
off: !e.canSend(),
|
|
3351
|
+
click: () => void e.send()
|
|
3352
|
+
}), ne = A("div", { class: "prow" }, A("label", { class: "field" }, u), A("div", { class: "tools" }, h, g, ee, te)), v = Hn(e), re = e.quick && (e.pins.length > 1 || e.chosen.length > 0), ie = A("div", { class: "pbox" }, !e.quick && v.length ? A("div", { class: "chips" }, v) : null, ne);
|
|
3353
|
+
return A("div", { class: "composer" }, A("div", { class: `pill${re ? " tabbed" : ""}` }, re ? A("div", {
|
|
3354
|
+
class: "ptab",
|
|
3355
|
+
"data-tab": ""
|
|
3356
|
+
}, A("div", { class: "chips" }, v)) : null, ie));
|
|
3357
|
+
}
|
|
3358
|
+
function Gn(e, t) {
|
|
3359
|
+
return A("div", {
|
|
3360
|
+
class: `quick${t ? " opening" : ""}`,
|
|
3361
|
+
role: "dialog",
|
|
3362
|
+
"aria-label": "Quick chat",
|
|
3363
|
+
"data-quick": ""
|
|
3364
|
+
}, Wn(e));
|
|
3365
|
+
}
|
|
3366
|
+
// src/overlay.ts
|
|
3367
|
+
var Kn = "onsite-overlay", qn = 250, Jn = 400, Yn = 150, Xn = 400, Zn = 400, Qn = 200, $n = 560, er = 120;
|
|
3368
|
+
function Q() {
|
|
3369
|
+
let e = document.documentElement;
|
|
3370
|
+
return {
|
|
3371
|
+
w: e?.clientWidth || innerWidth,
|
|
3372
|
+
h: e?.clientHeight || innerHeight
|
|
3373
|
+
};
|
|
3374
|
+
}
|
|
3375
|
+
var tr = {
|
|
3376
|
+
entries: [],
|
|
3377
|
+
takes: [],
|
|
3378
|
+
comments: [],
|
|
3379
|
+
shown: "",
|
|
3380
|
+
showing: [],
|
|
3381
|
+
running: "",
|
|
3382
|
+
seq: 0
|
|
3383
|
+
}, $ = {
|
|
3384
|
+
get(e) {
|
|
3385
|
+
try {
|
|
3386
|
+
return sessionStorage.getItem(`onsite:${e}`);
|
|
3387
|
+
} catch {
|
|
3388
|
+
return null;
|
|
3389
|
+
}
|
|
3390
|
+
},
|
|
3391
|
+
set(e, t) {
|
|
3392
|
+
try {
|
|
3393
|
+
t === null ? sessionStorage.removeItem(`onsite:${e}`) : sessionStorage.setItem(`onsite:${e}`, t);
|
|
3394
|
+
} catch {}
|
|
3395
|
+
}
|
|
3396
|
+
}, nr = {
|
|
3397
|
+
get(e) {
|
|
3398
|
+
try {
|
|
3399
|
+
return localStorage.getItem(`onsite:${e}`);
|
|
3400
|
+
} catch {
|
|
3401
|
+
return null;
|
|
3402
|
+
}
|
|
3403
|
+
},
|
|
3404
|
+
set(e, t) {
|
|
3405
|
+
try {
|
|
3406
|
+
localStorage.setItem(`onsite:${e}`, t);
|
|
3407
|
+
} catch {}
|
|
3408
|
+
}
|
|
3409
|
+
}, rr = class {
|
|
3410
|
+
host;
|
|
3411
|
+
shadow;
|
|
3412
|
+
ui;
|
|
3413
|
+
layer;
|
|
3414
|
+
client;
|
|
3415
|
+
conn = null;
|
|
3416
|
+
thread = tr;
|
|
3417
|
+
live = null;
|
|
3418
|
+
pref = "auto";
|
|
3419
|
+
pageScheme = "light";
|
|
3420
|
+
changes = null;
|
|
3421
|
+
hidden = !1;
|
|
3422
|
+
model = void 0;
|
|
3423
|
+
takes = 1;
|
|
3424
|
+
open = $.get("open") === "1";
|
|
3425
|
+
tab = $.get("tab") ?? "thread";
|
|
3426
|
+
mode = "idle";
|
|
3427
|
+
pins = [];
|
|
3428
|
+
quick = !1;
|
|
3429
|
+
chosen = [];
|
|
3430
|
+
openComment = "";
|
|
3431
|
+
draft = "";
|
|
3432
|
+
count = 1;
|
|
3433
|
+
busy = "";
|
|
3434
|
+
openSteps = /* @__PURE__ */ new Set();
|
|
3435
|
+
openFile = "";
|
|
3436
|
+
diff = null;
|
|
3437
|
+
exportTakes = null;
|
|
3438
|
+
exportComments = null;
|
|
3439
|
+
exportOut = null;
|
|
3440
|
+
copied = !1;
|
|
3441
|
+
toast = null;
|
|
3442
|
+
saved = Je($.get("dock"));
|
|
3443
|
+
anchor = this.saved;
|
|
3444
|
+
tip = !1;
|
|
3445
|
+
drag = null;
|
|
3446
|
+
hover = null;
|
|
3447
|
+
hoverBase = null;
|
|
3448
|
+
climbed = [];
|
|
3449
|
+
alt = "off";
|
|
3450
|
+
altMarks = null;
|
|
3451
|
+
altMenu = "";
|
|
3452
|
+
frameMarks = null;
|
|
3453
|
+
liveMarks = /* @__PURE__ */ new Map();
|
|
3454
|
+
hiddenFrames = new Set(sr($.get("hidden-frames")));
|
|
3455
|
+
chosenBar = void 0;
|
|
3456
|
+
picked = /* @__PURE__ */ new Map();
|
|
3457
|
+
lastRun = "";
|
|
3458
|
+
barAsk = "";
|
|
3459
|
+
beforeOriginal = null;
|
|
3460
|
+
drawn = /* @__PURE__ */ new Set();
|
|
3461
|
+
textarea;
|
|
3462
|
+
mover;
|
|
3463
|
+
hint;
|
|
3464
|
+
extras;
|
|
3465
|
+
tipEl;
|
|
3466
|
+
menu;
|
|
3467
|
+
quickBox;
|
|
3468
|
+
iconTip;
|
|
3469
|
+
question;
|
|
3470
|
+
stateSeen = !1;
|
|
3471
|
+
wasOpen = !1;
|
|
3472
|
+
quickWas = !1;
|
|
3473
|
+
tipTimer = 0;
|
|
3474
|
+
resizeTimer = 0;
|
|
3475
|
+
snapTimer = 0;
|
|
3476
|
+
stale = !1;
|
|
3477
|
+
checkLater = !1;
|
|
3478
|
+
noClick = !1;
|
|
3479
|
+
refocusing = !1;
|
|
3480
|
+
altTimer = 0;
|
|
3481
|
+
altAlone = !1;
|
|
3482
|
+
altDownAt = 0;
|
|
3483
|
+
lastTapAt = 0;
|
|
3484
|
+
toastTimer = 0;
|
|
3485
|
+
copyTimer = 0;
|
|
3486
|
+
changesTimer = 0;
|
|
3487
|
+
exportTimer = 0;
|
|
3488
|
+
frameTimer = 0;
|
|
3489
|
+
stopScheme = () => {};
|
|
3490
|
+
recheckScheme = () => {};
|
|
3491
|
+
update = null;
|
|
3492
|
+
flashes = Promise.resolve();
|
|
3493
|
+
updateWait;
|
|
3494
|
+
cleanups = [];
|
|
3495
|
+
constructor(e = {}) {
|
|
3496
|
+
this.client = e.client ?? pe(), this.updateWait = e.updateWait ?? 1e3, this.host = document.createElement(Kn), this.host.setAttribute("data-onsite-overlay", ""), this.host.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;margin:0;padding:0;border:0;z-index:2147483647;display:block;", this.shadow = this.host.attachShadow({ mode: "open" }), this.shadow.append(A("style", null, Lt)), this.layer = new Ht(this.host, () => this.layerState(), {
|
|
3497
|
+
show: (e, t) => this.show(e, t),
|
|
3498
|
+
hideTakes: (e) => void this.hideTakes(e),
|
|
3499
|
+
toggleAltMenu: (e) => {
|
|
3500
|
+
this.altMenu = this.altMenu === e ? "" : e, this.layer.draw(), this.altMenu ? this.avoid() : this.goBack();
|
|
3501
|
+
},
|
|
3502
|
+
openComment: (e) => {
|
|
3503
|
+
this.openComment = e, this.layer.draw();
|
|
3504
|
+
},
|
|
3505
|
+
resolve: (e) => void this.resolve(e, !0),
|
|
3506
|
+
chooseComment: (e) => this.chooseComment(e),
|
|
3507
|
+
altKeyName: P,
|
|
3508
|
+
keep: (e) => void this.keep(e),
|
|
3509
|
+
skip: (e) => void this.skip(e),
|
|
3510
|
+
toggleOriginal: (e) => this.toggleOriginal(e),
|
|
3511
|
+
cancel: (e) => void this.cancel(e),
|
|
3512
|
+
again: (e) => void this.again(e),
|
|
3513
|
+
hideFrame: (e) => this.hideFrame(e),
|
|
3514
|
+
openFrame: (e) => this.openFrame(e),
|
|
3515
|
+
framesChanged: () => queueMicrotask(() => this.avoid()),
|
|
3516
|
+
positioned: () => this.placeQuick()
|
|
3517
|
+
}), this.ui = A("div", {
|
|
3518
|
+
class: "ui",
|
|
3519
|
+
"data-layer": "ui"
|
|
3520
|
+
}), this.mover = A("div", {
|
|
3521
|
+
class: "mover",
|
|
3522
|
+
"data-mover": ""
|
|
3523
|
+
}), this.quickBox = A("div", { "data-quickbox": "" }), this.hint = A("div", {
|
|
3524
|
+
class: "snaphint",
|
|
3525
|
+
hidden: !0,
|
|
3526
|
+
"aria-hidden": "true",
|
|
3527
|
+
"data-snaphint": ""
|
|
3528
|
+
}), this.extras = A("div", null), this.tipEl = wn(), this.menu = new qt(this), this.question = new en(this.shadow, Q), this.iconTip = new gn(this.ui), this.ui.append(this.quickBox, this.mover, this.hint, this.menu.el, this.extras, this.question.el, this.iconTip.el), this.shadow.append(this.layer.root, this.ui), this.textarea = A("textarea", { rows: 1 }), this.textarea.addEventListener("input", () => {
|
|
3529
|
+
this.draft = this.textarea.value, this.renderComposerState(), this.fitText(), this.quick && this.placeQuick();
|
|
3530
|
+
}), this.textarea.addEventListener("keydown", (e) => {
|
|
3531
|
+
e.key === "Enter" && (e.metaKey || e.ctrlKey ? (e.preventDefault(), this.quick && e.shiftKey ? this.expandQuick() : this.send()) : e.altKey && (e.preventDefault(), this.dropAltView(), this.pinComment()));
|
|
3532
|
+
}), (document.documentElement ?? document.body).append(this.host);
|
|
3533
|
+
let t = un({
|
|
3534
|
+
doc: document,
|
|
3535
|
+
host: this.host,
|
|
3536
|
+
point: () => Xe(this.anchor, Q())
|
|
3537
|
+
}, (e) => {
|
|
3538
|
+
this.pageScheme = e, this.render();
|
|
3539
|
+
});
|
|
3540
|
+
this.pageScheme = t.scheme, this.stopScheme = t.stop, this.recheckScheme = t.recheck, this.listen(), this.render(), this.start(e.hot === void 0 ? me() : e.hot);
|
|
3541
|
+
}
|
|
3542
|
+
async start(e) {
|
|
3543
|
+
let t = await e;
|
|
3544
|
+
this.conn = ge(this.client, t, {
|
|
3545
|
+
state: (e) => this.onState(e),
|
|
3546
|
+
text: (e) => {
|
|
3547
|
+
e.run === this.thread.running && (this.live = {
|
|
3548
|
+
run: e.run,
|
|
3549
|
+
text: e.text
|
|
3550
|
+
}, this.renderLive());
|
|
3551
|
+
},
|
|
3552
|
+
flash: (e) => this.onFlash(e),
|
|
3553
|
+
afterUpdate: () => this.afterUpdate(),
|
|
3554
|
+
error: (e) => this.showToast(`Onsite did not answer: ${e.message}`)
|
|
3555
|
+
});
|
|
3556
|
+
try {
|
|
3557
|
+
let e = await this.client.call("GET prefs", {});
|
|
3558
|
+
this.pref = e.scheme, this.hidden = e.hidden === !0, this.model = e.model || void 0, this.takes = or(e.takes), this.count === 1 && (this.count = this.takes);
|
|
3559
|
+
let t = Je(e.dock);
|
|
3560
|
+
if (t !== this.saved && !this.drag) {
|
|
3561
|
+
let e = this.anchor !== this.saved;
|
|
3562
|
+
this.saved = t, $.set("dock", t), e || (this.anchor = t);
|
|
3563
|
+
}
|
|
3564
|
+
this.render(), this.recheckScheme();
|
|
3565
|
+
} catch {}
|
|
3566
|
+
}
|
|
3567
|
+
refresh() {
|
|
3568
|
+
return this.conn?.refresh() ?? Promise.resolve();
|
|
3569
|
+
}
|
|
3570
|
+
onState(e) {
|
|
3571
|
+
let t = this.thread;
|
|
3572
|
+
this.thread = e, this.sayStale(t, e);
|
|
3573
|
+
for (let t of R(e)) {
|
|
3574
|
+
let n = e.takes.find((e) => e.id === t);
|
|
3575
|
+
n && this.picked.set(n.of, n.id);
|
|
3576
|
+
}
|
|
3577
|
+
let n = e.takes.find((t) => t.id === e.shown);
|
|
3578
|
+
e.shown !== t.shown && (this.barAsk = ""), n && (this.lastRun = n.of), e.running ? e.live?.run === e.running && (this.live?.run !== e.running || e.live.text.length >= this.live.text.length) ? this.live = {
|
|
3579
|
+
run: e.running,
|
|
3580
|
+
text: e.live.text
|
|
3581
|
+
} : this.live && this.live.run !== e.running && (this.live = null) : this.live = null, this.chosen = this.chosen.filter((t) => e.comments.some((e) => e.id === t && !e.resolved)), this.openComment && !e.comments.some((e) => e.id === this.openComment && !e.resolved) && (this.openComment = "");
|
|
3582
|
+
let r = t.shown !== e.shown || R(t).join(" ") !== R(e).join(" ") || JSON.stringify(t.takes.map(ir)) !== JSON.stringify(e.takes.map(ir));
|
|
3583
|
+
r && this.alt !== "off" && this.loadMarks(), r && (this.diff = null), e.running && e.running !== t.running && (this.chosenBar = void 0), (r || e.running !== t.running || ar(e) !== ar(t)) && this.loadFrameMarksSoon(), this.render(), this.loadChangesSoon(), this.open && this.tab === "export" && this.loadExportSoon();
|
|
3584
|
+
}
|
|
3585
|
+
sayStale(e, t) {
|
|
3586
|
+
let n = this.stateSeen ? R(e) : ($.get("shown") ?? "").split(" ").filter(Boolean);
|
|
3587
|
+
this.stateSeen = !0;
|
|
3588
|
+
let r = R(t);
|
|
3589
|
+
if ($.set("shown", r.join(" ") || null), this.busy === "show") return;
|
|
3590
|
+
let i = n.filter((e) => !r.includes(e)), a = t.takes.find((e) => i.includes(e.id) && e.state === "open" && e.stale?.length);
|
|
3591
|
+
a && this.showToast(ne(a));
|
|
3592
|
+
}
|
|
3593
|
+
onFlash(e) {
|
|
3594
|
+
let t = this.thread.takes.find((t) => t.id === e.take)?.of ?? (this.thread.running && mt(this.thread.running, this.thread.takes, e.take) ? this.thread.running : "");
|
|
3595
|
+
if (t) {
|
|
3596
|
+
let n = this.liveMarks.get(t) ?? {
|
|
3597
|
+
stamps: [],
|
|
3598
|
+
selectors: []
|
|
3599
|
+
};
|
|
3600
|
+
z(n, e.marks), this.liveMarks.set(t, n);
|
|
3601
|
+
}
|
|
3602
|
+
let n = this.waitUpdate();
|
|
3603
|
+
this.flashes = this.flashes.then(async () => {
|
|
3604
|
+
await n, await ct(60), await M(), await M(), this.layer.draw(), this.layer.flash(e.marks) === 0 && (await ct(250), this.layer.flash(e.marks));
|
|
3605
|
+
}).catch(() => void 0);
|
|
3606
|
+
}
|
|
3607
|
+
waitUpdate() {
|
|
3608
|
+
if (!this.update) {
|
|
3609
|
+
let e = () => {}, t = new Promise((t) => {
|
|
3610
|
+
e = t;
|
|
3611
|
+
});
|
|
3612
|
+
this.update = {
|
|
3613
|
+
promise: t,
|
|
3614
|
+
done: e
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3617
|
+
let e = this.update.promise;
|
|
3618
|
+
return Promise.race([e, ct(this.updateWait)]);
|
|
3619
|
+
}
|
|
3620
|
+
afterUpdate() {
|
|
3621
|
+
this.update?.done(), this.update = null, this.recheckScheme(), this.layer.draw(), this.alt !== "off" && this.loadMarks(), this.loadFrameMarksSoon();
|
|
3622
|
+
}
|
|
3623
|
+
isOurs(e) {
|
|
3624
|
+
return e.composedPath().includes(this.host);
|
|
3625
|
+
}
|
|
3626
|
+
listen() {
|
|
3627
|
+
let e = (e, t, n = { capture: !0 }) => {
|
|
3628
|
+
addEventListener(e, t, n), this.cleanups.push(() => removeEventListener(e, t, n));
|
|
3629
|
+
};
|
|
3630
|
+
e("mousemove", (e) => this.onMove(e), {
|
|
3631
|
+
capture: !0,
|
|
3632
|
+
passive: !0
|
|
3633
|
+
}), e("pointerdown", (e) => this.onDown(e)), e("mousedown", (e) => this.onDown(e)), e("click", (e) => this.onClick(e)), e("keydown", (e) => this.onKey(e)), e("keyup", (e) => this.onKeyUp(e)), e("blur", () => this.altUp(), { capture: !1 }), e("scroll", () => this.layer.schedule(), {
|
|
3634
|
+
capture: !0,
|
|
3635
|
+
passive: !0
|
|
3636
|
+
}), e("resize", () => {
|
|
3637
|
+
this.place(), this.layer.schedule(), this.recheckScheme(), clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => this.avoid(), Qn);
|
|
3638
|
+
});
|
|
3639
|
+
let t = new MutationObserver(() => this.layer.schedule());
|
|
3640
|
+
document.body && t.observe(document.body, {
|
|
3641
|
+
subtree: !0,
|
|
3642
|
+
childList: !0,
|
|
3643
|
+
attributes: !0,
|
|
3644
|
+
characterData: !0
|
|
3645
|
+
}), this.cleanups.push(() => t.disconnect());
|
|
3646
|
+
let n = setInterval(() => {
|
|
3647
|
+
this.layer.busy() && this.layer.schedule();
|
|
3648
|
+
}, 500);
|
|
3649
|
+
this.cleanups.push(() => clearInterval(n));
|
|
3650
|
+
}
|
|
3651
|
+
picking(e) {
|
|
3652
|
+
return this.mode !== "idle" || e.altKey;
|
|
3653
|
+
}
|
|
3654
|
+
onMove(e) {
|
|
3655
|
+
if (this.isOurs(e)) return;
|
|
3656
|
+
let t = this.picking(e) ? q(e.target) : null;
|
|
3657
|
+
t && t === this.hoverBase && this.hover || (this.hoverBase = t, this.climbed = [], t !== this.hover && (this.hover = t, this.layer.draw()));
|
|
3658
|
+
}
|
|
3659
|
+
climb(e) {
|
|
3660
|
+
if (e.key !== "ArrowUp" && e.key !== "ArrowDown" || !this.hover?.isConnected || e.metaKey || e.ctrlKey || e.shiftKey || !e.altKey && (this.mode === "idle" || this.typing())) return !1;
|
|
3661
|
+
let t;
|
|
3662
|
+
return e.key === "ArrowUp" ? (t = Bt(this.hover), t && this.climbed.push(this.hover)) : t = this.climbed.pop() ?? Vt(this.hover), t && (this.hover = t, this.layer.draw()), !0;
|
|
3663
|
+
}
|
|
3664
|
+
typing() {
|
|
3665
|
+
let e = this.activeInside();
|
|
3666
|
+
return e instanceof HTMLElement && (e.isContentEditable || e.matches("input, textarea, select"));
|
|
3667
|
+
}
|
|
3668
|
+
onDown(e) {
|
|
3669
|
+
this.menu.open && !e.composedPath().some((e) => e === this.menu.el || e instanceof Element && e.matches("[data-dock], [data-menu-button]")) && this.menu.close(), !this.isOurs(e) && this.picking(e) && q(e.target) && (e.preventDefault(), e.stopPropagation());
|
|
3670
|
+
}
|
|
3671
|
+
onClick(e) {
|
|
3672
|
+
if (this.isOurs(e)) return;
|
|
3673
|
+
if (this.openComment && (this.openComment = "", this.layer.draw()), this.quick && !this.picking(e)) return this.closeQuick();
|
|
3674
|
+
if (!this.picking(e)) return;
|
|
3675
|
+
let t = q(e.target), n = t && t === this.hoverBase && this.hover?.isConnected ? this.hover : t;
|
|
3676
|
+
n && (e.preventDefault(), e.stopPropagation(), this.altAlone = !1, this.togglePin(n));
|
|
3677
|
+
}
|
|
3678
|
+
togglePin(e) {
|
|
3679
|
+
let t = this.pins.indexOf(e);
|
|
3680
|
+
t >= 0 ? this.pins.splice(t, 1) : this.pins.push(e), this.open || (this.quick = this.pins.length > 0, this.setTip(!1), this.menu.close()), this.render(), this.quick && this.textarea.focus({ preventScroll: !0 }), t < 0 && this.avoid();
|
|
3681
|
+
}
|
|
3682
|
+
closeQuick() {
|
|
3683
|
+
this.quick && (this.quick = !1, this.pins = [], this.hover = null, this.render());
|
|
3684
|
+
}
|
|
3685
|
+
expandQuick() {
|
|
3686
|
+
this.quick = !1, this.setOpen(!0);
|
|
3687
|
+
}
|
|
3688
|
+
placeQuick() {
|
|
3689
|
+
let e = this.quickBox.firstElementChild;
|
|
3690
|
+
if (!e) return;
|
|
3691
|
+
let t = this.pins[0], n = t?.isConnected ? t.getBoundingClientRect() : null, r = Q();
|
|
3692
|
+
if (e.style.width = `${Yt(r)}px`, !n || n.width === 0 && n.height === 0 && Ut()) {
|
|
3693
|
+
e.style.visibility = "hidden";
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
e.style.visibility = "";
|
|
3697
|
+
let i = e.querySelector("[data-tab]"), a = Zt({
|
|
3698
|
+
left: n.left - 4,
|
|
3699
|
+
top: n.top - 4,
|
|
3700
|
+
width: n.width + 8,
|
|
3701
|
+
height: n.height + 8
|
|
3702
|
+
}, {
|
|
3703
|
+
w: e.offsetWidth || Yt(r),
|
|
3704
|
+
h: e.offsetHeight || 80,
|
|
3705
|
+
tab: i ? {
|
|
3706
|
+
w: i.offsetWidth,
|
|
3707
|
+
h: i.offsetHeight
|
|
3708
|
+
} : void 0
|
|
3709
|
+
}, r);
|
|
3710
|
+
e.style.left = `${a.left}px`, e.style.top = `${a.top}px`, e.style.setProperty("--tab-x", `${a.tabX}px`), e.dataset.side = a.side;
|
|
3711
|
+
}
|
|
3712
|
+
fitText() {
|
|
3713
|
+
let e = this.textarea;
|
|
3714
|
+
if (!e.isConnected) return;
|
|
3715
|
+
e.style.height = "auto";
|
|
3716
|
+
let t = e.scrollHeight;
|
|
3717
|
+
e.style.height = t > 0 ? `${Math.min(t, er)}px` : "";
|
|
3718
|
+
}
|
|
3719
|
+
activeInside() {
|
|
3720
|
+
let e = document.activeElement;
|
|
3721
|
+
for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
|
|
3722
|
+
return e;
|
|
3723
|
+
}
|
|
3724
|
+
onKey(e) {
|
|
3725
|
+
if (this.question.key(e)) e.preventDefault(), e.stopPropagation();
|
|
3726
|
+
else if (!e.altKey && !e.metaKey && !e.ctrlKey && this.menu.key(e)) e.preventDefault(), e.stopPropagation();
|
|
3727
|
+
else if (!e.altKey && !e.metaKey && !e.ctrlKey && this.isOurs(e) && this.layer.frameKey(e)) e.preventDefault(), e.stopPropagation();
|
|
3728
|
+
else if (e.key === "Alt") {
|
|
3729
|
+
if (!e.repeat) {
|
|
3730
|
+
this.altAlone = !0, this.altDownAt = performance.now(), clearTimeout(this.altTimer);
|
|
3731
|
+
let e = this.activeInside() === this.textarea ? Xn : Yn;
|
|
3732
|
+
this.altTimer = window.setTimeout(() => this.altDown(), e);
|
|
3733
|
+
}
|
|
3734
|
+
} else if (e.altKey && (this.altAlone = !1, this.alt !== "held" && (clearTimeout(this.altTimer), this.altTimer = 0)), (!this.isOurs(e) || e.altKey) && this.climb(e)) e.preventDefault(), e.stopPropagation();
|
|
3735
|
+
else if (e.shiftKey && !e.altKey && !e.metaKey && !e.ctrlKey && e.key.startsWith("Arrow") && this.onHandle()) {
|
|
3736
|
+
if (e.preventDefault(), this.drag) return;
|
|
3737
|
+
this.setTip(!1), this.snapTo(et(this.anchor, e.key), "person");
|
|
3738
|
+
} else if (e.key === "Escape" && this.drag) this.endDrag(!0);
|
|
3739
|
+
else if (e.key === "Escape" && this.tip) this.setTip(!1);
|
|
3740
|
+
else if (e.key === "Escape") {
|
|
3741
|
+
if (this.openComment) this.openComment = "";
|
|
3742
|
+
else if (this.altMenu) this.altMenu = "";
|
|
3743
|
+
else if (this.mode !== "idle") this.setMode("idle");
|
|
3744
|
+
else if (this.quick) this.quick = !1, this.pins = [], this.hover = null;
|
|
3745
|
+
else if (this.open && this.isOurs(e)) this.setOpen(!1);
|
|
3746
|
+
else return;
|
|
3747
|
+
this.render();
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
onKeyUp(e) {
|
|
3751
|
+
if (e.key !== "Alt") return;
|
|
3752
|
+
this.altAlone && e.preventDefault();
|
|
3753
|
+
let t = this.altAlone && performance.now() - this.altDownAt < qn;
|
|
3754
|
+
if (this.altAlone = !1, this.altUp(), !t) {
|
|
3755
|
+
this.lastTapAt = 0;
|
|
3756
|
+
return;
|
|
3757
|
+
}
|
|
3758
|
+
let n = performance.now();
|
|
3759
|
+
this.lastTapAt && n - this.lastTapAt < Jn ? (this.lastTapAt = 0, this.setOpen(!this.open)) : this.lastTapAt = n;
|
|
3760
|
+
}
|
|
3761
|
+
altDown() {
|
|
3762
|
+
this.altTimer = 0, this.alt === "off" && (this.alt = "held", this.altMenu = "", this.loadMarks(), this.render());
|
|
3763
|
+
}
|
|
3764
|
+
altUp() {
|
|
3765
|
+
clearTimeout(this.altTimer), this.altTimer = 0, this.hover && this.mode === "idle" && (this.hover = null), this.alt === "held" && (this.alt = "off", this.altMarks = null, this.altMenu = ""), this.render();
|
|
3766
|
+
}
|
|
3767
|
+
dropAltView() {
|
|
3768
|
+
clearTimeout(this.altTimer), this.altTimer = 0, this.alt === "held" && (this.alt = "off", this.altMarks = null, this.altMenu = "", this.render());
|
|
3769
|
+
}
|
|
3770
|
+
toggleAltView() {
|
|
3771
|
+
this.alt === "pinned" ? (this.alt = "off", this.altMarks = null, this.altMenu = "") : (this.alt = "pinned", this.loadMarks()), this.render();
|
|
3772
|
+
}
|
|
3773
|
+
async loadMarks() {
|
|
3774
|
+
try {
|
|
3775
|
+
let e = await this.client.call("GET marks", {});
|
|
3776
|
+
if (this.alt === "off") return;
|
|
3777
|
+
await M(), this.altMarks = e, this.layer.draw();
|
|
3778
|
+
} catch {}
|
|
3779
|
+
}
|
|
3780
|
+
frames() {
|
|
3781
|
+
return ft(this.thread, this.hiddenFrames);
|
|
3782
|
+
}
|
|
3783
|
+
loadFrameMarksSoon(e = 120) {
|
|
3784
|
+
clearTimeout(this.frameTimer), this.frameTimer = window.setTimeout(async () => {
|
|
3785
|
+
if (this.frames().length === 0) this.frameMarks = null;
|
|
3786
|
+
else try {
|
|
3787
|
+
let e = await this.client.call("GET marks", {});
|
|
3788
|
+
await M(), this.frameMarks = e, this.layer.draw();
|
|
3789
|
+
} catch {}
|
|
3790
|
+
}, e);
|
|
3791
|
+
}
|
|
3792
|
+
hideFrame(e) {
|
|
3793
|
+
this.hiddenFrames.add(e), $.set("hidden-frames", JSON.stringify([...this.hiddenFrames])), this.render();
|
|
3794
|
+
}
|
|
3795
|
+
openFrame(e) {
|
|
3796
|
+
this.chosenBar = e, this.layer.draw(), e && this.layer.root.querySelector(`[data-framebar="${CSS.escape(e)}"]`)?.focus({ preventScroll: !0 });
|
|
3797
|
+
}
|
|
3798
|
+
async savePrefs(e) {
|
|
3799
|
+
let t = await this.client.call("POST prefs", e);
|
|
3800
|
+
return this.pref = t.scheme, this.hidden = t.hidden === !0, this.model = t.model || void 0, this.takes = or(t.takes), t;
|
|
3801
|
+
}
|
|
3802
|
+
async setHidden(e) {
|
|
3803
|
+
let t = this.hidden;
|
|
3804
|
+
this.hidden = e, this.setTip(!1), this.render();
|
|
3805
|
+
try {
|
|
3806
|
+
await this.savePrefs({ hidden: e || null }), e && !nr.get("hid-once") && (nr.set("hid-once", "1"), this.showToast(`The Onsite icon is hidden. Double-tap ${P()} to open Onsite, then choose Show icon.`));
|
|
3807
|
+
} catch (n) {
|
|
3808
|
+
this.hidden = t, this.showToast(`Could not ${e ? "hide" : "show"} the icon: ${n.message}`);
|
|
3809
|
+
}
|
|
3810
|
+
this.render();
|
|
3811
|
+
}
|
|
3812
|
+
async setScheme(e) {
|
|
3813
|
+
this.pref = e, this.render();
|
|
3814
|
+
try {
|
|
3815
|
+
await this.savePrefs({ scheme: e }), this.render();
|
|
3816
|
+
} catch (e) {
|
|
3817
|
+
this.showToast(`Could not keep the scheme: ${e.message}`);
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3820
|
+
moveDock(e) {
|
|
3821
|
+
this.snapTo(e, "person");
|
|
3822
|
+
}
|
|
3823
|
+
focusDock() {
|
|
3824
|
+
this.mover.querySelector("[data-dock], [data-menu-button]")?.focus({ preventScroll: !0 });
|
|
3825
|
+
}
|
|
3826
|
+
setOpen(e) {
|
|
3827
|
+
this.open = e, $.set("open", e ? "1" : null), e && this.setTip(!1), e && this.menu.close(), e && (this.quick = !1), e || (this.mode = "idle", this.alt === "pinned" && (this.alt = "off", this.altMarks = null)), this.render(), e && (this.loadChangesSoon(), queueMicrotask(() => this.textarea.focus()), this.avoid());
|
|
3828
|
+
}
|
|
3829
|
+
dockClick() {
|
|
3830
|
+
if (this.noClick) this.noClick = !1;
|
|
3831
|
+
else {
|
|
3832
|
+
if (this.menu.open) return this.menu.close();
|
|
3833
|
+
this.setOpen(!this.open);
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
onHandle() {
|
|
3837
|
+
let e = this.activeInside();
|
|
3838
|
+
return !!(e && this.shadow.contains(e) && (e.matches(".dock") || e.closest(".head")));
|
|
3839
|
+
}
|
|
3840
|
+
dragStart(e, t) {
|
|
3841
|
+
if (e.button !== 0 || this.drag || t === "head" && e.target?.closest?.("button:not(.grip), input, textarea, select, a, label, [role=tab]")) return;
|
|
3842
|
+
let n = e.currentTarget;
|
|
3843
|
+
this.noClick = !1;
|
|
3844
|
+
try {
|
|
3845
|
+
n.setPointerCapture(e.pointerId);
|
|
3846
|
+
} catch {}
|
|
3847
|
+
this.drag = {
|
|
3848
|
+
pointer: e.pointerId,
|
|
3849
|
+
el: n,
|
|
3850
|
+
from: t,
|
|
3851
|
+
x: e.clientX,
|
|
3852
|
+
y: e.clientY,
|
|
3853
|
+
moved: !1,
|
|
3854
|
+
target: this.anchor
|
|
3855
|
+
}, n.addEventListener("pointermove", this.onDragMove), n.addEventListener("pointerup", this.onDragUp), n.addEventListener("pointercancel", this.onDragCancel), n.addEventListener("lostpointercapture", this.onDragCancel);
|
|
3856
|
+
}
|
|
3857
|
+
onDragMove = (e) => {
|
|
3858
|
+
let t = this.drag;
|
|
3859
|
+
if (!t || e.pointerId !== t.pointer) return;
|
|
3860
|
+
let n = e.clientX - t.x, r = e.clientY - t.y;
|
|
3861
|
+
if (!t.moved && Math.hypot(n, r) < 4) return;
|
|
3862
|
+
t.moved || (t.moved = !0, this.setTip(!1), this.menu.close(), this.mover.classList.add("dragging")), e.preventDefault(), this.mover.style.transform = `translate(${n}px, ${r}px)`, t.target = $e(e.clientX, e.clientY, Q());
|
|
3863
|
+
let i = k(t.target, Q());
|
|
3864
|
+
this.hint.style.left = `${i.left}px`, this.hint.style.top = `${i.top}px`, this.hint.hidden = !1;
|
|
3865
|
+
};
|
|
3866
|
+
onDragUp = (e) => {
|
|
3867
|
+
this.drag && e.pointerId === this.drag.pointer && this.endDrag(!1);
|
|
3868
|
+
};
|
|
3869
|
+
onDragCancel = (e) => {
|
|
3870
|
+
this.drag && e.pointerId === this.drag.pointer && this.endDrag(!0);
|
|
3871
|
+
};
|
|
3872
|
+
endDrag(e) {
|
|
3873
|
+
let t = this.drag;
|
|
3874
|
+
if (t) {
|
|
3875
|
+
t.el.removeEventListener("pointermove", this.onDragMove), t.el.removeEventListener("pointerup", this.onDragUp), t.el.removeEventListener("pointercancel", this.onDragCancel), t.el.removeEventListener("lostpointercapture", this.onDragCancel);
|
|
3876
|
+
try {
|
|
3877
|
+
t.el.hasPointerCapture?.(t.pointer) && t.el.releasePointerCapture(t.pointer);
|
|
3878
|
+
} catch {}
|
|
3879
|
+
this.hint.hidden = !0, this.mover.classList.remove("dragging"), t.moved ? (t.from === "dock" && (this.noClick = !0), e ? this.snapTo(this.anchor, "back") : this.snapTo(t.target, "person")) : (this.drag = null, this.stale && this.render());
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
snapTo(e, t) {
|
|
3883
|
+
let n = [...this.mover.querySelectorAll(".dock, .panel")], r = n.map((e) => e.getBoundingClientRect());
|
|
3884
|
+
t === "person" && e !== this.saved ? (this.saved = e, $.set("dock", e), this.saveDock(e)) : t === "person" && (this.saved = e), this.anchor = e, this.drag = null, this.mover.style.transform = "", this.place(), this.recheckScheme();
|
|
3885
|
+
let i = n.flatMap((e, t) => {
|
|
3886
|
+
let n = r[t], i = e.getBoundingClientRect(), a = n ? n.left - i.left : 0, o = n ? n.top - i.top : 0;
|
|
3887
|
+
return a === 0 && o === 0 || e.classList.contains("opening") ? [] : [{
|
|
3888
|
+
el: e,
|
|
3889
|
+
dx: a,
|
|
3890
|
+
dy: o
|
|
3891
|
+
}];
|
|
3892
|
+
});
|
|
3893
|
+
if (N() || i.length === 0) return this.snapDone();
|
|
3894
|
+
for (let e of i) e.el.style.transition = "none", e.el.style.transform = `translate(${e.dx}px, ${e.dy}px)`;
|
|
3895
|
+
this.mover.offsetWidth;
|
|
3896
|
+
for (let e of i) e.el.classList.add("snapping"), e.el.style.transition = "", e.el.style.transform = "";
|
|
3897
|
+
clearTimeout(this.snapTimer), this.snapTimer = window.setTimeout(() => this.snapDone(), U.snap + 40);
|
|
3898
|
+
}
|
|
3899
|
+
snapDone() {
|
|
3900
|
+
clearTimeout(this.snapTimer), this.snapTimer = 0;
|
|
3901
|
+
for (let e of this.mover.querySelectorAll(".snapping")) e.classList.remove("snapping");
|
|
3902
|
+
this.stale ? this.render() : this.goBack(), this.checkLater && (this.checkLater = !1, this.avoid());
|
|
3903
|
+
}
|
|
3904
|
+
async saveDock(e) {
|
|
3905
|
+
try {
|
|
3906
|
+
await this.client.call("POST prefs", {
|
|
3907
|
+
scheme: this.pref,
|
|
3908
|
+
dock: e
|
|
3909
|
+
});
|
|
3910
|
+
} catch (e) {
|
|
3911
|
+
this.showToast(`Could not keep the place of Onsite: ${e.message}`);
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
targets() {
|
|
3915
|
+
return [
|
|
3916
|
+
...this.pins,
|
|
3917
|
+
...this.layer.menuTargets(),
|
|
3918
|
+
...this.layer.frameTargets()
|
|
3919
|
+
];
|
|
3920
|
+
}
|
|
3921
|
+
avoid() {
|
|
3922
|
+
if (!this.open || this.drag) return;
|
|
3923
|
+
if (this.snapTimer) {
|
|
3924
|
+
this.checkLater = !0;
|
|
3925
|
+
return;
|
|
3926
|
+
}
|
|
3927
|
+
let e = Q(), t = this.targets().map((t) => tt(t.getBoundingClientRect(), e)).filter((e) => e !== null);
|
|
3928
|
+
if (!t.length) return;
|
|
3929
|
+
let n = this.mover.querySelector(".panel")?.offsetHeight || $n, r = it(this.saved, (t) => [Qe(t, e, 400, n), k(t, e)], t);
|
|
3930
|
+
r !== this.anchor && this.snapTo(r, "avoid");
|
|
3931
|
+
}
|
|
3932
|
+
goBack() {
|
|
3933
|
+
if (this.anchor === this.saved || this.drag || this.snapTimer) return;
|
|
3934
|
+
let e = this.pins.length > 0 || this.altMenu !== "" || this.layer.frameTargets().length > 0;
|
|
3935
|
+
this.open && e || this.snapTo(this.saved, "back");
|
|
3936
|
+
}
|
|
3937
|
+
place() {
|
|
3938
|
+
let e = Q(), t = this.anchor;
|
|
3939
|
+
this.mover.dataset.row = T(t), this.extras.dataset.toast = t === "bottom-center" ? "top" : "bottom";
|
|
3940
|
+
let n = this.mover.querySelector(".dock");
|
|
3941
|
+
if (n) {
|
|
3942
|
+
let r = k(t, e);
|
|
3943
|
+
n.style.left = `${r.left}px`, n.style.top = `${r.top}px`;
|
|
3944
|
+
}
|
|
3945
|
+
let r = this.mover.querySelector("[data-dockmore]");
|
|
3946
|
+
if (r) {
|
|
3947
|
+
let n = k(t, e);
|
|
3948
|
+
r.style.left = `${n.left - 6}px`, r.style.top = `${n.top - 6}px`;
|
|
3949
|
+
}
|
|
3950
|
+
let i = (n, r, i) => {
|
|
3951
|
+
if (!n) return;
|
|
3952
|
+
let a = Ze(t, e, r, i);
|
|
3953
|
+
n.style.left = `${a.left}px`, n.style.width = `${a.width}px`, n.style.top = a.top === void 0 ? "" : `${a.top}px`, n.style.bottom = a.bottom === void 0 ? "" : `${a.bottom}px`, n.style.maxHeight = `${a.maxHeight}px`;
|
|
3954
|
+
};
|
|
3955
|
+
i(this.mover.querySelector(".panel"), 400), i(this.tipEl, 220, 8), this.menu.open && i(this.menu.el, 340, 8), this.question.place();
|
|
3956
|
+
}
|
|
3957
|
+
tipSoon(e) {
|
|
3958
|
+
e.pointerType && e.pointerType !== "mouse" || (clearTimeout(this.tipTimer), this.tipTimer = window.setTimeout(() => this.setTip(!0), Zn));
|
|
3959
|
+
}
|
|
3960
|
+
tipFocus() {
|
|
3961
|
+
this.refocusing || this.drag || this.setTip(!0);
|
|
3962
|
+
}
|
|
3963
|
+
setTip(e) {
|
|
3964
|
+
clearTimeout(this.tipTimer);
|
|
3965
|
+
let t = e && !this.open && !this.menu.open && !this.hidden && !this.drag?.moved;
|
|
3966
|
+
this.tip !== t && (this.tip = t, this.tipEl.hidden = !t);
|
|
3967
|
+
}
|
|
3968
|
+
setTab(e) {
|
|
3969
|
+
this.tab = e, $.set("tab", e), e === "export" && (this.copied = !1, this.loadExportSoon(0)), e === "changes" && this.loadChangesSoon(0), this.render();
|
|
3970
|
+
}
|
|
3971
|
+
setMode(e) {
|
|
3972
|
+
this.mode = e, e === "idle" && (this.hover = null), this.render(), e !== "idle" && this.textarea.focus();
|
|
3973
|
+
}
|
|
3974
|
+
setCount(e) {
|
|
3975
|
+
this.count = Math.max(1, Math.min(3, e)), this.render();
|
|
3976
|
+
}
|
|
3977
|
+
async cycleScheme() {
|
|
3978
|
+
let e = [
|
|
3979
|
+
"auto",
|
|
3980
|
+
"dark",
|
|
3981
|
+
"light"
|
|
3982
|
+
], t = e[(e.indexOf(this.pref) + 1) % e.length] ?? "auto";
|
|
3983
|
+
this.pref = t, this.render();
|
|
3984
|
+
try {
|
|
3985
|
+
this.pref = (await this.client.call("POST prefs", { scheme: t })).scheme, this.render();
|
|
3986
|
+
} catch (e) {
|
|
3987
|
+
this.showToast(`Could not keep the scheme: ${e.message}`);
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
panelScheme() {
|
|
3991
|
+
return this.pref === "auto" ? this.pageScheme : this.pref;
|
|
3992
|
+
}
|
|
3993
|
+
openTakes() {
|
|
3994
|
+
return this.thread.takes.filter((e) => e.state === "open");
|
|
3995
|
+
}
|
|
3996
|
+
shownTake() {
|
|
3997
|
+
return this.thread.shown ? this.thread.takes.find((e) => e.id === this.thread.shown) : void 0;
|
|
3998
|
+
}
|
|
3999
|
+
queueFull() {
|
|
4000
|
+
return !!this.thread.running && (this.thread.queue?.length ?? 0) >= 3;
|
|
4001
|
+
}
|
|
4002
|
+
basePick() {
|
|
4003
|
+
return ue(this.thread, this.pins.map((e) => e.getAttribute("data-onsite-src") ?? ""));
|
|
4004
|
+
}
|
|
4005
|
+
baseTake() {
|
|
4006
|
+
return this.basePick()?.take;
|
|
4007
|
+
}
|
|
4008
|
+
canSend() {
|
|
4009
|
+
return !this.busy && !this.queueFull() && (this.draft.trim() !== "" || this.chosen.length > 0);
|
|
4010
|
+
}
|
|
4011
|
+
async send() {
|
|
4012
|
+
if (!this.canSend()) return;
|
|
4013
|
+
let e = this.draft.trim() || "Work on the comments I chose.";
|
|
4014
|
+
await this.ask(e, this.count, [...this.chosen]) && (this.draft = "", this.textarea.value = "", this.chosen = [], this.render());
|
|
4015
|
+
}
|
|
4016
|
+
async ask(e, t, n = []) {
|
|
4017
|
+
if (this.busy || this.queueFull()) return !1;
|
|
4018
|
+
let r = We(this.pins, {
|
|
4019
|
+
host: this.host,
|
|
4020
|
+
scheme: this.pageScheme
|
|
4021
|
+
}), i = this.baseTake();
|
|
4022
|
+
this.busy = "ask", this.render();
|
|
4023
|
+
try {
|
|
4024
|
+
let a = await this.client.call("POST ask", {
|
|
4025
|
+
message: e,
|
|
4026
|
+
count: Math.max(1, Math.min(3, t)),
|
|
4027
|
+
...i ? { base: i.id } : {},
|
|
4028
|
+
context: r,
|
|
4029
|
+
...n.length ? { comments: n } : {}
|
|
4030
|
+
});
|
|
4031
|
+
return a.queued && this.showToast(a.queued === 1 ? "Queued. It starts when the run that works ends." : `Queued, ${a.queued} in line. Each ask starts when the one before it ends.`), this.pins = [], this.quick = !1, this.count = this.takes, this.mode = "idle", this.tab = "thread", $.set("tab", "thread"), !0;
|
|
4032
|
+
} catch (e) {
|
|
4033
|
+
return this.showToast(e.message), !1;
|
|
4034
|
+
} finally {
|
|
4035
|
+
this.busy = "", this.render();
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
async cancel(e) {
|
|
4039
|
+
try {
|
|
4040
|
+
await this.client.call("POST cancel", { run: e });
|
|
4041
|
+
} catch (e) {
|
|
4042
|
+
this.showToast(e.message);
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
async stop() {
|
|
4046
|
+
let e = this.thread.running;
|
|
4047
|
+
if (e) try {
|
|
4048
|
+
await this.client.call("POST stop", { run: e });
|
|
4049
|
+
} catch (e) {
|
|
4050
|
+
this.showToast(e.message);
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
toggleOriginal(e) {
|
|
4054
|
+
let t = this.openTakes().filter((t) => t.of === e), n = R(this.thread);
|
|
4055
|
+
if (!Ct(t, n)) return void this.show("", e);
|
|
4056
|
+
let r = V(e, t, n, this.picked);
|
|
4057
|
+
r && this.show(r.id);
|
|
4058
|
+
}
|
|
4059
|
+
takeRun() {
|
|
4060
|
+
let e = this.openTakes();
|
|
4061
|
+
if (this.barAsk && e.some((e) => e.of === this.barAsk)) return this.barAsk;
|
|
4062
|
+
let t = e.find((e) => e.id === this.thread.shown);
|
|
4063
|
+
return t ? t.of : this.lastRun && e.some((e) => e.of === this.lastRun) ? this.lastRun : e.at(-1)?.of ?? "";
|
|
4064
|
+
}
|
|
4065
|
+
takeRuns() {
|
|
4066
|
+
let e = new Set(this.openTakes().map((e) => e.of));
|
|
4067
|
+
return this.thread.entries.filter((t) => t.who === "person" && e.has(t.id)).map((e) => e.id);
|
|
4068
|
+
}
|
|
4069
|
+
stepAsk(e) {
|
|
4070
|
+
let t = this.takeRuns();
|
|
4071
|
+
if (t.length < 2) return;
|
|
4072
|
+
let n = Math.max(0, t.indexOf(this.takeRun()));
|
|
4073
|
+
this.barAsk = t[(n + e + t.length) % t.length], this.render();
|
|
4074
|
+
}
|
|
4075
|
+
async show(e, t) {
|
|
4076
|
+
if (this.busy) return;
|
|
4077
|
+
let n = R(this.thread), r = (e) => this.thread.takes.find((t) => t.id === e)?.of ?? e.replace(/-\d+$/, ""), i = e === "" ? t ? n.filter((e) => r(e) === t) : n : n.filter((t) => r(t) === r(e));
|
|
4078
|
+
if (e === "" ? i.length === 0 : n.includes(e)) return;
|
|
4079
|
+
let a = this.thread.takes.find((t) => t.id === e), o = !!a?.stale?.length;
|
|
4080
|
+
if (a && o && (!await this.askFirst(a) || this.busy)) return;
|
|
4081
|
+
a && (this.picked.set(a.of, a.id), this.lastRun = a.of, this.barAsk = "", this.beforeOriginal = null), this.busy = "show", this.render();
|
|
4082
|
+
let s = null;
|
|
4083
|
+
try {
|
|
4084
|
+
s = await this.client.call("GET marks", {});
|
|
4085
|
+
} catch {
|
|
4086
|
+
s = null;
|
|
4087
|
+
}
|
|
4088
|
+
let c = this.waitUpdate();
|
|
4089
|
+
try {
|
|
4090
|
+
let n = await this.client.call("POST show", e === "" && t ? {
|
|
4091
|
+
take: e,
|
|
4092
|
+
run: t
|
|
4093
|
+
} : { take: e });
|
|
4094
|
+
if (this.thread = {
|
|
4095
|
+
...this.thread,
|
|
4096
|
+
shown: n.take,
|
|
4097
|
+
showing: n.showing ?? (n.take ? [n.take] : [])
|
|
4098
|
+
}, n.files.length) {
|
|
4099
|
+
await c, await M();
|
|
4100
|
+
let t = (s?.groups ?? []).filter((t) => t.takes.some((t) => t === e || i.includes(t)));
|
|
4101
|
+
this.layer.swap(t.flatMap((e) => K(e, this.host)));
|
|
4102
|
+
}
|
|
4103
|
+
} catch (e) {
|
|
4104
|
+
this.showToast(e.message);
|
|
4105
|
+
} finally {
|
|
4106
|
+
this.busy = "", this.render(), this.alt !== "off" && this.loadMarks(), o && !this.shadow.activeElement && this.question.refocus();
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
askFirst(e) {
|
|
4110
|
+
return this.question.ask({
|
|
4111
|
+
label: "Show a take made on older code?",
|
|
4112
|
+
text: g(e),
|
|
4113
|
+
yes: "Show anyway"
|
|
4114
|
+
});
|
|
4115
|
+
}
|
|
4116
|
+
everywhere() {
|
|
4117
|
+
return R(this.thread).length > 0 ? "original" : this.takesBefore().length > 0 ? "back" : "";
|
|
4118
|
+
}
|
|
4119
|
+
takesBefore() {
|
|
4120
|
+
let e = this.beforeOriginal;
|
|
4121
|
+
return e ? [...e.showing.filter((t) => t !== e.shown), ...e.showing.includes(e.shown) ? [e.shown] : []].map((e) => this.thread.takes.find((t) => t.id === e)).filter((e) => e?.state === "open" && !e.stale?.length) : [];
|
|
4122
|
+
}
|
|
4123
|
+
async toggleEverywhere() {
|
|
4124
|
+
if (this.busy) return;
|
|
4125
|
+
let e = this.everywhere();
|
|
4126
|
+
if (e === "original") {
|
|
4127
|
+
let e = {
|
|
4128
|
+
showing: R(this.thread),
|
|
4129
|
+
shown: this.thread.shown
|
|
4130
|
+
};
|
|
4131
|
+
await this.show(""), R(this.thread).length === 0 && (this.beforeOriginal = e);
|
|
4132
|
+
return;
|
|
4133
|
+
}
|
|
4134
|
+
if (e !== "back") return;
|
|
4135
|
+
let t = this.beforeOriginal, n = this.takesBefore();
|
|
4136
|
+
this.beforeOriginal = null;
|
|
4137
|
+
let r = (t?.showing ?? []).map((e) => this.thread.takes.find((t) => t.id === e)).find((e) => e?.state === "open" && e.stale?.length);
|
|
4138
|
+
for (let e of n) await this.show(e.id);
|
|
4139
|
+
r && this.showToast(ne(r));
|
|
4140
|
+
}
|
|
4141
|
+
async hideTakes(e) {
|
|
4142
|
+
if (this.busy) return;
|
|
4143
|
+
let t = R(this.thread), n = t.filter((t) => e.includes(t));
|
|
4144
|
+
if (n.length === 0) return;
|
|
4145
|
+
if (n.length === t.length) return this.show("");
|
|
4146
|
+
let r = new Set(n.map((e) => this.thread.takes.find((t) => t.id === e)?.of).filter((e) => !!e));
|
|
4147
|
+
for (let e of r) await this.show("", e);
|
|
4148
|
+
}
|
|
4149
|
+
async keep(e) {
|
|
4150
|
+
if (!this.busy) {
|
|
4151
|
+
this.busy = "keep", this.render();
|
|
4152
|
+
try {
|
|
4153
|
+
let t = await this.client.call("POST keep", { take: e.id }), n = t.files.length ? ` · ${r(t.files.length, "file")} written` : "";
|
|
4154
|
+
this.showToast(`Kept ${u(e.no)}${n}${t.note ? `. ${t.note}` : ""}`, t.change);
|
|
4155
|
+
} catch (e) {
|
|
4156
|
+
this.showToast(e.message);
|
|
4157
|
+
} finally {
|
|
4158
|
+
this.busy = "", this.render();
|
|
4159
|
+
}
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
async skip(e) {
|
|
4163
|
+
if (!this.busy) {
|
|
4164
|
+
this.busy = "skip", this.render();
|
|
4165
|
+
try {
|
|
4166
|
+
let t = await this.client.call("POST skip", { take: e.id });
|
|
4167
|
+
this.showToast(`${u(e.no)} skipped · no file changed${t.note ? `. ${t.note}` : ""}`);
|
|
4168
|
+
} catch (e) {
|
|
4169
|
+
this.showToast(e.message);
|
|
4170
|
+
} finally {
|
|
4171
|
+
this.busy = "", this.render();
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
async again(e) {
|
|
4176
|
+
if (!this.busy) {
|
|
4177
|
+
this.busy = "again", this.render();
|
|
4178
|
+
try {
|
|
4179
|
+
let t = await this.client.call("POST again", { take: e.id });
|
|
4180
|
+
this.showToast(`Asked again for ${u(e.no)} on the new code${t.queued ? ` · ${d(t.queued - 1)}` : ""}`);
|
|
4181
|
+
} catch (e) {
|
|
4182
|
+
this.showToast(e.message);
|
|
4183
|
+
} finally {
|
|
4184
|
+
this.busy = "", this.render();
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
async undo(e) {
|
|
4189
|
+
if (!this.busy) {
|
|
4190
|
+
this.busy = "undo", this.toast = null, this.render();
|
|
4191
|
+
try {
|
|
4192
|
+
let t = await this.client.call("POST undo", { change: e }), n = this.thread.entries.find((t) => t.id === e);
|
|
4193
|
+
this.showToast(`Undone: ${n ? ce(n).split(" · ")[0]?.toLowerCase() : "the change"}${t.note ? `. ${t.note}` : ""}`);
|
|
4194
|
+
} catch (e) {
|
|
4195
|
+
this.showToast(e.message);
|
|
4196
|
+
} finally {
|
|
4197
|
+
this.busy = "", this.render();
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
lastChange() {
|
|
4202
|
+
let e = [...this.thread.entries].reverse().find((e) => e.who === "agent" && (e.kind === "keep" || e.kind === "skip" || e.kind === "undo"));
|
|
4203
|
+
return e && e.kind !== "undo" && !e.undone ? e.id : "";
|
|
4204
|
+
}
|
|
4205
|
+
canPin() {
|
|
4206
|
+
return !this.busy && this.draft.trim() !== "" && this.pins.length > 0;
|
|
4207
|
+
}
|
|
4208
|
+
async pinComment() {
|
|
4209
|
+
let e = this.pins[0], t = this.draft.trim();
|
|
4210
|
+
if (t && !this.busy) {
|
|
4211
|
+
if (!e) this.showToast(`Choose an element first: ${P()}-click it, then pin.`);
|
|
4212
|
+
else {
|
|
4213
|
+
this.busy = "comment", this.render();
|
|
4214
|
+
try {
|
|
4215
|
+
let n = e.getAttribute("data-onsite-comp"), r = await this.client.call("POST comment", {
|
|
4216
|
+
text: t,
|
|
4217
|
+
stamp: {
|
|
4218
|
+
src: e.getAttribute("data-onsite-src") ?? "",
|
|
4219
|
+
...n ? { comp: n } : {}
|
|
4220
|
+
},
|
|
4221
|
+
context: We([e], {
|
|
4222
|
+
host: this.host,
|
|
4223
|
+
scheme: this.pageScheme
|
|
4224
|
+
})
|
|
4225
|
+
}), i = this.thread.comments.findIndex((e) => e.id === r.id) + 1 || this.thread.comments.length + 1;
|
|
4226
|
+
this.draft = "", this.textarea.value = "", this.pins = [], this.quick = !1, this.hover = null, this.showToast(`Comment ${i} pinned · it starts no run`);
|
|
4227
|
+
} catch (e) {
|
|
4228
|
+
this.showToast(e.message);
|
|
4229
|
+
} finally {
|
|
4230
|
+
this.busy = "", this.render();
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
async resolve(e, t) {
|
|
4236
|
+
try {
|
|
4237
|
+
await this.client.call("POST resolve", {
|
|
4238
|
+
id: e,
|
|
4239
|
+
resolved: t
|
|
4240
|
+
}), t && (this.chosen = this.chosen.filter((t) => t !== e)), this.openComment = "";
|
|
4241
|
+
} catch (e) {
|
|
4242
|
+
this.showToast(e.message);
|
|
4243
|
+
}
|
|
4244
|
+
this.render();
|
|
4245
|
+
}
|
|
4246
|
+
chooseComment(e) {
|
|
4247
|
+
this.chosen = this.chosen.includes(e) ? this.chosen.filter((t) => t !== e) : [...this.chosen, e], this.render();
|
|
4248
|
+
}
|
|
4249
|
+
loadChangesSoon(e = 150) {
|
|
4250
|
+
this.open && (clearTimeout(this.changesTimer), this.changesTimer = window.setTimeout(async () => {
|
|
4251
|
+
try {
|
|
4252
|
+
this.changes = await this.client.call("GET changes", {}), this.render();
|
|
4253
|
+
} catch {}
|
|
4254
|
+
}, e));
|
|
4255
|
+
}
|
|
4256
|
+
async openDiff(e, t) {
|
|
4257
|
+
if (this.diff && this.diff.path === e && this.diff.take === t) this.diff = null, this.render();
|
|
4258
|
+
else {
|
|
4259
|
+
try {
|
|
4260
|
+
this.diff = await this.client.call("GET diff", {
|
|
4261
|
+
take: t,
|
|
4262
|
+
path: e
|
|
4263
|
+
});
|
|
4264
|
+
} catch (e) {
|
|
4265
|
+
this.showToast(e.message);
|
|
4266
|
+
}
|
|
4267
|
+
this.render();
|
|
4268
|
+
}
|
|
4269
|
+
}
|
|
4270
|
+
toggleFile(e) {
|
|
4271
|
+
this.openFile = this.openFile === e ? "" : e, this.diff?.path !== this.openFile && (this.diff = null), this.render();
|
|
4272
|
+
}
|
|
4273
|
+
exportable() {
|
|
4274
|
+
return this.thread.takes.filter((e) => e.state === "open" || e.state === "kept");
|
|
4275
|
+
}
|
|
4276
|
+
exportChosen() {
|
|
4277
|
+
let e = this.exportable().map((e) => e.id);
|
|
4278
|
+
if (this.exportTakes) return this.exportTakes.filter((t) => e.includes(t));
|
|
4279
|
+
let t = R(this.thread).filter((t) => e.includes(t));
|
|
4280
|
+
if (t.length > 0) return t;
|
|
4281
|
+
let n = e.at(-1);
|
|
4282
|
+
return n ? [n] : [];
|
|
4283
|
+
}
|
|
4284
|
+
exportCommentsChosen() {
|
|
4285
|
+
let e = this.thread.comments.filter((e) => !e.resolved).map((e) => e.id);
|
|
4286
|
+
return this.exportComments ? this.exportComments.filter((t) => e.includes(t)) : e;
|
|
4287
|
+
}
|
|
4288
|
+
toggleExportTake(e) {
|
|
4289
|
+
let t = this.exportChosen();
|
|
4290
|
+
this.exportTakes = t.includes(e) ? t.filter((t) => t !== e) : [...t, e], this.copied = !1, this.loadExportSoon(0), this.render();
|
|
4291
|
+
}
|
|
4292
|
+
toggleExportComment(e) {
|
|
4293
|
+
let t = this.exportCommentsChosen();
|
|
4294
|
+
this.exportComments = t.includes(e) ? t.filter((t) => t !== e) : [...t, e], this.copied = !1, this.loadExportSoon(0), this.render();
|
|
4295
|
+
}
|
|
4296
|
+
loadExportSoon(e = 150) {
|
|
4297
|
+
clearTimeout(this.exportTimer), this.exportTimer = window.setTimeout(async () => {
|
|
4298
|
+
try {
|
|
4299
|
+
this.exportOut = await this.client.call("POST export", {
|
|
4300
|
+
takes: this.exportChosen(),
|
|
4301
|
+
comments: this.exportCommentsChosen()
|
|
4302
|
+
});
|
|
4303
|
+
} catch (e) {
|
|
4304
|
+
this.exportOut = null, this.showToast(e.message);
|
|
4305
|
+
}
|
|
4306
|
+
this.render();
|
|
4307
|
+
}, e);
|
|
4308
|
+
}
|
|
4309
|
+
async copyExport() {
|
|
4310
|
+
let e = this.exportOut?.markdown;
|
|
4311
|
+
if (e) {
|
|
4312
|
+
try {
|
|
4313
|
+
await navigator.clipboard.writeText(e), this.copied = !0, clearTimeout(this.copyTimer), this.copyTimer = window.setTimeout(() => {
|
|
4314
|
+
this.copied = !1, this.render();
|
|
4315
|
+
}, 2e3);
|
|
4316
|
+
} catch {
|
|
4317
|
+
this.showToast("The browser did not allow the copy. Select the prompt and copy it.");
|
|
4318
|
+
}
|
|
4319
|
+
this.render();
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
downloadExport() {
|
|
4323
|
+
let e = this.exportOut;
|
|
4324
|
+
if (!e) return;
|
|
4325
|
+
let t = URL.createObjectURL(new Blob([e.markdown], { type: "text/markdown" })), n = A("a", {
|
|
4326
|
+
href: t,
|
|
4327
|
+
download: e.filename
|
|
4328
|
+
});
|
|
4329
|
+
this.shadow.append(n), n.click(), n.remove(), setTimeout(() => URL.revokeObjectURL(t), 1e3);
|
|
4330
|
+
}
|
|
4331
|
+
async saveExport() {
|
|
4332
|
+
try {
|
|
4333
|
+
let e = await this.client.call("POST export", {
|
|
4334
|
+
takes: this.exportChosen(),
|
|
4335
|
+
comments: this.exportCommentsChosen(),
|
|
4336
|
+
save: !0
|
|
4337
|
+
});
|
|
4338
|
+
this.exportOut = e, this.showToast(e.path ? `Saved to ${e.path}` : "Saved");
|
|
4339
|
+
} catch (e) {
|
|
4340
|
+
this.showToast(e.message);
|
|
4341
|
+
}
|
|
4342
|
+
this.render();
|
|
4343
|
+
}
|
|
4344
|
+
showToast(e, t) {
|
|
4345
|
+
clearTimeout(this.toastTimer), this.toast = t ? {
|
|
4346
|
+
text: e,
|
|
4347
|
+
undo: t
|
|
4348
|
+
} : { text: e }, this.toastTimer = window.setTimeout(() => {
|
|
4349
|
+
this.toast = null, this.render();
|
|
4350
|
+
}, 4e3), this.render();
|
|
4351
|
+
}
|
|
4352
|
+
layerState() {
|
|
4353
|
+
let e = this.frames();
|
|
4354
|
+
return {
|
|
4355
|
+
pageScheme: this.pageScheme,
|
|
4356
|
+
hover: this.hover,
|
|
4357
|
+
pins: this.pins,
|
|
4358
|
+
comments: this.thread.comments,
|
|
4359
|
+
chosen: this.chosen,
|
|
4360
|
+
openComment: this.openComment,
|
|
4361
|
+
takes: this.thread.takes,
|
|
4362
|
+
shown: this.thread.shown,
|
|
4363
|
+
showing: R(this.thread),
|
|
4364
|
+
alt: this.alt,
|
|
4365
|
+
altMarks: this.altMarks,
|
|
4366
|
+
altMenu: this.altMenu,
|
|
4367
|
+
avoid: this.ui.querySelector(".panel")?.getBoundingClientRect() ?? null,
|
|
4368
|
+
frames: e,
|
|
4369
|
+
barRun: _t(e, this.chosenBar),
|
|
4370
|
+
frameMarks: this.frameMarks,
|
|
4371
|
+
liveMarks: this.liveMarks,
|
|
4372
|
+
busy: !!this.busy,
|
|
4373
|
+
picked: this.picked,
|
|
4374
|
+
asks: this.thread.entries.filter((e) => e.who === "person").map((e) => e.id)
|
|
4375
|
+
};
|
|
4376
|
+
}
|
|
4377
|
+
render() {
|
|
4378
|
+
this.host.dataset.scheme = this.panelScheme(), this.host.dataset.motion = N() ? "reduce" : "full", this.drag || this.snapTimer ? this.stale = !0 : this.renderMover(), this.renderQuick(), this.iconTip.refresh();
|
|
4379
|
+
let e = Tn(this);
|
|
4380
|
+
this.extras.replaceChildren(...e ? [e] : []), this.place(), this.layer.draw(), this.goBack();
|
|
4381
|
+
}
|
|
4382
|
+
renderMover() {
|
|
4383
|
+
this.stale = !1;
|
|
4384
|
+
let e = this.ui.querySelector(".body"), t = !e || e.scrollHeight - e.scrollTop - e.clientHeight < 24, n = e?.scrollTop ?? 0, r = this.open && !this.wasOpen;
|
|
4385
|
+
this.wasOpen = this.open;
|
|
4386
|
+
let i = this.shadow.activeElement, a = [
|
|
4387
|
+
".dock",
|
|
4388
|
+
".dockmore",
|
|
4389
|
+
".grip",
|
|
4390
|
+
"[data-menu-button]"
|
|
4391
|
+
], o = i instanceof HTMLElement && this.mover.contains(i) ? i.dataset.tipKey : void 0, s = i === this.textarea ? "textarea" : o ? `[data-tip-key="${o}"]` : a.find((e) => i?.matches(e) && this.mover.contains(i)) ?? "", { selectionStart: c, selectionEnd: l } = this.textarea, u = this.hidden ? [] : xn(this);
|
|
4392
|
+
this.mover.replaceChildren(...u, this.open ? En(this, r) : this.tipEl), s === "textarea" && this.textarea.isConnected ? (this.textarea.focus({ preventScroll: !0 }), this.textarea.setSelectionRange(c, l)) : s && (this.refocusing = !0, this.mover.querySelector(s)?.focus({ preventScroll: !0 }), this.refocusing = !1);
|
|
4393
|
+
let d = this.ui.querySelector(".body");
|
|
4394
|
+
d && (d.scrollTop = t ? d.scrollHeight : n), this.open && this.fitText();
|
|
4395
|
+
}
|
|
4396
|
+
renderQuick() {
|
|
4397
|
+
if (this.quick && (this.open || this.pins.length === 0) && (this.quick = !1), !this.quick) {
|
|
4398
|
+
this.quickWas = !1, this.quickBox.firstChild && this.quickBox.replaceChildren();
|
|
4399
|
+
return;
|
|
4400
|
+
}
|
|
4401
|
+
let e = this.shadow.activeElement, t = e === this.textarea, n = e instanceof HTMLElement && this.quickBox.contains(e) ? e.dataset.tipKey : void 0, { selectionStart: r, selectionEnd: i } = this.textarea, a = Gn(this, !this.quickWas);
|
|
4402
|
+
a.style.width = `${Yt(Q())}px`, this.quickBox.replaceChildren(a), this.quickWas = !0, t ? (this.textarea.focus({ preventScroll: !0 }), this.textarea.setSelectionRange(r, i)) : n && this.quickBox.querySelector(`[data-tip-key="${n}"]`)?.focus({ preventScroll: !0 }), this.fitText(), this.placeQuick();
|
|
4403
|
+
}
|
|
4404
|
+
renderLive() {
|
|
4405
|
+
let e = this.ui.querySelector("[data-live]");
|
|
4406
|
+
if (!e || !this.live) return this.render();
|
|
4407
|
+
e.replaceChildren(document.createTextNode(this.live.text), A("span", {
|
|
4408
|
+
class: "caret",
|
|
4409
|
+
"aria-hidden": "true"
|
|
4410
|
+
}));
|
|
4411
|
+
let t = this.ui.querySelector(".body");
|
|
4412
|
+
t && t.scrollHeight - t.scrollTop - t.clientHeight < 80 && (t.scrollTop = t.scrollHeight);
|
|
4413
|
+
}
|
|
4414
|
+
renderComposerState() {
|
|
4415
|
+
let e = (e, t) => {
|
|
4416
|
+
let n = this.ui.querySelector(e);
|
|
4417
|
+
n && (t ? n.setAttribute("aria-disabled", "true") : n.removeAttribute("aria-disabled"));
|
|
4418
|
+
};
|
|
4419
|
+
e("[data-send]", !this.canSend()), e("[data-pin-comment]", !this.canPin());
|
|
4420
|
+
}
|
|
4421
|
+
destroy() {
|
|
4422
|
+
this.question.close(!1);
|
|
4423
|
+
for (let e of this.cleanups) e();
|
|
4424
|
+
this.stopScheme(), clearTimeout(this.toastTimer), clearTimeout(this.changesTimer), clearTimeout(this.exportTimer), clearTimeout(this.tipTimer), clearTimeout(this.resizeTimer), clearTimeout(this.snapTimer), clearTimeout(this.frameTimer), this.host.remove();
|
|
4425
|
+
}
|
|
4426
|
+
}, ir = (e) => `${e.id}:${e.state}`, ar = (e) => e.running ? (e.entries.find((t) => t.id === e.running && t.who === "person")?.steps ?? []).filter((e) => e.take).length : 0;
|
|
4427
|
+
function or(e) {
|
|
4428
|
+
return typeof e == "number" && Number.isInteger(e) ? Math.max(1, Math.min(3, e)) : 1;
|
|
4429
|
+
}
|
|
4430
|
+
function sr(e) {
|
|
4431
|
+
try {
|
|
4432
|
+
let t = JSON.parse(e ?? "[]");
|
|
4433
|
+
return Array.isArray(t) ? t.filter((e) => typeof e == "string") : [];
|
|
4434
|
+
} catch {
|
|
4435
|
+
return [];
|
|
4436
|
+
}
|
|
4437
|
+
}
|
|
4438
|
+
// src/index.ts
|
|
4439
|
+
function cr(e = {}) {
|
|
4440
|
+
return typeof document > "u" || document.querySelector("onsite-overlay") ? null : new rr(e);
|
|
4441
|
+
}
|
|
4442
|
+
typeof document < "u" && !globalThis.__ONSITE_NO_BOOT__ && cr();
|
|
4443
|
+
export { Kn as HOST_TAG, rr as Overlay, cr as mount, We as pageContext, Oe as propsOf, Ve as snapshot };
|