@vite-hub/ui 0.6.1 → 0.8.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.
- package/README.md +106 -46
- package/dist/AttachmentTitle-BWw0ck0T.js +110 -0
- package/dist/BubbleContent-B1a4e3vE.js +45 -0
- package/dist/Chat-CuSthJVg.js +112 -0
- package/dist/ChatMessage-CFQs0v4N.js +94 -0
- package/dist/CodeBlockContent-BjXJm8lO.js +92 -0
- package/dist/CodeBlockTitle-DIu8Ef3V.js +99 -0
- package/dist/CommentRow-XY3FNp30.js +86 -0
- package/dist/CopyButton-Bs6DT-Z8.js +188 -0
- package/dist/Markdown-Da5t-931.js +70 -0
- package/dist/MarkdownCodeBlock-BWDLOWPO.js +127 -0
- package/dist/MarkdownImage-CJN3myt4.js +111 -0
- package/dist/MessageHeader-CJ9eBHSS.js +61 -0
- package/dist/MessageParts-CyJLG34y.js +57 -0
- package/dist/MessageScrollerViewport-BaTlWLki.js +142 -0
- package/dist/MorphText-B6MWdeIv.js +36 -0
- package/dist/RollNumber-CnF52zJM.js +49 -0
- package/dist/SwapIcon-CUIq1TU5.js +67 -0
- package/dist/TraceTitle-Cp0y7RRD.js +133 -0
- package/dist/agent-session-2j2gbGpp.js +875 -0
- package/dist/agent-session-BwZSMi4S.d.ts +312 -0
- package/dist/appendItems-hQ4aBd9Q.js +4047 -0
- package/dist/attachment-BllgHx9Q.d.ts +124 -0
- package/dist/attachment-DQMJNfj0.js +35 -0
- package/dist/avatar-stack-Bj1xUkzY.d.ts +4 -0
- package/dist/avatar-stack-CoLlsmwJ.js +72 -0
- package/dist/bubble-D3M2_InY.js +32 -0
- package/dist/bubble-DmplVxLr.d.ts +64 -0
- package/dist/chat-DWdyMSuj.d.ts +13 -0
- package/dist/chat-message-QLHnX_ED.d.ts +11 -0
- package/dist/chat-session-BOj5L3Ey.d.ts +29 -0
- package/dist/chat-session-cxUzvwdj.js +43 -0
- package/dist/choices-input-DqgXl5a-.d.ts +97 -0
- package/dist/{vue-d2Td6uu2.js → client-BG-oCUtv-5i4sRwXP.js} +4156 -4156
- package/dist/code-block-BqOEVWPh.d.ts +182 -0
- package/dist/code-block-CMERLfew.js +14 -0
- package/dist/code-view-26RY6dX8.js +137 -0
- package/dist/code-view-D8yYdFUc.d.ts +184 -0
- package/dist/{comment-composer-DmDM3XYP.d.ts → comment-composer-CsVOvG9j.d.ts} +6 -6
- package/dist/{comment-composer-X7vJKh5b.js → comment-composer-D_mcH3Ts.js} +175 -37
- package/dist/{comment-layer-KnnVfdRV.d.ts → comment-layer-C3xmg-0_.d.ts} +14 -5
- package/dist/comment-layer-Ci6ipGi2.js +1206 -0
- package/dist/{comment-panel-DoLDOw3E.d.ts → comment-panel-DxN21VoY.d.ts} +24 -17
- package/dist/comment-selection-bar-B_bchB2O.d.ts +33 -0
- package/dist/comment-selection-bar-DZAtiRZ9.js +144 -0
- package/dist/{comment-thread-DPV2kqA4.d.ts → comment-thread-BmsqcjVQ.d.ts} +9 -8
- package/dist/{comment-thread-jqPx6aJ8.js → comment-thread-BzOZVqF2.js} +74 -49
- package/dist/comments-BU8cTt5o.d.ts +50 -0
- package/dist/{comments-9MDSNm-9.js → comments-BaSrroRV.js} +32 -4
- package/dist/{comments-OWjNidkP.d.ts → comments-ZfV6IZs8.d.ts} +9 -2
- package/dist/components-B_2Q0dJ3.js +269 -0
- package/dist/{config-LRonN53j.js → config-BDQYUjjp.js} +10 -29
- package/dist/{config-COSdO-ay.d.ts → config-JmsTI7gs.d.ts} +20 -33
- package/dist/connection-status-BVSH2ZVo.js +72 -0
- package/dist/connection-status-g62BTn44.d.ts +37 -0
- package/dist/copy-button-CRiXUFsl.d.ts +17 -0
- package/dist/device-frame-BW6IjB6P.d.ts +78 -0
- package/dist/device-frame-DDWoyB-G.js +515 -0
- package/dist/diffs-BTKaVnsb.d.ts +272 -0
- package/dist/diffs.d.ts +3 -0
- package/dist/{pierre-code-view-C49BVDrc.js → diffs.js} +147 -4223
- package/dist/drop-field-C0bXv1J-.d.ts +35 -0
- package/dist/drop-field-DeIvKoJs.js +77 -0
- package/dist/editor-BsOTjnnN.d.ts +540 -0
- package/dist/{markdown-editor-D1irG9Xl.js → editor-hXea1i46.js} +833 -106
- package/dist/editor.d.ts +2 -0
- package/dist/editor.js +3 -0
- package/dist/element-BpjNQvZ0.js +6 -0
- package/dist/{file-tree-CRFIdtzw.js → file-tree-B4JKbp4r.js} +19 -18
- package/dist/{file-tree-DOtkeBaq.d.ts → file-tree-BdnKA6UA.d.ts} +33 -8
- package/dist/file-tree-DDSIafDn.d.ts +22 -0
- package/dist/file-tree-DS5shGSL.js +46 -0
- package/dist/file-tree.d.ts +2 -0
- package/dist/file-tree.js +1 -0
- package/dist/files-cuVXzWlx.js +30 -0
- package/dist/filter-search-C9e6sGij.d.ts +28 -0
- package/dist/filter-search-COZsoRiR.js +73 -0
- package/dist/formatCSSVariablePrefix-DLS1Ed1_.js +5 -0
- package/dist/headless-2IcUWHMq.d.ts +51 -0
- package/dist/headless.d.ts +7 -4
- package/dist/headless.js +5 -3
- package/dist/highlight.d.ts +2 -0
- package/dist/highlight.js +1 -0
- package/dist/{highlights-C2AbEdDI.js → highlights-8Al0-h-v.js} +3 -2
- package/dist/{hold-to-delete-BSMrpE-i.d.ts → hold-to-delete-CQc1JaG_.d.ts} +7 -0
- package/dist/{hold-to-delete-Cludb56v.js → hold-to-delete-D1Vy40w5.js} +138 -20
- package/dist/hold-to-delete-DazElJT2.js +85 -0
- package/dist/hold-to-delete-ksBE7wxc.d.ts +58 -0
- package/dist/index-CffOzibW.d.ts +77 -0
- package/dist/{index-B2cbt3py.d.ts → index-D3-uYBqH.d.ts} +1 -1
- package/dist/index.d.ts +165 -52
- package/dist/index.js +126 -670
- package/dist/markdown-BLALLOc0.d.ts +45 -0
- package/dist/{parts/components/markdown-renderer.d.ts → markdown-DkDxdpMU.d.ts} +10 -7
- package/dist/{markdown-renderer-DMyYKeil.js → markdown-_0HhbsOo.js} +125 -127
- package/dist/markdown-editor.d.ts +51 -98
- package/dist/markdown-editor.js +70 -3
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +1 -0
- package/dist/marker-CvcWZ3Zp.d.ts +59 -0
- package/dist/marker-DNL6QR3L.js +63 -0
- package/dist/message-BwivYIEl.js +13 -0
- package/dist/message-DEq4K5cQ.d.ts +72 -0
- package/dist/message-parts-B1BZFVKe.d.ts +3 -0
- package/dist/message-parts-CG3gNWn8.d.ts +11 -0
- package/dist/message-parts.d.ts +2 -0
- package/dist/message-parts.js +1 -0
- package/dist/message-scroller-D7AvM31v.d.ts +41 -0
- package/dist/motion/core.d.ts +4 -4
- package/dist/motion/core.js +5 -11
- package/dist/motion-BH6ShUam.d.ts +12 -0
- package/dist/{install-C4LwcJda.js → motion-BhARaNBB.js} +1 -1
- package/dist/{effects-C1zYpSpg.js → motion-core-JZZiPKEk.js} +1829 -120
- package/dist/{motion-core-Dh20n5Se.d.ts → motion-core-gfsTPLbh.d.ts} +35 -74
- package/dist/motion-list-9vD1hSS0.js +49 -0
- package/dist/motion.d.ts +5 -14
- package/dist/motion.js +6 -13
- package/dist/nuxt-ui-D3Qda35W.js +22 -0
- package/dist/nuxt.d.ts +9 -5
- package/dist/nuxt.js +28 -33
- package/dist/parts/components/agent-session.d.ts +2 -295
- package/dist/parts/components/agent-session.js +1 -659
- package/dist/parts/components/attachment.d.ts +2 -85
- package/dist/parts/components/attachment.js +3 -72
- package/dist/parts/components/avatar-stack.d.ts +3 -2
- package/dist/parts/components/avatar-stack.js +1 -60
- package/dist/parts/components/bubble.d.ts +2 -69
- package/dist/parts/components/bubble.js +3 -52
- package/dist/parts/components/chat-message.d.ts +3 -25
- package/dist/parts/components/chat-message.js +1 -50
- package/dist/parts/components/chat-session.d.ts +2 -26
- package/dist/parts/components/chat-session.js +1 -37
- package/dist/parts/components/chat.d.ts +3 -52
- package/dist/parts/components/chat.js +1 -105
- package/dist/parts/components/code-block.d.ts +2 -102
- package/dist/parts/components/code-block.js +4 -109
- package/dist/parts/components/code-view.d.ts +3 -268
- package/dist/parts/components/code-view.js +1 -1
- package/dist/parts/components/comment-composer.d.ts +1 -1
- package/dist/parts/components/comment-composer.js +1 -1
- package/dist/parts/components/comment-layer.d.ts +1 -1
- package/dist/parts/components/comment-layer.js +1 -634
- package/dist/parts/components/comment-panel.d.ts +2 -2
- package/dist/parts/components/comment-panel.js +22 -16
- package/dist/parts/components/comment-selection-bar.d.ts +2 -2
- package/dist/parts/components/comment-selection-bar.js +1 -116
- package/dist/parts/components/comment-thread.d.ts +1 -1
- package/dist/parts/components/comment-thread.js +1 -3
- package/dist/parts/components/comments.d.ts +8 -9
- package/dist/parts/components/comments.js +5 -9
- package/dist/parts/components/connection-status.d.ts +2 -36
- package/dist/parts/components/connection-status.js +1 -64
- package/dist/parts/components/copy-button.d.ts +3 -126
- package/dist/parts/components/copy-button.js +1 -226
- package/dist/parts/components/device-frame.d.ts +2 -128
- package/dist/parts/components/device-frame.js +1 -470
- package/dist/parts/components/drop-field.d.ts +2 -67
- package/dist/parts/components/drop-field.js +1 -76
- package/dist/parts/components/file-tree.d.ts +3 -2
- package/dist/parts/components/file-tree.js +3 -1
- package/dist/parts/components/filter-search.d.ts +2 -45
- package/dist/parts/components/filter-search.js +1 -57
- package/dist/parts/components/hold-to-delete.d.ts +2 -80
- package/dist/parts/components/hold-to-delete.js +1 -75
- package/dist/parts/components/markdown.d.ts +3 -45
- package/dist/parts/components/markdown.js +1 -46
- package/dist/parts/components/marker.d.ts +2 -32
- package/dist/parts/components/marker.js +1 -22
- package/dist/parts/components/message-parts.d.ts +3 -25
- package/dist/parts/components/message-parts.js +1 -45
- package/dist/parts/components/message.d.ts +2 -32
- package/dist/parts/components/message.js +3 -22
- package/dist/parts/components/motion-list.d.ts +2 -40
- package/dist/parts/components/motion-list.js +1 -41
- package/dist/parts/components/motion.d.ts +5 -118
- package/dist/parts/components/motion.js +5 -163
- package/dist/parts/components/patch-parsers.d.ts +1 -1
- package/dist/parts/components/progress.d.ts +2 -39
- package/dist/parts/components/progress.js +1 -53
- package/dist/parts/components/prompt-input.d.ts +2 -134
- package/dist/parts/components/prompt-input.js +1 -253
- package/dist/parts/components/relative-time.d.ts +2 -71
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/status.d.ts +2 -58
- package/dist/parts/components/status.js +1 -47
- package/dist/parts/components/sync-status.d.ts +2 -22
- package/dist/parts/components/sync-status.js +1 -48
- package/dist/parts/components/tool-list.d.ts +2 -28
- package/dist/parts/components/tool-list.js +1 -118
- package/dist/parts/components/trace-run.d.ts +2 -25
- package/dist/parts/components/trace-run.js +1 -89
- package/dist/parts/components/trace.d.ts +2 -59
- package/dist/parts/components/trace.js +1 -76
- package/dist/parts/composables/attachments.js +75 -1
- package/dist/parts/headless/choices-input.d.ts +2 -2
- package/dist/parts/headless/choices-input.js +49 -37
- package/dist/parts/headless/comments.d.ts +1 -1
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/headless/message-scroller.d.ts +2 -2
- package/dist/parts/headless/message-scroller.js +211 -309
- package/dist/parts/headless/relative-time.d.ts +2 -0
- package/dist/parts/headless/relative-time.js +1 -0
- package/dist/parts/workspace/browser-support-notice.d.ts +1 -1
- package/dist/parts/workspace/browser-support-notice.js +6 -5
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/runners/web-container.js +2 -2
- package/dist/parts/workspace/workspace-bar.d.ts +1 -1
- package/dist/parts/workspace/workspace-bar.js +1 -1
- package/dist/parts/workspace/workspace-boot-status.d.ts +1 -1
- package/dist/parts/workspace/workspace-boot-status.js +1 -206
- package/dist/parts/workspace/workspace-editor-head.d.ts +1 -1
- package/dist/parts/workspace/workspace-editor-head.js +1 -1
- package/dist/parts/workspace/workspace-editor.d.ts +2 -2
- package/dist/parts/workspace/workspace-examples.js +1 -1
- package/dist/parts/workspace/workspace-file-tree.d.ts +1 -1
- package/dist/parts/workspace/workspace-file-tree.js +3 -2
- package/dist/parts/workspace/workspace-guide.d.ts +1 -1
- package/dist/parts/workspace/workspace-guide.js +1 -1
- package/dist/parts/workspace/workspace-preview.d.ts +1 -1
- package/dist/parts/workspace/workspace-preview.js +14 -12
- package/dist/parts/workspace/workspace-shell.d.ts +1 -1
- package/dist/parts/workspace/workspace-shell.js +11 -11
- package/dist/parts/workspace/workspace-sidebar.d.ts +2 -2
- package/dist/parts/workspace/workspace-sidebar.js +2 -2
- package/dist/parts/workspace/workspace-start.d.ts +1 -1
- package/dist/parts/workspace/workspace-start.js +1 -1
- package/dist/parts/workspace/workspace-steps.js +1 -1
- package/dist/parts/workspace/workspace.d.ts +3 -3
- package/dist/parts/workspace/workspace.js +5 -5
- package/dist/press-BuEC-XvZ.d.ts +83 -0
- package/dist/progress-8P8RLYMy.js +47 -0
- package/dist/progress-Ch0fA-bf.d.ts +8 -0
- package/dist/prompt-input-CRXEJBAK.js +412 -0
- package/dist/prompt-input-j4OFTF5p.d.ts +116 -0
- package/dist/relative-time-BnJfjeEm.js +131 -0
- package/dist/relative-time-BuP-Gvzn.d.ts +43 -0
- package/dist/{relative-time-DJnw45tr.js → relative-time-Dz2DR4eb.js} +64 -114
- package/dist/relative-time-grHFu1kY.d.ts +11 -0
- package/dist/{ring-GaJsg32c.js → ring-B0nZBnU0.js} +1 -2
- package/dist/runtime/nuxt-plugin.js +2 -5
- package/dist/{shiki-CbfEu_Az.js → shiki-CxzM_xNo.js} +3 -2
- package/dist/stand-ins-CuKM1UH1.js +339 -0
- package/dist/status-B2Yhrwv8.js +67 -0
- package/dist/status-ySiRa-8O.d.ts +38 -0
- package/dist/{stream-tokenizer-ByC3l0HQ.js → stream-tokenizer-BsjV6wxW.js} +1 -1
- package/dist/styles.css +4348 -3410
- package/dist/sync-status-B29eG_n-.js +59 -0
- package/dist/sync-status-D4KdGO6y.d.ts +35 -0
- package/dist/theme.css +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/theme.js +19 -8
- package/dist/{themes-DKugPHlg.js → themes-B0_ioVT0.js} +1 -1
- package/dist/tool-list-DDaCqpR6.js +209 -0
- package/dist/tool-list-DMRPM0Yi.d.ts +50 -0
- package/dist/trace-KCBvOsw_.d.ts +113 -0
- package/dist/trace-run-Dk962P5a.d.ts +49 -0
- package/dist/trace-run-nh6FIsl6.js +202 -0
- package/dist/{opt-out-D66l60sg.js → tween-1W-LlKk9.js} +65 -2
- package/dist/types-CMU8Vmew.d.ts +71 -0
- package/dist/types-CTk3aNb5.d.ts +15 -0
- package/dist/types-D0a3i4Fw.d.ts +21 -0
- package/dist/types-DTecvcsZ.d.ts +35 -0
- package/dist/types-D_BWab7g.d.ts +75 -0
- package/dist/types-RHaQ4gj1.d.ts +27 -0
- package/dist/ui-components-CKQAPI-W.js +7 -0
- package/dist/unwrapDefault-CExq-4rm.js +5 -0
- package/dist/utils-hi9-xROt.js +37 -0
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +8 -14
- package/dist/{vue-vUGpdMct.js → vue-BdA18K5-.js} +1 -1
- package/dist/workspace-boot-status-CyGlJS06.js +216 -0
- package/dist/{workspace-shell-ChCwWPyv.d.ts → workspace-shell-B4A7CINd.d.ts} +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +1 -2
- package/package.json +46 -15
- package/dist/announce-B0DLwflT.js +0 -31
- package/dist/attachments-DgwoQZKY.js +0 -88
- package/dist/avatar-stack-C0IKwj6g.d.ts +0 -57
- package/dist/choices-input-BUf-QqGj.d.ts +0 -92
- package/dist/code-view-Cg4nyTNA.js +0 -172
- package/dist/comment-attachments-DAzUbRmJ.js +0 -23
- package/dist/comment-list-ncwaCSVX.d.ts +0 -60
- package/dist/comment-person-D_IyIjXo.js +0 -39
- package/dist/comment-pin-hBJFiSYW.d.ts +0 -66
- package/dist/comment-row-DPMWI5Z0.js +0 -38
- package/dist/comment-selection-bar-CVuS-FNL.d.ts +0 -40
- package/dist/comment-send-CUkL3TbZ.js +0 -275
- package/dist/comment-send-MmxFsOQf.d.ts +0 -23
- package/dist/comment-send.css +0 -267
- package/dist/comment-status-nsCdrRk_.js +0 -20
- package/dist/drop-field-CNZgwFVO.js +0 -162
- package/dist/editor-Dmk3k6f6.js +0 -620
- package/dist/format-CPipR1FP.js +0 -19
- package/dist/handlers-CnbkvXjX.js +0 -181
- package/dist/icon-XZaCUZTG.d.ts +0 -29
- package/dist/image-preview-BKVUtfwQ.js +0 -104
- package/dist/index-B_PSX-5h.d.ts +0 -69
- package/dist/list-DUTAo0uC.js +0 -270
- package/dist/markdown-editor-B7gD60tp.d.ts +0 -189
- package/dist/message-scroller-BZqS63IX.d.ts +0 -173
- package/dist/nuxt-ui-7ByUrymx.js +0 -43
- package/dist/parts/components/comment-list.d.ts +0 -2
- package/dist/parts/components/comment-list.js +0 -173
- package/dist/parts/components/comment-pin.d.ts +0 -2
- package/dist/parts/components/comment-pin.js +0 -74
- package/dist/parts/components/comment-send.d.ts +0 -2
- package/dist/parts/components/comment-send.js +0 -1
- package/dist/parts/components/markdown-editor.d.ts +0 -2
- package/dist/parts/components/markdown-editor.js +0 -1
- package/dist/parts/components/markdown-renderer.js +0 -1
- package/dist/payload-text-DQNRbJY5.js +0 -31
- package/dist/progress-DL9k-ERG.js +0 -265
- package/dist/registry-DAIjCjWd.js +0 -77
- package/dist/slot-part-BWHvQ3mK.js +0 -25
- package/dist/text-gacox6bp.js +0 -822
- package/dist/travel-BliEidau.js +0 -180
- package/dist/tween-Dv3IIIQG.js +0 -61
- package/dist/types-Ceh7h7NT.d.ts +0 -31
- package/dist/visual-copy-CHHBfJ6O.js +0 -14
|
@@ -1,634 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as uiErrorDiagnostics } from "../../error-diagnostics-BlgA9rI2.js";
|
|
3
|
-
import { t as useCommentAttachments } from "../../comment-attachments-DAzUbRmJ.js";
|
|
4
|
-
import { i as consumedPointerEvents } from "../../comments-context-3js2YFl2.js";
|
|
5
|
-
import { n as excerpt } from "../../comment-person-D_IyIjXo.js";
|
|
6
|
-
import { n as threadRow } from "../../comment-row-DPMWI5Z0.js";
|
|
7
|
-
import { n as deliveryAttributes, t as commentTitle } from "../../comment-status-nsCdrRk_.js";
|
|
8
|
-
import { t as createMotionList } from "../../list-DUTAo0uC.js";
|
|
9
|
-
import { t as CommentComposer } from "../../comment-composer-X7vJKh5b.js";
|
|
10
|
-
import { CommentList, CommentToolbar } from "./comment-list.js";
|
|
11
|
-
import { CommentPin } from "./comment-pin.js";
|
|
12
|
-
import { n as CommentThread } from "../../comment-thread-jqPx6aJ8.js";
|
|
13
|
-
import { computed, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, reactive, ref, shallowRef, watch } from "vue";
|
|
14
|
-
// src/components/comment-layer.ts
|
|
15
|
-
const popoverWidth = 360;
|
|
16
|
-
const popoverHeight = 420;
|
|
17
|
-
function placeDraft(point, page, width, viewport) {
|
|
18
|
-
const inset = (Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize) || 16) / 2;
|
|
19
|
-
const x = page ? (viewport - width) / 2 - inset : point.x;
|
|
20
|
-
const flipX = x > viewport / 2 && x + inset + width > viewport - inset;
|
|
21
|
-
const left = Math.max(inset, Math.min(flipX ? x - inset - width : x + inset, viewport - inset - width));
|
|
22
|
-
return {
|
|
23
|
-
x,
|
|
24
|
-
y: point.y,
|
|
25
|
-
flipX,
|
|
26
|
-
left: left - x
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const pinShape = (kind) => kind === "area" || kind === "image" ? "round" : "point";
|
|
30
|
-
const clickSlop = 6;
|
|
31
|
-
const pinSpacing = 32;
|
|
32
|
-
const minimumArea = 8;
|
|
33
|
-
const marginMinWidth = 900;
|
|
34
|
-
const marginGap = 8;
|
|
35
|
-
const marginCardHeight = 72;
|
|
36
|
-
function containerOf(box) {
|
|
37
|
-
const center = {
|
|
38
|
-
x: box.left + box.width / 2,
|
|
39
|
-
y: box.top + box.height / 2
|
|
40
|
-
};
|
|
41
|
-
const under = document.elementsFromPoint(center.x, center.y).find((element) => !element.closest("[data-comments-ui]") && !element.localName.startsWith("vitehub-") && element !== document.documentElement);
|
|
42
|
-
for (let element = under ?? null; element && element !== document.documentElement; element = element.parentElement) {
|
|
43
|
-
const rect = element.getBoundingClientRect();
|
|
44
|
-
if (rect.left <= box.left + 1 && rect.top <= box.top + 1 && rect.right >= box.left + box.width - 1 && rect.bottom >= box.top + box.height - 1) return element;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const CommentLayer = defineComponent({
|
|
48
|
-
name: "CommentLayer",
|
|
49
|
-
props: {
|
|
50
|
-
client: { type: Object },
|
|
51
|
-
subject: { type: Object },
|
|
52
|
-
user: { type: Object },
|
|
53
|
-
comments: { type: Object },
|
|
54
|
-
people: {
|
|
55
|
-
default: () => [],
|
|
56
|
-
type: Array
|
|
57
|
-
},
|
|
58
|
-
hotkey: {
|
|
59
|
-
default: "c",
|
|
60
|
-
type: [String, Boolean]
|
|
61
|
-
},
|
|
62
|
-
readOnly: {
|
|
63
|
-
default: false,
|
|
64
|
-
type: Boolean
|
|
65
|
-
},
|
|
66
|
-
subjectUrl: { type: Function },
|
|
67
|
-
navigate: { type: Function },
|
|
68
|
-
can: { type: Function },
|
|
69
|
-
upload: { type: Function },
|
|
70
|
-
queueFiles: {
|
|
71
|
-
default: false,
|
|
72
|
-
type: Boolean
|
|
73
|
-
},
|
|
74
|
-
accept: { type: String },
|
|
75
|
-
attachmentUrl: { type: Function },
|
|
76
|
-
placement: {
|
|
77
|
-
default: "pin",
|
|
78
|
-
type: String
|
|
79
|
-
},
|
|
80
|
-
size: {
|
|
81
|
-
default: "sm",
|
|
82
|
-
type: String
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
setup(props, { slots }) {
|
|
86
|
-
const { client, subject } = props;
|
|
87
|
-
if (!props.comments && (!client || !subject)) throw uiErrorDiagnostics.UI_R0002({ message: "CommentLayer needs a `client` and a `subject`, or the `comments` state from useComments()." });
|
|
88
|
-
const layer = ref(null);
|
|
89
|
-
const uiRoot = () => {
|
|
90
|
-
const node = layer.value?.getRootNode();
|
|
91
|
-
return node instanceof ShadowRoot ? node : document;
|
|
92
|
-
};
|
|
93
|
-
const state = props.comments ?? useComments({
|
|
94
|
-
client,
|
|
95
|
-
hotkey: props.hotkey,
|
|
96
|
-
subject: () => props.subject,
|
|
97
|
-
subjectUrl: props.subjectUrl,
|
|
98
|
-
uiRoot,
|
|
99
|
-
user: () => props.user
|
|
100
|
-
});
|
|
101
|
-
provideComments(state);
|
|
102
|
-
const draftFiles = ref([]);
|
|
103
|
-
const uploadingDraft = shallowRef(null);
|
|
104
|
-
watch(() => state.draft.value, (next, previous) => {
|
|
105
|
-
if (next !== previous) draftFiles.value = next?.files ? [...next.files] : [];
|
|
106
|
-
});
|
|
107
|
-
const { enabled: attachmentsOn, prepare, queued } = useCommentAttachments(state, props);
|
|
108
|
-
const user = computed(() => state.user.value);
|
|
109
|
-
const pinned = computed(() => state.threads.value.filter((thread) => state.pageThreads.value.includes(thread) || state.shown.value.has(thread.id) || state.leaving.value.has(thread.id)));
|
|
110
|
-
const drawn = computed(() => pinned.value.filter((thread) => state.shown.value.has(thread.id) || state.leaving.value.has(thread.id)));
|
|
111
|
-
let down = null;
|
|
112
|
-
const drawing = ref(null);
|
|
113
|
-
const boxFrom = (start, event) => ({
|
|
114
|
-
left: Math.min(start.x, event.clientX),
|
|
115
|
-
top: Math.min(start.y, event.clientY),
|
|
116
|
-
width: Math.abs(event.clientX - start.x),
|
|
117
|
-
height: Math.abs(event.clientY - start.y)
|
|
118
|
-
});
|
|
119
|
-
const press = (event) => {
|
|
120
|
-
drawing.value = null;
|
|
121
|
-
down = consumedPointerEvents.has(event) || event.button !== 0 ? null : {
|
|
122
|
-
x: event.clientX,
|
|
123
|
-
y: event.clientY,
|
|
124
|
-
draw: event.pointerType !== "touch"
|
|
125
|
-
};
|
|
126
|
-
if (down?.draw && event.target instanceof Element) event.target.setPointerCapture?.(event.pointerId);
|
|
127
|
-
};
|
|
128
|
-
const move = (event) => {
|
|
129
|
-
if (!down?.draw) return;
|
|
130
|
-
if (!drawing.value && Math.hypot(event.clientX - down.x, event.clientY - down.y) <= clickSlop) return;
|
|
131
|
-
drawing.value = boxFrom(down, event);
|
|
132
|
-
};
|
|
133
|
-
const release = (event) => {
|
|
134
|
-
const start = down;
|
|
135
|
-
const drawn = drawing.value;
|
|
136
|
-
down = null;
|
|
137
|
-
drawing.value = null;
|
|
138
|
-
if (!start) return;
|
|
139
|
-
if (drawn) {
|
|
140
|
-
const box = boxFrom(start, event);
|
|
141
|
-
const element = box.width >= minimumArea && box.height >= minimumArea ? containerOf(box) : void 0;
|
|
142
|
-
if (!element) return;
|
|
143
|
-
event.preventDefault();
|
|
144
|
-
try {
|
|
145
|
-
state.startDraft(element, {
|
|
146
|
-
area: box,
|
|
147
|
-
point: {
|
|
148
|
-
x: box.left,
|
|
149
|
-
y: box.top
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
} catch {}
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (Math.hypot(event.clientX - start.x, event.clientY - start.y) > clickSlop) return;
|
|
156
|
-
event.preventDefault();
|
|
157
|
-
try {
|
|
158
|
-
state.startDraft({
|
|
159
|
-
x: event.clientX,
|
|
160
|
-
y: event.clientY
|
|
161
|
-
});
|
|
162
|
-
} catch {}
|
|
163
|
-
};
|
|
164
|
-
let returnTo = null;
|
|
165
|
-
let restoring = false;
|
|
166
|
-
watch(() => state.opened.value && commentThreadKey(state.opened.value), (key) => {
|
|
167
|
-
if (key) nextTick(() => layer.value?.querySelector("[data-slot='comment-thread']:not([data-preview])")?.focus());
|
|
168
|
-
});
|
|
169
|
-
watch(() => state.openId.value, (id, previous) => {
|
|
170
|
-
if (id) return;
|
|
171
|
-
returnTo = null;
|
|
172
|
-
const active = uiRoot().activeElement;
|
|
173
|
-
const thread = layer.value?.querySelector("[data-slot='comment-thread']:not([data-preview])");
|
|
174
|
-
if (previous && (!active || active === document.body || thread?.contains(active))) returnTo = previous;
|
|
175
|
-
}, { flush: "pre" });
|
|
176
|
-
watch(() => state.openId.value, (id) => {
|
|
177
|
-
if (id || !returnTo) return;
|
|
178
|
-
const target = returnTo;
|
|
179
|
-
returnTo = null;
|
|
180
|
-
nextTick(() => {
|
|
181
|
-
const pins = layer.value?.querySelectorAll("[data-slot='comment-pin']") ?? [];
|
|
182
|
-
restoring = true;
|
|
183
|
-
([...pins].find((pin) => pin.getAttribute("data-thread-id") === target) ?? layer.value?.querySelector("[data-slot='comment-toolbar-mode']"))?.focus();
|
|
184
|
-
restoring = false;
|
|
185
|
-
});
|
|
186
|
-
}, { flush: "post" });
|
|
187
|
-
let draftReturn = null;
|
|
188
|
-
watch(() => state.draft.value, (next, previous) => {
|
|
189
|
-
if (next && !previous) {
|
|
190
|
-
const active = document.activeElement;
|
|
191
|
-
const root = uiRoot();
|
|
192
|
-
draftReturn = active instanceof HTMLElement && active !== document.body && !(root instanceof ShadowRoot && active === root.host) && !layer.value?.contains(active) ? active : null;
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
if (next || !previous) return;
|
|
196
|
-
const target = draftReturn;
|
|
197
|
-
draftReturn = null;
|
|
198
|
-
nextTick(() => {
|
|
199
|
-
const focused = uiRoot().activeElement;
|
|
200
|
-
if (target?.isConnected && (!focused || focused === document.body)) target.focus({ preventScroll: true });
|
|
201
|
-
});
|
|
202
|
-
}, { flush: "sync" });
|
|
203
|
-
const draftAboveRoom = 72;
|
|
204
|
-
const draftCard = ref(null);
|
|
205
|
-
const draftBelow = ref(false);
|
|
206
|
-
const draftWidth = ref(0);
|
|
207
|
-
const measureDraft = () => {
|
|
208
|
-
draftWidth.value = draftCard.value?.offsetWidth ?? 0;
|
|
209
|
-
};
|
|
210
|
-
watch(() => state.draft.value, (next, previous) => {
|
|
211
|
-
if (next !== previous) draftBelow.value = false;
|
|
212
|
-
});
|
|
213
|
-
const fits = typeof ResizeObserver === "function" ? new ResizeObserver(() => {
|
|
214
|
-
measureDraft();
|
|
215
|
-
const card = draftCard.value;
|
|
216
|
-
if (card?.parentElement?.hasAttribute("data-above") && card.getBoundingClientRect().top < 8) draftBelow.value = true;
|
|
217
|
-
}) : void 0;
|
|
218
|
-
watch(draftCard, (card, previous) => {
|
|
219
|
-
if (previous) fits?.unobserve(previous);
|
|
220
|
-
if (card) fits?.observe(card);
|
|
221
|
-
measureDraft();
|
|
222
|
-
});
|
|
223
|
-
onBeforeUnmount(() => fits?.disconnect());
|
|
224
|
-
const place = ({ x, y }) => ({
|
|
225
|
-
left: `${x}px`,
|
|
226
|
-
top: `${y}px`,
|
|
227
|
-
"--vh-comment-x": `${x}px`
|
|
228
|
-
});
|
|
229
|
-
const picked = reactive(/* @__PURE__ */ new Map());
|
|
230
|
-
const placedItems = /* @__PURE__ */ new Map();
|
|
231
|
-
const observedCards = /* @__PURE__ */ new Map();
|
|
232
|
-
const observeCard = (key, card) => {
|
|
233
|
-
const previous = observedCards.get(key);
|
|
234
|
-
if (previous === card) return;
|
|
235
|
-
if (previous) cardSizes?.unobserve(previous);
|
|
236
|
-
observedCards.delete(key);
|
|
237
|
-
if (card) {
|
|
238
|
-
observedCards.set(key, card);
|
|
239
|
-
cardSizes?.observe(card);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
const readSides = () => {
|
|
243
|
-
for (const [key, item] of placedItems) {
|
|
244
|
-
const card = item.querySelector(":scope > [data-slot='comment-layer-popover']");
|
|
245
|
-
const area = card ? getComputedStyle(card).getPropertyValue("position-area") : "";
|
|
246
|
-
observeCard(key, card && area && area !== "none" ? card : null);
|
|
247
|
-
if (!card || !area || area === "none") {
|
|
248
|
-
picked.delete(key);
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
const spot = item.getBoundingClientRect();
|
|
252
|
-
const box = card.getBoundingClientRect();
|
|
253
|
-
const next = {
|
|
254
|
-
x: box.left + box.right < spot.left * 2,
|
|
255
|
-
y: box.top + box.bottom < spot.top * 2
|
|
256
|
-
};
|
|
257
|
-
const now = picked.get(key);
|
|
258
|
-
if (now?.x !== next.x || now?.y !== next.y) picked.set(key, next);
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
const cardSizes = typeof ResizeObserver === "function" ? new ResizeObserver(readSides) : void 0;
|
|
262
|
-
let sideFrame = 0;
|
|
263
|
-
const readSidesSoon = () => {
|
|
264
|
-
if (!sideFrame) sideFrame = requestAnimationFrame(() => {
|
|
265
|
-
sideFrame = 0;
|
|
266
|
-
readSides();
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
onMounted(() => {
|
|
270
|
-
readSides();
|
|
271
|
-
window.addEventListener("resize", readSidesSoon, { passive: true });
|
|
272
|
-
window.visualViewport?.addEventListener("resize", readSidesSoon, { passive: true });
|
|
273
|
-
});
|
|
274
|
-
let marginList;
|
|
275
|
-
const moveMargin = () => {
|
|
276
|
-
const element = layer.value;
|
|
277
|
-
if (!element) return;
|
|
278
|
-
if (marginList) marginList.play();
|
|
279
|
-
else marginList = createMotionList(element, {
|
|
280
|
-
items: (root) => [...root.querySelectorAll("[data-margin-key]")],
|
|
281
|
-
movesOnly: true
|
|
282
|
-
});
|
|
283
|
-
marginList.measure();
|
|
284
|
-
};
|
|
285
|
-
onMounted(moveMargin);
|
|
286
|
-
onUpdated(() => {
|
|
287
|
-
readSides();
|
|
288
|
-
moveMargin();
|
|
289
|
-
});
|
|
290
|
-
onBeforeUnmount(() => {
|
|
291
|
-
marginList?.destroy();
|
|
292
|
-
cardSizes?.disconnect();
|
|
293
|
-
cancelAnimationFrame(sideFrame);
|
|
294
|
-
window.removeEventListener("resize", readSidesSoon);
|
|
295
|
-
window.visualViewport?.removeEventListener("resize", readSidesSoon);
|
|
296
|
-
});
|
|
297
|
-
const placedItem = (key) => (element) => {
|
|
298
|
-
if (element instanceof HTMLElement) placedItems.set(key, element);
|
|
299
|
-
else {
|
|
300
|
-
placedItems.delete(key);
|
|
301
|
-
observeCard(key, null);
|
|
302
|
-
picked.delete(key);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
const side = (x, y, key) => {
|
|
306
|
-
const seen = key === void 0 ? void 0 : picked.get(key);
|
|
307
|
-
const flipX = seen ? seen.x : x + popoverWidth > window.innerWidth;
|
|
308
|
-
const flipY = seen ? seen.y : y + popoverHeight > window.innerHeight;
|
|
309
|
-
return {
|
|
310
|
-
"data-flip-x": flipX ? "true" : void 0,
|
|
311
|
-
"data-flip-y": flipY ? "true" : void 0
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
const composerView = (draft) => h(CommentComposer, {
|
|
315
|
-
accept: props.accept,
|
|
316
|
-
attachments: attachmentsOn.value,
|
|
317
|
-
busy: draft.busy || uploadingDraft.value === draft,
|
|
318
|
-
error: draft.error,
|
|
319
|
-
mentions: draft.mentions,
|
|
320
|
-
modelValue: draft.body,
|
|
321
|
-
onCancel: () => state.cancelDraft(),
|
|
322
|
-
files: draftFiles.value,
|
|
323
|
-
frame: "none",
|
|
324
|
-
layout: "row",
|
|
325
|
-
onSubmit: async (submit) => {
|
|
326
|
-
if (draft.busy || uploadingDraft.value === draft || state.draft.value !== draft) return;
|
|
327
|
-
draft.error = void 0;
|
|
328
|
-
draft.mentions = submit.mentions;
|
|
329
|
-
const files = queued(submit.files);
|
|
330
|
-
if (files) {
|
|
331
|
-
draft.attachments = [];
|
|
332
|
-
await state.send({ files });
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
uploadingDraft.value = draft;
|
|
336
|
-
const submitted = draftFiles.value;
|
|
337
|
-
const body = draft.body;
|
|
338
|
-
const mentions = draft.mentions;
|
|
339
|
-
try {
|
|
340
|
-
const { attachments, files } = await prepare(submit.files);
|
|
341
|
-
if (state.draft.value !== draft || draft.body !== body || draft.mentions !== mentions || draftFiles.value !== submitted) return;
|
|
342
|
-
draft.attachments = attachments;
|
|
343
|
-
if (await state.send({ files }) && draftFiles.value === submitted) draftFiles.value = [];
|
|
344
|
-
} catch (error) {
|
|
345
|
-
draft.error = error instanceof Error ? error.message : "The files could not be uploaded. Try again.";
|
|
346
|
-
} finally {
|
|
347
|
-
if (uploadingDraft.value === draft) uploadingDraft.value = null;
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
"onUpdate:files": (value) => draftFiles.value = value,
|
|
351
|
-
"onUpdate:mentions": (value) => draft.mentions = value,
|
|
352
|
-
"onUpdate:modelValue": (value) => draft.body = value,
|
|
353
|
-
people: user.value ? [user.value] : [],
|
|
354
|
-
size: props.size,
|
|
355
|
-
user: user.value,
|
|
356
|
-
users: state.users
|
|
357
|
-
});
|
|
358
|
-
const screenWidth = ref(0);
|
|
359
|
-
const onResize = () => {
|
|
360
|
-
screenWidth.value = window.innerWidth;
|
|
361
|
-
measureDraft();
|
|
362
|
-
};
|
|
363
|
-
onMounted(() => {
|
|
364
|
-
screenWidth.value = window.innerWidth;
|
|
365
|
-
window.addEventListener("resize", onResize, { passive: true });
|
|
366
|
-
});
|
|
367
|
-
onBeforeUnmount(() => window.removeEventListener("resize", onResize));
|
|
368
|
-
const inMargin = computed(() => props.placement === "margin" && screenWidth.value >= marginMinWidth);
|
|
369
|
-
const cardHeights = reactive(/* @__PURE__ */ new Map());
|
|
370
|
-
const cards = /* @__PURE__ */ new Map();
|
|
371
|
-
const measure = typeof ResizeObserver === "function" ? new ResizeObserver((entries) => {
|
|
372
|
-
for (const entry of entries) {
|
|
373
|
-
const key = entry.target.getAttribute("data-margin-key");
|
|
374
|
-
const height = Math.round(entry.target.getBoundingClientRect().height);
|
|
375
|
-
if (key && height && cardHeights.get(key) !== height) cardHeights.set(key, height);
|
|
376
|
-
}
|
|
377
|
-
}) : void 0;
|
|
378
|
-
onBeforeUnmount(() => measure?.disconnect());
|
|
379
|
-
const measured = (key) => (element) => {
|
|
380
|
-
const before = cards.get(key);
|
|
381
|
-
if (before && before !== element) measure?.unobserve(before);
|
|
382
|
-
if (element instanceof Element) {
|
|
383
|
-
cards.set(key, element);
|
|
384
|
-
measure?.observe(element);
|
|
385
|
-
} else cards.delete(key);
|
|
386
|
-
};
|
|
387
|
-
const statusSlot = () => slots.status ? { status: slots.status } : void 0;
|
|
388
|
-
const threadSlots = () => ({
|
|
389
|
-
...statusSlot(),
|
|
390
|
-
...slots.actions ? { actions: slots.actions } : {}
|
|
391
|
-
});
|
|
392
|
-
const threadView = (thread) => h(CommentThread, {
|
|
393
|
-
accept: props.accept,
|
|
394
|
-
attachmentUrl: props.attachmentUrl,
|
|
395
|
-
attachments: attachmentsOn.value,
|
|
396
|
-
can: props.can,
|
|
397
|
-
key: commentThreadKey(thread),
|
|
398
|
-
detached: state.positions.value.get(thread.id)?.detached === true,
|
|
399
|
-
readOnly: props.readOnly,
|
|
400
|
-
size: props.size,
|
|
401
|
-
onClose: () => state.close(),
|
|
402
|
-
onDelete: (messageId) => state.remove(thread.id, messageId),
|
|
403
|
-
onEdit: (messageId, body, mentions) => state.edit(thread.id, messageId, body, mentions),
|
|
404
|
-
onReopen: () => state.reopen(thread.id),
|
|
405
|
-
onReply: async (body, mentions, list) => {
|
|
406
|
-
const { attachments, files } = await prepare(list);
|
|
407
|
-
return state.reply(thread.id, body, mentions, attachments, files);
|
|
408
|
-
},
|
|
409
|
-
onResolve: async () => {
|
|
410
|
-
await state.resolve(thread.id);
|
|
411
|
-
state.close();
|
|
412
|
-
},
|
|
413
|
-
thread,
|
|
414
|
-
user: user.value
|
|
415
|
-
}, threadSlots());
|
|
416
|
-
const marginLayout = (spots, draftY) => {
|
|
417
|
-
const entries = pinned.value.flatMap((thread) => {
|
|
418
|
-
const spot = state.shown.value.has(thread.id) ? spots.get(thread.id) : void 0;
|
|
419
|
-
return spot ? [{
|
|
420
|
-
active: state.openId.value === thread.id,
|
|
421
|
-
key: thread.id,
|
|
422
|
-
thread,
|
|
423
|
-
y: spot.y
|
|
424
|
-
}] : [];
|
|
425
|
-
});
|
|
426
|
-
if (draftY !== void 0) entries.push({
|
|
427
|
-
active: true,
|
|
428
|
-
key: draftPositionKey,
|
|
429
|
-
y: draftY
|
|
430
|
-
});
|
|
431
|
-
entries.sort((a, b) => a.y - b.y);
|
|
432
|
-
const height = (entry) => cardHeights.get(entry.key) ?? (entry.active ? popoverHeight : marginCardHeight);
|
|
433
|
-
const tops = [];
|
|
434
|
-
let below = -Infinity;
|
|
435
|
-
for (const entry of entries) {
|
|
436
|
-
const top = Math.max(entry.y - 16, below + marginGap);
|
|
437
|
-
tops.push(top);
|
|
438
|
-
below = top + height(entry);
|
|
439
|
-
}
|
|
440
|
-
const edge = window.innerHeight - 16;
|
|
441
|
-
entries.forEach((entry, index) => {
|
|
442
|
-
if (!entry.active || tops[index] + height(entry) <= edge) return;
|
|
443
|
-
tops[index] = Math.max(16, edge - height(entry));
|
|
444
|
-
for (let before = index - 1; before >= 0; before--) tops[before] = Math.min(tops[before], tops[before + 1] - marginGap - height(entries[before]));
|
|
445
|
-
for (let after = index + 1; after < entries.length; after++) tops[after] = Math.max(tops[after], tops[after - 1] + marginGap + height(entries[after - 1]));
|
|
446
|
-
});
|
|
447
|
-
const at = new Map(entries.map((entry, index) => [entry.key, tops[index]]));
|
|
448
|
-
const cards = entries.flatMap((entry, index) => {
|
|
449
|
-
const thread = entry.thread;
|
|
450
|
-
if (!thread || entry.active) return [];
|
|
451
|
-
return [h("button", {
|
|
452
|
-
"aria-label": `${commentTitle(thread)}: ${excerpt(thread.messages[0]?.body ?? "")}`,
|
|
453
|
-
"data-margin-key": entry.key,
|
|
454
|
-
"data-slot": "comment-margin-card",
|
|
455
|
-
"data-status": thread.status,
|
|
456
|
-
...deliveryAttributes(thread.delivery),
|
|
457
|
-
key: entry.key,
|
|
458
|
-
onClick: () => state.open(thread),
|
|
459
|
-
onPointerenter: () => {
|
|
460
|
-
if (!state.draft.value) state.hoverId.value = thread.id;
|
|
461
|
-
},
|
|
462
|
-
onPointerleave: () => {
|
|
463
|
-
if (state.hoverId.value === thread.id) state.hoverId.value = null;
|
|
464
|
-
},
|
|
465
|
-
ref: measured(entry.key),
|
|
466
|
-
style: { top: `${tops[index]}px` },
|
|
467
|
-
type: "button"
|
|
468
|
-
}, threadRow(thread))];
|
|
469
|
-
});
|
|
470
|
-
return {
|
|
471
|
-
at,
|
|
472
|
-
node: h("div", { "data-slot": "comment-margin" }, cards)
|
|
473
|
-
};
|
|
474
|
-
};
|
|
475
|
-
return () => {
|
|
476
|
-
const spots = /* @__PURE__ */ new Map();
|
|
477
|
-
for (const thread of drawn.value) {
|
|
478
|
-
const position = state.positions.value.get(thread.id);
|
|
479
|
-
if (!position || position.detached || position.clipped || thread.anchor.kind === "page") continue;
|
|
480
|
-
const taken = (y) => [...spots.values()].some((spot) => Math.abs(spot.x - position.x) < pinSpacing && Math.abs(spot.y - y) < pinSpacing);
|
|
481
|
-
let y = position.y;
|
|
482
|
-
while (taken(y)) y += pinSpacing;
|
|
483
|
-
if (y !== position.y && y > window.innerHeight - pinSpacing) {
|
|
484
|
-
y = position.y - pinSpacing;
|
|
485
|
-
while (taken(y)) y -= pinSpacing;
|
|
486
|
-
}
|
|
487
|
-
spots.set(thread.id, {
|
|
488
|
-
...position,
|
|
489
|
-
y
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
const items = drawn.value.flatMap((thread) => {
|
|
493
|
-
const position = spots.get(thread.id);
|
|
494
|
-
if (!position) return [];
|
|
495
|
-
const leaving = !state.shown.value.has(thread.id);
|
|
496
|
-
const open = state.openId.value === thread.id;
|
|
497
|
-
const hover = state.hoverId.value === thread.id && !leaving && !open && !state.draft.value && !inMargin.value;
|
|
498
|
-
return [h("div", {
|
|
499
|
-
...side(position.x, position.y, thread.id),
|
|
500
|
-
"data-kind": thread.anchor.kind,
|
|
501
|
-
"data-leaving": leaving ? "true" : void 0,
|
|
502
|
-
"data-slot": "comment-layer-item",
|
|
503
|
-
inert: leaving || void 0,
|
|
504
|
-
key: thread.id,
|
|
505
|
-
ref: placedItem(thread.id),
|
|
506
|
-
style: place(position)
|
|
507
|
-
}, [h(CommentPin, {
|
|
508
|
-
active: open,
|
|
509
|
-
author: thread.author,
|
|
510
|
-
"data-shape": pinShape(thread.anchor.kind),
|
|
511
|
-
"data-thread-id": thread.id,
|
|
512
|
-
...deliveryAttributes(thread.delivery),
|
|
513
|
-
excerpt: excerpt(thread.messages[0]?.body ?? ""),
|
|
514
|
-
...thread.n ? { n: thread.n } : {},
|
|
515
|
-
onHover: () => {
|
|
516
|
-
if (!open && !restoring && !state.draft.value) state.hoverId.value = thread.id;
|
|
517
|
-
},
|
|
518
|
-
onLeave: () => {
|
|
519
|
-
if (state.hoverId.value === thread.id) state.hoverId.value = null;
|
|
520
|
-
},
|
|
521
|
-
onSelect: () => open ? state.close() : state.open(thread),
|
|
522
|
-
status: thread.status
|
|
523
|
-
}), hover ? h("div", {
|
|
524
|
-
"data-preview": "true",
|
|
525
|
-
"data-slot": "comment-layer-popover"
|
|
526
|
-
}, h(CommentThread, {
|
|
527
|
-
preview: true,
|
|
528
|
-
size: props.size,
|
|
529
|
-
thread
|
|
530
|
-
}, statusSlot())) : null])];
|
|
531
|
-
});
|
|
532
|
-
const draft = state.draft.value;
|
|
533
|
-
const draftPosition = draft && state.positions.value.get("draft");
|
|
534
|
-
const point = draftPosition && !draftPosition.detached && draft?.anchor.kind !== "page" ? draftPosition : draft?.point;
|
|
535
|
-
const draftInMargin = Boolean(inMargin.value && draft && point && draft.anchor.kind !== "page");
|
|
536
|
-
const margin = inMargin.value ? marginLayout(spots, draftInMargin ? point.y : void 0) : null;
|
|
537
|
-
const inColumn = (key) => {
|
|
538
|
-
const top = margin?.at.get(key);
|
|
539
|
-
return top === void 0 ? void 0 : {
|
|
540
|
-
"data-margin": "true",
|
|
541
|
-
"data-margin-key": key,
|
|
542
|
-
style: { top: `${top}px` }
|
|
543
|
-
};
|
|
544
|
-
};
|
|
545
|
-
const opened = state.opened.value;
|
|
546
|
-
const openedPosition = opened && state.positions.value.get(opened.id);
|
|
547
|
-
const pointForThread = openedPosition && !openedPosition.detached && !openedPosition.clipped && opened?.anchor.kind !== "page" ? spots.get(opened.id) ?? openedPosition : void 0;
|
|
548
|
-
const openedColumn = opened && pointForThread ? inColumn(opened.id) : void 0;
|
|
549
|
-
const openThread = opened ? h("div", {
|
|
550
|
-
...pointForThread ? side(pointForThread.x, pointForThread.y, "opened-thread") : {},
|
|
551
|
-
"data-kind": opened.anchor.kind,
|
|
552
|
-
"data-slot": "comment-layer-item",
|
|
553
|
-
key: "opened-thread",
|
|
554
|
-
ref: placedItem("opened-thread"),
|
|
555
|
-
style: pointForThread ? place(pointForThread) : void 0
|
|
556
|
-
}, h("div", {
|
|
557
|
-
...openedColumn,
|
|
558
|
-
"data-floating": pointForThread ? void 0 : "true",
|
|
559
|
-
"data-slot": "comment-layer-popover",
|
|
560
|
-
ref: (element) => openedColumn && measured(opened.id)(element)
|
|
561
|
-
}, threadView(opened))) : null;
|
|
562
|
-
const placement = draft && point ? placeDraft(point, draft.anchor.kind === "page", draftWidth.value, screenWidth.value) : void 0;
|
|
563
|
-
const draftColumn = draftInMargin ? inColumn(draftPositionKey) : void 0;
|
|
564
|
-
const composing = draft && placement ? h("div", {
|
|
565
|
-
...side(placement.x, placement.y),
|
|
566
|
-
"data-flip-x": placement.flipX ? "true" : void 0,
|
|
567
|
-
...(draft.anchor.kind === "area" || draft.anchor.kind === "image") && placement.y > draftAboveRoom && !draftBelow.value ? { "data-above": "true" } : {},
|
|
568
|
-
"data-draft": "true",
|
|
569
|
-
"data-kind": draft.anchor.kind,
|
|
570
|
-
"data-slot": "comment-layer-item",
|
|
571
|
-
style: place(placement)
|
|
572
|
-
}, [h(CommentPin, {
|
|
573
|
-
author: user.value,
|
|
574
|
-
"data-shape": pinShape(draft.anchor.kind),
|
|
575
|
-
draft: true
|
|
576
|
-
}), h("div", {
|
|
577
|
-
...draftColumn,
|
|
578
|
-
"data-motion-appear": draftColumn ? void 0 : "[data-slot=comment-pin]",
|
|
579
|
-
"data-slot": "comment-layer-popover",
|
|
580
|
-
style: draftColumn?.style ?? { "--vh-comment-draft-left": `${placement.left}px` },
|
|
581
|
-
ref: (element) => {
|
|
582
|
-
draftCard.value = element instanceof HTMLElement ? element : null;
|
|
583
|
-
if (draftColumn) measured(draftPositionKey)(element);
|
|
584
|
-
}
|
|
585
|
-
}, composerView(draft))]) : null;
|
|
586
|
-
return h("div", {
|
|
587
|
-
"data-active": state.active.value ? "true" : void 0,
|
|
588
|
-
"data-comments-ui": "",
|
|
589
|
-
"data-slot": "comment-layer",
|
|
590
|
-
ref: layer
|
|
591
|
-
}, [
|
|
592
|
-
state.active.value ? h("div", {
|
|
593
|
-
"data-slot": "comment-layer-overlay",
|
|
594
|
-
onPointercancel: () => {
|
|
595
|
-
down = null;
|
|
596
|
-
drawing.value = null;
|
|
597
|
-
},
|
|
598
|
-
onPointerdown: press,
|
|
599
|
-
onPointermove: move,
|
|
600
|
-
onPointerup: release
|
|
601
|
-
}, drawing.value ? [h("div", {
|
|
602
|
-
"data-slot": "comment-layer-area",
|
|
603
|
-
style: {
|
|
604
|
-
left: `${drawing.value.left}px`,
|
|
605
|
-
top: `${drawing.value.top}px`,
|
|
606
|
-
width: `${drawing.value.width}px`,
|
|
607
|
-
height: `${drawing.value.height}px`
|
|
608
|
-
}
|
|
609
|
-
}, [...[
|
|
610
|
-
"top-left",
|
|
611
|
-
"top-right",
|
|
612
|
-
"bottom-left",
|
|
613
|
-
"bottom-right"
|
|
614
|
-
].map((corner) => h("span", {
|
|
615
|
-
"data-corner": corner,
|
|
616
|
-
"data-slot": "comment-layer-area-handle",
|
|
617
|
-
key: corner
|
|
618
|
-
})), h("span", { "data-slot": "comment-layer-area-size" }, `${Math.round(drawing.value.width)} × ${Math.round(drawing.value.height)}`)])] : []) : null,
|
|
619
|
-
...items,
|
|
620
|
-
composing,
|
|
621
|
-
openThread,
|
|
622
|
-
margin?.node,
|
|
623
|
-
slots.default?.({ comments: state }) ?? [h(CommentToolbar, {
|
|
624
|
-
comments: state,
|
|
625
|
-
people: props.people
|
|
626
|
-
}), state.listOpen.value ? h(CommentList, {
|
|
627
|
-
comments: state,
|
|
628
|
-
navigate: props.navigate
|
|
629
|
-
}) : null]
|
|
630
|
-
]);
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
});
|
|
634
|
-
export { CommentLayer };
|
|
1
|
+
export { t as CommentLayer } from "../../comment-layer-Ci6ipGi2.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CommentPanelVariant,
|
|
2
|
-
export { CommentGroup, CommentGroupSlotScope, CommentPanel, CommentPanelSlots, CommentPanelVariant,
|
|
1
|
+
import { a as CommentPanelVariant, i as CommentPanelSlots, n as CommentGroupSlotScope, o as CommentUpload, r as CommentPanel, t as CommentGroup } from "../../comment-panel-DxN21VoY.js";
|
|
2
|
+
export { CommentGroup, CommentGroupSlotScope, CommentPanel, CommentPanelSlots, CommentPanelVariant, CommentUpload };
|