@mindbowser_inc/ui-feedback-plugin 0.1.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 +163 -0
- package/dist/firebase-BGU5KpRU.mjs +15481 -0
- package/dist/firebase-BGU5KpRU.mjs.map +1 -0
- package/dist/html2canvas.esm-d2sM-0Wm.mjs +4871 -0
- package/dist/html2canvas.esm-d2sM-0Wm.mjs.map +1 -0
- package/dist/index-BcqBbswO.mjs +18420 -0
- package/dist/index-BcqBbswO.mjs.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/s3-DkzKoz0A.mjs +32 -0
- package/dist/s3-DkzKoz0A.mjs.map +1 -0
- package/dist/supabase-BUHP2OkK.mjs +128 -0
- package/dist/supabase-BUHP2OkK.mjs.map +1 -0
- package/dist/ui-feedback-plugin.es.js +1382 -0
- package/dist/ui-feedback-plugin.es.js.map +1 -0
- package/dist/ui-feedback-plugin.umd.js +3036 -0
- package/dist/ui-feedback-plugin.umd.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,1382 @@
|
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var J = (e, t, r) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var H = (e, t, r) => J(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
const O = /* @__PURE__ */ new Set();
|
|
5
|
+
let T = {
|
|
6
|
+
active: !1,
|
|
7
|
+
userName: null,
|
|
8
|
+
comments: [],
|
|
9
|
+
replies: /* @__PURE__ */ new Map(),
|
|
10
|
+
selectedCommentId: null,
|
|
11
|
+
panelOpen: !1,
|
|
12
|
+
filter: "open",
|
|
13
|
+
config: {}
|
|
14
|
+
};
|
|
15
|
+
function L() {
|
|
16
|
+
return T;
|
|
17
|
+
}
|
|
18
|
+
function b(e) {
|
|
19
|
+
T = { ...T, ...e }, O.forEach((t) => t(T));
|
|
20
|
+
}
|
|
21
|
+
function P(e) {
|
|
22
|
+
return O.add(e), () => O.delete(e);
|
|
23
|
+
}
|
|
24
|
+
function X() {
|
|
25
|
+
if (T.userName) return T.userName;
|
|
26
|
+
const e = localStorage.getItem("ufp_user_name");
|
|
27
|
+
return e ? (b({ userName: e }), e) : null;
|
|
28
|
+
}
|
|
29
|
+
function Y(e) {
|
|
30
|
+
localStorage.setItem("ufp_user_name", e), b({ userName: e });
|
|
31
|
+
}
|
|
32
|
+
function U(e) {
|
|
33
|
+
try {
|
|
34
|
+
const t = new URL(e);
|
|
35
|
+
return t.origin + t.pathname;
|
|
36
|
+
} catch {
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function Q(e) {
|
|
41
|
+
return `
|
|
42
|
+
:host {
|
|
43
|
+
--ufp-primary: ${e};
|
|
44
|
+
--ufp-primary-dark: color-mix(in srgb, ${e} 80%, black);
|
|
45
|
+
--ufp-white: #ffffff;
|
|
46
|
+
--ufp-gray-50: #f9fafb;
|
|
47
|
+
--ufp-gray-100: #f3f4f6;
|
|
48
|
+
--ufp-gray-200: #e5e7eb;
|
|
49
|
+
--ufp-gray-300: #d1d5db;
|
|
50
|
+
--ufp-gray-400: #9ca3af;
|
|
51
|
+
--ufp-gray-500: #6b7280;
|
|
52
|
+
--ufp-gray-600: #4b5563;
|
|
53
|
+
--ufp-gray-700: #374151;
|
|
54
|
+
--ufp-gray-800: #1f2937;
|
|
55
|
+
--ufp-gray-900: #111827;
|
|
56
|
+
--ufp-green: #10b981;
|
|
57
|
+
--ufp-red: #ef4444;
|
|
58
|
+
--ufp-shadow: 0 4px 24px rgba(0,0,0,0.18);
|
|
59
|
+
--ufp-radius: 12px;
|
|
60
|
+
--ufp-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
61
|
+
font-family: var(--ufp-font);
|
|
62
|
+
all: initial;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
* { box-sizing: border-box; }
|
|
66
|
+
|
|
67
|
+
/* Trigger */
|
|
68
|
+
.ufp-trigger {
|
|
69
|
+
position: fixed;
|
|
70
|
+
z-index: 2147483646;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 8px;
|
|
74
|
+
background: var(--ufp-primary);
|
|
75
|
+
color: var(--ufp-white);
|
|
76
|
+
border: none;
|
|
77
|
+
border-radius: 28px;
|
|
78
|
+
padding: 10px 18px 10px 14px;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
box-shadow: var(--ufp-shadow);
|
|
81
|
+
font-family: var(--ufp-font);
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
user-select: none;
|
|
85
|
+
transition: background 0.15s, transform 0.1s;
|
|
86
|
+
touch-action: none;
|
|
87
|
+
}
|
|
88
|
+
.ufp-trigger:hover { background: var(--ufp-primary-dark); }
|
|
89
|
+
.ufp-trigger:active { transform: scale(0.97); }
|
|
90
|
+
.ufp-trigger.active { background: var(--ufp-gray-800); }
|
|
91
|
+
.ufp-trigger-icon { width: 20px; height: 20px; flex-shrink: 0; }
|
|
92
|
+
|
|
93
|
+
/* Modal overlay */
|
|
94
|
+
.ufp-modal-backdrop {
|
|
95
|
+
position: fixed;
|
|
96
|
+
inset: 0;
|
|
97
|
+
background: rgba(0,0,0,0.45);
|
|
98
|
+
z-index: 2147483646;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
}
|
|
103
|
+
.ufp-modal {
|
|
104
|
+
background: var(--ufp-white);
|
|
105
|
+
border-radius: var(--ufp-radius);
|
|
106
|
+
padding: 28px;
|
|
107
|
+
width: 360px;
|
|
108
|
+
box-shadow: var(--ufp-shadow);
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 16px;
|
|
112
|
+
}
|
|
113
|
+
.ufp-modal h2 {
|
|
114
|
+
margin: 0;
|
|
115
|
+
font-size: 18px;
|
|
116
|
+
font-weight: 700;
|
|
117
|
+
color: var(--ufp-gray-900);
|
|
118
|
+
font-family: var(--ufp-font);
|
|
119
|
+
}
|
|
120
|
+
.ufp-modal p {
|
|
121
|
+
margin: 0;
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
color: var(--ufp-gray-500);
|
|
124
|
+
font-family: var(--ufp-font);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Form elements */
|
|
128
|
+
.ufp-input {
|
|
129
|
+
width: 100%;
|
|
130
|
+
padding: 10px 14px;
|
|
131
|
+
border: 1.5px solid var(--ufp-gray-200);
|
|
132
|
+
border-radius: 8px;
|
|
133
|
+
font-size: 14px;
|
|
134
|
+
font-family: var(--ufp-font);
|
|
135
|
+
color: var(--ufp-gray-900);
|
|
136
|
+
outline: none;
|
|
137
|
+
transition: border-color 0.15s;
|
|
138
|
+
}
|
|
139
|
+
.ufp-input:focus { border-color: var(--ufp-primary); }
|
|
140
|
+
.ufp-textarea {
|
|
141
|
+
width: 100%;
|
|
142
|
+
padding: 10px 14px;
|
|
143
|
+
border: 1.5px solid var(--ufp-gray-200);
|
|
144
|
+
border-radius: 8px;
|
|
145
|
+
font-size: 14px;
|
|
146
|
+
font-family: var(--ufp-font);
|
|
147
|
+
color: var(--ufp-gray-900);
|
|
148
|
+
outline: none;
|
|
149
|
+
resize: vertical;
|
|
150
|
+
min-height: 80px;
|
|
151
|
+
transition: border-color 0.15s;
|
|
152
|
+
}
|
|
153
|
+
.ufp-textarea:focus { border-color: var(--ufp-primary); }
|
|
154
|
+
|
|
155
|
+
/* Buttons */
|
|
156
|
+
.ufp-btn {
|
|
157
|
+
padding: 9px 18px;
|
|
158
|
+
border-radius: 8px;
|
|
159
|
+
font-size: 14px;
|
|
160
|
+
font-weight: 600;
|
|
161
|
+
font-family: var(--ufp-font);
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
border: none;
|
|
164
|
+
transition: background 0.15s, opacity 0.15s;
|
|
165
|
+
}
|
|
166
|
+
.ufp-btn-primary {
|
|
167
|
+
background: var(--ufp-primary);
|
|
168
|
+
color: var(--ufp-white);
|
|
169
|
+
}
|
|
170
|
+
.ufp-btn-primary:hover { background: var(--ufp-primary-dark); }
|
|
171
|
+
.ufp-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
172
|
+
.ufp-btn-ghost {
|
|
173
|
+
background: transparent;
|
|
174
|
+
color: var(--ufp-gray-600);
|
|
175
|
+
border: 1.5px solid var(--ufp-gray-200);
|
|
176
|
+
}
|
|
177
|
+
.ufp-btn-ghost:hover { background: var(--ufp-gray-50); }
|
|
178
|
+
.ufp-btn-danger {
|
|
179
|
+
background: var(--ufp-red);
|
|
180
|
+
color: var(--ufp-white);
|
|
181
|
+
}
|
|
182
|
+
.ufp-btn-icon {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: center;
|
|
186
|
+
width: 32px;
|
|
187
|
+
height: 32px;
|
|
188
|
+
padding: 0;
|
|
189
|
+
border-radius: 6px;
|
|
190
|
+
background: transparent;
|
|
191
|
+
border: none;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
color: var(--ufp-gray-600);
|
|
194
|
+
font-size: 16px;
|
|
195
|
+
transition: background 0.12s, color 0.12s;
|
|
196
|
+
}
|
|
197
|
+
.ufp-btn-icon:hover { background: var(--ufp-gray-100); color: var(--ufp-gray-900); }
|
|
198
|
+
.ufp-btn-icon.active { background: var(--ufp-primary); color: var(--ufp-white); }
|
|
199
|
+
|
|
200
|
+
.ufp-btn-row {
|
|
201
|
+
display: flex;
|
|
202
|
+
gap: 8px;
|
|
203
|
+
justify-content: flex-end;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* Annotation overlay */
|
|
207
|
+
.ufp-overlay {
|
|
208
|
+
position: fixed;
|
|
209
|
+
inset: 0;
|
|
210
|
+
z-index: 2147483645;
|
|
211
|
+
cursor: crosshair;
|
|
212
|
+
background: rgba(99,102,241,0.04);
|
|
213
|
+
}
|
|
214
|
+
.ufp-overlay-svg {
|
|
215
|
+
position: absolute;
|
|
216
|
+
inset: 0;
|
|
217
|
+
width: 100%;
|
|
218
|
+
height: 100%;
|
|
219
|
+
pointer-events: none;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* Toolbar */
|
|
223
|
+
.ufp-toolbar {
|
|
224
|
+
position: fixed;
|
|
225
|
+
top: 50%;
|
|
226
|
+
left: 50%;
|
|
227
|
+
transform: translate(-50%, -50%);
|
|
228
|
+
z-index: 2147483647;
|
|
229
|
+
background: var(--ufp-white);
|
|
230
|
+
border-radius: 12px;
|
|
231
|
+
box-shadow: var(--ufp-shadow);
|
|
232
|
+
padding: 8px;
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
gap: 4px;
|
|
236
|
+
top: 24px;
|
|
237
|
+
left: 50%;
|
|
238
|
+
transform: translateX(-50%);
|
|
239
|
+
}
|
|
240
|
+
.ufp-toolbar-sep {
|
|
241
|
+
width: 1px;
|
|
242
|
+
height: 24px;
|
|
243
|
+
background: var(--ufp-gray-200);
|
|
244
|
+
margin: 0 4px;
|
|
245
|
+
}
|
|
246
|
+
.ufp-toolbar-label {
|
|
247
|
+
font-size: 12px;
|
|
248
|
+
font-family: var(--ufp-font);
|
|
249
|
+
color: var(--ufp-gray-500);
|
|
250
|
+
padding: 0 6px;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* Comment input popup */
|
|
254
|
+
.ufp-comment-popup {
|
|
255
|
+
position: fixed;
|
|
256
|
+
z-index: 2147483647;
|
|
257
|
+
background: var(--ufp-white);
|
|
258
|
+
border-radius: var(--ufp-radius);
|
|
259
|
+
box-shadow: var(--ufp-shadow);
|
|
260
|
+
padding: 16px;
|
|
261
|
+
width: 320px;
|
|
262
|
+
display: flex;
|
|
263
|
+
flex-direction: column;
|
|
264
|
+
gap: 12px;
|
|
265
|
+
}
|
|
266
|
+
.ufp-comment-popup h3 {
|
|
267
|
+
margin: 0;
|
|
268
|
+
font-size: 14px;
|
|
269
|
+
font-weight: 600;
|
|
270
|
+
color: var(--ufp-gray-800);
|
|
271
|
+
font-family: var(--ufp-font);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Comments panel */
|
|
275
|
+
.ufp-panel {
|
|
276
|
+
position: fixed;
|
|
277
|
+
top: 0;
|
|
278
|
+
right: 0;
|
|
279
|
+
bottom: 0;
|
|
280
|
+
width: 360px;
|
|
281
|
+
z-index: 2147483646;
|
|
282
|
+
background: var(--ufp-white);
|
|
283
|
+
box-shadow: -4px 0 24px rgba(0,0,0,0.12);
|
|
284
|
+
display: flex;
|
|
285
|
+
flex-direction: column;
|
|
286
|
+
transform: translateX(100%);
|
|
287
|
+
transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
|
|
288
|
+
}
|
|
289
|
+
.ufp-panel.open { transform: translateX(0); }
|
|
290
|
+
.ufp-panel-header {
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
justify-content: space-between;
|
|
294
|
+
padding: 16px 20px;
|
|
295
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
296
|
+
flex-shrink: 0;
|
|
297
|
+
}
|
|
298
|
+
.ufp-panel-title {
|
|
299
|
+
font-size: 16px;
|
|
300
|
+
font-weight: 700;
|
|
301
|
+
color: var(--ufp-gray-900);
|
|
302
|
+
font-family: var(--ufp-font);
|
|
303
|
+
}
|
|
304
|
+
.ufp-filter-tabs {
|
|
305
|
+
display: flex;
|
|
306
|
+
gap: 4px;
|
|
307
|
+
padding: 8px 12px;
|
|
308
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
309
|
+
flex-shrink: 0;
|
|
310
|
+
}
|
|
311
|
+
.ufp-filter-tab {
|
|
312
|
+
padding: 6px 14px;
|
|
313
|
+
border-radius: 20px;
|
|
314
|
+
font-size: 13px;
|
|
315
|
+
font-family: var(--ufp-font);
|
|
316
|
+
font-weight: 500;
|
|
317
|
+
cursor: pointer;
|
|
318
|
+
border: none;
|
|
319
|
+
background: transparent;
|
|
320
|
+
color: var(--ufp-gray-500);
|
|
321
|
+
transition: background 0.12s, color 0.12s;
|
|
322
|
+
}
|
|
323
|
+
.ufp-filter-tab.active {
|
|
324
|
+
background: var(--ufp-primary);
|
|
325
|
+
color: var(--ufp-white);
|
|
326
|
+
}
|
|
327
|
+
.ufp-panel-list {
|
|
328
|
+
flex: 1;
|
|
329
|
+
overflow-y: auto;
|
|
330
|
+
padding: 8px 0;
|
|
331
|
+
}
|
|
332
|
+
.ufp-panel-empty {
|
|
333
|
+
display: flex;
|
|
334
|
+
flex-direction: column;
|
|
335
|
+
align-items: center;
|
|
336
|
+
justify-content: center;
|
|
337
|
+
height: 200px;
|
|
338
|
+
color: var(--ufp-gray-400);
|
|
339
|
+
font-size: 14px;
|
|
340
|
+
font-family: var(--ufp-font);
|
|
341
|
+
gap: 8px;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/* Comment card */
|
|
345
|
+
.ufp-comment-card {
|
|
346
|
+
padding: 12px 16px;
|
|
347
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
transition: background 0.12s;
|
|
350
|
+
display: flex;
|
|
351
|
+
flex-direction: column;
|
|
352
|
+
gap: 8px;
|
|
353
|
+
}
|
|
354
|
+
.ufp-comment-card:hover { background: var(--ufp-gray-50); }
|
|
355
|
+
.ufp-comment-card.selected { background: #eef2ff; }
|
|
356
|
+
.ufp-comment-card-header {
|
|
357
|
+
display: flex;
|
|
358
|
+
align-items: flex-start;
|
|
359
|
+
justify-content: space-between;
|
|
360
|
+
gap: 8px;
|
|
361
|
+
}
|
|
362
|
+
.ufp-comment-meta {
|
|
363
|
+
display: flex;
|
|
364
|
+
align-items: center;
|
|
365
|
+
gap: 6px;
|
|
366
|
+
}
|
|
367
|
+
.ufp-avatar {
|
|
368
|
+
width: 26px;
|
|
369
|
+
height: 26px;
|
|
370
|
+
border-radius: 50%;
|
|
371
|
+
background: var(--ufp-primary);
|
|
372
|
+
color: var(--ufp-white);
|
|
373
|
+
font-size: 11px;
|
|
374
|
+
font-weight: 700;
|
|
375
|
+
font-family: var(--ufp-font);
|
|
376
|
+
display: flex;
|
|
377
|
+
align-items: center;
|
|
378
|
+
justify-content: center;
|
|
379
|
+
flex-shrink: 0;
|
|
380
|
+
}
|
|
381
|
+
.ufp-comment-author {
|
|
382
|
+
font-size: 13px;
|
|
383
|
+
font-weight: 600;
|
|
384
|
+
color: var(--ufp-gray-800);
|
|
385
|
+
font-family: var(--ufp-font);
|
|
386
|
+
}
|
|
387
|
+
.ufp-comment-time {
|
|
388
|
+
font-size: 11px;
|
|
389
|
+
color: var(--ufp-gray-400);
|
|
390
|
+
font-family: var(--ufp-font);
|
|
391
|
+
}
|
|
392
|
+
.ufp-comment-text {
|
|
393
|
+
font-size: 13px;
|
|
394
|
+
color: var(--ufp-gray-700);
|
|
395
|
+
font-family: var(--ufp-font);
|
|
396
|
+
line-height: 1.5;
|
|
397
|
+
overflow: hidden;
|
|
398
|
+
display: -webkit-box;
|
|
399
|
+
-webkit-line-clamp: 2;
|
|
400
|
+
-webkit-box-orient: vertical;
|
|
401
|
+
}
|
|
402
|
+
.ufp-comment-thumbnail {
|
|
403
|
+
width: 100%;
|
|
404
|
+
height: 80px;
|
|
405
|
+
object-fit: cover;
|
|
406
|
+
object-position: top left;
|
|
407
|
+
border-radius: 6px;
|
|
408
|
+
border: 1px solid var(--ufp-gray-200);
|
|
409
|
+
}
|
|
410
|
+
.ufp-comment-footer {
|
|
411
|
+
display: flex;
|
|
412
|
+
align-items: center;
|
|
413
|
+
justify-content: space-between;
|
|
414
|
+
}
|
|
415
|
+
.ufp-reply-count {
|
|
416
|
+
font-size: 12px;
|
|
417
|
+
color: var(--ufp-gray-400);
|
|
418
|
+
font-family: var(--ufp-font);
|
|
419
|
+
}
|
|
420
|
+
.ufp-resolved-badge {
|
|
421
|
+
font-size: 11px;
|
|
422
|
+
font-weight: 600;
|
|
423
|
+
font-family: var(--ufp-font);
|
|
424
|
+
padding: 2px 8px;
|
|
425
|
+
border-radius: 12px;
|
|
426
|
+
background: #d1fae5;
|
|
427
|
+
color: #065f46;
|
|
428
|
+
}
|
|
429
|
+
.ufp-card-actions {
|
|
430
|
+
display: flex;
|
|
431
|
+
gap: 4px;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/* Detail view */
|
|
435
|
+
.ufp-detail {
|
|
436
|
+
position: fixed;
|
|
437
|
+
inset: 0;
|
|
438
|
+
z-index: 2147483647;
|
|
439
|
+
background: rgba(0,0,0,0.75);
|
|
440
|
+
display: flex;
|
|
441
|
+
align-items: stretch;
|
|
442
|
+
}
|
|
443
|
+
.ufp-detail-image-area {
|
|
444
|
+
flex: 1;
|
|
445
|
+
overflow: auto;
|
|
446
|
+
display: flex;
|
|
447
|
+
align-items: flex-start;
|
|
448
|
+
justify-content: center;
|
|
449
|
+
padding: 24px;
|
|
450
|
+
position: relative;
|
|
451
|
+
}
|
|
452
|
+
.ufp-detail-image-wrap {
|
|
453
|
+
position: relative;
|
|
454
|
+
display: inline-block;
|
|
455
|
+
}
|
|
456
|
+
.ufp-detail-screenshot {
|
|
457
|
+
max-width: 100%;
|
|
458
|
+
display: block;
|
|
459
|
+
border-radius: 8px;
|
|
460
|
+
}
|
|
461
|
+
.ufp-detail-annotation-svg {
|
|
462
|
+
position: absolute;
|
|
463
|
+
top: 0;
|
|
464
|
+
left: 0;
|
|
465
|
+
width: 100%;
|
|
466
|
+
height: 100%;
|
|
467
|
+
pointer-events: none;
|
|
468
|
+
}
|
|
469
|
+
.ufp-detail-sidebar {
|
|
470
|
+
width: 340px;
|
|
471
|
+
background: var(--ufp-white);
|
|
472
|
+
display: flex;
|
|
473
|
+
flex-direction: column;
|
|
474
|
+
flex-shrink: 0;
|
|
475
|
+
}
|
|
476
|
+
.ufp-detail-header {
|
|
477
|
+
display: flex;
|
|
478
|
+
align-items: center;
|
|
479
|
+
justify-content: space-between;
|
|
480
|
+
padding: 16px 20px;
|
|
481
|
+
border-bottom: 1px solid var(--ufp-gray-100);
|
|
482
|
+
flex-shrink: 0;
|
|
483
|
+
}
|
|
484
|
+
.ufp-detail-body {
|
|
485
|
+
flex: 1;
|
|
486
|
+
overflow-y: auto;
|
|
487
|
+
padding: 16px 20px;
|
|
488
|
+
display: flex;
|
|
489
|
+
flex-direction: column;
|
|
490
|
+
gap: 16px;
|
|
491
|
+
}
|
|
492
|
+
.ufp-detail-comment {
|
|
493
|
+
display: flex;
|
|
494
|
+
flex-direction: column;
|
|
495
|
+
gap: 8px;
|
|
496
|
+
}
|
|
497
|
+
.ufp-detail-comment-text {
|
|
498
|
+
font-size: 14px;
|
|
499
|
+
color: var(--ufp-gray-800);
|
|
500
|
+
font-family: var(--ufp-font);
|
|
501
|
+
line-height: 1.6;
|
|
502
|
+
}
|
|
503
|
+
.ufp-detail-actions {
|
|
504
|
+
display: flex;
|
|
505
|
+
gap: 8px;
|
|
506
|
+
flex-wrap: wrap;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/* Reply thread */
|
|
510
|
+
.ufp-replies {
|
|
511
|
+
display: flex;
|
|
512
|
+
flex-direction: column;
|
|
513
|
+
gap: 12px;
|
|
514
|
+
border-top: 1px solid var(--ufp-gray-100);
|
|
515
|
+
padding-top: 12px;
|
|
516
|
+
}
|
|
517
|
+
.ufp-replies-title {
|
|
518
|
+
font-size: 12px;
|
|
519
|
+
font-weight: 600;
|
|
520
|
+
color: var(--ufp-gray-500);
|
|
521
|
+
font-family: var(--ufp-font);
|
|
522
|
+
text-transform: uppercase;
|
|
523
|
+
letter-spacing: 0.05em;
|
|
524
|
+
}
|
|
525
|
+
.ufp-reply {
|
|
526
|
+
display: flex;
|
|
527
|
+
flex-direction: column;
|
|
528
|
+
gap: 4px;
|
|
529
|
+
}
|
|
530
|
+
.ufp-reply-meta {
|
|
531
|
+
display: flex;
|
|
532
|
+
align-items: center;
|
|
533
|
+
gap: 6px;
|
|
534
|
+
}
|
|
535
|
+
.ufp-reply-author {
|
|
536
|
+
font-size: 12px;
|
|
537
|
+
font-weight: 600;
|
|
538
|
+
color: var(--ufp-gray-700);
|
|
539
|
+
font-family: var(--ufp-font);
|
|
540
|
+
}
|
|
541
|
+
.ufp-reply-time {
|
|
542
|
+
font-size: 11px;
|
|
543
|
+
color: var(--ufp-gray-400);
|
|
544
|
+
font-family: var(--ufp-font);
|
|
545
|
+
}
|
|
546
|
+
.ufp-reply-text {
|
|
547
|
+
font-size: 13px;
|
|
548
|
+
color: var(--ufp-gray-700);
|
|
549
|
+
font-family: var(--ufp-font);
|
|
550
|
+
line-height: 1.5;
|
|
551
|
+
padding-left: 32px;
|
|
552
|
+
}
|
|
553
|
+
.ufp-reply-input-area {
|
|
554
|
+
display: flex;
|
|
555
|
+
flex-direction: column;
|
|
556
|
+
gap: 8px;
|
|
557
|
+
border-top: 1px solid var(--ufp-gray-100);
|
|
558
|
+
padding-top: 12px;
|
|
559
|
+
}
|
|
560
|
+
.ufp-reply-name-row {
|
|
561
|
+
display: flex;
|
|
562
|
+
gap: 8px;
|
|
563
|
+
align-items: center;
|
|
564
|
+
}
|
|
565
|
+
.ufp-reply-name-label {
|
|
566
|
+
font-size: 12px;
|
|
567
|
+
color: var(--ufp-gray-500);
|
|
568
|
+
font-family: var(--ufp-font);
|
|
569
|
+
white-space: nowrap;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/* Loading spinner */
|
|
573
|
+
.ufp-spinner {
|
|
574
|
+
width: 20px;
|
|
575
|
+
height: 20px;
|
|
576
|
+
border: 2px solid var(--ufp-gray-200);
|
|
577
|
+
border-top-color: var(--ufp-primary);
|
|
578
|
+
border-radius: 50%;
|
|
579
|
+
animation: ufp-spin 0.7s linear infinite;
|
|
580
|
+
}
|
|
581
|
+
@keyframes ufp-spin { to { transform: rotate(360deg); } }
|
|
582
|
+
|
|
583
|
+
/* Scrollbar */
|
|
584
|
+
.ufp-panel-list::-webkit-scrollbar,
|
|
585
|
+
.ufp-detail-body::-webkit-scrollbar,
|
|
586
|
+
.ufp-detail-image-area::-webkit-scrollbar { width: 4px; }
|
|
587
|
+
.ufp-panel-list::-webkit-scrollbar-thumb,
|
|
588
|
+
.ufp-detail-body::-webkit-scrollbar-thumb,
|
|
589
|
+
.ufp-detail-image-area::-webkit-scrollbar-thumb {
|
|
590
|
+
background: var(--ufp-gray-300);
|
|
591
|
+
border-radius: 2px;
|
|
592
|
+
}
|
|
593
|
+
`;
|
|
594
|
+
}
|
|
595
|
+
const Z = {
|
|
596
|
+
"bottom-right": { bottom: "24px", right: "24px" },
|
|
597
|
+
"bottom-left": { bottom: "24px", left: "24px" },
|
|
598
|
+
"top-right": { top: "24px", right: "24px" },
|
|
599
|
+
"top-left": { top: "24px", left: "24px" }
|
|
600
|
+
}, $ = "#6366f1", I = "#4f46e5", j = "#4338ca";
|
|
601
|
+
function ee(e, t, r, n) {
|
|
602
|
+
const o = document.createElement("div");
|
|
603
|
+
Object.assign(o.style, {
|
|
604
|
+
position: "fixed",
|
|
605
|
+
zIndex: "2147483647",
|
|
606
|
+
display: "flex",
|
|
607
|
+
alignItems: "stretch",
|
|
608
|
+
borderRadius: "28px",
|
|
609
|
+
boxShadow: "0 4px 20px rgba(0,0,0,0.28), 0 1px 4px rgba(0,0,0,0.16)",
|
|
610
|
+
overflow: "hidden",
|
|
611
|
+
userSelect: "none",
|
|
612
|
+
...Z[t]
|
|
613
|
+
});
|
|
614
|
+
const a = document.createElement("button");
|
|
615
|
+
a.id = "ufp-btn-annotate", a.title = "Add feedback annotation", D(a), a.style.padding = "10px 16px 10px 14px", a.innerHTML = `
|
|
616
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" style="flex-shrink:0">
|
|
617
|
+
<path d="M12 20h9"/>
|
|
618
|
+
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
619
|
+
</svg>
|
|
620
|
+
<span id="ufp-annotate-label" style="font-size:14px;font-weight:600;">Feedback</span>
|
|
621
|
+
`;
|
|
622
|
+
const d = document.createElement("div");
|
|
623
|
+
d.style.cssText = "width:1px;background:rgba(255,255,255,0.3);flex-shrink:0;";
|
|
624
|
+
const l = document.createElement("button");
|
|
625
|
+
l.id = "ufp-btn-panel", l.title = "View all comments", D(l), l.style.padding = "10px 14px", l.innerHTML = `
|
|
626
|
+
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" style="flex-shrink:0">
|
|
627
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
|
628
|
+
</svg>
|
|
629
|
+
<span id="ufp-panel-count" style="font-size:13px;font-weight:600;min-width:8px;text-align:center;"></span>
|
|
630
|
+
`, o.appendChild(a), o.appendChild(d), o.appendChild(l), e.appendChild(o);
|
|
631
|
+
const p = o.querySelector("#ufp-annotate-label"), s = o.querySelector("#ufp-panel-count");
|
|
632
|
+
return a.addEventListener("click", (i) => {
|
|
633
|
+
if (i.stopPropagation(), o._dragged) return;
|
|
634
|
+
const u = L();
|
|
635
|
+
u.active || (u.panelOpen ? (n(), setTimeout(r, 220)) : r());
|
|
636
|
+
}), l.addEventListener("click", (i) => {
|
|
637
|
+
i.stopPropagation(), !o._dragged && (L().active || n());
|
|
638
|
+
}), _(a, () => (L().panelOpen, $), I), _(l, () => L().panelOpen ? j : $, I), P((i) => {
|
|
639
|
+
const u = i.comments.filter((w) => !w.resolved).length;
|
|
640
|
+
s.textContent = u > 0 ? String(u) : "", i.active ? (p.textContent = "Drawing…", a.style.opacity = "0.65", l.style.opacity = "0.65", a.style.pointerEvents = "none", l.style.pointerEvents = "none") : (p.textContent = "Feedback", a.style.opacity = "1", l.style.opacity = "1", a.style.pointerEvents = "auto", l.style.pointerEvents = "auto"), l.style.background = i.panelOpen ? j : $;
|
|
641
|
+
}), te(o), o;
|
|
642
|
+
}
|
|
643
|
+
function D(e) {
|
|
644
|
+
Object.assign(e.style, {
|
|
645
|
+
display: "flex",
|
|
646
|
+
alignItems: "center",
|
|
647
|
+
gap: "7px",
|
|
648
|
+
background: $,
|
|
649
|
+
color: "#ffffff",
|
|
650
|
+
border: "none",
|
|
651
|
+
cursor: "pointer",
|
|
652
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
653
|
+
lineHeight: "1",
|
|
654
|
+
transition: "background 0.12s"
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function _(e, t, r) {
|
|
658
|
+
e.addEventListener("mouseenter", () => {
|
|
659
|
+
e.style.background = r;
|
|
660
|
+
}), e.addEventListener("mouseleave", () => {
|
|
661
|
+
e.style.background = t();
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
function te(e) {
|
|
665
|
+
let t = 0, r = 0, n = 0, o = 0;
|
|
666
|
+
e.addEventListener("pointerdown", (a) => {
|
|
667
|
+
if (a.button !== 0) return;
|
|
668
|
+
t = a.clientX, r = a.clientY;
|
|
669
|
+
const d = e.getBoundingClientRect();
|
|
670
|
+
n = d.left, o = d.top, e._dragged = !1;
|
|
671
|
+
const l = (s) => {
|
|
672
|
+
const i = s.clientX - t, u = s.clientY - r;
|
|
673
|
+
!e._dragged && Math.sqrt(i * i + u * u) < 5 || (e._dragged = !0, e.style.left = `${Math.max(0, Math.min(window.innerWidth - e.offsetWidth, n + i))}px`, e.style.top = `${Math.max(0, Math.min(window.innerHeight - e.offsetHeight, o + u))}px`, e.style.right = "auto", e.style.bottom = "auto");
|
|
674
|
+
}, p = () => {
|
|
675
|
+
document.removeEventListener("pointermove", l), document.removeEventListener("pointerup", p), requestAnimationFrame(() => {
|
|
676
|
+
e._dragged = !1;
|
|
677
|
+
});
|
|
678
|
+
};
|
|
679
|
+
document.addEventListener("pointermove", l), document.addEventListener("pointerup", p);
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
function ne(e) {
|
|
683
|
+
return new Promise((t) => {
|
|
684
|
+
const r = document.createElement("div");
|
|
685
|
+
r.className = "ufp-modal-backdrop", r.innerHTML = `
|
|
686
|
+
<div class="ufp-modal" role="dialog" aria-modal="true" aria-labelledby="ufp-modal-title">
|
|
687
|
+
<h2 id="ufp-modal-title">Welcome to Feedback Mode</h2>
|
|
688
|
+
<p>Enter your name so others can see who left the comment.</p>
|
|
689
|
+
<input
|
|
690
|
+
class="ufp-input"
|
|
691
|
+
id="ufp-name-input"
|
|
692
|
+
type="text"
|
|
693
|
+
placeholder="Your name"
|
|
694
|
+
maxlength="60"
|
|
695
|
+
autocomplete="off"
|
|
696
|
+
/>
|
|
697
|
+
<div class="ufp-btn-row">
|
|
698
|
+
<button class="ufp-btn ufp-btn-primary" id="ufp-name-submit" disabled>Continue</button>
|
|
699
|
+
</div>
|
|
700
|
+
</div>
|
|
701
|
+
`, e.appendChild(r);
|
|
702
|
+
const n = r.querySelector("#ufp-name-input"), o = r.querySelector("#ufp-name-submit");
|
|
703
|
+
n.addEventListener("input", () => {
|
|
704
|
+
o.disabled = n.value.trim().length === 0;
|
|
705
|
+
});
|
|
706
|
+
const a = () => {
|
|
707
|
+
const d = n.value.trim();
|
|
708
|
+
d && (Y(d), r.remove(), t(d));
|
|
709
|
+
};
|
|
710
|
+
o.addEventListener("click", a), n.addEventListener("keydown", (d) => {
|
|
711
|
+
d.key === "Enter" && a();
|
|
712
|
+
}), requestAnimationFrame(() => n.focus());
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
const C = "#6366f1", M = 3;
|
|
716
|
+
function z(e, t = 1, r = 1) {
|
|
717
|
+
switch (e.type) {
|
|
718
|
+
case "pen": {
|
|
719
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
720
|
+
return n.setAttribute("d", oe(e.points, t, r)), n.setAttribute("stroke", e.color), n.setAttribute("stroke-width", String(e.width * Math.min(t, r))), n.setAttribute("fill", "none"), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round"), n;
|
|
721
|
+
}
|
|
722
|
+
case "rect": {
|
|
723
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
724
|
+
return n.setAttribute("x", String(e.x * t)), n.setAttribute("y", String(e.y * r)), n.setAttribute("width", String(e.width * t)), n.setAttribute("height", String(e.height * r)), n.setAttribute("stroke", e.color), n.setAttribute("stroke-width", String(e.strokeWidth * Math.min(t, r))), n.setAttribute("fill", "none"), n.setAttribute("rx", "3"), n;
|
|
725
|
+
}
|
|
726
|
+
case "circle": {
|
|
727
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "ellipse");
|
|
728
|
+
return n.setAttribute("cx", String(e.cx * t)), n.setAttribute("cy", String(e.cy * r)), n.setAttribute("rx", String(e.rx * t)), n.setAttribute("ry", String(e.ry * r)), n.setAttribute("stroke", e.color), n.setAttribute("stroke-width", String(e.strokeWidth * Math.min(t, r))), n.setAttribute("fill", "none"), n;
|
|
729
|
+
}
|
|
730
|
+
case "arrow": {
|
|
731
|
+
const n = document.createElementNS("http://www.w3.org/2000/svg", "g"), o = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
732
|
+
return o.setAttribute("x1", String(e.x1 * t)), o.setAttribute("y1", String(e.y1 * r)), o.setAttribute("x2", String(e.x2 * t)), o.setAttribute("y2", String(e.y2 * r)), o.setAttribute("stroke", e.color), o.setAttribute("stroke-width", String(e.width * Math.min(t, r))), o.setAttribute("marker-end", "url(#ufp-arrowhead)"), n.appendChild(o), n;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function re(e, t, r, n) {
|
|
737
|
+
const o = r / t.pageWidth, a = n / t.pageHeight;
|
|
738
|
+
e.innerHTML = "";
|
|
739
|
+
const d = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
740
|
+
d.innerHTML = `
|
|
741
|
+
<marker id="ufp-arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
742
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${C}" />
|
|
743
|
+
</marker>
|
|
744
|
+
`, e.appendChild(d), t.shapes.forEach((l) => {
|
|
745
|
+
e.appendChild(z(l, o, a));
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
function oe(e, t, r) {
|
|
749
|
+
if (e.length === 0) return "";
|
|
750
|
+
if (e.length === 1) {
|
|
751
|
+
const o = e[0];
|
|
752
|
+
return `M ${o.x * t} ${o.y * r}`;
|
|
753
|
+
}
|
|
754
|
+
let n = `M ${e[0].x * t} ${e[0].y * r}`;
|
|
755
|
+
for (let o = 1; o < e.length; o++)
|
|
756
|
+
n += ` L ${e[o].x * t} ${e[o].y * r}`;
|
|
757
|
+
return n;
|
|
758
|
+
}
|
|
759
|
+
function ie(e) {
|
|
760
|
+
return new Promise((t) => {
|
|
761
|
+
let r = "pen";
|
|
762
|
+
const n = [];
|
|
763
|
+
let o = !1, a = 0, d = 0, l = [], p = null, s = null;
|
|
764
|
+
const i = document.createElement("div");
|
|
765
|
+
i.style.cssText = "position:fixed;inset:0;z-index:2147483645;cursor:crosshair;background:rgba(99,102,241,0.04);";
|
|
766
|
+
const u = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
767
|
+
u.style.cssText = "position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;", u.innerHTML = `
|
|
768
|
+
<defs>
|
|
769
|
+
<marker id="ufp-arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
770
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${C}" />
|
|
771
|
+
</marker>
|
|
772
|
+
</defs>
|
|
773
|
+
`, i.appendChild(u);
|
|
774
|
+
function w() {
|
|
775
|
+
i.remove(), v.remove(), s == null || s.remove();
|
|
776
|
+
}
|
|
777
|
+
function h() {
|
|
778
|
+
const m = u.querySelector("defs");
|
|
779
|
+
u.innerHTML = "", u.appendChild(m), n.forEach((x) => u.appendChild(z(x)));
|
|
780
|
+
}
|
|
781
|
+
function k() {
|
|
782
|
+
let m = 0, x = 0, g = 0;
|
|
783
|
+
return n.forEach((c) => {
|
|
784
|
+
if (c.type === "pen" && c.points.length) {
|
|
785
|
+
const y = c.points[c.points.length - 1];
|
|
786
|
+
m += y.x, x += y.y, g++;
|
|
787
|
+
} else c.type === "rect" ? (m += c.x + c.width, x += c.y + c.height, g++) : c.type === "circle" ? (m += c.cx, x += c.cy, g++) : c.type === "arrow" && (m += c.x2, x += c.y2, g++);
|
|
788
|
+
}), {
|
|
789
|
+
anchorX: g > 0 ? m / g - window.scrollX : window.innerWidth / 2,
|
|
790
|
+
anchorY: g > 0 ? x / g - window.scrollY : window.innerHeight / 2
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function E() {
|
|
794
|
+
i.style.pointerEvents = "none", v.style.pointerEvents = "none", f();
|
|
795
|
+
}
|
|
796
|
+
function f() {
|
|
797
|
+
s && s.remove();
|
|
798
|
+
const { anchorX: m, anchorY: x } = k(), g = 300, c = 12;
|
|
799
|
+
let y = m + c, S = x + c;
|
|
800
|
+
y + g > window.innerWidth - c && (y = m - g - c), y < c && (y = c), S + 210 > window.innerHeight - c && (S = window.innerHeight - 210 - c), S < c && (S = c), s = document.createElement("div"), s.style.cssText = `
|
|
801
|
+
position:fixed;left:${y}px;top:${S}px;z-index:2147483647;
|
|
802
|
+
background:#fff;border-radius:12px;padding:16px;width:${g}px;
|
|
803
|
+
box-shadow:0 4px 24px rgba(0,0,0,0.18);
|
|
804
|
+
display:flex;flex-direction:column;gap:10px;
|
|
805
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
806
|
+
`, s.innerHTML = `
|
|
807
|
+
<div style="font-size:13px;font-weight:600;color:#374151;">Add your comment</div>
|
|
808
|
+
<textarea id="ufp-inline-text" placeholder="Describe your feedback…" rows="3"
|
|
809
|
+
style="width:100%;padding:9px 12px;border:1.5px solid #e5e7eb;border-radius:8px;
|
|
810
|
+
font-size:13px;font-family:inherit;color:#111827;resize:none;
|
|
811
|
+
min-height:72px;outline:none;box-sizing:border-box;"></textarea>
|
|
812
|
+
<div style="display:flex;gap:6px;justify-content:flex-end;align-items:center;">
|
|
813
|
+
<button id="ufp-popup-cancel"
|
|
814
|
+
style="padding:7px 12px;border-radius:8px;font-size:13px;font-weight:500;
|
|
815
|
+
font-family:inherit;cursor:pointer;background:transparent;
|
|
816
|
+
border:1.5px solid #e5e7eb;color:#6b7280;">Cancel</button>
|
|
817
|
+
<button id="ufp-popup-submit" disabled
|
|
818
|
+
style="padding:7px 14px;border-radius:8px;font-size:13px;font-weight:600;
|
|
819
|
+
font-family:inherit;cursor:pointer;background:#6366f1;border:none;
|
|
820
|
+
color:#fff;opacity:0.45;transition:opacity 0.15s;">Submit</button>
|
|
821
|
+
</div>
|
|
822
|
+
`, e.appendChild(s);
|
|
823
|
+
const B = s.querySelector("#ufp-inline-text"), R = s.querySelector("#ufp-popup-submit"), G = s.querySelector("#ufp-popup-cancel");
|
|
824
|
+
B.addEventListener("input", () => {
|
|
825
|
+
const N = B.value.trim().length > 0;
|
|
826
|
+
R.disabled = !N, R.style.opacity = N ? "1" : "0.45";
|
|
827
|
+
}), R.addEventListener("click", () => {
|
|
828
|
+
const N = B.value.trim();
|
|
829
|
+
if (!N) return;
|
|
830
|
+
const V = k();
|
|
831
|
+
w(), t({ shapes: [...n], text: N, ...V });
|
|
832
|
+
}), G.addEventListener("click", () => {
|
|
833
|
+
w(), t(null);
|
|
834
|
+
}), requestAnimationFrame(() => B.focus());
|
|
835
|
+
}
|
|
836
|
+
const v = ae(
|
|
837
|
+
e,
|
|
838
|
+
(m) => {
|
|
839
|
+
r = m;
|
|
840
|
+
},
|
|
841
|
+
() => {
|
|
842
|
+
w(), t(null);
|
|
843
|
+
},
|
|
844
|
+
() => {
|
|
845
|
+
n.length !== 0 && (s && (s.remove(), s = null, i.style.pointerEvents = "auto", v.style.pointerEvents = "auto"), n.pop(), h());
|
|
846
|
+
}
|
|
847
|
+
);
|
|
848
|
+
e.appendChild(i), i.addEventListener("pointerdown", (m) => {
|
|
849
|
+
m.button === 0 && (i.setPointerCapture(m.pointerId), o = !0, a = m.clientX + window.scrollX, d = m.clientY + window.scrollY, r === "pen" && (l = [{ x: a, y: d }]));
|
|
850
|
+
}), i.addEventListener("pointermove", (m) => {
|
|
851
|
+
if (!o) return;
|
|
852
|
+
const x = m.clientX + window.scrollX, g = m.clientY + window.scrollY;
|
|
853
|
+
if (p && p.remove(), r === "pen")
|
|
854
|
+
l.push({ x, y: g }), p = z({ type: "pen", points: [...l], color: C, width: M });
|
|
855
|
+
else if (r === "rect") {
|
|
856
|
+
const c = { type: "rect", x: Math.min(a, x), y: Math.min(d, g), width: Math.abs(x - a), height: Math.abs(g - d), color: C, strokeWidth: M };
|
|
857
|
+
p = z(c);
|
|
858
|
+
} else if (r === "circle") {
|
|
859
|
+
const c = Math.abs(x - a) / 2, y = Math.abs(g - d) / 2, S = { type: "circle", cx: Math.min(a, x) + c, cy: Math.min(d, g) + y, rx: c, ry: y, color: C, strokeWidth: M };
|
|
860
|
+
p = z(S);
|
|
861
|
+
} else r === "arrow" && (p = z({ type: "arrow", x1: a, y1: d, x2: x, y2: g, color: C, width: M }));
|
|
862
|
+
p && u.appendChild(p);
|
|
863
|
+
}), i.addEventListener("pointerup", (m) => {
|
|
864
|
+
if (!o) return;
|
|
865
|
+
o = !1, p && (p.remove(), p = null);
|
|
866
|
+
const x = m.clientX + window.scrollX, g = m.clientY + window.scrollY;
|
|
867
|
+
let c = !1;
|
|
868
|
+
if (r === "pen" && l.length > 1)
|
|
869
|
+
n.push({ type: "pen", points: [...l], color: C, width: M }), l = [], c = !0;
|
|
870
|
+
else if (r === "rect") {
|
|
871
|
+
const y = Math.abs(x - a), S = Math.abs(g - d);
|
|
872
|
+
y > 4 && S > 4 && (n.push({ type: "rect", x: Math.min(a, x), y: Math.min(d, g), width: y, height: S, color: C, strokeWidth: M }), c = !0);
|
|
873
|
+
} else if (r === "circle") {
|
|
874
|
+
const y = Math.abs(x - a) / 2, S = Math.abs(g - d) / 2;
|
|
875
|
+
y > 4 && S > 4 && (n.push({ type: "circle", cx: Math.min(a, x) + y, cy: Math.min(d, g) + S, rx: y, ry: S, color: C, strokeWidth: M }), c = !0);
|
|
876
|
+
} else r === "arrow" && Math.sqrt((x - a) ** 2 + (g - d) ** 2) > 10 && (n.push({ type: "arrow", x1: a, y1: d, x2: x, y2: g, color: C, width: M }), c = !0);
|
|
877
|
+
c && (h(), E());
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
function ae(e, t, r, n) {
|
|
882
|
+
const o = document.createElement("div");
|
|
883
|
+
return o.className = "ufp-toolbar", o.innerHTML = `
|
|
884
|
+
<span class="ufp-toolbar-label">Draw to annotate</span>
|
|
885
|
+
<div class="ufp-toolbar-sep"></div>
|
|
886
|
+
<button class="ufp-btn-icon active" data-tool="pen" title="Pen">
|
|
887
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
888
|
+
<path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
889
|
+
</svg>
|
|
890
|
+
</button>
|
|
891
|
+
<button class="ufp-btn-icon" data-tool="rect" title="Rectangle">
|
|
892
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>
|
|
893
|
+
</button>
|
|
894
|
+
<button class="ufp-btn-icon" data-tool="circle" title="Circle">
|
|
895
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg>
|
|
896
|
+
</button>
|
|
897
|
+
<button class="ufp-btn-icon" data-tool="arrow" title="Arrow">
|
|
898
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
899
|
+
<line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/>
|
|
900
|
+
</svg>
|
|
901
|
+
</button>
|
|
902
|
+
<div class="ufp-toolbar-sep"></div>
|
|
903
|
+
<button class="ufp-btn-icon" id="ufp-undo-btn" title="Undo last stroke">
|
|
904
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
905
|
+
<polyline points="9 14 4 9 9 4"/><path d="M20 20v-7a4 4 0 0 0-4-4H4"/>
|
|
906
|
+
</svg>
|
|
907
|
+
</button>
|
|
908
|
+
<div class="ufp-toolbar-sep"></div>
|
|
909
|
+
<button class="ufp-btn ufp-btn-ghost" id="ufp-cancel-btn">Cancel</button>
|
|
910
|
+
`, o.querySelectorAll("[data-tool]").forEach((a) => {
|
|
911
|
+
a.addEventListener("click", () => {
|
|
912
|
+
o.querySelectorAll("[data-tool]").forEach((d) => d.classList.remove("active")), a.classList.add("active"), t(a.dataset.tool);
|
|
913
|
+
});
|
|
914
|
+
}), o.querySelector("#ufp-undo-btn").addEventListener("click", n), o.querySelector("#ufp-cancel-btn").addEventListener("click", r), e.appendChild(o), o;
|
|
915
|
+
}
|
|
916
|
+
function W(e) {
|
|
917
|
+
const t = Date.now() - e, r = Math.floor(t / 1e3);
|
|
918
|
+
if (r < 60) return "just now";
|
|
919
|
+
const n = Math.floor(r / 60);
|
|
920
|
+
if (n < 60) return `${n}m ago`;
|
|
921
|
+
const o = Math.floor(n / 60);
|
|
922
|
+
if (o < 24) return `${o}h ago`;
|
|
923
|
+
const a = Math.floor(o / 24);
|
|
924
|
+
return a < 7 ? `${a}d ago` : new Date(e).toLocaleDateString();
|
|
925
|
+
}
|
|
926
|
+
function F(e) {
|
|
927
|
+
return e.split(" ").filter(Boolean).slice(0, 2).map((t) => t[0].toUpperCase()).join("");
|
|
928
|
+
}
|
|
929
|
+
function A(e) {
|
|
930
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
931
|
+
}
|
|
932
|
+
function se(e, t, r, n) {
|
|
933
|
+
let o = [...t];
|
|
934
|
+
const a = document.createElement("div");
|
|
935
|
+
a.className = "ufp-replies";
|
|
936
|
+
const d = (h) => {
|
|
937
|
+
const k = a.querySelector(".ufp-replies-list");
|
|
938
|
+
k && k.remove();
|
|
939
|
+
const E = document.createElement("div");
|
|
940
|
+
if (E.className = "ufp-replies-list", E.style.cssText = "display:flex;flex-direction:column;gap:12px;", h.length > 0) {
|
|
941
|
+
const f = document.createElement("div");
|
|
942
|
+
f.className = "ufp-replies-title", f.textContent = `${h.length} ${h.length === 1 ? "Reply" : "Replies"}`, E.appendChild(f), h.forEach((v) => {
|
|
943
|
+
const m = document.createElement("div");
|
|
944
|
+
m.className = "ufp-reply", m.innerHTML = `
|
|
945
|
+
<div class="ufp-reply-meta">
|
|
946
|
+
<div class="ufp-avatar" style="width:22px;height:22px;font-size:10px;">${F(v.authorName)}</div>
|
|
947
|
+
<span class="ufp-reply-author">${A(v.authorName)}</span>
|
|
948
|
+
<span class="ufp-reply-time">${W(v.createdAt)}</span>
|
|
949
|
+
</div>
|
|
950
|
+
<div class="ufp-reply-text">${A(v.text)}</div>
|
|
951
|
+
`, E.appendChild(m);
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
a.insertBefore(E, a.querySelector(".ufp-reply-input-area"));
|
|
955
|
+
}, l = document.createElement("div");
|
|
956
|
+
l.className = "ufp-reply-input-area";
|
|
957
|
+
const p = X();
|
|
958
|
+
l.innerHTML = `
|
|
959
|
+
<div class="ufp-reply-name-row">
|
|
960
|
+
<span class="ufp-reply-name-label">Replying as:</span>
|
|
961
|
+
<input
|
|
962
|
+
class="ufp-input"
|
|
963
|
+
id="ufp-reply-name"
|
|
964
|
+
type="text"
|
|
965
|
+
placeholder="Your name"
|
|
966
|
+
value="${A(p ?? "")}"
|
|
967
|
+
style="flex:1;"
|
|
968
|
+
/>
|
|
969
|
+
</div>
|
|
970
|
+
<textarea
|
|
971
|
+
class="ufp-textarea"
|
|
972
|
+
id="ufp-reply-text"
|
|
973
|
+
placeholder="Write a reply…"
|
|
974
|
+
rows="2"
|
|
975
|
+
style="min-height:60px;"
|
|
976
|
+
></textarea>
|
|
977
|
+
<div class="ufp-btn-row">
|
|
978
|
+
<button class="ufp-btn ufp-btn-primary" id="ufp-reply-submit" disabled style="font-size:13px;padding:7px 14px;">Reply</button>
|
|
979
|
+
</div>
|
|
980
|
+
`;
|
|
981
|
+
const s = l.querySelector("#ufp-reply-name"), i = l.querySelector("#ufp-reply-text"), u = l.querySelector("#ufp-reply-submit"), w = () => {
|
|
982
|
+
u.disabled = s.value.trim().length === 0 || i.value.trim().length === 0;
|
|
983
|
+
};
|
|
984
|
+
return s.addEventListener("input", w), i.addEventListener("input", w), u.addEventListener("click", async () => {
|
|
985
|
+
const h = s.value.trim(), k = i.value.trim();
|
|
986
|
+
if (!h || !k) return;
|
|
987
|
+
u.disabled = !0, u.textContent = "Sending…", Y(h);
|
|
988
|
+
const E = {
|
|
989
|
+
commentId: e,
|
|
990
|
+
authorName: h,
|
|
991
|
+
text: k,
|
|
992
|
+
createdAt: Date.now()
|
|
993
|
+
};
|
|
994
|
+
try {
|
|
995
|
+
const v = { id: await r.addReply(E), ...E };
|
|
996
|
+
i.value = "", u.textContent = "Reply", u.disabled = !0, o = [...o, v], d(o), n(v);
|
|
997
|
+
} catch (f) {
|
|
998
|
+
console.error("[ui-feedback-plugin] Failed to save reply:", f), u.disabled = !1, u.textContent = "Reply";
|
|
999
|
+
}
|
|
1000
|
+
}), a.appendChild(l), d(o), a.addReply = (h) => {
|
|
1001
|
+
o = [...o, h], d(o);
|
|
1002
|
+
}, a;
|
|
1003
|
+
}
|
|
1004
|
+
function le(e, t, r, n, o, a, d, l) {
|
|
1005
|
+
const p = document.createElement("div");
|
|
1006
|
+
p.className = "ufp-detail", p.innerHTML = `
|
|
1007
|
+
<div class="ufp-detail-image-area">
|
|
1008
|
+
<div class="ufp-detail-image-wrap">
|
|
1009
|
+
<img class="ufp-detail-screenshot" src="${t.screenshotUrl}" alt="Page screenshot" />
|
|
1010
|
+
<svg class="ufp-detail-annotation-svg" xmlns="http://www.w3.org/2000/svg">
|
|
1011
|
+
<defs>
|
|
1012
|
+
<marker id="ufp-detail-arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
|
|
1013
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="#6366f1" />
|
|
1014
|
+
</marker>
|
|
1015
|
+
</defs>
|
|
1016
|
+
</svg>
|
|
1017
|
+
</div>
|
|
1018
|
+
</div>
|
|
1019
|
+
<div class="ufp-detail-sidebar">
|
|
1020
|
+
<div class="ufp-detail-header">
|
|
1021
|
+
<button id="ufp-detail-back" style="
|
|
1022
|
+
display:flex;align-items:center;gap:6px;
|
|
1023
|
+
background:none;border:none;cursor:pointer;
|
|
1024
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
1025
|
+
font-size:13px;font-weight:600;color:#6b7280;padding:4px 0;
|
|
1026
|
+
">
|
|
1027
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
1028
|
+
<polyline points="15 18 9 12 15 6"/>
|
|
1029
|
+
</svg>
|
|
1030
|
+
Back to comments
|
|
1031
|
+
</button>
|
|
1032
|
+
${t.resolved ? '<span class="ufp-resolved-badge">Resolved</span>' : ""}
|
|
1033
|
+
</div>
|
|
1034
|
+
<div class="ufp-detail-body">
|
|
1035
|
+
<div class="ufp-detail-comment">
|
|
1036
|
+
<div class="ufp-comment-meta">
|
|
1037
|
+
<div class="ufp-avatar">${F(t.authorName)}</div>
|
|
1038
|
+
<div>
|
|
1039
|
+
<div class="ufp-comment-author">${A(t.authorName)}</div>
|
|
1040
|
+
<div class="ufp-comment-time">${W(t.createdAt)}</div>
|
|
1041
|
+
</div>
|
|
1042
|
+
</div>
|
|
1043
|
+
<div class="ufp-detail-comment-text">${A(t.text)}</div>
|
|
1044
|
+
<div class="ufp-detail-actions" id="ufp-detail-actions"></div>
|
|
1045
|
+
</div>
|
|
1046
|
+
<div id="ufp-detail-replies"></div>
|
|
1047
|
+
</div>
|
|
1048
|
+
</div>
|
|
1049
|
+
`, e.appendChild(p), p.querySelector("#ufp-detail-back").addEventListener("click", () => {
|
|
1050
|
+
p.remove(), b({ panelOpen: !0 });
|
|
1051
|
+
});
|
|
1052
|
+
const s = p.querySelector("#ufp-detail-actions");
|
|
1053
|
+
if (t.resolved) {
|
|
1054
|
+
const f = document.createElement("button");
|
|
1055
|
+
f.className = "ufp-btn ufp-btn-ghost", f.style.fontSize = "13px", f.innerHTML = `
|
|
1056
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
|
1057
|
+
style="vertical-align:middle;margin-right:4px"><polyline points="9 14 4 9 9 4"/><path d="M20 20v-7a4 4 0 0 0-4-4H4"/></svg>
|
|
1058
|
+
Reopen
|
|
1059
|
+
`, f.addEventListener("click", async () => {
|
|
1060
|
+
f.disabled = !0, f.textContent = "Reopening…", await n.updateComment(t.id, { resolved: !1 }), a(t.id), p.remove(), b({ panelOpen: !0 });
|
|
1061
|
+
}), s.appendChild(f);
|
|
1062
|
+
} else {
|
|
1063
|
+
const f = document.createElement("button");
|
|
1064
|
+
f.className = "ufp-btn ufp-btn-primary", f.style.fontSize = "13px", f.innerHTML = `
|
|
1065
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"
|
|
1066
|
+
style="vertical-align:middle;margin-right:4px"><polyline points="20 6 9 17 4 12"/></svg>
|
|
1067
|
+
Mark Resolved
|
|
1068
|
+
`, f.addEventListener("click", async () => {
|
|
1069
|
+
f.disabled = !0, f.textContent = "Resolving…", await n.updateComment(t.id, { resolved: !0 }), o(t.id), p.remove(), b({ panelOpen: !0 });
|
|
1070
|
+
}), s.appendChild(f);
|
|
1071
|
+
}
|
|
1072
|
+
const i = document.createElement("button");
|
|
1073
|
+
i.className = "ufp-btn ufp-btn-ghost", i.style.fontSize = "13px", i.textContent = "Delete", i.addEventListener("click", async () => {
|
|
1074
|
+
confirm("Delete this comment and all its replies?") && (i.disabled = !0, await n.deleteComment(t.id), d(t.id), p.remove(), b({ panelOpen: !0 }));
|
|
1075
|
+
}), s.appendChild(i);
|
|
1076
|
+
const u = p.querySelector("#ufp-detail-replies"), w = se(t.id, r, n, (f) => {
|
|
1077
|
+
var v;
|
|
1078
|
+
(v = w.addReply) == null || v.call(w, f), l == null || l(f);
|
|
1079
|
+
});
|
|
1080
|
+
u.appendChild(w);
|
|
1081
|
+
const h = p.querySelector(".ufp-detail-screenshot"), k = p.querySelector(".ufp-detail-annotation-svg"), E = () => {
|
|
1082
|
+
const f = h.clientWidth, v = h.clientHeight;
|
|
1083
|
+
k.setAttribute("viewBox", `0 0 ${f} ${v}`), re(k, t.annotation, f, v), k.querySelectorAll("[marker-end]").forEach((m) => {
|
|
1084
|
+
m.setAttribute("marker-end", "url(#ufp-detail-arrowhead)");
|
|
1085
|
+
});
|
|
1086
|
+
};
|
|
1087
|
+
h.complete && h.naturalWidth > 0 ? E() : h.addEventListener("load", E);
|
|
1088
|
+
}
|
|
1089
|
+
function pe(e, t, r) {
|
|
1090
|
+
const n = document.createElement("div");
|
|
1091
|
+
n.className = "ufp-panel", n.innerHTML = `
|
|
1092
|
+
<div class="ufp-panel-header">
|
|
1093
|
+
<span class="ufp-panel-title">Feedback</span>
|
|
1094
|
+
<div style="display:flex;gap:8px;align-items:center;">
|
|
1095
|
+
<button id="ufp-new-feedback" class="ufp-btn ufp-btn-primary" style="font-size:13px;padding:7px 14px;display:flex;align-items:center;gap:5px;">
|
|
1096
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
|
1097
|
+
New
|
|
1098
|
+
</button>
|
|
1099
|
+
<button class="ufp-btn-icon" id="ufp-panel-close" title="Close panel">
|
|
1100
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1101
|
+
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
|
1102
|
+
</svg>
|
|
1103
|
+
</button>
|
|
1104
|
+
</div>
|
|
1105
|
+
</div>
|
|
1106
|
+
<div class="ufp-filter-tabs">
|
|
1107
|
+
<button class="ufp-filter-tab active" data-filter="open">Open</button>
|
|
1108
|
+
<button class="ufp-filter-tab" data-filter="resolved">Resolved</button>
|
|
1109
|
+
</div>
|
|
1110
|
+
<div class="ufp-panel-list" id="ufp-comment-list"></div>
|
|
1111
|
+
`, e.appendChild(n), n.querySelector("#ufp-panel-close").addEventListener("click", () => {
|
|
1112
|
+
b({ panelOpen: !1 });
|
|
1113
|
+
}), n.querySelector("#ufp-new-feedback").addEventListener("click", () => {
|
|
1114
|
+
b({ panelOpen: !1 }), r();
|
|
1115
|
+
}), n.querySelectorAll(".ufp-filter-tab").forEach((l) => {
|
|
1116
|
+
l.addEventListener("click", () => {
|
|
1117
|
+
n.querySelectorAll(".ufp-filter-tab").forEach((p) => p.classList.remove("active")), l.classList.add("active"), b({ filter: l.dataset.filter });
|
|
1118
|
+
});
|
|
1119
|
+
});
|
|
1120
|
+
const o = n.querySelector("#ufp-comment-list"), a = /* @__PURE__ */ new Map(), d = async (l, p) => {
|
|
1121
|
+
const s = l.filter((i) => p === "open" ? !i.resolved : i.resolved);
|
|
1122
|
+
if (o.innerHTML = "", s.length === 0) {
|
|
1123
|
+
o.innerHTML = `
|
|
1124
|
+
<div class="ufp-panel-empty">
|
|
1125
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" opacity="0.4">
|
|
1126
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
|
1127
|
+
</svg>
|
|
1128
|
+
<span>No ${p} comments yet</span>
|
|
1129
|
+
${p === "open" ? '<span style="font-size:12px;color:#9ca3af;">Click <strong>New</strong> to add feedback</span>' : ""}
|
|
1130
|
+
</div>
|
|
1131
|
+
`;
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
for (const i of s) {
|
|
1135
|
+
if (!a.has(i.id))
|
|
1136
|
+
try {
|
|
1137
|
+
a.set(i.id, await t.getReplies(i.id));
|
|
1138
|
+
} catch {
|
|
1139
|
+
a.set(i.id, []);
|
|
1140
|
+
}
|
|
1141
|
+
o.appendChild(
|
|
1142
|
+
de(i, a, e, t)
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
return P(async (l) => {
|
|
1147
|
+
n.classList.toggle("open", l.panelOpen), l.panelOpen && await d(l.comments, l.filter);
|
|
1148
|
+
}), n;
|
|
1149
|
+
}
|
|
1150
|
+
function de(e, t, r, n, o) {
|
|
1151
|
+
const a = t.get(e.id) ?? [], d = document.createElement("div");
|
|
1152
|
+
return d.className = "ufp-comment-card", d.dataset.id = e.id, d.innerHTML = `
|
|
1153
|
+
<div class="ufp-comment-card-header">
|
|
1154
|
+
<div class="ufp-comment-meta">
|
|
1155
|
+
<div class="ufp-avatar">${F(e.authorName)}</div>
|
|
1156
|
+
<div>
|
|
1157
|
+
<div class="ufp-comment-author">${A(e.authorName)}</div>
|
|
1158
|
+
<div class="ufp-comment-time">${W(e.createdAt)}</div>
|
|
1159
|
+
</div>
|
|
1160
|
+
</div>
|
|
1161
|
+
${e.resolved ? '<span class="ufp-resolved-badge">Resolved</span>' : ""}
|
|
1162
|
+
</div>
|
|
1163
|
+
<img class="ufp-comment-thumbnail" src="${e.screenshotUrl}" alt="Screenshot" loading="lazy" />
|
|
1164
|
+
<div class="ufp-comment-text">${A(e.text)}</div>
|
|
1165
|
+
<div class="ufp-comment-footer">
|
|
1166
|
+
<span class="ufp-reply-count">
|
|
1167
|
+
${a.length > 0 ? `${a.length} ${a.length === 1 ? "reply" : "replies"}` : "No replies yet — click to reply"}
|
|
1168
|
+
</span>
|
|
1169
|
+
</div>
|
|
1170
|
+
`, d.addEventListener("click", async () => {
|
|
1171
|
+
let l = t.get(e.id) ?? [];
|
|
1172
|
+
try {
|
|
1173
|
+
l = await n.getReplies(e.id), t.set(e.id, l);
|
|
1174
|
+
} catch (p) {
|
|
1175
|
+
console.error("[ui-feedback-plugin] Failed to fetch replies:", p);
|
|
1176
|
+
}
|
|
1177
|
+
le(
|
|
1178
|
+
r,
|
|
1179
|
+
e,
|
|
1180
|
+
l,
|
|
1181
|
+
n,
|
|
1182
|
+
(p) => {
|
|
1183
|
+
const s = L();
|
|
1184
|
+
b({ comments: s.comments.map((i) => i.id === p ? { ...i, resolved: !0 } : i) });
|
|
1185
|
+
},
|
|
1186
|
+
(p) => {
|
|
1187
|
+
const s = L();
|
|
1188
|
+
b({ comments: s.comments.map((i) => i.id === p ? { ...i, resolved: !1 } : i) });
|
|
1189
|
+
},
|
|
1190
|
+
(p) => {
|
|
1191
|
+
const s = L();
|
|
1192
|
+
b({ comments: s.comments.filter((i) => i.id !== p) }), t.delete(p);
|
|
1193
|
+
},
|
|
1194
|
+
// When a reply is added in the detail view, update badge count immediately
|
|
1195
|
+
(p) => {
|
|
1196
|
+
const s = t.get(e.id) ?? [];
|
|
1197
|
+
t.set(e.id, [...s, p]);
|
|
1198
|
+
const i = L();
|
|
1199
|
+
b({ comments: [...i.comments] });
|
|
1200
|
+
}
|
|
1201
|
+
);
|
|
1202
|
+
}), d;
|
|
1203
|
+
}
|
|
1204
|
+
async function ce() {
|
|
1205
|
+
try {
|
|
1206
|
+
const e = await ue();
|
|
1207
|
+
return await fe(e);
|
|
1208
|
+
} catch {
|
|
1209
|
+
return me();
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
async function ue() {
|
|
1213
|
+
return (await import("./html2canvas.esm-d2sM-0Wm.mjs")).default;
|
|
1214
|
+
}
|
|
1215
|
+
async function fe(e) {
|
|
1216
|
+
const t = window.scrollX, r = window.scrollY;
|
|
1217
|
+
window.scrollTo(0, 0);
|
|
1218
|
+
try {
|
|
1219
|
+
return (await e(document.body, {
|
|
1220
|
+
allowTaint: !0,
|
|
1221
|
+
useCORS: !0,
|
|
1222
|
+
logging: !1,
|
|
1223
|
+
scale: Math.min(window.devicePixelRatio, 2),
|
|
1224
|
+
width: document.documentElement.scrollWidth,
|
|
1225
|
+
height: document.documentElement.scrollHeight,
|
|
1226
|
+
windowWidth: document.documentElement.scrollWidth,
|
|
1227
|
+
windowHeight: document.documentElement.scrollHeight,
|
|
1228
|
+
x: 0,
|
|
1229
|
+
y: 0,
|
|
1230
|
+
ignoreElements: (o) => o.tagName === "UI-FEEDBACK-PLUGIN"
|
|
1231
|
+
})).toDataURL("image/png");
|
|
1232
|
+
} finally {
|
|
1233
|
+
window.scrollTo(t, r);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
function me() {
|
|
1237
|
+
const e = document.createElement("canvas");
|
|
1238
|
+
e.width = window.innerWidth, e.height = window.innerHeight;
|
|
1239
|
+
const t = e.getContext("2d");
|
|
1240
|
+
return t.fillStyle = "#f3f4f6", t.fillRect(0, 0, e.width, e.height), t.fillStyle = "#9ca3af", t.font = "16px -apple-system, sans-serif", t.textAlign = "center", t.fillText("Screenshot unavailable", e.width / 2, e.height / 2), e.toDataURL("image/png");
|
|
1241
|
+
}
|
|
1242
|
+
const q = "ui-feedback-plugin";
|
|
1243
|
+
async function he(e) {
|
|
1244
|
+
const t = e.database;
|
|
1245
|
+
if (t.provider === "firebase") {
|
|
1246
|
+
const { FirebaseAdapter: r } = await import("./firebase-BGU5KpRU.mjs");
|
|
1247
|
+
return new r(t);
|
|
1248
|
+
}
|
|
1249
|
+
if (t.provider === "supabase") {
|
|
1250
|
+
const { SupabaseAdapter: r } = await import("./supabase-BUHP2OkK.mjs");
|
|
1251
|
+
return new r(t.url, t.anonKey);
|
|
1252
|
+
}
|
|
1253
|
+
throw new Error("[ui-feedback-plugin] Unknown database provider");
|
|
1254
|
+
}
|
|
1255
|
+
async function ge(e, t) {
|
|
1256
|
+
const r = e.screenshots;
|
|
1257
|
+
if (!r)
|
|
1258
|
+
return t;
|
|
1259
|
+
if (r.provider === "s3") {
|
|
1260
|
+
const { S3ScreenshotAdapter: n } = await import("./s3-DkzKoz0A.mjs");
|
|
1261
|
+
return new n(r.uploadEndpoint, r.headers);
|
|
1262
|
+
}
|
|
1263
|
+
if (r.provider === "firebase") {
|
|
1264
|
+
if (e.database.provider !== "firebase")
|
|
1265
|
+
throw new Error('[ui-feedback-plugin] screenshots.provider "firebase" requires database.provider "firebase"');
|
|
1266
|
+
return t;
|
|
1267
|
+
}
|
|
1268
|
+
if (r.provider === "supabase") {
|
|
1269
|
+
if (e.database.provider !== "supabase")
|
|
1270
|
+
throw new Error('[ui-feedback-plugin] screenshots.provider "supabase" requires database.provider "supabase"');
|
|
1271
|
+
return t;
|
|
1272
|
+
}
|
|
1273
|
+
throw new Error("[ui-feedback-plugin] Unknown screenshot storage provider");
|
|
1274
|
+
}
|
|
1275
|
+
function be(e) {
|
|
1276
|
+
var d;
|
|
1277
|
+
if (customElements.get(q))
|
|
1278
|
+
return console.warn("[ui-feedback-plugin] Already initialized."), () => {
|
|
1279
|
+
};
|
|
1280
|
+
const t = ((d = e.theme) == null ? void 0 : d.primaryColor) ?? "#6366f1", r = e.projectKey ?? "default", n = e.position ?? "bottom-right";
|
|
1281
|
+
b({ config: e });
|
|
1282
|
+
class o extends HTMLElement {
|
|
1283
|
+
constructor() {
|
|
1284
|
+
super();
|
|
1285
|
+
H(this, "shadow");
|
|
1286
|
+
H(this, "dbAdapter");
|
|
1287
|
+
H(this, "screenshotAdapter");
|
|
1288
|
+
H(this, "unsubscribe", null);
|
|
1289
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
1290
|
+
}
|
|
1291
|
+
async connectedCallback() {
|
|
1292
|
+
const s = document.createElement("style");
|
|
1293
|
+
s.textContent = Q(t), this.shadow.appendChild(s);
|
|
1294
|
+
try {
|
|
1295
|
+
this.dbAdapter = await he(e), this.screenshotAdapter = await ge(e, this.dbAdapter);
|
|
1296
|
+
} catch (i) {
|
|
1297
|
+
console.error("[ui-feedback-plugin] Failed to initialize adapters:", i);
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
this.mount();
|
|
1301
|
+
}
|
|
1302
|
+
disconnectedCallback() {
|
|
1303
|
+
var s;
|
|
1304
|
+
(s = this.unsubscribe) == null || s.call(this);
|
|
1305
|
+
}
|
|
1306
|
+
mount() {
|
|
1307
|
+
const s = U(window.location.href);
|
|
1308
|
+
pe(this.shadow, this.dbAdapter, () => this.startAnnotation()), ee(
|
|
1309
|
+
this.shadow,
|
|
1310
|
+
n,
|
|
1311
|
+
() => this.startAnnotation(),
|
|
1312
|
+
() => b({ panelOpen: !L().panelOpen })
|
|
1313
|
+
), this.unsubscribe = this.dbAdapter.subscribeToComments(s, r, (i) => {
|
|
1314
|
+
b({ comments: i });
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
async startAnnotation() {
|
|
1318
|
+
let s = X();
|
|
1319
|
+
if (!s && (s = await ne(this.shadow), !s))
|
|
1320
|
+
return;
|
|
1321
|
+
b({ active: !0, panelOpen: !1 });
|
|
1322
|
+
const i = await ie(this.shadow);
|
|
1323
|
+
if (!i) {
|
|
1324
|
+
b({ active: !1 });
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
b({ active: !1 }), this.showToast("Saving comment…", "info");
|
|
1328
|
+
try {
|
|
1329
|
+
await this.saveComment(s, i.text, i.shapes), this.showToast("Comment saved!", "success");
|
|
1330
|
+
} catch (u) {
|
|
1331
|
+
console.error("[ui-feedback-plugin] Failed to save comment:", u), this.showToast("Failed to save — check the browser console for details.", "error");
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
b({ panelOpen: !0 });
|
|
1335
|
+
}
|
|
1336
|
+
async saveComment(s, i, u) {
|
|
1337
|
+
const w = U(window.location.href), h = {
|
|
1338
|
+
shapes: u,
|
|
1339
|
+
pageWidth: document.documentElement.scrollWidth,
|
|
1340
|
+
pageHeight: document.documentElement.scrollHeight
|
|
1341
|
+
};
|
|
1342
|
+
this.style.visibility = "hidden";
|
|
1343
|
+
let k;
|
|
1344
|
+
try {
|
|
1345
|
+
k = await ce();
|
|
1346
|
+
} finally {
|
|
1347
|
+
this.style.visibility = "";
|
|
1348
|
+
}
|
|
1349
|
+
const E = {
|
|
1350
|
+
pageUrl: w,
|
|
1351
|
+
projectKey: r,
|
|
1352
|
+
authorName: s,
|
|
1353
|
+
text: i,
|
|
1354
|
+
screenshotUrl: "",
|
|
1355
|
+
annotation: h,
|
|
1356
|
+
resolved: !1,
|
|
1357
|
+
createdAt: Date.now()
|
|
1358
|
+
}, f = await this.dbAdapter.addComment(E), v = await this.screenshotAdapter.uploadScreenshot(f, k);
|
|
1359
|
+
await this.dbAdapter.updateComment(f, { screenshotUrl: v });
|
|
1360
|
+
}
|
|
1361
|
+
showToast(s, i) {
|
|
1362
|
+
const u = this.shadow.querySelector(".ufp-toast");
|
|
1363
|
+
u == null || u.remove();
|
|
1364
|
+
const w = { info: "#6366f1", success: "#10b981", error: "#ef4444" }, h = document.createElement("div");
|
|
1365
|
+
h.className = "ufp-toast", h.style.cssText = `
|
|
1366
|
+
position:fixed;bottom:80px;left:50%;transform:translateX(-50%);
|
|
1367
|
+
background:${w[i]};color:white;padding:10px 20px;border-radius:8px;
|
|
1368
|
+
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
|
1369
|
+
font-size:13px;font-weight:500;z-index:2147483647;
|
|
1370
|
+
box-shadow:0 4px 12px rgba(0,0,0,0.2);pointer-events:none;
|
|
1371
|
+
max-width:360px;text-align:center;
|
|
1372
|
+
`, h.textContent = s, this.shadow.appendChild(h), setTimeout(() => h.remove(), i === "error" ? 6e3 : 2500);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
customElements.define(q, o);
|
|
1376
|
+
const a = document.createElement(q);
|
|
1377
|
+
return document.body.appendChild(a), () => a.remove();
|
|
1378
|
+
}
|
|
1379
|
+
export {
|
|
1380
|
+
be as initFeedbackPlugin
|
|
1381
|
+
};
|
|
1382
|
+
//# sourceMappingURL=ui-feedback-plugin.es.js.map
|