@vite-hub/ui 0.5.1 → 0.6.1

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 (88) hide show
  1. package/README.md +1 -1
  2. package/dist/{colors-BghReA9C-DEq4bhEP.js → colors-BghReA9C-A4M9YE0s.js} +1 -1
  3. package/dist/{comment-attachments-CMpYOJod.js → comment-attachments-DAzUbRmJ.js} +4 -0
  4. package/dist/{comment-composer-BI6CNJyO.d.ts → comment-composer-DmDM3XYP.d.ts} +1 -1
  5. package/dist/{comment-composer-CzU7DdfD.js → comment-composer-X7vJKh5b.js} +4 -4
  6. package/dist/comment-layer-KnnVfdRV.d.ts +130 -0
  7. package/dist/{comment-list-CSK5o-Ua.d.ts → comment-list-ncwaCSVX.d.ts} +2 -2
  8. package/dist/{comment-panel-CEvOI3gk.d.ts → comment-panel-DoLDOw3E.d.ts} +2 -42
  9. package/dist/{comment-pin-C5UeLPTa.d.ts → comment-pin-hBJFiSYW.d.ts} +1 -1
  10. package/dist/{comment-send-DPzV9B8S.js → comment-send-CUkL3TbZ.js} +2 -2
  11. package/dist/comment-status-nsCdrRk_.js +20 -0
  12. package/dist/{comment-thread-DGm1cGJt.d.ts → comment-thread-DPV2kqA4.d.ts} +4 -8
  13. package/dist/{comment-thread-CbPtoi8-.js → comment-thread-jqPx6aJ8.js} +9 -9
  14. package/dist/{comments-C0OdHh_F.js → comments-9MDSNm-9.js} +40 -47
  15. package/dist/{comments-DrE9DU-E.d.ts → comments-OWjNidkP.d.ts} +7 -5
  16. package/dist/{comments-context-CrjhleVA.js → comments-context-3js2YFl2.js} +2 -2
  17. package/dist/{config-xL4EBeXw.d.ts → config-COSdO-ay.d.ts} +2 -1
  18. package/dist/{config-DztmAYYn.js → config-LRonN53j.js} +9 -3
  19. package/dist/{draw-DzSmD7uo-Cb7s9kxJ.js → draw-DzSmD7uo-BvtKi0oE.js} +2 -2
  20. package/dist/{editor-CGiEVOnB.js → editor-Dmk3k6f6.js} +1 -1
  21. package/dist/{effects-g4QucvgO.js → effects-C1zYpSpg.js} +9 -2
  22. package/dist/{format-Bc9m7-r0.js → format-CPipR1FP.js} +4 -23
  23. package/dist/headless.d.ts +2 -2
  24. package/dist/headless.js +1 -1
  25. package/dist/{image-preview-DrLXrHpp.js → image-preview-BKVUtfwQ.js} +1 -1
  26. package/dist/index.d.ts +11 -11
  27. package/dist/index.js +10 -9
  28. package/dist/{install-Ba9mkkqI.js → install-C4LwcJda.js} +1 -1
  29. package/dist/{markdown-editor-3gY9MLvy.js → markdown-editor-D1irG9Xl.js} +45 -11
  30. package/dist/markdown-editor.js +1 -1
  31. package/dist/{markdown-renderer-DFS1vf1h.js → markdown-renderer-DMyYKeil.js} +13062 -12372
  32. package/dist/{message-scroller-a6qaYHno.d.ts → message-scroller-BZqS63IX.d.ts} +2 -2
  33. package/dist/motion/core.d.ts +1 -1
  34. package/dist/motion/core.js +4 -4
  35. package/dist/{motion-core-DNl7TR1T.d.ts → motion-core-Dh20n5Se.d.ts} +2 -1
  36. package/dist/motion.d.ts +1 -1
  37. package/dist/motion.js +5 -5
  38. package/dist/nuxt.d.ts +1 -1
  39. package/dist/parts/components/agent-session.d.ts +46 -3
  40. package/dist/parts/components/agent-session.js +27 -7
  41. package/dist/parts/components/avatar-stack.js +1 -1
  42. package/dist/parts/components/chat.js +1 -1
  43. package/dist/parts/components/comment-composer.d.ts +1 -1
  44. package/dist/parts/components/comment-composer.js +1 -1
  45. package/dist/parts/components/comment-layer.d.ts +1 -1
  46. package/dist/parts/components/comment-layer.js +21 -35
  47. package/dist/parts/components/comment-list.d.ts +1 -1
  48. package/dist/parts/components/comment-list.js +3 -2
  49. package/dist/parts/components/comment-panel.d.ts +1 -1
  50. package/dist/parts/components/comment-panel.js +32 -29
  51. package/dist/parts/components/comment-pin.d.ts +1 -1
  52. package/dist/parts/components/comment-selection-bar.js +1 -1
  53. package/dist/parts/components/comment-send.js +1 -1
  54. package/dist/parts/components/comment-thread.d.ts +2 -2
  55. package/dist/parts/components/comment-thread.js +3 -3
  56. package/dist/parts/components/comments.d.ts +6 -6
  57. package/dist/parts/components/comments.js +4 -4
  58. package/dist/parts/components/copy-button.js +2 -2
  59. package/dist/parts/components/markdown-editor.js +1 -1
  60. package/dist/parts/components/markdown-renderer.js +1 -1
  61. package/dist/parts/components/markdown.js +1 -1
  62. package/dist/parts/components/message-parts.js +1 -1
  63. package/dist/parts/components/motion.js +2 -2
  64. package/dist/parts/components/prompt-input.d.ts +3 -3
  65. package/dist/parts/components/prompt-input.js +2 -2
  66. package/dist/parts/components/trace-run.js +1 -1
  67. package/dist/parts/headless/comments.d.ts +1 -1
  68. package/dist/parts/headless/comments.js +1 -1
  69. package/dist/parts/headless/message-scroller.d.ts +1 -1
  70. package/dist/parts/workspace/browser-support-notice.d.ts +1 -1
  71. package/dist/parts/workspace/browser-support-notice.js +1 -1
  72. package/dist/parts/workspace/workspace-boot-status.js +1 -1
  73. package/dist/parts/workspace/workspace-sidebar.d.ts +1 -1
  74. package/dist/parts/workspace/workspace-sidebar.js +1 -1
  75. package/dist/parts/workspace/workspace.d.ts +2 -2
  76. package/dist/parts/workspace/workspace.js +1 -1
  77. package/dist/{ring-BN4d8vtw.js → ring-GaJsg32c.js} +63 -12
  78. package/dist/runtime/nuxt-plugin.js +1 -1
  79. package/dist/{sankey-CAYwt82B-BAAk7WkJ.js → sankey-CAYwt82B-e6k34wtW.js} +3 -3
  80. package/dist/styles.css +20 -2
  81. package/dist/{text-BWzZFnGY.js → text-gacox6bp.js} +1 -1
  82. package/dist/{travel-CwVhU_GS.js → travel-BliEidau.js} +1 -1
  83. package/dist/vue-d2Td6uu2.js +6587 -0
  84. package/dist/{vue-kCdzBu0N.js → vue-vUGpdMct.js} +1 -1
  85. package/dist/workspace.js +1 -1
  86. package/package.json +7 -7
  87. package/dist/comment-layer-DyVstrs-.d.ts +0 -174
  88. package/dist/vue-BlknIGIm.js +0 -2501
