@nuniapp/widget 0.1.3 → 0.1.4

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 CHANGED
@@ -60,11 +60,12 @@ Using React? Use [`@nuniapp/react`](https://www.npmjs.com/package/@nuniapp/react
60
60
 
61
61
  ## Options
62
62
 
63
- | Option | Description |
64
- | -------------------------------------- | ------------------------------------------------------------------------------------------ |
65
- | `project` | Your public project ID. Commit it; it is not a secret. |
66
- | `getPageKey(url)` | Optional. Decide which URLs share comments. Defaults to the path, ignoring query and hash. |
67
- | `convexUrl`, `convexSiteUrl`, `appUrl` | Optional. For self-hosting or local development. |
63
+ | Option | Description |
64
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
65
+ | `project` | Your public project ID. Commit it; it is not a secret. |
66
+ | `getPageKey(url)` | Optional. Decide which URLs share comments. Defaults to the path, ignoring query and hash. |
67
+ | `convexUrl`, `convexSiteUrl`, `appUrl` | Optional. For self-hosting or local development. |
68
+ | `capture` | Optional. Owner-only page context per comment: `{ console, network, dom, screenshot }`, all on by default. |
68
69
 
69
70
  `init` returns `{ destroy() }`.
70
71
 
package/dist/index.d.ts CHANGED
@@ -10,13 +10,49 @@ interface NuniOptions {
10
10
  appUrl?: string;
11
11
  /** Custom page key. Comments are matched by this; defaults to the normalized path. */
12
12
  getPageKey?: (url: URL) => string;
13
+ /**
14
+ * Extra context attached to each comment for the project owner and their
15
+ * coding agent. Everything is on by default; set a key to `false` to stop
16
+ * capturing it.
17
+ */
18
+ capture?: {
19
+ /** Recent console errors and warnings. */
20
+ console?: boolean;
21
+ /** Recent failed requests (method, origin + path, status). */
22
+ network?: boolean;
23
+ /** The element's markup (form values removed) and key styles. */
24
+ dom?: boolean;
25
+ /** An image of the element and its surroundings. */
26
+ screenshot?: boolean;
27
+ };
13
28
  }
14
29
  export declare const VERSION: string;
15
30
  //#endregion
16
- //#region src/index.d.ts
17
- export interface NuniInstance {
31
+ //#region src/screenshot.d.ts
32
+ /**
33
+ * Screenshots are loaded lazily (a separate chunk for npm users, a separate
34
+ * script for the CDN build), so the widget itself stays small.
35
+ */
36
+ interface ScreenshotOptions {
37
+ /** Nuni's own host element, left out of the image. */
38
+ exclude: Element;
39
+ /** Outline color drawn around the commented element. */
40
+ accent: string;
41
+ }
42
+ type CaptureScreenshot = (el: Element, options: ScreenshotOptions) => Promise<Blob | null>;
43
+ declare global {
44
+ interface Window {
45
+ /** Set by nuni-screenshot.global.js (the CDN build). */
46
+ __nuniScreenshot?: CaptureScreenshot;
47
+ }
48
+ }
49
+ //#endregion
50
+ //#region src/mount.d.ts
51
+ interface NuniInstance {
18
52
  destroy(): void;
19
53
  }
54
+ //#endregion
55
+ //#region src/index.d.ts
20
56
  /**
21
57
  * Mount Nuni on the page. Call once on the client. Calling it again with the
22
58
  * same project shares the mounted widget; it is removed when every handle is
@@ -25,4 +61,4 @@ export interface NuniInstance {
25
61
  */
26
62
  export declare function init(options: NuniOptions): NuniInstance;
27
63
  //#endregion
28
- export type { NuniOptions };
64
+ export type { NuniInstance, NuniOptions };