helldots 0.5.0 → 0.6.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 +198 -12
- package/dist/helldots.esm.js +6 -5
- package/dist/helldots.esm.js.map +4 -4
- package/dist/helldots.umd.js +13 -12
- package/dist/index.d.ts +203 -10
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface CommentAnchor {
|
|
|
24
24
|
export type AnchorState = "anchored" | "orphaned" | "inactive";
|
|
25
25
|
|
|
26
26
|
/** RF09 — comment lifecycle state. */
|
|
27
|
-
export type CommentStatus = "open" | "in_progress" | "resolved";
|
|
27
|
+
export type CommentStatus = "open" | "in_progress" | "in_review" | "resolved";
|
|
28
28
|
|
|
29
29
|
/** RF3 — comment category. `null` means deliberately unclassified. */
|
|
30
30
|
export type CommentType = "bug" | "suggestion" | "question" | "improvement";
|
|
@@ -32,6 +32,72 @@ export type CommentType = "bug" | "suggestion" | "question" | "improvement";
|
|
|
32
32
|
/** RF4 — comment priority. `null` means deliberately unprioritised. */
|
|
33
33
|
export type CommentPriority = "high" | "medium" | "low";
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Aggregate figures over a corpus of comments. Every bucket is present even
|
|
37
|
+
* when empty, so a consumer can index it without guarding — an absent key and
|
|
38
|
+
* a zero would otherwise be indistinguishable.
|
|
39
|
+
*/
|
|
40
|
+
export interface CommentMetrics {
|
|
41
|
+
total: number;
|
|
42
|
+
byStatus: Record<CommentStatus, number>;
|
|
43
|
+
/** `unset` holds the comments left deliberately unclassified. */
|
|
44
|
+
byType: Record<CommentType | "unset", number>;
|
|
45
|
+
/** `unset` holds the comments left deliberately unprioritised. */
|
|
46
|
+
byPriority: Record<CommentPriority | "unset", number>;
|
|
47
|
+
/**
|
|
48
|
+
* Comments created per day, oldest first, in `YYYY-MM-DD`. Only days that
|
|
49
|
+
* saw activity get an entry: filling the gaps would put a year of empty
|
|
50
|
+
* buckets between two comments twelve months apart.
|
|
51
|
+
*/
|
|
52
|
+
overTime: Array<{ date: string; count: number }>;
|
|
53
|
+
resolution: {
|
|
54
|
+
resolvedCount: number;
|
|
55
|
+
/** Comments that were resolved, reopened and resolved again. */
|
|
56
|
+
reopenedCount: number;
|
|
57
|
+
/** Mean and median of the resolution currently in force, or null when nothing is resolved. */
|
|
58
|
+
averageMs: number | null;
|
|
59
|
+
medianMs: number | null;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Who performed an audited action, as the host declared them at the time. */
|
|
64
|
+
export interface AuditActor {
|
|
65
|
+
/** From `user.id`, when the host supplies one. Never rendered. */
|
|
66
|
+
id?: string;
|
|
67
|
+
/** The display name at the time of the action. */
|
|
68
|
+
name: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The four actions worth auditing. Replies carry their own author and
|
|
73
|
+
* timestamp already, and reactions are high-frequency signal with no audit
|
|
74
|
+
* value — neither produces an entry.
|
|
75
|
+
*/
|
|
76
|
+
export type AuditEventType = "created" | "edited" | "status" | "classified";
|
|
77
|
+
|
|
78
|
+
/** One entry of a comment's append-only audit trail. */
|
|
79
|
+
export interface AuditEvent {
|
|
80
|
+
type: AuditEventType;
|
|
81
|
+
/**
|
|
82
|
+
* ISO timestamp, from the acting client's clock. Merge corpora written on
|
|
83
|
+
* machines whose clocks disagree and an entry can predate the comment it
|
|
84
|
+
* belongs to; durations derived from these are clamped at zero rather than
|
|
85
|
+
* rendered negative.
|
|
86
|
+
*/
|
|
87
|
+
at: string;
|
|
88
|
+
actor: AuditActor;
|
|
89
|
+
/** "classified" only: which field moved. */
|
|
90
|
+
field?: "type" | "priority" | "tags";
|
|
91
|
+
/**
|
|
92
|
+
* Both ends of the transition, for "status" and for "classified" on type or
|
|
93
|
+
* priority. `null` is a value, not an absence — it is how type and priority
|
|
94
|
+
* read when deliberately unset. Absent for "created", "edited", and for a
|
|
95
|
+
* tag change, which is a list with no two-value transition.
|
|
96
|
+
*/
|
|
97
|
+
from?: string | null;
|
|
98
|
+
to?: string | null;
|
|
99
|
+
}
|
|
100
|
+
|
|
35
101
|
/** RF2 — environment snapshot taken when the comment was created. */
|
|
36
102
|
export interface CommentContext {
|
|
37
103
|
version: 1;
|
|
@@ -72,8 +138,31 @@ export interface SerializedComment {
|
|
|
72
138
|
anchor: CommentAnchor | null;
|
|
73
139
|
/** location.pathname where the comment was created. */
|
|
74
140
|
page: string;
|
|
141
|
+
/**
|
|
142
|
+
* Append-only audit trail: who created, edited, moved or reclassified this
|
|
143
|
+
* comment, and when. Optional and absent by default — records written
|
|
144
|
+
* before it existed simply have none, so no migration is involved, and
|
|
145
|
+
* `null` rather than `[]` keeps an untouched corpus free of extra bytes.
|
|
146
|
+
*
|
|
147
|
+
* Every resolution the comment has had is derivable from the `status`
|
|
148
|
+
* entries, which is why no separate resolution history is stored.
|
|
149
|
+
*/
|
|
150
|
+
history?: AuditEvent[] | null;
|
|
75
151
|
replies: CommentReply[];
|
|
76
152
|
author: string;
|
|
153
|
+
/**
|
|
154
|
+
* Stable identifier of the author, from the `user.id` the host supplied at
|
|
155
|
+
* creation. Optional and absent by default: records written before it
|
|
156
|
+
* existed simply have none, so no migration is involved.
|
|
157
|
+
*
|
|
158
|
+
* Never rendered — `author` is the display name and stays what any UI
|
|
159
|
+
* shows — it travels with the record, so a store that holds nothing but
|
|
160
|
+
* comments renders every author without a lookup. The id is opaque to
|
|
161
|
+
* HellDots: whether it points into the host's user table, into a
|
|
162
|
+
* comments-only database, or nowhere at all is the host's business. What it
|
|
163
|
+
* buys is telling two teammates who share a display name apart.
|
|
164
|
+
*/
|
|
165
|
+
authorId?: string | null;
|
|
77
166
|
createdAt: string;
|
|
78
167
|
screenshots: string[];
|
|
79
168
|
status: CommentStatus;
|
|
@@ -94,17 +183,19 @@ export interface SerializedComment {
|
|
|
94
183
|
/** RF1 — automatic viewport capture (JPEG data-URL). */
|
|
95
184
|
contextScreenshot: string | null;
|
|
96
185
|
/**
|
|
97
|
-
* RF6 — emoji →
|
|
98
|
-
*
|
|
186
|
+
* RF6 — emoji → the actor keys that reacted (see the `user` option). Always
|
|
187
|
+
* one of the six emoji in the fixed set; anything else is dropped on load.
|
|
188
|
+
* Null when nobody has reacted, so an untouched corpus carries no extra
|
|
189
|
+
* payload.
|
|
99
190
|
*/
|
|
100
|
-
reactions
|
|
191
|
+
reactions: Record<string, string[]> | null;
|
|
101
192
|
}
|
|
102
193
|
|
|
103
194
|
/**
|
|
104
195
|
* Everything that can change, as one discriminated union. Switch on `type`
|
|
105
196
|
* and TypeScript narrows the rest of the fields for you.
|
|
106
197
|
*
|
|
107
|
-
* The
|
|
198
|
+
* The ten specific callbacks below carry exactly the same events at
|
|
108
199
|
* exactly the same moments; subscribe either way, or both.
|
|
109
200
|
*/
|
|
110
201
|
export type ChangeEvent =
|
|
@@ -129,6 +220,12 @@ export type ChangeEvent =
|
|
|
129
220
|
type: "reply:edited";
|
|
130
221
|
comment: SerializedComment;
|
|
131
222
|
reply: CommentReply;
|
|
223
|
+
}
|
|
224
|
+
/** `reply` is null when the reaction is on the root comment. */
|
|
225
|
+
| {
|
|
226
|
+
type: "reaction:toggled";
|
|
227
|
+
comment: SerializedComment;
|
|
228
|
+
reply: CommentReply | null;
|
|
132
229
|
};
|
|
133
230
|
|
|
134
231
|
export interface CommentOverlayOptions {
|
|
@@ -164,8 +261,19 @@ export interface CommentOverlayOptions {
|
|
|
164
261
|
* font or adding `crossorigin` to the `<link>`.
|
|
165
262
|
*/
|
|
166
263
|
embedCrossOriginFonts?: boolean;
|
|
167
|
-
/**
|
|
168
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Identity used as the author of new comments and replies.
|
|
266
|
+
*
|
|
267
|
+
* `name` is what gets displayed. `id` is optional and never rendered: it
|
|
268
|
+
* is persisted as `authorId` on the comments and replies this user creates,
|
|
269
|
+
* and it is what a reaction is keyed on — so two teammates who share a
|
|
270
|
+
* display name are still told apart. Without it the name is used, and
|
|
271
|
+
* without any `user` at all every actor collapses into one.
|
|
272
|
+
*
|
|
273
|
+
* HellDots authenticates nobody: whatever the host declares here is taken
|
|
274
|
+
* at face value and recorded as-is.
|
|
275
|
+
*/
|
|
276
|
+
user?: { name: string; id?: string };
|
|
169
277
|
/**
|
|
170
278
|
* Query parameter carrying a comment id in "Copy link" URLs, and read back
|
|
171
279
|
* on startup to open that comment. Default: "helldotsComment". Override it
|
|
@@ -211,16 +319,42 @@ export interface CommentOverlayOptions {
|
|
|
211
319
|
onCommentStatusChanged?: (comment: SerializedComment) => void;
|
|
212
320
|
/** Fired after type, priority or tags change on any comment. */
|
|
213
321
|
onCommentUpdated?: (comment: SerializedComment) => void;
|
|
322
|
+
/**
|
|
323
|
+
* Fired after a reaction is added to or removed from a comment or a reply.
|
|
324
|
+
* `reply` is null when the reaction is on the root comment.
|
|
325
|
+
*/
|
|
326
|
+
onReactionToggled?: (
|
|
327
|
+
comment: SerializedComment,
|
|
328
|
+
reply: CommentReply | null
|
|
329
|
+
) => void;
|
|
214
330
|
}
|
|
215
331
|
|
|
216
332
|
export interface CommentReply {
|
|
217
333
|
id: CommentId;
|
|
218
334
|
text: string;
|
|
219
335
|
author: string;
|
|
336
|
+
/**
|
|
337
|
+
* Stable identifier of the author, from the `user.id` the host supplied at
|
|
338
|
+
* creation. Optional and absent by default: records written before it
|
|
339
|
+
* existed simply have none, so no migration is involved.
|
|
340
|
+
*
|
|
341
|
+
* Never rendered — `author` is the display name and stays what any UI
|
|
342
|
+
* shows — it travels with the record, so a store that holds nothing but
|
|
343
|
+
* comments renders every author without a lookup. The id is opaque to
|
|
344
|
+
* HellDots: whether it points into the host's user table, into a
|
|
345
|
+
* comments-only database, or nowhere at all is the host's business. What it
|
|
346
|
+
* buys is telling two teammates who share a display name apart.
|
|
347
|
+
*/
|
|
348
|
+
authorId?: string | null;
|
|
220
349
|
timestamp: string;
|
|
221
350
|
screenshots?: string[];
|
|
222
351
|
/** ISO timestamp of the last edit; null when never edited. */
|
|
223
352
|
editedAt?: string | null;
|
|
353
|
+
/**
|
|
354
|
+
* RF6 — emoji → the actor keys that reacted. Same shape and same rules as a
|
|
355
|
+
* comment's; null when nobody has reacted.
|
|
356
|
+
*/
|
|
357
|
+
reactions?: Record<string, string[]> | null;
|
|
224
358
|
}
|
|
225
359
|
|
|
226
360
|
export interface Comment {
|
|
@@ -240,8 +374,31 @@ export interface Comment {
|
|
|
240
374
|
target?: HTMLElement | null;
|
|
241
375
|
/** location.pathname where the comment was created. */
|
|
242
376
|
page: string;
|
|
377
|
+
/**
|
|
378
|
+
* Append-only audit trail: who created, edited, moved or reclassified this
|
|
379
|
+
* comment, and when. Optional and absent by default — records written
|
|
380
|
+
* before it existed simply have none, so no migration is involved, and
|
|
381
|
+
* `null` rather than `[]` keeps an untouched corpus free of extra bytes.
|
|
382
|
+
*
|
|
383
|
+
* Every resolution the comment has had is derivable from the `status`
|
|
384
|
+
* entries, which is why no separate resolution history is stored.
|
|
385
|
+
*/
|
|
386
|
+
history?: AuditEvent[] | null;
|
|
243
387
|
replies: CommentReply[];
|
|
244
388
|
author: string;
|
|
389
|
+
/**
|
|
390
|
+
* Stable identifier of the author, from the `user.id` the host supplied at
|
|
391
|
+
* creation. Optional and absent by default: records written before it
|
|
392
|
+
* existed simply have none, so no migration is involved.
|
|
393
|
+
*
|
|
394
|
+
* Never rendered — `author` is the display name and stays what any UI
|
|
395
|
+
* shows — it travels with the record, so a store that holds nothing but
|
|
396
|
+
* comments renders every author without a lookup. The id is opaque to
|
|
397
|
+
* HellDots: whether it points into the host's user table, into a
|
|
398
|
+
* comments-only database, or nowhere at all is the host's business. What it
|
|
399
|
+
* buys is telling two teammates who share a display name apart.
|
|
400
|
+
*/
|
|
401
|
+
authorId?: string | null;
|
|
245
402
|
createdAt: string;
|
|
246
403
|
screenshots: string[];
|
|
247
404
|
status: CommentStatus;
|
|
@@ -262,10 +419,12 @@ export interface Comment {
|
|
|
262
419
|
/** RF1 — automatic viewport capture (JPEG data-URL). */
|
|
263
420
|
contextScreenshot: string | null;
|
|
264
421
|
/**
|
|
265
|
-
* RF6 — emoji →
|
|
266
|
-
*
|
|
422
|
+
* RF6 — emoji → the actor keys that reacted (see the `user` option). Always
|
|
423
|
+
* one of the six emoji in the fixed set; anything else is dropped on load.
|
|
424
|
+
* Null when nobody has reacted, so an untouched corpus carries no extra
|
|
425
|
+
* payload.
|
|
267
426
|
*/
|
|
268
|
-
reactions
|
|
427
|
+
reactions: Record<string, string[]> | null;
|
|
269
428
|
}
|
|
270
429
|
|
|
271
430
|
export declare class CommentOverlay {
|
|
@@ -315,10 +474,44 @@ export declare class CommentOverlay {
|
|
|
315
474
|
* backend before loadComments — fires no per-comment callbacks.
|
|
316
475
|
*/
|
|
317
476
|
clearComments(): void;
|
|
477
|
+
/**
|
|
478
|
+
* Aggregate figures over every comment the widget holds. Unfiltered: the
|
|
479
|
+
* dashboard inside the inbox measures whatever that panel is showing, but a
|
|
480
|
+
* host has no notion of those filters.
|
|
481
|
+
*/
|
|
482
|
+
getMetrics(): CommentMetrics;
|
|
483
|
+
/**
|
|
484
|
+
* Downloads the corpus as CSV, one row per comment. Screenshots and the
|
|
485
|
+
* automatic context capture stay out. Defaults to every comment.
|
|
486
|
+
*/
|
|
487
|
+
exportCommentsCsv(comments?: SerializedComment[]): void;
|
|
488
|
+
/**
|
|
489
|
+
* Downloads the aggregate figures as CSV in long format — `section, key,
|
|
490
|
+
* value` — so the column count does not change with the corpus.
|
|
491
|
+
*/
|
|
492
|
+
exportMetricsCsv(comments?: SerializedComment[]): void;
|
|
493
|
+
/**
|
|
494
|
+
* Opens the browser's print dialog on a report of the figures, which is
|
|
495
|
+
* where "save as PDF" lives. The report is built in its own document, so
|
|
496
|
+
* what prints is the report rather than the host page.
|
|
497
|
+
*/
|
|
498
|
+
printMetricsReport(comments?: SerializedComment[], scope?: string): void;
|
|
318
499
|
setCommentStatus(id: CommentId, status: CommentStatus): boolean;
|
|
319
500
|
setCommentType(id: CommentId, type: CommentType | null): boolean;
|
|
320
501
|
setCommentPriority(id: CommentId, priority: CommentPriority | null): boolean;
|
|
321
502
|
setCommentTags(id: CommentId, tags: string[]): boolean;
|
|
503
|
+
/**
|
|
504
|
+
* RF6 — flips the current actor's reaction on a comment: present, it is
|
|
505
|
+
* removed; absent, it is added. The actor is `user.id ?? user.name`.
|
|
506
|
+
* Returns false when the id or the emoji is unknown.
|
|
507
|
+
*/
|
|
508
|
+
toggleCommentReaction(id: CommentId, emoji: string): boolean;
|
|
509
|
+
/** Same contract as toggleCommentReaction, one level down. */
|
|
510
|
+
toggleReplyReaction(
|
|
511
|
+
commentId: CommentId,
|
|
512
|
+
replyId: CommentId,
|
|
513
|
+
emoji: string
|
|
514
|
+
): boolean;
|
|
322
515
|
cleanup(): void;
|
|
323
516
|
}
|
|
324
517
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "helldots",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Drop-in comment overlay for web apps — click anywhere to leave a comment anchored to that element, with an automatic screenshot and environment capture",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"comments",
|
|
@@ -53,9 +53,11 @@
|
|
|
53
53
|
"build": "node scripts/build.mjs",
|
|
54
54
|
"size": "node scripts/check-size.mjs",
|
|
55
55
|
"verify": "npm run lint && npm run typecheck && npm run format:check && npm test && npm run build && npm run size",
|
|
56
|
+
"check:commit": "node scripts/check-commit-msg.mjs",
|
|
56
57
|
"prepublishOnly": "npm run verify",
|
|
57
58
|
"changeset": "changeset",
|
|
58
|
-
"release": "changeset version"
|
|
59
|
+
"release": "changeset version",
|
|
60
|
+
"prepare": "node scripts/install-hooks.mjs"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@changesets/cli": "^2.31.0",
|