deictic 0.2.0 → 0.3.0
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/API.md +303 -0
- package/README.md +56 -127
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +117 -7
- package/dist/client/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logs/client.d.ts +4 -0
- package/dist/logs/client.d.ts.map +1 -0
- package/dist/logs/client.js +16 -0
- package/dist/logs/client.js.map +1 -0
- package/dist/logs/index.d.ts +18 -0
- package/dist/logs/index.d.ts.map +1 -0
- package/dist/logs/index.js +21 -0
- package/dist/logs/index.js.map +1 -0
- package/dist/network/client.d.ts +4 -0
- package/dist/network/client.d.ts.map +1 -0
- package/dist/network/client.js +29 -0
- package/dist/network/client.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +39 -0
- package/dist/network/index.js.map +1 -0
- package/dist/recommended/index.d.ts +13 -3
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +8 -1
- package/dist/recommended/index.js.map +1 -1
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +175 -46
- package/dist/recordings/client.js.map +1 -1
- package/dist/recordings/index.d.ts +2 -2
- package/dist/screenshots/client.d.ts +6 -0
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/client.js +34 -2
- package/dist/screenshots/client.js.map +1 -1
- package/dist/screenshots/dom.d.ts.map +1 -1
- package/dist/screenshots/dom.js +1 -28
- package/dist/screenshots/dom.js.map +1 -1
- package/dist/screenshots/index.js.map +1 -1
- package/dist/screenshots/rrweb.d.ts +1 -1
- package/dist/screenshots/rrweb.js +5 -1
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/index.d.ts +14 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +2 -0
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index3.d.ts +29 -3
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index4.d.ts +52 -172
- package/dist/shared/index4.d.ts.map +1 -1
- package/dist/shared/index5.d.ts +208 -58
- package/dist/shared/index5.d.ts.map +1 -1
- package/dist/shared/index6.d.ts +70 -0
- package/dist/shared/index6.d.ts.map +1 -0
- package/dist/shared/marks.js +6 -1
- package/dist/shared/marks.js.map +1 -1
- package/dist/shared/mask.js +107 -0
- package/dist/shared/mask.js.map +1 -0
- package/dist/shared/playwright.js +19 -4
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/recordings.js +219 -28
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/tasks.js +145 -34
- package/dist/shared/tasks.js.map +1 -1
- package/dist/tailwind/client.d.ts +1 -1
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tasks/client.d.ts +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +271 -56
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +35 -14
- package/dist/voice/client.js.map +1 -1
- package/dist/voice/index.d.ts +6 -1
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +12 -2
- package/dist/voice/index.js.map +1 -1
- package/package.json +41 -2
- package/skills/deictic/SKILL.md +20 -14
- package/skills/deictic/references/install.md +18 -11
- package/skills/deictic/references/recordings.md +29 -0
- package/skills/deictic/references/tasks.md +49 -21
- package/skills/deictic/references/watch.md +38 -11
- package/skills/deictic/scripts/lib.mjs +69 -3
- package/skills/deictic/scripts/recording.mjs +84 -4
- package/skills/deictic/scripts/task.mjs +36 -7
- package/skills/deictic/scripts/vb.mjs +12 -0
- package/skills/deictic/scripts/watch.mjs +74 -10
- package/src/client/away.ts +105 -0
- package/src/client/index.ts +40 -9
- package/src/client/style.ts +1 -0
- package/src/index.ts +14 -2
- package/src/plugins/logs/client.ts +18 -0
- package/src/plugins/logs/index.ts +55 -0
- package/src/plugins/network/client.ts +30 -0
- package/src/plugins/network/index.ts +69 -0
- package/src/plugins/network/mask.ts +133 -0
- package/src/plugins/recommended/index.ts +14 -1
- package/src/plugins/recordings/client.ts +219 -40
- package/src/plugins/recordings/index.ts +108 -23
- package/src/plugins/recordings/marks.ts +6 -0
- package/src/plugins/recordings/replay.ts +127 -4
- package/src/plugins/screenshots/client.ts +35 -0
- package/src/plugins/screenshots/dom.ts +1 -32
- package/src/plugins/screenshots/index.ts +2 -0
- package/src/plugins/screenshots/playwright.ts +15 -4
- package/src/plugins/screenshots/rrweb.ts +2 -1
- package/src/plugins/tasks/client.ts +273 -41
- package/src/plugins/tasks/index.ts +155 -39
- package/src/plugins/tasks/watchers.ts +36 -0
- package/src/plugins/voice/client.ts +33 -11
- package/src/plugins/voice/index.ts +21 -4
package/dist/tasks/client.js
CHANGED
|
@@ -5,37 +5,72 @@ import { defineClientPlugin } from "../index.js";
|
|
|
5
5
|
* The tasks panel: the tasks already about this element and their state, and a field to add one. Each
|
|
6
6
|
* task's ID opens it on the board, where the board has a page; one no one has claimed yet can be edited
|
|
7
7
|
* in place (its words) or deleted (canceled on the board), both changes the popup's undo takes back.
|
|
8
|
+
* Beside the channel it says who watches it (`Model.watching`), or that no agent does.
|
|
8
9
|
* Ctrl+Enter or Add sends it with the page's URL, the viewport and the element as it rendered, which
|
|
9
|
-
* the source can't tell
|
|
10
|
+
* the source can't tell: the chain of source it rendered through, its HTML (a file attached), and where the
|
|
11
|
+
* annotations plugin is loaded, what's marked on the page.
|
|
10
12
|
*
|
|
11
|
-
* Where the screenshots plugin is loaded, a shot of the page goes with it, unless that's unticked
|
|
13
|
+
* Where the screenshots plugin is loaded, a shot of the page goes with it, unless that's unticked, the element
|
|
14
|
+
* outlined in it as the task goes: nothing else says which of two rows alike was meant (a shot drawn on is
|
|
15
|
+
* left as it was drawn). With
|
|
12
16
|
* the annotations plugin too, Annotate takes the shot now and opens it to draw on: saved, it's a chip
|
|
13
17
|
* under the field, which opens it again to change the marks, and Add another takes one more. Any chip
|
|
14
18
|
* (a recording's too) takes the box's place; removing the last brings it back unticked, so a task goes
|
|
15
19
|
* without a shot unless asked again.
|
|
16
20
|
*
|
|
21
|
+
* The element's HTML as it rendered goes with it too, as a file, unless its box is unticked (or the server
|
|
22
|
+
* half's `html` option is off, and then there's no box).
|
|
23
|
+
*
|
|
17
24
|
* Where the recordings plugin is loaded, Record leaves the popup (`away`) to record the page, keeping
|
|
18
25
|
* what's typed and attached, and comes back with the recording as a chip too, which plays it back.
|
|
19
26
|
* Where the voice plugin is, Voice records the mic here in the panel: stopped, it's a chip that plays it.
|
|
20
27
|
*/
|
|
21
28
|
const STYLE = `
|
|
22
|
-
|
|
23
|
-
.tasks
|
|
24
|
-
|
|
25
|
-
.tasks
|
|
26
|
-
|
|
27
|
-
.tasks
|
|
29
|
+
/* The column is no wider than the panel: an \`auto\` one grows to a long title, which then never truncates. */
|
|
30
|
+
.tasks { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
|
|
31
|
+
/* Five rows, and the rest scrolled to: the field stays where it is however many there are. */
|
|
32
|
+
.tasks { max-height: 112px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--deictic-line) transparent; }
|
|
33
|
+
/* A task's words being changed need the room. */
|
|
34
|
+
.tasks:has(.editing) { max-height: none; }
|
|
35
|
+
.tasks li { position: relative; display: flex; gap: 6px; align-items: baseline; }
|
|
36
|
+
.tasks .title { flex: 1; min-width: 0; padding: 0; border: 0; border-radius: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
37
|
+
/* Clicked, a task reads whole, as it was typed. */
|
|
38
|
+
.tasks li.whole .title { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
39
|
+
/* The state is a dot, named by its tooltip: a ring while no one has it, filled once someone does or it's over. */
|
|
40
|
+
.tasks .state { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }
|
|
41
|
+
/* Room for Edit and Delete, which would lie over the first line's end. */
|
|
42
|
+
.tasks li.whole:has(.acts) .title { padding-right: 40px; }
|
|
43
|
+
.tasks li.whole .state { align-self: baseline; }
|
|
44
|
+
.tasks .state.waiting { border-style: dotted; }
|
|
45
|
+
.tasks .state.claimed { border-color: #60a5fa; background: #60a5fa; }
|
|
46
|
+
.tasks .state.blocked { border-color: #fbbf24; background: #fbbf24; }
|
|
47
|
+
.tasks .state.completed { border-color: #4ade80; background: #4ade80; }
|
|
48
|
+
.tasks .state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }
|
|
28
49
|
.tasks a { color: inherit; text-decoration: none; }
|
|
29
50
|
.tasks a:hover { text-decoration: underline; }
|
|
30
|
-
|
|
51
|
+
/* Over the row's end, and only while the row is pointed at or focused in: the title keeps the width. */
|
|
52
|
+
.tasks .acts { position: absolute; inset: 0 0 auto auto; min-height: 18px; display: none; align-items: center; padding-left: 14px; background: linear-gradient(to right, transparent, var(--deictic-bg) 12px); }
|
|
53
|
+
.tasks li:hover .acts, .tasks li:focus-within .acts { display: flex; }
|
|
54
|
+
.tasks .act { display: inline-flex; padding: 2px; border: 0; color: var(--deictic-muted); }
|
|
31
55
|
.tasks .act:hover { color: var(--deictic-fg); }
|
|
32
56
|
.tasks .act svg { width: 12px; height: 12px; }
|
|
57
|
+
.tasks .place { flex: none; padding: 0; border: 0; font: 11px ui-monospace, monospace; color: var(--deictic-muted); }
|
|
58
|
+
.tasks button.place:hover { color: var(--deictic-fg); text-decoration: underline; }
|
|
59
|
+
.more { margin: 0 0 8px; }
|
|
60
|
+
.more[hidden] { display: none; }
|
|
61
|
+
.more summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }
|
|
62
|
+
.more summary:hover { color: var(--deictic-fg); }
|
|
63
|
+
.more .tasks { margin: 4px 0 0; }
|
|
33
64
|
.tasks li.editing { display: grid; }
|
|
34
65
|
.tasks li.editing .row { margin-top: 0; }
|
|
35
66
|
.tasks li.editing .actions { display: flex; gap: 6px; }
|
|
36
67
|
textarea { min-height: 64px; resize: vertical; font: 13px/1.4 system-ui, sans-serif; }
|
|
37
68
|
.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }
|
|
38
|
-
|
|
69
|
+
/* Cut short before it pushes Add out: a channel's name and its watchers' may be long. */
|
|
70
|
+
.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }
|
|
71
|
+
/* A dot as a task's state is: a ring while no one watches, green while someone does. */
|
|
72
|
+
.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }
|
|
73
|
+
.watch.on::before { border-color: #4ade80; background: #4ade80; }
|
|
39
74
|
.hint a { color: inherit; }
|
|
40
75
|
.hint a:hover { color: var(--deictic-fg); }
|
|
41
76
|
.shot { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; color: var(--deictic-muted); }
|
|
@@ -60,6 +95,8 @@ textarea { min-height: 64px; resize: vertical; font: 13px/1.4 system-ui, sans-se
|
|
|
60
95
|
const ICON = (path) => `<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="${path}"/></svg>`;
|
|
61
96
|
const EDIT = ICON("M4 20h4L19 9l-4-4L4 16z");
|
|
62
97
|
const DELETE = ICON("M4 7h16M10 7V4h4v3M6 7l1 13h10l1-13");
|
|
98
|
+
/** The states of a task that's over, as a board names them: nothing more happens to it. */
|
|
99
|
+
const OVER = /* @__PURE__ */ new Set(["completed", "failed"]);
|
|
63
100
|
const PLAY = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>";
|
|
64
101
|
/** Marks as a task tells of them: how many, and what the notes say. */
|
|
65
102
|
function marksOf(list) {
|
|
@@ -101,6 +138,74 @@ function pathTo(inner, outer) {
|
|
|
101
138
|
}
|
|
102
139
|
return steps.join(" > ");
|
|
103
140
|
}
|
|
141
|
+
const parentOf = (el) => {
|
|
142
|
+
if (el.parentElement !== null) return el.parentElement;
|
|
143
|
+
const root = el.getRootNode();
|
|
144
|
+
return root instanceof ShadowRoot ? root.host : void 0;
|
|
145
|
+
};
|
|
146
|
+
/** How many places a chain names after the element's own. */
|
|
147
|
+
const CHAIN = 5;
|
|
148
|
+
/**
|
|
149
|
+
* The source `el` rendered through, after its own file, nearest first, each a `file:line`: a shared component's
|
|
150
|
+
* own line is the same wherever it's used, and what uses it is the next file out (or a component between them,
|
|
151
|
+
* which is why there are several). Read off the marks around it, the only trace of source the page has: each
|
|
152
|
+
* place is the nearest element the next file wrote, which is where, in that file, the one before is used.
|
|
153
|
+
*/
|
|
154
|
+
function chainOf(el, file) {
|
|
155
|
+
const found = [];
|
|
156
|
+
let last = file;
|
|
157
|
+
for (let at = parentOf(el); at !== void 0 && found.length < CHAIN; at = parentOf(at)) {
|
|
158
|
+
const mark = at.getAttribute("data-deictic");
|
|
159
|
+
if (mark === null) continue;
|
|
160
|
+
const from = mark.replace(/:\d+:\d+$/, "");
|
|
161
|
+
if (from === last) continue;
|
|
162
|
+
last = from;
|
|
163
|
+
found.push(mark.replace(/:\d+$/, ""));
|
|
164
|
+
}
|
|
165
|
+
return found;
|
|
166
|
+
}
|
|
167
|
+
/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */
|
|
168
|
+
const HTML = 1e5;
|
|
169
|
+
/** The overlay's own green, as its outline of the element while the popup is open. */
|
|
170
|
+
const OUTLINE = "#12b358";
|
|
171
|
+
/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */
|
|
172
|
+
const ROOM = 3;
|
|
173
|
+
/**
|
|
174
|
+
* A shot's PNG with the element outlined in it: dashes around its box, white under them so they show on any
|
|
175
|
+
* page. The shot may have more pixels than its size in CSS ones, which the box is in.
|
|
176
|
+
*/
|
|
177
|
+
async function outlined(png, { box, size }) {
|
|
178
|
+
const url = typeof png === "string" ? png : URL.createObjectURL(png);
|
|
179
|
+
try {
|
|
180
|
+
const image = new Image();
|
|
181
|
+
image.src = url;
|
|
182
|
+
await image.decode();
|
|
183
|
+
const canvas = element("canvas", {
|
|
184
|
+
width: image.naturalWidth,
|
|
185
|
+
height: image.naturalHeight
|
|
186
|
+
});
|
|
187
|
+
const ctx = canvas.getContext("2d");
|
|
188
|
+
if (ctx === null) throw new Error("tasks: this browser won't draw to a canvas");
|
|
189
|
+
ctx.drawImage(image, 0, 0);
|
|
190
|
+
const k = image.naturalWidth / size.width;
|
|
191
|
+
const rect = [
|
|
192
|
+
(box.x - ROOM) * k,
|
|
193
|
+
(box.y - ROOM) * k,
|
|
194
|
+
(box.width + 6) * k,
|
|
195
|
+
(box.height + 6) * k
|
|
196
|
+
];
|
|
197
|
+
ctx.lineWidth = 4 * k;
|
|
198
|
+
ctx.strokeStyle = "#fff";
|
|
199
|
+
ctx.strokeRect(...rect);
|
|
200
|
+
ctx.lineWidth = 2 * k;
|
|
201
|
+
ctx.strokeStyle = OUTLINE;
|
|
202
|
+
ctx.setLineDash([6 * k, 4 * k]);
|
|
203
|
+
ctx.strokeRect(...rect);
|
|
204
|
+
return await new Promise((done, fail) => canvas.toBlob((blob) => blob === null ? fail(/* @__PURE__ */ new Error("tasks: the screenshot drew nothing")) : done(blob), "image/png"));
|
|
205
|
+
} finally {
|
|
206
|
+
if (typeof png !== "string") URL.revokeObjectURL(url);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
104
209
|
function element(tag, props = {}) {
|
|
105
210
|
return Object.assign(document.createElement(tag), props);
|
|
106
211
|
}
|
|
@@ -130,6 +235,7 @@ function announce(model, op, target) {
|
|
|
130
235
|
var client_default = defineClientPlugin({
|
|
131
236
|
name: "tasks",
|
|
132
237
|
label: "Task",
|
|
238
|
+
resume: ({ use }) => use("recordings")?.going(),
|
|
133
239
|
mount: (panel, context) => {
|
|
134
240
|
const style = element("style", { textContent: STYLE });
|
|
135
241
|
const list = element("ul", { className: "tasks" });
|
|
@@ -142,17 +248,27 @@ var client_default = defineClientPlugin({
|
|
|
142
248
|
const hint = element("span", { className: "hint" });
|
|
143
249
|
const row = element("div", { className: "row" });
|
|
144
250
|
row.append(hint, add);
|
|
145
|
-
|
|
251
|
+
const fold = element("details", { className: "more" });
|
|
252
|
+
const count = element("summary");
|
|
253
|
+
const others = element("ul", { className: "tasks" });
|
|
254
|
+
fold.append(count, others);
|
|
255
|
+
const closed = element("details", { className: "more" });
|
|
256
|
+
const closedCount = element("summary");
|
|
257
|
+
const ended = element("ul", { className: "tasks" });
|
|
258
|
+
closed.append(closedCount, ended);
|
|
259
|
+
panel.append(style, list, closed, fold, text);
|
|
146
260
|
const shots = context.use("screenshots");
|
|
261
|
+
const here = context.element.isConnected;
|
|
147
262
|
const notes = context.use("annotations");
|
|
148
263
|
const recorder = context.use("recordings");
|
|
149
264
|
const voice = context.use("voice");
|
|
265
|
+
const sendsHtml = context.options?.html !== false;
|
|
150
266
|
const aborts = new AbortController();
|
|
151
267
|
const attach = element("input", {
|
|
152
268
|
type: "checkbox",
|
|
153
269
|
checked: true
|
|
154
270
|
});
|
|
155
|
-
const toggle = element("label", { hidden: shots === void 0 });
|
|
271
|
+
const toggle = element("label", { hidden: shots === void 0 || !here });
|
|
156
272
|
toggle.append(attach, "Attach a screenshot");
|
|
157
273
|
const annotate = element("button", {
|
|
158
274
|
type: "button",
|
|
@@ -170,7 +286,7 @@ var client_default = defineClientPlugin({
|
|
|
170
286
|
title: "Record your voice, here"
|
|
171
287
|
});
|
|
172
288
|
const actions = element("span", { className: "actions" });
|
|
173
|
-
actions.append(...shots !== void 0 && notes !== void 0 ? [annotate] : []);
|
|
289
|
+
actions.append(...shots !== void 0 && notes !== void 0 && here ? [annotate] : []);
|
|
174
290
|
const shot = element("div", { className: "shot" });
|
|
175
291
|
shot.append(toggle, actions);
|
|
176
292
|
const chipsEl = element("div", { className: "chips" });
|
|
@@ -181,6 +297,15 @@ var client_default = defineClientPlugin({
|
|
|
181
297
|
});
|
|
182
298
|
const problem = element("div", { className: "shot-problem" });
|
|
183
299
|
if (shots !== void 0 || recorder !== void 0 || voice !== void 0) panel.append(shot, chipsEl, problem);
|
|
300
|
+
const withHtml = element("input", {
|
|
301
|
+
type: "checkbox",
|
|
302
|
+
checked: true
|
|
303
|
+
});
|
|
304
|
+
const htmlToggle = element("label", { title: "The element as the page has it now, as a file: element.html" });
|
|
305
|
+
htmlToggle.append(withHtml, "Attach HTML snapshot");
|
|
306
|
+
const htmlRow = element("div", { className: "shot" });
|
|
307
|
+
htmlRow.append(htmlToggle);
|
|
308
|
+
if (sendsHtml) panel.append(htmlRow);
|
|
184
309
|
panel.append(row);
|
|
185
310
|
let chips = [];
|
|
186
311
|
let recordings = [];
|
|
@@ -273,7 +398,7 @@ var client_default = defineClientPlugin({
|
|
|
273
398
|
voices = voices.filter((x) => x !== v);
|
|
274
399
|
dropped();
|
|
275
400
|
});
|
|
276
|
-
}), ...attached && shots !== void 0 && notes !== void 0 ? [another] : [], ...attached ? more() : []);
|
|
401
|
+
}), ...attached && shots !== void 0 && notes !== void 0 && here ? [another] : [], ...attached ? more() : []);
|
|
277
402
|
able();
|
|
278
403
|
mark();
|
|
279
404
|
};
|
|
@@ -347,9 +472,11 @@ var client_default = defineClientPlugin({
|
|
|
347
472
|
const kept = {
|
|
348
473
|
text: text.value,
|
|
349
474
|
attach: attach.checked,
|
|
475
|
+
html: withHtml.checked,
|
|
350
476
|
drawn,
|
|
351
477
|
recordings,
|
|
352
|
-
voices
|
|
478
|
+
voices,
|
|
479
|
+
facts: facts()
|
|
353
480
|
};
|
|
354
481
|
context.away(kept, () => recorder.record());
|
|
355
482
|
});
|
|
@@ -405,6 +532,7 @@ var client_default = defineClientPlugin({
|
|
|
405
532
|
};
|
|
406
533
|
speak.addEventListener("click", () => void (take === void 0 ? speakOn() : speakOff()));
|
|
407
534
|
let editing;
|
|
535
|
+
const whole = /* @__PURE__ */ new Set();
|
|
408
536
|
let edited;
|
|
409
537
|
/** Tells the popup what leaving now would lose: a listed task's changed words, or a new one's, typed, attached or being spoken. */
|
|
410
538
|
const mark = () => context.unsaved(edited ?? (text.value.trim() !== "" || attachedCount() > 0 || take !== void 0 ? add : void 0));
|
|
@@ -472,7 +600,7 @@ var client_default = defineClientPlugin({
|
|
|
472
600
|
const render = (model) => {
|
|
473
601
|
shown = model;
|
|
474
602
|
edited = void 0;
|
|
475
|
-
const { channel, link, tasks } = model;
|
|
603
|
+
const { channel, link, tasks, elsewhere, watching } = model;
|
|
476
604
|
const name = link === void 0 ? element("span") : element("a", {
|
|
477
605
|
href: link,
|
|
478
606
|
target: "_blank",
|
|
@@ -481,30 +609,86 @@ var client_default = defineClientPlugin({
|
|
|
481
609
|
});
|
|
482
610
|
name.textContent = `#${channel}`;
|
|
483
611
|
hint.replaceChildren("to ", name);
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
title: t.title
|
|
612
|
+
if (watching !== void 0) {
|
|
613
|
+
const names = new Intl.ListFormat("en", { type: "conjunction" }).format(watching);
|
|
614
|
+
const on = watching.length > 0;
|
|
615
|
+
const who = element("span", {
|
|
616
|
+
className: on ? "watch on" : "watch",
|
|
617
|
+
textContent: on ? `${names} watching` : "no agent watching",
|
|
618
|
+
title: on ? `${names} ${watching.length === 1 ? "is" : "are"} watching #${channel}, and take${watching.length === 1 ? "s" : ""} each task as it's added` : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`
|
|
492
619
|
});
|
|
620
|
+
hint.append(" · ", who);
|
|
621
|
+
}
|
|
622
|
+
/** A task's row: its state, its ID, a link where it has a page, its title, and where it's from when that's said. */
|
|
623
|
+
const rowOf = (t, from) => {
|
|
624
|
+
const item = element("li");
|
|
493
625
|
const state = element("span", {
|
|
494
626
|
className: `state ${t.state}`,
|
|
495
|
-
|
|
627
|
+
title: t.state
|
|
496
628
|
});
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
629
|
+
state.role = "img";
|
|
630
|
+
const id = element("code", { textContent: `#${t.id}` });
|
|
631
|
+
const title = element("button", {
|
|
632
|
+
type: "button",
|
|
633
|
+
className: "title"
|
|
634
|
+
});
|
|
635
|
+
const show = () => {
|
|
636
|
+
const all = whole.has(t.id);
|
|
637
|
+
item.classList.toggle("whole", all);
|
|
638
|
+
title.textContent = all ? t.text : t.title;
|
|
639
|
+
title.title = all ? "Show its first line only" : "Show all of it";
|
|
640
|
+
title.ariaExpanded = String(all);
|
|
641
|
+
};
|
|
642
|
+
title.addEventListener("click", () => {
|
|
643
|
+
if (!whole.delete(t.id)) whole.add(t.id);
|
|
644
|
+
show();
|
|
645
|
+
});
|
|
646
|
+
show();
|
|
647
|
+
const to = t.link === void 0 ? id : element("a", {
|
|
648
|
+
href: t.link,
|
|
649
|
+
target: "_blank",
|
|
650
|
+
rel: "noreferrer",
|
|
651
|
+
title: "Open the task on the board"
|
|
652
|
+
});
|
|
653
|
+
if (to !== id) to.append(id);
|
|
654
|
+
item.append(state, to, title, ...from === void 0 ? [] : [from]);
|
|
655
|
+
return item;
|
|
656
|
+
};
|
|
657
|
+
const { file } = context.target.loc;
|
|
658
|
+
fold.hidden = elsewhere.length === 0;
|
|
659
|
+
count.textContent = `${elsewhere.length} elsewhere in ${file.split("/").at(-1)}`;
|
|
660
|
+
others.replaceChildren(...elsewhere.map((t) => {
|
|
661
|
+
if (t.at === void 0) return rowOf(t);
|
|
662
|
+
const { line, column, tag } = t.at;
|
|
663
|
+
const name = `<${tag}> :${line}`;
|
|
664
|
+
const there = document.querySelector(`[data-deictic="${CSS.escape(`${file}:${line}:${column}`)}"]`);
|
|
665
|
+
if (there === null) return rowOf(t, element("span", {
|
|
666
|
+
className: "place",
|
|
667
|
+
textContent: name,
|
|
668
|
+
title: `Line ${line}, not on this page now`
|
|
669
|
+
}));
|
|
670
|
+
const go = element("button", {
|
|
671
|
+
type: "button",
|
|
672
|
+
className: "place",
|
|
673
|
+
textContent: name,
|
|
674
|
+
title: `Open the tasks of line ${line}`
|
|
675
|
+
});
|
|
676
|
+
go.addEventListener("click", () => void context.open("tasks", there));
|
|
677
|
+
return rowOf(t, go);
|
|
678
|
+
}));
|
|
679
|
+
const over = tasks.filter((t) => OVER.has(t.state));
|
|
680
|
+
closed.hidden = over.length === 0;
|
|
681
|
+
closedCount.textContent = `${over.length} closed`;
|
|
682
|
+
ended.replaceChildren(...over.map((t) => rowOf(t)));
|
|
683
|
+
const live = tasks.filter((t) => !OVER.has(t.state));
|
|
684
|
+
const grew = live.length > list.childElementCount;
|
|
685
|
+
list.replaceChildren(...live.map((t) => {
|
|
686
|
+
if (t.id === editing && t.open) return editor(t);
|
|
687
|
+
const item = rowOf(t, t.at === void 0 ? void 0 : element("span", {
|
|
688
|
+
className: "place",
|
|
689
|
+
textContent: `was :${t.at.line}`,
|
|
690
|
+
title: `Added when this was on line ${t.at.line}: it has moved since`
|
|
691
|
+
}));
|
|
508
692
|
if (!t.open) return item;
|
|
509
693
|
const edit = element("button", {
|
|
510
694
|
type: "button",
|
|
@@ -526,13 +710,44 @@ var client_default = defineClientPlugin({
|
|
|
526
710
|
remove.disabled = true;
|
|
527
711
|
change({ remove: t.id });
|
|
528
712
|
});
|
|
529
|
-
|
|
713
|
+
const acts = element("span", { className: "acts" });
|
|
714
|
+
acts.append(edit, remove);
|
|
715
|
+
item.append(acts);
|
|
530
716
|
return item;
|
|
531
717
|
}));
|
|
718
|
+
if (grew) list.scrollTop = list.scrollHeight;
|
|
532
719
|
able();
|
|
533
720
|
mark();
|
|
534
721
|
};
|
|
535
|
-
|
|
722
|
+
const back = context.resumed;
|
|
723
|
+
/**
|
|
724
|
+
* What the page says of the element: read now, while the page has it, and as the panel left it where the
|
|
725
|
+
* page has moved on without it (a recording that went on to another), which is the page the task is about.
|
|
726
|
+
*/
|
|
727
|
+
const facts = () => {
|
|
728
|
+
const { element: el, elements } = context;
|
|
729
|
+
if (!here && back !== void 0) return back.state.facts;
|
|
730
|
+
const chain = chainOf(el, context.target.loc.file);
|
|
731
|
+
return {
|
|
732
|
+
page: location.href,
|
|
733
|
+
viewport: {
|
|
734
|
+
width: innerWidth,
|
|
735
|
+
height: innerHeight
|
|
736
|
+
},
|
|
737
|
+
...context.pointed === void 0 ? {} : { pointed: {
|
|
738
|
+
path: pathTo(context.pointed, el),
|
|
739
|
+
html: context.pointed.outerHTML.slice(0, 4e3)
|
|
740
|
+
} },
|
|
741
|
+
count: elements.length,
|
|
742
|
+
...chain.length === 0 ? {} : { chain },
|
|
743
|
+
html: (shots?.masked(el) ?? el).outerHTML.slice(0, HTML)
|
|
744
|
+
};
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* The shots to attach: each chip's PNG, kept as a shot, as the person drew it, or a shot taken now where the
|
|
748
|
+
* box is ticked. Only that one has the element outlined in it (or is as it was taken, where that can't be
|
|
749
|
+
* drawn): nothing else in it says what it's about, while a shot someone annotated says what they marked.
|
|
750
|
+
*/
|
|
536
751
|
const screenshotsOf = async () => {
|
|
537
752
|
if (shots === void 0) return void 0;
|
|
538
753
|
if (chips.length > 0) {
|
|
@@ -543,13 +758,21 @@ var client_default = defineClientPlugin({
|
|
|
543
758
|
...marks.length === 0 ? {} : { marks: marksOf(marks) }
|
|
544
759
|
})));
|
|
545
760
|
}
|
|
546
|
-
if (!attach.checked || recordings.length > 0) return void 0;
|
|
761
|
+
if (!attach.checked || recordings.length > 0 || !here) return void 0;
|
|
547
762
|
add.textContent = "Capturing…";
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
763
|
+
const taken = await shots.capture(context.element);
|
|
764
|
+
try {
|
|
765
|
+
return [{
|
|
766
|
+
id: (await shots.upload(await outlined(taken.url, taken), taken)).id,
|
|
767
|
+
box: taken.box,
|
|
768
|
+
outlined: true
|
|
769
|
+
}];
|
|
770
|
+
} catch {
|
|
771
|
+
return [{
|
|
772
|
+
id: taken.id,
|
|
773
|
+
box: taken.box
|
|
774
|
+
}];
|
|
775
|
+
}
|
|
553
776
|
};
|
|
554
777
|
const send = async () => {
|
|
555
778
|
if (busy || sending) return;
|
|
@@ -569,20 +792,12 @@ var client_default = defineClientPlugin({
|
|
|
569
792
|
return;
|
|
570
793
|
}
|
|
571
794
|
add.textContent = "Add task";
|
|
572
|
-
const { element: el, elements } = context;
|
|
573
795
|
try {
|
|
796
|
+
const { html, ...said } = facts();
|
|
574
797
|
const op = {
|
|
575
798
|
text: text.value,
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
width: innerWidth,
|
|
579
|
-
height: innerHeight
|
|
580
|
-
},
|
|
581
|
-
...context.pointed === void 0 ? {} : { pointed: {
|
|
582
|
-
path: pathTo(context.pointed, el),
|
|
583
|
-
html: context.pointed.outerHTML.slice(0, 4e3)
|
|
584
|
-
} },
|
|
585
|
-
count: elements.length,
|
|
799
|
+
...said,
|
|
800
|
+
...sendsHtml && withHtml.checked ? { html } : {},
|
|
586
801
|
...screenshots === void 0 ? {} : { screenshots },
|
|
587
802
|
...recordings.length === 0 ? {} : { recordings: recordings.map(({ id, duration, url, voice: clips }) => ({
|
|
588
803
|
id,
|
|
@@ -605,11 +820,11 @@ var client_default = defineClientPlugin({
|
|
|
605
820
|
sending = false;
|
|
606
821
|
able();
|
|
607
822
|
};
|
|
608
|
-
const back = context.resumed;
|
|
609
823
|
if (back !== void 0) {
|
|
610
824
|
const kept = back.state;
|
|
611
825
|
text.value = kept.text;
|
|
612
826
|
attach.checked = kept.attach;
|
|
827
|
+
withHtml.checked = kept.html;
|
|
613
828
|
chips = kept.drawn.map(toChip);
|
|
614
829
|
recordings = [...kept.recordings, ...back.result === void 0 ? [] : [back.result]];
|
|
615
830
|
voices = kept.voices;
|