@tldraw/commenting 5.7.0-canary.ea40e3961399 → 5.7.0-canary.ed10ee6bcceb

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 (102) hide show
  1. package/commenting.css +277 -275
  2. package/dist-cjs/canvas/canvas-events.js +25 -1
  3. package/dist-cjs/canvas/canvas-events.js.map +2 -2
  4. package/dist-cjs/canvas/comment-tool.js +29 -28
  5. package/dist-cjs/canvas/comment-tool.js.map +2 -2
  6. package/dist-cjs/canvas/comments-filter-menu.js +55 -38
  7. package/dist-cjs/canvas/comments-filter-menu.js.map +2 -2
  8. package/dist-cjs/canvas/comments-overflow-menu.js +6 -24
  9. package/dist-cjs/canvas/comments-overflow-menu.js.map +2 -2
  10. package/dist-cjs/canvas/comments-overlay.js +1 -0
  11. package/dist-cjs/canvas/comments-overlay.js.map +2 -2
  12. package/dist-cjs/canvas/comments-sidebar.js +15 -3
  13. package/dist-cjs/canvas/comments-sidebar.js.map +2 -2
  14. package/dist-cjs/canvas/comments-visibility-toggle.js +1 -1
  15. package/dist-cjs/canvas/comments-visibility-toggle.js.map +1 -1
  16. package/dist-cjs/canvas/options.js.map +2 -2
  17. package/dist-cjs/canvas/pending-composer.js +133 -8
  18. package/dist-cjs/canvas/pending-composer.js.map +2 -2
  19. package/dist-cjs/canvas/region-box.js +150 -35
  20. package/dist-cjs/canvas/region-box.js.map +3 -3
  21. package/dist-cjs/canvas/thread-pin.js +20 -4
  22. package/dist-cjs/canvas/thread-pin.js.map +2 -2
  23. package/dist-cjs/canvas/thread-view.js +130 -57
  24. package/dist-cjs/canvas/thread-view.js.map +2 -2
  25. package/dist-cjs/index.d.ts +39 -11
  26. package/dist-cjs/index.js +1 -1
  27. package/dist-cjs/ui/byline.js +2 -2
  28. package/dist-cjs/ui/byline.js.map +2 -2
  29. package/dist-cjs/ui/comment-card.js +3 -1
  30. package/dist-cjs/ui/comment-card.js.map +2 -2
  31. package/dist-cjs/ui/comment-extensions.js +4 -1
  32. package/dist-cjs/ui/comment-extensions.js.map +2 -2
  33. package/dist-cjs/ui/comments-list.js +6 -7
  34. package/dist-cjs/ui/comments-list.js.map +2 -2
  35. package/dist-cjs/ui/icons.js +4 -4
  36. package/dist-cjs/ui/icons.js.map +2 -2
  37. package/dist-cjs/ui/reaction-picker.js +2 -2
  38. package/dist-cjs/ui/reaction-picker.js.map +1 -1
  39. package/dist-cjs/ui/send-button.js.map +1 -1
  40. package/dist-esm/canvas/canvas-events.mjs +25 -1
  41. package/dist-esm/canvas/canvas-events.mjs.map +2 -2
  42. package/dist-esm/canvas/comment-tool.mjs +30 -29
  43. package/dist-esm/canvas/comment-tool.mjs.map +2 -2
  44. package/dist-esm/canvas/comments-filter-menu.mjs +57 -39
  45. package/dist-esm/canvas/comments-filter-menu.mjs.map +2 -2
  46. package/dist-esm/canvas/comments-overflow-menu.mjs +8 -24
  47. package/dist-esm/canvas/comments-overflow-menu.mjs.map +2 -2
  48. package/dist-esm/canvas/comments-overlay.mjs +1 -0
  49. package/dist-esm/canvas/comments-overlay.mjs.map +2 -2
  50. package/dist-esm/canvas/comments-sidebar.mjs +16 -4
  51. package/dist-esm/canvas/comments-sidebar.mjs.map +2 -2
  52. package/dist-esm/canvas/comments-visibility-toggle.mjs +1 -1
  53. package/dist-esm/canvas/comments-visibility-toggle.mjs.map +1 -1
  54. package/dist-esm/canvas/options.mjs.map +2 -2
  55. package/dist-esm/canvas/pending-composer.mjs +143 -9
  56. package/dist-esm/canvas/pending-composer.mjs.map +2 -2
  57. package/dist-esm/canvas/region-box.mjs +161 -38
  58. package/dist-esm/canvas/region-box.mjs.map +3 -3
  59. package/dist-esm/canvas/thread-pin.mjs +22 -6
  60. package/dist-esm/canvas/thread-pin.mjs.map +2 -2
  61. package/dist-esm/canvas/thread-view.mjs +140 -58
  62. package/dist-esm/canvas/thread-view.mjs.map +2 -2
  63. package/dist-esm/index.d.mts +39 -11
  64. package/dist-esm/index.mjs +1 -1
  65. package/dist-esm/ui/byline.mjs +2 -2
  66. package/dist-esm/ui/byline.mjs.map +2 -2
  67. package/dist-esm/ui/comment-card.mjs +3 -1
  68. package/dist-esm/ui/comment-card.mjs.map +2 -2
  69. package/dist-esm/ui/comment-extensions.mjs +11 -2
  70. package/dist-esm/ui/comment-extensions.mjs.map +2 -2
  71. package/dist-esm/ui/comments-list.mjs +6 -7
  72. package/dist-esm/ui/comments-list.mjs.map +2 -2
  73. package/dist-esm/ui/icons.mjs +4 -4
  74. package/dist-esm/ui/icons.mjs.map +2 -2
  75. package/dist-esm/ui/reaction-picker.mjs +2 -2
  76. package/dist-esm/ui/reaction-picker.mjs.map +1 -1
  77. package/dist-esm/ui/send-button.mjs.map +1 -1
  78. package/package.json +5 -5
  79. package/src/canvas/canvas-events.ts +39 -2
  80. package/src/canvas/canvas.css +73 -38
  81. package/src/canvas/comment-render.test.ts +8 -1
  82. package/src/canvas/comment-tool.test.ts +34 -44
  83. package/src/canvas/comment-tool.tsx +51 -55
  84. package/src/canvas/comments-filter-menu.tsx +19 -6
  85. package/src/canvas/comments-overflow-menu.tsx +12 -18
  86. package/src/canvas/comments-overlay.tsx +5 -2
  87. package/src/canvas/comments-sidebar.tsx +20 -5
  88. package/src/canvas/comments-visibility-toggle.tsx +1 -1
  89. package/src/canvas/options.ts +21 -2
  90. package/src/canvas/pending-composer.tsx +182 -17
  91. package/src/canvas/region-box.tsx +192 -42
  92. package/src/canvas/thread-pin.tsx +28 -6
  93. package/src/canvas/thread-view.test.ts +39 -0
  94. package/src/canvas/thread-view.tsx +185 -70
  95. package/src/ui/byline.tsx +5 -2
  96. package/src/ui/comment-card.tsx +7 -1
  97. package/src/ui/comment-extensions.ts +18 -5
  98. package/src/ui/comments-list.tsx +23 -17
  99. package/src/ui/comments.css +175 -201
  100. package/src/ui/icons.tsx +5 -5
  101. package/src/ui/reaction-picker.tsx +2 -2
  102. package/src/ui/send-button.tsx +2 -2
@@ -53,7 +53,7 @@ export { AvatarProps }
53
53
  * shows the full date and time in a tooltip.
54
54
  * @public @react
55
55
  */
56
- export declare function Byline({ author, date, edited }: BylineProps): JSX.Element;
56
+ export declare function Byline({ author, date, edited, renderAvatar }: BylineProps): JSX.Element;
57
57
 
58
58
  /** @public */
