@devaccel-labs/app-comments-toolbar 1.1.0 → 1.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/README.md +148 -30
- package/dist/react.js +417 -64
- package/dist/server.js +342 -14
- package/dist/types/capture/api.d.ts +30 -0
- package/dist/types/capture/editor.d.ts +10 -0
- package/dist/types/capture/ignore.d.ts +19 -0
- package/dist/types/capture/index.d.ts +1 -0
- package/dist/types/capture/picker.d.ts +9 -0
- package/dist/types/capture/picture.d.ts +29 -0
- package/dist/types/capture/surface.d.ts +39 -0
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/resolve.d.ts +2 -1
- package/dist/types/core/types.d.ts +11 -0
- package/dist/types/debug-context.d.ts +7 -0
- package/dist/types/dictation.d.ts +9 -0
- package/dist/types/embed/controller.d.ts +61 -0
- package/dist/types/embed/index.d.ts +1 -0
- package/dist/types/embed/options.d.ts +35 -0
- package/dist/types/help/index.d.ts +1 -0
- package/dist/types/help/panel-index.d.ts +1 -0
- package/dist/types/help/panel-styles.d.ts +1 -0
- package/dist/types/help/panel.d.ts +4 -0
- package/dist/types/help/pill-styles.d.ts +11 -0
- package/dist/types/help/pill.d.ts +44 -0
- package/dist/types/help/react.d.ts +12 -0
- package/dist/types/help/requests.d.ts +2 -0
- package/dist/types/help/types.d.ts +119 -0
- package/dist/types/help/wire.d.ts +61 -0
- package/dist/types/native-wire.d.ts +63 -0
- package/dist/types/native.d.ts +43 -0
- package/dist/types/react.d.ts +7 -0
- package/dist/types/replay.d.ts +6 -0
- package/dist/types/runtime/api.d.ts +250 -0
- package/dist/types/runtime/attachment-model.d.ts +16 -0
- package/dist/types/runtime/attachments.d.ts +43 -7
- package/dist/types/runtime/boot.d.ts +39 -0
- package/dist/types/runtime/browser-label.d.ts +5 -0
- package/dist/types/runtime/build-id.d.ts +1 -0
- package/dist/types/runtime/capture-ui.d.ts +45 -21
- package/dist/types/runtime/clarity-model.d.ts +260 -0
- package/dist/types/runtime/clarity-ui.d.ts +62 -0
- package/dist/types/runtime/client.d.ts +6 -197
- package/dist/types/runtime/composer-size.d.ts +30 -0
- package/dist/types/runtime/dashboard.d.ts +17 -2
- package/dist/types/runtime/debug-context-core.d.ts +88 -0
- package/dist/types/runtime/debug-context-host.d.ts +39 -0
- package/dist/types/runtime/debug-context-model.d.ts +352 -0
- package/dist/types/runtime/debug-context-redact.d.ts +48 -0
- package/dist/types/runtime/debug-context.d.ts +36 -0
- package/dist/types/runtime/details-model.d.ts +7 -0
- package/dist/types/runtime/details.d.ts +7 -5
- package/dist/types/runtime/dictation-engine.d.ts +98 -0
- package/dist/types/runtime/dictation-model.d.ts +28 -0
- package/dist/types/runtime/dictation-ui.d.ts +56 -0
- package/dist/types/runtime/dictation.d.ts +66 -0
- package/dist/types/runtime/draft-dock.d.ts +32 -0
- package/dist/types/runtime/draft-model.d.ts +104 -0
- package/dist/types/runtime/draft-store.d.ts +15 -0
- package/dist/types/runtime/edits.d.ts +1 -1
- package/dist/types/runtime/font.d.ts +16 -0
- package/dist/types/runtime/format.d.ts +30 -1
- package/dist/types/runtime/host-watch.d.ts +20 -0
- package/dist/types/runtime/icons.d.ts +16 -2
- package/dist/types/runtime/index.d.ts +2 -0
- package/dist/types/runtime/ink.d.ts +8 -0
- package/dist/types/runtime/kind-model.d.ts +14 -0
- package/dist/types/runtime/live-model.d.ts +25 -0
- package/dist/types/runtime/loader.d.ts +5 -3
- package/dist/types/runtime/markup-editor.d.ts +54 -0
- package/dist/types/runtime/markup-model.d.ts +126 -0
- package/dist/types/runtime/markup.d.ts +69 -0
- package/dist/types/runtime/mention-parse.d.ts +18 -0
- package/dist/types/runtime/mentions.d.ts +4 -4
- package/dist/types/runtime/page-background.d.ts +9 -0
- package/dist/types/runtime/page-image.d.ts +64 -11
- package/dist/types/runtime/placement.d.ts +6 -3
- package/dist/types/runtime/record.d.ts +18 -2
- package/dist/types/runtime/related.d.ts +1 -1
- package/dist/types/runtime/replay-model.d.ts +80 -0
- package/dist/types/runtime/replay.d.ts +5 -38
- package/dist/types/runtime/screen.d.ts +47 -0
- package/dist/types/runtime/screenshot.d.ts +60 -8
- package/dist/types/runtime/session-source.d.ts +45 -0
- package/dist/types/runtime/session.d.ts +20 -18
- package/dist/types/runtime/shield.d.ts +9 -0
- package/dist/types/runtime/shot.d.ts +45 -0
- package/dist/types/runtime/sketch.d.ts +26 -0
- package/dist/types/runtime/styles.d.ts +1 -1
- package/dist/types/runtime/sync.d.ts +1 -0
- package/dist/types/runtime/thread-model.d.ts +18 -0
- package/dist/types/runtime/ticket-form-model.d.ts +57 -0
- package/dist/types/runtime/ticket-form.d.ts +9 -0
- package/dist/types/runtime/toolbar.d.ts +37 -1
- package/dist/types/runtime/ui-scale.d.ts +17 -0
- package/dist/types/runtime/update.d.ts +32 -8
- package/dist/types/runtime/use-debug-context.d.ts +27 -0
- package/dist/types/server/index.d.ts +22 -0
- package/dist/types/server/support.d.ts +20 -0
- package/dist/types/server.d.ts +2 -0
- package/dist/types/vite/plugin.d.ts +15 -0
- package/dist/vite.js +121 -41
- package/package.json +24 -11
- package/src/capture/api.ts +128 -0
- package/src/capture/editor.tsx +178 -0
- package/src/capture/ignore.ts +38 -0
- package/src/capture/index.ts +27 -0
- package/src/capture/picker.tsx +171 -0
- package/src/capture/picture.ts +90 -0
- package/src/capture/surface.tsx +185 -0
- package/src/compiler/annotate.ts +202 -0
- package/src/compiler/babel.d.ts +11 -0
- package/src/compiler/enabled.ts +55 -0
- package/src/compiler/index.ts +2 -0
- package/src/core/index.ts +8 -0
- package/src/core/resolve.ts +307 -0
- package/src/core/types.ts +58 -0
- package/src/debug-context.ts +47 -0
- package/src/dictation.ts +17 -0
- package/src/embed/controller.ts +215 -0
- package/src/embed/index.ts +68 -0
- package/src/embed/options.ts +100 -0
- package/src/help/index.ts +38 -0
- package/src/help/panel-index.ts +17 -0
- package/src/help/panel-styles.ts +123 -0
- package/src/help/panel.ts +840 -0
- package/src/help/pill-styles.ts +75 -0
- package/src/help/pill.ts +338 -0
- package/src/help/react.tsx +143 -0
- package/src/help/requests.ts +111 -0
- package/src/help/types.ts +124 -0
- package/src/help/wire.ts +55 -0
- package/src/native-wire.ts +124 -0
- package/src/native.ts +282 -0
- package/src/react.ts +27 -0
- package/src/replay.ts +13 -0
- package/src/runtime/api.ts +531 -0
- package/src/runtime/attachment-model.ts +42 -0
- package/src/runtime/attachments.tsx +1260 -0
- package/src/runtime/boot.ts +95 -0
- package/src/runtime/browser-label.ts +31 -0
- package/src/runtime/build-id.ts +10 -0
- package/src/runtime/capture-ui.tsx +306 -0
- package/src/runtime/capture.ts +508 -0
- package/src/runtime/clarity-model.ts +634 -0
- package/src/runtime/clarity-ui.tsx +454 -0
- package/src/runtime/client.ts +151 -0
- package/src/runtime/composer-size.tsx +146 -0
- package/src/runtime/dashboard.tsx +1130 -0
- package/src/runtime/debug-context-core.ts +681 -0
- package/src/runtime/debug-context-host.ts +56 -0
- package/src/runtime/debug-context-model.ts +1319 -0
- package/src/runtime/debug-context-redact.ts +259 -0
- package/src/runtime/debug-context.ts +613 -0
- package/src/runtime/details-model.ts +30 -0
- package/src/runtime/details.tsx +395 -0
- package/src/runtime/dictation-engine.ts +616 -0
- package/src/runtime/dictation-model.ts +79 -0
- package/src/runtime/dictation-ui.tsx +363 -0
- package/src/runtime/dictation.ts +271 -0
- package/src/runtime/dock.ts +108 -0
- package/src/runtime/draft-dock.tsx +124 -0
- package/src/runtime/draft-model.ts +251 -0
- package/src/runtime/draft-store.ts +149 -0
- package/src/runtime/edits.tsx +165 -0
- package/src/runtime/font.ts +42 -0
- package/src/runtime/format.ts +129 -0
- package/src/runtime/freshness.ts +23 -0
- package/src/runtime/handoff.ts +76 -0
- package/src/runtime/host-watch.ts +64 -0
- package/src/runtime/icons.tsx +295 -0
- package/src/runtime/idle.ts +20 -0
- package/src/runtime/index.ts +11 -0
- package/src/runtime/ink.ts +6 -0
- package/src/runtime/kind-model.ts +20 -0
- package/src/runtime/live-model.ts +32 -0
- package/src/runtime/loader.tsx +87 -0
- package/src/runtime/markup-editor.tsx +1333 -0
- package/src/runtime/markup-model.ts +485 -0
- package/src/runtime/markup.ts +382 -0
- package/src/runtime/members.ts +58 -0
- package/src/runtime/mention-parse.ts +56 -0
- package/src/runtime/mentions.tsx +205 -0
- package/src/runtime/page-background.ts +51 -0
- package/src/runtime/page-image.ts +1592 -0
- package/src/runtime/placement.ts +336 -0
- package/src/runtime/record.ts +402 -0
- package/src/runtime/redact.ts +30 -0
- package/src/runtime/related.ts +34 -0
- package/src/runtime/render-page.ts +2 -0
- package/src/runtime/replay-model.ts +232 -0
- package/src/runtime/replay.ts +173 -0
- package/src/runtime/runtime-version.ts +7 -0
- package/src/runtime/runtime.tsx +51 -0
- package/src/runtime/screen.ts +182 -0
- package/src/runtime/screenshot.ts +260 -0
- package/src/runtime/session-source.ts +112 -0
- package/src/runtime/session.ts +108 -0
- package/src/runtime/shield.ts +34 -0
- package/src/runtime/shot.tsx +422 -0
- package/src/runtime/sketch.ts +139 -0
- package/src/runtime/styles.ts +1541 -0
- package/src/runtime/sync.ts +300 -0
- package/src/runtime/thread-model.ts +71 -0
- package/src/runtime/ticket-form-model.ts +128 -0
- package/src/runtime/ticket-form.tsx +342 -0
- package/src/runtime/toolbar.tsx +4427 -0
- package/src/runtime/ui-scale.ts +75 -0
- package/src/runtime/update.ts +98 -0
- package/src/runtime/use-debug-context.ts +81 -0
- package/src/server/index.ts +133 -0
- package/src/server/support.ts +499 -0
- package/src/server.ts +4 -0
- package/src/vite/plugin.ts +102 -0
- package/src/vite.ts +1 -0
|
@@ -1,14 +1,66 @@
|
|
|
1
|
+
import type { Sketch } from "../core/index.js";
|
|
1
2
|
import type { Capture } from "./client.js";
|
|
2
3
|
/** The page, viewport and browser a screenshot is being taken in. */
|
|
3
4
|
export declare function describeCapture(url: string): Capture;
|
|
4
|
-
/**
|
|
5
|
+
/** A box in CSS pixels from the top-left of the viewport. */
|
|
6
|
+
export type Frame = {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
};
|
|
12
|
+
export type Viewport = {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
/** `rect` as a frame, or null when none of it is inside the viewport. */
|
|
17
|
+
export declare function frameOf(rect: DOMRect | Frame, viewport: Viewport): Frame | null;
|
|
18
|
+
/** The ring drawn around `frame`, in output pixels, when the picture is `scale` output pixels per CSS pixel. */
|
|
19
|
+
export declare function ringFor(frame: Frame, scale: number, origin?: {
|
|
20
|
+
left: number;
|
|
21
|
+
top: number;
|
|
22
|
+
}): {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
w: number;
|
|
26
|
+
h: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The part of the viewport a crop around `frame` shows: the element and its drawing with room around them, at
|
|
30
|
+
* least `CROP_MIN`, never beyond the viewport, centred on the element as far as the viewport allows.
|
|
31
|
+
*/
|
|
32
|
+
export declare function cropFor(frame: Frame, viewport: Viewport, sketch?: Sketch): Frame;
|
|
33
|
+
/**
|
|
34
|
+
* The page as it was at one instant: a copy of its DOM and, if an element was being pointed at, that element's
|
|
35
|
+
* box in the viewport at the same instant. Drawing the copy happens later and takes a while; measuring the
|
|
36
|
+
* element then instead would put its ring wherever the element had moved to in the meantime.
|
|
37
|
+
*/
|
|
38
|
+
export type PageShot = {
|
|
39
|
+
/** The highlighted element's box when the page was copied; null when nothing was, or it was off screen. */
|
|
40
|
+
frame: Frame | null;
|
|
41
|
+
viewport: Viewport;
|
|
42
|
+
/** Device pixels per CSS pixel the drawing is made at. */
|
|
43
|
+
scale: number;
|
|
44
|
+
/** The drawing, made once on the first request and shared by every picture cut from this shot. */
|
|
45
|
+
render: () => Promise<HTMLCanvasElement>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Copies the visible page now, synchronously, with `highlight`'s box measured at the same moment. The toolbar is
|
|
49
|
+
* left out. Nothing is drawn until `render` is first called (see `shotPage`, `shotAround`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function takeShot(highlight?: Element | null, timeout?: number): PageShot;
|
|
52
|
+
/** The visible page as a canvas, toolbar left out, drawn from the page as it is now. `timeout` bounds a slow frame. */
|
|
5
53
|
export declare function renderViewport(scale: number, timeout?: number): Promise<HTMLCanvasElement>;
|
|
6
|
-
/** Drops the reused render, for example after the page changed in a way the view key can't see. */
|
|
7
|
-
export declare function forgetDrawnPage(): void;
|
|
8
|
-
/** The whole visible page as a JPEG, toolbar left out. If `highlight` is on screen it's outlined. */
|
|
9
|
-
export declare function capturePage(highlight?: Element | null): Promise<Blob | null>;
|
|
10
54
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
55
|
+
* The whole visible page as a JPEG, from `shot`. If the shot framed an element it's outlined, or `sketch`
|
|
56
|
+
* (drawn against it) is painted on instead.
|
|
57
|
+
*/
|
|
58
|
+
export declare function shotPage(shot: PageShot, sketch?: Sketch): Promise<Blob | null>;
|
|
59
|
+
/**
|
|
60
|
+
* What the person saw around the framed element, cut from `shot`, with the rest dimmed and the element
|
|
61
|
+
* outlined, or with `sketch` painted on instead. A JPEG data URL, or null when nothing was framed or the
|
|
62
|
+
* page couldn't be drawn.
|
|
13
63
|
*/
|
|
14
|
-
export declare function
|
|
64
|
+
export declare function shotAround(shot: PageShot, sketch?: Sketch): Promise<string | null>;
|
|
65
|
+
/** `shotAround` for the page as it is now. */
|
|
66
|
+
export declare function captureAround(element: Element, sketch?: Sketch): Promise<string | null>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host session (which comment service, project and environment, and the 15-minute host token) and the
|
|
3
|
+
* cache that reuses it until the token is about to expire. DOM-free: the web toolbar loads the session route
|
|
4
|
+
* with `fetch` from the page (`./session.ts`); native clients load it with the app's own bearer auth.
|
|
5
|
+
*/
|
|
6
|
+
export type Session = {
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
project: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
hostToken: string;
|
|
11
|
+
/**
|
|
12
|
+
* Native clients only: their app origin (`<scheme>://app`), sent as `x-comment-service-origin` on every
|
|
13
|
+
* request. Web leaves it unset; the browser sends `Origin`.
|
|
14
|
+
*/
|
|
15
|
+
clientOrigin?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Web, script-tag loader only (`../embed`): the origin the session route says `embed.js` may be loaded from
|
|
18
|
+
* when that is not `apiUrl`'s origin. Without it the loader mounts nothing for such a session.
|
|
19
|
+
*/
|
|
20
|
+
loaderOrigin?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Returns this page's session, or null when comments are off. `refresh` skips the cached one. */
|
|
23
|
+
export type GetSession = (options?: {
|
|
24
|
+
refresh?: boolean;
|
|
25
|
+
}) => Promise<Session | null>;
|
|
26
|
+
export declare function readJwt(token: string): {
|
|
27
|
+
exp?: number;
|
|
28
|
+
typ?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
memberId?: string;
|
|
32
|
+
origin?: string;
|
|
33
|
+
} | null;
|
|
34
|
+
export declare function sessionFrom(payload: unknown): Session | null;
|
|
35
|
+
/**
|
|
36
|
+
* The session route answered, and its answer was "comments are off" with a reason (`{ enabled: false, error }`),
|
|
37
|
+
* most often because nobody is signed in. Not a failure to reach it.
|
|
38
|
+
*/
|
|
39
|
+
export declare class SessionOff extends Error {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reads the session route at most once at a time and reuses the answer until its host token is about to expire.
|
|
43
|
+
* "Comments are off" is kept for the source's lifetime. A failed request is not kept, so the next call retries.
|
|
44
|
+
*/
|
|
45
|
+
export declare function sessionSource(path: string, load: (path: string) => Promise<unknown>, now?: () => number): GetSession;
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}) => Promise<Session | null>;
|
|
11
|
-
export declare function readJwt(token: string): {
|
|
12
|
-
exp?: number;
|
|
13
|
-
typ?: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
email?: string;
|
|
16
|
-
memberId?: string;
|
|
17
|
-
} | null;
|
|
18
|
-
export declare function sessionFrom(payload: unknown): Session | null;
|
|
1
|
+
import { type GetSession, type Session } from "./session-source.js";
|
|
2
|
+
export { readJwt, sessionFrom, SessionOff } from "./session-source.js";
|
|
3
|
+
export type { GetSession, Session } from "./session-source.js";
|
|
4
|
+
/**
|
|
5
|
+
* Forgets every toolbar sign-in this page's origin holds. Run when the host app says nobody is signed in: a
|
|
6
|
+
* sign-in is kept per browser, not per person of the host app, so the next person to sign in to the app must
|
|
7
|
+
* not find the last one's.
|
|
8
|
+
*/
|
|
9
|
+
export declare function forgetSignIns(storage?: Storage): void;
|
|
19
10
|
/**
|
|
20
11
|
* Reads the session route at most once at a time and reuses the answer until its host token is about to expire.
|
|
21
12
|
* "Comments are off" is kept for the page's lifetime. A failed request is not kept, so the next call retries.
|
|
@@ -23,3 +14,14 @@ export declare function sessionFrom(payload: unknown): Session | null;
|
|
|
23
14
|
export declare function sessionSource(path: string, load?: (path: string) => Promise<unknown>, now?: () => number): GetSession;
|
|
24
15
|
/** The page-wide session source for a session route path. */
|
|
25
16
|
export declare function sessionFor(path: string): GetSession;
|
|
17
|
+
/** What the host app says now: comments are on (with the session), off, or it could not be asked. */
|
|
18
|
+
export type HostAnswer = {
|
|
19
|
+
readonly state: "on";
|
|
20
|
+
readonly session: Session;
|
|
21
|
+
} | {
|
|
22
|
+
readonly state: "off";
|
|
23
|
+
} | {
|
|
24
|
+
readonly state: "unknown";
|
|
25
|
+
};
|
|
26
|
+
/** Asks the session route again, past any kept answer, or takes the kept one when `fresh` is false. */
|
|
27
|
+
export declare function askHost(get: GetSession, fresh?: boolean): Promise<HostAnswer>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps the page from reacting to the toolbar. Presses on the toolbar never reach the page, so an open menu,
|
|
3
|
+
* popover, or dialog does not treat them as an outside press, and buttons do not pull focus out of it. Focus
|
|
4
|
+
* moving into the toolbar is hidden from document-level focus traps (Radix FocusScope listens for focusin and
|
|
5
|
+
* focusout on document), which would otherwise pull it straight back into an open modal so the composer never
|
|
6
|
+
* takes input. The focus listeners sit on document, so the page's and the toolbar's own React handlers still
|
|
7
|
+
* run; call this before any app dialog opens so stopImmediatePropagation runs ahead of the trap's listeners.
|
|
8
|
+
*/
|
|
9
|
+
export declare function shieldFromPage(): () => void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type Pending, type PreviewFile } from "./attachments.js";
|
|
3
|
+
import { type MarkupShape } from "./markup.js";
|
|
4
|
+
import { type MarkupResult } from "./markup-editor.js";
|
|
5
|
+
import { type ReplayEvent } from "./replay.js";
|
|
6
|
+
/** The captures a draft holds: pictures (marked up on the stage) and clips. */
|
|
7
|
+
export type ShotCapture = PreviewFile;
|
|
8
|
+
/**
|
|
9
|
+
* The flattened picture `item` needs before it is sent, given the shapes drawn on it: null when the file already
|
|
10
|
+
* shows them, the original when every shape is gone, else a fresh flatten. Rejects when the image can't be read.
|
|
11
|
+
*/
|
|
12
|
+
export declare function flattenCapture(item: Pending, shapes: MarkupShape[]): Promise<MarkupResult | null>;
|
|
13
|
+
/** Where an event sits on a clip's timeline, 0..1, or null when it falls outside the clip. */
|
|
14
|
+
export declare function timelinePosition(event: ReplayEvent, clip: {
|
|
15
|
+
startedAt: number;
|
|
16
|
+
durationMs: number;
|
|
17
|
+
}): number | null;
|
|
18
|
+
/**
|
|
19
|
+
* A draft of captures as a comment: the selected capture fills the surface (a picture with the markup tools live
|
|
20
|
+
* on it, or a clip playing), the others sit in a filmstrip, and the composer (`children`) is a column beside it.
|
|
21
|
+
* Nothing has to be typed, and there is no Done to press: posting flattens whatever was drawn (see the composer's
|
|
22
|
+
* submit in `toolbar.tsx`). "Another page" and "Record" minimise the surface to the dock so the draft can collect
|
|
23
|
+
* more from elsewhere in the app.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ShotSurface({ captures, selectedId, shapes, savedAt, onSelect, onRemove, onShapes, onAnother, onRecord, onDictate, dictating, onMinimise, onDiscard, confirmDiscard, onSubmit, children, }: {
|
|
26
|
+
captures: ShotCapture[];
|
|
27
|
+
selectedId: string | null;
|
|
28
|
+
/** Shapes drawn on each picture so far, by capture id; a picture not listed shows its flattened shapes. */
|
|
29
|
+
shapes: ReadonlyMap<string, MarkupShape[]>;
|
|
30
|
+
savedAt: number | null;
|
|
31
|
+
onSelect: (id: string) => void;
|
|
32
|
+
onRemove: (id: string) => void;
|
|
33
|
+
onShapes: (id: string, shapes: MarkupShape[]) => void;
|
|
34
|
+
onAnother: () => void;
|
|
35
|
+
onRecord: () => void;
|
|
36
|
+
/** Starts (or stops) typing what the person says into the comment; absent when dictation is not available. */
|
|
37
|
+
onDictate?: (() => void) | undefined;
|
|
38
|
+
dictating?: boolean | undefined;
|
|
39
|
+
onMinimise: () => void;
|
|
40
|
+
onDiscard: () => void;
|
|
41
|
+
confirmDiscard: boolean;
|
|
42
|
+
/** Cmd+Enter on the picture: post, as it does in the comment box. */
|
|
43
|
+
onSubmit: () => void;
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Sketch } from "../core/index.js";
|
|
2
|
+
import { type Point } from "./ink.js";
|
|
3
|
+
export { INK, INK_HALO, type Point } from "./ink.js";
|
|
4
|
+
export type InkBox = {
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
};
|
|
10
|
+
/** Drops points within `tolerance` px of the line through their neighbours (Ramer–Douglas–Peucker). */
|
|
11
|
+
export declare function simplify(points: Point[], tolerance?: number): Point[];
|
|
12
|
+
export declare function inkBox(points: Point[]): InkBox;
|
|
13
|
+
export declare function isTap(box: InkBox): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The element a drawing is about: under the middle of the drawing, widened to the nearest ancestor that covers
|
|
16
|
+
* a fair share of it. Circling a button picks the button; circling a whole card picks the card.
|
|
17
|
+
*/
|
|
18
|
+
export declare function elementUnder(box: InkBox): Element | null;
|
|
19
|
+
/** Strokes in viewport coordinates, stored relative to `element`'s box. */
|
|
20
|
+
export declare function sketchFor(element: Element, strokes: Point[][]): Sketch;
|
|
21
|
+
/** The drawing's box, relative to the element it is stored against. */
|
|
22
|
+
export declare function sketchBox(sketch: Sketch): InkBox;
|
|
23
|
+
/** A smooth SVG path through a flat x, y list: quadratic curves through each pair of midpoints. */
|
|
24
|
+
export declare function pathData(path: number[], dx?: number, dy?: number): string;
|
|
25
|
+
/** Paints `sketch` on a canvas, given where its element's top-left corner lands and the canvas scale. */
|
|
26
|
+
export declare function paintSketch(ctx: CanvasRenderingContext2D, sketch: Sketch, origin: Point, scale: number): void;
|