package/README.md CHANGED
@@ -307,7 +307,7 @@ For everything else, use the component or the helper:
307
307
  | `<MorphText :text="copied ? 'Copied' : 'Copy link'" />` | `morphText(element, text)` | A label outside a `UButton` |
308
308
  | `<SwapIcon :name="icon" enter="draw" />` | `swapIcon(container, icon, { exit, enter })` | An icon that says what happened: `exit: "right"` for an arrow that leaves the way it points, `enter: "draw"` for a check or a spinner |
309
309
  | `<RollNumber :value="count" />` | `rollNumber(element, value, format?)` | A count: only the changed digits roll, up when it grows, down when it shrinks |
310
- | `<UButton v-ring="saved" />` | `ring(element)` | A finished action, such as saved or copied: a ring in the border color grows once and fades |
310
+ | `<UButton v-ring="saved" />` | `ring(element)` | A finished action, such as saved or copied: a ring in the border color grows once and fades. A button joined to others in a `UFieldGroup` rings the whole group |
311
311
 
312
312
  `CopyButton` uses all of them. Each helper can be called again in the middle of its motion and continues from where it is. The element keeps the final text for screen readers the whole time and holds plain text again at the end. Under reduced motion a label, an icon, or a digit crossfades in 150ms, and there is no ring. Inside `data-motion="none"` the change happens at once.
313
313
 