59
59
  export declare interface BylineProps {
@@ -62,6 +62,8 @@ export declare interface BylineProps {
62
62
  date: string;
63
63
  /** Shows an "edited" marker when the comment has been edited. */
64
64
  edited?: boolean;
65
+ /** Draws the author's avatar. Defaults to `<Avatar>`. */
66
+ renderAvatar?(author: CommentAuthor): ReactNode;
65
67
  }
66
68
 
67
69
  /**
@@ -129,7 +131,7 @@ export declare interface CommentBodyProps {
129
131
  }
130
132
 
131
133
  /** A single comment: Avatar, Byline, and a body slot the consumer renders. @public @react */
132
- export declare function CommentCard({ author, body, date, you, edited, actions, footer, }: CommentCardProps): JSX.Element;
134
+ export declare function CommentCard({ author, body, date, you, edited, byline, renderAvatar, actions, footer, }: CommentCardProps): JSX.Element;
133
135
 
134
136
  /** @public */
135
137
  export declare interface CommentCardProps {
@@ -142,6 +144,10 @@ export declare interface CommentCardProps {
142
144
  you: boolean;
143
145
  /** Whether the comment has been edited (shows an "edited" marker). */
144
146
  edited?: boolean;
147
+ /** Replaces the default `<Byline>` built from `author`, `date`, and `edited`. */
148
+ byline?: ReactNode;
149
+ /** Draws the default byline's avatar. Defaults to `<Avatar>`. */
150
+ renderAvatar?(author: CommentAuthor): ReactNode;
145
151
  /** Hover-revealed controls at the card's top-right (e.g. an edit affordance). */
146
152
  actions?: ReactNode;
147
153
  /** Content under the body, aligned with it rather than the avatar (e.g. a `<Reactions>` row). */
@@ -191,6 +197,24 @@ export declare interface CommentingComponents {
191
197
  CommentBody?: ComponentType<{
192
198
  comment: TLComment;
193
199
  }>;
200
+ /**
201
+ * A comment's byline: the author's avatar and name, the time, and the edited marker. Replaces the
202
+ * default `<Byline>`, which is exported — so a byline that only changes how the author is shown
203
+ * (a badge read from `comment.meta`, say) can spread these props into it with a different
204
+ * `author`. `author` is what `resolveAuthor` returned for the comment's `authorId`.
205
+ */
206
+ CommentByline?: ComponentType<BylineProps & {
207
+ comment: TLComment;
208
+ }>;
209
+ /**
210
+ * An author's avatar, wherever the layer draws one: comment bylines, sidebar rows, the composers,
211
+ * and the default pin content. Replaces the default `<Avatar>`, which is exported — so an avatar
212
+ * that only adds something (a presence ring, a badge) can spread these props into it. `authorId`
213
+ * is the id `author` was resolved from, or `null` in a composer with no signed-in user.
214
+ */
215
+ Avatar?: ComponentType<AvatarProps & {
216
+ authorId: null | string;
217
+ }>;
194
218
  /** A pin's inner content. Replaces the author-initial default. */
195
219
  PinContent?: ComponentType<{
196
220
  comments: TLComment[];
@@ -203,9 +227,11 @@ export declare interface CommentingComponents {
203
227
  /**
204
228
  * A whole sidebar row. Replaces the default `<CommentListItem>`, which is exported — so a row
205
229
  * that only adds an unread dot or a status chip can spread these props into it. Use
206
- * `ThreadPreview` instead when only the preview text is changing.
230
+ * `ThreadPreview` instead when only the preview text is changing. `comments` are the thread's
231
+ * live comments, oldest first.
207
232
  */
208
233
  ThreadRow?: ComponentType<CommentListItemRenderProps & {
234
+ comments: TLComment[];
209
235
  thread: TLCommentThread;
210
236
  }>;
211
237
  /**
@@ -399,7 +425,7 @@ export declare interface CommentingOptions {
399
425
  }
400
426
 
401
427
  /** One thread's row in a {@link CommentsList}. @public @react */
402
- export declare function CommentListItem({ id, author, preview, date, resolved, page, count, selected, reactions, href, resolvedLabel, onSelect, }: CommentListItemRenderProps): JSX.Element;
428
+ export declare function CommentListItem({ id, author, preview, date, resolved, page, count, selected, reactions, href, renderAvatar, resolvedLabel, onSelect, }: CommentListItemRenderProps): JSX.Element;
403
429
 
404
430
  /** @public */
405
431
  export declare interface CommentListItemProps {
@@ -419,6 +445,8 @@ export declare interface CommentListItemProps {
419
445
  /** Tallied reactions for the row (a thread's, or a single comment's when the row is one
420
446
  * comment), shown as inert pills under the preview. Omit to hide. */
421
447
  reactions?: ReactionSummary[];
448
+ /** Draws the author's avatar. Defaults to `<Avatar>`. */
449
+ renderAvatar?(author: CommentAuthor): ReactNode;
422
450
  /**
423
451
  * Link target for the item. When set, the row renders as an anchor so browser affordances
424
452
  * (ctrl/cmd-click, middle-click) open it in a new tab; a plain click still calls `onSelect`.
@@ -625,8 +653,8 @@ export declare interface CommentThreadProps {
625
653
  * release — like placing a sticky note — settling on a point, or on a shape when released over one.
626
654
  * With region comments enabled, dragging past the threshold draws a region rectangle instead.
627
655
  * Placement only opens a composer; the records are created when the comment is posted. The tool
628
- * stays active while the composer is open — posting returns to select, and so does clicking the
629
- * canvas elsewhere, which cancels the placement.
656
+ * stays active after a placement, so comments can be placed one after another. Escape closes an
657
+ * open composer first, then returns to the select tool.
630
658
  * @public
631
659
  */
632
660
  export declare class CommentTool extends StateNode {
@@ -1213,12 +1241,12 @@ export declare function revealThread(editor: Editor, threadOrCommentId: string):
1213
1241
  */
1214
1242
  export declare function richTextToPlaintext(body: TLRichText, resolveName?: (id: string) => string | undefined): string;
1215
1243
 
1216
- /** The button that posts a comment — an up arrow. @public @react */
1244
+ /** The button that posts a comment — a return arrow. @public @react */
1217
1245
  export declare function SendButton({ label, disabled, onClick }: SendButtonProps): JSX.Element;
1218
1246
 
1219
1247
  /** @public */
1220
1248
  export declare interface SendButtonProps {
1221
- /** The button's accessible name (e.g. "Send"). Shown as an up-arrow icon, so this is its label. */
1249
+ /** The button's accessible name (e.g. "Send"). Shown as a return-arrow icon, so this is its label. */
1222
1250
  label: string;
1223
1251
  disabled?: boolean;
1224
1252
  onClick?(): void;
@@ -1292,9 +1320,9 @@ export declare function sortSidebarRows(rows: readonly SidebarRow[]): readonly S
1292
1320
 
1293
1321
  /**
1294
1322
  * Open the comment composer at a page point, anchored as a comment tool click there would be. Use
1295
- * it to start a comment from outside the tool, such as a context menu item. Enters the comment tool
1296
- * (which must be registered), since the draft composer closes when the tool exits. It doesn't check
1297
- * `canComment`: a viewer who can't comment sees the `ComposerFallback` slot instead.
1323
+ * it to start a comment from outside the tool, such as a context menu item. It leaves the select
1324
+ * tool active with the composer open. It doesn't check `canComment`: a
1325
+ * viewer who can't comment sees the `ComposerFallback` slot instead.
1298
1326
  *
1299
1327
  * @example
1300
1328
  * ```tsx
package/dist-cjs/index.js CHANGED
@@ -145,7 +145,7 @@ var import_state = require("./canvas/state");
145
145
  var import_thread_state = require("./canvas/thread-state");
146
146
  (0, import_utils.registerTldrawLibraryVersion)(
147
147
  "@tldraw/commenting",
148
- "5.7.0-canary.ea40e3961399",
148
+ "5.7.0-canary.ed10ee6bcceb",
149
149
  "cjs"
150
150
  );
151
151
  //# sourceMappingURL=index.js.map
@@ -25,10 +25,10 @@ var import_jsx_runtime = require("react/jsx-runtime");
25
25
  var import_mentions = require("@tldraw/mentions");
26
26
  var import_tldraw = require("tldraw");
27
27
  var import_format_time = require("./format-time");
28
- function Byline({ author, date, edited }) {
28
+ function Byline({ author, date, edited, renderAvatar }) {
29
29
  const { locale } = (0, import_tldraw.useCurrentTranslation)();
30
30
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-cmt-head", children: [
31
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mentions.Avatar, { author }),
31
+ renderAvatar ? renderAvatar(author) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mentions.Avatar, { author }),
32
32
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "tlui-cmt-author", children: author.name }),
33
33
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tldraw.TldrawUiTooltip, { content: (0, import_format_time.formatFullDateTime)(date, locale), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "tlui-cmt-time", children: [
34
34
  (0, import_format_time.formatRelativeTime)(date, locale),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/byline.tsx"],
4
- "sourcesContent": ["import { Avatar, type CommentAuthor } from '@tldraw/mentions'\nimport { TldrawUiTooltip, useCurrentTranslation } from 'tldraw'\nimport { formatFullDateTime, formatRelativeTime } from './format-time'\n\n/** @public */\nexport interface BylineProps {\n\tauthor: CommentAuthor\n\t/** ISO datetime; formatted to relative time by the component. */\n\tdate: string\n\t/** Shows an \"edited\" marker when the comment has been edited. */\n\tedited?: boolean\n}\n\n/**\n * A comment's metadata line: author name, relative time, and an edited marker. Hovering the time\n * shows the full date and time in a tooltip.\n * @public @react\n */\nexport function Byline({ author, date, edited }: BylineProps) {\n\t// The relative time is the one piece of a byline that isn't the host's data, so it follows the\n\t// same translation context as every other string in the UI rather than a prop of its own.\n\tconst { locale } = useCurrentTranslation()\n\treturn (\n\t\t<div className=\"tlui-cmt-head\">\n\t\t\t<Avatar author={author} />\n\t\t\t<span className=\"tlui-cmt-author\">{author.name}</span>\n\t\t\t<TldrawUiTooltip content={formatFullDateTime(date, locale)}>\n\t\t\t\t<span className=\"tlui-cmt-time\">\n\t\t\t\t\t{formatRelativeTime(date, locale)}\n\t\t\t\t\t{edited && <span className=\"tlui-cmt-edited\"> \u00B7 edited</span>}\n\t\t\t\t</span>\n\t\t\t</TldrawUiTooltip>\n\t\t</div>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBG;AAxBH,sBAA2C;AAC3C,oBAAuD;AACvD,yBAAuD;AAgBhD,SAAS,OAAO,EAAE,QAAQ,MAAM,OAAO,GAAgB;AAG7D,QAAM,EAAE,OAAO,QAAI,qCAAsB;AACzC,SACC,6CAAC,SAAI,WAAU,iBACd;AAAA,gDAAC,0BAAO,QAAgB;AAAA,IACxB,4CAAC,UAAK,WAAU,mBAAmB,iBAAO,MAAK;AAAA,IAC/C,4CAAC,iCAAgB,aAAS,uCAAmB,MAAM,MAAM,GACxD,uDAAC,UAAK,WAAU,iBACd;AAAA,iDAAmB,MAAM,MAAM;AAAA,MAC/B,UAAU,4CAAC,UAAK,WAAU,mBAAkB,0BAAS;AAAA,OACvD,GACD;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["import { Avatar, type CommentAuthor } from '@tldraw/mentions'\nimport { type ReactNode } from 'react'\nimport { TldrawUiTooltip, useCurrentTranslation } from 'tldraw'\nimport { formatFullDateTime, formatRelativeTime } from './format-time'\n\n/** @public */\nexport interface BylineProps {\n\tauthor: CommentAuthor\n\t/** ISO datetime; formatted to relative time by the component. */\n\tdate: string\n\t/** Shows an \"edited\" marker when the comment has been edited. */\n\tedited?: boolean\n\t/** Draws the author's avatar. Defaults to `<Avatar>`. */\n\trenderAvatar?(author: CommentAuthor): ReactNode\n}\n\n/**\n * A comment's metadata line: author name, relative time, and an edited marker. Hovering the time\n * shows the full date and time in a tooltip.\n * @public @react\n */\nexport function Byline({ author, date, edited, renderAvatar }: BylineProps) {\n\t// The relative time is the one piece of a byline that isn't the host's data, so it follows the\n\t// same translation context as every other string in the UI rather than a prop of its own.\n\tconst { locale } = useCurrentTranslation()\n\treturn (\n\t\t<div className=\"tlui-cmt-head\">\n\t\t\t{renderAvatar ? renderAvatar(author) : <Avatar author={author} />}\n\t\t\t<span className=\"tlui-cmt-author\">{author.name}</span>\n\t\t\t<TldrawUiTooltip content={formatFullDateTime(date, locale)}>\n\t\t\t\t<span className=\"tlui-cmt-time\">\n\t\t\t\t\t{formatRelativeTime(date, locale)}\n\t\t\t\t\t{edited && <span className=\"tlui-cmt-edited\"> \u00B7 edited</span>}\n\t\t\t\t</span>\n\t\t\t</TldrawUiTooltip>\n\t\t</div>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2B0C;AA3B1C,sBAA2C;AAE3C,oBAAuD;AACvD,yBAAuD;AAkBhD,SAAS,OAAO,EAAE,QAAQ,MAAM,QAAQ,aAAa,GAAgB;AAG3E,QAAM,EAAE,OAAO,QAAI,qCAAsB;AACzC,SACC,6CAAC,SAAI,WAAU,iBACb;AAAA,mBAAe,aAAa,MAAM,IAAI,4CAAC,0BAAO,QAAgB;AAAA,IAC/D,4CAAC,UAAK,WAAU,mBAAmB,iBAAO,MAAK;AAAA,IAC/C,4CAAC,iCAAgB,aAAS,uCAAmB,MAAM,MAAM,GACxD,uDAAC,UAAK,WAAU,iBACd;AAAA,iDAAmB,MAAM,MAAM;AAAA,MAC/B,UAAU,4CAAC,UAAK,WAAU,mBAAkB,0BAAS;AAAA,OACvD,GACD;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -29,11 +29,13 @@ function CommentCard({
29
29
  date,
30
30
  you,
31
31
  edited,
32
+ byline,
33
+ renderAvatar,
32
34
  actions,
33
35
  footer
34
36
  }) {
35
37
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: you ? "tlui-cmt-card tlui-cmt-card--you" : "tlui-cmt-card", children: [
36
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_byline.Byline, { author, date, edited }),
38
+ byline ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_byline.Byline, { author, date, edited, renderAvatar }),
37
39
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-cmt-body", children: [
38
40
  body,
39
41
  footer
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/comment-card.tsx"],
4
- "sourcesContent": ["import { type CommentAuthor } from '@tldraw/mentions'\nimport { ReactNode } from 'react'\nimport { Byline } from './byline'\n\n/** @public */\nexport interface CommentCardProps {\n\tauthor: CommentAuthor\n\t/** The rendered comment body. The card doesn't dictate a format \u2014 pass a `<CommentBody>`\n\t * for a comment's rich text, or any node of your own. */\n\tbody: ReactNode\n\t/** ISO datetime; formatted to relative time by the component. */\n\tdate: string\n\tyou: boolean\n\t/** Whether the comment has been edited (shows an \"edited\" marker). */\n\tedited?: boolean\n\t/** Hover-revealed controls at the card's top-right (e.g. an edit affordance). */\n\tactions?: ReactNode\n\t/** Content under the body, aligned with it rather than the avatar (e.g. a `<Reactions>` row). */\n\tfooter?: ReactNode\n}\n\n/** A single comment: Avatar, Byline, and a body slot the consumer renders. @public @react */\nexport function CommentCard({\n\tauthor,\n\tbody,\n\tdate,\n\tyou,\n\tedited,\n\tactions,\n\tfooter,\n}: CommentCardProps) {\n\treturn (\n\t\t<div className={you ? 'tlui-cmt-card tlui-cmt-card--you' : 'tlui-cmt-card'}>\n\t\t\t<Byline author={author} date={date} edited={edited} />\n\t\t\t<div className=\"tlui-cmt-body\">\n\t\t\t\t{body}\n\t\t\t\t{footer}\n\t\t\t</div>\n\t\t\t{actions !== undefined && <div className=\"tlui-cmt-card__actions\">{actions}</div>}\n\t\t</div>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCG;AA/BH,oBAAuB;AAoBhB,SAAS,YAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAqB;AACpB,SACC,6CAAC,SAAI,WAAW,MAAM,qCAAqC,iBAC1D;AAAA,gDAAC,wBAAO,QAAgB,MAAY,QAAgB;AAAA,IACpD,6CAAC,SAAI,WAAU,iBACb;AAAA;AAAA,MACA;AAAA,OACF;AAAA,IACC,YAAY,UAAa,4CAAC,SAAI,WAAU,0BAA0B,mBAAQ;AAAA,KAC5E;AAEF;",
4
+ "sourcesContent": ["import { type CommentAuthor } from '@tldraw/mentions'\nimport { ReactNode } from 'react'\nimport { Byline } from './byline'\n\n/** @public */\nexport interface CommentCardProps {\n\tauthor: CommentAuthor\n\t/** The rendered comment body. The card doesn't dictate a format \u2014 pass a `<CommentBody>`\n\t * for a comment's rich text, or any node of your own. */\n\tbody: ReactNode\n\t/** ISO datetime; formatted to relative time by the component. */\n\tdate: string\n\tyou: boolean\n\t/** Whether the comment has been edited (shows an \"edited\" marker). */\n\tedited?: boolean\n\t/** Replaces the default `<Byline>` built from `author`, `date`, and `edited`. */\n\tbyline?: ReactNode\n\t/** Draws the default byline's avatar. Defaults to `<Avatar>`. */\n\trenderAvatar?(author: CommentAuthor): ReactNode\n\t/** Hover-revealed controls at the card's top-right (e.g. an edit affordance). */\n\tactions?: ReactNode\n\t/** Content under the body, aligned with it rather than the avatar (e.g. a `<Reactions>` row). */\n\tfooter?: ReactNode\n}\n\n/** A single comment: Avatar, Byline, and a body slot the consumer renders. @public @react */\nexport function CommentCard({\n\tauthor,\n\tbody,\n\tdate,\n\tyou,\n\tedited,\n\tbyline,\n\trenderAvatar,\n\tactions,\n\tfooter,\n}: CommentCardProps) {\n\treturn (\n\t\t<div className={you ? 'tlui-cmt-card tlui-cmt-card--you' : 'tlui-cmt-card'}>\n\t\t\t{byline ?? <Byline author={author} date={date} edited={edited} renderAvatar={renderAvatar} />}\n\t\t\t<div className=\"tlui-cmt-body\">\n\t\t\t\t{body}\n\t\t\t\t{footer}\n\t\t\t</div>\n\t\t\t{actions !== undefined && <div className=\"tlui-cmt-card__actions\">{actions}</div>}\n\t\t</div>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuCc;AArCd,oBAAuB;AAwBhB,SAAS,YAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAqB;AACpB,SACC,6CAAC,SAAI,WAAW,MAAM,qCAAqC,iBACzD;AAAA,cAAU,4CAAC,wBAAO,QAAgB,MAAY,QAAgB,cAA4B;AAAA,IAC3F,6CAAC,SAAI,WAAU,iBACb;AAAA;AAAA,MACA;AAAA,OACF;AAAA,IACC,YAAY,UAAa,4CAAC,SAAI,WAAU,0BAA0B,mBAAQ;AAAA,KAC5E;AAEF;",
6
6
  "names": []
7
7
  }
@@ -24,7 +24,10 @@ __export(comment_extensions_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(comment_extensions_exports);
26
26
  var import_tldraw = require("tldraw");
27
- const commentTipTapExtensions = (0, import_tldraw.getTipTapDefaultExtensions)({ heading: false });
27
+ const TASK_EXTENSION_NAMES = /* @__PURE__ */ new Set([import_tldraw.TaskList.name, import_tldraw.TaskItem.name, import_tldraw.TaskItemToggleExtension.name]);
28
+ const commentTipTapExtensions = (0, import_tldraw.getTipTapDefaultExtensions)({ heading: false }).filter(
29
+ (extension) => !TASK_EXTENSION_NAMES.has(extension.name)
30
+ );
28
31
  const EMPTY_COMMENT = (0, import_tldraw.toRichText)("");
29
32
  function isCommentEmpty(richText) {
30
33
  if (richText.content.length === 0) return true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/comment-extensions.ts"],
4
- "sourcesContent": ["import { getTipTapDefaultExtensions, TLRichText, toRichText } from 'tldraw'\n\n/**\n * tldraw's default rich-text extension set, minus headings \u2014 the deliberately limited set used for\n * both the comment composer and comment display. Comments support paragraphs, bold, italic, lists,\n * links, code, and highlight, but not headings. Built from tldraw's shared factory so the config\n * stays in lockstep with the text shape's defaults rather than drifting from a copy.\n */\nexport const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false })\n\n/** An empty comment document \u2014 the seed value for a fresh composer and its post-submit reset. */\nexport const EMPTY_COMMENT: TLRichText = toRichText('')\n\n/**\n * Whether a rich-text comment body has no text. Mirrors tldraw's private `isEmptyRichText`: an\n * empty doc can be encoded as an empty `content` array or a single empty paragraph.\n */\nexport function isCommentEmpty(richText: TLRichText): boolean {\n\tif (richText.content.length === 0) return true\n\tif (richText.content.length === 1) {\n\t\tconst node = richText.content[0] as any\n\t\tif (!node.content || node.content.length === 0) return true\n\t}\n\treturn false\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmE;AAQ5D,MAAM,8BAA0B,0CAA2B,EAAE,SAAS,MAAM,CAAC;AAG7E,MAAM,oBAA4B,0BAAW,EAAE;AAM/C,SAAS,eAAe,UAA+B;AAC7D,MAAI,SAAS,QAAQ,WAAW,EAAG,QAAO;AAC1C,MAAI,SAAS,QAAQ,WAAW,GAAG;AAClC,UAAM,OAAO,SAAS,QAAQ,CAAC;AAC/B,QAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACR;",
4
+ "sourcesContent": ["import {\n\tgetTipTapDefaultExtensions,\n\tTaskItem,\n\tTaskItemToggleExtension,\n\tTaskList,\n\tTLRichText,\n\ttoRichText,\n} from 'tldraw'\n\n// A posted comment is static HTML with nothing to write a click back to, so a checkbox there would\n// toggle on screen and snap back.\nconst TASK_EXTENSION_NAMES = new Set([TaskList.name, TaskItem.name, TaskItemToggleExtension.name])\n\n/**\n * tldraw's default rich-text extension set, minus headings and task lists \u2014 the deliberately\n * limited set used for both the comment composer and comment display. Comments support paragraphs,\n * bold, italic, lists, links, code, and highlight. Built from tldraw's shared factory so the config\n * stays in lockstep with the text shape's defaults rather than drifting from a copy.\n */\nexport const commentTipTapExtensions = getTipTapDefaultExtensions({ heading: false }).filter(\n\t(extension) => !TASK_EXTENSION_NAMES.has(extension.name)\n)\n\n/** An empty comment document \u2014 the seed value for a fresh composer and its post-submit reset. */\nexport const EMPTY_COMMENT: TLRichText = toRichText('')\n\n/**\n * Whether a rich-text comment body has no text. Mirrors tldraw's private `isEmptyRichText`: an\n * empty doc can be encoded as an empty `content` array or a single empty paragraph.\n */\nexport function isCommentEmpty(richText: TLRichText): boolean {\n\tif (richText.content.length === 0) return true\n\tif (richText.content.length === 1) {\n\t\tconst node = richText.content[0] as any\n\t\tif (!node.content || node.content.length === 0) return true\n\t}\n\treturn false\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOO;AAIP,MAAM,uBAAuB,oBAAI,IAAI,CAAC,uBAAS,MAAM,uBAAS,MAAM,sCAAwB,IAAI,CAAC;AAQ1F,MAAM,8BAA0B,0CAA2B,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,EACrF,CAAC,cAAc,CAAC,qBAAqB,IAAI,UAAU,IAAI;AACxD;AAGO,MAAM,oBAA4B,0BAAW,EAAE;AAM/C,SAAS,eAAe,UAA+B;AAC7D,MAAI,SAAS,QAAQ,WAAW,EAAG,QAAO;AAC1C,MAAI,SAAS,QAAQ,WAAW,GAAG;AAClC,UAAM,OAAO,SAAS,QAAQ,CAAC;AAC/B,QAAI,CAAC,KAAK,WAAW,KAAK,QAAQ,WAAW,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -24,7 +24,6 @@ __export(comments_list_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(comments_list_exports);
26
26
  var import_jsx_runtime = require("react/jsx-runtime");
27
- var import_mentions = require("@tldraw/mentions");
28
27
  var import_react = require("react");
29
28
  var import_tldraw = require("tldraw");
30
29
  var import_byline = require("./byline");
@@ -62,6 +61,7 @@ function CommentListItem({
62
61
  selected,
63
62
  reactions,
64
63
  href,
64
+ renderAvatar,
65
65
  resolvedLabel = "Resolved",
66
66
  onSelect
67
67
  }) {
@@ -73,17 +73,16 @@ function CommentListItem({
73
73
  };
74
74
  const Tag = href ? "a" : "button";
75
75
  const replies = count !== void 0 ? (0, import_reply_count.replyCountLabel)(msg, count - 1) : null;
76
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
76
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
77
77
  Tag,
78
78
  {
79
79
  ...href ? { href } : { type: "button" },
80
80
  className: selected ? "tlui-cmt-list__item tlui-cmt-list__item--selected" : "tlui-cmt-list__item",
81
81
  "data-resolved": resolved || void 0,
82
82
  onClick: handleClick,
83
- children: [
84
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mentions.Avatar, { author }),
85
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-cmt-list__item-body", children: [
86
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_byline.Byline, { author, date }),
83
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-cmt-list__item-body", children: [
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_byline.Byline, { author, date, renderAvatar }),
85
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-cmt-body", children: [
87
86
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-cmt-list__item-preview", children: preview }),
88
87
  reactions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reactions.Reactions, { reactions, canReact: false, enableHoverList: false }),
89
88
  (resolved || page !== void 0 || replies) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-cmt-list__item-meta", children: [
@@ -95,7 +94,7 @@ function CommentListItem({
95
94
  replies && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "tlui-cmt-list__item-replies", children: replies })
96
95
  ] })
97
96
  ] })
98
- ]
97
+ ] })
99
98
  }
100
99
  );
101
100
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/comments-list.tsx"],
4
- "sourcesContent": ["import { Avatar, type CommentAuthor } from '@tldraw/mentions'\nimport { Fragment, MouseEvent, ReactNode } from 'react'\nimport { useTranslation } from 'tldraw'\nimport { Byline } from './byline'\nimport { CheckIcon } from './icons'\nimport { Reactions, type ReactionSummary } from './reactions'\nimport { replyCountLabel } from './reply-count'\n\n/** @public */\nexport interface CommentListItemProps {\n\tid: string\n\tauthor: CommentAuthor\n\t/** A short preview of the thread \u2014 e.g. the first comment's body. */\n\tpreview: ReactNode\n\t/** ISO datetime of the thread's first comment. */\n\tdate: string\n\tresolved?: boolean\n\t/** Name of the page the thread lives on, shown as a small label. Omit to hide. */\n\tpage?: string\n\t/** Total comments in the thread. */\n\tcount?: number\n\t/** Whether this thread is the open one. */\n\tselected?: boolean\n\t/** Tallied reactions for the row (a thread's, or a single comment's when the row is one\n\t * comment), shown as inert pills under the preview. Omit to hide. */\n\treactions?: ReactionSummary[]\n\t/**\n\t * Link target for the item. When set, the row renders as an anchor so browser affordances\n\t * (ctrl/cmd-click, middle-click) open it in a new tab; a plain click still calls `onSelect`.\n\t */\n\thref?: string\n}\n\n/**\n * What a row is rendered with: the item, plus the list-level wiring it needs to be interactive.\n * A custom row gets the same props the default `<CommentListItem>` does, so it can wrap the\n * default rather than reimplement it.\n *\n * @public\n */\nexport interface CommentListItemRenderProps extends CommentListItemProps {\n\t/** Label for a resolved thread's marker on its row. */\n\tresolvedLabel?: string\n\t/** Called with the thread id when the row is chosen. */\n\tonSelect?(id: string): void\n}\n\n/** @public */\nexport interface CommentsListProps {\n\titems: CommentListItemProps[]\n\t/** Called with a thread id when an item is chosen. */\n\tonSelect?(id: string): void\n\t/** Shown above the list (e.g. \"Comments\"). Omit for none. */\n\theader?: ReactNode\n\t/** Rendered at the right of the header row \u2014 e.g. a filter menu. */\n\theaderAction?: ReactNode\n\t/** Shown in place of the list when there are no threads. */\n\tempty?: ReactNode\n\t/** Label for a resolved thread's marker on its row. Defaults to \"Resolved\". */\n\tresolvedLabel?: string\n\t/**\n\t * Override how each item renders. Defaults to `<CommentListItem>`, which is exported \u2014 so a\n\t * row that only adds something can spread these props into it rather than start over. The list\n\t * supplies the key, so a custom row doesn't need one.\n\t */\n\trenderItem?(props: CommentListItemRenderProps): ReactNode\n}\n\n/**\n * A scrollable list of comment threads \u2014 each an avatar, byline, and a one-line preview.\n * Presentational: you supply the items (already summarised) and an `onSelect` handler; the canvas\n * `CanvasCommentsSidebar` wires it to the store, but a consumer can build their own list from this.\n * @public @react\n */\nexport function CommentsList({\n\titems,\n\tonSelect,\n\theader,\n\theaderAction,\n\tempty,\n\tresolvedLabel,\n\trenderItem,\n}: CommentsListProps) {\n\treturn (\n\t\t<div className=\"tlui-cmt-list\">\n\t\t\t{(header !== undefined || headerAction) && (\n\t\t\t\t<div className=\"tlui-cmt-list__header\">\n\t\t\t\t\t{header !== undefined && <span className=\"tlui-cmt-list__header-title\">{header}</span>}\n\t\t\t\t\t{headerAction}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{items.length === 0 ? (\n\t\t\t\t<div className=\"tlui-cmt-list__empty\">{empty}</div>\n\t\t\t) : (\n\t\t\t\t<div className=\"tlui-cmt-list__items\">\n\t\t\t\t\t{items.map((item) => {\n\t\t\t\t\t\tconst props: CommentListItemRenderProps = { ...item, resolvedLabel, onSelect }\n\t\t\t\t\t\t// A custom row is wrapped rather than keyed directly: it's the consumer's element,\n\t\t\t\t\t\t// and requiring them to remember a key is the kind of thing that only shows up as a\n\t\t\t\t\t\t// console warning in someone else's app.\n\t\t\t\t\t\treturn renderItem ? (\n\t\t\t\t\t\t\t<Fragment key={item.id}>{renderItem(props)}</Fragment>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<CommentListItem key={item.id} {...props} />\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\n/** One thread's row in a {@link CommentsList}. @public @react */\nexport function CommentListItem({\n\tid,\n\tauthor,\n\tpreview,\n\tdate,\n\tresolved,\n\tpage,\n\tcount,\n\tselected,\n\treactions,\n\thref,\n\tresolvedLabel = 'Resolved',\n\tonSelect,\n}: CommentListItemRenderProps) {\n\tconst msg = useTranslation()\n\tconst handleClick = (e: MouseEvent) => {\n\t\tif (href && isOpenInNewTabClick(e)) return\n\t\te.preventDefault()\n\t\tif (onSelect) onSelect(id)\n\t}\n\tconst Tag = href ? 'a' : 'button'\n\t// `count` is the thread's total comments; a reply is every comment after the opening one.\n\tconst replies = count !== undefined ? replyCountLabel(msg, count - 1) : null\n\treturn (\n\t\t<Tag\n\t\t\t{...(href ? { href } : { type: 'button' })}\n\t\t\tclassName={\n\t\t\t\tselected ? 'tlui-cmt-list__item tlui-cmt-list__item--selected' : 'tlui-cmt-list__item'\n\t\t\t}\n\t\t\tdata-resolved={resolved || undefined}\n\t\t\tonClick={handleClick}\n\t\t>\n\t\t\t<Avatar author={author} />\n\t\t\t<div className=\"tlui-cmt-list__item-body\">\n\t\t\t\t<Byline author={author} date={date} />\n\t\t\t\t<div className=\"tlui-cmt-list__item-preview\">{preview}</div>\n\t\t\t\t{reactions && <Reactions reactions={reactions} canReact={false} enableHoverList={false} />}\n\t\t\t\t{(resolved || page !== undefined || replies) && (\n\t\t\t\t\t<div className=\"tlui-cmt-list__item-meta\">\n\t\t\t\t\t\t{resolved && (\n\t\t\t\t\t\t\t<span className=\"tlui-cmt-list__item-resolved\">\n\t\t\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t\t\t\t{resolvedLabel}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{page !== undefined && <span className=\"tlui-cmt-list__item-page\">{page}</span>}\n\t\t\t\t\t\t{replies && <span className=\"tlui-cmt-list__item-replies\">{replies}</span>}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</Tag>\n\t)\n}\n\n/**\n * Whether a click should be left to the browser's link handling (new tab, new window, or download).\n * @public\n */\nexport function isOpenInNewTabClick(e: MouseEvent) {\n\treturn e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsFI;AAtFJ,sBAA2C;AAC3C,mBAAgD;AAChD,oBAA+B;AAC/B,oBAAuB;AACvB,mBAA0B;AAC1B,uBAAgD;AAChD,yBAAgC;AAoEzB,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAsB;AACrB,SACC,6CAAC,SAAI,WAAU,iBACZ;AAAA,gBAAW,UAAa,iBACzB,6CAAC,SAAI,WAAU,yBACb;AAAA,iBAAW,UAAa,4CAAC,UAAK,WAAU,+BAA+B,kBAAO;AAAA,MAC9E;AAAA,OACF;AAAA,IAEA,MAAM,WAAW,IACjB,4CAAC,SAAI,WAAU,wBAAwB,iBAAM,IAE7C,4CAAC,SAAI,WAAU,wBACb,gBAAM,IAAI,CAAC,SAAS;AACpB,YAAM,QAAoC,EAAE,GAAG,MAAM,eAAe,SAAS;AAI7E,aAAO,aACN,4CAAC,yBAAwB,qBAAW,KAAK,KAA1B,KAAK,EAAuB,IAE3C,4CAAC,mBAA+B,GAAG,SAAb,KAAK,EAAe;AAAA,IAE5C,CAAC,GACF;AAAA,KAEF;AAEF;AAGO,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AACD,GAA+B;AAC9B,QAAM,UAAM,8BAAe;AAC3B,QAAM,cAAc,CAAC,MAAkB;AACtC,QAAI,QAAQ,oBAAoB,CAAC,EAAG;AACpC,MAAE,eAAe;AACjB,QAAI,SAAU,UAAS,EAAE;AAAA,EAC1B;AACA,QAAM,MAAM,OAAO,MAAM;AAEzB,QAAM,UAAU,UAAU,aAAY,oCAAgB,KAAK,QAAQ,CAAC,IAAI;AACxE,SACC;AAAA,IAAC;AAAA;AAAA,MACC,GAAI,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS;AAAA,MACxC,WACC,WAAW,sDAAsD;AAAA,MAElE,iBAAe,YAAY;AAAA,MAC3B,SAAS;AAAA,MAET;AAAA,oDAAC,0BAAO,QAAgB;AAAA,QACxB,6CAAC,SAAI,WAAU,4BACd;AAAA,sDAAC,wBAAO,QAAgB,MAAY;AAAA,UACpC,4CAAC,SAAI,WAAU,+BAA+B,mBAAQ;AAAA,UACrD,aAAa,4CAAC,8BAAU,WAAsB,UAAU,OAAO,iBAAiB,OAAO;AAAA,WACtF,YAAY,SAAS,UAAa,YACnC,6CAAC,SAAI,WAAU,4BACb;AAAA,wBACA,6CAAC,UAAK,WAAU,gCACf;AAAA,0DAAC,0BAAU;AAAA,cACV;AAAA,eACF;AAAA,YAEA,SAAS,UAAa,4CAAC,UAAK,WAAU,4BAA4B,gBAAK;AAAA,YACvE,WAAW,4CAAC,UAAK,WAAU,+BAA+B,mBAAQ;AAAA,aACpE;AAAA,WAEF;AAAA;AAAA;AAAA,EACD;AAEF;AAMO,SAAS,oBAAoB,GAAe;AAClD,SAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW;AACzE;",
4
+ "sourcesContent": ["import { type CommentAuthor } from '@tldraw/mentions'\nimport { Fragment, MouseEvent, ReactNode } from 'react'\nimport { useTranslation } from 'tldraw'\nimport { Byline } from './byline'\nimport { CheckIcon } from './icons'\nimport { Reactions, type ReactionSummary } from './reactions'\nimport { replyCountLabel } from './reply-count'\n\n/** @public */\nexport interface CommentListItemProps {\n\tid: string\n\tauthor: CommentAuthor\n\t/** A short preview of the thread \u2014 e.g. the first comment's body. */\n\tpreview: ReactNode\n\t/** ISO datetime of the thread's first comment. */\n\tdate: string\n\tresolved?: boolean\n\t/** Name of the page the thread lives on, shown as a small label. Omit to hide. */\n\tpage?: string\n\t/** Total comments in the thread. */\n\tcount?: number\n\t/** Whether this thread is the open one. */\n\tselected?: boolean\n\t/** Tallied reactions for the row (a thread's, or a single comment's when the row is one\n\t * comment), shown as inert pills under the preview. Omit to hide. */\n\treactions?: ReactionSummary[]\n\t/** Draws the author's avatar. Defaults to `<Avatar>`. */\n\trenderAvatar?(author: CommentAuthor): ReactNode\n\t/**\n\t * Link target for the item. When set, the row renders as an anchor so browser affordances\n\t * (ctrl/cmd-click, middle-click) open it in a new tab; a plain click still calls `onSelect`.\n\t */\n\thref?: string\n}\n\n/**\n * What a row is rendered with: the item, plus the list-level wiring it needs to be interactive.\n * A custom row gets the same props the default `<CommentListItem>` does, so it can wrap the\n * default rather than reimplement it.\n *\n * @public\n */\nexport interface CommentListItemRenderProps extends CommentListItemProps {\n\t/** Label for a resolved thread's marker on its row. */\n\tresolvedLabel?: string\n\t/** Called with the thread id when the row is chosen. */\n\tonSelect?(id: string): void\n}\n\n/** @public */\nexport interface CommentsListProps {\n\titems: CommentListItemProps[]\n\t/** Called with a thread id when an item is chosen. */\n\tonSelect?(id: string): void\n\t/** Shown above the list (e.g. \"Comments\"). Omit for none. */\n\theader?: ReactNode\n\t/** Rendered at the right of the header row \u2014 e.g. a filter menu. */\n\theaderAction?: ReactNode\n\t/** Shown in place of the list when there are no threads. */\n\tempty?: ReactNode\n\t/** Label for a resolved thread's marker on its row. Defaults to \"Resolved\". */\n\tresolvedLabel?: string\n\t/**\n\t * Override how each item renders. Defaults to `<CommentListItem>`, which is exported \u2014 so a\n\t * row that only adds something can spread these props into it rather than start over. The list\n\t * supplies the key, so a custom row doesn't need one.\n\t */\n\trenderItem?(props: CommentListItemRenderProps): ReactNode\n}\n\n/**\n * A scrollable list of comment threads \u2014 each an avatar, byline, and a one-line preview.\n * Presentational: you supply the items (already summarised) and an `onSelect` handler; the canvas\n * `CanvasCommentsSidebar` wires it to the store, but a consumer can build their own list from this.\n * @public @react\n */\nexport function CommentsList({\n\titems,\n\tonSelect,\n\theader,\n\theaderAction,\n\tempty,\n\tresolvedLabel,\n\trenderItem,\n}: CommentsListProps) {\n\treturn (\n\t\t<div className=\"tlui-cmt-list\">\n\t\t\t{(header !== undefined || headerAction) && (\n\t\t\t\t<div className=\"tlui-cmt-list__header\">\n\t\t\t\t\t{header !== undefined && <span className=\"tlui-cmt-list__header-title\">{header}</span>}\n\t\t\t\t\t{headerAction}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{items.length === 0 ? (\n\t\t\t\t<div className=\"tlui-cmt-list__empty\">{empty}</div>\n\t\t\t) : (\n\t\t\t\t<div className=\"tlui-cmt-list__items\">\n\t\t\t\t\t{items.map((item) => {\n\t\t\t\t\t\tconst props: CommentListItemRenderProps = { ...item, resolvedLabel, onSelect }\n\t\t\t\t\t\t// A custom row is wrapped rather than keyed directly: it's the consumer's element,\n\t\t\t\t\t\t// and requiring them to remember a key is the kind of thing that only shows up as a\n\t\t\t\t\t\t// console warning in someone else's app.\n\t\t\t\t\t\treturn renderItem ? (\n\t\t\t\t\t\t\t<Fragment key={item.id}>{renderItem(props)}</Fragment>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<CommentListItem key={item.id} {...props} />\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\n/** One thread's row in a {@link CommentsList}. @public @react */\nexport function CommentListItem({\n\tid,\n\tauthor,\n\tpreview,\n\tdate,\n\tresolved,\n\tpage,\n\tcount,\n\tselected,\n\treactions,\n\thref,\n\trenderAvatar,\n\tresolvedLabel = 'Resolved',\n\tonSelect,\n}: CommentListItemRenderProps) {\n\tconst msg = useTranslation()\n\tconst handleClick = (e: MouseEvent) => {\n\t\tif (href && isOpenInNewTabClick(e)) return\n\t\te.preventDefault()\n\t\tif (onSelect) onSelect(id)\n\t}\n\tconst Tag = href ? 'a' : 'button'\n\t// `count` is the thread's total comments; a reply is every comment after the opening one.\n\tconst replies = count !== undefined ? replyCountLabel(msg, count - 1) : null\n\treturn (\n\t\t<Tag\n\t\t\t{...(href ? { href } : { type: 'button' })}\n\t\t\tclassName={\n\t\t\t\tselected ? 'tlui-cmt-list__item tlui-cmt-list__item--selected' : 'tlui-cmt-list__item'\n\t\t\t}\n\t\t\tdata-resolved={resolved || undefined}\n\t\t\tonClick={handleClick}\n\t\t>\n\t\t\t<div className=\"tlui-cmt-list__item-body\">\n\t\t\t\t<Byline author={author} date={date} renderAvatar={renderAvatar} />\n\t\t\t\t<div className=\"tlui-cmt-body\">\n\t\t\t\t\t<div className=\"tlui-cmt-list__item-preview\">{preview}</div>\n\t\t\t\t\t{reactions && (\n\t\t\t\t\t\t<Reactions reactions={reactions} canReact={false} enableHoverList={false} />\n\t\t\t\t\t)}\n\t\t\t\t\t{(resolved || page !== undefined || replies) && (\n\t\t\t\t\t\t<div className=\"tlui-cmt-list__item-meta\">\n\t\t\t\t\t\t\t{resolved && (\n\t\t\t\t\t\t\t\t<span className=\"tlui-cmt-list__item-resolved\">\n\t\t\t\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t\t\t\t\t{resolvedLabel}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{page !== undefined && <span className=\"tlui-cmt-list__item-page\">{page}</span>}\n\t\t\t\t\t\t\t{replies && <span className=\"tlui-cmt-list__item-replies\">{replies}</span>}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Tag>\n\t)\n}\n\n/**\n * Whether a click should be left to the browser's link handling (new tab, new window, or download).\n * @public\n */\nexport function isOpenInNewTabClick(e: MouseEvent) {\n\treturn e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwFI;AAvFJ,mBAAgD;AAChD,oBAA+B;AAC/B,oBAAuB;AACvB,mBAA0B;AAC1B,uBAAgD;AAChD,yBAAgC;AAsEzB,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAsB;AACrB,SACC,6CAAC,SAAI,WAAU,iBACZ;AAAA,gBAAW,UAAa,iBACzB,6CAAC,SAAI,WAAU,yBACb;AAAA,iBAAW,UAAa,4CAAC,UAAK,WAAU,+BAA+B,kBAAO;AAAA,MAC9E;AAAA,OACF;AAAA,IAEA,MAAM,WAAW,IACjB,4CAAC,SAAI,WAAU,wBAAwB,iBAAM,IAE7C,4CAAC,SAAI,WAAU,wBACb,gBAAM,IAAI,CAAC,SAAS;AACpB,YAAM,QAAoC,EAAE,GAAG,MAAM,eAAe,SAAS;AAI7E,aAAO,aACN,4CAAC,yBAAwB,qBAAW,KAAK,KAA1B,KAAK,EAAuB,IAE3C,4CAAC,mBAA+B,GAAG,SAAb,KAAK,EAAe;AAAA,IAE5C,CAAC,GACF;AAAA,KAEF;AAEF;AAGO,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AACD,GAA+B;AAC9B,QAAM,UAAM,8BAAe;AAC3B,QAAM,cAAc,CAAC,MAAkB;AACtC,QAAI,QAAQ,oBAAoB,CAAC,EAAG;AACpC,MAAE,eAAe;AACjB,QAAI,SAAU,UAAS,EAAE;AAAA,EAC1B;AACA,QAAM,MAAM,OAAO,MAAM;AAEzB,QAAM,UAAU,UAAU,aAAY,oCAAgB,KAAK,QAAQ,CAAC,IAAI;AACxE,SACC;AAAA,IAAC;AAAA;AAAA,MACC,GAAI,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS;AAAA,MACxC,WACC,WAAW,sDAAsD;AAAA,MAElE,iBAAe,YAAY;AAAA,MAC3B,SAAS;AAAA,MAET,uDAAC,SAAI,WAAU,4BACd;AAAA,oDAAC,wBAAO,QAAgB,MAAY,cAA4B;AAAA,QAChE,6CAAC,SAAI,WAAU,iBACd;AAAA,sDAAC,SAAI,WAAU,+BAA+B,mBAAQ;AAAA,UACrD,aACA,4CAAC,8BAAU,WAAsB,UAAU,OAAO,iBAAiB,OAAO;AAAA,WAEzE,YAAY,SAAS,UAAa,YACnC,6CAAC,SAAI,WAAU,4BACb;AAAA,wBACA,6CAAC,UAAK,WAAU,gCACf;AAAA,0DAAC,0BAAU;AAAA,cACV;AAAA,eACF;AAAA,YAEA,SAAS,UAAa,4CAAC,UAAK,WAAU,4BAA4B,gBAAK;AAAA,YACvE,WAAW,4CAAC,UAAK,WAAU,+BAA+B,mBAAQ;AAAA,aACpE;AAAA,WAEF;AAAA,SACD;AAAA;AAAA,EACD;AAEF;AAMO,SAAS,oBAAoB,GAAe;AAClD,SAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW;AACzE;",
6
6
  "names": []
7
7
  }
@@ -72,10 +72,10 @@ function SendIcon() {
72
72
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
73
  "path",
74
74
  {
75
- d: "M7.14645 2.14645C7.34171 1.95118 7.65829 1.95118 7.85355 2.14645L11.8536 6.14645C12.0488 6.34171 12.0488 6.65829 11.8536 6.85355C11.6583 7.04882 11.3417 7.04882 11.1464 6.85355L8 3.70711L8 12.5C8 12.7761 7.77614 13 7.5 13C7.22386 13 7 12.7761 7 12.5L7 3.70711L3.85355 6.85355C3.65829 7.04882 3.34171 7.04882 3.14645 6.85355C2.95118 6.65829 2.95118 6.34171 3.14645 6.14645L7.14645 2.14645Z",
76
- fill: "currentColor",
77
- fillRule: "evenodd",
78
- clipRule: "evenodd"
75
+ d: "M12 3V8C12 8.55228 11.5523 9 11 9H3.5M6 6.5L3.5 9L6 11.5",
76
+ stroke: "currentColor",
77
+ strokeLinecap: "round",
78
+ strokeLinejoin: "round"
79
79
  }
80
80
  ) });
81
81
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/icons.tsx"],
4
- "sourcesContent": ["/* The commenting UI's inline icons, kept together so the set is visible in one place.\n *\n * Anything with an equivalent in tldraw's icon assets goes through `TldrawUiIcon` instead (the \u22EF\n * menu, the dismiss cross, the resolve button's check). What's left lives here because the asset\n * set has no counterpart \u2014 a smiley, a send arrow, a filter \u2014 or because the asset reads wrong at\n * the size it's needed, which is the case for both resolved checks below. The eye pair mirrors\n * tldraw's presence glyphs: the open state is the `follow` icon \u2014 the almond eye whose pupil\n * tracks presence \u2014 and the closed state the `closed` icon, its shut-lid companion. Both are in\n * the asset set, but they're inlined because the package renders without an `AssetUrlsProvider`,\n * so `TldrawUiIcon` can't reach them. Inline also means they render without the consumer serving\n * files.\n *\n * All internal \u2014 none are exported from the package. */\n\n/** The check inside a resolved comment pin. A drawn check, not the '\u2713' glyph \u2014 that character sits\n * off-baseline and varies by font. Heavier and rounder than `CheckIcon`: it has to hold its weight\n * against the pin's 28px filled face, where the asset check reads too light. */\nexport function PinCheckIcon() {\n\treturn (\n\t\t<svg\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t\twidth=\"15\"\n\t\t\theight=\"15\"\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"2.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<path d=\"M4 12.5l5 5L20 6.5\" />\n\t\t</svg>\n\t)\n}\n\n/** The check beside the \"Resolved\" label on a comments list row. Thinner than `PinCheckIcon` \u2014 it\n * sits next to text at 12px, so it's drawn to match the label's weight rather than shout. */\nexport function CheckIcon() {\n\treturn (\n\t\t<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M2.5 6.2 4.7 8.4 9.5 3.6\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** The reaction picker's trigger. */\nexport function SmileyIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82708 7.49972C1.82708 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82708 10.6327 1.82708 7.49972ZM5.03747 9.21395C4.87949 8.98746 4.56782 8.93193 4.34133 9.08991C4.11484 9.24789 4.05931 9.55956 4.21729 9.78605C4.93926 10.8211 6.14033 11.5 7.50004 11.5C8.85974 11.5 10.0608 10.8211 10.7828 9.78605C10.9408 9.55956 10.8852 9.24789 10.6587 9.08991C10.4323 8.93193 10.1206 8.98746 9.9626 9.21395C9.41963 9.99238 8.51907 10.5 7.50004 10.5C6.481 10.5 5.58044 9.99238 5.03747 9.21395ZM5.37503 6.84998C5.85828 6.84998 6.25003 6.45815 6.25003 5.97498C6.25003 5.4918 5.85828 5.09998 5.37503 5.09998C4.89179 5.09998 4.50003 5.4918 4.50003 5.97498C4.50003 6.45815 4.89179 6.84998 5.37503 6.84998ZM10.5 5.97498C10.5 6.45815 10.1083 6.84998 9.62503 6.84998C9.14179 6.84998 8.75003 6.45815 8.75003 5.97498C8.75003 5.4918 9.14179 5.09998 9.62503 5.09998C10.1083 5.09998 10.5 5.4918 10.5 5.97498Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** The composer's post button \u2014 an up arrow. */\nexport function SendIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M7.14645 2.14645C7.34171 1.95118 7.65829 1.95118 7.85355 2.14645L11.8536 6.14645C12.0488 6.34171 12.0488 6.65829 11.8536 6.85355C11.6583 7.04882 11.3417 7.04882 11.1464 6.85355L8 3.70711L8 12.5C8 12.7761 7.77614 13 7.5 13C7.22386 13 7 12.7761 7 12.5L7 3.70711L3.85355 6.85355C3.65829 7.04882 3.34171 7.04882 3.14645 6.85355C2.95118 6.65829 2.95118 6.34171 3.14645 6.14645L7.14645 2.14645Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** Comment pins are showing. tldraw's `follow` glyph (icons/icon/follow.svg) inlined at its native\n * weight \u2014 the almond eye with a centred pupil. Pairs with `EyeClosedIcon`; the two must stay the\n * same family. */\nexport function EyeOpenIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path fill=\"currentColor\" d=\"M19 15a4 4 0 1 1-8 0 4 4 0 0 1 8 0\" />\n\t\t\t<path\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\td=\"M26 15c0 1.77-1.077 3.496-3.07 4.825C20.946 21.149 18.145 22 15 22s-5.945-.851-7.93-2.175C5.076 18.496 4 16.77 4 15c0-1.77 1.077-3.496 3.07-4.825C9.054 8.851 11.855 8 15 8s5.945.851 7.93 2.175C24.924 11.504 26 13.23 26 15Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** Comment pins are hidden. tldraw's `closed` eye glyph (icons/icon/closed.svg) \u2014 a shut lower lid\n * with lashes, the design pair to `follow`. Inlined like the open eye: the package renders without\n * an `AssetUrlsProvider`. Lash dots are `r=1.5` (vs the asset's `r=1`) because at the 15px header\n * size the asset's finer lashes fall below a pixel; the lid keeps `follow`'s native stroke. */\nexport function EyeClosedIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\td=\"M27 15C27 19.4183 21.6274 23 15 23C8.37258 23 3 19.4183 3 15\"\n\t\t\t/>\n\t\t\t<circle cx=\"4\" cy=\"20\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"9\" cy=\"23\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"15\" cy=\"24\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"21\" cy=\"23\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"26\" cy=\"20\" r=\"1.5\" fill=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n\n/** The sidebar's comment-menu trigger \u2014 tldraw's `dots-vertical` glyph (icons/icon/dots-vertical.svg)\n * inlined, a vertical kebab. Inlined like the eye pair because the package renders without an\n * `AssetUrlsProvider`. */\nexport function MoreMenuIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M15 9.48975C14.3167 9.48975 13.7292 9.24747 13.2375 8.76293C12.7458 8.27003 12.5 7.67688 12.5 6.98348C12.5 6.29843 12.7458 5.71364 13.2375 5.22909C13.7292 4.73619 14.3167 4.48975 15 4.48975C15.6833 4.48975 16.2708 4.73619 16.7625 5.22909C17.2542 5.71364 17.5 6.29843 17.5 6.98348C17.5 7.44296 17.3833 7.86485 17.15 8.24914C16.925 8.62508 16.625 8.92583 16.25 9.1514C15.875 9.37696 15.4583 9.48975 15 9.48975Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M15 17.5C14.3167 17.5 13.7292 17.2577 13.2375 16.7732C12.7458 16.2803 12.5 15.6871 12.5 14.9937C12.5 14.3087 12.7458 13.7239 13.2375 13.2393C13.7292 12.7464 14.3167 12.5 15 12.5C15.6833 12.5 16.2708 12.7464 16.7625 13.2393C17.2542 13.7239 17.5 14.3087 17.5 14.9937C17.5 15.4532 17.3833 15.8751 17.15 16.2594C16.925 16.6353 16.625 16.9361 16.25 17.1617C15.875 17.3872 15.4583 17.5 15 17.5Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M15 25.5103C14.3167 25.5103 13.7292 25.268 13.2375 24.7834C12.7458 24.2905 12.5 23.6974 12.5 23.004C12.5 22.319 12.7458 21.7342 13.2375 21.2496C13.7292 20.7567 14.3167 20.5103 15 20.5103C15.6833 20.5103 16.2708 20.7567 16.7625 21.2496C17.2542 21.7342 17.5 22.319 17.5 23.004C17.5 23.4635 17.3833 23.8854 17.15 24.2697C16.925 24.6456 16.625 24.9463 16.25 25.1719C15.875 25.3975 15.4583 25.5103 15 25.5103Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BG;AAbI,SAAS,eAAe;AAC9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,QAAO;AAAA,MACP,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEZ,sDAAC,UAAK,GAAE,sBAAqB;AAAA;AAAA,EAC9B;AAEF;AAIO,SAAS,YAAY;AAC3B,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA;AAAA,EAChB,GACD;AAEF;AAGO,SAAS,aAAa;AAC5B,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,MAAK;AAAA,MACL,UAAS;AAAA,MACT,UAAS;AAAA;AAAA,EACV,GACD;AAEF;AAGO,SAAS,WAAW;AAC1B,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,MAAK;AAAA,MACL,UAAS;AAAA,MACT,UAAS;AAAA;AAAA,EACV,GACD;AAEF;AAKO,SAAS,cAAc;AAC7B,SACC,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,gDAAC,UAAK,MAAK,gBAAe,GAAE,sCAAqC;AAAA,IACjE;AAAA,MAAC;AAAA;AAAA,QACA,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,GAAE;AAAA;AAAA,IACH;AAAA,KACD;AAEF;AAMO,SAAS,gBAAgB;AAC/B,SACC,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,GAAE;AAAA;AAAA,IACH;AAAA,IACA,4CAAC,YAAO,IAAG,KAAI,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACnD,4CAAC,YAAO,IAAG,KAAI,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACnD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACpD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACpD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,KACrD;AAEF;AAKO,SAAS,eAAe;AAC9B,SACC,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,GAAE;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,GAAE;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,GAAE;AAAA;AAAA,IACH;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["/* The commenting UI's inline icons, kept together so the set is visible in one place.\n *\n * Anything with an equivalent in tldraw's icon assets goes through `TldrawUiIcon` instead (the \u22EF\n * menu, the dismiss cross, the resolve button's check). What's left lives here because the asset\n * set has no counterpart \u2014 a smiley, a send arrow, a filter \u2014 or because the asset reads wrong at\n * the size it's needed, which is the case for both resolved checks below. The eye pair mirrors\n * tldraw's presence glyphs: the open state is the `follow` icon \u2014 the almond eye whose pupil\n * tracks presence \u2014 and the closed state the `closed` icon, its shut-lid companion. Both are in\n * the asset set, but they're inlined because the package renders without an `AssetUrlsProvider`,\n * so `TldrawUiIcon` can't reach them. Inline also means they render without the consumer serving\n * files.\n *\n * All internal \u2014 none are exported from the package. */\n\n/** The check inside a resolved comment pin. A drawn check, not the '\u2713' glyph \u2014 that character sits\n * off-baseline and varies by font. Heavier and rounder than `CheckIcon`: it has to hold its weight\n * against the pin's 28px filled face, where the asset check reads too light. */\nexport function PinCheckIcon() {\n\treturn (\n\t\t<svg\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t\twidth=\"15\"\n\t\t\theight=\"15\"\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"2.5\"\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<path d=\"M4 12.5l5 5L20 6.5\" />\n\t\t</svg>\n\t)\n}\n\n/** The check beside the \"Resolved\" label on a comments list row. Thinner than `PinCheckIcon` \u2014 it\n * sits next to text at 12px, so it's drawn to match the label's weight rather than shout. */\nexport function CheckIcon() {\n\treturn (\n\t\t<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M2.5 6.2 4.7 8.4 9.5 3.6\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** The reaction picker's trigger. */\nexport function SmileyIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M7.49991 0.876892C3.84222 0.876892 0.877075 3.84204 0.877075 7.49972C0.877075 11.1574 3.84222 14.1226 7.49991 14.1226C11.1576 14.1226 14.1227 11.1574 14.1227 7.49972C14.1227 3.84204 11.1576 0.876892 7.49991 0.876892ZM1.82708 7.49972C1.82708 4.36671 4.36689 1.82689 7.49991 1.82689C10.6329 1.82689 13.1727 4.36671 13.1727 7.49972C13.1727 10.6327 10.6329 13.1726 7.49991 13.1726C4.36689 13.1726 1.82708 10.6327 1.82708 7.49972ZM5.03747 9.21395C4.87949 8.98746 4.56782 8.93193 4.34133 9.08991C4.11484 9.24789 4.05931 9.55956 4.21729 9.78605C4.93926 10.8211 6.14033 11.5 7.50004 11.5C8.85974 11.5 10.0608 10.8211 10.7828 9.78605C10.9408 9.55956 10.8852 9.24789 10.6587 9.08991C10.4323 8.93193 10.1206 8.98746 9.9626 9.21395C9.41963 9.99238 8.51907 10.5 7.50004 10.5C6.481 10.5 5.58044 9.99238 5.03747 9.21395ZM5.37503 6.84998C5.85828 6.84998 6.25003 6.45815 6.25003 5.97498C6.25003 5.4918 5.85828 5.09998 5.37503 5.09998C4.89179 5.09998 4.50003 5.4918 4.50003 5.97498C4.50003 6.45815 4.89179 6.84998 5.37503 6.84998ZM10.5 5.97498C10.5 6.45815 10.1083 6.84998 9.62503 6.84998C9.14179 6.84998 8.75003 6.45815 8.75003 5.97498C8.75003 5.4918 9.14179 5.09998 9.62503 5.09998C10.1083 5.09998 10.5 5.4918 10.5 5.97498Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** The composer's post button \u2014 a return arrow (\u21B5), since Enter is what posts. */\nexport function SendIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M12 3V8C12 8.55228 11.5523 9 11 9H3.5M6 6.5L3.5 9L6 11.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** Comment pins are showing. tldraw's `follow` glyph (icons/icon/follow.svg) inlined at its native\n * weight \u2014 the almond eye with a centred pupil. Pairs with `EyeClosedIcon`; the two must stay the\n * same family. */\nexport function EyeOpenIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path fill=\"currentColor\" d=\"M19 15a4 4 0 1 1-8 0 4 4 0 0 1 8 0\" />\n\t\t\t<path\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\td=\"M26 15c0 1.77-1.077 3.496-3.07 4.825C20.946 21.149 18.145 22 15 22s-5.945-.851-7.93-2.175C5.076 18.496 4 16.77 4 15c0-1.77 1.077-3.496 3.07-4.825C9.054 8.851 11.855 8 15 8s5.945.851 7.93 2.175C24.924 11.504 26 13.23 26 15Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\n/** Comment pins are hidden. tldraw's `closed` eye glyph (icons/icon/closed.svg) \u2014 a shut lower lid\n * with lashes, the design pair to `follow`. Inlined like the open eye: the package renders without\n * an `AssetUrlsProvider`. Lash dots are `r=1.5` (vs the asset's `r=1`) because at the 15px header\n * size the asset's finer lashes fall below a pixel; the lid keeps `follow`'s native stroke. */\nexport function EyeClosedIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\td=\"M27 15C27 19.4183 21.6274 23 15 23C8.37258 23 3 19.4183 3 15\"\n\t\t\t/>\n\t\t\t<circle cx=\"4\" cy=\"20\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"9\" cy=\"23\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"15\" cy=\"24\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"21\" cy=\"23\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"26\" cy=\"20\" r=\"1.5\" fill=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n\n/** The sidebar's comment-menu trigger \u2014 tldraw's `dots-vertical` glyph (icons/icon/dots-vertical.svg)\n * inlined, a vertical kebab. Inlined like the eye pair because the package renders without an\n * `AssetUrlsProvider`. */\nexport function MoreMenuIcon() {\n\treturn (\n\t\t<svg width=\"15\" height=\"15\" viewBox=\"0 0 30 30\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M15 9.48975C14.3167 9.48975 13.7292 9.24747 13.2375 8.76293C12.7458 8.27003 12.5 7.67688 12.5 6.98348C12.5 6.29843 12.7458 5.71364 13.2375 5.22909C13.7292 4.73619 14.3167 4.48975 15 4.48975C15.6833 4.48975 16.2708 4.73619 16.7625 5.22909C17.2542 5.71364 17.5 6.29843 17.5 6.98348C17.5 7.44296 17.3833 7.86485 17.15 8.24914C16.925 8.62508 16.625 8.92583 16.25 9.1514C15.875 9.37696 15.4583 9.48975 15 9.48975Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M15 17.5C14.3167 17.5 13.7292 17.2577 13.2375 16.7732C12.7458 16.2803 12.5 15.6871 12.5 14.9937C12.5 14.3087 12.7458 13.7239 13.2375 13.2393C13.7292 12.7464 14.3167 12.5 15 12.5C15.6833 12.5 16.2708 12.7464 16.7625 13.2393C17.2542 13.7239 17.5 14.3087 17.5 14.9937C17.5 15.4532 17.3833 15.8751 17.15 16.2594C16.925 16.6353 16.625 16.9361 16.25 17.1617C15.875 17.3872 15.4583 17.5 15 17.5Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M15 25.5103C14.3167 25.5103 13.7292 25.268 13.2375 24.7834C12.7458 24.2905 12.5 23.6974 12.5 23.004C12.5 22.319 12.7458 21.7342 13.2375 21.2496C13.7292 20.7567 14.3167 20.5103 15 20.5103C15.6833 20.5103 16.2708 20.7567 16.7625 21.2496C17.2542 21.7342 17.5 22.319 17.5 23.004C17.5 23.4635 17.3833 23.8854 17.15 24.2697C16.925 24.6456 16.625 24.9463 16.25 25.1719C15.875 25.3975 15.4583 25.5103 15 25.5103Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BG;AAbI,SAAS,eAAe;AAC9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,QAAO;AAAA,MACP,MAAK;AAAA,MACL,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAY;AAAA,MAEZ,sDAAC,UAAK,GAAE,sBAAqB;AAAA;AAAA,EAC9B;AAEF;AAIO,SAAS,YAAY;AAC3B,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA;AAAA,EAChB,GACD;AAEF;AAGO,SAAS,aAAa;AAC5B,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,MAAK;AAAA,MACL,UAAS;AAAA,MACT,UAAS;AAAA;AAAA,EACV,GACD;AAEF;AAGO,SAAS,WAAW;AAC1B,SACC,4CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,IAAC;AAAA;AAAA,MACA,GAAE;AAAA,MACF,QAAO;AAAA,MACP,eAAc;AAAA,MACd,gBAAe;AAAA;AAAA,EAChB,GACD;AAEF;AAKO,SAAS,cAAc;AAC7B,SACC,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA,gDAAC,UAAK,MAAK,gBAAe,GAAE,sCAAqC;AAAA,IACjE;AAAA,MAAC;AAAA;AAAA,QACA,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,GAAE;AAAA;AAAA,IACH;AAAA,KACD;AAEF;AAMO,SAAS,gBAAgB;AAC/B,SACC,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,GAAE;AAAA;AAAA,IACH;AAAA,IACA,4CAAC,YAAO,IAAG,KAAI,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACnD,4CAAC,YAAO,IAAG,KAAI,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACnD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACpD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,IACpD,4CAAC,YAAO,IAAG,MAAK,IAAG,MAAK,GAAE,OAAM,MAAK,gBAAe;AAAA,KACrD;AAEF;AAKO,SAAS,eAAe;AAC9B,SACC,6CAAC,SAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACvE;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,GAAE;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,GAAE;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,GAAE;AAAA;AAAA,IACH;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -40,7 +40,7 @@ function ReactionPicker({
40
40
  renderReaction,
41
41
  palette: Palette = import_emoji_picker.EmojiPicker,
42
42
  menuId,
43
- className = "tlui-cmt-thread__action"
43
+ className = "tlui-cmt-icon-btn"
44
44
  }) {
45
45
  const msg = (0, import_tldraw.useTranslation)();
46
46
  const editor = (0, import_tldraw.useMaybeEditor)();
@@ -66,7 +66,7 @@ function ReactionPicker({
66
66
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SmileyIcon, {})
67
67
  }
68
68
  ) }),
