@vite-hub/ui 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +102 -76
  2. package/dist/announce-Cy_Tn9wW.js +32 -0
  3. package/dist/{avatar-stack-DPRFuezh.d.ts → avatar-stack-DXmCQhxd.d.ts} +1 -1
  4. package/dist/{comment-composer-jYv2ULNP.js → comment-composer-D7ZytyER.js} +257 -10
  5. package/dist/{comment-composer-fINL5bxo.d.ts → comment-composer-DvKMTrAi.d.ts} +4 -4
  6. package/dist/{comment-layer-C_sbPIR5.d.ts → comment-layer-GTsLdABl.d.ts} +4 -4
  7. package/dist/{comment-list-BcSaLngS.d.ts → comment-list-BI96empx.d.ts} +2 -2
  8. package/dist/comment-marks.css +18 -22
  9. package/dist/{comment-panel-CfvdRUMX.d.ts → comment-panel-CsKWTms_.d.ts} +2 -2
  10. package/dist/{comment-pin-DHOdRvUw.d.ts → comment-pin-CvwgRSDR.d.ts} +1 -1
  11. package/dist/{comment-row-Bn3nr8l5.js → comment-row-JmTC0uXr.js} +1 -1
  12. package/dist/comment-send-7bg4NEEM.js +277 -0
  13. package/dist/comment-send-C45dHC22.d.ts +25 -0
  14. package/dist/comment-send.css +267 -0
  15. package/dist/comment-thread-B_Sc2QX6.js +797 -0
  16. package/dist/{comment-thread-DKJjmWN0.d.ts → comment-thread-C6U-bsK_.d.ts} +4 -4
  17. package/dist/{comments-D0d26ghV.js → comments-B88zg9gC.js} +1 -1
  18. package/dist/{comments-context-C2lOZyQ5.js → comments-context-DhbIdYQ1.js} +2 -1
  19. package/dist/{config-Dk67emQt.js → config-B1u7zqMB.js} +8 -1
  20. package/dist/{config-DgxBW013.d.ts → config-pHazYdq6.d.ts} +11 -0
  21. package/dist/drop-field-3CDRFFRm.js +163 -0
  22. package/dist/{editor-C_wt4RRV.js → editor-BHYGLgty.js} +42 -3
  23. package/dist/effects-Ql6VzCRa.js +2971 -0
  24. package/dist/headless.d.ts +1 -1
  25. package/dist/headless.js +1 -1
  26. package/dist/hold-to-delete-DjWzRDyY.d.ts +51 -0
  27. package/dist/hold-to-delete-ROLQRZg_.js +434 -0
  28. package/dist/icon-c5Jb_Tl7.d.ts +31 -0
  29. package/dist/{image-preview-C9tdkmEj.js → image-preview-BigoAvb3.js} +2 -2
  30. package/dist/{index-BYRFQfCd.d.ts → index-YUvL2nV8.d.ts} +8 -10
  31. package/dist/index.d.ts +19 -14
  32. package/dist/index.js +45 -44
  33. package/dist/install-D5f6msEU.js +17 -0
  34. package/dist/list-RCbNZ14q.js +271 -0
  35. package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-Dfl2DgPS.js} +1 -1
  36. package/dist/markdown-editor.js +1 -1
  37. package/dist/{message-scroller-jrYN9dG9.d.ts → message-scroller-Bm1YWTeY.d.ts} +2 -2
  38. package/dist/motion/core.d.ts +4 -0
  39. package/dist/motion/core.js +11 -0
  40. package/dist/motion-core-lHRF8PZz.d.ts +456 -0
  41. package/dist/motion.d.ts +16 -0
  42. package/dist/motion.js +13 -0
  43. package/dist/{nuxt-ui-DSQFzq3s.js → nuxt-ui-CgvMzO5v.js} +20 -14
  44. package/dist/nuxt.d.ts +1 -1
  45. package/dist/nuxt.js +12 -3
  46. package/dist/opt-out-b6bnUjIT.js +208 -0
  47. package/dist/parts/components/agent-session.js +1 -1
  48. package/dist/parts/components/attachment.d.ts +1 -1
  49. package/dist/parts/components/attachment.js +1 -1
  50. package/dist/parts/components/avatar-stack.d.ts +1 -1
  51. package/dist/parts/components/avatar-stack.js +2 -1
  52. package/dist/parts/components/bubble.d.ts +1 -1
  53. package/dist/parts/components/chat-session.d.ts +1 -1
  54. package/dist/parts/components/chat.js +2 -2
  55. package/dist/parts/components/code-block.d.ts +1 -1
  56. package/dist/parts/components/code-block.js +1 -1
  57. package/dist/parts/components/comment-composer.d.ts +1 -1
  58. package/dist/parts/components/comment-composer.js +1 -1
  59. package/dist/parts/components/comment-layer.d.ts +1 -1
  60. package/dist/parts/components/comment-layer.js +24 -6
  61. package/dist/parts/components/comment-list.d.ts +1 -1
  62. package/dist/parts/components/comment-list.js +12 -7
  63. package/dist/parts/components/comment-panel.d.ts +1 -1
  64. package/dist/parts/components/comment-panel.js +24 -10
  65. package/dist/parts/components/comment-pin.d.ts +1 -1
  66. package/dist/parts/components/comment-selection-bar.js +3 -2
  67. package/dist/parts/components/comment-send.d.ts +2 -0
  68. package/dist/parts/components/comment-send.js +2 -0
  69. package/dist/parts/components/comment-thread.d.ts +1 -1
  70. package/dist/parts/components/comment-thread.js +2 -597
  71. package/dist/parts/components/comments.d.ts +8 -7
  72. package/dist/parts/components/comments.js +5 -4
  73. package/dist/parts/components/copy-button.d.ts +13 -3
  74. package/dist/parts/components/copy-button.js +226 -1
  75. package/dist/parts/components/device-frame.d.ts +2 -2
  76. package/dist/parts/components/drop-field.d.ts +69 -0
  77. package/dist/parts/components/drop-field.js +77 -0
  78. package/dist/parts/components/filter-search.js +1 -1
  79. package/dist/parts/components/hold-to-delete.d.ts +82 -0
  80. package/dist/parts/components/hold-to-delete.js +76 -0
  81. package/dist/parts/components/markdown-editor.js +1 -1
  82. package/dist/parts/components/markdown-renderer.js +1 -1
  83. package/dist/parts/components/markdown.js +1 -1
  84. package/dist/parts/components/marker.d.ts +1 -1
  85. package/dist/parts/components/message-parts.js +13 -5
  86. package/dist/parts/components/motion-list.d.ts +42 -0
  87. package/dist/parts/components/motion-list.js +42 -0
  88. package/dist/parts/components/motion.d.ts +124 -0
  89. package/dist/parts/components/motion.js +172 -0
  90. package/dist/parts/components/progress.d.ts +41 -0
  91. package/dist/parts/components/progress.js +54 -0
  92. package/dist/parts/components/prompt-input.d.ts +5 -5
  93. package/dist/parts/components/prompt-input.js +3 -3
  94. package/dist/parts/components/relative-time.js +1 -1
  95. package/dist/parts/components/sync-status.js +2 -1
  96. package/dist/parts/components/tool-list.d.ts +1 -1
  97. package/dist/parts/components/trace-run.d.ts +1 -1
  98. package/dist/parts/components/trace-run.js +1 -1
  99. package/dist/parts/components/trace.d.ts +1 -1
  100. package/dist/parts/headless/comments.js +1 -1
  101. package/dist/parts/headless/message-scroller.d.ts +1 -1
  102. package/dist/parts/playground/share.d.ts +36 -2
  103. package/dist/parts/workspace/browser-support-notice.d.ts +1 -1
  104. package/dist/parts/workspace/browser-support-notice.js +12 -4
  105. package/dist/parts/workspace/codemirror.d.ts +9 -0
  106. package/dist/parts/workspace/codemirror.js +37 -4
  107. package/dist/parts/workspace/connect-panel.d.ts +1 -1
  108. package/dist/parts/workspace/connect-panel.js +1 -1
  109. package/dist/parts/workspace/file-icons.d.ts +16 -0
  110. package/dist/parts/workspace/file-icons.js +82 -0
  111. package/dist/parts/workspace/icons.d.ts +1 -0
  112. package/dist/parts/workspace/icons.js +1 -0
  113. package/dist/parts/workspace/runners/render.d.ts +26 -0
  114. package/dist/parts/workspace/runners/render.js +124 -0
  115. package/dist/parts/workspace/runners/web-container.d.ts +29 -0
  116. package/dist/parts/workspace/runners/web-container.js +186 -0
  117. package/dist/parts/workspace/workspace-bar.d.ts +51 -0
  118. package/dist/parts/workspace/workspace-bar.js +51 -0
  119. package/dist/parts/workspace/workspace-editor-head.d.ts +47 -0
  120. package/dist/parts/workspace/workspace-editor-head.js +66 -0
  121. package/dist/parts/workspace/workspace-editor.d.ts +17 -0
  122. package/dist/parts/workspace/workspace-editor.js +29 -3
  123. package/dist/parts/workspace/workspace-examples.d.ts +74 -0
  124. package/dist/parts/workspace/workspace-examples.js +72 -0
  125. package/dist/parts/workspace/workspace-file-link.d.ts +35 -0
  126. package/dist/parts/workspace/workspace-file-link.js +39 -0
  127. package/dist/parts/workspace/workspace-file-tree.d.ts +8 -8
  128. package/dist/parts/workspace/workspace-file-tree.js +26 -19
  129. package/dist/parts/workspace/workspace-guide.d.ts +52 -0
  130. package/dist/parts/workspace/workspace-guide.js +91 -0
  131. package/dist/parts/workspace/workspace-issues.d.ts +46 -0
  132. package/dist/parts/workspace/workspace-issues.js +49 -0
  133. package/dist/parts/workspace/workspace-preview.js +1 -1
  134. package/dist/parts/workspace/workspace-shell.d.ts +2 -88
  135. package/dist/parts/workspace/workspace-shell.js +131 -78
  136. package/dist/parts/workspace/workspace-sidebar.d.ts +75 -0
  137. package/dist/parts/workspace/workspace-sidebar.js +132 -0
  138. package/dist/parts/workspace/workspace-start.d.ts +47 -0
  139. package/dist/parts/workspace/workspace-start.js +60 -0
  140. package/dist/parts/workspace/workspace-status.d.ts +69 -0
  141. package/dist/parts/workspace/workspace-status.js +74 -0
  142. package/dist/parts/workspace/workspace-steps.d.ts +2 -0
  143. package/dist/parts/workspace/workspace-steps.js +128 -0
  144. package/dist/parts/workspace/workspace-task.d.ts +20 -0
  145. package/dist/parts/workspace/workspace-task.js +20 -0
  146. package/dist/parts/workspace/workspace.d.ts +251 -0
  147. package/dist/parts/workspace/workspace.js +665 -0
  148. package/dist/playground.d.ts +1 -1
  149. package/dist/progress-C7afI5vq.js +266 -0
  150. package/dist/registry-D3-ysX7l.js +78 -0
  151. package/dist/{relative-time-BVmjOsYG.js → relative-time-DgSS3zKN.js} +1 -1
  152. package/dist/ring-B7Qxu7zd.js +175 -0
  153. package/dist/runtime/nuxt-plugin.js +2 -2
  154. package/dist/styles.css +586 -573
  155. package/dist/text-BCJflBJf.js +826 -0
  156. package/dist/theme.d.ts +43 -0
  157. package/dist/theme.js +22 -7
  158. package/dist/travel-C87xd5Wh.js +182 -0
  159. package/dist/tween-CO24nMpf.js +62 -0
  160. package/dist/{types-Dj7vp0lZ.d.ts → types-BX64qHlV.d.ts} +1 -1
  161. package/dist/visual-copy-CrVc3z4n.js +15 -0
  162. package/dist/workspace-shell-BJGnoF3p.d.ts +112 -0
  163. package/dist/workspace-steps-Bgph2rpr.d.ts +72 -0
  164. package/dist/workspace.d.ts +16 -3
  165. package/dist/workspace.js +15 -2
  166. package/package.json +21 -10
  167. package/dist/copy-button-CRN3kmSD.js +0 -253
  168. package/dist/icon-swap.css +0 -69
  169. package/dist/parts/playground/highlight.d.ts +0 -5
  170. package/dist/parts/playground/highlight.js +0 -23
  171. package/dist/parts/playground/playground-render.d.ts +0 -126
  172. package/dist/parts/playground/playground-render.js +0 -356
  173. package/dist/parts/workspace/playground-container.d.ts +0 -192
  174. package/dist/parts/workspace/playground-container.js +0 -603
  175. package/dist/share-DM4eNy4q.d.ts +0 -37
