@unofficialbox/box-open-elements 0.11.0 → 0.12.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.
@@ -1,57 +1,76 @@
1
- import { BaseElement } from "../../core/index.js";
2
- export type AnnotationThreadAction = {
3
- id: string;
4
- label: string;
5
- tone?: string;
6
- };
7
- export type AnnotationThreadEntry = {
8
- author: string;
9
- body: string;
10
- createdAt?: string;
11
- id: string;
12
- initials?: string;
13
- status?: string;
1
+ import { CommentThread } from "../comments/index.js";
2
+ import type { CommentAction, CommentEntry, CommentSubmittedDetail } from "../comments/index.js";
3
+ /** @deprecated Prefer `CommentAction`; kept so existing hosts keep compiling. */
4
+ export type AnnotationThreadAction = CommentAction;
5
+ /** @deprecated Prefer `CommentSubmittedDetail`. */
6
+ export type AnnotationThreadEntrySubmittedDetail = CommentSubmittedDetail;
7
+ /**
8
+ * An annotation comment.
9
+ *
10
+ * A comment plus `toolLabel` — which annotation tool produced it (highlight,
11
+ * draw, stamp). That field is the only thing an annotation entry adds, which is
12
+ * why the rest of the model lives in `patterns/comments`.
13
+ */
14
+ export type AnnotationThreadEntry = CommentEntry & {
14
15
  toolLabel?: string;
15
16
  };
16
- export type AnnotationThreadEntrySubmittedDetail = {
17
- body: string;
18
- inReplyToId: string | null;
17
+ /**
18
+ * Where in the document a thread is attached.
19
+ *
20
+ * Every field is optional because anchors arrive in different shapes: a page
21
+ * number alone for a page-level note, a region for a drawn box, a quote for
22
+ * selected text. A thread with no anchor at all is a comment, and belongs on
23
+ * `box-comment-thread` instead.
24
+ */
25
+ export type AnnotationAnchor = {
26
+ page?: number;
27
+ quote?: string;
28
+ region?: {
29
+ height: number;
30
+ width: number;
31
+ x: number;
32
+ y: number;
33
+ };
19
34
  };
20
- export declare class AnnotationThread extends BaseElement {
35
+ /**
36
+ * A comment thread anchored to a place in a document.
37
+ *
38
+ * This is `box-comment-thread` plus the anchor. The distinction is the whole
39
+ * point: comments stand on their own — on a file, a task, a contract clause —
40
+ * and only become annotations when something ties them to a page, a region, or
41
+ * a run of selected text. Hosts that want the former should reach for
42
+ * `box-comment-thread` directly rather than for an annotation with no anchor.
43
+ *
44
+ * Every attribute, part and event of the underlying thread is inherited
45
+ * unchanged, so this remains a drop-in for the previous implementation.
46
+ */
47
+ export declare class AnnotationThread extends CommentThread {
21
48
  static readonly tagName: string;
22
49
  static get observedAttributes(): string[];
23
- private titleEl;
24
- private messageEl;
25
- private entriesEl;
26
- private emptyEl;
27
- private actionsEl;
28
- private composerEl;
29
- private composerInputEl;
30
- private entriesSignature;
31
- private actionsSignature;
32
- get actions(): AnnotationThreadAction[];
33
- set actions(value: AnnotationThreadAction[]);
34
- get composable(): boolean;
35
- set composable(value: boolean);
50
+ private anchorEl;
51
+ protected threadStyles(): string;
52
+ protected headerExtras(): string;
53
+ protected defaultHeading(): string;
54
+ protected emptyText(): string;
55
+ protected defaultComposerLabel(): string;
56
+ protected defaultPlaceholder(): string;
57
+ /**
58
+ * Annotations name their pill `toolLabel`. Mapping it here keeps that
59
+ * vocabulary for existing hosts while the base model stays generic.
60
+ */
61
+ protected entryBadge(entry: AnnotationThreadEntry): string | undefined;
62
+ /** Where in the document this thread sits. Null when unanchored. */
63
+ get anchor(): AnnotationAnchor | null;
64
+ set anchor(value: AnnotationAnchor | null);
36
65
  get entries(): AnnotationThreadEntry[];
37
66
  set entries(value: AnnotationThreadEntry[]);
38
- get message(): string;
39
- set message(value: string);
40
- get selectedEntryId(): string;
41
- set selectedEntryId(value: string);
42
- get heading(): string;
43
- set heading(value: string);
44
- private parseJsonAttribute;
45
- private emitAction;
46
- private emitEntrySelected;
47
- private submitComposer;
48
- private entriesKey;
49
- private actionsKey;
50
- private rebuildEntries;
51
- private patchEntrySelection;
52
- private rebuildActions;
53
- private patchActionLabels;
54
- protected renderTemplate(): void;
55
- protected setupListeners(): void;
67
+ /**
68
+ * The anchor in words.
69
+ *
70
+ * A region is described by its page rather than by its coordinates: the
71
+ * numbers locate the highlight for the renderer, but they tell a reader
72
+ * nothing, and a screen reader least of all.
73
+ */
74
+ private anchorLocation;
56
75
  protected update(): void;
57
76
  }