@unofficialbox/box-open-elements 0.11.0 → 0.13.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.
Files changed (59) hide show
  1. package/dist/components/feedback/alert.d.ts +2 -0
  2. package/dist/components/feedback/alert.js +41 -8
  3. package/dist/components/feedback/indicator.d.ts +34 -0
  4. package/dist/components/feedback/indicator.js +167 -0
  5. package/dist/components/feedback/nudge.js +0 -1
  6. package/dist/components/feedback/toast.d.ts +4 -5
  7. package/dist/components/feedback/toast.js +19 -46
  8. package/dist/components/feedback/tone.d.ts +18 -0
  9. package/dist/components/feedback/tone.js +23 -0
  10. package/dist/components/forms/calendar.d.ts +25 -0
  11. package/dist/components/forms/calendar.js +94 -2
  12. package/dist/components/forms/tile-group.d.ts +58 -0
  13. package/dist/components/forms/tile-group.js +280 -0
  14. package/dist/components/output/code-block.d.ts +49 -0
  15. package/dist/components/output/code-block.js +236 -0
  16. package/dist/components/output/formatted-date.d.ts +38 -0
  17. package/dist/components/output/formatted-date.js +90 -0
  18. package/dist/components/output/formatted-file-size.d.ts +31 -0
  19. package/dist/components/output/formatted-file-size.js +61 -0
  20. package/dist/components/output/formatted-number.d.ts +37 -0
  21. package/dist/components/output/formatted-number.js +106 -0
  22. package/dist/components/output/formatted-value.d.ts +44 -0
  23. package/dist/components/output/formatted-value.js +100 -0
  24. package/dist/components/output/index.d.ts +6 -0
  25. package/dist/components/output/index.js +9 -0
  26. package/dist/components/output/relative-time.d.ts +41 -0
  27. package/dist/components/output/relative-time.js +82 -0
  28. package/dist/element-maps.d.ts +17 -1
  29. package/dist/entries/code-block.d.ts +1 -0
  30. package/dist/entries/code-block.js +1 -0
  31. package/dist/entries/comment-thread.d.ts +1 -0
  32. package/dist/entries/comment-thread.js +1 -0
  33. package/dist/entries/formatted-date.d.ts +1 -0
  34. package/dist/entries/formatted-date.js +1 -0
  35. package/dist/entries/formatted-file-size.d.ts +1 -0
  36. package/dist/entries/formatted-file-size.js +1 -0
  37. package/dist/entries/formatted-number.d.ts +1 -0
  38. package/dist/entries/formatted-number.js +1 -0
  39. package/dist/entries/indicator.d.ts +1 -0
  40. package/dist/entries/indicator.js +1 -0
  41. package/dist/entries/relative-time.d.ts +1 -0
  42. package/dist/entries/relative-time.js +1 -0
  43. package/dist/entries/tile-group.d.ts +1 -0
  44. package/dist/entries/tile-group.js +1 -0
  45. package/dist/foundations/format/format.d.ts +82 -0
  46. package/dist/foundations/format/format.js +122 -0
  47. package/dist/foundations/format/index.d.ts +1 -0
  48. package/dist/foundations/format/index.js +3 -0
  49. package/dist/index.d.ts +10 -0
  50. package/dist/index.js +12 -0
  51. package/dist/patterns/comments/comment-thread.d.ts +79 -0
  52. package/dist/patterns/comments/comment-thread.js +561 -0
  53. package/dist/patterns/comments/index.d.ts +2 -0
  54. package/dist/patterns/comments/index.js +5 -0
  55. package/dist/patterns/comments/types.d.ts +39 -0
  56. package/dist/patterns/comments/types.js +8 -0
  57. package/dist/patterns/preview/annotation-thread.d.ts +67 -48
  58. package/dist/patterns/preview/annotation-thread.js +96 -440
  59. package/package.json +1 -1
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The comment model.
3
+ *
4
+ * Kept separate from the component so the data contract does not depend on the
5
+ * class: a host that only transports comments — a controller, an adapter, a
6
+ * server route — imports these without pulling a custom element in with them.
7
+ */
8
+ /** A button offered beneath the thread, e.g. "Resolve" or "Delete". */
9
+ export type CommentAction = {
10
+ id: string;
11
+ label: string;
12
+ tone?: string;
13
+ };
14
+ /**
15
+ * One comment.
16
+ *
17
+ * `badge` is the generic pill beside the author — whatever short qualifier the
18
+ * surface wants to show. `box-annotation-thread` maps its own `toolLabel` onto
19
+ * it, which is why the base model does not name it after annotation tools.
20
+ */
21
+ export type CommentEntry = {
22
+ author: string;
23
+ badge?: string;
24
+ body: string;
25
+ createdAt?: string;
26
+ id: string;
27
+ initials?: string;
28
+ status?: string;
29
+ };
30
+ /**
31
+ * A composed comment, before it has an id.
32
+ *
33
+ * `inReplyToId` carries the selected entry, so the same event serves both a new
34
+ * top-level comment and a reply — the host decides which by reading it.
35
+ */
36
+ export type CommentSubmittedDetail = {
37
+ body: string;
38
+ inReplyToId: string | null;
39
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The comment model.
3
+ *
4
+ * Kept separate from the component so the data contract does not depend on the
5
+ * class: a host that only transports comments — a controller, an adapter, a
6
+ * server route — imports these without pulling a custom element in with them.
7
+ */
8
+ export {};
@@ -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
  }