@@ -1,9 +1,16 @@
1
+ import { r as useUIComponent } from "./nuxt-ui-CgvMzO5v.js";
2
+ import { RollNumber } from "./parts/components/motion.js";
3
+ import { a as useViteHubUIIcons } from "./config-B1u7zqMB.js";
4
+ import { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentGroup, AttachmentMedia, AttachmentTitle } from "./parts/components/attachment.js";
1
5
  import { AvatarStack } from "./parts/components/avatar-stack.js";
2
- import { a as pathOf, c as swallowNextClick, l as useDocumentPointerDown, n as injectComments, r as consumedPointerEvents, s as shakeEventName } from "./comments-context-C2lOZyQ5.js";
6
+ import { t as ImagePreview } from "./image-preview-BigoAvb3.js";
7
+ import { c as shakeEventName, i as consumedPointerEvents, l as swallowNextClick, n as injectComments, o as pathOf, u as useDocumentPointerDown } from "./comments-context-DhbIdYQ1.js";
3
8
  import { i as toPerson, t as displayName } from "./comment-person-CLPlW_SS.js";
9
+ import { n as shake, t as travel } from "./travel-C87xd5Wh.js";
4
10
  import { i as matchesAccept } from "./attachments-BzTwqRTU.js";
11
+ import { t as createMotionList } from "./list-RCbNZ14q.js";
5
12
  import { PromptInput } from "./parts/components/prompt-input.js";
