deictic 0.8.1 → 0.9.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 +71 -17
- package/README.md +1 -1
- package/dist/annotations/client.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +13 -13
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +11 -7
- package/dist/client/index.js.map +1 -1
- package/dist/react/client.d.ts +19 -0
- package/dist/react/client.d.ts.map +1 -0
- package/dist/react/client.js +504 -0
- package/dist/react/client.js.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +1 -0
- package/dist/recommended/index.d.ts +15 -7
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +48 -5
- package/dist/recordings/client.js.map +1 -1
- package/dist/screenshots/client.d.ts +9 -1
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/rrweb.d.ts +0 -6
- package/dist/screenshots/rrweb.d.ts.map +1 -1
- package/dist/screenshots/rrweb.js +46 -12
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/board.js +1 -1
- package/dist/shared/client.js +44 -2
- package/dist/shared/client.js.map +1 -1
- package/dist/shared/dom.js +7 -1
- package/dist/shared/dom.js.map +1 -1
- package/dist/shared/drawer.js +1 -1
- package/dist/shared/endpoints.js +1 -1
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index10.d.ts +70 -0
- package/dist/shared/index10.d.ts.map +1 -0
- package/dist/shared/index3.d.ts +11 -0
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index7.d.ts +92 -312
- package/dist/shared/index7.d.ts.map +1 -1
- package/dist/shared/index8.d.ts +324 -47
- package/dist/shared/index8.d.ts.map +1 -1
- package/dist/shared/index9.d.ts +45 -63
- package/dist/shared/index9.d.ts.map +1 -1
- package/dist/shared/init.js +15 -11
- package/dist/shared/init.js.map +1 -1
- package/dist/shared/marks.js +7 -1
- package/dist/shared/marks.js.map +1 -1
- package/dist/shared/package.js +3 -1
- package/dist/shared/packages.js +1 -1
- package/dist/shared/playwright.js +39 -1
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/react.js +25 -0
- package/dist/shared/react.js.map +1 -0
- package/dist/shared/recommended.js +6 -3
- package/dist/shared/recommended.js.map +1 -1
- package/dist/shared/recording.js +80 -3
- package/dist/shared/recording.js.map +1 -1
- package/dist/shared/recordings.js +30 -2
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/screenshots.js.map +1 -1
- package/dist/shared/src.js.map +1 -1
- package/dist/shared/task.js +1 -0
- package/dist/shared/task.js.map +1 -1
- package/dist/shared/tasks.js +11 -0
- 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.js +45 -19
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/voice/client.d.ts +1 -1
- package/dist/voice/client.js +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/package.json +25 -1
- package/src/cli/bun.ts +2 -2
- package/src/cli/init.ts +14 -9
- package/src/cli/recording.ts +90 -4
- package/src/cli/task.ts +4 -0
- package/src/cli.ts +13 -6
- package/src/client/dom.ts +14 -0
- package/src/client/index.ts +21 -14
- package/src/index.ts +6 -0
- package/src/plugins/react/client.ts +162 -0
- package/src/plugins/react/index.ts +130 -0
- package/src/plugins/react/renders.ts +219 -0
- package/src/plugins/react/serialize.ts +139 -0
- package/src/plugins/react/timeline.ts +143 -0
- package/src/plugins/recommended/index.ts +17 -5
- package/src/plugins/recordings/client.ts +64 -4
- package/src/plugins/recordings/marks.ts +7 -0
- package/src/plugins/recordings/replay.ts +30 -2
- package/src/plugins/screenshots/client.ts +42 -2
- package/src/plugins/screenshots/index.ts +11 -0
- package/src/plugins/screenshots/playwright.ts +65 -1
- package/src/plugins/screenshots/rrweb.ts +55 -28
- package/src/plugins/screenshots/states.ts +26 -0
- package/src/plugins/tasks/client.ts +41 -6
- package/src/plugins/tasks/composer.ts +24 -7
- package/src/plugins/tasks/index.ts +16 -2
|
@@ -221,11 +221,27 @@ export default defineClientPlugin<Model, Op>({
|
|
|
221
221
|
const unpin = over ? pinsIn(context).glance() : undefined;
|
|
222
222
|
|
|
223
223
|
const shots = context.use('screenshots');
|
|
224
|
+
// The page as the press that opened the popup froze it, rendered meanwhile: a shot taken as it's sent may have
|
|
225
|
+
// missed a tooltip or a menu, which the popup's own pointer and focus close.
|
|
226
|
+
const frozen = shots?.frozen(context.element);
|
|
224
227
|
const recorder = context.use('recordings');
|
|
225
228
|
const back = context.resumed;
|
|
226
229
|
// The server half's `html` option, which takes the button away; a page half with no options (a `standalone` server's) has it.
|
|
227
230
|
const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;
|
|
228
231
|
const own = (): About[] => [{ target: context.target, own: true, el: context.element }];
|
|
232
|
+
const inspector = context.use('react');
|
|
233
|
+
/**
|
|
234
|
+
* What React's DevTools would show of an element, where the react plugin is loaded: read now, while the page has
|
|
235
|
+
* it, or as the panel left it. A read that fails leaves it out, not the task.
|
|
236
|
+
*/
|
|
237
|
+
const reactOf = async (a: About): Promise<string | undefined> => {
|
|
238
|
+
const el = onPage(a);
|
|
239
|
+
if (el === undefined) return a.seen?.react;
|
|
240
|
+
return inspector?.snapshot(el).catch((e: unknown) => {
|
|
241
|
+
console.warn('deictic: the task goes without react.json', e);
|
|
242
|
+
return undefined;
|
|
243
|
+
});
|
|
244
|
+
};
|
|
229
245
|
|
|
230
246
|
/**
|
|
231
247
|
* What the page says of an element: read now, while the page has it, and as the panel left it where the page
|
|
@@ -273,10 +289,16 @@ export default defineClientPlugin<Model, Op>({
|
|
|
273
289
|
...(shot === undefined ? {} : { shot }),
|
|
274
290
|
html,
|
|
275
291
|
...wherever(about),
|
|
276
|
-
about:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
292
|
+
about: (
|
|
293
|
+
await Promise.all(
|
|
294
|
+
about.map(async (a) => {
|
|
295
|
+
const seen = seenOf(a);
|
|
296
|
+
if (seen === undefined) return [];
|
|
297
|
+
const react = sendsHtml && html ? await reactOf(a) : undefined;
|
|
298
|
+
return [{ target: a.target, own: a.own, seen: { ...seen, ...(react === undefined ? {} : { react }) } }];
|
|
299
|
+
}),
|
|
300
|
+
)
|
|
301
|
+
).flat(),
|
|
280
302
|
};
|
|
281
303
|
context.away(kept, () => recorder.record());
|
|
282
304
|
};
|
|
@@ -288,6 +310,7 @@ export default defineClientPlugin<Model, Op>({
|
|
|
288
310
|
html: sendsHtml,
|
|
289
311
|
...(context.at === undefined ? {} : { at: context.at }),
|
|
290
312
|
shoot: true,
|
|
313
|
+
...(frozen === undefined ? {} : { frozen }),
|
|
291
314
|
// Back from a recording on a page without the element: nothing of it to shoot or draw on here.
|
|
292
315
|
here: context.element.isConnected,
|
|
293
316
|
over,
|
|
@@ -297,15 +320,27 @@ export default defineClientPlugin<Model, Op>({
|
|
|
297
320
|
const { text, about, html: withHtml, screenshots } = gathered;
|
|
298
321
|
// The first element is the task's place; the rest are named beside it; with none, it's the page's.
|
|
299
322
|
const [first, ...rest] = about;
|
|
300
|
-
const { html, ...said } = (first === undefined ? undefined : seenOf(first)) ?? { html: undefined, count: 0 };
|
|
323
|
+
const { html, react: _, ...said } = (first === undefined ? undefined : seenOf(first)) ?? { html: undefined, count: 0 };
|
|
301
324
|
const htmlOf = (of: string | undefined) => (sendsHtml && withHtml && of !== undefined ? { html: of } : {});
|
|
325
|
+
// Its components' props and state go with its HTML, as what the page had.
|
|
326
|
+
const reactWith = async (a: About) => {
|
|
327
|
+
const react = sendsHtml && withHtml ? await reactOf(a) : undefined;
|
|
328
|
+
return react === undefined ? {} : { react };
|
|
329
|
+
};
|
|
302
330
|
const op: Op = {
|
|
303
331
|
text,
|
|
304
332
|
...wherever(about),
|
|
305
333
|
...said,
|
|
306
334
|
...(first === undefined ? { detached: true } : {}),
|
|
307
335
|
...htmlOf(html),
|
|
308
|
-
...(
|
|
336
|
+
...(first === undefined ? {} : await reactWith(first)),
|
|
337
|
+
...(rest.length === 0
|
|
338
|
+
? {}
|
|
339
|
+
: {
|
|
340
|
+
also: await Promise.all(
|
|
341
|
+
rest.map(async (a) => ({ at: atOf(a.target), tag: a.target.tag, ...htmlOf(seenOf(a)?.html), ...(await reactWith(a)) })),
|
|
342
|
+
),
|
|
343
|
+
}),
|
|
309
344
|
...attachedOf(gathered),
|
|
310
345
|
};
|
|
311
346
|
// Sent on its first element, which may not be the popup's.
|
|
@@ -26,7 +26,7 @@ import type { ClientContext, LightboxItem, Point, Target } from '#src/index.ts';
|
|
|
26
26
|
// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.
|
|
27
27
|
import type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';
|
|
28
28
|
import type { Recording } from '#src/plugins/recordings/index.ts';
|
|
29
|
-
import type { Shot } from '#src/plugins/screenshots/index.ts';
|
|
29
|
+
import type { Capture, Shot } from '#src/plugins/screenshots/index.ts';
|
|
30
30
|
import type { Clip, Take } from '#src/plugins/voice/index.ts';
|
|
31
31
|
|
|
32
32
|
import type { Marks, Op } from './index.ts';
|
|
@@ -134,6 +134,8 @@ export type Sent = NonNullable<Op['screenshots']>[number] & { url: string };
|
|
|
134
134
|
export interface Seen extends Pick<Op, 'point' | 'pointed' | 'count' | 'which' | 'chain'> {
|
|
135
135
|
/** The element's HTML, as it would be attached. */
|
|
136
136
|
html: string;
|
|
137
|
+
/** What React's DevTools would show of it, `react.json`, where the react plugin is loaded and React wrote it. */
|
|
138
|
+
react?: string;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
/**
|
|
@@ -211,6 +213,11 @@ export interface ComposerOptions {
|
|
|
211
213
|
at?: Point;
|
|
212
214
|
/** Whether a shot is taken as it's sent, while nothing else is attached and none was asked for or not: a task's. */
|
|
213
215
|
shoot?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* The popup's own element as the press that opened it froze the page (`screenshots.frozen`): what a shot of it is,
|
|
218
|
+
* rather than the page as it is when it's sent, by which time a tooltip or a menu may have closed.
|
|
219
|
+
*/
|
|
220
|
+
frozen?: Promise<Shot>;
|
|
214
221
|
/** Whether this page has what's shot and drawn on: not for a task back from a recording on a page without it. */
|
|
215
222
|
here?: boolean;
|
|
216
223
|
/** Whether it's over the page, in the overlay's root: a press on the page picks an element, and attached ones are outlined. */
|
|
@@ -309,10 +316,20 @@ export function composerIn(context: ClientContext, options: ComposerOptions): Co
|
|
|
309
316
|
|
|
310
317
|
const text = element('textarea', { placeholder: options.placeholder, rows: 1 });
|
|
311
318
|
const chipsEl = element('div', { className: 'chips' });
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
319
|
+
/** A shot of `of`: as the press froze it, where it's the popup's own element still first, else as the page is now. */
|
|
320
|
+
const shotOf = (s: Capture, of: Element) => {
|
|
321
|
+
const frozen = about[0]?.own === true && onPage(about[0]) === of ? options.frozen : undefined;
|
|
322
|
+
return frozen === undefined ? s.capture(of) : frozen.catch(() => s.capture(of));
|
|
323
|
+
};
|
|
324
|
+
const camera = toolButton(
|
|
325
|
+
CAMERA,
|
|
326
|
+
options.frozen === undefined ? `Attach a screenshot, taken as it's sent` : 'Attach a screenshot of the page as it was when you pressed',
|
|
327
|
+
undefined,
|
|
328
|
+
() => {
|
|
329
|
+
wanted = !shooting();
|
|
330
|
+
showChips();
|
|
331
|
+
},
|
|
332
|
+
);
|
|
316
333
|
camera.hidden = shots === undefined || !here;
|
|
317
334
|
const code = toolButton(CODE, 'Attach an HTML snapshot: the element as the page has it now, as a file', undefined, () => {
|
|
318
335
|
withHtml = !withHtml;
|
|
@@ -541,7 +558,7 @@ export function composerIn(context: ClientContext, options: ComposerOptions): Co
|
|
|
541
558
|
problem.textContent = '';
|
|
542
559
|
try {
|
|
543
560
|
if (old === undefined) doing.textContent = 'Capturing…';
|
|
544
|
-
const shot = old?.drawn?.shot ?? (await shots
|
|
561
|
+
const shot = old?.drawn?.shot ?? (await shotOf(shots, onPage(about[0]) ?? document.documentElement));
|
|
545
562
|
doing.textContent = '';
|
|
546
563
|
const picture: Picture = { url: shot.url, ...shot.size };
|
|
547
564
|
const marks = await notes.edit(picture, old?.drawn?.marks ?? [], { signal: aborts.signal });
|
|
@@ -676,7 +693,7 @@ export function composerIn(context: ClientContext, options: ComposerOptions): Co
|
|
|
676
693
|
// Of the first element, which the shot then says the place of; of the page, with none on it.
|
|
677
694
|
const first = onPage(about[0]);
|
|
678
695
|
const of = first ?? document.documentElement;
|
|
679
|
-
const now = await shots
|
|
696
|
+
const now = await shotOf(shots, of);
|
|
680
697
|
const where = first === undefined ? {} : { box: now.box };
|
|
681
698
|
// The others as the page has them, moved by as much as the shot has the first off where the page has it.
|
|
682
699
|
const live = of.getBoundingClientRect();
|
|
@@ -229,7 +229,7 @@ export interface Op {
|
|
|
229
229
|
* The other elements it's about, after the one it's sent on, in the order they were attached: each one's place,
|
|
230
230
|
* its tag, and its HTML as it rendered, where that's attached.
|
|
231
231
|
*/
|
|
232
|
-
also?: { at: string; tag: string; html?: string }[];
|
|
232
|
+
also?: { at: string; tag: string; html?: string; react?: string }[];
|
|
233
233
|
/**
|
|
234
234
|
* No element is attached: it's about the page, and the element it's sent on is only where the popup was. It has
|
|
235
235
|
* no place then, so no element's tab lists it and nothing pins it.
|
|
@@ -244,6 +244,11 @@ export interface Op {
|
|
|
244
244
|
chain?: string[];
|
|
245
245
|
/** The element's HTML as it rendered, to attach: cut short, and masked where the screenshots plugin is loaded. */
|
|
246
246
|
html?: string;
|
|
247
|
+
/**
|
|
248
|
+
* What React's DevTools would show of the components that wrote it, as JSON, to attach as `react.json`: where the
|
|
249
|
+
* react plugin is loaded, and sent with the HTML.
|
|
250
|
+
*/
|
|
251
|
+
react?: string;
|
|
247
252
|
/**
|
|
248
253
|
* Shots the screenshots plugin took, to attach, where that plugin is loaded: each with where the element is in
|
|
249
254
|
* it (`box`, for one taken of the element; one taken of the window from the tool panel has none), whether
|
|
@@ -607,8 +612,14 @@ export function tasks(options: TasksOptions = {}) {
|
|
|
607
612
|
if (html !== undefined) files.push({ data: new TextEncoder().encode(html.slice(0, HTML)), name: 'element.html', type: 'text/html' });
|
|
608
613
|
else if (op.pointed !== undefined)
|
|
609
614
|
files.push({ data: new TextEncoder().encode(op.pointed.html.slice(0, HTML)), name: 'pointed.html', type: 'text/html' });
|
|
615
|
+
const json = (of: unknown, name: string) => {
|
|
616
|
+
if (typeof of === 'string' && of !== '')
|
|
617
|
+
files.push({ data: new TextEncoder().encode(of.slice(0, REACT)), name, type: 'application/json' });
|
|
618
|
+
};
|
|
619
|
+
json(op.react, 'react.json');
|
|
610
620
|
// The others': the Nth element's is `element.N.html`, the first being the one it's sent on.
|
|
611
621
|
for (const [i, other] of (op.also ?? []).entries()) {
|
|
622
|
+
json(other.react, `react.${i + 2}.json`);
|
|
612
623
|
if (typeof other.html !== 'string' || other.html === '') continue;
|
|
613
624
|
files.push({ data: new TextEncoder().encode(other.html.slice(0, HTML)), name: `element.${i + 2}.html`, type: 'text/html' });
|
|
614
625
|
}
|
|
@@ -845,7 +856,7 @@ function textPage(name: string, text: string): string {
|
|
|
845
856
|
type Kind = 'screenshot' | 'recording' | 'voice clip' | 'voice note';
|
|
846
857
|
|
|
847
858
|
/** What a task or a reply attaches: files, and what the labels say of them. */
|
|
848
|
-
type Attaching = Partial<Pick<Op, 'screenshots' | 'recordings' | 'voice' | 'annotations' | 'html' | 'pointed' | 'also'>>;
|
|
859
|
+
type Attaching = Partial<Pick<Op, 'screenshots' | 'recordings' | 'voice' | 'annotations' | 'html' | 'react' | 'pointed' | 'also'>>;
|
|
849
860
|
|
|
850
861
|
/**
|
|
851
862
|
* A message's files, as the drawer shows them: each recording with where it replays, which its
|
|
@@ -913,6 +924,9 @@ const boxOf = ({ x, y, width, height }: Box) => [x, y, width, height].map(Math.r
|
|
|
913
924
|
/** What `element.html` holds of an element at most, in characters: a table's rows, not a whole page. */
|
|
914
925
|
const HTML = 100_000;
|
|
915
926
|
|
|
927
|
+
/** What `react.json` holds at most, in characters: the page half cuts it to less. */
|
|
928
|
+
const REACT = 250_000;
|
|
929
|
+
|
|
916
930
|
/** A label's value: a board holds 256 characters. */
|
|
917
931
|
const LABEL = 256;
|
|
918
932
|
|