69
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tldraw.TldrawUiDropdownMenuContent, { side: "bottom", align: "start", alignOffset: 0, sideOffset: 4, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tldraw.TldrawUiDropdownMenuContent, { side: "bottom", align: "start", alignOffset: 0, sideOffset: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
70
  Palette,
71
71
  {
72
72
  emoji,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/reaction-picker.tsx"],
4
- "sourcesContent": ["import { useCallback, useId, type ComponentType, type KeyboardEvent, type MouseEvent } from 'react'\nimport {\n\tdefineMessages,\n\tTldrawUiButton,\n\tTldrawUiDropdownMenuContent,\n\tTldrawUiDropdownMenuRoot,\n\tTldrawUiDropdownMenuTrigger,\n\ttlmenus,\n\tuseMaybeEditor,\n\tuseTranslation,\n} from 'tldraw'\nimport { EmojiPicker, type EmojiPickerProps } from './emoji-picker'\nimport { SmileyIcon } from './icons'\nimport { RenderReaction } from './reaction'\n\nconst messages = defineMessages({\n\tcommentsAddReaction: { id: 'comments.add-reaction', defaultMessage: 'Add reaction' },\n})\n\n/** @public */\nexport interface ReactionPickerProps {\n\t/** The emoji to offer. Defaults to `DEFAULT_REACTION_EMOJI`. */\n\temoji?: string[]\n\t/** Emoji the current user has already reacted with; shown as pressed in the grid. */\n\tselected?: string[]\n\t/** Called when an emoji is chosen. */\n\tonSelect?(emoji: string): void\n\t/** How to draw each emoji token. Defaults to the token string (OS emoji font). */\n\trenderReaction?: RenderReaction\n\t/**\n\t * What the button opens \u2014 the thing that produces a token. Defaults to `EmojiPicker`, the grid of\n\t * emoji. Swap it for any component taking the same props to offer something else entirely (the\n\t * drawn reactions example replaces it with a canvas you draw in); the props are passed straight\n\t * through either way.\n\t */\n\tpalette?: ComponentType<EmojiPickerProps>\n\t/**\n\t * Identifies the menu in tldraw's global menu registry, which keys open/closed state by id.\n\t * A thread renders one picker per comment, so this must differ per comment \u2014 sharing an id\n\t * makes every picker in the thread open at once. Defaults to a per-instance generated id;\n\t * pass one only for a stabler, more debuggable value.\n\t */\n\tmenuId?: string\n\t/** Class for the trigger button. Defaults to the card-action style, matching the \u22EF button. */\n\tclassName?: string\n}\n\n/**\n * Whether a palette pick asked to keep the palette open (shift held) for multi-select.\n * @internal\n */\nexport function isMultiSelectPick(event?: MouseEvent | KeyboardEvent): boolean {\n\treturn !!event?.shiftKey\n}\n\n/**\n * The add-reaction affordance: a smiley button that opens an emoji grid.\n *\n * Anchored to its own button rather than to the reactions row, so the menu keeps its position as\n * reactions are added and the row reflows.\n *\n * Picking an emoji dismisses the grid \u2014 adding and removing alike, since either way the picker has\n * done its job \u2014 and hands focus back to the trigger. Shift-picking keeps the grid open, for\n * choosing several reactions in a row.\n * @public @react\n */\nexport function ReactionPicker({\n\temoji,\n\tselected,\n\tonSelect,\n\trenderReaction,\n\tpalette: Palette = EmojiPicker,\n\tmenuId,\n\tclassName = 'tlui-cmt-thread__action',\n}: ReactionPickerProps) {\n\tconst msg = useTranslation()\n\tconst editor = useMaybeEditor()\n\t// Unique per mounted picker unless the host supplies something stabler \u2014 see `menuId`.\n\tconst generatedId = useId()\n\tconst id = menuId ?? `comment-reactions-${generatedId}`\n\n\t// The dropdown's open state lives in tldraw's global menu registry, so dropping the entry is\n\t// what closes it. The palette's tokens are plain buttons \u2014 a swappable component, not radix\n\t// menu items \u2014 so nothing dismisses the menu on its own.\n\tconst handleSelect = useCallback(\n\t\t(value: string, event?: MouseEvent | KeyboardEvent) => {\n\t\t\tonSelect?.(value)\n\t\t\tif (!isMultiSelectPick(event)) {\n\t\t\t\ttlmenus.deleteOpenMenu(id, editor?.contextId)\n\t\t\t}\n\t\t},\n\t\t[onSelect, id, editor]\n\t)\n\n\treturn (\n\t\t<TldrawUiDropdownMenuRoot id={id}>\n\t\t\t<TldrawUiDropdownMenuTrigger>\n\t\t\t\t<TldrawUiButton\n\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\ttooltip={msg(messages.commentsAddReaction)}\n\t\t\t\t\ttitle={msg(messages.commentsAddReaction)}\n\t\t\t\t\tclassName={className}\n\t\t\t\t>\n\t\t\t\t\t<SmileyIcon />\n\t\t\t\t</TldrawUiButton>\n\t\t\t</TldrawUiDropdownMenuTrigger>\n\t\t\t{/* left-aligned under the trigger, so the grid opens rightward off the card's edge */}\n\t\t\t<TldrawUiDropdownMenuContent side=\"bottom\" align=\"start\" alignOffset={0} sideOffset={4}>\n\t\t\t\t<Palette\n\t\t\t\t\temoji={emoji}\n\t\t\t\t\tselected={selected}\n\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\trenderReaction={renderReaction}\n\t\t\t\t/>\n\t\t\t</TldrawUiDropdownMenuContent>\n\t\t</TldrawUiDropdownMenuRoot>\n\t)\n}\n"],
4
+ "sourcesContent": ["import { useCallback, useId, type ComponentType, type KeyboardEvent, type MouseEvent } from 'react'\nimport {\n\tdefineMessages,\n\tTldrawUiButton,\n\tTldrawUiDropdownMenuContent,\n\tTldrawUiDropdownMenuRoot,\n\tTldrawUiDropdownMenuTrigger,\n\ttlmenus,\n\tuseMaybeEditor,\n\tuseTranslation,\n} from 'tldraw'\nimport { EmojiPicker, type EmojiPickerProps } from './emoji-picker'\nimport { SmileyIcon } from './icons'\nimport { RenderReaction } from './reaction'\n\nconst messages = defineMessages({\n\tcommentsAddReaction: { id: 'comments.add-reaction', defaultMessage: 'Add reaction' },\n})\n\n/** @public */\nexport interface ReactionPickerProps {\n\t/** The emoji to offer. Defaults to `DEFAULT_REACTION_EMOJI`. */\n\temoji?: string[]\n\t/** Emoji the current user has already reacted with; shown as pressed in the grid. */\n\tselected?: string[]\n\t/** Called when an emoji is chosen. */\n\tonSelect?(emoji: string): void\n\t/** How to draw each emoji token. Defaults to the token string (OS emoji font). */\n\trenderReaction?: RenderReaction\n\t/**\n\t * What the button opens \u2014 the thing that produces a token. Defaults to `EmojiPicker`, the grid of\n\t * emoji. Swap it for any component taking the same props to offer something else entirely (the\n\t * drawn reactions example replaces it with a canvas you draw in); the props are passed straight\n\t * through either way.\n\t */\n\tpalette?: ComponentType<EmojiPickerProps>\n\t/**\n\t * Identifies the menu in tldraw's global menu registry, which keys open/closed state by id.\n\t * A thread renders one picker per comment, so this must differ per comment \u2014 sharing an id\n\t * makes every picker in the thread open at once. Defaults to a per-instance generated id;\n\t * pass one only for a stabler, more debuggable value.\n\t */\n\tmenuId?: string\n\t/** Class for the trigger button. Defaults to the card-action style, matching the \u22EF button. */\n\tclassName?: string\n}\n\n/**\n * Whether a palette pick asked to keep the palette open (shift held) for multi-select.\n * @internal\n */\nexport function isMultiSelectPick(event?: MouseEvent | KeyboardEvent): boolean {\n\treturn !!event?.shiftKey\n}\n\n/**\n * The add-reaction affordance: a smiley button that opens an emoji grid.\n *\n * Anchored to its own button rather than to the reactions row, so the menu keeps its position as\n * reactions are added and the row reflows.\n *\n * Picking an emoji dismisses the grid \u2014 adding and removing alike, since either way the picker has\n * done its job \u2014 and hands focus back to the trigger. Shift-picking keeps the grid open, for\n * choosing several reactions in a row.\n * @public @react\n */\nexport function ReactionPicker({\n\temoji,\n\tselected,\n\tonSelect,\n\trenderReaction,\n\tpalette: Palette = EmojiPicker,\n\tmenuId,\n\tclassName = 'tlui-cmt-icon-btn',\n}: ReactionPickerProps) {\n\tconst msg = useTranslation()\n\tconst editor = useMaybeEditor()\n\t// Unique per mounted picker unless the host supplies something stabler \u2014 see `menuId`.\n\tconst generatedId = useId()\n\tconst id = menuId ?? `comment-reactions-${generatedId}`\n\n\t// The dropdown's open state lives in tldraw's global menu registry, so dropping the entry is\n\t// what closes it. The palette's tokens are plain buttons \u2014 a swappable component, not radix\n\t// menu items \u2014 so nothing dismisses the menu on its own.\n\tconst handleSelect = useCallback(\n\t\t(value: string, event?: MouseEvent | KeyboardEvent) => {\n\t\t\tonSelect?.(value)\n\t\t\tif (!isMultiSelectPick(event)) {\n\t\t\t\ttlmenus.deleteOpenMenu(id, editor?.contextId)\n\t\t\t}\n\t\t},\n\t\t[onSelect, id, editor]\n\t)\n\n\treturn (\n\t\t<TldrawUiDropdownMenuRoot id={id}>\n\t\t\t<TldrawUiDropdownMenuTrigger>\n\t\t\t\t<TldrawUiButton\n\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\ttooltip={msg(messages.commentsAddReaction)}\n\t\t\t\t\ttitle={msg(messages.commentsAddReaction)}\n\t\t\t\t\tclassName={className}\n\t\t\t\t>\n\t\t\t\t\t<SmileyIcon />\n\t\t\t\t</TldrawUiButton>\n\t\t\t</TldrawUiDropdownMenuTrigger>\n\t\t\t{/* left-aligned under the trigger, so the grid opens rightward off the card's edge */}\n\t\t\t<TldrawUiDropdownMenuContent side=\"bottom\" align=\"start\" alignOffset={0} sideOffset={0}>\n\t\t\t\t<Palette\n\t\t\t\t\temoji={emoji}\n\t\t\t\t\tselected={selected}\n\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\trenderReaction={renderReaction}\n\t\t\t\t/>\n\t\t\t</TldrawUiDropdownMenuContent>\n\t\t</TldrawUiDropdownMenuRoot>\n\t)\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FE;AA/FF,mBAA4F;AAC5F,oBASO;AACP,0BAAmD;AACnD,mBAA2B;AAG3B,MAAM,eAAW,8BAAe;AAAA,EAC/B,qBAAqB,EAAE,IAAI,yBAAyB,gBAAgB,eAAe;AACpF,CAAC;AAkCM,SAAS,kBAAkB,OAA6C;AAC9E,SAAO,CAAC,CAAC,OAAO;AACjB;AAaO,SAAS,eAAe;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS,UAAU;AAAA,EACnB;AAAA,EACA,YAAY;AACb,GAAwB;AACvB,QAAM,UAAM,8BAAe;AAC3B,QAAM,aAAS,8BAAe;AAE9B,QAAM,kBAAc,oBAAM;AAC1B,QAAM,KAAK,UAAU,qBAAqB,WAAW;AAKrD,QAAM,mBAAe;AAAA,IACpB,CAAC,OAAe,UAAuC;AACtD,iBAAW,KAAK;AAChB,UAAI,CAAC,kBAAkB,KAAK,GAAG;AAC9B,8BAAQ,eAAe,IAAI,QAAQ,SAAS;AAAA,MAC7C;AAAA,IACD;AAAA,IACA,CAAC,UAAU,IAAI,MAAM;AAAA,EACtB;AAEA,SACC,6CAAC,0CAAyB,IACzB;AAAA,gDAAC,6CACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,SAAS,IAAI,SAAS,mBAAmB;AAAA,QACzC,OAAO,IAAI,SAAS,mBAAmB;AAAA,QACvC;AAAA,QAEA,sDAAC,2BAAW;AAAA;AAAA,IACb,GACD;AAAA,IAEA,4CAAC,6CAA4B,MAAK,UAAS,OAAM,SAAQ,aAAa,GAAG,YAAY,GACpF;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ui/send-button.tsx"],
4
- "sourcesContent": ["import { SendIcon } from './icons'\n\n/** @public */\nexport interface SendButtonProps {\n\t/** The button's accessible name (e.g. \"Send\"). Shown as an up-arrow icon, so this is its label. */\n\tlabel: string\n\tdisabled?: boolean\n\tonClick?(): void\n}\n\n/** The button that posts a comment \u2014 an up arrow. @public @react */\nexport function SendButton({ label, disabled, onClick }: SendButtonProps) {\n\treturn (\n\t\t<button\n\t\t\tclassName=\"tlui-cmt-send\"\n\t\t\ttype=\"button\"\n\t\t\tdisabled={disabled}\n\t\t\tonClick={onClick}\n\t\t\taria-label={label}\n\t\t\ttitle={label}\n\t\t>\n\t\t\t<SendIcon />\n\t\t</button>\n\t)\n}\n"],
4
+ "sourcesContent": ["import { SendIcon } from './icons'\n\n/** @public */\nexport interface SendButtonProps {\n\t/** The button's accessible name (e.g. \"Send\"). Shown as a return-arrow icon, so this is its label. */\n\tlabel: string\n\tdisabled?: boolean\n\tonClick?(): void\n}\n\n/** The button that posts a comment \u2014 a return arrow. @public @react */\nexport function SendButton({ label, disabled, onClick }: SendButtonProps) {\n\treturn (\n\t\t<button\n\t\t\tclassName=\"tlui-cmt-send\"\n\t\t\ttype=\"button\"\n\t\t\tdisabled={disabled}\n\t\t\tonClick={onClick}\n\t\t\taria-label={label}\n\t\t\ttitle={label}\n\t\t>\n\t\t\t<SendIcon />\n\t\t</button>\n\t)\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBG;AArBH,mBAAyB;AAWlB,SAAS,WAAW,EAAE,OAAO,UAAU,QAAQ,GAAoB;AACzE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,cAAY;AAAA,MACZ,OAAO;AAAA,MAEP,sDAAC,yBAAS;AAAA;AAAA,EACX;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { react, unsafe__withoutCapture } from "tldraw";
1
2
  function isCanvasPanGesture(editor, e) {
2
3
  return e.button !== 0 || editor.inputs.keys.has("Space");
3
4
  }
@@ -8,8 +9,31 @@ function forwardPointerEventToCanvas(container, e) {
8
9
  newEvent.isSpecialRedispatchedEvent = true;
9
10
  cvs.dispatchEvent(newEvent);
10
11
  }
12
+ function startCommentDrag(editor, { cursor, onCameraMove }) {
13
+ const prevCursor = { ...editor.getInstanceState().cursor };
14
+ const stopCursor = react("comment drag cursor", () => {
15
+ if (editor.getInstanceState().cursor.type !== cursor) {
16
+ editor.setCursor({ type: cursor, rotation: 0 });
17
+ }
18
+ });
19
+ let started = false;
20
+ const stopCamera = react("comment drag follows camera", () => {
21
+ editor.getCamera();
22
+ if (!started) {
23
+ started = true;
24
+ return;
25
+ }
26
+ unsafe__withoutCapture(onCameraMove);
27
+ });
28
+ return () => {
29
+ stopCamera();
30
+ stopCursor();
31
+ editor.setCursor(prevCursor);
32
+ };
33
+ }
11
34
  export {
12
35
  forwardPointerEventToCanvas,
13
- isCanvasPanGesture
36
+ isCanvasPanGesture,
37
+ startCommentDrag
14
38
  };
15
39
  //# sourceMappingURL=canvas-events.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/canvas/canvas-events.ts"],
4
- "sourcesContent": ["import { type PointerEvent as ReactPointerEvent } from 'react'\nimport { Editor } from 'tldraw'\n\n/** A pointer-down that belongs to the camera, not the comment UI: any non-primary button\n * (middle/right-button pans), or a primary press with the spacebar pan key held. */\nexport function isCanvasPanGesture(editor: Editor, e: ReactPointerEvent) {\n\treturn e.button !== 0 || editor.inputs.keys.has('Space')\n}\n\n/** Hand a pointer event to the canvas beneath the comments layer, marked the same way the\n * pass-through wheel/hover hooks mark their re-dispatched events. */\nexport function forwardPointerEventToCanvas(container: HTMLElement, e: ReactPointerEvent) {\n\tconst cvs = container.querySelector('.tl-canvas')\n\tif (!cvs) return\n\tconst newEvent = new PointerEvent(e.type, e.nativeEvent as any)\n\t;(newEvent as any).isSpecialRedispatchedEvent = true\n\tcvs.dispatchEvent(newEvent)\n}\n"],
5
- "mappings": "AAKO,SAAS,mBAAmB,QAAgB,GAAsB;AACxE,SAAO,EAAE,WAAW,KAAK,OAAO,OAAO,KAAK,IAAI,OAAO;AACxD;AAIO,SAAS,4BAA4B,WAAwB,GAAsB;AACzF,QAAM,MAAM,UAAU,cAAc,YAAY;AAChD,MAAI,CAAC,IAAK;AACV,QAAM,WAAW,IAAI,aAAa,EAAE,MAAM,EAAE,WAAkB;AAC7D,EAAC,SAAiB,6BAA6B;AAChD,MAAI,cAAc,QAAQ;AAC3B;",
4
+ "sourcesContent": ["import { type PointerEvent as ReactPointerEvent } from 'react'\nimport { Editor, react, TLCursorType, unsafe__withoutCapture } from 'tldraw'\n\n/** A pointer-down that belongs to the camera, not the comment UI: any non-primary button\n * (middle/right-button pans), or a primary press with the spacebar pan key held. */\nexport function isCanvasPanGesture(editor: Editor, e: { button: number }) {\n\treturn e.button !== 0 || editor.inputs.keys.has('Space')\n}\n\n/** Hand a pointer event to the canvas beneath the comments layer, marked the same way the\n * pass-through wheel/hover hooks mark their re-dispatched events. */\nexport function forwardPointerEventToCanvas(container: HTMLElement, e: ReactPointerEvent) {\n\tconst cvs = container.querySelector('.tl-canvas')\n\tif (!cvs) return\n\tconst newEvent = new PointerEvent(e.type, e.nativeEvent as any)\n\t;(newEvent as any).isSpecialRedispatchedEvent = true\n\tcvs.dispatchEvent(newEvent)\n}\n\n/**\n * Start a comment drag (pin move or region resize) run by the comment UI's own pointer handlers\n * rather than a tool state. Shows `cursor` for the whole drag and re-runs `onCameraMove` when the\n * camera moves, from the drag's last pointer position, so a mid-drag scroll keeps the dragged thing\n * under the pointer as a shape drag does. Returns the cleanup.\n *\n * The drag's pointer moves still reach the editor (its inputs and the presence cursor others see\n * must keep tracking), so the active tool's hover handling may set its own cursor on each one; the\n * drag's cursor is put back whenever that happens.\n */\nexport function startCommentDrag(\n\teditor: Editor,\n\t{ cursor, onCameraMove }: { cursor: TLCursorType; onCameraMove(): void }\n): () => void {\n\tconst prevCursor = { ...editor.getInstanceState().cursor }\n\tconst stopCursor = react('comment drag cursor', () => {\n\t\tif (editor.getInstanceState().cursor.type !== cursor) {\n\t\t\teditor.setCursor({ type: cursor, rotation: 0 })\n\t\t}\n\t})\n\tlet started = false\n\tconst stopCamera = react('comment drag follows camera', () => {\n\t\teditor.getCamera()\n\t\tif (!started) {\n\t\t\tstarted = true\n\t\t\treturn\n\t\t}\n\t\t// Untracked: the callback writes state it may also read.\n\t\tunsafe__withoutCapture(onCameraMove)\n\t})\n\treturn () => {\n\t\tstopCamera()\n\t\tstopCursor()\n\t\teditor.setCursor(prevCursor)\n\t}\n}\n"],
5
+ "mappings": "AACA,SAAiB,OAAqB,8BAA8B;AAI7D,SAAS,mBAAmB,QAAgB,GAAuB;AACzE,SAAO,EAAE,WAAW,KAAK,OAAO,OAAO,KAAK,IAAI,OAAO;AACxD;AAIO,SAAS,4BAA4B,WAAwB,GAAsB;AACzF,QAAM,MAAM,UAAU,cAAc,YAAY;AAChD,MAAI,CAAC,IAAK;AACV,QAAM,WAAW,IAAI,aAAa,EAAE,MAAM,EAAE,WAAkB;AAC7D,EAAC,SAAiB,6BAA6B;AAChD,MAAI,cAAc,QAAQ;AAC3B;AAYO,SAAS,iBACf,QACA,EAAE,QAAQ,aAAa,GACV;AACb,QAAM,aAAa,EAAE,GAAG,OAAO,iBAAiB,EAAE,OAAO;AACzD,QAAM,aAAa,MAAM,uBAAuB,MAAM;AACrD,QAAI,OAAO,iBAAiB,EAAE,OAAO,SAAS,QAAQ;AACrD,aAAO,UAAU,EAAE,MAAM,QAAQ,UAAU,EAAE,CAAC;AAAA,IAC/C;AAAA,EACD,CAAC;AACD,MAAI,UAAU;AACd,QAAM,aAAa,MAAM,+BAA+B,MAAM;AAC7D,WAAO,UAAU;AACjB,QAAI,CAAC,SAAS;AACb,gBAAU;AACV;AAAA,IACD;AAEA,2BAAuB,YAAY;AAAA,EACpC,CAAC;AACD,SAAO,MAAM;AACZ,eAAW;AACX,eAAW;AACX,WAAO,UAAU,UAAU;AAAA,EAC5B;AACD;",
6
6
  "names": []
7
7
  }