6
- import { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from "vue";
13
+ import { computed, defineComponent, h, nextTick, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, ref, useId, watch } from "vue";
7
14
  import { foldName } from "@vite-hub/comments/client";
8
15
  //#region src/internal/comment-mentions.ts
9
16
  /** The tag of a mention chip in a rendered message. */
@@ -82,6 +89,193 @@ function mentionPlugin(people) {
82
89
  return plugin;
83
90
  }
84
91
  //#endregion
92
+ //#region src/internal/comment-image-stack.ts
93
+ const closeDelay = 250;
94
+ /**
95
+ * The pictures of a comment box as one stack of cards beside the text, with their count. Hover or focus fans them out
96
+ * above the box, where each card opens full size and has its Remove button. A tap on the stack fans it out too.
97
+ *
98
+ * A new picture comes out of `origin`, such as the text for a paste or the attach button for a pick, and the others
99
+ * move to make room (docs/design/motion.md, "Items are added, removed, or reordered"). The fan travels each card from
100
+ * its place in the stack to its place in the fan and back ("Something moves to a new place").
101
+ */
102
+ const CommentImageStack = defineComponent({
103
+ name: "CommentImageStack",
104
+ props: {
105
+ images: {
106
+ required: true,
107
+ type: Array
108
+ },
109
+ /** The pictures can't be removed, such as while the comment is sent. */
110
+ disabled: {
111
+ default: false,
112
+ type: Boolean
113
+ },
114
+ /** Where the next new picture comes from. Read once for each change of `images`. */
115
+ origin: { type: Function }
116
+ },
117
+ emits: ["remove"],
118
+ setup(props, { emit }) {
119
+ const icons = useViteHubUIIcons();
120
+ const UButton = useUIComponent("UButton");
121
+ const root = ref();
122
+ const cards = ref();
123
+ const fanned = ref(false);
124
+ const bounds = ref({
125
+ left: 0,
126
+ width: 0,
127
+ scrollable: false
128
+ });
129
+ let observer;
130
+ let list;
131
+ let closer;
132
+ let hovered = false;
133
+ let focused = false;
134
+ let refocus = false;
135
+ let fanFrom;
136
+ const cardElements = () => [...cards.value?.children ?? []].filter((child) => child instanceof HTMLElement && child.hasAttribute("data-key") && !child.hasAttribute("data-motion-ghost"));
137
+ function measureBounds() {
138
+ const stack = root.value;
139
+ if (!stack) return;
140
+ const rect = (stack.closest("[data-slot=comment-composer-box]") ?? stack).getBoundingClientRect();
141
+ const left = Math.max(0, rect.left);
142
+ const documentRoot = stack.ownerDocument.documentElement;
143
+ const width = Math.max(0, Math.min(documentRoot.clientWidth, rect.right) - left);
144
+ const offset = left - stack.getBoundingClientRect().left;
145
+ const rem = Number.parseFloat(getComputedStyle(documentRoot).fontSize) || 16;
146
+ const scrollable = width < (props.images.length * 4 + .5) * rem;
147
+ if (bounds.value.left !== offset || bounds.value.width !== width || bounds.value.scrollable !== scrollable) bounds.value = {
148
+ left: offset,
149
+ width,
150
+ scrollable
151
+ };
152
+ }
153
+ function setFanned(value) {
154
+ clearTimeout(closer);
155
+ if (value && props.images.length === 0) value = false;
156
+ if (fanned.value === value) return;
157
+ fanFrom = new Map(cardElements().map((card) => [card, card.getBoundingClientRect()]));
158
+ if (value) measureBounds();
159
+ fanned.value = value;
160
+ }
161
+ const closeSoon = () => {
162
+ clearTimeout(closer);
163
+ closer = setTimeout(() => {
164
+ if (!focused && !hovered) setFanned(false);
165
+ }, closeDelay);
166
+ };
167
+ onMounted(() => {
168
+ if (cards.value) list = createMotionList(cards.value);
169
+ const box = root.value?.closest("[data-slot=comment-composer-box]");
170
+ if (box && typeof ResizeObserver !== "undefined") {
171
+ observer = new ResizeObserver(() => {
172
+ if (fanned.value) measureBounds();
173
+ });
174
+ observer.observe(box);
175
+ }
176
+ });
177
+ onBeforeUpdate(() => {
178
+ if (!fanFrom) list?.measure();
179
+ });
180
+ onUpdated(() => {
181
+ if (props.images.length === 0 && fanned.value) setFanned(false);
182
+ if (fanned.value) measureBounds();
183
+ const from = fanFrom;
184
+ fanFrom = void 0;
185
+ if (!from) return list?.play({ origin: props.origin?.() ?? void 0 });
186
+ for (const [card, box] of from) if (card.isConnected) travel(card, { from: box });
187
+ });
188
+ onBeforeUnmount(() => {
189
+ clearTimeout(closer);
190
+ observer?.disconnect();
191
+ list?.destroy();
192
+ });
193
+ const label = computed(() => props.images.length === 1 ? "1 picture" : `${props.images.length} pictures`);
194
+ return () => {
195
+ const count = props.images.length;
196
+ return h("div", {
197
+ "data-fanned": fanned.value ? "true" : void 0,
198
+ "data-slot": "comment-image-stack",
199
+ onFocusin: (event) => {
200
+ focused = true;
201
+ if (refocus) return;
202
+ if (event.target instanceof Element && event.target.matches(":focus-visible")) setFanned(true);
203
+ },
204
+ onFocusout: (event) => {
205
+ if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget)) return;
206
+ focused = false;
207
+ closeSoon();
208
+ },
209
+ onKeydown: (event) => {
210
+ if (event.key !== "Escape" || !fanned.value) return;
211
+ event.preventDefault();
212
+ event.stopPropagation();
213
+ setFanned(false);
214
+ refocus = true;
215
+ root.value?.querySelector("[data-slot=comment-image-stack-toggle]")?.focus();
216
+ refocus = false;
217
+ },
218
+ onPointerenter: (event) => {
219
+ if (event.pointerType !== "mouse") return;
220
+ hovered = true;
221
+ setFanned(true);
222
+ },
223
+ onPointerleave: (event) => {
224
+ if (event.pointerType !== "mouse") return;
225
+ hovered = false;
226
+ closeSoon();
227
+ },
228
+ ref: root,
229
+ role: "group",
230
+ "aria-label": `Attached ${label.value}`,
231
+ style: {
232
+ "--vh-fan-left": `${bounds.value.left}px`,
233
+ "--vh-fan-room": `${bounds.value.width}px`,
234
+ "--vh-fan-count": count
235
+ }
236
+ }, [
237
+ h("button", {
238
+ "aria-expanded": String(fanned.value),
239
+ "aria-label": `Show ${label.value}`,
240
+ "data-slot": "comment-image-stack-toggle",
241
+ onClick: () => setFanned(hovered || !fanned.value),
242
+ type: "button"
243
+ }),
244
+ h("div", {
245
+ "data-slot": "comment-image-stack-cards",
246
+ "data-scrollable": fanned.value && bounds.value.scrollable ? "true" : void 0,
247
+ ref: cards
248
+ }, props.images.map((image, index) => h("div", {
249
+ "data-key": image.key,
250
+ "data-slot": "comment-image-stack-card",
251
+ inert: fanned.value ? void 0 : true,
252
+ key: image.key,
253
+ style: { "--vh-stack-depth": count - 1 - index }
254
+ }, [h(ImagePreview, {
255
+ alt: image.name,
256
+ compact: true,
257
+ src: image.url
258
+ }), h(UButton, {
259
+ "aria-label": `Remove ${image.name}`,
260
+ color: "neutral",
261
+ "data-slot": "comment-image-stack-remove",
262
+ disabled: props.disabled,
263
+ icon: icons.value.close,
264
+ onClick: () => emit("remove", image.key),
265
+ size: "xs",
266
+ square: true,
267
+ variant: "ghost"
268
+ })]))),
269
+ count > 1 ? h(RollNumber, {
270
+ "aria-hidden": "true",
271
+ "data-slot": "comment-image-stack-count",
272
+ value: count
273
+ }) : null
274
+ ]);
275
+ };
276
+ }
277
+ });
278
+ //#endregion
85
279
  //#region src/components/comment-composer.ts