@@ -1,4 +1,4 @@
1
- // ../../node_modules/.pnpm/comark-charts@0.12.2_@comark+html@0.9.2_katex@0.19.1_shiki@4.6.0__comark@0.9.2_katex@0._771ab56cd4a9a28336752f82e45a6908/node_modules/comark-charts/dist/colors-BghReA9C.mjs
1
+ // ../../node_modules/.pnpm/comark-charts@0.14.3_@comark+html@0.9.2_katex@0.19.1_shiki@4.6.0__comark@0.9.2_katex@0._3dc1623b66c2ddc50c7ba6cd35e1abd0/node_modules/comark-charts/dist/colors-BghReA9C.mjs
2
2
  /**
3
3
  * The colors the SVG is drawn with. Each is the light theme's value of a CSS variable, so the SVG reads on its own,
4
4
  * and the stylesheet swaps each one for its variable, which follows the page's theme and dark mode.
@@ -8,6 +8,10 @@ function useCommentAttachments(state, props) {
8
8
  });
9
9
  return {
10
10
  enabled: computed(() => mode.value !== void 0),
11
+ queued(files) {
12
+ if (!state.outbox.enabled || mode.value === "upload" && files.length > 0) return void 0;
13
+ return mode.value === "queue" ? files : [];
14
+ },
11
15
  async prepare(files) {
12
16
  return {
13
17
  files: mode.value === "queue" ? files : [],
@@ -229,10 +229,10 @@ declare const CommentComposer: import("vue").DefineComponent<import("vue").Extra
229
229
  modelValue: string;
230
230
  autofocus: boolean;
231
231
  variant: CommentComposerVariant;
232
- people: CommentUser[];
233
232
  mentions: string[];
234
233
  busy: boolean;
235
234
  guard: boolean;
235
+ people: CommentUser[];
236
236
  participants: string[];
237
237
  attachments: boolean;
238
238
  allowEmpty: boolean;
@@ -1,11 +1,11 @@
1
- import { c as shakeEventName, i as consumedPointerEvents, l as swallowNextClick, n as injectComments, o as pathOf, u as useDocumentPointerDown } from "./comments-context-CrjhleVA.js";
1
+ import { c as shakeEventName, i as consumedPointerEvents, l as swallowNextClick, n as injectComments, o as pathOf, u as useDocumentPointerDown } from "./comments-context-3js2YFl2.js";
2
2
  import { i as toPerson, t as displayName } from "./comment-person-D_IyIjXo.js";
3
- import { n as shake, t as travel } from "./travel-CwVhU_GS.js";
3
+ import { n as shake, t as travel } from "./travel-BliEidau.js";
4
4
  import { i as matchesAccept } from "./attachments-DgwoQZKY.js";
5
5
  import { RollNumber } from "./parts/components/motion.js";
6
- import { a as useViteHubUIIcons } from "./config-DztmAYYn.js";
6
+ import { a as useViteHubUIIcons } from "./config-LRonN53j.js";
7
7
  import { t as createMotionList } from "./list-DUTAo0uC.js";
8
- import { t as ImagePreview } from "./image-preview-DrLXrHpp.js";
8
+ import { t as ImagePreview } from "./image-preview-BKVUtfwQ.js";
9
9
  import { r as useUIComponent } from "./nuxt-ui-7ByUrymx.js";
10
10
  import { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentGroup, AttachmentMedia, AttachmentTitle } from "./parts/components/attachment.js";
11
11
  import { AvatarStack } from "./parts/components/avatar-stack.js";
@@ -0,0 +1,130 @@
1
+ import { s as CommentsState, t as CommentCan } from "./comments-OWjNidkP.js";
2
+ import { n as AvatarStackPerson } from "./avatar-stack-C0IKwj6g.js";
3
+ import { r as CommentComposerSize } from "./comment-composer-DmDM3XYP.js";
4
+ import { c as CommentUpload } from "./comment-panel-DoLDOw3E.js";
5
+ import { n as CommentAttachmentUrl } from "./comment-thread-DPV2kqA4.js";
6
+ import { PropType } from "vue";
7
+ import { CommentSubject, CommentUser, CommentsClient } from "@vite-hub/comments/client";
8
+ /** Where a thread opens: in a card beside its pin, or in a column of cards on the right edge of the screen. */
9
+ type CommentPlacement = "pin" | "margin";
10
+ declare const CommentLayer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
11
+ client: {
12
+ type: PropType<CommentsClient>;
13
+ };
14
+ subject: {
15
+ type: PropType<CommentSubject>;
16
+ };
17
+ user: {
18
+ type: PropType<CommentUser>;
19
+ };
20
+ comments: {
21
+ type: PropType<CommentsState>;
22
+ };
23
+ people: {
24
+ default: () => never[];
25
+ type: PropType<AvatarStackPerson[]>;
26
+ };
27
+ hotkey: {
28
+ default: string;
29
+ type: PropType<string | false>;
30
+ };
31
+ readOnly: {
32
+ default: boolean;
33
+ type: BooleanConstructor;
34
+ };
35
+ subjectUrl: {
36
+ type: PropType<(subject: CommentSubject) => string | undefined>;
37
+ };
38
+ navigate: {
39
+ type: PropType<(href: string) => void>;
40
+ };
41
+ can: {
42
+ type: PropType<CommentCan>;
43
+ };
44
+ upload: {
45
+ type: PropType<CommentUpload>;
46
+ };
47
+ queueFiles: {
48
+ default: boolean;
49
+ type: BooleanConstructor;
50
+ };
51
+ accept: {
52
+ type: StringConstructor;
53
+ };
54
+ attachmentUrl: {
55
+ type: PropType<CommentAttachmentUrl>;
56
+ };
57
+ placement: {
58
+ default: string;
59
+ type: PropType<CommentPlacement>;
60
+ };
61
+ size: {
62
+ default: string;
63
+ type: PropType<CommentComposerSize>;
64
+ };
65
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
66
+ [key: string]: any;
67
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
68
+ client: {
69
+ type: PropType<CommentsClient>;
70
+ };
71
+ subject: {
72
+ type: PropType<CommentSubject>;
73
+ };
74
+ user: {
75
+ type: PropType<CommentUser>;
76
+ };
77
+ comments: {
78
+ type: PropType<CommentsState>;
79
+ };
80
+ people: {
81
+ default: () => never[];
82
+ type: PropType<AvatarStackPerson[]>;
83
+ };
84
+ hotkey: {
85
+ default: string;
86
+ type: PropType<string | false>;
87
+ };
88
+ readOnly: {
89
+ default: boolean;
90
+ type: BooleanConstructor;
91
+ };
92
+ subjectUrl: {
93
+ type: PropType<(subject: CommentSubject) => string | undefined>;
94
+ };
95
+ navigate: {
96
+ type: PropType<(href: string) => void>;
97
+ };
98
+ can: {
99
+ type: PropType<CommentCan>;
100
+ };
101
+ upload: {
102
+ type: PropType<CommentUpload>;
103
+ };
104
+ queueFiles: {
105
+ default: boolean;
106
+ type: BooleanConstructor;
107
+ };
108
+ accept: {
109
+ type: StringConstructor;
110
+ };
111
+ attachmentUrl: {
112
+ type: PropType<CommentAttachmentUrl>;
113
+ };
114
+ placement: {
115
+ default: string;
116
+ type: PropType<CommentPlacement>;
117
+ };
118
+ size: {
119
+ default: string;
120
+ type: PropType<CommentComposerSize>;
121
+ };
122
+ }>> & Readonly<{}>, {
123
+ size: CommentComposerSize;
124
+ people: AvatarStackPerson[];
125
+ hotkey: string | false;
126
+ readOnly: boolean;
127
+ queueFiles: boolean;
128
+ placement: CommentPlacement;
129
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
130
+ export { CommentPlacement as n, CommentLayer as t };
@@ -1,6 +1,6 @@
1
- import { s as CommentsState } from "./comments-DrE9DU-E.js";
1
+ import { s as CommentsState } from "./comments-OWjNidkP.js";
2
2
  import { n as AvatarStackPerson } from "./avatar-stack-C0IKwj6g.js";
3
- import { s as CommentRowSlots } from "./comment-panel-CEvOI3gk.js";
3
+ import { s as CommentRowSlots } from "./comment-panel-DoLDOw3E.js";
4
4
  import { PropType, SlotsType } from "vue";
5
5
  declare const CommentFilters: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
6
  comments: {
@@ -1,5 +1,5 @@
1
- import { s as CommentsState, t as CommentCan } from "./comments-DrE9DU-E.js";
2
- import { l as CommentThreadSlots, n as CommentAttachmentUrl } from "./comment-thread-DGm1cGJt.js";
1
+ import { s as CommentsState, t as CommentCan } from "./comments-OWjNidkP.js";
2
+ import { l as CommentThreadSlots, n as CommentAttachmentUrl } from "./comment-thread-DPV2kqA4.js";
3
3
  import { PropType, SlotsType, VNode } from "vue";
4
4
  import { CommentStatus, CommentSubject, CommentThread, CommentUser, CommentsClient } from "@vite-hub/comments/client";
5
5
  type CommentPanelVariant = "docked" | "floating";
@@ -31,162 +31,122 @@ type CommentPanelSlots = CommentThreadSlots & CommentRowSlots & {
31
31
  /** Puts a thread under a heading of the list, such as `"From earlier versions"`. `undefined` keeps it in the first, unnamed group. */
32
32
  type CommentGroup = (thread: CommentThread) => string | undefined;
33
33
  declare const CommentPanel: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
34
- /** A state from `useComments()`. Defaults to the state of the nearest `CommentLayer` or `provideComments()`. */
35
34
  comments: {
36
35
  type: PropType<CommentsState>;
37
36
  };
38
- /** The client, for a panel that is not inside a `CommentLayer`. Give it with `subject`. */
39
37
  client: {
40
38
  type: PropType<CommentsClient>;
41
39
  };
42
- /** What the threads are about, with `client`. */
43
40
  subject: {
44
41
  type: PropType<CommentSubject>;
45
42
  };
46
- /** The signed-in user, with `client`. Defaults to the client's user. */
47
43
  user: {
48
44
  type: PropType<CommentUser>;
49
45
  };
50
- /** `docked` fills its container, such as a side column. `floating` is a card over the page. */
51
46
  variant: {
52
47
  default: string;
53
48
  type: PropType<CommentPanelVariant>;
54
49
  };
55
- /** The id of the open thread. Use `v-model:thread`. `null` shows the list. */
56
50
  thread: {
57
51
  default: undefined;
58
52
  type: PropType<string | null>;
59
53
  };
60
- /** Which threads the list shows. Use `v-model:status`. */
61
54
  status: {
62
55
  type: PropType<CommentStatus>;
63
56
  };
64
- /** The heading of the list. */
65
57
  title: {
66
58
  default: string;
67
59
  type: StringConstructor;
68
60
  };
69
- /** Hide the page box and every reply, edit, delete, and status control. */
70
61
  readOnly: {
71
62
  default: boolean;
72
63
  type: BooleanConstructor;
73
64
  };
74
- /** Turns attached files into attachment keys before the comment is saved or sent. */
75
65
  upload: {
76
66
  type: PropType<CommentUpload>;
77
67
  };
78
- /** Save raw files with outbox entries. Set only when the server accepts file uploads. `upload` takes precedence. */
79
68
  queueFiles: {
80
69
  default: boolean;
81
70
  type: BooleanConstructor;
82
71
  };
83
- /** The file types that the boxes take, such as `image/*`. */
84
72
  accept: {
85
73
  type: StringConstructor;
86
74
  };
87
- /** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
88
75
  attachmentUrl: {
89
76
  type: PropType<CommentAttachmentUrl>;
90
77
  };
91
- /** Send a new page comment that has files and no text. */
92
78
  allowEmpty: {
93
79
  default: boolean;
94
80
  type: BooleanConstructor;
95
81
  };
96
- /** People that messages may mention, on top of the people that the comments state knows. */
97
82
  people: {
98
83
  default: () => never[];
99
84
  type: PropType<CommentUser[]>;
100
85
  };
101
- /** What the signed-in user may do in a thread. Defaults to the `can` of the comments state. */
102
86
  can: {
103
87
  type: PropType<CommentCan>;
104
88
  };
105
- /**
106
- * Groups the rows under headings, in the order the groups first appear. Threads without a group come first. Without a
107
- * group callback, a resolved thread that Open lists for a later reply goes under "Replied since resolved".
108
- */
109
89
  group: {
110
90
  type: PropType<CommentGroup>;
111
91
  };
112
92
  }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
113
93
  [key: string]: any;
114
94
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:thread" | "update:status")[], "select" | "update:thread" | "update:status", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
115
- /** A state from `useComments()`. Defaults to the state of the nearest `CommentLayer` or `provideComments()`. */
116
95
  comments: {
117
96
  type: PropType<CommentsState>;
118
97
  };
119
- /** The client, for a panel that is not inside a `CommentLayer`. Give it with `subject`. */
120
98
  client: {
121
99
  type: PropType<CommentsClient>;
122
100
  };
123
- /** What the threads are about, with `client`. */
124
101
  subject: {
125
102
  type: PropType<CommentSubject>;
126
103
  };
127
- /** The signed-in user, with `client`. Defaults to the client's user. */
128
104
  user: {
129
105
  type: PropType<CommentUser>;
130
106
  };
131
- /** `docked` fills its container, such as a side column. `floating` is a card over the page. */
132
107
  variant: {
133
108
  default: string;
134
109
  type: PropType<CommentPanelVariant>;
135
110
  };
136
- /** The id of the open thread. Use `v-model:thread`. `null` shows the list. */
137
111
  thread: {
138
112
  default: undefined;
139
113
  type: PropType<string | null>;
140
114
  };
141
- /** Which threads the list shows. Use `v-model:status`. */
142
115
  status: {
143
116
  type: PropType<CommentStatus>;
144
117
  };
145
- /** The heading of the list. */
146
118
  title: {
147
119
  default: string;
148
120
  type: StringConstructor;
149
121
  };
150
- /** Hide the page box and every reply, edit, delete, and status control. */
151
122
  readOnly: {
152
123
  default: boolean;
153
124
  type: BooleanConstructor;
154
125
  };
155
- /** Turns attached files into attachment keys before the comment is saved or sent. */
156
126
  upload: {
157
127
  type: PropType<CommentUpload>;
158
128
  };
159
- /** Save raw files with outbox entries. Set only when the server accepts file uploads. `upload` takes precedence. */
160
129
  queueFiles: {
161
130
  default: boolean;
162
131
  type: BooleanConstructor;
163
132
  };
164
- /** The file types that the boxes take, such as `image/*`. */
165
133
  accept: {
166
134
  type: StringConstructor;
167
135
  };
168
- /** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
169
136
  attachmentUrl: {
170
137
  type: PropType<CommentAttachmentUrl>;
171
138
  };
172
- /** Send a new page comment that has files and no text. */
173
139
  allowEmpty: {
174
140
  default: boolean;
175
141
  type: BooleanConstructor;
176
142
  };
177
- /** People that messages may mention, on top of the people that the comments state knows. */
178
143
  people: {
179
144
  default: () => never[];
180
145
  type: PropType<CommentUser[]>;
181
146
  };
182
- /** What the signed-in user may do in a thread. Defaults to the `can` of the comments state. */
183
147
  can: {
184
148
  type: PropType<CommentCan>;
185
149
  };
186
- /**
187
- * Groups the rows under headings, in the order the groups first appear. Threads without a group come first. Without a
188
- * group callback, a resolved thread that Open lists for a later reply goes under "Replied since resolved".
189
- */
190
150
  group: {
191
151
  type: PropType<CommentGroup>;
192
152
  };
@@ -60,7 +60,7 @@ declare const CommentPin: import("vue").DefineComponent<import("vue").ExtractPro
60
60
  onLeave?: ((...args: any[]) => any) | undefined;
61
61
  }>, {
62
62
  active: boolean;
63
- status: CommentStatus;
64
63
  draft: boolean;
64
+ status: CommentStatus;
65
65
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
66
66
  export { CommentPin as t };
@@ -1,6 +1,6 @@
1
1
  import { n as prepareAnnouncer, t as announce } from "./announce-B0DLwflT.js";
2
2
  import { r as useUIComponent } from "./nuxt-ui-7ByUrymx.js";
3
- import { o as motionSkipped } from "./ring-BN4d8vtw.js";
3
+ import { o as motionSkipped } from "./ring-GaJsg32c.js";
4
4
  import { r as createSpring } from "./opt-out-D66l60sg.js";
5
5
  import { useCopy } from "./parts/components/copy-button.js";
6
6
  import { defineComponent, h, nextTick, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, ref, shallowRef, watch } from "vue";
@@ -231,7 +231,7 @@ const CommentSend = defineComponent({
231
231
  "aria-hidden": "true",
232
232
  "data-slot": "comment-send-hold-copy"
233
233
  }, sendContent(current.count, lastInbox))])];
