@vite-hub/ui 0.3.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.
- package/README.md +107 -81
- package/dist/announce-Cy_Tn9wW.js +32 -0
- package/dist/{code-view-D0bqhogi.js → code-view-DsU-xzic.js} +4 -4
- package/dist/comment-attachments-C4yNbcx5.js +20 -0
- package/dist/{comment-composer-jYv2ULNP.js → comment-composer-D7ZytyER.js} +257 -10
- package/dist/{comment-composer-Cc8Jvu6u.d.ts → comment-composer-DvKMTrAi.d.ts} +1 -1
- package/dist/{comment-layer-ClH4MLj4.d.ts → comment-layer-GTsLdABl.d.ts} +17 -6
- package/dist/{comment-list-B8hphLfS.d.ts → comment-list-BI96empx.d.ts} +2 -2
- package/dist/comment-marks.css +18 -22
- package/dist/{comment-panel-fcKSKwLC.d.ts → comment-panel-CsKWTms_.d.ts} +15 -4
- package/dist/{comment-row-Bbm9WwuF.js → comment-row-JmTC0uXr.js} +2 -2
- package/dist/comment-selection-bar-CyVBNYl9.d.ts +42 -0
- package/dist/comment-send-7bg4NEEM.js +277 -0
- package/dist/comment-send-C45dHC22.d.ts +25 -0
- package/dist/comment-send.css +267 -0
- package/dist/comment-thread-B_Sc2QX6.js +797 -0
- package/dist/{comment-thread-CoTLrdal.d.ts → comment-thread-C6U-bsK_.d.ts} +23 -6
- package/dist/{comments-CkWc2Khc.js → comments-B88zg9gC.js} +66 -10
- package/dist/{comments-Bx2WRsYy.d.ts → comments-D8hulVPy.d.ts} +34 -6
- package/dist/{comments-context-C2lOZyQ5.js → comments-context-DhbIdYQ1.js} +2 -1
- package/dist/{config-Dk67emQt.js → config-B1u7zqMB.js} +8 -1
- package/dist/{config-DgxBW013.d.ts → config-pHazYdq6.d.ts} +11 -0
- package/dist/drop-field-3CDRFFRm.js +163 -0
- package/dist/{editor-C_wt4RRV.js → editor-BHYGLgty.js} +42 -3
- package/dist/effects-Ql6VzCRa.js +2971 -0
- package/dist/format-orwcdZL_.js +39 -0
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/hold-to-delete-DjWzRDyY.d.ts +51 -0
- package/dist/hold-to-delete-ROLQRZg_.js +434 -0
- package/dist/icon-c5Jb_Tl7.d.ts +31 -0
- package/dist/{image-preview-C9tdkmEj.js → image-preview-BigoAvb3.js} +2 -2
- package/dist/{index-BD1e8vx5.d.ts → index-YUvL2nV8.d.ts} +10 -6
- package/dist/index.d.ts +18 -12
- package/dist/index.js +47 -45
- package/dist/install-D5f6msEU.js +17 -0
- package/dist/list-RCbNZ14q.js +271 -0
- package/dist/{markdown-editor-CMbNZOdN.js → markdown-editor-Dfl2DgPS.js} +1 -1
- package/dist/{markdown-editor-DqdZfIEn.d.ts → markdown-editor-wQF0yD5o.d.ts} +1 -1
- package/dist/markdown-editor.d.ts +1 -1
- package/dist/markdown-editor.js +1 -1
- package/dist/motion/core.d.ts +4 -0
- package/dist/motion/core.js +11 -0
- package/dist/motion-core-lHRF8PZz.d.ts +456 -0
- package/dist/motion.d.ts +16 -0
- package/dist/motion.js +13 -0
- package/dist/{nuxt-ui-DSQFzq3s.js → nuxt-ui-CgvMzO5v.js} +20 -14
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +20 -5
- package/dist/opt-out-b6bnUjIT.js +208 -0
- package/dist/parts/components/agent-session.js +1 -1
- package/dist/parts/components/attachment.js +1 -1
- package/dist/parts/components/avatar-stack.js +3 -2
- package/dist/parts/components/chat-session.d.ts +1 -1
- package/dist/parts/components/chat.js +2 -2
- package/dist/parts/components/code-block.js +1 -1
- 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 +54 -23
- package/dist/parts/components/comment-list.d.ts +1 -1
- package/dist/parts/components/comment-list.js +13 -7
- package/dist/parts/components/comment-panel.d.ts +1 -1
- package/dist/parts/components/comment-panel.js +46 -20
- package/dist/parts/components/comment-pin.js +1 -1
- package/dist/parts/components/comment-selection-bar.d.ts +2 -0
- package/dist/parts/components/comment-selection-bar.js +117 -0
- package/dist/parts/components/comment-send.d.ts +2 -0
- package/dist/parts/components/comment-send.js +2 -0
- package/dist/parts/components/comment-thread.d.ts +2 -2
- package/dist/parts/components/comment-thread.js +2 -570
- package/dist/parts/components/comments.d.ts +8 -6
- package/dist/parts/components/comments.js +6 -4
- package/dist/parts/components/copy-button.d.ts +12 -2
- package/dist/parts/components/copy-button.js +226 -1
- package/dist/parts/components/drop-field.d.ts +69 -0
- package/dist/parts/components/drop-field.js +77 -0
- package/dist/parts/components/filter-search.js +1 -1
- package/dist/parts/components/hold-to-delete.d.ts +82 -0
- package/dist/parts/components/hold-to-delete.js +76 -0
- package/dist/parts/components/markdown-editor.d.ts +1 -1
- package/dist/parts/components/markdown-editor.js +1 -1
- package/dist/parts/components/markdown-renderer.js +1 -1
- package/dist/parts/components/markdown.js +1 -1
- package/dist/parts/components/message-parts.js +13 -5
- package/dist/parts/components/motion-list.d.ts +42 -0
- package/dist/parts/components/motion-list.js +42 -0
- package/dist/parts/components/motion.d.ts +124 -0
- package/dist/parts/components/motion.js +172 -0
- package/dist/parts/components/progress.d.ts +41 -0
- package/dist/parts/components/progress.js +54 -0
- package/dist/parts/components/prompt-input.d.ts +3 -3
- package/dist/parts/components/prompt-input.js +3 -3
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/sync-status.js +2 -1
- package/dist/parts/components/tool-list.d.ts +1 -1
- package/dist/parts/components/trace-run.d.ts +1 -1
- package/dist/parts/components/trace-run.js +2 -2
- package/dist/parts/headless/comments.d.ts +2 -2
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/playground/share.d.ts +36 -2
- package/dist/parts/workspace/browser-support-notice.js +12 -4
- package/dist/parts/workspace/codemirror.d.ts +9 -0
- package/dist/parts/workspace/codemirror.js +37 -4
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/file-icons.d.ts +16 -0
- package/dist/parts/workspace/file-icons.js +82 -0
- package/dist/parts/workspace/icons.d.ts +1 -0
- package/dist/parts/workspace/icons.js +1 -0
- package/dist/parts/workspace/runners/render.d.ts +26 -0
- package/dist/parts/workspace/runners/render.js +124 -0
- package/dist/parts/workspace/runners/web-container.d.ts +29 -0
- package/dist/parts/workspace/runners/web-container.js +186 -0
- package/dist/parts/workspace/workspace-bar.d.ts +51 -0
- package/dist/parts/workspace/workspace-bar.js +51 -0
- package/dist/parts/workspace/workspace-boot-status.js +1 -1
- package/dist/parts/workspace/workspace-editor-head.d.ts +47 -0
- package/dist/parts/workspace/workspace-editor-head.js +66 -0
- package/dist/parts/workspace/workspace-editor.d.ts +17 -0
- package/dist/parts/workspace/workspace-editor.js +29 -3
- package/dist/parts/workspace/workspace-examples.d.ts +74 -0
- package/dist/parts/workspace/workspace-examples.js +72 -0
- package/dist/parts/workspace/workspace-file-link.d.ts +35 -0
- package/dist/parts/workspace/workspace-file-link.js +39 -0
- package/dist/parts/workspace/workspace-file-tree.d.ts +8 -8
- package/dist/parts/workspace/workspace-file-tree.js +26 -19
- package/dist/parts/workspace/workspace-guide.d.ts +52 -0
- package/dist/parts/workspace/workspace-guide.js +91 -0
- package/dist/parts/workspace/workspace-issues.d.ts +46 -0
- package/dist/parts/workspace/workspace-issues.js +49 -0
- package/dist/parts/workspace/workspace-preview.js +1 -1
- package/dist/parts/workspace/workspace-shell.d.ts +2 -88
- package/dist/parts/workspace/workspace-shell.js +131 -78
- package/dist/parts/workspace/workspace-sidebar.d.ts +75 -0
- package/dist/parts/workspace/workspace-sidebar.js +132 -0
- package/dist/parts/workspace/workspace-start.d.ts +47 -0
- package/dist/parts/workspace/workspace-start.js +60 -0
- package/dist/parts/workspace/workspace-status.d.ts +69 -0
- package/dist/parts/workspace/workspace-status.js +74 -0
- package/dist/parts/workspace/workspace-steps.d.ts +2 -0
- package/dist/parts/workspace/workspace-steps.js +128 -0
- package/dist/parts/workspace/workspace-task.d.ts +20 -0
- package/dist/parts/workspace/workspace-task.js +20 -0
- package/dist/parts/workspace/workspace.d.ts +251 -0
- package/dist/parts/workspace/workspace.js +665 -0
- package/dist/{pierre-code-view-xgBL6DO7.js → pierre-code-view-NE35tkmR.js} +37 -17
- package/dist/playground.d.ts +1 -1
- package/dist/progress-C7afI5vq.js +266 -0
- package/dist/registry-D3-ysX7l.js +78 -0
- package/dist/{relative-time-BVmjOsYG.js → relative-time-DgSS3zKN.js} +1 -1
- package/dist/ring-B7Qxu7zd.js +175 -0
- package/dist/runtime/nuxt-plugin.js +2 -2
- package/dist/styles.css +657 -526
- package/dist/text-BCJflBJf.js +826 -0
- package/dist/theme.d.ts +43 -0
- package/dist/theme.js +22 -7
- package/dist/travel-C87xd5Wh.js +182 -0
- package/dist/tween-CO24nMpf.js +62 -0
- package/dist/{types-Dyr6CfBW.d.ts → types-BX64qHlV.d.ts} +1 -1
- package/dist/visual-copy-CrVc3z4n.js +15 -0
- package/dist/workspace-shell-BJGnoF3p.d.ts +112 -0
- package/dist/workspace-steps-Bgph2rpr.d.ts +72 -0
- package/dist/workspace.d.ts +17 -4
- package/dist/workspace.js +16 -3
- package/package.json +22 -11
- package/dist/copy-button-CRN3kmSD.js +0 -253
- package/dist/format-Du58PlsG.js +0 -18
- package/dist/icon-swap.css +0 -69
- package/dist/parts/playground/highlight.d.ts +0 -5
- package/dist/parts/playground/highlight.js +0 -23
- package/dist/parts/playground/playground-render.d.ts +0 -126
- package/dist/parts/playground/playground-render.js +0 -356
- package/dist/parts/workspace/playground-container.d.ts +0 -192
- package/dist/parts/workspace/playground-container.js +0 -603
- package/dist/share-DM4eNy4q.d.ts +0 -37
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { r as useUIComponent } from "../../nuxt-ui-
|
|
2
|
-
import {
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-CgvMzO5v.js";
|
|
2
|
+
import { RollNumber } from "./motion.js";
|
|
3
|
+
import { a as useViteHubUIIcons } from "../../config-B1u7zqMB.js";
|
|
3
4
|
import { AvatarStack } from "./avatar-stack.js";
|
|
4
|
-
import { a as useCommentsContext } from "../../comments-
|
|
5
|
-
import { n as threadRow, t as rowSlotScope } from "../../comment-row-
|
|
5
|
+
import { a as useCommentsContext, s as deliveryAttributes } from "../../comments-B88zg9gC.js";
|
|
6
|
+
import { n as threadRow, t as rowSlotScope } from "../../comment-row-JmTC0uXr.js";
|
|
7
|
+
import { MotionList } from "./motion-list.js";
|
|
6
8
|
import { defineComponent, h } from "vue";
|
|
7
9
|
//#region src/components/comment-list.ts
|
|
8
10
|
const commentsProp = { type: Object };
|
|
@@ -19,11 +21,11 @@ const CommentFilters = defineComponent({
|
|
|
19
21
|
"data-slot": "comment-filter",
|
|
20
22
|
"data-state": comments.filters[key] ? "on" : "off",
|
|
21
23
|
key,
|
|
22
|
-
label: count === void 0 ? label :
|
|
24
|
+
label: count === void 0 ? label : void 0,
|
|
23
25
|
onClick: () => comments.filters[key] = !comments.filters[key],
|
|
24
26
|
size: "xs",
|
|
25
27
|
variant: comments.filters[key] ? "soft" : "ghost"
|
|
26
|
-
});
|
|
28
|
+
}, count === void 0 ? void 0 : { default: () => [`${label} `, h(RollNumber, { value: count })] });
|
|
27
29
|
return h("div", {
|
|
28
30
|
"aria-label": "Filter comments",
|
|
29
31
|
"data-slot": "comment-filters",
|
|
@@ -77,7 +79,10 @@ const CommentList = defineComponent({
|
|
|
77
79
|
}, [scopeButton("page", "This page"), scopeButton("site", "All pages")]), h(CommentFilters, { comments })]), rows.length === 0 ? h("p", {
|
|
78
80
|
"data-slot": "comment-list-empty",
|
|
79
81
|
role: "status"
|
|
80
|
-
}, comments.status.value === "loading" && comments.threads.value.length === 0 ? "Loading comments." : comments.status.value === "error" ? "The comments could not load." : "No comments here.") : h(
|
|
82
|
+
}, comments.status.value === "loading" && comments.threads.value.length === 0 ? "Loading comments." : comments.status.value === "error" ? "The comments could not load." : "No comments here.") : h(MotionList, {
|
|
83
|
+
"data-slot": "comment-list-items",
|
|
84
|
+
tag: "ol"
|
|
85
|
+
}, () => rows.map((thread) => {
|
|
81
86
|
const detached = comments.positions.value.get(thread.id)?.detached === true;
|
|
82
87
|
return h("li", { key: thread.id }, [h("a", {
|
|
83
88
|
"aria-current": comments.openId.value === thread.id ? "true" : void 0,
|
|
@@ -85,6 +90,7 @@ const CommentList = defineComponent({
|
|
|
85
90
|
"data-focus-inset": "",
|
|
86
91
|
"data-slot": "comment-list-item",
|
|
87
92
|
"data-status": thread.status,
|
|
93
|
+
...deliveryAttributes(thread.delivery),
|
|
88
94
|
href: comments.link(thread),
|
|
89
95
|
onClick: (event) => select(thread, event)
|
|
90
96
|
}, slots.row?.(rowSlotScope(thread)) ?? threadRow(thread, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CommentPanelVariant, c as CommentUpload, i as CommentPanelSlots, n as CommentGroupSlotScope, o as CommentRowSlotScope, r as CommentPanel, s as CommentRowSlots, t as CommentGroup } from "../../comment-panel-
|
|
1
|
+
import { a as CommentPanelVariant, c as CommentUpload, i as CommentPanelSlots, n as CommentGroupSlotScope, o as CommentRowSlotScope, r as CommentPanel, s as CommentRowSlots, t as CommentGroup } from "../../comment-panel-CsKWTms_.js";
|
|
2
2
|
export { CommentGroup, CommentGroupSlotScope, CommentPanel, CommentPanelSlots, CommentPanelVariant, CommentRowSlotScope, CommentRowSlots, CommentUpload };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { r as useUIComponent } from "../../nuxt-ui-
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-CgvMzO5v.js";
|
|
2
|
+
import { RollNumber } from "./motion.js";
|
|
2
3
|
import { t as uiErrorDiagnostics } from "../../error-diagnostics-SXtnk6bz.js";
|
|
3
|
-
import { n as injectComments } from "../../comments-context-
|
|
4
|
-
import { t as CommentComposer } from "../../comment-composer-
|
|
5
|
-
import { a as useCommentsContext, i as useComments, r as provideComments, s as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { n as injectComments } from "../../comments-context-DhbIdYQ1.js";
|
|
5
|
+
import { t as CommentComposer } from "../../comment-composer-D7ZytyER.js";
|
|
6
|
+
import { a as useCommentsContext, d as useSelectedComment, i as useComments, l as repliedSinceResolved, o as commentTitle, r as provideComments, s as deliveryAttributes, u as commentThreadKey } from "../../comments-B88zg9gC.js";
|
|
7
|
+
import { t as useCommentAttachments } from "../../comment-attachments-C4yNbcx5.js";
|
|
8
|
+
import { n as threadRow, t as rowSlotScope } from "../../comment-row-JmTC0uXr.js";
|
|
9
|
+
import { n as CommentThread } from "../../comment-thread-B_Sc2QX6.js";
|
|
8
10
|
import { computed, defineComponent, h, nextTick, ref, watch } from "vue";
|
|
9
11
|
//#region src/components/comment-panel.ts
|
|
10
12
|
const listSlots = /* @__PURE__ */ new Set([
|
|
@@ -50,8 +52,13 @@ const CommentPanel = defineComponent({
|
|
|
50
52
|
default: false,
|
|
51
53
|
type: Boolean
|
|
52
54
|
},
|
|
53
|
-
/** Turns attached files into attachment keys
|
|
55
|
+
/** Turns attached files into attachment keys before the comment is saved or sent. */
|
|
54
56
|
upload: { type: Function },
|
|
57
|
+
/** Save raw files with outbox entries. Set only when the server accepts file uploads. `upload` takes precedence. */
|
|
58
|
+
queueFiles: {
|
|
59
|
+
default: false,
|
|
60
|
+
type: Boolean
|
|
61
|
+
},
|
|
55
62
|
/** The file types that the boxes take, such as `image/*`. */
|
|
56
63
|
accept: { type: String },
|
|
57
64
|
/** Gives the URL of an attachment key. With it, image attachments show as thumbnails. */
|
|
@@ -98,13 +105,16 @@ const CommentPanel = defineComponent({
|
|
|
98
105
|
const status = computed(() => props.status ?? localStatus.value);
|
|
99
106
|
const scoped = computed(() => state.threads.value.filter((thread) => state.scope.value === "site" || sameSubject(thread.subject, state.subject.value)));
|
|
100
107
|
const rows = computed(() => scoped.value.filter((thread) => thread.status === status.value || status.value === "open" && repliedSinceResolved(thread)));
|
|
101
|
-
const opened =
|
|
108
|
+
const opened = useSelectedComment(state.threads, threadId);
|
|
102
109
|
watch(opened, (thread, _previous, onCleanup) => {
|
|
103
110
|
if (thread) onCleanup(state.retainMark(thread.id));
|
|
104
111
|
}, {
|
|
105
112
|
immediate: true,
|
|
106
113
|
flush: "sync"
|
|
107
114
|
});
|
|
115
|
+
watch(opened, (thread) => {
|
|
116
|
+
if (thread && thread.id !== threadId.value) setThread(thread.id);
|
|
117
|
+
});
|
|
108
118
|
const body = ref("");
|
|
109
119
|
const mentions = ref([]);
|
|
110
120
|
const files = ref([]);
|
|
@@ -124,14 +134,13 @@ const CommentPanel = defineComponent({
|
|
|
124
134
|
nextTick(() => root.value?.querySelector("[data-slot='comment-thread']")?.focus());
|
|
125
135
|
}
|
|
126
136
|
function back() {
|
|
127
|
-
const id =
|
|
137
|
+
const id = opened.value?.id;
|
|
128
138
|
setThread(null);
|
|
129
139
|
nextTick(() => {
|
|
130
140
|
[...root.value?.querySelectorAll("[data-slot='comment-panel-item']") ?? []].find((row) => row.dataset.threadId === id)?.focus();
|
|
131
141
|
});
|
|
132
142
|
}
|
|
133
|
-
const
|
|
134
|
-
const keys = async (list) => attachmentsOn.value && list.length > 0 && props.upload ? props.upload(list) : [];
|
|
143
|
+
const { enabled: attachmentsOn, prepare } = useCommentAttachments(state, props);
|
|
135
144
|
const subjectKey = () => `${state.subject.value.kind}\u0000${state.subject.value.id}`;
|
|
136
145
|
let sending = 0;
|
|
137
146
|
watch(subjectKey, () => {
|
|
@@ -153,10 +162,10 @@ const CommentPanel = defineComponent({
|
|
|
153
162
|
mentions: mentions.value
|
|
154
163
|
};
|
|
155
164
|
try {
|
|
156
|
-
const
|
|
165
|
+
const attached = await prepare(submit.files);
|
|
157
166
|
if (run !== sending) return;
|
|
158
167
|
await state.create({
|
|
159
|
-
|
|
168
|
+
...attached,
|
|
160
169
|
body: submit.body,
|
|
161
170
|
mentions: submit.mentions
|
|
162
171
|
});
|
|
@@ -189,6 +198,7 @@ const CommentPanel = defineComponent({
|
|
|
189
198
|
"data-focus-inset": "",
|
|
190
199
|
"data-slot": "comment-panel-item",
|
|
191
200
|
"data-status": thread.status,
|
|
201
|
+
...deliveryAttributes(thread.delivery),
|
|
192
202
|
"data-thread-id": thread.id,
|
|
193
203
|
onClick: () => select(thread),
|
|
194
204
|
type: "button"
|
|
@@ -213,15 +223,28 @@ const CommentPanel = defineComponent({
|
|
|
213
223
|
const list = () => {
|
|
214
224
|
const counts = state.counts.value;
|
|
215
225
|
const filter = (value, label, count) => h(UButton, {
|
|
216
|
-
"aria-
|
|
226
|
+
"aria-checked": String(status.value === value),
|
|
217
227
|
color: "neutral",
|
|
218
228
|
"data-slot": "comment-panel-filter",
|
|
219
229
|
"data-state": status.value === value ? "on" : "off",
|
|
220
|
-
label: `${label} ${count}`,
|
|
221
230
|
onClick: () => setStatus(value),
|
|
231
|
+
onKeydown: (event) => {
|
|
232
|
+
if (![
|
|
233
|
+
"ArrowLeft",
|
|
234
|
+
"ArrowRight",
|
|
235
|
+
"ArrowUp",
|
|
236
|
+
"ArrowDown"
|
|
237
|
+
].includes(event.key)) return;
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
const group = event.currentTarget.closest("[role=radiogroup]");
|
|
240
|
+
setStatus(value === "open" ? "resolved" : "open");
|
|
241
|
+
nextTick(() => group?.querySelector("[role=radio][aria-checked=true]")?.focus());
|
|
242
|
+
},
|
|
243
|
+
role: "radio",
|
|
222
244
|
size: "xs",
|
|
245
|
+
tabindex: status.value === value ? 0 : -1,
|
|
223
246
|
variant: status.value === value ? "soft" : "ghost"
|
|
224
|
-
});
|
|
247
|
+
}, { default: () => [`${label} `, h(RollNumber, { value: count })] });
|
|
225
248
|
const empty = state.status.value === "loading" && state.threads.value.length === 0 ? "Loading comments." : state.status.value === "error" ? "The comments could not load." : status.value === "open" ? "No open comments." : "No resolved comments.";
|
|
226
249
|
return [
|
|
227
250
|
h("header", { "data-slot": "comment-panel-header" }, [
|
|
@@ -229,7 +252,7 @@ const CommentPanel = defineComponent({
|
|
|
229
252
|
h("div", {
|
|
230
253
|
"aria-label": "Filter comments",
|
|
231
254
|
"data-slot": "comment-panel-filters",
|
|
232
|
-
role: "
|
|
255
|
+
role: "radiogroup"
|
|
233
256
|
}, [filter("open", "Open", counts.open), filter("resolved", "Resolved", counts.resolved)]),
|
|
234
257
|
slots["list-actions"] ? h("div", { "data-slot": "comment-panel-actions" }, slots["list-actions"]()) : null
|
|
235
258
|
]),
|
|
@@ -270,7 +293,7 @@ const CommentPanel = defineComponent({
|
|
|
270
293
|
can: props.can,
|
|
271
294
|
detached: state.positions.value.get(thread.id)?.detached === true,
|
|
272
295
|
dismissible: false,
|
|
273
|
-
key: thread
|
|
296
|
+
key: commentThreadKey(thread),
|
|
274
297
|
navigation: "back",
|
|
275
298
|
onClose: back,
|
|
276
299
|
onDelete: async (messageId) => {
|
|
@@ -278,7 +301,10 @@ const CommentPanel = defineComponent({
|
|
|
278
301
|
},
|
|
279
302
|
onEdit: (messageId, text, ids) => state.edit(thread.id, messageId, text, ids),
|
|
280
303
|
onReopen: () => state.reopen(thread.id),
|
|
281
|
-
onReply: async (text, ids,
|
|
304
|
+
onReply: async (text, ids, list) => {
|
|
305
|
+
const { attachments, files } = await prepare(list);
|
|
306
|
+
return state.reply(thread.id, text, ids, attachments, files);
|
|
307
|
+
},
|
|
282
308
|
onResolve: () => state.resolve(thread.id),
|
|
283
309
|
people: props.people,
|
|
284
310
|
readOnly: props.readOnly,
|
|
@@ -286,7 +312,7 @@ const CommentPanel = defineComponent({
|
|
|
286
312
|
user: state.user.value
|
|
287
313
|
}, threadSlots());
|
|
288
314
|
return () => h("section", {
|
|
289
|
-
"aria-label": opened.value ?
|
|
315
|
+
"aria-label": opened.value ? commentTitle(opened.value) : props.title,
|
|
290
316
|
"data-comments-ui": "",
|
|
291
317
|
"data-slot": "comment-panel",
|
|
292
318
|
"data-variant": props.variant,
|
|
@@ -35,7 +35,7 @@ const CommentPin = defineComponent({
|
|
|
35
35
|
if (props.draft) return "New comment";
|
|
36
36
|
const by = props.author ? ` by ${displayName(props.author)}` : "";
|
|
37
37
|
const text = props.excerpt ? `: ${props.excerpt}` : "";
|
|
38
|
-
return `Comment ${props.n}${by}${text}${props.status === "resolved" ? ", resolved" : ""}`;
|
|
38
|
+
return `Comment${props.n === void 0 ? "" : ` ${props.n}`}${by}${text}${props.status === "resolved" ? ", resolved" : ""}`;
|
|
39
39
|
};
|
|
40
40
|
let pointed = false;
|
|
41
41
|
let focused = false;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { n as useTooltipComponent, r as useUIComponent } from "../../nuxt-ui-CgvMzO5v.js";
|
|
2
|
+
import { a as useViteHubUIIcons } from "../../config-B1u7zqMB.js";
|
|
3
|
+
import { defineComponent, h, onErrorCaptured, onMounted, ref } from "vue";
|
|
4
|
+
//#region src/components/comment-selection-bar.ts
|
|
5
|
+
const TooltipOrTitle = defineComponent({
|
|
6
|
+
name: "CommentSelectionBarTooltip",
|
|
7
|
+
props: {
|
|
8
|
+
tooltip: {
|
|
9
|
+
required: true,
|
|
10
|
+
type: [Object, Function]
|
|
11
|
+
},
|
|
12
|
+
side: {
|
|
13
|
+
required: true,
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
16
|
+
content: {
|
|
17
|
+
required: true,
|
|
18
|
+
type: Function
|
|
19
|
+
},
|
|
20
|
+
trigger: {
|
|
21
|
+
required: true,
|
|
22
|
+
type: Function
|
|
23
|
+
},
|
|
24
|
+
title: {
|
|
25
|
+
required: true,
|
|
26
|
+
type: String
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setup(props) {
|
|
30
|
+
const failed = ref(false);
|
|
31
|
+
let mounted = false;
|
|
32
|
+
onMounted(() => mounted = true);
|
|
33
|
+
onErrorCaptured(() => {
|
|
34
|
+
if (mounted || failed.value) return;
|
|
35
|
+
failed.value = true;
|
|
36
|
+
return false;
|
|
37
|
+
});
|
|
38
|
+
return () => failed.value ? props.trigger(props.title) : h(props.tooltip, { content: {
|
|
39
|
+
side: props.side,
|
|
40
|
+
sideOffset: 8
|
|
41
|
+
} }, {
|
|
42
|
+
content: props.content,
|
|
43
|
+
default: () => props.trigger()
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* The bar over selected text: Comment, and Suggest when the page takes suggested changes. It is the dark surface on a
|
|
49
|
+
* light page and its light twin on a dark one, so it stands out from the text. The page places it and listens for the
|
|
50
|
+
* keys. A press on the bar keeps the selection on the page.
|
|
51
|
+
*/
|
|
52
|
+
const CommentSelectionBar = defineComponent({
|
|
53
|
+
name: "CommentSelectionBar",
|
|
54
|
+
props: {
|
|
55
|
+
/** Show Suggest (E), for a page that takes suggested changes. */
|
|
56
|
+
suggest: {
|
|
57
|
+
default: false,
|
|
58
|
+
type: Boolean
|
|
59
|
+
},
|
|
60
|
+
/** The side of the text that the bar is on. The bar grows from that side, and its tooltips open away from the text. */
|
|
61
|
+
side: {
|
|
62
|
+
default: "top",
|
|
63
|
+
type: String
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
emits: ["comment", "suggest"],
|
|
67
|
+
setup(props, { emit }) {
|
|
68
|
+
const UIcon = useUIComponent("UIcon");
|
|
69
|
+
const UTooltip = useTooltipComponent();
|
|
70
|
+
const icons = useViteHubUIIcons();
|
|
71
|
+
const actions = () => [{
|
|
72
|
+
name: "comment",
|
|
73
|
+
label: "Comment",
|
|
74
|
+
hint: "Comment on the selected text",
|
|
75
|
+
key: "C",
|
|
76
|
+
icon: icons.value.comment
|
|
77
|
+
}, ...props.suggest ? [{
|
|
78
|
+
name: "suggest",
|
|
79
|
+
label: "Suggest",
|
|
80
|
+
hint: "Suggest new words",
|
|
81
|
+
key: "E",
|
|
82
|
+
icon: icons.value.edit
|
|
83
|
+
}] : []];
|
|
84
|
+
const button = (action, title) => h("button", {
|
|
85
|
+
"aria-keyshortcuts": action.key,
|
|
86
|
+
"data-action": action.name,
|
|
87
|
+
"data-slot": "comment-selection-bar-action",
|
|
88
|
+
onClick: () => action.name === "comment" ? emit("comment") : emit("suggest"),
|
|
89
|
+
title,
|
|
90
|
+
type: "button"
|
|
91
|
+
}, [h(UIcon, {
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
name: action.icon
|
|
94
|
+
}), action.label]);
|
|
95
|
+
return () => h("div", {
|
|
96
|
+
"aria-label": "Selected text",
|
|
97
|
+
"data-motion-appear": "",
|
|
98
|
+
"data-side": props.side,
|
|
99
|
+
"data-slot": "comment-selection-bar",
|
|
100
|
+
onMousedown: (event) => event.preventDefault(),
|
|
101
|
+
role: "group"
|
|
102
|
+
}, actions().map((action) => {
|
|
103
|
+
const title = `${action.hint} (${action.key})`;
|
|
104
|
+
if (!UTooltip) return button(action, title);
|
|
105
|
+
return h(TooltipOrTitle, {
|
|
106
|
+
content: () => [action.hint, h("kbd", { "data-slot": "comment-selection-bar-kbd" }, action.key)],
|
|
107
|
+
key: action.name,
|
|
108
|
+
side: props.side,
|
|
109
|
+
title,
|
|
110
|
+
tooltip: UTooltip,
|
|
111
|
+
trigger: (fallback) => button(action, fallback)
|
|
112
|
+
});
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
//#endregion
|
|
117
|
+
export { CommentSelectionBar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CommentReplySlots, c as
|
|
2
|
-
export { CommentAttachmentLink, CommentAttachmentUrl, CommentReply, CommentReplySlotScope, CommentReplySlots, CommentThread, CommentThreadSlotScope, CommentThreadSlots, messagesSinceResolved, repliedSinceResolved };
|
|
1
|
+
import { a as CommentReplySlots, c as CommentThreadSlotScope, d as repliedSinceResolved, i as CommentReplySlotScope, l as CommentThreadSlots, n as CommentAttachmentUrl, o as CommentStatusSlotScope, r as CommentReply, s as CommentThread, t as CommentAttachmentLink, u as messagesSinceResolved } from "../../comment-thread-C6U-bsK_.js";
|
|
2
|
+
export { CommentAttachmentLink, CommentAttachmentUrl, CommentReply, CommentReplySlotScope, CommentReplySlots, CommentStatusSlotScope, CommentThread, CommentThreadSlotScope, CommentThreadSlots, messagesSinceResolved, repliedSinceResolved };
|