86
280
  const emptyLineQuery = /^\S{2,}$/u;
87
281
  const placeholders = {
@@ -105,6 +299,7 @@ const pastedFiles = (clipboard) => {
105
299
  return Array.from(clipboard.files).filter((file) => file.type.startsWith("image/") || !hasText);
106
300
  };
107
301
  const escapeWindow = 2e3;
302
+ const revokeDelay = 1e3;
108
303
  const CommentComposer = defineComponent({
109
304
  name: "CommentComposer",
110
305
  props: {
@@ -224,6 +419,7 @@ const CommentComposer = defineComponent({
224
419
  const allowEmpty = computed(() => props.allowEmpty ?? props.variant === "reply");
225
420
  const parts = /* @__PURE__ */ new WeakMap();
226
421
  const urls = /* @__PURE__ */ new Set();
422
+ const revokers = [];
227
423
  const partOf = (file) => {
228
424
  let part = parts.get(file);
229
425
  if (!part) {
@@ -243,9 +439,11 @@ const CommentComposer = defineComponent({
243
439
  for (const file of previous) {
244
440
  const part = parts.get(file);
245
441
  if (part && !next.includes(file)) {
246
- URL.revokeObjectURL(part.url);
247
- urls.delete(part.url);
248
442
  parts.delete(file);
443
+ revokers.push(setTimeout(() => {
444
+ URL.revokeObjectURL(part.url);
445
+ urls.delete(part.url);
446
+ }, revokeDelay));
249
447
  }
250
448
  }
251
449
  });
@@ -303,19 +501,20 @@ const CommentComposer = defineComponent({
303
501
  () => props.layout,
304
502
  () => props.size
305
503
  ], measureLines, { flush: "post" });
306
- async function shake() {
504
+ async function shake$1() {
307
505
  const reduced = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
308
506
  shaking.value = null;
309
507
  await nextTick();
310
508
  root.value?.offsetWidth;
311
509
  shaking.value = reduced ? "flash" : "shake";
510
+ if (!reduced && root.value) shake(root.value);
312
511
  clearTimeout(timer);
313
512
  timer = setTimeout(() => shaking.value = null, 450);
314
513
  focus();
315
514
  }
316
515
  const onShake = (event) => {
317
516
  if (event instanceof CustomEvent && event.detail?.escape === true) escaped.value = true;
318
- shake();
517
+ shake$1();
319
518
  };
320
519
  onMounted(() => {
321
520
  root.value?.addEventListener(shakeEventName, onShake);
@@ -329,11 +528,12 @@ const CommentComposer = defineComponent({
329
528
  root.value?.removeEventListener(shakeEventName, onShake);
330
529
  clearTimeout(timer);
331
530
  clearTimeout(escapeTimer);
531
+ for (const revoker of revokers) clearTimeout(revoker);
332
532
  for (const url of urls) URL.revokeObjectURL(url);
333
533
  });
334
534
  expose({
335
535
  focus,
336
- shake
536
+ shake: shake$1
337
537
  });
338
538
  watch(menu, (open) => {
339
539
  const field = textarea();
@@ -356,7 +556,7 @@ const CommentComposer = defineComponent({
356
556
  if (hasContent()) {
357
557
  event.stopPropagation();
358
558
  swallowNextClick();
359
- shake();
559
+ shake$1();
360
560
  } else emit("cancel");
361
561
  });
362
562
  function checkSelection() {
@@ -445,6 +645,7 @@ const CommentComposer = defineComponent({
445
645
  }
446
646
  function keydown(event) {
447
647
  if (event.isComposing) return;
648
+ if (event.target instanceof Element && event.target.closest("[data-slot=comment-image-stack][data-fanned]")) return;
448
649
  const open = menu.value;
449
650
  const listed = open !== null && open.items.length > 0;
450
651
  if (listed && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
@@ -469,7 +670,7 @@ const CommentComposer = defineComponent({
469
670
  menu.value = null;
470
671
  } else if (hasContent() && !escaped.value) {
471
672
  escaped.value = true;
472
- shake();
673
+ shake$1();
473
674
  } else discard();
474
675
  }
475
676
  async function discard() {
@@ -484,6 +685,47 @@ const CommentComposer = defineComponent({
484
685
  emit("cancel");
485
686
  }
486
687
  const hasFiles = (event) => attachmentsOn.value && (event.dataTransfer?.types.includes("Files") ?? false);
688
+ let origin;
689
+ const takeOrigin = () => {
690
+ const from = origin;
691
+ origin = void 0;
692
+ return from;
693
+ };
694
+ const UIcon = useUIComponent("UIcon");
695
+ const icons = useViteHubUIIcons();
696
+ const fileList = ({ files: list, remove }) => {
697
+ const images = [];
698
+ const others = [];
699
+ list.forEach((file, index) => {
700
+ if (file.mediaType.startsWith("image/")) images.push({
701
+ key: file.url,
702
+ name: file.filename ?? "Picture",
703
+ url: file.url
704
+ });
705
+ else others.push({
706
+ file,
707
+ index
708
+ });
709
+ });
710
+ return [h(CommentImageStack, {
711
+ disabled: props.busy,
712
+ images,
713
+ onRemove: (key) => remove(list.findIndex((file) => file.url === key)),
714
+ origin: takeOrigin
715
+ }), others.length > 0 ? h(AttachmentGroup, { "data-slot": "prompt-input-attachments" }, () => others.map(({ file, index }) => h(Attachment, {
716
+ key: file.url,
717
+ size: "xs"
718
+ }, () => [
719
+ h(AttachmentMedia, { variant: "icon" }, () => h(UIcon, { name: icons.value.file })),
720
+ h(AttachmentContent, () => h(AttachmentTitle, () => file.filename ?? file.mediaType)),
721
+ h(AttachmentActions, () => h(AttachmentAction, {
722
+ "aria-label": `Remove ${file.filename ?? "attachment"}`,
723
+ disabled: props.busy,
724
+ icon: icons.value.close,
725
+ onClick: () => remove(index)
726
+ }))
727
+ ]))) : null];
728
+ };
487
729
  return () => h("div", {
488
730
  "data-busy": props.busy ? "true" : void 0,
489
731
  "data-dirty": hasContent() ? "true" : void 0,
@@ -504,6 +746,7 @@ const CommentComposer = defineComponent({
504
746
  },
505
747
  onPasteCapture: (event) => {
506
748
  if (!attachmentsOn.value || !event.clipboardData) return;
749
+ origin = textarea();
507
750
  if (pastedFiles(event.clipboardData).some((file) => matchesAccept(file, props.accept))) event.preventDefault();
508
751
  },
509
752
  onDragover: (event) => {
@@ -518,9 +761,13 @@ const CommentComposer = defineComponent({
518
761
  dragging.value = false;
519
762
  if (!hasFiles(event)) return;
520
763
  event.preventDefault();
764
+ origin = root.value?.querySelector("[data-slot=prompt-input-group]");
521
765
  addFiles(event.dataTransfer?.files ?? []);
522
766
  focus();
523
767
  },
768
+ onChangeCapture: (event) => {
769
+ if (event.target instanceof HTMLInputElement && event.target.type === "file") origin = root.value?.querySelector("[data-slot=prompt-input-toolbar] button[aria-label='Add attachment']");
770
+ },
524
771
  ref: root
525
772
  }, [h("div", { "data-slot": "comment-composer-box" }, [
526
773
  slots.extra ? h("div", { "data-slot": "comment-composer-extra" }, slots.extra()) : null,
@@ -542,7 +789,7 @@ const CommentComposer = defineComponent({
542
789
  onSubmit: submit,
543
790
  "onUpdate:files": (next) => setFiles(files.value.filter((file) => next.includes(partOf(file)))),
544
791
  "onUpdate:modelValue": (value) => emit("update:modelValue", value)
545
- }),
792
+ }, attachmentsOn.value ? { files: fileList } : void 0),
546
793
  menu.value && menu.value.items.length === 0 ? h("div", {
547
794
  "data-slot": "comment-composer-mentions",
548
795
  "data-state": menu.value.failed ? "error" : "empty",
@@ -225,17 +225,17 @@ declare const CommentComposer: import("vue").DefineComponent<import("vue").Extra
225
225
  "onUpdate:mentions"?: ((...args: any[]) => any) | undefined;
226
226
  "onUpdate:files"?: ((...args: any[]) => any) | undefined;
227
227
  }>, {
228
+ layout: "row" | "box";
228
229
  size: CommentComposerSize;
229
230
  modelValue: string;
230
231
  autofocus: boolean;
231
232
  variant: CommentComposerVariant;
232
- layout: "row" | "box";
233
- people: CommentUser[];
234
- busy: boolean;
235
- attachments: boolean;
236
233
  mentions: string[];
234
+ busy: boolean;
237
235
  guard: boolean;
236
+ people: CommentUser[];
238
237
  participants: string[];
238
+ attachments: boolean;
239
239
  allowEmpty: boolean;
240
240
  frame: CommentComposerFrame;
241
241
  }, SlotsType<CommentComposerSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,8 +1,8 @@
1
- import { n as AvatarStackPerson } from "./avatar-stack-DPRFuezh.js";
2
- import { r as CommentComposerSize } from "./comment-composer-fINL5bxo.js";
1
+ import { n as AvatarStackPerson } from "./avatar-stack-DXmCQhxd.js";
2
+ import { r as CommentComposerSize } from "./comment-composer-DvKMTrAi.js";
3
3
  import { s as CommentsState, t as CommentCan } from "./comments-D8hulVPy.js";
4
- import { n as CommentAttachmentUrl } from "./comment-thread-DKJjmWN0.js";
5
- import { c as CommentUpload } from "./comment-panel-CfvdRUMX.js";
4
+ import { n as CommentAttachmentUrl } from "./comment-thread-C6U-bsK_.js";
5
+ import { c as CommentUpload } from "./comment-panel-CsKWTms_.js";
6
6
  import { PropType } from "vue";
7
7
  import { CommentSubject, CommentUser, CommentsClient } from "@vite-hub/comments/client";
8
8
  //#region src/components/comment-layer.d.ts
@@ -1,6 +1,6 @@
1
- import { n as AvatarStackPerson } from "./avatar-stack-DPRFuezh.js";
1
+ import { n as AvatarStackPerson } from "./avatar-stack-DXmCQhxd.js";
2
2
  import { s as CommentsState } from "./comments-D8hulVPy.js";
3
- import { s as CommentRowSlots } from "./comment-panel-CfvdRUMX.js";
3
+ import { s as CommentRowSlots } from "./comment-panel-CsKWTms_.js";
4
4
  import { PropType, SlotsType } from "vue";
5
5
  //#region src/components/comment-list.d.ts
6
6
  declare const CommentFilters: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
@@ -11,7 +11,10 @@
11
11
  * firmer (45%), `data-status="resolved"` makes it dashed and grey, and `data-draft="true"` is the area being drawn or
12
12
  * written on: 2px comment blue with a fill. Its `comment-mark-handle` children, with `data-corner="top-left"` and the
13
13
  * other three corners, are round handles.
14
- * - `data-leaving="true"` on a pin or an area: it shrinks and fades out in 130ms (`commentLeaveMs` of `vite-hub/ui/headless`), then the page removes it.
14
+ * - `data-leaving="true"` on a pin or an area fades it out. If the motion layer is installed, it folds a copy away
15
+ * instead. The page removes the mark after `commentLeaveMs` of `vite-hub/ui/headless`.
16
+ * A pin squashes when it is pressed, with the press of the motion layer. Its zoom and its active size are a `transform`,
17
+ * so the press adds to them.
15
18
  * The page places a pin with `left` and `top`, and an area with `left`, `top`, `width`, and `height`.
16
19
  * Commented text uses the CSS Custom Highlight API with the names `vh-comment`, `vh-comment-resolved`,
17
20
  * `vh-comment-active`, and `vh-comment-draft`.
@@ -96,9 +99,9 @@
96
99
  padding: 0;
97
100
  place-items: center;
98
101
  position: absolute;
99
- scale: var(--vh-comment-zoom, 1);
102
+ transform: scale(var(--vh-comment-zoom, 1));
100
103
  transform-origin: 0 100%;
101
- transition: scale 120ms ease-out, opacity 150ms ease-out;
104
+ transition: opacity 150ms ease-out;
102
105
  width: var(--vh-comment-pin-size);
103
106
  }
104
107
 
@@ -123,15 +126,9 @@
123
126
  position: absolute;
124
127
  }
125
128
 
126
- :is([data-slot="comment-mark-pin"], [data-slot="comment-pin"]):is(:hover, :focus-visible, [data-active="true"]) {
127
- scale: calc(var(--vh-comment-zoom, 1) * 1.06);
128
- }
129
-
130
- /* A tap must not leave the pin grown, so only a fine pointer grows it on hover. */
131
- @media not ((hover: hover) and (pointer: fine)) {
132
- :is([data-slot="comment-mark-pin"], [data-slot="comment-pin"]):hover:not(:focus-visible, [data-active="true"]) {
133
- scale: var(--vh-comment-zoom, 1);
134
- }
129
+ /* The open pin and the focused pin are larger. A pin does not move on hover. */
130
+ :is([data-slot="comment-mark-pin"], [data-slot="comment-pin"]):is(:focus-visible, [data-active="true"]) {
131
+ transform: scale(calc(var(--vh-comment-zoom, 1) * 1.06));
135
132
  }
136
133
 
137
134
  :is([data-slot="comment-mark-pin"], [data-slot="comment-pin"])[data-status="resolved"] {
@@ -188,23 +185,23 @@
188
185
  :is([data-slot="comment-mark-handle"], [data-slot="comment-layer-area-handle"])[data-corner$="left"] { left: -5px; }
189
186
  :is([data-slot="comment-mark-handle"], [data-slot="comment-layer-area-handle"])[data-corner$="right"] { right: -5px; }
190
187
 
191
- /* A mark that goes, such as the others when one comment shows on its own: it shrinks and fades. */
188
+ /* A mark that goes, such as the others when one comment shows on its own. The leave effect of the motion layer folds a
189
+ copy of it away. */
192
190
  :is([data-slot="comment-mark-pin"], [data-slot="comment-mark-area"])[data-leaving="true"],
193
191
  [data-slot="comment-layer-item"][data-leaving="true"] > * {
194
- animation: vh-comment-mark-leave 130ms cubic-bezier(0.4, 0, 1, 1) forwards;
195
192
  pointer-events: none;
196
193
  }
197
194
 
198
- [data-slot="comment-mark-area"][data-leaving="true"] {
199
- animation-name: vh-comment-mark-leave-area;
195
+ :is([data-slot="comment-mark-pin"], [data-slot="comment-mark-area"])[data-leaving="true"]:not([data-motion-leave-managed]) {
196
+ animation: vh-comment-mark-fade 130ms cubic-bezier(0.4, 0, 1, 1) forwards;
200
197
  }
201
198
 
202
- @keyframes vh-comment-mark-leave {
203
- to { opacity: 0; scale: calc(var(--vh-comment-zoom, 1) * 0.8); }
199
+ [data-slot="comment-mark-pin"][data-motion-leave-managed] {
200
+ transition: none;
204
201
  }
205
202
 
206
- @keyframes vh-comment-mark-leave-area {
207
- to { opacity: 0; scale: 0.97; }
203
+ @keyframes vh-comment-mark-fade {
204
+ to { opacity: 0; }
208
205
  }
209
206
 
210
207
  @media (prefers-reduced-motion: reduce) {
@@ -212,8 +209,7 @@
212
209
  transition: none;
213
210
  }
214
211
 
215
- :is([data-slot="comment-mark-pin"], [data-slot="comment-mark-area"])[data-leaving="true"],
216
- [data-slot="comment-layer-item"][data-leaving="true"] > * {
212
+ :is([data-slot="comment-mark-pin"], [data-slot="comment-mark-area"])[data-leaving="true"]:not([data-motion-leave-managed]) {
217
213
  animation: none;
218
214
  opacity: 0;
219
215
  }
@@ -1,5 +1,5 @@
1
1
  import { s as CommentsState, t as CommentCan } from "./comments-D8hulVPy.js";
2
- import { l as CommentThreadSlots, n as CommentAttachmentUrl } from "./comment-thread-DKJjmWN0.js";
2
+ import { l as CommentThreadSlots, n as CommentAttachmentUrl } from "./comment-thread-C6U-bsK_.js";
3
3
  import { PropType, SlotsType, VNode } from "vue";
4
4
  import { CommentStatus, CommentSubject, CommentThread, CommentUser, CommentsClient } from "@vite-hub/comments/client";
5
5
  //#region src/components/comment-panel.d.ts
@@ -199,10 +199,10 @@ declare const CommentPanel: import("vue").DefineComponent<import("vue").ExtractP
199
199
  title: string;
200
200
  variant: CommentPanelVariant;
201
201
  people: CommentUser[];
202
+ allowEmpty: boolean;
202
203
  readOnly: boolean;
203
204
  queueFiles: boolean;
204
205
  thread: string | null;
205
- allowEmpty: boolean;
206
206
  }, SlotsType<CommentPanelSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
207
207
  //#endregion
208
208
  export { CommentPanelVariant as a, CommentUpload as c, CommentPanelSlots as i, CommentGroupSlotScope as n, CommentRowSlotScope as o, CommentPanel as r, CommentRowSlots as s, CommentGroup as t };
@@ -60,8 +60,8 @@ declare const CommentPin: import("vue").DefineComponent<import("vue").ExtractPro
60
60
  onHover?: ((...args: any[]) => any) | undefined;
61
61
  onLeave?: ((...args: any[]) => any) | undefined;
62
62
  }>, {
63
- status: CommentStatus;
64
63
  active: boolean;
64
+ status: CommentStatus;
65
65
  draft: boolean;
66
66
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
67
67
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { AvatarStack } from "./parts/components/avatar-stack.js";
2
2
  import { a as writerName, o as writerPerson, r as plainText } from "./comment-person-CLPlW_SS.js";
3
- import { t as RelativeTime } from "./relative-time-BVmjOsYG.js";
3
+ import { t as RelativeTime } from "./relative-time-DgSS3zKN.js";
4
4
  import { h } from "vue";
5
5
  //#region src/internal/comment-row.ts
6
6
  /** The start of a thread as plain text: its first message, else the text that it is about. */