234
- case "sent": return [status(void 0, [icon("i-lucide-check"), current.inbox ? "In inbox" : "Sent"])];
234
+ case "sent": return [status(void 0, [icon("i-lucide-check"), current.inbox ? "In inbox" : "Sent"]), current.count > 0 ? sendButton(current.count, Boolean(current.agent && !current.agent.host)) : null].filter((part) => part !== null);
235
235
  case "working": return [
236
236
  status(void 0, [h("span", {
237
237
  "aria-hidden": "true",
@@ -0,0 +1,20 @@
1
+ // src/internal/comment-status.ts
2
+ /** The messages written after the thread was resolved. Empty for an open thread. */
3
+ function messagesSinceResolved(thread) {
4
+ const { resolvedAt } = thread;
5
+ if (thread.status !== "resolved" || resolvedAt === void 0) return [];
6
+ return thread.messages.filter((message) => message.createdAt > resolvedAt);
7
+ }
8
+ const repliedSinceResolved = (thread) => messagesSinceResolved(thread).length > 0;
9
+ /** "Comment 3". A comment that waits in the outbox has no number yet. */
10
+ function commentTitle(thread) {
11
+ return thread.n ? `Comment ${thread.n}` : "Comment";
12
+ }
13
+ /** `data-pending` or `data-failed` for a thread, message, or row that the outbox holds. */
14
+ function deliveryAttributes(delivery) {
15
+ return {
16
+ "data-failed": delivery?.status === "failed" ? "true" : void 0,
17
+ "data-pending": delivery?.status === "pending" ? "true" : void 0
18
+ };
19
+ }
20
+ export { repliedSinceResolved as i, deliveryAttributes as n, messagesSinceResolved as r, commentTitle as t };
@@ -1,13 +1,9 @@
1
- import { t as CommentCan } from "./comments-DrE9DU-E.js";
2
- import { i as CommentComposerSlots, r as CommentComposerSize } from "./comment-composer-BI6CNJyO.js";
1
+ import { t as CommentCan } from "./comments-OWjNidkP.js";
2
+ import { i as CommentComposerSlots, r as CommentComposerSize } from "./comment-composer-DmDM3XYP.js";
3
3
  import { PropType, SlotsType, VNode } from "vue";
4
4
  import { CommentDelivery, CommentMessage, CommentThread, CommentUser } from "@vite-hub/comments/client";
5
5
  /** The messages written after the thread was resolved. Empty for an open thread. */
6
6
  declare function messagesSinceResolved(thread: Pick<CommentThread, "status" | "resolvedAt" | "messages">): CommentMessage[];
7
- /**
8
- * Whether someone replied after the thread was resolved, such as an agent that says what it changed. The thread stays
9
- * resolved, and lists show it with the open threads until someone resolves it again.
10
- */
11
7
  declare const repliedSinceResolved: (thread: Pick<CommentThread, "status" | "resolvedAt" | "messages">) => boolean;
12
8
  type Done = Promise<unknown> | void;
13
9
  /** An attachment as `attachmentUrl` describes it: its URL, and the file name and media type when the key does not say. */
@@ -369,11 +365,11 @@ declare const CommentThread$1: import("vue").DefineComponent<import("vue").Extra
369
365
  onClose?: ((...args: any[]) => any) | undefined;
370
366
  }>, {
371
367
  size: CommentComposerSize;
372
- people: CommentUser[];
368
+ preview: boolean;
373
369
  busy: boolean;
370
+ people: CommentUser[];
374
371
  attachments: boolean;
375
372
  readOnly: boolean;
376
- preview: boolean;
377
373
  detached: boolean;
378
374
  navigation: "close" | "back";
379
375
  dismissible: boolean;
@@ -1,10 +1,11 @@
1
1
  import { RollNumber } from "./parts/components/motion.js";
2
- import { i as consumedPointerEvents, l as swallowNextClick, n as injectComments, o as pathOf, r as commentThreadPortals, s as shakeDirtyComposers, u as useDocumentPointerDown } from "./comments-context-CrjhleVA.js";
3
- import { n as mentionPlugin, r as mentionTag, t as CommentComposer } from "./comment-composer-CzU7DdfD.js";
2
+ import { i as consumedPointerEvents, l as swallowNextClick, n as injectComments, o as pathOf, r as commentThreadPortals, s as shakeDirtyComposers, u as useDocumentPointerDown } from "./comments-context-3js2YFl2.js";
3
+ import { n as mentionPlugin, r as mentionTag, t as CommentComposer } from "./comment-composer-X7vJKh5b.js";
4
4
  import { a as writerName, o as writerPerson, t as displayName } from "./comment-person-D_IyIjXo.js";
5
- import { c as messagesSinceResolved, o as commentTitle, s as deliveryAttributes, t as defaultCommentCan } from "./comments-C0OdHh_F.js";
6
- import { a as useViteHubUIIcons } from "./config-DztmAYYn.js";
7
- import { t as travel } from "./travel-CwVhU_GS.js";
5
+ import { n as deliveryAttributes, r as messagesSinceResolved, t as commentTitle } from "./comment-status-nsCdrRk_.js";
6
+ import { t as defaultCommentCan } from "./comments-9MDSNm-9.js";
7
+ import { a as useViteHubUIIcons } from "./config-LRonN53j.js";
8
+ import { t as travel } from "./travel-BliEidau.js";
8
9
  import { r as useUIComponent } from "./nuxt-ui-7ByUrymx.js";
9
10
  import { Attachment, AttachmentContent, AttachmentGroup, AttachmentMedia, AttachmentTitle } from "./parts/components/attachment.js";
10
11
  import { AvatarStack } from "./parts/components/avatar-stack.js";
@@ -678,7 +679,6 @@ const CommentThread = defineComponent({
678
679
  const { thread } = props;
679
680
  const resolved = thread.status === "resolved";
680
681
  const later = messagesSinceResolved(thread);
681
- const resolvable = !resolved || later.length > 0;
682
682
  const first = thread.messages[0];
683
683
  const quote = thread.anchor.kind === "text" ? thread.anchor.exact : void 0;
684
684
  if (props.preview) {
@@ -725,10 +725,10 @@ const CommentThread = defineComponent({
725
725
  h("span", { "data-slot": "comment-thread-spacer" }),
726
726
  slots.actions ? h("div", { "data-slot": "comment-thread-actions" }, slots.actions({ thread })) : null,
727
727
  !allowed("resolve") ? null : h(UButton, {
728
- "aria-label": resolvable ? "Resolve" : "Reopen",
728
+ "aria-label": resolved ? "Reopen" : "Resolve",
729
729
  color: "neutral",
730
- icon: resolvable ? icons.value.check : icons.value.reopen,
731
- onClick: () => void act(resolvable ? props.onResolve : props.onReopen),
730
+ icon: resolved ? icons.value.reopen : icons.value.check,
731
+ onClick: () => void act(resolved ? props.onReopen : props.onResolve),
732
732
  size: "xs",
733
733
  variant: "ghost"
734
734
  }),
@@ -1,6 +1,6 @@
1
1
  import { t as uiErrorDiagnostics } from "./error-diagnostics-BlgA9rI2.js";
2
2
  import { createCommentVisibility } from "./parts/headless/comment-visibility.js";
3
- import { a as hasDirtyComposer, n as injectComments, s as shakeDirtyComposers, t as commentsKey } from "./comments-context-CrjhleVA.js";
3
+ import { a as hasDirtyComposer, n as injectComments, s as shakeDirtyComposers, t as commentsKey } from "./comments-context-3js2YFl2.js";
4
4
  import { computed, getCurrentInstance, isRef, onBeforeUnmount, onMounted, provide, reactive, ref, shallowRef, toRaw, toValue, watch } from "vue";
5
5
  import { createAnchor, resolveAnchor } from "@vite-hub/comments/client";
6
6
  // src/internal/comment-selection.ts
@@ -26,29 +26,6 @@ function useSelectedComment(threads, id) {
26
26
  });
27
27
  return computed(() => selection.value.thread);
28
28
  }
29
- // src/internal/comment-status.ts
30
- /** The messages written after the thread was resolved. Empty for an open thread. */
31
- function messagesSinceResolved(thread) {
32
- const { resolvedAt } = thread;
33
- if (thread.status !== "resolved" || resolvedAt === void 0) return [];
34
- return thread.messages.filter((message) => message.createdAt > resolvedAt);
35
- }
36
- /**
37
- * Whether someone replied after the thread was resolved, such as an agent that says what it changed. The thread stays
38
- * resolved, and lists show it with the open threads until someone resolves it again.
39
- */
40
- const repliedSinceResolved = (thread) => messagesSinceResolved(thread).length > 0;
41
- /** "Comment 3". A comment that waits in the outbox has no number yet. */
42
- function commentTitle(thread) {
43
- return thread.n ? `Comment ${thread.n}` : "Comment";
44
- }
45
- /** `data-pending` or `data-failed` for a thread, message, or row that the outbox holds. */
46
- function deliveryAttributes(delivery) {
47
- return {
48
- "data-failed": delivery?.status === "failed" ? "true" : void 0,
49
- "data-pending": delivery?.status === "pending" ? "true" : void 0
50
- };
51
- }
52
29
  // src/headless/comments.ts
53
30
  /**
54
31
  * The permissions that the parts assume without a `can` option: a signed-in user may reply to and resolve any thread,
@@ -63,6 +40,7 @@ function defaultCommentCan(user) {
63
40
  }
64
41
  const draftPositionKey = "draft";
65
42
  const uiSelector = "[data-comments-ui]";
43
+ const draftComposerSelector = "[data-draft] [data-slot='comment-composer']";
66
44
  function defaultIgnore(element) {
67
45
  for (let node = element; node;) {
68
46
  if (node.closest(uiSelector)) return true;
@@ -82,6 +60,7 @@ function samePosition(a, b) {
82
60
  }
83
61
  const editableSelector = "input, textarea, select, [contenteditable]:not([contenteditable='false']), [role='textbox'], [role='combobox'], [role='searchbox']";
84
62
  const isEditable = (path) => path.some((element) => element.matches(editableSelector));
63
+ const someFiles = (files) => files !== void 0 && (!Array.isArray(files) || files.length > 0);
85
64
  function describeError(error) {
86
65
  return error instanceof Error ? error.message : "The comment could not be sent. Try again.";
87
66
  }
@@ -128,7 +107,7 @@ function useComments(options) {
128
107
  const hoverId = ref(null);
129
108
  const listOpen = ref(false);
130
109
  const blocked = ref(0);
131
- const isOpen = (thread) => thread.status === "open" || repliedSinceResolved(thread);
110
+ const isOpen = (thread) => thread.status === "open";
132
111
  const passes = (thread) => {
133
112
  if (!(filters.open && isOpen(thread) || filters.resolved && thread.status === "resolved")) return false;
134
113
  return !filters.mine || thread.author.id === user.value?.id;
@@ -136,13 +115,12 @@ function useComments(options) {
136
115
  const onPage = (thread) => sameSubject(thread.subject, subject.value);
137
116
  const pageThreads = computed(() => threads.value.filter((thread) => onPage(thread) && passes(thread)));
138
117
  const listed = computed(() => threads.value.filter((thread) => (scope.value === "site" || onPage(thread)) && passes(thread)));
139
- const counts = computed(() => {
140
- const scoped = threads.value.filter((thread) => scope.value === "site" || onPage(thread));
141
- return {
142
- open: scoped.filter(isOpen).length,
143
- resolved: scoped.filter((thread) => thread.status === "resolved").length
144
- };
145
- });
118
+ const scoped = computed(() => threads.value.filter((thread) => scope.value === "site" || onPage(thread)));
119
+ const openThreads = computed(() => scoped.value.filter(isOpen));
120
+ const counts = computed(() => ({
121
+ open: openThreads.value.length,
122
+ resolved: scoped.value.filter((thread) => thread.status === "resolved").length
123
+ }));
146
124
  const opened = useSelectedComment(threads, openId);
147
125
  watch(opened, (thread) => {
148
126
  if (thread && thread.id !== openId.value) openId.value = thread.id;
@@ -185,7 +163,7 @@ function useComments(options) {
185
163
  const previous = positions.value;
186
164
  if (!(next.size === previous.size && [...next].every(([key, position]) => samePosition(position, previous.get(key))))) positions.value = next;
187
165
  }
188
- const hasText = () => (draft.value?.body.trim().length ?? 0) > 0 || hasDirtyComposer(uiRoot());
166
+ const hasText = () => (draft.value?.body.trim().length ?? 0) > 0 || hasDirtyComposer(uiRoot(), draft.value ? void 0 : draftComposerSelector);
189
167
  const block = (escape = false) => {
190
168
  blocked.value++;
191
169
  shakeDirtyComposers(uiRoot(), escape);
@@ -268,22 +246,36 @@ function useComments(options) {
268
246
  async function send(sendOptions = {}) {
269
247
  const current = draft.value;
270
248
  const body = current?.body.trim() ?? "";
271
- const files = sendOptions.files ?? [];
272
- if (!current || current.busy || !body && current.attachments.length === 0 && files.length === 0) return void 0;
249
+ const files = sendOptions.files;
250
+ const hasFiles = someFiles(files);
251
+ if (!current || current.busy || !body && current.attachments.length === 0 && !hasFiles) return void 0;
273
252
  const submittedBody = current.body;
274
253
  const mentions = [...current.mentions];
275
254
  const attachments = [...current.attachments];
276
- current.busy = true;
255
+ const input = {
256
+ subject: subject.value,
257
+ anchor: toRaw(current.anchor),
258
+ body,
259
+ mentions,
260
+ ...attachments.length > 0 ? { attachments } : {},
261
+ ...hasFiles ? { files } : {}
262
+ };
277
263
  current.error = void 0;
264
+ if (client.outbox) {
265
+ draft.value = null;
266
+ try {
267
+ const thread = await client.create(input);
268
+ flash(thread.id);
269
+ return thread;
270
+ } catch (error) {
271
+ current.error = describeError(error);
272
+ if (!draft.value) draft.value = current;
273
+ return;
274
+ }
275
+ }
276
+ current.busy = true;
278
277
  try {
279
- const thread = await client.create({
280
- subject: subject.value,
281
- anchor: toRaw(current.anchor),
282
- body,
283
- mentions,
284
- ...attachments.length > 0 ? { attachments } : {},
285
- ...files.length > 0 ? { files } : {}
286
- });
278
+ const thread = await client.create(input);
287
279
  current.busy = false;
288
280
  flash(thread.id);
289
281
  if (draft.value === current && current.body === submittedBody && current.mentions.length === mentions.length && current.mentions.every((id, index) => id === mentions[index])) draft.value = null;
@@ -513,6 +505,7 @@ function useComments(options) {
513
505
  },
514
506
  pageThreads,
515
507
  listed,
508
+ openThreads,
516
509
  counts,
517
510
  positions,
518
511
  draft,
@@ -542,7 +535,7 @@ function useComments(options) {
542
535
  body,
543
536
  mentions,
544
537
  ...attachments?.length ? { attachments } : {},
545
- ...files?.length ? { files } : {}
538
+ ...someFiles(files) ? { files } : {}
546
539
  });
547
540
  flash(thread.id);
548
541
  return thread;
@@ -553,7 +546,7 @@ function useComments(options) {
553
546
  body,
554
547
  mentions,
555
548
  ...attachments?.length ? { attachments } : {},
556
- ...files?.length ? { files } : {}
549
+ ...someFiles(files) ? { files } : {}
557
550
  });
558
551
  flash(threadId);
559
552
  return thread;
@@ -601,4 +594,4 @@ function useCommentsContext(state) {
601
594
  if (!found) throw uiErrorDiagnostics.UI_R0002({ message: "Comment parts need a comments state. Put them inside CommentLayer, or pass the result of useComments() as the `comments` prop." });
602
595
  return found;
603
596
  }
604
- export { useCommentsContext as a, messagesSinceResolved as c, useSelectedComment as d, useComments as i, repliedSinceResolved as l, draftPositionKey as n, commentTitle as o, provideComments as r, deliveryAttributes as s, defaultCommentCan as t, commentThreadKey as u };
597
+ export { useCommentsContext as a, useComments as i, draftPositionKey as n, commentThreadKey as o, provideComments as r, useSelectedComment as s, defaultCommentCan as t };