@agent-native/pinpoint 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/pinpoint/SKILL.md +77 -0
- package/README.md +408 -0
- package/dist/agent-context-76ZW6ODH.js +13 -0
- package/dist/agent-context-76ZW6ODH.js.map +1 -0
- package/dist/chunk-5OW42OKO.js +4897 -0
- package/dist/chunk-5OW42OKO.js.map +1 -0
- package/dist/chunk-BB7X7W3H.js +94 -0
- package/dist/chunk-BB7X7W3H.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/chunk-EPXBFDY6.js +88 -0
- package/dist/chunk-EPXBFDY6.js.map +1 -0
- package/dist/chunk-JCYY4S7A.js +53 -0
- package/dist/chunk-JCYY4S7A.js.map +1 -0
- package/dist/chunk-W7IKAJ3P.js +569 -0
- package/dist/chunk-W7IKAJ3P.js.map +1 -0
- package/dist/chunk-Y7IWDHIU.js +25 -0
- package/dist/chunk-Y7IWDHIU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +71 -0
- package/dist/cli.js.map +1 -0
- package/dist/formatter-25JPHXYA.js +8 -0
- package/dist/formatter-25JPHXYA.js.map +1 -0
- package/dist/index-5or67wLi.d.ts +193 -0
- package/dist/index-CJGmgMCD.d.ts +79 -0
- package/dist/index.browser.d.ts +381 -0
- package/dist/index.browser.js +657 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +269 -0
- package/dist/index.js +973 -0
- package/dist/index.js.map +1 -0
- package/dist/open-file-RQVHOCXI.js +8 -0
- package/dist/open-file-RQVHOCXI.js.map +1 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +28 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/react.d.ts +23 -0
- package/dist/react.js +20 -0
- package/dist/react.js.map +1 -0
- package/dist/server/index.d.ts +161 -0
- package/dist/server/index.js +457 -0
- package/dist/server/index.js.map +1 -0
- package/dist/types/index.d.ts +193 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +83 -0
- package/src/scripts/create-pin.ts +41 -0
- package/src/scripts/delete-pin.ts +15 -0
- package/src/scripts/get-pins.ts +35 -0
- package/src/scripts/list-sessions.ts +33 -0
- package/src/scripts/resolve-pin.ts +26 -0
- package/src/scripts/run.ts +8 -0
- package/src/scripts/update-pin.ts +31 -0
|
@@ -0,0 +1,4897 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/storage/memory-store.ts
|
|
4
|
+
var MemoryStore = class {
|
|
5
|
+
pins = /* @__PURE__ */ new Map();
|
|
6
|
+
async load(pageUrl) {
|
|
7
|
+
return Array.from(this.pins.values()).filter(
|
|
8
|
+
(pin) => pin.pageUrl === pageUrl
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
async save(pin) {
|
|
12
|
+
this.pins.set(pin.id, { ...pin });
|
|
13
|
+
}
|
|
14
|
+
async update(id, patch) {
|
|
15
|
+
const existing = this.pins.get(id);
|
|
16
|
+
if (!existing) return;
|
|
17
|
+
this.pins.set(id, {
|
|
18
|
+
...existing,
|
|
19
|
+
...patch,
|
|
20
|
+
id: existing.id,
|
|
21
|
+
// never overwrite ID
|
|
22
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async delete(id) {
|
|
26
|
+
this.pins.delete(id);
|
|
27
|
+
}
|
|
28
|
+
async list(filter) {
|
|
29
|
+
let result = Array.from(this.pins.values());
|
|
30
|
+
if (filter?.pageUrl) {
|
|
31
|
+
result = result.filter((pin) => pin.pageUrl === filter.pageUrl);
|
|
32
|
+
}
|
|
33
|
+
if (filter?.status) {
|
|
34
|
+
result = result.filter((pin) => pin.status.state === filter.status);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
async clear(pageUrl) {
|
|
39
|
+
if (pageUrl) {
|
|
40
|
+
for (const [id, pin] of this.pins) {
|
|
41
|
+
if (pin.pageUrl === pageUrl) {
|
|
42
|
+
this.pins.delete(id);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
this.pins.clear();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/storage/schemas.ts
|
|
52
|
+
import { z } from "zod";
|
|
53
|
+
var ElementInfoSchema = z.object({
|
|
54
|
+
tagName: z.string(),
|
|
55
|
+
id: z.string().optional(),
|
|
56
|
+
classNames: z.array(z.string()),
|
|
57
|
+
selector: z.string(),
|
|
58
|
+
textContent: z.string().optional(),
|
|
59
|
+
boundingRect: z.object({
|
|
60
|
+
x: z.number(),
|
|
61
|
+
y: z.number(),
|
|
62
|
+
width: z.number(),
|
|
63
|
+
height: z.number()
|
|
64
|
+
}),
|
|
65
|
+
computedStyles: z.record(z.string(), z.string()).optional(),
|
|
66
|
+
ariaAttributes: z.record(z.string(), z.string()).optional(),
|
|
67
|
+
dataAttributes: z.record(z.string(), z.string()).optional(),
|
|
68
|
+
domPath: z.string().optional()
|
|
69
|
+
});
|
|
70
|
+
var FrameworkInfoSchema = z.object({
|
|
71
|
+
framework: z.string(),
|
|
72
|
+
componentPath: z.string(),
|
|
73
|
+
sourceFile: z.string().optional(),
|
|
74
|
+
frameworkVersion: z.string().optional()
|
|
75
|
+
});
|
|
76
|
+
var PinStatusSchema = z.enum([
|
|
77
|
+
"open",
|
|
78
|
+
"acknowledged",
|
|
79
|
+
"resolved",
|
|
80
|
+
"dismissed"
|
|
81
|
+
]);
|
|
82
|
+
var PinSchema = z.object({
|
|
83
|
+
id: z.string().uuid(),
|
|
84
|
+
pageUrl: z.string(),
|
|
85
|
+
createdAt: z.string().datetime(),
|
|
86
|
+
updatedAt: z.string().datetime(),
|
|
87
|
+
author: z.string().optional(),
|
|
88
|
+
comment: z.string(),
|
|
89
|
+
element: ElementInfoSchema,
|
|
90
|
+
framework: FrameworkInfoSchema.optional(),
|
|
91
|
+
status: z.object({
|
|
92
|
+
state: PinStatusSchema,
|
|
93
|
+
changedAt: z.string().datetime(),
|
|
94
|
+
changedBy: z.string().optional()
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// src/storage/rest-client.ts
|
|
99
|
+
var RestClient = class {
|
|
100
|
+
constructor(endpoint) {
|
|
101
|
+
this.endpoint = endpoint;
|
|
102
|
+
this.endpoint = endpoint.replace(/\/+$/, "");
|
|
103
|
+
}
|
|
104
|
+
endpoint;
|
|
105
|
+
async load(pageUrl) {
|
|
106
|
+
const params = new URLSearchParams({ pageUrl });
|
|
107
|
+
const res = await fetch(`${this.endpoint}?${params}`);
|
|
108
|
+
if (!res.ok) return [];
|
|
109
|
+
const data = await res.json();
|
|
110
|
+
return Array.isArray(data) ? data.filter((item) => PinSchema.safeParse(item).success) : [];
|
|
111
|
+
}
|
|
112
|
+
async save(pin) {
|
|
113
|
+
const res = await fetch(this.endpoint, {
|
|
114
|
+
method: "POST",
|
|
115
|
+
headers: { "Content-Type": "application/json" },
|
|
116
|
+
body: JSON.stringify(pin)
|
|
117
|
+
});
|
|
118
|
+
if (!res.ok) throw new Error(`Failed to save pin: ${res.status}`);
|
|
119
|
+
}
|
|
120
|
+
async update(id, patch) {
|
|
121
|
+
const res = await fetch(`${this.endpoint}/${encodeURIComponent(id)}`, {
|
|
122
|
+
method: "PATCH",
|
|
123
|
+
headers: { "Content-Type": "application/json" },
|
|
124
|
+
body: JSON.stringify(patch)
|
|
125
|
+
});
|
|
126
|
+
if (!res.ok) throw new Error(`Failed to update pin: ${res.status}`);
|
|
127
|
+
}
|
|
128
|
+
async delete(id) {
|
|
129
|
+
const res = await fetch(`${this.endpoint}/${encodeURIComponent(id)}`, {
|
|
130
|
+
method: "DELETE"
|
|
131
|
+
});
|
|
132
|
+
if (!res.ok) throw new Error(`Failed to delete pin: ${res.status}`);
|
|
133
|
+
}
|
|
134
|
+
async list(filter) {
|
|
135
|
+
const params = new URLSearchParams();
|
|
136
|
+
if (filter?.pageUrl) params.set("pageUrl", filter.pageUrl);
|
|
137
|
+
if (filter?.status) params.set("status", filter.status);
|
|
138
|
+
const res = await fetch(`${this.endpoint}?${params}`);
|
|
139
|
+
if (!res.ok) return [];
|
|
140
|
+
const data = await res.json();
|
|
141
|
+
return Array.isArray(data) ? data.filter((item) => PinSchema.safeParse(item).success) : [];
|
|
142
|
+
}
|
|
143
|
+
async clear(pageUrl) {
|
|
144
|
+
const params = new URLSearchParams();
|
|
145
|
+
if (pageUrl) params.set("pageUrl", pageUrl);
|
|
146
|
+
const res = await fetch(`${this.endpoint}?${params}`, { method: "DELETE" });
|
|
147
|
+
if (!res.ok) throw new Error(`Failed to clear pins: ${res.status}`);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// src/detection/element-picker.ts
|
|
152
|
+
var ElementPicker = class {
|
|
153
|
+
active = false;
|
|
154
|
+
paused = false;
|
|
155
|
+
hoveredElement = null;
|
|
156
|
+
rafId = null;
|
|
157
|
+
stableTimeout = null;
|
|
158
|
+
lastTarget = null;
|
|
159
|
+
options;
|
|
160
|
+
handleMouseMove;
|
|
161
|
+
handleClick;
|
|
162
|
+
handleKeyDown;
|
|
163
|
+
constructor(options = {}) {
|
|
164
|
+
this.options = options;
|
|
165
|
+
this.handleMouseMove = (e) => {
|
|
166
|
+
if (!this.active || this.paused) return;
|
|
167
|
+
if (this.isOwnUI(e)) return;
|
|
168
|
+
if (this.rafId !== null) return;
|
|
169
|
+
this.rafId = requestAnimationFrame(() => {
|
|
170
|
+
this.rafId = null;
|
|
171
|
+
this.processHover(e.clientX, e.clientY);
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
this.handleClick = (e) => {
|
|
175
|
+
if (!this.active || this.paused) return;
|
|
176
|
+
if (this.isOwnUI(e)) return;
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
e.stopImmediatePropagation();
|
|
180
|
+
const target = this.hoveredElement;
|
|
181
|
+
if (target && !this.shouldIgnore(target)) {
|
|
182
|
+
this.options.onSelect?.(target);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
this.handleKeyDown = (e) => {
|
|
186
|
+
if (!this.active) return;
|
|
187
|
+
if (e.key === "Escape") {
|
|
188
|
+
this.deactivate();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Check if an event originates from Pinpoint's own UI.
|
|
194
|
+
* Uses composedPath() to cross Shadow DOM boundaries.
|
|
195
|
+
*/
|
|
196
|
+
isOwnUI(e) {
|
|
197
|
+
const path = e.composedPath();
|
|
198
|
+
for (const node of path) {
|
|
199
|
+
if (node instanceof HTMLElement) {
|
|
200
|
+
if (node.id === "pinpoint-root") return true;
|
|
201
|
+
if (node.hasAttribute?.("data-pinpoint-marker")) return true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
shouldIgnore(element) {
|
|
207
|
+
const root = element.getRootNode();
|
|
208
|
+
if (root instanceof ShadowRoot) {
|
|
209
|
+
const host = root.host;
|
|
210
|
+
if (host.id === "pinpoint-root") return true;
|
|
211
|
+
}
|
|
212
|
+
if (element.hasAttribute("data-pinpoint-marker")) return true;
|
|
213
|
+
if (element.closest?.("[data-pinpoint-marker]")) return true;
|
|
214
|
+
if (!this.options.ignoreSelector) return false;
|
|
215
|
+
return element.closest(this.options.ignoreSelector) !== null || element.matches(this.options.ignoreSelector);
|
|
216
|
+
}
|
|
217
|
+
pierceElementFromPoint(x, y) {
|
|
218
|
+
let element = document.elementFromPoint(x, y);
|
|
219
|
+
if (!element) return null;
|
|
220
|
+
while (element?.shadowRoot) {
|
|
221
|
+
const inner = element.shadowRoot.elementFromPoint(x, y);
|
|
222
|
+
if (!inner || inner === element) break;
|
|
223
|
+
element = inner;
|
|
224
|
+
}
|
|
225
|
+
return element;
|
|
226
|
+
}
|
|
227
|
+
processHover(x, y) {
|
|
228
|
+
const element = this.pierceElementFromPoint(x, y);
|
|
229
|
+
if (!element || this.shouldIgnore(element)) {
|
|
230
|
+
if (this.hoveredElement) {
|
|
231
|
+
this.hoveredElement = null;
|
|
232
|
+
this.lastTarget = null;
|
|
233
|
+
this.clearStableTimeout();
|
|
234
|
+
this.options.onHover?.(null, null);
|
|
235
|
+
}
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (element === this.lastTarget) return;
|
|
239
|
+
this.lastTarget = element;
|
|
240
|
+
this.hoveredElement = element;
|
|
241
|
+
const rect = element.getBoundingClientRect();
|
|
242
|
+
this.options.onHover?.(element, rect);
|
|
243
|
+
this.clearStableTimeout();
|
|
244
|
+
this.stableTimeout = setTimeout(() => {
|
|
245
|
+
if (this.hoveredElement === element) {
|
|
246
|
+
this.options.onStableHover?.(element);
|
|
247
|
+
}
|
|
248
|
+
}, 100);
|
|
249
|
+
}
|
|
250
|
+
clearStableTimeout() {
|
|
251
|
+
if (this.stableTimeout !== null) {
|
|
252
|
+
clearTimeout(this.stableTimeout);
|
|
253
|
+
this.stableTimeout = null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
activate() {
|
|
257
|
+
if (this.active) return;
|
|
258
|
+
this.active = true;
|
|
259
|
+
document.addEventListener("mousemove", this.handleMouseMove, true);
|
|
260
|
+
document.addEventListener("click", this.handleClick, true);
|
|
261
|
+
document.addEventListener("keydown", this.handleKeyDown, true);
|
|
262
|
+
if (this.options.blockInteractions) {
|
|
263
|
+
document.body.style.pointerEvents = "none";
|
|
264
|
+
const overlay = document.getElementById("pinpoint-root");
|
|
265
|
+
if (overlay) overlay.style.pointerEvents = "auto";
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
deactivate() {
|
|
269
|
+
if (!this.active) return;
|
|
270
|
+
this.active = false;
|
|
271
|
+
document.removeEventListener("mousemove", this.handleMouseMove, true);
|
|
272
|
+
document.removeEventListener("click", this.handleClick, true);
|
|
273
|
+
document.removeEventListener("keydown", this.handleKeyDown, true);
|
|
274
|
+
if (this.rafId !== null) {
|
|
275
|
+
cancelAnimationFrame(this.rafId);
|
|
276
|
+
this.rafId = null;
|
|
277
|
+
}
|
|
278
|
+
this.clearStableTimeout();
|
|
279
|
+
this.hoveredElement = null;
|
|
280
|
+
this.lastTarget = null;
|
|
281
|
+
if (this.options.blockInteractions) {
|
|
282
|
+
document.body.style.pointerEvents = "";
|
|
283
|
+
}
|
|
284
|
+
this.options.onHover?.(null, null);
|
|
285
|
+
}
|
|
286
|
+
/** Update blockInteractions at runtime (called from settings toggle) */
|
|
287
|
+
setBlockInteractions(value) {
|
|
288
|
+
const wasBlocking = this.options.blockInteractions;
|
|
289
|
+
this.options.blockInteractions = value;
|
|
290
|
+
if (this.active) {
|
|
291
|
+
if (value && !wasBlocking) {
|
|
292
|
+
document.body.style.pointerEvents = "none";
|
|
293
|
+
const overlay = document.getElementById("pinpoint-root");
|
|
294
|
+
if (overlay) overlay.style.pointerEvents = "auto";
|
|
295
|
+
} else if (!value && wasBlocking) {
|
|
296
|
+
document.body.style.pointerEvents = "";
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/** Pause picking without removing listeners (e.g., while popup is open) */
|
|
301
|
+
pause() {
|
|
302
|
+
this.paused = true;
|
|
303
|
+
this.hoveredElement = null;
|
|
304
|
+
this.lastTarget = null;
|
|
305
|
+
this.clearStableTimeout();
|
|
306
|
+
this.options.onHover?.(null, null);
|
|
307
|
+
}
|
|
308
|
+
/** Resume picking after pause */
|
|
309
|
+
resume() {
|
|
310
|
+
this.paused = false;
|
|
311
|
+
}
|
|
312
|
+
isPaused() {
|
|
313
|
+
return this.paused;
|
|
314
|
+
}
|
|
315
|
+
isActive() {
|
|
316
|
+
return this.active;
|
|
317
|
+
}
|
|
318
|
+
/** Get the currently hovered element */
|
|
319
|
+
getHoveredElement() {
|
|
320
|
+
return this.hoveredElement;
|
|
321
|
+
}
|
|
322
|
+
dispose() {
|
|
323
|
+
this.deactivate();
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// src/detection/selector-builder.ts
|
|
328
|
+
import { finder } from "@medv/finder";
|
|
329
|
+
var DEFAULT_SKIP_CLASSES = [
|
|
330
|
+
/^css-/,
|
|
331
|
+
// CSS-in-JS (Emotion, etc.)
|
|
332
|
+
/^_/,
|
|
333
|
+
// CSS Modules hashes
|
|
334
|
+
/^sc-/,
|
|
335
|
+
// styled-components
|
|
336
|
+
/^go\d/,
|
|
337
|
+
// Goober
|
|
338
|
+
/^tw-/,
|
|
339
|
+
// Tailwind utilities (sometimes hashed)
|
|
340
|
+
/^chakra-/
|
|
341
|
+
// Chakra UI internals
|
|
342
|
+
];
|
|
343
|
+
var DEFAULT_SKIP_IDS = [
|
|
344
|
+
/^:r[0-9]/,
|
|
345
|
+
// React auto-generated IDs
|
|
346
|
+
/^radix-/,
|
|
347
|
+
// Radix UI auto IDs
|
|
348
|
+
/^headlessui-/
|
|
349
|
+
// HeadlessUI auto IDs
|
|
350
|
+
];
|
|
351
|
+
function buildSelector(element, options = {}) {
|
|
352
|
+
const { timeoutMs = 200, skipClassPatterns = [] } = options;
|
|
353
|
+
const allSkipClasses = [...DEFAULT_SKIP_CLASSES, ...skipClassPatterns];
|
|
354
|
+
try {
|
|
355
|
+
return finder(element, {
|
|
356
|
+
className: (name) => !allSkipClasses.some((pattern) => pattern.test(name)),
|
|
357
|
+
idName: (name) => !DEFAULT_SKIP_IDS.some((pattern) => pattern.test(name)),
|
|
358
|
+
attr: (name) => name.startsWith("data-testid") || name.startsWith("data-cy"),
|
|
359
|
+
timeoutMs
|
|
360
|
+
});
|
|
361
|
+
} catch {
|
|
362
|
+
return buildFallbackSelector(element);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function buildFallbackSelector(element) {
|
|
366
|
+
const parts = [];
|
|
367
|
+
if (element.id) {
|
|
368
|
+
return `#${CSS.escape(element.id)}`;
|
|
369
|
+
}
|
|
370
|
+
parts.push(element.tagName.toLowerCase());
|
|
371
|
+
const testId = element.getAttribute("data-testid");
|
|
372
|
+
if (testId) {
|
|
373
|
+
return `[data-testid="${CSS.escape(testId)}"]`;
|
|
374
|
+
}
|
|
375
|
+
const classes = Array.from(element.classList).filter(
|
|
376
|
+
(name) => !DEFAULT_SKIP_CLASSES.some((pattern) => pattern.test(name))
|
|
377
|
+
);
|
|
378
|
+
if (classes.length > 0) {
|
|
379
|
+
parts.push(`.${classes.map((c) => CSS.escape(c)).join(".")}`);
|
|
380
|
+
}
|
|
381
|
+
const parent = element.parentElement;
|
|
382
|
+
if (parent) {
|
|
383
|
+
const siblings = Array.from(parent.children).filter(
|
|
384
|
+
(child) => child.tagName === element.tagName
|
|
385
|
+
);
|
|
386
|
+
if (siblings.length > 1) {
|
|
387
|
+
const index = siblings.indexOf(element) + 1;
|
|
388
|
+
parts.push(`:nth-child(${index})`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return parts.join("");
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/detection/element-info.ts
|
|
395
|
+
var STYLE_KEYS = [
|
|
396
|
+
"color",
|
|
397
|
+
"backgroundColor",
|
|
398
|
+
"fontSize",
|
|
399
|
+
"fontFamily",
|
|
400
|
+
"fontWeight",
|
|
401
|
+
"lineHeight",
|
|
402
|
+
"padding",
|
|
403
|
+
"margin",
|
|
404
|
+
"border",
|
|
405
|
+
"borderRadius",
|
|
406
|
+
"display",
|
|
407
|
+
"position",
|
|
408
|
+
"width",
|
|
409
|
+
"height",
|
|
410
|
+
"opacity",
|
|
411
|
+
"zIndex",
|
|
412
|
+
"overflow",
|
|
413
|
+
"textAlign",
|
|
414
|
+
"textDecoration"
|
|
415
|
+
];
|
|
416
|
+
function extractElementInfo(element) {
|
|
417
|
+
const rect = element.getBoundingClientRect();
|
|
418
|
+
const computed = window.getComputedStyle(element);
|
|
419
|
+
const computedStyles = {};
|
|
420
|
+
for (const key of STYLE_KEYS) {
|
|
421
|
+
const value = computed.getPropertyValue(
|
|
422
|
+
key.replace(/([A-Z])/g, "-$1").toLowerCase()
|
|
423
|
+
);
|
|
424
|
+
if (value) {
|
|
425
|
+
computedStyles[key] = value;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const ariaAttributes = {};
|
|
429
|
+
for (const attr of element.attributes) {
|
|
430
|
+
if (attr.name.startsWith("aria-") || attr.name === "role") {
|
|
431
|
+
ariaAttributes[attr.name] = attr.value;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
const dataAttributes = {};
|
|
435
|
+
for (const attr of element.attributes) {
|
|
436
|
+
if (attr.name.startsWith("data-")) {
|
|
437
|
+
dataAttributes[attr.name] = attr.value;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
const domPath = buildDomPath(element);
|
|
441
|
+
const textContent = getTextContent(element);
|
|
442
|
+
return {
|
|
443
|
+
tagName: element.tagName.toLowerCase(),
|
|
444
|
+
id: element.id || void 0,
|
|
445
|
+
classNames: Array.from(element.classList),
|
|
446
|
+
selector: buildSelector(element),
|
|
447
|
+
textContent,
|
|
448
|
+
boundingRect: {
|
|
449
|
+
x: Math.round(rect.x),
|
|
450
|
+
y: Math.round(rect.y),
|
|
451
|
+
width: Math.round(rect.width),
|
|
452
|
+
height: Math.round(rect.height)
|
|
453
|
+
},
|
|
454
|
+
computedStyles,
|
|
455
|
+
ariaAttributes: Object.keys(ariaAttributes).length > 0 ? ariaAttributes : void 0,
|
|
456
|
+
dataAttributes: Object.keys(dataAttributes).length > 0 ? dataAttributes : void 0,
|
|
457
|
+
domPath
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function buildElementContext(element, frameworkInfo) {
|
|
461
|
+
const info = extractElementInfo(element);
|
|
462
|
+
const htmlSnippet = getCleanedHtml(element);
|
|
463
|
+
return {
|
|
464
|
+
element: info,
|
|
465
|
+
framework: frameworkInfo,
|
|
466
|
+
htmlSnippet,
|
|
467
|
+
cssSelector: info.selector,
|
|
468
|
+
computedStyles: info.computedStyles || {}
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function getTextContent(element) {
|
|
472
|
+
let text = "";
|
|
473
|
+
for (const node of element.childNodes) {
|
|
474
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
475
|
+
text += node.textContent?.trim() || "";
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (!text) {
|
|
479
|
+
text = element.textContent?.trim() || "";
|
|
480
|
+
}
|
|
481
|
+
if (!text) return void 0;
|
|
482
|
+
return text.length > 200 ? text.slice(0, 200) + "..." : text;
|
|
483
|
+
}
|
|
484
|
+
function buildDomPath(element) {
|
|
485
|
+
const parts = [];
|
|
486
|
+
let current = element;
|
|
487
|
+
while (current && current !== document.documentElement) {
|
|
488
|
+
let part = current.tagName.toLowerCase();
|
|
489
|
+
if (current.id) {
|
|
490
|
+
part += `#${current.id}`;
|
|
491
|
+
} else if (current.classList.length > 0) {
|
|
492
|
+
const firstClass = current.classList[0];
|
|
493
|
+
if (firstClass && !/^(css-|_|sc-)/.test(firstClass)) {
|
|
494
|
+
part += `.${firstClass}`;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
parts.unshift(part);
|
|
498
|
+
current = current.parentElement;
|
|
499
|
+
}
|
|
500
|
+
return parts.join(" > ");
|
|
501
|
+
}
|
|
502
|
+
function getCleanedHtml(element, maxLength = 500) {
|
|
503
|
+
const clone = element.cloneNode(true);
|
|
504
|
+
const allElements = [clone, ...Array.from(clone.querySelectorAll("*"))];
|
|
505
|
+
for (const el of allElements) {
|
|
506
|
+
for (const attr of Array.from(el.attributes)) {
|
|
507
|
+
if (attr.name.startsWith("on")) {
|
|
508
|
+
el.removeAttribute(attr.name);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
let html = clone.outerHTML;
|
|
513
|
+
html = html.replace(/\s+/g, " ").trim();
|
|
514
|
+
if (html.length > maxLength) {
|
|
515
|
+
const openTagEnd = html.indexOf(">") + 1;
|
|
516
|
+
if (openTagEnd > 0 && openTagEnd < maxLength) {
|
|
517
|
+
html = html.slice(0, maxLength) + "...";
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return html;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/detection/drag-select.ts
|
|
524
|
+
var DragSelect = class {
|
|
525
|
+
active = false;
|
|
526
|
+
dragging = false;
|
|
527
|
+
startX = 0;
|
|
528
|
+
startY = 0;
|
|
529
|
+
options;
|
|
530
|
+
handleMouseDown;
|
|
531
|
+
handleMouseMove;
|
|
532
|
+
handleMouseUp;
|
|
533
|
+
constructor(options = {}) {
|
|
534
|
+
this.options = { coverageThreshold: 0.75, ...options };
|
|
535
|
+
this.handleMouseDown = (e) => {
|
|
536
|
+
if (!this.active || e.button !== 0) return;
|
|
537
|
+
if (!e.shiftKey) return;
|
|
538
|
+
e.preventDefault();
|
|
539
|
+
this.dragging = true;
|
|
540
|
+
this.startX = e.clientX;
|
|
541
|
+
this.startY = e.clientY;
|
|
542
|
+
const rect = this.buildRect(e.clientX, e.clientY);
|
|
543
|
+
this.options.onDragStart?.(
|
|
544
|
+
new DOMRect(rect.x, rect.y, rect.width, rect.height)
|
|
545
|
+
);
|
|
546
|
+
};
|
|
547
|
+
this.handleMouseMove = (e) => {
|
|
548
|
+
if (!this.dragging) return;
|
|
549
|
+
e.preventDefault();
|
|
550
|
+
const rect = this.buildRect(e.clientX, e.clientY);
|
|
551
|
+
this.options.onDragMove?.(
|
|
552
|
+
new DOMRect(rect.x, rect.y, rect.width, rect.height)
|
|
553
|
+
);
|
|
554
|
+
};
|
|
555
|
+
this.handleMouseUp = (e) => {
|
|
556
|
+
if (!this.dragging) return;
|
|
557
|
+
this.dragging = false;
|
|
558
|
+
const selectionRect = this.buildRect(e.clientX, e.clientY);
|
|
559
|
+
if (selectionRect.width < 5 && selectionRect.height < 5) return;
|
|
560
|
+
const selected = this.getElementsInRect(selectionRect);
|
|
561
|
+
this.options.onDragEnd?.(selected);
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
buildRect(currentX, currentY) {
|
|
565
|
+
return {
|
|
566
|
+
x: Math.min(this.startX, currentX),
|
|
567
|
+
y: Math.min(this.startY, currentY),
|
|
568
|
+
width: Math.abs(currentX - this.startX),
|
|
569
|
+
height: Math.abs(currentY - this.startY)
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
getElementsInRect(selectionRect) {
|
|
573
|
+
const threshold = this.options.coverageThreshold;
|
|
574
|
+
const elements = [];
|
|
575
|
+
const walker = document.createTreeWalker(
|
|
576
|
+
document.body,
|
|
577
|
+
NodeFilter.SHOW_ELEMENT,
|
|
578
|
+
{
|
|
579
|
+
acceptNode: (node2) => {
|
|
580
|
+
const el = node2;
|
|
581
|
+
if (this.options.ignoreSelector && el.matches(this.options.ignoreSelector)) {
|
|
582
|
+
return NodeFilter.FILTER_REJECT;
|
|
583
|
+
}
|
|
584
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
let node;
|
|
589
|
+
while (node = walker.nextNode()) {
|
|
590
|
+
const el = node;
|
|
591
|
+
const rect = el.getBoundingClientRect();
|
|
592
|
+
if (rect.width === 0 || rect.height === 0) continue;
|
|
593
|
+
const overlapX = Math.max(
|
|
594
|
+
0,
|
|
595
|
+
Math.min(rect.right, selectionRect.x + selectionRect.width) - Math.max(rect.left, selectionRect.x)
|
|
596
|
+
);
|
|
597
|
+
const overlapY = Math.max(
|
|
598
|
+
0,
|
|
599
|
+
Math.min(rect.bottom, selectionRect.y + selectionRect.height) - Math.max(rect.top, selectionRect.y)
|
|
600
|
+
);
|
|
601
|
+
const overlapArea = overlapX * overlapY;
|
|
602
|
+
const elementArea = rect.width * rect.height;
|
|
603
|
+
const coverage = overlapArea / elementArea;
|
|
604
|
+
if (coverage >= threshold) {
|
|
605
|
+
if (el.children.length === 0 || rect.width < 400) {
|
|
606
|
+
elements.push(el);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return elements;
|
|
611
|
+
}
|
|
612
|
+
activate() {
|
|
613
|
+
if (this.active) return;
|
|
614
|
+
this.active = true;
|
|
615
|
+
document.addEventListener("mousedown", this.handleMouseDown, true);
|
|
616
|
+
document.addEventListener("mousemove", this.handleMouseMove, true);
|
|
617
|
+
document.addEventListener("mouseup", this.handleMouseUp, true);
|
|
618
|
+
}
|
|
619
|
+
deactivate() {
|
|
620
|
+
if (!this.active) return;
|
|
621
|
+
this.active = false;
|
|
622
|
+
this.dragging = false;
|
|
623
|
+
document.removeEventListener("mousedown", this.handleMouseDown, true);
|
|
624
|
+
document.removeEventListener("mousemove", this.handleMouseMove, true);
|
|
625
|
+
document.removeEventListener("mouseup", this.handleMouseUp, true);
|
|
626
|
+
}
|
|
627
|
+
isDragging() {
|
|
628
|
+
return this.dragging;
|
|
629
|
+
}
|
|
630
|
+
dispose() {
|
|
631
|
+
this.deactivate();
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
// src/detection/text-select.ts
|
|
636
|
+
var TextSelect = class {
|
|
637
|
+
active = false;
|
|
638
|
+
options;
|
|
639
|
+
handleSelectionChange;
|
|
640
|
+
debounceTimer = null;
|
|
641
|
+
constructor(options = {}) {
|
|
642
|
+
this.options = { minLength: 3, ...options };
|
|
643
|
+
this.handleSelectionChange = () => {
|
|
644
|
+
if (!this.active) return;
|
|
645
|
+
if (this.debounceTimer) clearTimeout(this.debounceTimer);
|
|
646
|
+
this.debounceTimer = setTimeout(() => {
|
|
647
|
+
const selection = this.getTextSelection();
|
|
648
|
+
this.options.onSelect?.(selection);
|
|
649
|
+
}, 150);
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
getTextSelection() {
|
|
653
|
+
const selection = window.getSelection();
|
|
654
|
+
if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
const text = selection.toString().trim();
|
|
658
|
+
if (text.length < (this.options.minLength ?? 3)) {
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
661
|
+
const range = selection.getRangeAt(0);
|
|
662
|
+
const container = range.commonAncestorContainer.nodeType === Node.ELEMENT_NODE ? range.commonAncestorContainer : range.commonAncestorContainer.parentElement;
|
|
663
|
+
if (!container) return null;
|
|
664
|
+
const fullText = container.textContent || "";
|
|
665
|
+
const startOffset = range.startOffset;
|
|
666
|
+
const endOffset = range.endOffset;
|
|
667
|
+
const contextBefore = fullText.slice(
|
|
668
|
+
Math.max(0, startOffset - 50),
|
|
669
|
+
startOffset
|
|
670
|
+
);
|
|
671
|
+
const contextAfter = fullText.slice(endOffset, endOffset + 50);
|
|
672
|
+
const context = `...${contextBefore}[${text}]${contextAfter}...`;
|
|
673
|
+
const rect = range.getBoundingClientRect();
|
|
674
|
+
return {
|
|
675
|
+
text,
|
|
676
|
+
container,
|
|
677
|
+
startOffset,
|
|
678
|
+
endOffset,
|
|
679
|
+
context,
|
|
680
|
+
rect
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
activate() {
|
|
684
|
+
if (this.active) return;
|
|
685
|
+
this.active = true;
|
|
686
|
+
document.addEventListener("selectionchange", this.handleSelectionChange);
|
|
687
|
+
}
|
|
688
|
+
deactivate() {
|
|
689
|
+
if (!this.active) return;
|
|
690
|
+
this.active = false;
|
|
691
|
+
document.removeEventListener("selectionchange", this.handleSelectionChange);
|
|
692
|
+
if (this.debounceTimer) {
|
|
693
|
+
clearTimeout(this.debounceTimer);
|
|
694
|
+
this.debounceTimer = null;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
/** Get the current text selection, if any */
|
|
698
|
+
getCurrentSelection() {
|
|
699
|
+
return this.getTextSelection();
|
|
700
|
+
}
|
|
701
|
+
dispose() {
|
|
702
|
+
this.deactivate();
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
// src/frameworks/adapter.ts
|
|
707
|
+
var adapters = [];
|
|
708
|
+
var detectedAdapter = null;
|
|
709
|
+
var detected = false;
|
|
710
|
+
function registerAdapter(adapter) {
|
|
711
|
+
adapters.push(adapter);
|
|
712
|
+
detected = false;
|
|
713
|
+
detectedAdapter = null;
|
|
714
|
+
}
|
|
715
|
+
function detectFramework() {
|
|
716
|
+
if (detected && detectedAdapter) return detectedAdapter;
|
|
717
|
+
for (const adapter of adapters) {
|
|
718
|
+
try {
|
|
719
|
+
if (adapter.detect()) {
|
|
720
|
+
detectedAdapter = adapter;
|
|
721
|
+
detected = true;
|
|
722
|
+
return adapter;
|
|
723
|
+
}
|
|
724
|
+
} catch {
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
detectedAdapter = genericAdapter;
|
|
728
|
+
detected = true;
|
|
729
|
+
return genericAdapter;
|
|
730
|
+
}
|
|
731
|
+
function getComponentInfo(element) {
|
|
732
|
+
const adapter = detectFramework();
|
|
733
|
+
try {
|
|
734
|
+
return adapter.getComponentInfo(element);
|
|
735
|
+
} catch {
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
function getSourceLocation(element) {
|
|
740
|
+
const adapter = detectFramework();
|
|
741
|
+
try {
|
|
742
|
+
return adapter.getSourceLocation(element);
|
|
743
|
+
} catch {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
var genericAdapter = {
|
|
748
|
+
name: "generic",
|
|
749
|
+
detect: () => true,
|
|
750
|
+
// Always matches as fallback
|
|
751
|
+
getComponentInfo: () => null,
|
|
752
|
+
getSourceLocation: () => null
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
// src/ui/components/PinMarker.tsx
|
|
756
|
+
var MAX_MARKERS = 100;
|
|
757
|
+
var BADGE_SIZE = 20;
|
|
758
|
+
var BADGE_FONT = 11;
|
|
759
|
+
var BADGE_OFFSET = -10;
|
|
760
|
+
var STATUS_COLORS = {
|
|
761
|
+
open: "#3b82f6",
|
|
762
|
+
acknowledged: "#eab308",
|
|
763
|
+
resolved: "#22c55e",
|
|
764
|
+
dismissed: "#a1a1aa"
|
|
765
|
+
};
|
|
766
|
+
var PinMarkerManager = class {
|
|
767
|
+
markers = /* @__PURE__ */ new Map();
|
|
768
|
+
updateTimer = null;
|
|
769
|
+
onClick = null;
|
|
770
|
+
onToggleSelect = null;
|
|
771
|
+
selectedPinIds = /* @__PURE__ */ new Set();
|
|
772
|
+
showCheckboxes = false;
|
|
773
|
+
constructor(markerColor = "#3b82f6") {
|
|
774
|
+
this.markerColor = markerColor;
|
|
775
|
+
}
|
|
776
|
+
setOnClick(handler) {
|
|
777
|
+
this.onClick = handler;
|
|
778
|
+
}
|
|
779
|
+
setOnToggleSelect(handler) {
|
|
780
|
+
this.onToggleSelect = handler;
|
|
781
|
+
}
|
|
782
|
+
setSelectedPins(ids) {
|
|
783
|
+
this.selectedPinIds = ids;
|
|
784
|
+
for (const [id, pair] of this.markers) {
|
|
785
|
+
this.updateCheckboxVisual(pair.checkbox, ids.has(id));
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
setShowCheckboxes(show) {
|
|
789
|
+
this.showCheckboxes = show;
|
|
790
|
+
for (const pair of this.markers.values()) {
|
|
791
|
+
pair.checkbox.style.display = show ? "flex" : "none";
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
update(pins) {
|
|
795
|
+
const visiblePins = pins.slice(0, MAX_MARKERS);
|
|
796
|
+
const pinIds = new Set(visiblePins.map((p) => p.id));
|
|
797
|
+
for (const [id, pair] of this.markers) {
|
|
798
|
+
if (!pinIds.has(id)) {
|
|
799
|
+
pair.wrapper.remove();
|
|
800
|
+
this.markers.delete(id);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
for (let i = 0; i < visiblePins.length; i++) {
|
|
804
|
+
this.updateMarker(visiblePins[i], i + 1);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
updateCheckboxVisual(checkbox, selected) {
|
|
808
|
+
const inner = checkbox.querySelector(".pp-marker-checkbox-inner");
|
|
809
|
+
if (!inner) return;
|
|
810
|
+
if (selected) {
|
|
811
|
+
inner.style.background = "#3b82f6";
|
|
812
|
+
inner.style.borderColor = "#3b82f6";
|
|
813
|
+
inner.innerHTML = `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12l5 5l10 -10"/></svg>`;
|
|
814
|
+
} else {
|
|
815
|
+
inner.style.background = "rgba(0,0,0,0.5)";
|
|
816
|
+
inner.style.borderColor = "rgba(255,255,255,0.3)";
|
|
817
|
+
inner.innerHTML = "";
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
updateMarker(pin, number) {
|
|
821
|
+
const element = document.querySelector(pin.element.selector);
|
|
822
|
+
if (!element) {
|
|
823
|
+
const existing = this.markers.get(pin.id);
|
|
824
|
+
if (existing) existing.wrapper.style.display = "none";
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
let pair = this.markers.get(pin.id);
|
|
828
|
+
const statusColor = STATUS_COLORS[pin.status.state] || this.markerColor;
|
|
829
|
+
if (!pair) {
|
|
830
|
+
const wrapper = document.createElement("div");
|
|
831
|
+
wrapper.setAttribute("data-pinpoint-marker", pin.id);
|
|
832
|
+
wrapper.style.cssText = `
|
|
833
|
+
position: fixed;
|
|
834
|
+
z-index: 2147483646;
|
|
835
|
+
pointer-events: none;
|
|
836
|
+
`;
|
|
837
|
+
const outline = document.createElement("div");
|
|
838
|
+
outline.style.cssText = `
|
|
839
|
+
position: absolute;
|
|
840
|
+
top: 0; left: 0;
|
|
841
|
+
width: 100%; height: 100%;
|
|
842
|
+
border: 1.5px solid ${statusColor};
|
|
843
|
+
border-radius: 3px;
|
|
844
|
+
pointer-events: none;
|
|
845
|
+
opacity: 0.6;
|
|
846
|
+
`;
|
|
847
|
+
const badge = document.createElement("div");
|
|
848
|
+
badge.style.cssText = `
|
|
849
|
+
position: absolute;
|
|
850
|
+
top: ${BADGE_OFFSET}px;
|
|
851
|
+
right: ${BADGE_OFFSET}px;
|
|
852
|
+
width: ${BADGE_SIZE}px;
|
|
853
|
+
height: ${BADGE_SIZE}px;
|
|
854
|
+
min-width: ${BADGE_SIZE}px;
|
|
855
|
+
padding: 0 4px;
|
|
856
|
+
border-radius: ${BADGE_SIZE / 2}px;
|
|
857
|
+
display: flex;
|
|
858
|
+
align-items: center;
|
|
859
|
+
justify-content: center;
|
|
860
|
+
font-size: ${BADGE_FONT}px;
|
|
861
|
+
font-weight: 600;
|
|
862
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
863
|
+
font-variant-numeric: tabular-nums;
|
|
864
|
+
color: #fff;
|
|
865
|
+
background: ${statusColor};
|
|
866
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
|
|
867
|
+
cursor: pointer;
|
|
868
|
+
pointer-events: auto;
|
|
869
|
+
user-select: none;
|
|
870
|
+
z-index: 1;
|
|
871
|
+
animation: pp-badge-appear 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
872
|
+
`;
|
|
873
|
+
if (!document.getElementById("pp-marker-keyframes")) {
|
|
874
|
+
const style2 = document.createElement("style");
|
|
875
|
+
style2.id = "pp-marker-keyframes";
|
|
876
|
+
style2.textContent = `
|
|
877
|
+
@keyframes pp-badge-appear {
|
|
878
|
+
from { transform: scale(0); opacity: 0; }
|
|
879
|
+
to { transform: scale(1); opacity: 1; }
|
|
880
|
+
}
|
|
881
|
+
`;
|
|
882
|
+
document.head.appendChild(style2);
|
|
883
|
+
}
|
|
884
|
+
badge.addEventListener("click", (e) => {
|
|
885
|
+
e.stopPropagation();
|
|
886
|
+
e.preventDefault();
|
|
887
|
+
this.onClick?.(pin);
|
|
888
|
+
});
|
|
889
|
+
badge.addEventListener("mouseenter", () => {
|
|
890
|
+
badge.style.transform = "scale(1.15)";
|
|
891
|
+
});
|
|
892
|
+
badge.addEventListener("mouseleave", () => {
|
|
893
|
+
badge.style.transform = "scale(1)";
|
|
894
|
+
});
|
|
895
|
+
const checkbox = document.createElement("div");
|
|
896
|
+
checkbox.style.cssText = `
|
|
897
|
+
position: absolute;
|
|
898
|
+
top: ${BADGE_OFFSET}px;
|
|
899
|
+
left: ${BADGE_OFFSET}px;
|
|
900
|
+
width: ${BADGE_SIZE}px;
|
|
901
|
+
height: ${BADGE_SIZE}px;
|
|
902
|
+
display: ${this.showCheckboxes ? "flex" : "none"};
|
|
903
|
+
align-items: center;
|
|
904
|
+
justify-content: center;
|
|
905
|
+
cursor: pointer;
|
|
906
|
+
pointer-events: auto;
|
|
907
|
+
z-index: 1;
|
|
908
|
+
`;
|
|
909
|
+
const checkboxInner = document.createElement("div");
|
|
910
|
+
checkboxInner.className = "pp-marker-checkbox-inner";
|
|
911
|
+
checkboxInner.style.cssText = `
|
|
912
|
+
width: 16px;
|
|
913
|
+
height: 16px;
|
|
914
|
+
border-radius: 4px;
|
|
915
|
+
border: 1.5px solid rgba(255,255,255,0.3);
|
|
916
|
+
background: rgba(0,0,0,0.5);
|
|
917
|
+
display: flex;
|
|
918
|
+
align-items: center;
|
|
919
|
+
justify-content: center;
|
|
920
|
+
`;
|
|
921
|
+
checkbox.appendChild(checkboxInner);
|
|
922
|
+
checkbox.addEventListener("click", (e) => {
|
|
923
|
+
e.stopPropagation();
|
|
924
|
+
e.preventDefault();
|
|
925
|
+
this.onToggleSelect?.(pin);
|
|
926
|
+
});
|
|
927
|
+
const resolvedOverlay = document.createElement("div");
|
|
928
|
+
resolvedOverlay.style.cssText = `
|
|
929
|
+
position: absolute;
|
|
930
|
+
top: 0; left: 0;
|
|
931
|
+
width: 100%; height: 100%;
|
|
932
|
+
display: ${pin.status.state === "resolved" ? "flex" : "none"};
|
|
933
|
+
align-items: center;
|
|
934
|
+
justify-content: center;
|
|
935
|
+
background: rgba(34, 197, 94, 0.12);
|
|
936
|
+
border-radius: 3px;
|
|
937
|
+
pointer-events: none;
|
|
938
|
+
`;
|
|
939
|
+
resolvedOverlay.innerHTML = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#22c55e" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12l5 5l10 -10"/></svg>`;
|
|
940
|
+
wrapper.appendChild(outline);
|
|
941
|
+
wrapper.appendChild(badge);
|
|
942
|
+
wrapper.appendChild(checkbox);
|
|
943
|
+
wrapper.appendChild(resolvedOverlay);
|
|
944
|
+
document.body.appendChild(wrapper);
|
|
945
|
+
pair = {
|
|
946
|
+
wrapper,
|
|
947
|
+
outline,
|
|
948
|
+
badge,
|
|
949
|
+
checkbox,
|
|
950
|
+
resolvedOverlay
|
|
951
|
+
};
|
|
952
|
+
this.markers.set(pin.id, pair);
|
|
953
|
+
}
|
|
954
|
+
pair.badge.textContent = String(number);
|
|
955
|
+
pair.badge.title = pin.comment;
|
|
956
|
+
pair.badge.style.background = statusColor;
|
|
957
|
+
pair.outline.style.borderColor = statusColor;
|
|
958
|
+
pair.resolvedOverlay.style.display = pin.status.state === "resolved" ? "flex" : "none";
|
|
959
|
+
this.updateCheckboxVisual(pair.checkbox, this.selectedPinIds.has(pin.id));
|
|
960
|
+
const rect = element.getBoundingClientRect();
|
|
961
|
+
pair.wrapper.style.left = `${rect.left}px`;
|
|
962
|
+
pair.wrapper.style.top = `${rect.top}px`;
|
|
963
|
+
pair.wrapper.style.width = `${rect.width}px`;
|
|
964
|
+
pair.wrapper.style.height = `${rect.height}px`;
|
|
965
|
+
const visible = rect.bottom > 0 && rect.top < window.innerHeight && rect.right > 0 && rect.left < window.innerWidth;
|
|
966
|
+
pair.wrapper.style.display = visible ? "block" : "none";
|
|
967
|
+
}
|
|
968
|
+
startTracking(pins) {
|
|
969
|
+
this.stopTracking();
|
|
970
|
+
this.update(pins);
|
|
971
|
+
this.updateTimer = setInterval(() => this.update(pins), 200);
|
|
972
|
+
}
|
|
973
|
+
stopTracking() {
|
|
974
|
+
if (this.updateTimer) {
|
|
975
|
+
clearInterval(this.updateTimer);
|
|
976
|
+
this.updateTimer = null;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
dispose() {
|
|
980
|
+
this.stopTracking();
|
|
981
|
+
for (const pair of this.markers.values()) {
|
|
982
|
+
pair.wrapper.remove();
|
|
983
|
+
}
|
|
984
|
+
this.markers.clear();
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
// ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/dist/solid.js
|
|
989
|
+
var sharedConfig = {
|
|
990
|
+
context: void 0,
|
|
991
|
+
registry: void 0,
|
|
992
|
+
effects: void 0,
|
|
993
|
+
done: false,
|
|
994
|
+
getContextId() {
|
|
995
|
+
return getContextId(this.context.count);
|
|
996
|
+
},
|
|
997
|
+
getNextContextId() {
|
|
998
|
+
return getContextId(this.context.count++);
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
function getContextId(count) {
|
|
1002
|
+
const num = String(count), len = num.length - 1;
|
|
1003
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
1004
|
+
}
|
|
1005
|
+
function setHydrateContext(context) {
|
|
1006
|
+
sharedConfig.context = context;
|
|
1007
|
+
}
|
|
1008
|
+
function nextHydrateContext() {
|
|
1009
|
+
return {
|
|
1010
|
+
...sharedConfig.context,
|
|
1011
|
+
id: sharedConfig.getNextContextId(),
|
|
1012
|
+
count: 0
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
var IS_DEV = false;
|
|
1016
|
+
var equalFn = (a, b) => a === b;
|
|
1017
|
+
var $TRACK = /* @__PURE__ */ Symbol("solid-track");
|
|
1018
|
+
var signalOptions = {
|
|
1019
|
+
equals: equalFn
|
|
1020
|
+
};
|
|
1021
|
+
var ERROR = null;
|
|
1022
|
+
var runEffects = runQueue;
|
|
1023
|
+
var STALE = 1;
|
|
1024
|
+
var PENDING = 2;
|
|
1025
|
+
var UNOWNED = {
|
|
1026
|
+
owned: null,
|
|
1027
|
+
cleanups: null,
|
|
1028
|
+
context: null,
|
|
1029
|
+
owner: null
|
|
1030
|
+
};
|
|
1031
|
+
var Owner = null;
|
|
1032
|
+
var Transition = null;
|
|
1033
|
+
var Scheduler = null;
|
|
1034
|
+
var ExternalSourceConfig = null;
|
|
1035
|
+
var Listener = null;
|
|
1036
|
+
var Updates = null;
|
|
1037
|
+
var Effects = null;
|
|
1038
|
+
var ExecCount = 0;
|
|
1039
|
+
function createRoot(fn, detachedOwner) {
|
|
1040
|
+
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
|
|
1041
|
+
owned: null,
|
|
1042
|
+
cleanups: null,
|
|
1043
|
+
context: current ? current.context : null,
|
|
1044
|
+
owner: current
|
|
1045
|
+
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
1046
|
+
Owner = root;
|
|
1047
|
+
Listener = null;
|
|
1048
|
+
try {
|
|
1049
|
+
return runUpdates(updateFn, true);
|
|
1050
|
+
} finally {
|
|
1051
|
+
Listener = listener;
|
|
1052
|
+
Owner = owner;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
function createSignal(value, options) {
|
|
1056
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
1057
|
+
const s = {
|
|
1058
|
+
value,
|
|
1059
|
+
observers: null,
|
|
1060
|
+
observerSlots: null,
|
|
1061
|
+
comparator: options.equals || void 0
|
|
1062
|
+
};
|
|
1063
|
+
const setter = (value2) => {
|
|
1064
|
+
if (typeof value2 === "function") {
|
|
1065
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
|
|
1066
|
+
else value2 = value2(s.value);
|
|
1067
|
+
}
|
|
1068
|
+
return writeSignal(s, value2);
|
|
1069
|
+
};
|
|
1070
|
+
return [readSignal.bind(s), setter];
|
|
1071
|
+
}
|
|
1072
|
+
function createRenderEffect(fn, value, options) {
|
|
1073
|
+
const c = createComputation(fn, value, false, STALE);
|
|
1074
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
1075
|
+
else updateComputation(c);
|
|
1076
|
+
}
|
|
1077
|
+
function createEffect(fn, value, options) {
|
|
1078
|
+
runEffects = runUserEffects;
|
|
1079
|
+
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
|
|
1080
|
+
if (s) c.suspense = s;
|
|
1081
|
+
if (!options || !options.render) c.user = true;
|
|
1082
|
+
Effects ? Effects.push(c) : updateComputation(c);
|
|
1083
|
+
}
|
|
1084
|
+
function createMemo(fn, value, options) {
|
|
1085
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
1086
|
+
const c = createComputation(fn, value, true, 0);
|
|
1087
|
+
c.observers = null;
|
|
1088
|
+
c.observerSlots = null;
|
|
1089
|
+
c.comparator = options.equals || void 0;
|
|
1090
|
+
if (Scheduler && Transition && Transition.running) {
|
|
1091
|
+
c.tState = STALE;
|
|
1092
|
+
Updates.push(c);
|
|
1093
|
+
} else updateComputation(c);
|
|
1094
|
+
return readSignal.bind(c);
|
|
1095
|
+
}
|
|
1096
|
+
function untrack(fn) {
|
|
1097
|
+
if (!ExternalSourceConfig && Listener === null) return fn();
|
|
1098
|
+
const listener = Listener;
|
|
1099
|
+
Listener = null;
|
|
1100
|
+
try {
|
|
1101
|
+
if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
|
|
1102
|
+
return fn();
|
|
1103
|
+
} finally {
|
|
1104
|
+
Listener = listener;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
function onMount(fn) {
|
|
1108
|
+
createEffect(() => untrack(fn));
|
|
1109
|
+
}
|
|
1110
|
+
function onCleanup(fn) {
|
|
1111
|
+
if (Owner === null) ;
|
|
1112
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
1113
|
+
else Owner.cleanups.push(fn);
|
|
1114
|
+
return fn;
|
|
1115
|
+
}
|
|
1116
|
+
function startTransition(fn) {
|
|
1117
|
+
if (Transition && Transition.running) {
|
|
1118
|
+
fn();
|
|
1119
|
+
return Transition.done;
|
|
1120
|
+
}
|
|
1121
|
+
const l = Listener;
|
|
1122
|
+
const o = Owner;
|
|
1123
|
+
return Promise.resolve().then(() => {
|
|
1124
|
+
Listener = l;
|
|
1125
|
+
Owner = o;
|
|
1126
|
+
let t;
|
|
1127
|
+
if (Scheduler || SuspenseContext) {
|
|
1128
|
+
t = Transition || (Transition = {
|
|
1129
|
+
sources: /* @__PURE__ */ new Set(),
|
|
1130
|
+
effects: [],
|
|
1131
|
+
promises: /* @__PURE__ */ new Set(),
|
|
1132
|
+
disposed: /* @__PURE__ */ new Set(),
|
|
1133
|
+
queue: /* @__PURE__ */ new Set(),
|
|
1134
|
+
running: true
|
|
1135
|
+
});
|
|
1136
|
+
t.done || (t.done = new Promise((res) => t.resolve = res));
|
|
1137
|
+
t.running = true;
|
|
1138
|
+
}
|
|
1139
|
+
runUpdates(fn, false);
|
|
1140
|
+
Listener = Owner = null;
|
|
1141
|
+
return t ? t.done : void 0;
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
1145
|
+
function useContext(context) {
|
|
1146
|
+
let value;
|
|
1147
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
|
|
1148
|
+
}
|
|
1149
|
+
var SuspenseContext;
|
|
1150
|
+
function readSignal() {
|
|
1151
|
+
const runningTransition = Transition && Transition.running;
|
|
1152
|
+
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
1153
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
1154
|
+
else {
|
|
1155
|
+
const updates = Updates;
|
|
1156
|
+
Updates = null;
|
|
1157
|
+
runUpdates(() => lookUpstream(this), false);
|
|
1158
|
+
Updates = updates;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
if (Listener) {
|
|
1162
|
+
const sSlot = this.observers ? this.observers.length : 0;
|
|
1163
|
+
if (!Listener.sources) {
|
|
1164
|
+
Listener.sources = [this];
|
|
1165
|
+
Listener.sourceSlots = [sSlot];
|
|
1166
|
+
} else {
|
|
1167
|
+
Listener.sources.push(this);
|
|
1168
|
+
Listener.sourceSlots.push(sSlot);
|
|
1169
|
+
}
|
|
1170
|
+
if (!this.observers) {
|
|
1171
|
+
this.observers = [Listener];
|
|
1172
|
+
this.observerSlots = [Listener.sources.length - 1];
|
|
1173
|
+
} else {
|
|
1174
|
+
this.observers.push(Listener);
|
|
1175
|
+
this.observerSlots.push(Listener.sources.length - 1);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
1179
|
+
return this.value;
|
|
1180
|
+
}
|
|
1181
|
+
function writeSignal(node, value, isComp) {
|
|
1182
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
1183
|
+
if (!node.comparator || !node.comparator(current, value)) {
|
|
1184
|
+
if (Transition) {
|
|
1185
|
+
const TransitionRunning = Transition.running;
|
|
1186
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
1187
|
+
Transition.sources.add(node);
|
|
1188
|
+
node.tValue = value;
|
|
1189
|
+
}
|
|
1190
|
+
if (!TransitionRunning) node.value = value;
|
|
1191
|
+
} else node.value = value;
|
|
1192
|
+
if (node.observers && node.observers.length) {
|
|
1193
|
+
runUpdates(() => {
|
|
1194
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
1195
|
+
const o = node.observers[i];
|
|
1196
|
+
const TransitionRunning = Transition && Transition.running;
|
|
1197
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
1198
|
+
if (TransitionRunning ? !o.tState : !o.state) {
|
|
1199
|
+
if (o.pure) Updates.push(o);
|
|
1200
|
+
else Effects.push(o);
|
|
1201
|
+
if (o.observers) markDownstream(o);
|
|
1202
|
+
}
|
|
1203
|
+
if (!TransitionRunning) o.state = STALE;
|
|
1204
|
+
else o.tState = STALE;
|
|
1205
|
+
}
|
|
1206
|
+
if (Updates.length > 1e6) {
|
|
1207
|
+
Updates = [];
|
|
1208
|
+
if (IS_DEV) ;
|
|
1209
|
+
throw new Error();
|
|
1210
|
+
}
|
|
1211
|
+
}, false);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return value;
|
|
1215
|
+
}
|
|
1216
|
+
function updateComputation(node) {
|
|
1217
|
+
if (!node.fn) return;
|
|
1218
|
+
cleanNode(node);
|
|
1219
|
+
const time = ExecCount;
|
|
1220
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
1221
|
+
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
1222
|
+
queueMicrotask(() => {
|
|
1223
|
+
runUpdates(() => {
|
|
1224
|
+
Transition && (Transition.running = true);
|
|
1225
|
+
Listener = Owner = node;
|
|
1226
|
+
runComputation(node, node.tValue, time);
|
|
1227
|
+
Listener = Owner = null;
|
|
1228
|
+
}, false);
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
function runComputation(node, value, time) {
|
|
1233
|
+
let nextValue;
|
|
1234
|
+
const owner = Owner, listener = Listener;
|
|
1235
|
+
Listener = Owner = node;
|
|
1236
|
+
try {
|
|
1237
|
+
nextValue = node.fn(value);
|
|
1238
|
+
} catch (err) {
|
|
1239
|
+
if (node.pure) {
|
|
1240
|
+
if (Transition && Transition.running) {
|
|
1241
|
+
node.tState = STALE;
|
|
1242
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
1243
|
+
node.tOwned = void 0;
|
|
1244
|
+
} else {
|
|
1245
|
+
node.state = STALE;
|
|
1246
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
1247
|
+
node.owned = null;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
node.updatedAt = time + 1;
|
|
1251
|
+
return handleError(err);
|
|
1252
|
+
} finally {
|
|
1253
|
+
Listener = listener;
|
|
1254
|
+
Owner = owner;
|
|
1255
|
+
}
|
|
1256
|
+
if (!node.updatedAt || node.updatedAt <= time) {
|
|
1257
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
1258
|
+
writeSignal(node, nextValue, true);
|
|
1259
|
+
} else if (Transition && Transition.running && node.pure) {
|
|
1260
|
+
if (!Transition.sources.has(node)) node.value = nextValue;
|
|
1261
|
+
Transition.sources.add(node);
|
|
1262
|
+
node.tValue = nextValue;
|
|
1263
|
+
} else node.value = nextValue;
|
|
1264
|
+
node.updatedAt = time;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
function createComputation(fn, init, pure, state = STALE, options) {
|
|
1268
|
+
const c = {
|
|
1269
|
+
fn,
|
|
1270
|
+
state,
|
|
1271
|
+
updatedAt: null,
|
|
1272
|
+
owned: null,
|
|
1273
|
+
sources: null,
|
|
1274
|
+
sourceSlots: null,
|
|
1275
|
+
cleanups: null,
|
|
1276
|
+
value: init,
|
|
1277
|
+
owner: Owner,
|
|
1278
|
+
context: Owner ? Owner.context : null,
|
|
1279
|
+
pure
|
|
1280
|
+
};
|
|
1281
|
+
if (Transition && Transition.running) {
|
|
1282
|
+
c.state = 0;
|
|
1283
|
+
c.tState = state;
|
|
1284
|
+
}
|
|
1285
|
+
if (Owner === null) ;
|
|
1286
|
+
else if (Owner !== UNOWNED) {
|
|
1287
|
+
if (Transition && Transition.running && Owner.pure) {
|
|
1288
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
1289
|
+
else Owner.tOwned.push(c);
|
|
1290
|
+
} else {
|
|
1291
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
1292
|
+
else Owner.owned.push(c);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
if (ExternalSourceConfig && c.fn) {
|
|
1296
|
+
const sourceFn = c.fn;
|
|
1297
|
+
const [track, trigger] = createSignal(void 0, {
|
|
1298
|
+
equals: false
|
|
1299
|
+
});
|
|
1300
|
+
const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
|
|
1301
|
+
onCleanup(() => ordinary.dispose());
|
|
1302
|
+
let inTransition;
|
|
1303
|
+
const triggerInTransition = () => startTransition(trigger).then(() => {
|
|
1304
|
+
if (inTransition) {
|
|
1305
|
+
inTransition.dispose();
|
|
1306
|
+
inTransition = void 0;
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
c.fn = (x) => {
|
|
1310
|
+
track();
|
|
1311
|
+
if (Transition && Transition.running) {
|
|
1312
|
+
if (!inTransition) inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
|
|
1313
|
+
return inTransition.track(x);
|
|
1314
|
+
}
|
|
1315
|
+
return ordinary.track(x);
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1318
|
+
return c;
|
|
1319
|
+
}
|
|
1320
|
+
function runTop(node) {
|
|
1321
|
+
const runningTransition = Transition && Transition.running;
|
|
1322
|
+
if ((runningTransition ? node.tState : node.state) === 0) return;
|
|
1323
|
+
if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
|
|
1324
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
1325
|
+
const ancestors = [node];
|
|
1326
|
+
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
1327
|
+
if (runningTransition && Transition.disposed.has(node)) return;
|
|
1328
|
+
if (runningTransition ? node.tState : node.state) ancestors.push(node);
|
|
1329
|
+
}
|
|
1330
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
1331
|
+
node = ancestors[i];
|
|
1332
|
+
if (runningTransition) {
|
|
1333
|
+
let top = node, prev = ancestors[i + 1];
|
|
1334
|
+
while ((top = top.owner) && top !== prev) {
|
|
1335
|
+
if (Transition.disposed.has(top)) return;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
if ((runningTransition ? node.tState : node.state) === STALE) {
|
|
1339
|
+
updateComputation(node);
|
|
1340
|
+
} else if ((runningTransition ? node.tState : node.state) === PENDING) {
|
|
1341
|
+
const updates = Updates;
|
|
1342
|
+
Updates = null;
|
|
1343
|
+
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
1344
|
+
Updates = updates;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
function runUpdates(fn, init) {
|
|
1349
|
+
if (Updates) return fn();
|
|
1350
|
+
let wait = false;
|
|
1351
|
+
if (!init) Updates = [];
|
|
1352
|
+
if (Effects) wait = true;
|
|
1353
|
+
else Effects = [];
|
|
1354
|
+
ExecCount++;
|
|
1355
|
+
try {
|
|
1356
|
+
const res = fn();
|
|
1357
|
+
completeUpdates(wait);
|
|
1358
|
+
return res;
|
|
1359
|
+
} catch (err) {
|
|
1360
|
+
if (!wait) Effects = null;
|
|
1361
|
+
Updates = null;
|
|
1362
|
+
handleError(err);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
function completeUpdates(wait) {
|
|
1366
|
+
if (Updates) {
|
|
1367
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
1368
|
+
else runQueue(Updates);
|
|
1369
|
+
Updates = null;
|
|
1370
|
+
}
|
|
1371
|
+
if (wait) return;
|
|
1372
|
+
let res;
|
|
1373
|
+
if (Transition) {
|
|
1374
|
+
if (!Transition.promises.size && !Transition.queue.size) {
|
|
1375
|
+
const sources = Transition.sources;
|
|
1376
|
+
const disposed = Transition.disposed;
|
|
1377
|
+
Effects.push.apply(Effects, Transition.effects);
|
|
1378
|
+
res = Transition.resolve;
|
|
1379
|
+
for (const e2 of Effects) {
|
|
1380
|
+
"tState" in e2 && (e2.state = e2.tState);
|
|
1381
|
+
delete e2.tState;
|
|
1382
|
+
}
|
|
1383
|
+
Transition = null;
|
|
1384
|
+
runUpdates(() => {
|
|
1385
|
+
for (const d of disposed) cleanNode(d);
|
|
1386
|
+
for (const v of sources) {
|
|
1387
|
+
v.value = v.tValue;
|
|
1388
|
+
if (v.owned) {
|
|
1389
|
+
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
1390
|
+
}
|
|
1391
|
+
if (v.tOwned) v.owned = v.tOwned;
|
|
1392
|
+
delete v.tValue;
|
|
1393
|
+
delete v.tOwned;
|
|
1394
|
+
v.tState = 0;
|
|
1395
|
+
}
|
|
1396
|
+
setTransPending(false);
|
|
1397
|
+
}, false);
|
|
1398
|
+
} else if (Transition.running) {
|
|
1399
|
+
Transition.running = false;
|
|
1400
|
+
Transition.effects.push.apply(Transition.effects, Effects);
|
|
1401
|
+
Effects = null;
|
|
1402
|
+
setTransPending(true);
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
const e = Effects;
|
|
1407
|
+
Effects = null;
|
|
1408
|
+
if (e.length) runUpdates(() => runEffects(e), false);
|
|
1409
|
+
if (res) res();
|
|
1410
|
+
}
|
|
1411
|
+
function runQueue(queue) {
|
|
1412
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
1413
|
+
}
|
|
1414
|
+
function scheduleQueue(queue) {
|
|
1415
|
+
for (let i = 0; i < queue.length; i++) {
|
|
1416
|
+
const item = queue[i];
|
|
1417
|
+
const tasks = Transition.queue;
|
|
1418
|
+
if (!tasks.has(item)) {
|
|
1419
|
+
tasks.add(item);
|
|
1420
|
+
Scheduler(() => {
|
|
1421
|
+
tasks.delete(item);
|
|
1422
|
+
runUpdates(() => {
|
|
1423
|
+
Transition.running = true;
|
|
1424
|
+
runTop(item);
|
|
1425
|
+
}, false);
|
|
1426
|
+
Transition && (Transition.running = false);
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
function runUserEffects(queue) {
|
|
1432
|
+
let i, userLength = 0;
|
|
1433
|
+
for (i = 0; i < queue.length; i++) {
|
|
1434
|
+
const e = queue[i];
|
|
1435
|
+
if (!e.user) runTop(e);
|
|
1436
|
+
else queue[userLength++] = e;
|
|
1437
|
+
}
|
|
1438
|
+
if (sharedConfig.context) {
|
|
1439
|
+
if (sharedConfig.count) {
|
|
1440
|
+
sharedConfig.effects || (sharedConfig.effects = []);
|
|
1441
|
+
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
setHydrateContext();
|
|
1445
|
+
}
|
|
1446
|
+
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
|
|
1447
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
1448
|
+
userLength += sharedConfig.effects.length;
|
|
1449
|
+
delete sharedConfig.effects;
|
|
1450
|
+
}
|
|
1451
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
1452
|
+
}
|
|
1453
|
+
function lookUpstream(node, ignore) {
|
|
1454
|
+
const runningTransition = Transition && Transition.running;
|
|
1455
|
+
if (runningTransition) node.tState = 0;
|
|
1456
|
+
else node.state = 0;
|
|
1457
|
+
for (let i = 0; i < node.sources.length; i += 1) {
|
|
1458
|
+
const source = node.sources[i];
|
|
1459
|
+
if (source.sources) {
|
|
1460
|
+
const state = runningTransition ? source.tState : source.state;
|
|
1461
|
+
if (state === STALE) {
|
|
1462
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
1463
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
function markDownstream(node) {
|
|
1468
|
+
const runningTransition = Transition && Transition.running;
|
|
1469
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
1470
|
+
const o = node.observers[i];
|
|
1471
|
+
if (runningTransition ? !o.tState : !o.state) {
|
|
1472
|
+
if (runningTransition) o.tState = PENDING;
|
|
1473
|
+
else o.state = PENDING;
|
|
1474
|
+
if (o.pure) Updates.push(o);
|
|
1475
|
+
else Effects.push(o);
|
|
1476
|
+
o.observers && markDownstream(o);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
function cleanNode(node) {
|
|
1481
|
+
let i;
|
|
1482
|
+
if (node.sources) {
|
|
1483
|
+
while (node.sources.length) {
|
|
1484
|
+
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
1485
|
+
if (obs && obs.length) {
|
|
1486
|
+
const n = obs.pop(), s = source.observerSlots.pop();
|
|
1487
|
+
if (index < obs.length) {
|
|
1488
|
+
n.sourceSlots[s] = index;
|
|
1489
|
+
obs[index] = n;
|
|
1490
|
+
source.observerSlots[index] = s;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
if (node.tOwned) {
|
|
1496
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
1497
|
+
delete node.tOwned;
|
|
1498
|
+
}
|
|
1499
|
+
if (Transition && Transition.running && node.pure) {
|
|
1500
|
+
reset(node, true);
|
|
1501
|
+
} else if (node.owned) {
|
|
1502
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
1503
|
+
node.owned = null;
|
|
1504
|
+
}
|
|
1505
|
+
if (node.cleanups) {
|
|
1506
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
1507
|
+
node.cleanups = null;
|
|
1508
|
+
}
|
|
1509
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
1510
|
+
else node.state = 0;
|
|
1511
|
+
}
|
|
1512
|
+
function reset(node, top) {
|
|
1513
|
+
if (!top) {
|
|
1514
|
+
node.tState = 0;
|
|
1515
|
+
Transition.disposed.add(node);
|
|
1516
|
+
}
|
|
1517
|
+
if (node.owned) {
|
|
1518
|
+
for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
function castError(err) {
|
|
1522
|
+
if (err instanceof Error) return err;
|
|
1523
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
1524
|
+
cause: err
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
function runErrors(err, fns, owner) {
|
|
1528
|
+
try {
|
|
1529
|
+
for (const f of fns) f(err);
|
|
1530
|
+
} catch (e) {
|
|
1531
|
+
handleError(e, owner && owner.owner || null);
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
function handleError(err, owner = Owner) {
|
|
1535
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
1536
|
+
const error = castError(err);
|
|
1537
|
+
if (!fns) throw error;
|
|
1538
|
+
if (Effects) Effects.push({
|
|
1539
|
+
fn() {
|
|
1540
|
+
runErrors(error, fns, owner);
|
|
1541
|
+
},
|
|
1542
|
+
state: STALE
|
|
1543
|
+
});
|
|
1544
|
+
else runErrors(error, fns, owner);
|
|
1545
|
+
}
|
|
1546
|
+
var FALLBACK = /* @__PURE__ */ Symbol("fallback");
|
|
1547
|
+
function dispose(d) {
|
|
1548
|
+
for (let i = 0; i < d.length; i++) d[i]();
|
|
1549
|
+
}
|
|
1550
|
+
function mapArray(list, mapFn, options = {}) {
|
|
1551
|
+
let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
|
|
1552
|
+
onCleanup(() => dispose(disposers));
|
|
1553
|
+
return () => {
|
|
1554
|
+
let newItems = list() || [], newLen = newItems.length, i, j;
|
|
1555
|
+
newItems[$TRACK];
|
|
1556
|
+
return untrack(() => {
|
|
1557
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
1558
|
+
if (newLen === 0) {
|
|
1559
|
+
if (len !== 0) {
|
|
1560
|
+
dispose(disposers);
|
|
1561
|
+
disposers = [];
|
|
1562
|
+
items = [];
|
|
1563
|
+
mapped = [];
|
|
1564
|
+
len = 0;
|
|
1565
|
+
indexes && (indexes = []);
|
|
1566
|
+
}
|
|
1567
|
+
if (options.fallback) {
|
|
1568
|
+
items = [FALLBACK];
|
|
1569
|
+
mapped[0] = createRoot((disposer) => {
|
|
1570
|
+
disposers[0] = disposer;
|
|
1571
|
+
return options.fallback();
|
|
1572
|
+
});
|
|
1573
|
+
len = 1;
|
|
1574
|
+
}
|
|
1575
|
+
} else if (len === 0) {
|
|
1576
|
+
mapped = new Array(newLen);
|
|
1577
|
+
for (j = 0; j < newLen; j++) {
|
|
1578
|
+
items[j] = newItems[j];
|
|
1579
|
+
mapped[j] = createRoot(mapper);
|
|
1580
|
+
}
|
|
1581
|
+
len = newLen;
|
|
1582
|
+
} else {
|
|
1583
|
+
temp = new Array(newLen);
|
|
1584
|
+
tempdisposers = new Array(newLen);
|
|
1585
|
+
indexes && (tempIndexes = new Array(newLen));
|
|
1586
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++) ;
|
|
1587
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
1588
|
+
temp[newEnd] = mapped[end];
|
|
1589
|
+
tempdisposers[newEnd] = disposers[end];
|
|
1590
|
+
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
1591
|
+
}
|
|
1592
|
+
newIndices = /* @__PURE__ */ new Map();
|
|
1593
|
+
newIndicesNext = new Array(newEnd + 1);
|
|
1594
|
+
for (j = newEnd; j >= start; j--) {
|
|
1595
|
+
item = newItems[j];
|
|
1596
|
+
i = newIndices.get(item);
|
|
1597
|
+
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
1598
|
+
newIndices.set(item, j);
|
|
1599
|
+
}
|
|
1600
|
+
for (i = start; i <= end; i++) {
|
|
1601
|
+
item = items[i];
|
|
1602
|
+
j = newIndices.get(item);
|
|
1603
|
+
if (j !== void 0 && j !== -1) {
|
|
1604
|
+
temp[j] = mapped[i];
|
|
1605
|
+
tempdisposers[j] = disposers[i];
|
|
1606
|
+
indexes && (tempIndexes[j] = indexes[i]);
|
|
1607
|
+
j = newIndicesNext[j];
|
|
1608
|
+
newIndices.set(item, j);
|
|
1609
|
+
} else disposers[i]();
|
|
1610
|
+
}
|
|
1611
|
+
for (j = start; j < newLen; j++) {
|
|
1612
|
+
if (j in temp) {
|
|
1613
|
+
mapped[j] = temp[j];
|
|
1614
|
+
disposers[j] = tempdisposers[j];
|
|
1615
|
+
if (indexes) {
|
|
1616
|
+
indexes[j] = tempIndexes[j];
|
|
1617
|
+
indexes[j](j);
|
|
1618
|
+
}
|
|
1619
|
+
} else mapped[j] = createRoot(mapper);
|
|
1620
|
+
}
|
|
1621
|
+
mapped = mapped.slice(0, len = newLen);
|
|
1622
|
+
items = newItems.slice(0);
|
|
1623
|
+
}
|
|
1624
|
+
return mapped;
|
|
1625
|
+
});
|
|
1626
|
+
function mapper(disposer) {
|
|
1627
|
+
disposers[j] = disposer;
|
|
1628
|
+
if (indexes) {
|
|
1629
|
+
const [s, set] = createSignal(j);
|
|
1630
|
+
indexes[j] = set;
|
|
1631
|
+
return mapFn(newItems[j], s);
|
|
1632
|
+
}
|
|
1633
|
+
return mapFn(newItems[j]);
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
var hydrationEnabled = false;
|
|
1638
|
+
function createComponent(Comp, props) {
|
|
1639
|
+
if (hydrationEnabled) {
|
|
1640
|
+
if (sharedConfig.context) {
|
|
1641
|
+
const c = sharedConfig.context;
|
|
1642
|
+
setHydrateContext(nextHydrateContext());
|
|
1643
|
+
const r = untrack(() => Comp(props || {}));
|
|
1644
|
+
setHydrateContext(c);
|
|
1645
|
+
return r;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
return untrack(() => Comp(props || {}));
|
|
1649
|
+
}
|
|
1650
|
+
var narrowedError = (name) => `Stale read from <${name}>.`;
|
|
1651
|
+
function For(props) {
|
|
1652
|
+
const fallback = "fallback" in props && {
|
|
1653
|
+
fallback: () => props.fallback
|
|
1654
|
+
};
|
|
1655
|
+
return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
|
|
1656
|
+
}
|
|
1657
|
+
function Show(props) {
|
|
1658
|
+
const keyed = props.keyed;
|
|
1659
|
+
const conditionValue = createMemo(() => props.when, void 0, void 0);
|
|
1660
|
+
const condition = keyed ? conditionValue : createMemo(conditionValue, void 0, {
|
|
1661
|
+
equals: (a, b) => !a === !b
|
|
1662
|
+
});
|
|
1663
|
+
return createMemo(() => {
|
|
1664
|
+
const c = condition();
|
|
1665
|
+
if (c) {
|
|
1666
|
+
const child = props.children;
|
|
1667
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
1668
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
1669
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
1670
|
+
return conditionValue();
|
|
1671
|
+
})) : child;
|
|
1672
|
+
}
|
|
1673
|
+
return props.fallback;
|
|
1674
|
+
}, void 0, void 0);
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// ../../node_modules/.pnpm/solid-js@1.9.12/node_modules/solid-js/web/dist/web.js
|
|
1678
|
+
var booleans = [
|
|
1679
|
+
"allowfullscreen",
|
|
1680
|
+
"async",
|
|
1681
|
+
"alpha",
|
|
1682
|
+
"autofocus",
|
|
1683
|
+
"autoplay",
|
|
1684
|
+
"checked",
|
|
1685
|
+
"controls",
|
|
1686
|
+
"default",
|
|
1687
|
+
"disabled",
|
|
1688
|
+
"formnovalidate",
|
|
1689
|
+
"hidden",
|
|
1690
|
+
"indeterminate",
|
|
1691
|
+
"inert",
|
|
1692
|
+
"ismap",
|
|
1693
|
+
"loop",
|
|
1694
|
+
"multiple",
|
|
1695
|
+
"muted",
|
|
1696
|
+
"nomodule",
|
|
1697
|
+
"novalidate",
|
|
1698
|
+
"open",
|
|
1699
|
+
"playsinline",
|
|
1700
|
+
"readonly",
|
|
1701
|
+
"required",
|
|
1702
|
+
"reversed",
|
|
1703
|
+
"seamless",
|
|
1704
|
+
"selected",
|
|
1705
|
+
"adauctionheaders",
|
|
1706
|
+
"browsingtopics",
|
|
1707
|
+
"credentialless",
|
|
1708
|
+
"defaultchecked",
|
|
1709
|
+
"defaultmuted",
|
|
1710
|
+
"defaultselected",
|
|
1711
|
+
"defer",
|
|
1712
|
+
"disablepictureinpicture",
|
|
1713
|
+
"disableremoteplayback",
|
|
1714
|
+
"preservespitch",
|
|
1715
|
+
"shadowrootclonable",
|
|
1716
|
+
"shadowrootcustomelementregistry",
|
|
1717
|
+
"shadowrootdelegatesfocus",
|
|
1718
|
+
"shadowrootserializable",
|
|
1719
|
+
"sharedstoragewritable"
|
|
1720
|
+
];
|
|
1721
|
+
var Properties = /* @__PURE__ */ new Set([
|
|
1722
|
+
"className",
|
|
1723
|
+
"value",
|
|
1724
|
+
"readOnly",
|
|
1725
|
+
"noValidate",
|
|
1726
|
+
"formNoValidate",
|
|
1727
|
+
"isMap",
|
|
1728
|
+
"noModule",
|
|
1729
|
+
"playsInline",
|
|
1730
|
+
"adAuctionHeaders",
|
|
1731
|
+
"allowFullscreen",
|
|
1732
|
+
"browsingTopics",
|
|
1733
|
+
"defaultChecked",
|
|
1734
|
+
"defaultMuted",
|
|
1735
|
+
"defaultSelected",
|
|
1736
|
+
"disablePictureInPicture",
|
|
1737
|
+
"disableRemotePlayback",
|
|
1738
|
+
"preservesPitch",
|
|
1739
|
+
"shadowRootClonable",
|
|
1740
|
+
"shadowRootCustomElementRegistry",
|
|
1741
|
+
"shadowRootDelegatesFocus",
|
|
1742
|
+
"shadowRootSerializable",
|
|
1743
|
+
"sharedStorageWritable",
|
|
1744
|
+
...booleans
|
|
1745
|
+
]);
|
|
1746
|
+
var memo = (fn) => createMemo(() => fn());
|
|
1747
|
+
function reconcileArrays(parentNode, a, b) {
|
|
1748
|
+
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
1749
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
1750
|
+
if (a[aStart] === b[bStart]) {
|
|
1751
|
+
aStart++;
|
|
1752
|
+
bStart++;
|
|
1753
|
+
continue;
|
|
1754
|
+
}
|
|
1755
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
1756
|
+
aEnd--;
|
|
1757
|
+
bEnd--;
|
|
1758
|
+
}
|
|
1759
|
+
if (aEnd === aStart) {
|
|
1760
|
+
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
1761
|
+
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
1762
|
+
} else if (bEnd === bStart) {
|
|
1763
|
+
while (aStart < aEnd) {
|
|
1764
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
1765
|
+
aStart++;
|
|
1766
|
+
}
|
|
1767
|
+
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
1768
|
+
const node = a[--aEnd].nextSibling;
|
|
1769
|
+
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
1770
|
+
parentNode.insertBefore(b[--bEnd], node);
|
|
1771
|
+
a[aEnd] = b[bEnd];
|
|
1772
|
+
} else {
|
|
1773
|
+
if (!map) {
|
|
1774
|
+
map = /* @__PURE__ */ new Map();
|
|
1775
|
+
let i = bStart;
|
|
1776
|
+
while (i < bEnd) map.set(b[i], i++);
|
|
1777
|
+
}
|
|
1778
|
+
const index = map.get(a[aStart]);
|
|
1779
|
+
if (index != null) {
|
|
1780
|
+
if (bStart < index && index < bEnd) {
|
|
1781
|
+
let i = aStart, sequence = 1, t;
|
|
1782
|
+
while (++i < aEnd && i < bEnd) {
|
|
1783
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
1784
|
+
sequence++;
|
|
1785
|
+
}
|
|
1786
|
+
if (sequence > index - bStart) {
|
|
1787
|
+
const node = a[aStart];
|
|
1788
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
1789
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
1790
|
+
} else aStart++;
|
|
1791
|
+
} else a[aStart++].remove();
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
var $$EVENTS = "_$DX_DELEGATE";
|
|
1796
|
+
function render(code, element, init, options = {}) {
|
|
1797
|
+
let disposer;
|
|
1798
|
+
createRoot((dispose2) => {
|
|
1799
|
+
disposer = dispose2;
|
|
1800
|
+
element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
|
|
1801
|
+
}, options.owner);
|
|
1802
|
+
return () => {
|
|
1803
|
+
disposer();
|
|
1804
|
+
element.textContent = "";
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1807
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
1808
|
+
let node;
|
|
1809
|
+
const create = () => {
|
|
1810
|
+
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
1811
|
+
t.innerHTML = html;
|
|
1812
|
+
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
1813
|
+
};
|
|
1814
|
+
const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
1815
|
+
fn.cloneNode = fn;
|
|
1816
|
+
return fn;
|
|
1817
|
+
}
|
|
1818
|
+
function delegateEvents(eventNames, document2 = window.document) {
|
|
1819
|
+
const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
1820
|
+
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
1821
|
+
const name = eventNames[i];
|
|
1822
|
+
if (!e.has(name)) {
|
|
1823
|
+
e.add(name);
|
|
1824
|
+
document2.addEventListener(name, eventHandler);
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
function setAttribute(node, name, value) {
|
|
1829
|
+
if (isHydrating(node)) return;
|
|
1830
|
+
if (value == null) node.removeAttribute(name);
|
|
1831
|
+
else node.setAttribute(name, value);
|
|
1832
|
+
}
|
|
1833
|
+
function className(node, value) {
|
|
1834
|
+
if (isHydrating(node)) return;
|
|
1835
|
+
if (value == null) node.removeAttribute("class");
|
|
1836
|
+
else node.className = value;
|
|
1837
|
+
}
|
|
1838
|
+
function addEventListener(node, name, handler, delegate) {
|
|
1839
|
+
if (delegate) {
|
|
1840
|
+
if (Array.isArray(handler)) {
|
|
1841
|
+
node[`$$${name}`] = handler[0];
|
|
1842
|
+
node[`$$${name}Data`] = handler[1];
|
|
1843
|
+
} else node[`$$${name}`] = handler;
|
|
1844
|
+
} else if (Array.isArray(handler)) {
|
|
1845
|
+
const handlerFn = handler[0];
|
|
1846
|
+
node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
|
|
1847
|
+
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
1848
|
+
}
|
|
1849
|
+
function style(node, value, prev) {
|
|
1850
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
1851
|
+
const nodeStyle = node.style;
|
|
1852
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
1853
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = void 0);
|
|
1854
|
+
prev || (prev = {});
|
|
1855
|
+
value || (value = {});
|
|
1856
|
+
let v, s;
|
|
1857
|
+
for (s in prev) {
|
|
1858
|
+
value[s] == null && nodeStyle.removeProperty(s);
|
|
1859
|
+
delete prev[s];
|
|
1860
|
+
}
|
|
1861
|
+
for (s in value) {
|
|
1862
|
+
v = value[s];
|
|
1863
|
+
if (v !== prev[s]) {
|
|
1864
|
+
nodeStyle.setProperty(s, v);
|
|
1865
|
+
prev[s] = v;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
return prev;
|
|
1869
|
+
}
|
|
1870
|
+
function setStyleProperty(node, name, value) {
|
|
1871
|
+
value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
|
|
1872
|
+
}
|
|
1873
|
+
function use(fn, element, arg) {
|
|
1874
|
+
return untrack(() => fn(element, arg));
|
|
1875
|
+
}
|
|
1876
|
+
function insert(parent, accessor, marker, initial) {
|
|
1877
|
+
if (marker !== void 0 && !initial) initial = [];
|
|
1878
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
1879
|
+
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
|
|
1880
|
+
}
|
|
1881
|
+
function isHydrating(node) {
|
|
1882
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
1883
|
+
}
|
|
1884
|
+
function eventHandler(e) {
|
|
1885
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
1886
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
1887
|
+
}
|
|
1888
|
+
let node = e.target;
|
|
1889
|
+
const key = `$$${e.type}`;
|
|
1890
|
+
const oriTarget = e.target;
|
|
1891
|
+
const oriCurrentTarget = e.currentTarget;
|
|
1892
|
+
const retarget = (value) => Object.defineProperty(e, "target", {
|
|
1893
|
+
configurable: true,
|
|
1894
|
+
value
|
|
1895
|
+
});
|
|
1896
|
+
const handleNode = () => {
|
|
1897
|
+
const handler = node[key];
|
|
1898
|
+
if (handler && !node.disabled) {
|
|
1899
|
+
const data = node[`${key}Data`];
|
|
1900
|
+
data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
|
|
1901
|
+
if (e.cancelBubble) return;
|
|
1902
|
+
}
|
|
1903
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
1904
|
+
return true;
|
|
1905
|
+
};
|
|
1906
|
+
const walkUpTree = () => {
|
|
1907
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host)) ;
|
|
1908
|
+
};
|
|
1909
|
+
Object.defineProperty(e, "currentTarget", {
|
|
1910
|
+
configurable: true,
|
|
1911
|
+
get() {
|
|
1912
|
+
return node || document;
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
1916
|
+
if (e.composedPath) {
|
|
1917
|
+
const path = e.composedPath();
|
|
1918
|
+
retarget(path[0]);
|
|
1919
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
1920
|
+
node = path[i];
|
|
1921
|
+
if (!handleNode()) break;
|
|
1922
|
+
if (node._$host) {
|
|
1923
|
+
node = node._$host;
|
|
1924
|
+
walkUpTree();
|
|
1925
|
+
break;
|
|
1926
|
+
}
|
|
1927
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
1928
|
+
break;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
} else walkUpTree();
|
|
1932
|
+
retarget(oriTarget);
|
|
1933
|
+
}
|
|
1934
|
+
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
1935
|
+
const hydrating = isHydrating(parent);
|
|
1936
|
+
if (hydrating) {
|
|
1937
|
+
!current && (current = [...parent.childNodes]);
|
|
1938
|
+
let cleaned = [];
|
|
1939
|
+
for (let i = 0; i < current.length; i++) {
|
|
1940
|
+
const node = current[i];
|
|
1941
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
1942
|
+
else cleaned.push(node);
|
|
1943
|
+
}
|
|
1944
|
+
current = cleaned;
|
|
1945
|
+
}
|
|
1946
|
+
while (typeof current === "function") current = current();
|
|
1947
|
+
if (value === current) return current;
|
|
1948
|
+
const t = typeof value, multi = marker !== void 0;
|
|
1949
|
+
parent = multi && current[0] && current[0].parentNode || parent;
|
|
1950
|
+
if (t === "string" || t === "number") {
|
|
1951
|
+
if (hydrating) return current;
|
|
1952
|
+
if (t === "number") {
|
|
1953
|
+
value = value.toString();
|
|
1954
|
+
if (value === current) return current;
|
|
1955
|
+
}
|
|
1956
|
+
if (multi) {
|
|
1957
|
+
let node = current[0];
|
|
1958
|
+
if (node && node.nodeType === 3) {
|
|
1959
|
+
node.data !== value && (node.data = value);
|
|
1960
|
+
} else node = document.createTextNode(value);
|
|
1961
|
+
current = cleanChildren(parent, current, marker, node);
|
|
1962
|
+
} else {
|
|
1963
|
+
if (current !== "" && typeof current === "string") {
|
|
1964
|
+
current = parent.firstChild.data = value;
|
|
1965
|
+
} else current = parent.textContent = value;
|
|
1966
|
+
}
|
|
1967
|
+
} else if (value == null || t === "boolean") {
|
|
1968
|
+
if (hydrating) return current;
|
|
1969
|
+
current = cleanChildren(parent, current, marker);
|
|
1970
|
+
} else if (t === "function") {
|
|
1971
|
+
createRenderEffect(() => {
|
|
1972
|
+
let v = value();
|
|
1973
|
+
while (typeof v === "function") v = v();
|
|
1974
|
+
current = insertExpression(parent, v, current, marker);
|
|
1975
|
+
});
|
|
1976
|
+
return () => current;
|
|
1977
|
+
} else if (Array.isArray(value)) {
|
|
1978
|
+
const array = [];
|
|
1979
|
+
const currentArray = current && Array.isArray(current);
|
|
1980
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
1981
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
1982
|
+
return () => current;
|
|
1983
|
+
}
|
|
1984
|
+
if (hydrating) {
|
|
1985
|
+
if (!array.length) return current;
|
|
1986
|
+
if (marker === void 0) return current = [...parent.childNodes];
|
|
1987
|
+
let node = array[0];
|
|
1988
|
+
if (node.parentNode !== parent) return current;
|
|
1989
|
+
const nodes = [node];
|
|
1990
|
+
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
1991
|
+
return current = nodes;
|
|
1992
|
+
}
|
|
1993
|
+
if (array.length === 0) {
|
|
1994
|
+
current = cleanChildren(parent, current, marker);
|
|
1995
|
+
if (multi) return current;
|
|
1996
|
+
} else if (currentArray) {
|
|
1997
|
+
if (current.length === 0) {
|
|
1998
|
+
appendNodes(parent, array, marker);
|
|
1999
|
+
} else reconcileArrays(parent, current, array);
|
|
2000
|
+
} else {
|
|
2001
|
+
current && cleanChildren(parent);
|
|
2002
|
+
appendNodes(parent, array);
|
|
2003
|
+
}
|
|
2004
|
+
current = array;
|
|
2005
|
+
} else if (value.nodeType) {
|
|
2006
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
2007
|
+
if (Array.isArray(current)) {
|
|
2008
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
2009
|
+
cleanChildren(parent, current, null, value);
|
|
2010
|
+
} else if (current == null || current === "" || !parent.firstChild) {
|
|
2011
|
+
parent.appendChild(value);
|
|
2012
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
2013
|
+
current = value;
|
|
2014
|
+
} else ;
|
|
2015
|
+
return current;
|
|
2016
|
+
}
|
|
2017
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
2018
|
+
let dynamic = false;
|
|
2019
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
2020
|
+
let item = array[i], prev = current && current[normalized.length], t;
|
|
2021
|
+
if (item == null || item === true || item === false) ;
|
|
2022
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
2023
|
+
normalized.push(item);
|
|
2024
|
+
} else if (Array.isArray(item)) {
|
|
2025
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
2026
|
+
} else if (t === "function") {
|
|
2027
|
+
if (unwrap) {
|
|
2028
|
+
while (typeof item === "function") item = item();
|
|
2029
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
2030
|
+
} else {
|
|
2031
|
+
normalized.push(item);
|
|
2032
|
+
dynamic = true;
|
|
2033
|
+
}
|
|
2034
|
+
} else {
|
|
2035
|
+
const value = String(item);
|
|
2036
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
2037
|
+
else normalized.push(document.createTextNode(value));
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
return dynamic;
|
|
2041
|
+
}
|
|
2042
|
+
function appendNodes(parent, array, marker = null) {
|
|
2043
|
+
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
2044
|
+
}
|
|
2045
|
+
function cleanChildren(parent, current, marker, replacement) {
|
|
2046
|
+
if (marker === void 0) return parent.textContent = "";
|
|
2047
|
+
const node = replacement || document.createTextNode("");
|
|
2048
|
+
if (current.length) {
|
|
2049
|
+
let inserted = false;
|
|
2050
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
2051
|
+
const el = current[i];
|
|
2052
|
+
if (node !== el) {
|
|
2053
|
+
const isParent = el.parentNode === parent;
|
|
2054
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
2055
|
+
else isParent && el.remove();
|
|
2056
|
+
} else inserted = true;
|
|
2057
|
+
}
|
|
2058
|
+
} else parent.insertBefore(node, marker);
|
|
2059
|
+
return [node];
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
// src/ui/styles/theme.ts
|
|
2063
|
+
var overlayStyles = `
|
|
2064
|
+
:host {
|
|
2065
|
+
all: initial;
|
|
2066
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
2067
|
+
font-size: 13px;
|
|
2068
|
+
line-height: 1.4;
|
|
2069
|
+
color: var(--pp-text);
|
|
2070
|
+
pointer-events: none;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
*,
|
|
2074
|
+
*::before,
|
|
2075
|
+
*::after {
|
|
2076
|
+
box-sizing: border-box;
|
|
2077
|
+
margin: 0;
|
|
2078
|
+
padding: 0;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/* Theme variables */
|
|
2082
|
+
:host {
|
|
2083
|
+
--pp-bg: rgba(24, 24, 27, 0.92);
|
|
2084
|
+
--pp-bg-solid: #18181b;
|
|
2085
|
+
--pp-text: #fafafa;
|
|
2086
|
+
--pp-text-muted: #a1a1aa;
|
|
2087
|
+
--pp-border: rgba(63, 63, 70, 0.6);
|
|
2088
|
+
--pp-accent: #3b82f6;
|
|
2089
|
+
--pp-accent-hover: #60a5fa;
|
|
2090
|
+
--pp-success: #22c55e;
|
|
2091
|
+
--pp-warning: #eab308;
|
|
2092
|
+
--pp-danger: #ef4444;
|
|
2093
|
+
--pp-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.06);
|
|
2094
|
+
--pp-radius: 10px;
|
|
2095
|
+
--pp-radius-sm: 6px;
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
:host([data-theme="light"]) {
|
|
2099
|
+
--pp-bg: rgba(255, 255, 255, 0.92);
|
|
2100
|
+
--pp-bg-solid: #ffffff;
|
|
2101
|
+
--pp-text: #18181b;
|
|
2102
|
+
--pp-text-muted: #71717a;
|
|
2103
|
+
--pp-border: rgba(228, 228, 231, 0.8);
|
|
2104
|
+
--pp-accent: #2563eb;
|
|
2105
|
+
--pp-accent-hover: #3b82f6;
|
|
2106
|
+
--pp-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06);
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
:host([data-theme="light"]) .pp-popup__textarea {
|
|
2110
|
+
background: rgba(0, 0, 0, 0.06);
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
/* Toolbar */
|
|
2114
|
+
.pp-toolbar {
|
|
2115
|
+
position: fixed;
|
|
2116
|
+
z-index: 2147483646;
|
|
2117
|
+
pointer-events: auto;
|
|
2118
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
2119
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%);
|
|
2120
|
+
background: var(--pp-bg);
|
|
2121
|
+
border: 1px solid var(--pp-border);
|
|
2122
|
+
border-radius: var(--pp-radius);
|
|
2123
|
+
box-shadow: var(--pp-shadow);
|
|
2124
|
+
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
|
2125
|
+
user-select: none;
|
|
2126
|
+
cursor: default;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
.pp-toolbar--collapsed {
|
|
2130
|
+
padding: 10px;
|
|
2131
|
+
display: flex;
|
|
2132
|
+
align-items: center;
|
|
2133
|
+
justify-content: center;
|
|
2134
|
+
gap: 6px;
|
|
2135
|
+
cursor: pointer;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
.pp-toolbar--expanded {
|
|
2139
|
+
padding: 12px;
|
|
2140
|
+
width: 320px;
|
|
2141
|
+
max-height: 420px;
|
|
2142
|
+
display: flex;
|
|
2143
|
+
flex-direction: column;
|
|
2144
|
+
gap: 8px;
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
.pp-toolbar__badge {
|
|
2148
|
+
display: inline-flex;
|
|
2149
|
+
align-items: center;
|
|
2150
|
+
justify-content: center;
|
|
2151
|
+
min-width: 18px;
|
|
2152
|
+
height: 18px;
|
|
2153
|
+
padding: 0 5px;
|
|
2154
|
+
border-radius: 9px;
|
|
2155
|
+
background: var(--pp-accent);
|
|
2156
|
+
color: #fff;
|
|
2157
|
+
font-size: 11px;
|
|
2158
|
+
font-weight: 600;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
/* Buttons */
|
|
2162
|
+
.pp-btn {
|
|
2163
|
+
display: inline-flex;
|
|
2164
|
+
align-items: center;
|
|
2165
|
+
justify-content: center;
|
|
2166
|
+
gap: 4px;
|
|
2167
|
+
padding: 5px 10px;
|
|
2168
|
+
border: 1px solid var(--pp-border);
|
|
2169
|
+
border-radius: var(--pp-radius-sm);
|
|
2170
|
+
background: transparent;
|
|
2171
|
+
color: var(--pp-text);
|
|
2172
|
+
font-size: 12px;
|
|
2173
|
+
font-weight: 500;
|
|
2174
|
+
cursor: pointer;
|
|
2175
|
+
transition: all 0.15s ease;
|
|
2176
|
+
white-space: nowrap;
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
.pp-btn:hover {
|
|
2180
|
+
background: rgba(255, 255, 255, 0.06);
|
|
2181
|
+
border-color: var(--pp-accent);
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
.pp-btn--primary {
|
|
2185
|
+
background: var(--pp-accent);
|
|
2186
|
+
border-color: var(--pp-accent);
|
|
2187
|
+
color: #fff;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
.pp-btn--primary:hover {
|
|
2191
|
+
background: var(--pp-accent-hover);
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
.pp-btn--sm {
|
|
2195
|
+
padding: 3px 6px;
|
|
2196
|
+
font-size: 11px;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
.pp-btn--icon {
|
|
2200
|
+
padding: 4px;
|
|
2201
|
+
border: none;
|
|
2202
|
+
background: transparent;
|
|
2203
|
+
color: var(--pp-text-muted);
|
|
2204
|
+
cursor: pointer;
|
|
2205
|
+
border-radius: var(--pp-radius-sm);
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
.pp-btn--icon:hover {
|
|
2209
|
+
background: rgba(255, 255, 255, 0.06);
|
|
2210
|
+
color: var(--pp-text);
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
.pp-btn--icon-sm {
|
|
2214
|
+
padding: 2px;
|
|
2215
|
+
opacity: 0;
|
|
2216
|
+
pointer-events: none;
|
|
2217
|
+
transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
.pp-pin-item:hover .pp-btn--icon-sm,
|
|
2221
|
+
.pp-pin-item:focus-within .pp-btn--icon-sm {
|
|
2222
|
+
opacity: 1;
|
|
2223
|
+
pointer-events: auto;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
.pp-btn--icon-sm:hover {
|
|
2227
|
+
background: rgba(239, 68, 68, 0.15);
|
|
2228
|
+
color: var(--pp-danger);
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
@media (hover: none) {
|
|
2232
|
+
.pp-btn--icon-sm {
|
|
2233
|
+
opacity: 0.6;
|
|
2234
|
+
pointer-events: auto;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2239
|
+
.pp-btn--icon-sm { transition: none; }
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
/* Pin list */
|
|
2243
|
+
.pp-pin-list {
|
|
2244
|
+
display: flex;
|
|
2245
|
+
flex-direction: column;
|
|
2246
|
+
gap: 4px;
|
|
2247
|
+
overflow-y: auto;
|
|
2248
|
+
max-height: 240px;
|
|
2249
|
+
scrollbar-width: thin;
|
|
2250
|
+
scrollbar-color: var(--pp-border) transparent;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
.pp-pin-item {
|
|
2254
|
+
display: flex;
|
|
2255
|
+
align-items: center;
|
|
2256
|
+
gap: 8px;
|
|
2257
|
+
padding: 6px 8px;
|
|
2258
|
+
border-radius: var(--pp-radius-sm);
|
|
2259
|
+
cursor: pointer;
|
|
2260
|
+
transition: background 0.1s;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
.pp-pin-item:hover {
|
|
2264
|
+
background: rgba(255, 255, 255, 0.04);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
.pp-pin-item__number {
|
|
2268
|
+
display: flex;
|
|
2269
|
+
align-items: center;
|
|
2270
|
+
justify-content: center;
|
|
2271
|
+
width: 22px;
|
|
2272
|
+
height: 22px;
|
|
2273
|
+
min-width: 22px;
|
|
2274
|
+
padding: 0 4px;
|
|
2275
|
+
border-radius: 11px;
|
|
2276
|
+
background: var(--pp-accent);
|
|
2277
|
+
color: #fff;
|
|
2278
|
+
font-size: 11px;
|
|
2279
|
+
font-weight: 600;
|
|
2280
|
+
font-variant-numeric: tabular-nums;
|
|
2281
|
+
flex-shrink: 0;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
.pp-pin-item__content {
|
|
2285
|
+
flex: 1;
|
|
2286
|
+
min-width: 0;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
.pp-pin-item__comment {
|
|
2290
|
+
font-size: 12px;
|
|
2291
|
+
color: var(--pp-text);
|
|
2292
|
+
display: -webkit-box;
|
|
2293
|
+
-webkit-line-clamp: 2;
|
|
2294
|
+
-webkit-box-orient: vertical;
|
|
2295
|
+
overflow: hidden;
|
|
2296
|
+
word-break: break-word;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2299
|
+
.pp-pin-item__status {
|
|
2300
|
+
width: 6px;
|
|
2301
|
+
height: 6px;
|
|
2302
|
+
border-radius: 50%;
|
|
2303
|
+
flex-shrink: 0;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
.pp-pin-item__status--open { background: var(--pp-danger); }
|
|
2307
|
+
.pp-pin-item__status--acknowledged { background: var(--pp-warning); }
|
|
2308
|
+
.pp-pin-item__status--resolved { background: var(--pp-success); }
|
|
2309
|
+
.pp-pin-item__status--dismissed { background: var(--pp-text-muted); }
|
|
2310
|
+
|
|
2311
|
+
/* Action bar \u2014 horizontal icon bar at bottom */
|
|
2312
|
+
.pp-actions {
|
|
2313
|
+
display: flex;
|
|
2314
|
+
align-items: center;
|
|
2315
|
+
justify-content: center;
|
|
2316
|
+
gap: 6px;
|
|
2317
|
+
padding-top: 8px;
|
|
2318
|
+
border-top: 1px solid var(--pp-border);
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
.pp-actions .pp-btn--icon {
|
|
2322
|
+
width: 32px;
|
|
2323
|
+
height: 32px;
|
|
2324
|
+
border-radius: 50%;
|
|
2325
|
+
display: flex;
|
|
2326
|
+
align-items: center;
|
|
2327
|
+
justify-content: center;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
.pp-actions .pp-btn--icon:focus-visible {
|
|
2331
|
+
outline: 2px solid var(--pp-accent);
|
|
2332
|
+
outline-offset: 2px;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
/* Popup */
|
|
2336
|
+
.pp-popup {
|
|
2337
|
+
position: fixed;
|
|
2338
|
+
z-index: 2147483647;
|
|
2339
|
+
pointer-events: auto;
|
|
2340
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
2341
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%);
|
|
2342
|
+
background: var(--pp-bg);
|
|
2343
|
+
border: 1px solid var(--pp-border);
|
|
2344
|
+
border-radius: var(--pp-radius);
|
|
2345
|
+
box-shadow: var(--pp-shadow);
|
|
2346
|
+
padding: 10px;
|
|
2347
|
+
min-width: 280px;
|
|
2348
|
+
max-width: 360px;
|
|
2349
|
+
display: flex;
|
|
2350
|
+
flex-direction: column;
|
|
2351
|
+
gap: 6px;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
.pp-popup__element-info {
|
|
2355
|
+
font-size: 11px;
|
|
2356
|
+
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
2357
|
+
color: var(--pp-accent);
|
|
2358
|
+
word-break: break-all;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
.pp-popup__component {
|
|
2362
|
+
font-size: 12px;
|
|
2363
|
+
color: var(--pp-text-muted);
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
.pp-popup__source {
|
|
2367
|
+
font-size: 11px;
|
|
2368
|
+
color: var(--pp-text-muted);
|
|
2369
|
+
cursor: pointer;
|
|
2370
|
+
display: flex;
|
|
2371
|
+
align-items: center;
|
|
2372
|
+
gap: 4px;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
.pp-popup__source:hover {
|
|
2376
|
+
color: var(--pp-accent);
|
|
2377
|
+
text-decoration: underline;
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
/* Popup header with chevron toggle */
|
|
2381
|
+
.pp-popup__header {
|
|
2382
|
+
display: flex;
|
|
2383
|
+
align-items: center;
|
|
2384
|
+
justify-content: space-between;
|
|
2385
|
+
cursor: pointer;
|
|
2386
|
+
padding: 2px 0;
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
.pp-popup__name {
|
|
2390
|
+
font-size: 12px;
|
|
2391
|
+
font-weight: 500;
|
|
2392
|
+
color: var(--pp-text);
|
|
2393
|
+
overflow: hidden;
|
|
2394
|
+
text-overflow: ellipsis;
|
|
2395
|
+
white-space: nowrap;
|
|
2396
|
+
max-width: 280px;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
.pp-popup__chevron {
|
|
2400
|
+
color: var(--pp-text-muted);
|
|
2401
|
+
transition: transform 0.15s ease;
|
|
2402
|
+
display: flex;
|
|
2403
|
+
align-items: center;
|
|
2404
|
+
flex-shrink: 0;
|
|
2405
|
+
transform: rotate(-90deg);
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2408
|
+
.pp-popup__chevron--open {
|
|
2409
|
+
transform: rotate(0deg);
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
/* CSS-based collapsible \u2014 keeps DOM, animates height */
|
|
2413
|
+
.pp-popup__details {
|
|
2414
|
+
display: grid;
|
|
2415
|
+
grid-template-rows: 0fr;
|
|
2416
|
+
transition: grid-template-rows 0.2s ease-out;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
.pp-popup__details--open {
|
|
2420
|
+
grid-template-rows: 1fr;
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
.pp-popup__details-inner {
|
|
2424
|
+
overflow: hidden;
|
|
2425
|
+
display: flex;
|
|
2426
|
+
flex-direction: column;
|
|
2427
|
+
gap: 3px;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2431
|
+
.pp-popup__chevron,
|
|
2432
|
+
.pp-popup__details {
|
|
2433
|
+
transition: none;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
.pp-popup__textarea {
|
|
2438
|
+
width: 100%;
|
|
2439
|
+
min-height: 48px;
|
|
2440
|
+
max-height: 120px;
|
|
2441
|
+
padding: 8px;
|
|
2442
|
+
border: 1px solid var(--pp-border);
|
|
2443
|
+
border-radius: var(--pp-radius-sm);
|
|
2444
|
+
background: rgba(0, 0, 0, 0.2);
|
|
2445
|
+
color: var(--pp-text);
|
|
2446
|
+
font-size: 13px;
|
|
2447
|
+
font-family: inherit;
|
|
2448
|
+
resize: none;
|
|
2449
|
+
overflow-y: auto;
|
|
2450
|
+
outline: none;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
.pp-popup__textarea:focus {
|
|
2454
|
+
border-color: var(--pp-accent);
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
.pp-popup__actions {
|
|
2458
|
+
display: flex;
|
|
2459
|
+
gap: 6px;
|
|
2460
|
+
justify-content: flex-end;
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
.pp-popup__actions .pp-btn {
|
|
2464
|
+
height: 26px;
|
|
2465
|
+
padding: 0 10px;
|
|
2466
|
+
font-size: 12px;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
/* Selection label */
|
|
2470
|
+
.pp-selection-label {
|
|
2471
|
+
position: fixed;
|
|
2472
|
+
z-index: 2147483646;
|
|
2473
|
+
pointer-events: none;
|
|
2474
|
+
padding: 3px 8px;
|
|
2475
|
+
border-radius: 4px;
|
|
2476
|
+
background: var(--pp-accent);
|
|
2477
|
+
color: #fff;
|
|
2478
|
+
font-size: 11px;
|
|
2479
|
+
font-weight: 500;
|
|
2480
|
+
white-space: nowrap;
|
|
2481
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
/* Context menu */
|
|
2485
|
+
.pp-context-menu {
|
|
2486
|
+
position: fixed;
|
|
2487
|
+
z-index: 2147483647;
|
|
2488
|
+
pointer-events: auto;
|
|
2489
|
+
background: var(--pp-bg-solid);
|
|
2490
|
+
border: 1px solid var(--pp-border);
|
|
2491
|
+
border-radius: var(--pp-radius-sm);
|
|
2492
|
+
box-shadow: var(--pp-shadow);
|
|
2493
|
+
padding: 4px;
|
|
2494
|
+
min-width: 180px;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
.pp-context-menu__item {
|
|
2498
|
+
display: flex;
|
|
2499
|
+
align-items: center;
|
|
2500
|
+
gap: 8px;
|
|
2501
|
+
padding: 6px 8px;
|
|
2502
|
+
border-radius: 4px;
|
|
2503
|
+
cursor: pointer;
|
|
2504
|
+
font-size: 12px;
|
|
2505
|
+
color: var(--pp-text);
|
|
2506
|
+
transition: background 0.1s;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
.pp-context-menu__item:hover {
|
|
2510
|
+
background: rgba(255, 255, 255, 0.06);
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
.pp-context-menu__separator {
|
|
2514
|
+
height: 1px;
|
|
2515
|
+
background: var(--pp-border);
|
|
2516
|
+
margin: 4px 0;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/* Prompt mode */
|
|
2520
|
+
.pp-prompt {
|
|
2521
|
+
position: fixed;
|
|
2522
|
+
z-index: 2147483647;
|
|
2523
|
+
pointer-events: auto;
|
|
2524
|
+
display: flex;
|
|
2525
|
+
gap: 6px;
|
|
2526
|
+
align-items: center;
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
.pp-prompt__input {
|
|
2530
|
+
padding: 6px 10px;
|
|
2531
|
+
border: 1px solid var(--pp-accent);
|
|
2532
|
+
border-radius: var(--pp-radius-sm);
|
|
2533
|
+
background: var(--pp-bg);
|
|
2534
|
+
color: var(--pp-text);
|
|
2535
|
+
font-size: 13px;
|
|
2536
|
+
font-family: inherit;
|
|
2537
|
+
min-width: 240px;
|
|
2538
|
+
outline: none;
|
|
2539
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
/* Settings panel */
|
|
2543
|
+
.pp-settings {
|
|
2544
|
+
display: flex;
|
|
2545
|
+
flex-direction: column;
|
|
2546
|
+
gap: 8px;
|
|
2547
|
+
padding-top: 8px;
|
|
2548
|
+
border-top: 1px solid var(--pp-border);
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
.pp-settings__row {
|
|
2552
|
+
display: flex;
|
|
2553
|
+
align-items: center;
|
|
2554
|
+
justify-content: space-between;
|
|
2555
|
+
gap: 8px;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
.pp-settings__label {
|
|
2559
|
+
font-size: 12px;
|
|
2560
|
+
color: var(--pp-text);
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
.pp-settings__value {
|
|
2564
|
+
font-size: 11px;
|
|
2565
|
+
color: var(--pp-text-muted);
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
/* Toggle switch */
|
|
2569
|
+
.pp-toggle {
|
|
2570
|
+
position: relative;
|
|
2571
|
+
width: 32px;
|
|
2572
|
+
height: 18px;
|
|
2573
|
+
border-radius: 9px;
|
|
2574
|
+
background: var(--pp-border);
|
|
2575
|
+
cursor: pointer;
|
|
2576
|
+
transition: background 0.2s;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
.pp-toggle--active {
|
|
2580
|
+
background: var(--pp-accent);
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
.pp-toggle__thumb {
|
|
2584
|
+
position: absolute;
|
|
2585
|
+
top: 2px;
|
|
2586
|
+
left: 2px;
|
|
2587
|
+
width: 14px;
|
|
2588
|
+
height: 14px;
|
|
2589
|
+
border-radius: 50%;
|
|
2590
|
+
background: #fff;
|
|
2591
|
+
transition: transform 0.2s;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
.pp-toggle--active .pp-toggle__thumb {
|
|
2595
|
+
transform: translateX(14px);
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/* Kbd hints */
|
|
2599
|
+
.pp-kbd {
|
|
2600
|
+
display: inline-flex;
|
|
2601
|
+
align-items: center;
|
|
2602
|
+
justify-content: center;
|
|
2603
|
+
padding: 1px 4px;
|
|
2604
|
+
border: 1px solid var(--pp-border);
|
|
2605
|
+
border-radius: 3px;
|
|
2606
|
+
background: rgba(255, 255, 255, 0.04);
|
|
2607
|
+
font-size: 10px;
|
|
2608
|
+
font-family: inherit;
|
|
2609
|
+
color: var(--pp-text-muted);
|
|
2610
|
+
line-height: 1;
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
/* Mode tabs */
|
|
2614
|
+
.pp-mode-tabs {
|
|
2615
|
+
display: flex;
|
|
2616
|
+
gap: 2px;
|
|
2617
|
+
padding: 2px;
|
|
2618
|
+
background: rgba(255, 255, 255, 0.04);
|
|
2619
|
+
border-radius: var(--pp-radius-sm);
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
.pp-mode-tab {
|
|
2623
|
+
flex: 1;
|
|
2624
|
+
display: flex;
|
|
2625
|
+
align-items: center;
|
|
2626
|
+
justify-content: center;
|
|
2627
|
+
gap: 4px;
|
|
2628
|
+
padding: 5px 8px;
|
|
2629
|
+
border: none;
|
|
2630
|
+
border-radius: 4px;
|
|
2631
|
+
background: transparent;
|
|
2632
|
+
color: var(--pp-text-muted);
|
|
2633
|
+
font-size: 11px;
|
|
2634
|
+
font-weight: 500;
|
|
2635
|
+
cursor: pointer;
|
|
2636
|
+
white-space: nowrap;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
.pp-mode-tab:hover {
|
|
2640
|
+
color: var(--pp-text);
|
|
2641
|
+
background: rgba(255, 255, 255, 0.04);
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
.pp-mode-tab--active {
|
|
2645
|
+
background: rgba(255, 255, 255, 0.08);
|
|
2646
|
+
color: var(--pp-text);
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
.pp-mode-tab__count {
|
|
2650
|
+
display: inline-flex;
|
|
2651
|
+
align-items: center;
|
|
2652
|
+
justify-content: center;
|
|
2653
|
+
min-width: 16px;
|
|
2654
|
+
height: 16px;
|
|
2655
|
+
padding: 0 4px;
|
|
2656
|
+
border-radius: 8px;
|
|
2657
|
+
background: var(--pp-accent);
|
|
2658
|
+
color: #fff;
|
|
2659
|
+
font-size: 10px;
|
|
2660
|
+
font-weight: 600;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
/* Draw tools bar */
|
|
2664
|
+
.pp-draw-tools {
|
|
2665
|
+
display: flex;
|
|
2666
|
+
align-items: center;
|
|
2667
|
+
gap: 2px;
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
.pp-draw-tool {
|
|
2671
|
+
display: flex;
|
|
2672
|
+
align-items: center;
|
|
2673
|
+
justify-content: center;
|
|
2674
|
+
width: 32px;
|
|
2675
|
+
height: 32px;
|
|
2676
|
+
border: none;
|
|
2677
|
+
border-radius: var(--pp-radius-sm);
|
|
2678
|
+
background: transparent;
|
|
2679
|
+
color: var(--pp-text-muted);
|
|
2680
|
+
cursor: pointer;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
.pp-draw-tool:hover {
|
|
2684
|
+
background: rgba(255, 255, 255, 0.06);
|
|
2685
|
+
color: var(--pp-text);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
.pp-draw-tool--active {
|
|
2689
|
+
background: rgba(59, 130, 246, 0.15);
|
|
2690
|
+
color: var(--pp-accent);
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
.pp-draw-tool:disabled {
|
|
2694
|
+
opacity: 0.3;
|
|
2695
|
+
cursor: default;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
/* Draw options row */
|
|
2699
|
+
.pp-draw-options {
|
|
2700
|
+
display: flex;
|
|
2701
|
+
align-items: center;
|
|
2702
|
+
justify-content: space-between;
|
|
2703
|
+
gap: 8px;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
.pp-draw-colors {
|
|
2707
|
+
display: flex;
|
|
2708
|
+
gap: 4px;
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
.pp-color-swatch {
|
|
2712
|
+
width: 20px;
|
|
2713
|
+
height: 20px;
|
|
2714
|
+
border-radius: 50%;
|
|
2715
|
+
border: 2px solid transparent;
|
|
2716
|
+
cursor: pointer;
|
|
2717
|
+
padding: 0;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
.pp-color-swatch:hover {
|
|
2721
|
+
opacity: 0.85;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
.pp-color-swatch--active {
|
|
2725
|
+
border-color: #fff;
|
|
2726
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
.pp-draw-widths {
|
|
2730
|
+
display: flex;
|
|
2731
|
+
gap: 4px;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
.pp-width-btn {
|
|
2735
|
+
display: flex;
|
|
2736
|
+
align-items: center;
|
|
2737
|
+
justify-content: center;
|
|
2738
|
+
width: 28px;
|
|
2739
|
+
height: 28px;
|
|
2740
|
+
border: none;
|
|
2741
|
+
border-radius: var(--pp-radius-sm);
|
|
2742
|
+
background: transparent;
|
|
2743
|
+
cursor: pointer;
|
|
2744
|
+
padding: 0;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
.pp-width-btn:hover {
|
|
2748
|
+
background: rgba(255, 255, 255, 0.06);
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
.pp-width-btn--active {
|
|
2752
|
+
background: rgba(255, 255, 255, 0.1);
|
|
2753
|
+
outline: 1px solid var(--pp-border);
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
/* Queue badge in toolbar header */
|
|
2757
|
+
.pp-toolbar__queue-badge {
|
|
2758
|
+
display: inline-flex;
|
|
2759
|
+
align-items: center;
|
|
2760
|
+
justify-content: center;
|
|
2761
|
+
min-width: 18px;
|
|
2762
|
+
height: 18px;
|
|
2763
|
+
padding: 0 5px;
|
|
2764
|
+
border-radius: 9px;
|
|
2765
|
+
background: var(--pp-warning);
|
|
2766
|
+
color: #000;
|
|
2767
|
+
font-size: 10px;
|
|
2768
|
+
font-weight: 700;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
/* Popup input row with mic */
|
|
2772
|
+
.pp-popup__input-row {
|
|
2773
|
+
position: relative;
|
|
2774
|
+
display: flex;
|
|
2775
|
+
align-items: flex-start;
|
|
2776
|
+
gap: 4px;
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
.pp-popup__input-row .pp-popup__textarea {
|
|
2780
|
+
flex: 1;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
.pp-popup__mic {
|
|
2784
|
+
flex-shrink: 0;
|
|
2785
|
+
width: 32px;
|
|
2786
|
+
height: 32px;
|
|
2787
|
+
display: flex;
|
|
2788
|
+
align-items: center;
|
|
2789
|
+
justify-content: center;
|
|
2790
|
+
border-radius: 50%;
|
|
2791
|
+
margin-top: 4px;
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
.pp-popup__mic--recording {
|
|
2795
|
+
color: var(--pp-danger) !important;
|
|
2796
|
+
background: rgba(239, 68, 68, 0.15) !important;
|
|
2797
|
+
animation: pp-mic-pulse 1.2s ease-in-out infinite;
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
@keyframes pp-mic-pulse {
|
|
2801
|
+
0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
|
|
2802
|
+
50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
/* Ghost button (Fix this) */
|
|
2806
|
+
.pp-btn--ghost {
|
|
2807
|
+
display: inline-flex;
|
|
2808
|
+
align-items: center;
|
|
2809
|
+
gap: 4px;
|
|
2810
|
+
padding: 3px 8px;
|
|
2811
|
+
border: none;
|
|
2812
|
+
border-radius: var(--pp-radius-sm);
|
|
2813
|
+
background: transparent;
|
|
2814
|
+
color: var(--pp-warning);
|
|
2815
|
+
font-size: 11px;
|
|
2816
|
+
font-weight: 500;
|
|
2817
|
+
cursor: pointer;
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
.pp-btn--ghost:hover {
|
|
2821
|
+
background: rgba(234, 179, 8, 0.1);
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
/* Text input popup for draw-mode text annotations */
|
|
2825
|
+
.pp-text-input-popup {
|
|
2826
|
+
position: fixed;
|
|
2827
|
+
z-index: 2147483647;
|
|
2828
|
+
pointer-events: auto;
|
|
2829
|
+
display: flex;
|
|
2830
|
+
align-items: center;
|
|
2831
|
+
gap: 6px;
|
|
2832
|
+
padding: 4px 8px;
|
|
2833
|
+
background: var(--pp-bg);
|
|
2834
|
+
border: 1px solid var(--pp-border);
|
|
2835
|
+
border-radius: var(--pp-radius-sm);
|
|
2836
|
+
box-shadow: var(--pp-shadow);
|
|
2837
|
+
backdrop-filter: blur(12px) saturate(180%);
|
|
2838
|
+
-webkit-backdrop-filter: blur(12px) saturate(180%);
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
.pp-text-input-popup__indicator {
|
|
2842
|
+
width: 8px;
|
|
2843
|
+
height: 8px;
|
|
2844
|
+
border-radius: 50%;
|
|
2845
|
+
flex-shrink: 0;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
.pp-text-input-popup__input {
|
|
2849
|
+
border: none;
|
|
2850
|
+
background: transparent;
|
|
2851
|
+
color: var(--pp-text);
|
|
2852
|
+
font-size: 13px;
|
|
2853
|
+
font-family: inherit;
|
|
2854
|
+
outline: none;
|
|
2855
|
+
min-width: 200px;
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
/* Scrollbar */
|
|
2859
|
+
::-webkit-scrollbar {
|
|
2860
|
+
width: 4px;
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
::-webkit-scrollbar-track {
|
|
2864
|
+
background: transparent;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
::-webkit-scrollbar-thumb {
|
|
2868
|
+
background: var(--pp-border);
|
|
2869
|
+
border-radius: 2px;
|
|
2870
|
+
}
|
|
2871
|
+
`;
|
|
2872
|
+
|
|
2873
|
+
// src/ui/icons/index.ts
|
|
2874
|
+
var S = 'width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
|
|
2875
|
+
var icons = {
|
|
2876
|
+
pin: `<svg ${S}><path d="M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4"/><path d="M9 15l-4.5 4.5"/><path d="M14.5 4l5.5 5.5"/></svg>`,
|
|
2877
|
+
mapPin: `<svg ${S}><path d="M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"/><path d="M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0"/></svg>`,
|
|
2878
|
+
crosshair: `<svg ${S}><path d="M4 8v-2a2 2 0 0 1 2 -2h2"/><path d="M4 16v2a2 2 0 0 0 2 2h2"/><path d="M16 4h2a2 2 0 0 1 2 2v2"/><path d="M16 20h2a2 2 0 0 0 2 -2v-2"/><path d="M9 12l6 0"/><path d="M12 9l0 6"/></svg>`,
|
|
2879
|
+
send: `<svg ${S}><path d="M10 14l11 -11"/><path d="M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5"/></svg>`,
|
|
2880
|
+
copy: `<svg ${S}><path d="M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"/><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"/></svg>`,
|
|
2881
|
+
trash: `<svg ${S}><path d="M4 7l16 0"/><path d="M10 11l0 6"/><path d="M14 11l0 6"/><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"/><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"/></svg>`,
|
|
2882
|
+
settings: `<svg ${S}><path d="M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065"/><path d="M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"/></svg>`,
|
|
2883
|
+
x: `<svg ${S}><path d="M18 6l-12 12"/><path d="M6 6l12 12"/></svg>`,
|
|
2884
|
+
chevronDown: `<svg ${S}><path d="M6 9l6 6l6 -6"/></svg>`,
|
|
2885
|
+
check: `<svg ${S}><path d="M5 12l5 5l10 -10"/></svg>`,
|
|
2886
|
+
messageSquare: `<svg ${S}><path d="M8 9h8"/><path d="M8 13h6"/><path d="M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12"/></svg>`,
|
|
2887
|
+
eye: `<svg ${S}><path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/><path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"/></svg>`,
|
|
2888
|
+
fileCode: `<svg ${S}><path d="M14 3v4a1 1 0 0 0 1 1h4"/><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2"/><path d="M10 13l-1 2l1 2"/><path d="M14 13l1 2l-1 2"/></svg>`,
|
|
2889
|
+
history: `<svg ${S}><path d="M12 8l0 4l2 2"/><path d="M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"/></svg>`,
|
|
2890
|
+
minus: `<svg ${S}><path d="M5 12l14 0"/></svg>`,
|
|
2891
|
+
// Draw mode icons
|
|
2892
|
+
pencil: `<svg ${S}><path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"/><path d="M13.5 6.5l4 4"/></svg>`,
|
|
2893
|
+
arrowUpRight: `<svg ${S}><path d="M17 7l-10 10"/><path d="M8 7l9 0l0 9"/></svg>`,
|
|
2894
|
+
circle: `<svg ${S}><circle cx="12" cy="12" r="9"/></svg>`,
|
|
2895
|
+
square: `<svg ${S}><rect x="4" y="4" width="16" height="16" rx="2"/></svg>`,
|
|
2896
|
+
typography: `<svg ${S}><path d="M4 20l3 0"/><path d="M14 20l7 0"/><path d="M6.9 15l6.9 0"/><path d="M10.2 6.3l5.8 13.7"/><path d="M5 20l6 -16l2 0l7 16"/></svg>`,
|
|
2897
|
+
undo: `<svg ${S}><path d="M9 14l-4 -4l4 -4"/><path d="M5 10h11a4 4 0 1 1 0 8h-1"/></svg>`,
|
|
2898
|
+
palette: `<svg ${S}><path d="M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"/><circle cx="8.5" cy="10.5" r="1"/><circle cx="12.5" cy="7.5" r="1"/><circle cx="16.5" cy="10.5" r="1"/></svg>`,
|
|
2899
|
+
lineWeight: `<svg ${S}><path d="M4 6h16"/><path d="M4 12h16" stroke-width="3"/><path d="M4 18h16" stroke-width="5"/></svg>`,
|
|
2900
|
+
// Voice icon
|
|
2901
|
+
microphone: `<svg ${S}><path d="M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z"/><path d="M5 10a7 7 0 0 0 14 0"/><path d="M8 21l8 0"/><path d="M12 17l0 4"/></svg>`,
|
|
2902
|
+
microphoneOff: `<svg ${S}><path d="M3 3l18 18"/><path d="M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1"/><path d="M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85"/><path d="M8 21l8 0"/><path d="M12 17l0 4"/></svg>`,
|
|
2903
|
+
// Queue & batch icons
|
|
2904
|
+
plus: `<svg ${S}><path d="M12 5l0 14"/><path d="M5 12l14 0"/></svg>`,
|
|
2905
|
+
stack: `<svg ${S}><path d="M12 2l-8 4l8 4l8 -4l-8 -4"/><path d="M4 10l8 4l8 -4"/><path d="M4 14l8 4l8 -4"/></svg>`,
|
|
2906
|
+
checkSquare: `<svg ${S}><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M9 12l2 2l4 -4"/></svg>`,
|
|
2907
|
+
squareEmpty: `<svg ${S}><rect x="3" y="3" width="18" height="18" rx="2"/></svg>`,
|
|
2908
|
+
bolt: `<svg ${S}><path d="M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11"/></svg>`,
|
|
2909
|
+
checkCircle: `<svg ${S}><circle cx="12" cy="12" r="9"/><path d="M9 12l2 2l4 -4"/></svg>`
|
|
2910
|
+
};
|
|
2911
|
+
|
|
2912
|
+
// src/ui/components/Toolbar.tsx
|
|
2913
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
2914
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div style=display:flex;align-items:center;justify-content:center;gap:6px><span style=display:flex;align-items:center>`);
|
|
2915
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span class=pp-toolbar__badge>`);
|
|
2916
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<button class="pp-btn pp-btn--primary"style=width:100%><span style=display:inline-flex></span>Send <!> selected to Claude`);
|
|
2917
|
+
var _tmpl$5 = /* @__PURE__ */ template(`<div class=pp-draw-tools><button title=Freehand></button><button title=Arrow></button><button title=Circle></button><button title=Rectangle></button><button title="Text note"></button><div style=flex:1></div><button class=pp-draw-tool title="Undo (remove last stroke)"></button><button class=pp-draw-tool title="Clear drawing">`);
|
|
2918
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<div class=pp-draw-options><div class=pp-draw-colors></div><div class=pp-draw-widths>`);
|
|
2919
|
+
var _tmpl$7 = /* @__PURE__ */ template(`<div style=font-size:11px;color:var(--pp-text-muted);text-align:center> stroke`);
|
|
2920
|
+
var _tmpl$8 = /* @__PURE__ */ template(`<div class=pp-settings><div class=pp-settings__row><span class=pp-settings__label>Output detail</span><select style="background:var(--pp-bg-solid);color:var(--pp-text);border:1px solid var(--pp-border);border-radius:var(--pp-radius-sm);padding:2px 6px;font-size:11px"><option value=compact>Compact</option><option value=standard>Standard</option><option value=detailed>Detailed</option></select></div><div class=pp-settings__row><span class=pp-settings__label>Auto-submit</span><div><div class=pp-toggle__thumb></div></div></div><div class=pp-settings__row><span class=pp-settings__label>Clear on send</span><div><div class=pp-toggle__thumb></div></div></div><div class=pp-settings__row><span class=pp-settings__label>Block page clicks</span><div><div class=pp-toggle__thumb></div></div></div><div class=pp-settings__row><span class=pp-settings__label>Compact popup</span><div><div class=pp-toggle__thumb>`);
|
|
2921
|
+
var _tmpl$9 = /* @__PURE__ */ template(`<div style=display:contents><div style=display:flex;align-items:center;justify-content:space-between;font-size:12px;font-weight:600;letter-spacing:0.02em;color:var(--pp-text-muted)><span></span></div><div class=pp-mode-tabs role=tablist><button role=tab><span></span>Select</button><button role=tab><span></span>Draw</button><button role=tab><span></span>Queue</button></div><div class=pp-actions role=toolbar aria-label="Pinpoint actions"><button class=pp-btn--icon title="Send to agent"aria-label="Send to agent"></button><button class=pp-btn--icon title="Copy to clipboard"aria-label="Copy to clipboard"></button><button class=pp-btn--icon title=Settings aria-label="Toggle settings"></button><button class=pp-btn--icon title=Close aria-label="Close toolbar">`);
|
|
2922
|
+
var _tmpl$0 = /* @__PURE__ */ template(`<span class=pp-toolbar__queue-badge>`);
|
|
2923
|
+
var _tmpl$1 = /* @__PURE__ */ template(`<span class=pp-mode-tab__count>`);
|
|
2924
|
+
var _tmpl$10 = /* @__PURE__ */ template(`<div style=font-size:11px;color:var(--pp-accent);display:flex;align-items:center;gap:4px><span></span>Click any element to annotate`);
|
|
2925
|
+
var _tmpl$11 = /* @__PURE__ */ template(`<div class=pp-pin-list>`);
|
|
2926
|
+
var _tmpl$12 = /* @__PURE__ */ template(`<div class=pp-pin-item><div></div><span class=pp-pin-item__number></span><div class=pp-pin-item__content><div class=pp-pin-item__comment></div></div><button class="pp-btn--icon pp-btn--icon-sm"style=opacity:1;pointer-events:auto></button><button class="pp-btn--icon pp-btn--icon-sm"title="Remove pin"aria-label="Remove pin">`);
|
|
2927
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<span style=color:var(--pp-text-muted);font-style:italic>No comment`);
|
|
2928
|
+
var _tmpl$14 = /* @__PURE__ */ template(`<button>`);
|
|
2929
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<button><div style=width:16px>`);
|
|
2930
|
+
var _tmpl$16 = /* @__PURE__ */ template(`<div style="font-size:11px;color:var(--pp-text-muted);text-align:center;padding:8px 0">Queue is empty. Add pins or drawings, then queue them here.`);
|
|
2931
|
+
var _tmpl$17 = /* @__PURE__ */ template(`<div style=font-size:11px;color:var(--pp-text-muted);text-align:center>`);
|
|
2932
|
+
var _tmpl$18 = /* @__PURE__ */ template(`<div style=display:flex;gap:6px><button class=pp-btn style=flex:1>Clear</button><button class="pp-btn pp-btn--primary"style=flex:1><span style=display:inline-flex></span>Send All`);
|
|
2933
|
+
var _tmpl$19 = /* @__PURE__ */ template(`<div class=pp-pin-item><span class=pp-pin-item__number></span><div class=pp-pin-item__content><div class=pp-pin-item__comment>`);
|
|
2934
|
+
var _tmpl$20 = /* @__PURE__ */ template(`<button class=pp-btn--icon title="Clear all"aria-label="Clear all pins">`);
|
|
2935
|
+
var DRAW_COLORS = [{
|
|
2936
|
+
color: "#EF4444",
|
|
2937
|
+
name: "Red"
|
|
2938
|
+
}, {
|
|
2939
|
+
color: "#3B82F6",
|
|
2940
|
+
name: "Blue"
|
|
2941
|
+
}, {
|
|
2942
|
+
color: "#22C55E",
|
|
2943
|
+
name: "Green"
|
|
2944
|
+
}, {
|
|
2945
|
+
color: "#EAB308",
|
|
2946
|
+
name: "Yellow"
|
|
2947
|
+
}];
|
|
2948
|
+
var LINE_WIDTHS = [{
|
|
2949
|
+
width: 2,
|
|
2950
|
+
name: "Thin"
|
|
2951
|
+
}, {
|
|
2952
|
+
width: 4,
|
|
2953
|
+
name: "Medium"
|
|
2954
|
+
}, {
|
|
2955
|
+
width: 8,
|
|
2956
|
+
name: "Thick"
|
|
2957
|
+
}];
|
|
2958
|
+
var Toolbar = (props) => {
|
|
2959
|
+
const [pos, setPos] = createSignal(props.position ? {
|
|
2960
|
+
right: window.innerWidth - props.position.x,
|
|
2961
|
+
bottom: window.innerHeight - props.position.y
|
|
2962
|
+
} : {
|
|
2963
|
+
right: 16,
|
|
2964
|
+
bottom: 16
|
|
2965
|
+
});
|
|
2966
|
+
const [dragging, setDragging] = createSignal(false);
|
|
2967
|
+
const [dragStart, setDragStart] = createSignal({
|
|
2968
|
+
x: 0,
|
|
2969
|
+
y: 0,
|
|
2970
|
+
right: 0,
|
|
2971
|
+
bottom: 0
|
|
2972
|
+
});
|
|
2973
|
+
const [didDrag, setDidDrag] = createSignal(false);
|
|
2974
|
+
function handleMouseDown(e) {
|
|
2975
|
+
if (props.expanded) return;
|
|
2976
|
+
setDragging(true);
|
|
2977
|
+
setDidDrag(false);
|
|
2978
|
+
setDragStart({
|
|
2979
|
+
x: e.clientX,
|
|
2980
|
+
y: e.clientY,
|
|
2981
|
+
right: pos().right,
|
|
2982
|
+
bottom: pos().bottom
|
|
2983
|
+
});
|
|
2984
|
+
const handleMove = (e2) => {
|
|
2985
|
+
setDidDrag(true);
|
|
2986
|
+
const start = dragStart();
|
|
2987
|
+
const dx = e2.clientX - start.x;
|
|
2988
|
+
const dy = e2.clientY - start.y;
|
|
2989
|
+
setPos({
|
|
2990
|
+
right: Math.max(0, Math.min(window.innerWidth - 60, start.right - dx)),
|
|
2991
|
+
bottom: Math.max(0, Math.min(window.innerHeight - 60, start.bottom - dy))
|
|
2992
|
+
});
|
|
2993
|
+
};
|
|
2994
|
+
const handleUp = () => {
|
|
2995
|
+
setDragging(false);
|
|
2996
|
+
window.removeEventListener("mousemove", handleMove);
|
|
2997
|
+
window.removeEventListener("mouseup", handleUp);
|
|
2998
|
+
};
|
|
2999
|
+
window.addEventListener("mousemove", handleMove);
|
|
3000
|
+
window.addEventListener("mouseup", handleUp);
|
|
3001
|
+
}
|
|
3002
|
+
function handleClick(e) {
|
|
3003
|
+
if (props.expanded) return;
|
|
3004
|
+
if (didDrag()) return;
|
|
3005
|
+
props.onToggleExpand();
|
|
3006
|
+
}
|
|
3007
|
+
const queueSummary = () => {
|
|
3008
|
+
const q = props.queue;
|
|
3009
|
+
let draws = 0;
|
|
3010
|
+
let clicks = 0;
|
|
3011
|
+
for (const item of q) {
|
|
3012
|
+
if (item.drawings?.length || item.textNotes?.length) draws++;
|
|
3013
|
+
if (item.pin) clicks++;
|
|
3014
|
+
}
|
|
3015
|
+
const parts = [];
|
|
3016
|
+
if (draws > 0) parts.push(`Draw x${draws}`);
|
|
3017
|
+
if (clicks > 0) parts.push(`Click x${clicks}`);
|
|
3018
|
+
return parts.join(" / ") || "Empty";
|
|
3019
|
+
};
|
|
3020
|
+
const totalBadgeCount = () => props.pins.length + props.queue.length + props.drawStrokeCount;
|
|
3021
|
+
return (() => {
|
|
3022
|
+
var _el$ = _tmpl$();
|
|
3023
|
+
addEventListener(_el$, "click", handleClick);
|
|
3024
|
+
addEventListener(_el$, "mousedown", props.expanded ? void 0 : handleMouseDown, true);
|
|
3025
|
+
insert(_el$, (() => {
|
|
3026
|
+
var _c$ = memo(() => !!!props.expanded);
|
|
3027
|
+
return () => _c$() ? (
|
|
3028
|
+
/* Collapsed pill */
|
|
3029
|
+
(() => {
|
|
3030
|
+
var _el$2 = _tmpl$2(), _el$3 = _el$2.firstChild;
|
|
3031
|
+
insert(_el$2, (() => {
|
|
3032
|
+
var _c$2 = memo(() => totalBadgeCount() > 0);
|
|
3033
|
+
return () => _c$2() && (() => {
|
|
3034
|
+
var _el$4 = _tmpl$3();
|
|
3035
|
+
insert(_el$4, totalBadgeCount);
|
|
3036
|
+
return _el$4;
|
|
3037
|
+
})();
|
|
3038
|
+
})(), _el$3);
|
|
3039
|
+
createRenderEffect(() => _el$3.innerHTML = icons.pin);
|
|
3040
|
+
return _el$2;
|
|
3041
|
+
})()
|
|
3042
|
+
) : (
|
|
3043
|
+
/* Expanded toolbar */
|
|
3044
|
+
(() => {
|
|
3045
|
+
var _el$5 = _tmpl$9(), _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$6.nextSibling, _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$9.nextSibling, _el$10 = _el$1.firstChild, _el$11 = _el$1.nextSibling, _el$12 = _el$11.firstChild, _el$13 = _el$12.nextSibling, _el$49 = _el$8.nextSibling, _el$50 = _el$49.firstChild, _el$51 = _el$50.nextSibling, _el$52 = _el$51.nextSibling, _el$53 = _el$52.nextSibling;
|
|
3046
|
+
addEventListener(_el$5, "click", (e) => e.stopPropagation());
|
|
3047
|
+
insert(_el$7, () => props.author || "Pinpoint");
|
|
3048
|
+
insert(_el$6, (() => {
|
|
3049
|
+
var _c$3 = memo(() => props.queue.length > 0);
|
|
3050
|
+
return () => _c$3() && (() => {
|
|
3051
|
+
var _el$54 = _tmpl$0();
|
|
3052
|
+
insert(_el$54, () => props.queue.length);
|
|
3053
|
+
return _el$54;
|
|
3054
|
+
})();
|
|
3055
|
+
})(), null);
|
|
3056
|
+
addEventListener(_el$9, "click", () => props.onModeChange("select"));
|
|
3057
|
+
addEventListener(_el$1, "click", () => props.onModeChange("draw"));
|
|
3058
|
+
addEventListener(_el$11, "click", () => props.onModeChange("queue"));
|
|
3059
|
+
insert(_el$11, (() => {
|
|
3060
|
+
var _c$4 = memo(() => props.queue.length > 0);
|
|
3061
|
+
return () => _c$4() && (() => {
|
|
3062
|
+
var _el$55 = _tmpl$1();
|
|
3063
|
+
insert(_el$55, () => props.queue.length);
|
|
3064
|
+
return _el$55;
|
|
3065
|
+
})();
|
|
3066
|
+
})(), null);
|
|
3067
|
+
insert(_el$5, createComponent(Show, {
|
|
3068
|
+
get when() {
|
|
3069
|
+
return props.mode === "select";
|
|
3070
|
+
},
|
|
3071
|
+
get children() {
|
|
3072
|
+
return [memo(() => memo(() => props.pins.length === 0)() && (() => {
|
|
3073
|
+
var _el$56 = _tmpl$10(), _el$57 = _el$56.firstChild;
|
|
3074
|
+
createRenderEffect(() => _el$57.innerHTML = icons.crosshair);
|
|
3075
|
+
return _el$56;
|
|
3076
|
+
})()), memo(() => memo(() => props.pins.length > 0)() && (() => {
|
|
3077
|
+
var _el$58 = _tmpl$11();
|
|
3078
|
+
insert(_el$58, createComponent(For, {
|
|
3079
|
+
get each() {
|
|
3080
|
+
return props.pins;
|
|
3081
|
+
},
|
|
3082
|
+
children: (pin, index) => (() => {
|
|
3083
|
+
var _el$59 = _tmpl$12(), _el$60 = _el$59.firstChild, _el$61 = _el$60.nextSibling, _el$62 = _el$61.nextSibling, _el$63 = _el$62.firstChild, _el$64 = _el$62.nextSibling, _el$65 = _el$64.nextSibling;
|
|
3084
|
+
addEventListener(_el$59, "click", () => props.onEditPin(pin));
|
|
3085
|
+
insert(_el$61, () => index() + 1);
|
|
3086
|
+
insert(_el$63, () => pin.comment || _tmpl$13());
|
|
3087
|
+
addEventListener(_el$64, "click", (e) => {
|
|
3088
|
+
e.stopPropagation();
|
|
3089
|
+
props.onTogglePinSelect(pin);
|
|
3090
|
+
});
|
|
3091
|
+
addEventListener(_el$65, "click", (e) => {
|
|
3092
|
+
e.stopPropagation();
|
|
3093
|
+
props.onRemovePin(pin.id);
|
|
3094
|
+
});
|
|
3095
|
+
createRenderEffect((_p$) => {
|
|
3096
|
+
var _v$32 = `pp-pin-item__status pp-pin-item__status--${pin.status.state}`, _v$33 = props.selectedPinIds.has(pin.id) ? "Deselect" : "Select for send", _v$34 = props.selectedPinIds.has(pin.id) ? "Deselect" : "Select for send", _v$35 = props.selectedPinIds.has(pin.id) ? icons.checkSquare : icons.squareEmpty, _v$36 = props.selectedPinIds.has(pin.id) ? "var(--pp-accent)" : "var(--pp-text-muted)", _v$37 = icons.minus;
|
|
3097
|
+
_v$32 !== _p$.e && className(_el$60, _p$.e = _v$32);
|
|
3098
|
+
_v$33 !== _p$.t && setAttribute(_el$64, "title", _p$.t = _v$33);
|
|
3099
|
+
_v$34 !== _p$.a && setAttribute(_el$64, "aria-label", _p$.a = _v$34);
|
|
3100
|
+
_v$35 !== _p$.o && (_el$64.innerHTML = _p$.o = _v$35);
|
|
3101
|
+
_v$36 !== _p$.i && setStyleProperty(_el$64, "color", _p$.i = _v$36);
|
|
3102
|
+
_v$37 !== _p$.n && (_el$65.innerHTML = _p$.n = _v$37);
|
|
3103
|
+
return _p$;
|
|
3104
|
+
}, {
|
|
3105
|
+
e: void 0,
|
|
3106
|
+
t: void 0,
|
|
3107
|
+
a: void 0,
|
|
3108
|
+
o: void 0,
|
|
3109
|
+
i: void 0,
|
|
3110
|
+
n: void 0
|
|
3111
|
+
});
|
|
3112
|
+
return _el$59;
|
|
3113
|
+
})()
|
|
3114
|
+
}));
|
|
3115
|
+
return _el$58;
|
|
3116
|
+
})()), createComponent(Show, {
|
|
3117
|
+
get when() {
|
|
3118
|
+
return props.selectedPinIds.size > 0;
|
|
3119
|
+
},
|
|
3120
|
+
get children() {
|
|
3121
|
+
var _el$14 = _tmpl$4(), _el$15 = _el$14.firstChild, _el$16 = _el$15.nextSibling, _el$18 = _el$16.nextSibling, _el$17 = _el$18.nextSibling;
|
|
3122
|
+
addEventListener(_el$14, "click", () => props.onSendSelected());
|
|
3123
|
+
insert(_el$14, () => props.selectedPinIds.size, _el$18);
|
|
3124
|
+
createRenderEffect(() => _el$15.innerHTML = icons.send);
|
|
3125
|
+
return _el$14;
|
|
3126
|
+
}
|
|
3127
|
+
})];
|
|
3128
|
+
}
|
|
3129
|
+
}), _el$49);
|
|
3130
|
+
insert(_el$5, createComponent(Show, {
|
|
3131
|
+
get when() {
|
|
3132
|
+
return props.mode === "draw";
|
|
3133
|
+
},
|
|
3134
|
+
get children() {
|
|
3135
|
+
return [(() => {
|
|
3136
|
+
var _el$19 = _tmpl$5(), _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling, _el$22 = _el$21.nextSibling, _el$23 = _el$22.nextSibling, _el$24 = _el$23.nextSibling, _el$25 = _el$24.nextSibling, _el$26 = _el$25.nextSibling, _el$27 = _el$26.nextSibling;
|
|
3137
|
+
addEventListener(_el$20, "click", () => props.onDrawToolChange("freehand"));
|
|
3138
|
+
addEventListener(_el$21, "click", () => props.onDrawToolChange("arrow"));
|
|
3139
|
+
addEventListener(_el$22, "click", () => props.onDrawToolChange("circle"));
|
|
3140
|
+
addEventListener(_el$23, "click", () => props.onDrawToolChange("rect"));
|
|
3141
|
+
addEventListener(_el$24, "click", () => props.onDrawToolChange("text"));
|
|
3142
|
+
addEventListener(_el$26, "click", () => props.onDrawUndo());
|
|
3143
|
+
addEventListener(_el$27, "click", () => props.onDrawClear());
|
|
3144
|
+
createRenderEffect((_p$) => {
|
|
3145
|
+
var _v$3 = `pp-draw-tool ${props.drawTool === "freehand" ? "pp-draw-tool--active" : ""}`, _v$4 = icons.pencil, _v$5 = `pp-draw-tool ${props.drawTool === "arrow" ? "pp-draw-tool--active" : ""}`, _v$6 = icons.arrowUpRight, _v$7 = `pp-draw-tool ${props.drawTool === "circle" ? "pp-draw-tool--active" : ""}`, _v$8 = icons.circle, _v$9 = `pp-draw-tool ${props.drawTool === "rect" ? "pp-draw-tool--active" : ""}`, _v$0 = icons.square, _v$1 = `pp-draw-tool ${props.drawTool === "text" ? "pp-draw-tool--active" : ""}`, _v$10 = icons.typography, _v$11 = icons.undo, _v$12 = props.drawStrokeCount === 0, _v$13 = icons.trash, _v$14 = props.drawStrokeCount === 0;
|
|
3146
|
+
_v$3 !== _p$.e && className(_el$20, _p$.e = _v$3);
|
|
3147
|
+
_v$4 !== _p$.t && (_el$20.innerHTML = _p$.t = _v$4);
|
|
3148
|
+
_v$5 !== _p$.a && className(_el$21, _p$.a = _v$5);
|
|
3149
|
+
_v$6 !== _p$.o && (_el$21.innerHTML = _p$.o = _v$6);
|
|
3150
|
+
_v$7 !== _p$.i && className(_el$22, _p$.i = _v$7);
|
|
3151
|
+
_v$8 !== _p$.n && (_el$22.innerHTML = _p$.n = _v$8);
|
|
3152
|
+
_v$9 !== _p$.s && className(_el$23, _p$.s = _v$9);
|
|
3153
|
+
_v$0 !== _p$.h && (_el$23.innerHTML = _p$.h = _v$0);
|
|
3154
|
+
_v$1 !== _p$.r && className(_el$24, _p$.r = _v$1);
|
|
3155
|
+
_v$10 !== _p$.d && (_el$24.innerHTML = _p$.d = _v$10);
|
|
3156
|
+
_v$11 !== _p$.l && (_el$26.innerHTML = _p$.l = _v$11);
|
|
3157
|
+
_v$12 !== _p$.u && (_el$26.disabled = _p$.u = _v$12);
|
|
3158
|
+
_v$13 !== _p$.c && (_el$27.innerHTML = _p$.c = _v$13);
|
|
3159
|
+
_v$14 !== _p$.w && (_el$27.disabled = _p$.w = _v$14);
|
|
3160
|
+
return _p$;
|
|
3161
|
+
}, {
|
|
3162
|
+
e: void 0,
|
|
3163
|
+
t: void 0,
|
|
3164
|
+
a: void 0,
|
|
3165
|
+
o: void 0,
|
|
3166
|
+
i: void 0,
|
|
3167
|
+
n: void 0,
|
|
3168
|
+
s: void 0,
|
|
3169
|
+
h: void 0,
|
|
3170
|
+
r: void 0,
|
|
3171
|
+
d: void 0,
|
|
3172
|
+
l: void 0,
|
|
3173
|
+
u: void 0,
|
|
3174
|
+
c: void 0,
|
|
3175
|
+
w: void 0
|
|
3176
|
+
});
|
|
3177
|
+
return _el$19;
|
|
3178
|
+
})(), (() => {
|
|
3179
|
+
var _el$28 = _tmpl$6(), _el$29 = _el$28.firstChild, _el$30 = _el$29.nextSibling;
|
|
3180
|
+
insert(_el$29, createComponent(For, {
|
|
3181
|
+
each: DRAW_COLORS,
|
|
3182
|
+
children: (c) => (() => {
|
|
3183
|
+
var _el$67 = _tmpl$14();
|
|
3184
|
+
addEventListener(_el$67, "click", () => props.onDrawColorChange(c.color));
|
|
3185
|
+
createRenderEffect((_p$) => {
|
|
3186
|
+
var _v$38 = `pp-color-swatch ${props.drawColor === c.color ? "pp-color-swatch--active" : ""}`, _v$39 = c.color, _v$40 = c.name;
|
|
3187
|
+
_v$38 !== _p$.e && className(_el$67, _p$.e = _v$38);
|
|
3188
|
+
_v$39 !== _p$.t && setStyleProperty(_el$67, "background", _p$.t = _v$39);
|
|
3189
|
+
_v$40 !== _p$.a && setAttribute(_el$67, "title", _p$.a = _v$40);
|
|
3190
|
+
return _p$;
|
|
3191
|
+
}, {
|
|
3192
|
+
e: void 0,
|
|
3193
|
+
t: void 0,
|
|
3194
|
+
a: void 0
|
|
3195
|
+
});
|
|
3196
|
+
return _el$67;
|
|
3197
|
+
})()
|
|
3198
|
+
}));
|
|
3199
|
+
insert(_el$30, createComponent(For, {
|
|
3200
|
+
each: LINE_WIDTHS,
|
|
3201
|
+
children: (w) => (() => {
|
|
3202
|
+
var _el$68 = _tmpl$15(), _el$69 = _el$68.firstChild;
|
|
3203
|
+
addEventListener(_el$68, "click", () => props.onDrawLineWidthChange(w.width));
|
|
3204
|
+
createRenderEffect((_p$) => {
|
|
3205
|
+
var _v$41 = `pp-width-btn ${props.drawLineWidth === w.width ? "pp-width-btn--active" : ""}`, _v$42 = w.name, _v$43 = `${w.width}px`, _v$44 = props.drawColor, _v$45 = `${w.width / 2}px`;
|
|
3206
|
+
_v$41 !== _p$.e && className(_el$68, _p$.e = _v$41);
|
|
3207
|
+
_v$42 !== _p$.t && setAttribute(_el$68, "title", _p$.t = _v$42);
|
|
3208
|
+
_v$43 !== _p$.a && setStyleProperty(_el$69, "height", _p$.a = _v$43);
|
|
3209
|
+
_v$44 !== _p$.o && setStyleProperty(_el$69, "background", _p$.o = _v$44);
|
|
3210
|
+
_v$45 !== _p$.i && setStyleProperty(_el$69, "border-radius", _p$.i = _v$45);
|
|
3211
|
+
return _p$;
|
|
3212
|
+
}, {
|
|
3213
|
+
e: void 0,
|
|
3214
|
+
t: void 0,
|
|
3215
|
+
a: void 0,
|
|
3216
|
+
o: void 0,
|
|
3217
|
+
i: void 0
|
|
3218
|
+
});
|
|
3219
|
+
return _el$68;
|
|
3220
|
+
})()
|
|
3221
|
+
}));
|
|
3222
|
+
return _el$28;
|
|
3223
|
+
})(), createComponent(Show, {
|
|
3224
|
+
get when() {
|
|
3225
|
+
return props.drawStrokeCount > 0;
|
|
3226
|
+
},
|
|
3227
|
+
get children() {
|
|
3228
|
+
var _el$31 = _tmpl$7(), _el$32 = _el$31.firstChild;
|
|
3229
|
+
insert(_el$31, () => props.drawStrokeCount, _el$32);
|
|
3230
|
+
insert(_el$31, () => props.drawStrokeCount !== 1 ? "s" : "", null);
|
|
3231
|
+
return _el$31;
|
|
3232
|
+
}
|
|
3233
|
+
})];
|
|
3234
|
+
}
|
|
3235
|
+
}), _el$49);
|
|
3236
|
+
insert(_el$5, createComponent(Show, {
|
|
3237
|
+
get when() {
|
|
3238
|
+
return props.mode === "queue";
|
|
3239
|
+
},
|
|
3240
|
+
get children() {
|
|
3241
|
+
return memo(() => props.queue.length === 0)() ? _tmpl$16() : [(() => {
|
|
3242
|
+
var _el$71 = _tmpl$17();
|
|
3243
|
+
insert(_el$71, queueSummary);
|
|
3244
|
+
return _el$71;
|
|
3245
|
+
})(), (() => {
|
|
3246
|
+
var _el$72 = _tmpl$11();
|
|
3247
|
+
insert(_el$72, createComponent(For, {
|
|
3248
|
+
get each() {
|
|
3249
|
+
return props.queue;
|
|
3250
|
+
},
|
|
3251
|
+
children: (item, index) => (() => {
|
|
3252
|
+
var _el$77 = _tmpl$19(), _el$78 = _el$77.firstChild, _el$79 = _el$78.nextSibling, _el$80 = _el$79.firstChild;
|
|
3253
|
+
insert(_el$78, () => index() + 1);
|
|
3254
|
+
insert(_el$80, (() => {
|
|
3255
|
+
var _c$6 = memo(() => !!item.pin);
|
|
3256
|
+
return () => _c$6() ? item.pin.comment || "Pin annotation" : `Drawing (${(item.drawings?.length || 0) + (item.textNotes?.length || 0)} items)`;
|
|
3257
|
+
})());
|
|
3258
|
+
return _el$77;
|
|
3259
|
+
})()
|
|
3260
|
+
}));
|
|
3261
|
+
return _el$72;
|
|
3262
|
+
})(), (() => {
|
|
3263
|
+
var _el$73 = _tmpl$18(), _el$74 = _el$73.firstChild, _el$75 = _el$74.nextSibling, _el$76 = _el$75.firstChild;
|
|
3264
|
+
addEventListener(_el$74, "click", () => props.onQueueClear());
|
|
3265
|
+
addEventListener(_el$75, "click", () => props.onQueueSend());
|
|
3266
|
+
createRenderEffect(() => _el$76.innerHTML = icons.send);
|
|
3267
|
+
return _el$73;
|
|
3268
|
+
})()];
|
|
3269
|
+
}
|
|
3270
|
+
}), _el$49);
|
|
3271
|
+
insert(_el$5, createComponent(Show, {
|
|
3272
|
+
get when() {
|
|
3273
|
+
return props.showSettings;
|
|
3274
|
+
},
|
|
3275
|
+
get children() {
|
|
3276
|
+
var _el$33 = _tmpl$8(), _el$34 = _el$33.firstChild, _el$35 = _el$34.firstChild, _el$36 = _el$35.nextSibling, _el$37 = _el$34.nextSibling, _el$38 = _el$37.firstChild, _el$39 = _el$38.nextSibling, _el$40 = _el$37.nextSibling, _el$41 = _el$40.firstChild, _el$42 = _el$41.nextSibling, _el$43 = _el$40.nextSibling, _el$44 = _el$43.firstChild, _el$45 = _el$44.nextSibling, _el$46 = _el$43.nextSibling, _el$47 = _el$46.firstChild, _el$48 = _el$47.nextSibling;
|
|
3277
|
+
_el$36.addEventListener("change", (e) => props.onOutputFormatChange(e.currentTarget.value));
|
|
3278
|
+
addEventListener(_el$39, "click", () => props.onAutoSubmitChange(!props.autoSubmit));
|
|
3279
|
+
addEventListener(_el$42, "click", () => props.onClearOnSendChange(!props.clearOnSend));
|
|
3280
|
+
addEventListener(_el$45, "click", () => props.onBlockInteractionsChange(!props.blockInteractions));
|
|
3281
|
+
addEventListener(_el$48, "click", () => props.onCompactPopupChange(!props.compactPopup));
|
|
3282
|
+
createRenderEffect((_p$) => {
|
|
3283
|
+
var _v$15 = `pp-toggle ${props.autoSubmit ? "pp-toggle--active" : ""}`, _v$16 = `pp-toggle ${props.clearOnSend ? "pp-toggle--active" : ""}`, _v$17 = `pp-toggle ${props.blockInteractions ? "pp-toggle--active" : ""}`, _v$18 = `pp-toggle ${props.compactPopup ? "pp-toggle--active" : ""}`;
|
|
3284
|
+
_v$15 !== _p$.e && className(_el$39, _p$.e = _v$15);
|
|
3285
|
+
_v$16 !== _p$.t && className(_el$42, _p$.t = _v$16);
|
|
3286
|
+
_v$17 !== _p$.a && className(_el$45, _p$.a = _v$17);
|
|
3287
|
+
_v$18 !== _p$.o && className(_el$48, _p$.o = _v$18);
|
|
3288
|
+
return _p$;
|
|
3289
|
+
}, {
|
|
3290
|
+
e: void 0,
|
|
3291
|
+
t: void 0,
|
|
3292
|
+
a: void 0,
|
|
3293
|
+
o: void 0
|
|
3294
|
+
});
|
|
3295
|
+
createRenderEffect(() => _el$36.value = props.outputFormat);
|
|
3296
|
+
return _el$33;
|
|
3297
|
+
}
|
|
3298
|
+
}), _el$49);
|
|
3299
|
+
addEventListener(_el$50, "click", () => props.onSend());
|
|
3300
|
+
addEventListener(_el$51, "click", () => props.onCopy());
|
|
3301
|
+
insert(_el$49, (() => {
|
|
3302
|
+
var _c$5 = memo(() => props.pins.length > 0);
|
|
3303
|
+
return () => _c$5() && (() => {
|
|
3304
|
+
var _el$81 = _tmpl$20();
|
|
3305
|
+
addEventListener(_el$81, "click", () => props.onClear());
|
|
3306
|
+
createRenderEffect(() => _el$81.innerHTML = icons.trash);
|
|
3307
|
+
return _el$81;
|
|
3308
|
+
})();
|
|
3309
|
+
})(), _el$52);
|
|
3310
|
+
addEventListener(_el$52, "click", () => props.onToggleSettings());
|
|
3311
|
+
addEventListener(_el$53, "click", () => props.onToggleExpand());
|
|
3312
|
+
createRenderEffect((_p$) => {
|
|
3313
|
+
var _v$19 = `pp-mode-tab ${props.mode === "select" ? "pp-mode-tab--active" : ""}`, _v$20 = props.mode === "select", _v$21 = icons.crosshair, _v$22 = `pp-mode-tab ${props.mode === "draw" ? "pp-mode-tab--active" : ""}`, _v$23 = props.mode === "draw", _v$24 = icons.pencil, _v$25 = `pp-mode-tab ${props.mode === "queue" ? "pp-mode-tab--active" : ""}`, _v$26 = props.mode === "queue", _v$27 = icons.stack, _v$28 = icons.send, _v$29 = icons.copy, _v$30 = icons.settings, _v$31 = icons.x;
|
|
3314
|
+
_v$19 !== _p$.e && className(_el$9, _p$.e = _v$19);
|
|
3315
|
+
_v$20 !== _p$.t && setAttribute(_el$9, "aria-selected", _p$.t = _v$20);
|
|
3316
|
+
_v$21 !== _p$.a && (_el$0.innerHTML = _p$.a = _v$21);
|
|
3317
|
+
_v$22 !== _p$.o && className(_el$1, _p$.o = _v$22);
|
|
3318
|
+
_v$23 !== _p$.i && setAttribute(_el$1, "aria-selected", _p$.i = _v$23);
|
|
3319
|
+
_v$24 !== _p$.n && (_el$10.innerHTML = _p$.n = _v$24);
|
|
3320
|
+
_v$25 !== _p$.s && className(_el$11, _p$.s = _v$25);
|
|
3321
|
+
_v$26 !== _p$.h && setAttribute(_el$11, "aria-selected", _p$.h = _v$26);
|
|
3322
|
+
_v$27 !== _p$.r && (_el$12.innerHTML = _p$.r = _v$27);
|
|
3323
|
+
_v$28 !== _p$.d && (_el$50.innerHTML = _p$.d = _v$28);
|
|
3324
|
+
_v$29 !== _p$.l && (_el$51.innerHTML = _p$.l = _v$29);
|
|
3325
|
+
_v$30 !== _p$.u && (_el$52.innerHTML = _p$.u = _v$30);
|
|
3326
|
+
_v$31 !== _p$.c && (_el$53.innerHTML = _p$.c = _v$31);
|
|
3327
|
+
return _p$;
|
|
3328
|
+
}, {
|
|
3329
|
+
e: void 0,
|
|
3330
|
+
t: void 0,
|
|
3331
|
+
a: void 0,
|
|
3332
|
+
o: void 0,
|
|
3333
|
+
i: void 0,
|
|
3334
|
+
n: void 0,
|
|
3335
|
+
s: void 0,
|
|
3336
|
+
h: void 0,
|
|
3337
|
+
r: void 0,
|
|
3338
|
+
d: void 0,
|
|
3339
|
+
l: void 0,
|
|
3340
|
+
u: void 0,
|
|
3341
|
+
c: void 0
|
|
3342
|
+
});
|
|
3343
|
+
return _el$5;
|
|
3344
|
+
})()
|
|
3345
|
+
);
|
|
3346
|
+
})());
|
|
3347
|
+
createRenderEffect((_p$) => {
|
|
3348
|
+
var _v$ = `pp-toolbar ${props.expanded ? "pp-toolbar--expanded" : "pp-toolbar--collapsed"}`, _v$2 = {
|
|
3349
|
+
...props.expanded ? {
|
|
3350
|
+
bottom: "16px",
|
|
3351
|
+
right: "16px"
|
|
3352
|
+
} : {
|
|
3353
|
+
right: `${pos().right}px`,
|
|
3354
|
+
bottom: `${pos().bottom}px`
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
3358
|
+
_p$.t = style(_el$, _v$2, _p$.t);
|
|
3359
|
+
return _p$;
|
|
3360
|
+
}, {
|
|
3361
|
+
e: void 0,
|
|
3362
|
+
t: void 0
|
|
3363
|
+
});
|
|
3364
|
+
return _el$;
|
|
3365
|
+
})();
|
|
3366
|
+
};
|
|
3367
|
+
delegateEvents(["mousedown"]);
|
|
3368
|
+
|
|
3369
|
+
// src/ui/components/OverlayCanvas.tsx
|
|
3370
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<canvas style=position:fixed;top:0;left:0;z-index:2147483645>`);
|
|
3371
|
+
function lerp(start, end, t) {
|
|
3372
|
+
return start + (end - start) * t;
|
|
3373
|
+
}
|
|
3374
|
+
var OverlayCanvas = (props) => {
|
|
3375
|
+
let canvasRef;
|
|
3376
|
+
let animFrameId = null;
|
|
3377
|
+
let currentRect = {
|
|
3378
|
+
x: 0,
|
|
3379
|
+
y: 0,
|
|
3380
|
+
width: 0,
|
|
3381
|
+
height: 0
|
|
3382
|
+
};
|
|
3383
|
+
let targetRect = null;
|
|
3384
|
+
const LERP_SPEED = 0.25;
|
|
3385
|
+
function resizeCanvas() {
|
|
3386
|
+
if (!canvasRef) return;
|
|
3387
|
+
const dpr = window.devicePixelRatio || 1;
|
|
3388
|
+
canvasRef.width = window.innerWidth * dpr;
|
|
3389
|
+
canvasRef.height = window.innerHeight * dpr;
|
|
3390
|
+
canvasRef.style.width = `${window.innerWidth}px`;
|
|
3391
|
+
canvasRef.style.height = `${window.innerHeight}px`;
|
|
3392
|
+
const ctx = canvasRef.getContext("2d");
|
|
3393
|
+
if (ctx) ctx.scale(dpr, dpr);
|
|
3394
|
+
}
|
|
3395
|
+
function drawStroke(ctx, stroke) {
|
|
3396
|
+
if (stroke.points.length < 1) return;
|
|
3397
|
+
ctx.strokeStyle = stroke.color;
|
|
3398
|
+
ctx.lineWidth = stroke.lineWidth;
|
|
3399
|
+
ctx.lineCap = "round";
|
|
3400
|
+
ctx.lineJoin = "round";
|
|
3401
|
+
ctx.setLineDash([]);
|
|
3402
|
+
if (stroke.type === "freehand") {
|
|
3403
|
+
ctx.beginPath();
|
|
3404
|
+
ctx.moveTo(stroke.points[0].x, stroke.points[0].y);
|
|
3405
|
+
for (let i = 1; i < stroke.points.length; i++) {
|
|
3406
|
+
ctx.lineTo(stroke.points[i].x, stroke.points[i].y);
|
|
3407
|
+
}
|
|
3408
|
+
ctx.stroke();
|
|
3409
|
+
} else if (stroke.type === "arrow") {
|
|
3410
|
+
if (stroke.points.length < 2) return;
|
|
3411
|
+
const start = stroke.points[0];
|
|
3412
|
+
const end = stroke.points[stroke.points.length - 1];
|
|
3413
|
+
ctx.beginPath();
|
|
3414
|
+
ctx.moveTo(start.x, start.y);
|
|
3415
|
+
ctx.lineTo(end.x, end.y);
|
|
3416
|
+
ctx.stroke();
|
|
3417
|
+
const angle = Math.atan2(end.y - start.y, end.x - start.x);
|
|
3418
|
+
const headLen = 12 + stroke.lineWidth * 2;
|
|
3419
|
+
ctx.beginPath();
|
|
3420
|
+
ctx.moveTo(end.x, end.y);
|
|
3421
|
+
ctx.lineTo(end.x - headLen * Math.cos(angle - Math.PI / 6), end.y - headLen * Math.sin(angle - Math.PI / 6));
|
|
3422
|
+
ctx.moveTo(end.x, end.y);
|
|
3423
|
+
ctx.lineTo(end.x - headLen * Math.cos(angle + Math.PI / 6), end.y - headLen * Math.sin(angle + Math.PI / 6));
|
|
3424
|
+
ctx.stroke();
|
|
3425
|
+
} else if (stroke.type === "circle") {
|
|
3426
|
+
if (stroke.points.length < 2) return;
|
|
3427
|
+
const start = stroke.points[0];
|
|
3428
|
+
const end = stroke.points[stroke.points.length - 1];
|
|
3429
|
+
const rx = Math.abs(end.x - start.x) / 2;
|
|
3430
|
+
const ry = Math.abs(end.y - start.y) / 2;
|
|
3431
|
+
const cx = (start.x + end.x) / 2;
|
|
3432
|
+
const cy = (start.y + end.y) / 2;
|
|
3433
|
+
ctx.beginPath();
|
|
3434
|
+
ctx.ellipse(cx, cy, rx, ry, 0, 0, Math.PI * 2);
|
|
3435
|
+
ctx.stroke();
|
|
3436
|
+
} else if (stroke.type === "rect") {
|
|
3437
|
+
if (stroke.points.length < 2) return;
|
|
3438
|
+
const start = stroke.points[0];
|
|
3439
|
+
const end = stroke.points[stroke.points.length - 1];
|
|
3440
|
+
ctx.strokeRect(start.x, start.y, end.x - start.x, end.y - start.y);
|
|
3441
|
+
}
|
|
3442
|
+
}
|
|
3443
|
+
function drawTextNote(ctx, note) {
|
|
3444
|
+
const fontSize = 13;
|
|
3445
|
+
const padding = 6;
|
|
3446
|
+
ctx.font = `500 ${fontSize}px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif`;
|
|
3447
|
+
const metrics = ctx.measureText(note.text);
|
|
3448
|
+
const textWidth = metrics.width;
|
|
3449
|
+
const textHeight = fontSize + 2;
|
|
3450
|
+
ctx.fillStyle = "rgba(0, 0, 0, 0.75)";
|
|
3451
|
+
const bgX = note.x - 2;
|
|
3452
|
+
const bgY = note.y - textHeight - padding / 2;
|
|
3453
|
+
const bgW = textWidth + padding * 2;
|
|
3454
|
+
const bgH = textHeight + padding;
|
|
3455
|
+
const r = 4;
|
|
3456
|
+
ctx.beginPath();
|
|
3457
|
+
ctx.moveTo(bgX + r, bgY);
|
|
3458
|
+
ctx.lineTo(bgX + bgW - r, bgY);
|
|
3459
|
+
ctx.quadraticCurveTo(bgX + bgW, bgY, bgX + bgW, bgY + r);
|
|
3460
|
+
ctx.lineTo(bgX + bgW, bgY + bgH - r);
|
|
3461
|
+
ctx.quadraticCurveTo(bgX + bgW, bgY + bgH, bgX + bgW - r, bgY + bgH);
|
|
3462
|
+
ctx.lineTo(bgX + r, bgY + bgH);
|
|
3463
|
+
ctx.quadraticCurveTo(bgX, bgY + bgH, bgX, bgY + bgH - r);
|
|
3464
|
+
ctx.lineTo(bgX, bgY + r);
|
|
3465
|
+
ctx.quadraticCurveTo(bgX, bgY, bgX + r, bgY);
|
|
3466
|
+
ctx.closePath();
|
|
3467
|
+
ctx.fill();
|
|
3468
|
+
ctx.fillStyle = note.color;
|
|
3469
|
+
ctx.beginPath();
|
|
3470
|
+
ctx.arc(bgX + padding, bgY + bgH / 2, 3, 0, Math.PI * 2);
|
|
3471
|
+
ctx.fill();
|
|
3472
|
+
ctx.fillStyle = "#ffffff";
|
|
3473
|
+
ctx.fillText(note.text, bgX + padding + 10, note.y - 2);
|
|
3474
|
+
}
|
|
3475
|
+
function draw() {
|
|
3476
|
+
if (!canvasRef) return;
|
|
3477
|
+
const ctx = canvasRef.getContext("2d");
|
|
3478
|
+
if (!ctx) return;
|
|
3479
|
+
const dpr = window.devicePixelRatio || 1;
|
|
3480
|
+
ctx.clearRect(0, 0, canvasRef.width / dpr, canvasRef.height / dpr);
|
|
3481
|
+
if (props.active && !props.drawMode && props.hoveredRect) {
|
|
3482
|
+
targetRect = {
|
|
3483
|
+
x: props.hoveredRect.x,
|
|
3484
|
+
y: props.hoveredRect.y,
|
|
3485
|
+
width: props.hoveredRect.width,
|
|
3486
|
+
height: props.hoveredRect.height
|
|
3487
|
+
};
|
|
3488
|
+
} else if (props.active && !props.drawMode) {
|
|
3489
|
+
targetRect = null;
|
|
3490
|
+
}
|
|
3491
|
+
if (props.active && !props.drawMode && targetRect) {
|
|
3492
|
+
currentRect.x = lerp(currentRect.x, targetRect.x, LERP_SPEED);
|
|
3493
|
+
currentRect.y = lerp(currentRect.y, targetRect.y, LERP_SPEED);
|
|
3494
|
+
currentRect.width = lerp(currentRect.width, targetRect.width, LERP_SPEED);
|
|
3495
|
+
currentRect.height = lerp(currentRect.height, targetRect.height, LERP_SPEED);
|
|
3496
|
+
ctx.strokeStyle = "rgba(59, 130, 246, 0.8)";
|
|
3497
|
+
ctx.lineWidth = 2;
|
|
3498
|
+
ctx.setLineDash([]);
|
|
3499
|
+
ctx.strokeRect(currentRect.x, currentRect.y, currentRect.width, currentRect.height);
|
|
3500
|
+
ctx.fillStyle = "rgba(59, 130, 246, 0.06)";
|
|
3501
|
+
ctx.fillRect(currentRect.x, currentRect.y, currentRect.width, currentRect.height);
|
|
3502
|
+
}
|
|
3503
|
+
if (props.active && !props.drawMode && props.dragRect) {
|
|
3504
|
+
ctx.strokeStyle = "rgba(59, 130, 246, 0.6)";
|
|
3505
|
+
ctx.lineWidth = 1;
|
|
3506
|
+
ctx.setLineDash([4, 4]);
|
|
3507
|
+
ctx.strokeRect(props.dragRect.x, props.dragRect.y, props.dragRect.width, props.dragRect.height);
|
|
3508
|
+
ctx.fillStyle = "rgba(59, 130, 246, 0.08)";
|
|
3509
|
+
ctx.fillRect(props.dragRect.x, props.dragRect.y, props.dragRect.width, props.dragRect.height);
|
|
3510
|
+
}
|
|
3511
|
+
for (const stroke of props.drawStrokes) {
|
|
3512
|
+
drawStroke(ctx, stroke);
|
|
3513
|
+
}
|
|
3514
|
+
if (props.currentStroke) {
|
|
3515
|
+
drawStroke(ctx, props.currentStroke);
|
|
3516
|
+
}
|
|
3517
|
+
for (const note of props.textNotes) {
|
|
3518
|
+
drawTextNote(ctx, note);
|
|
3519
|
+
}
|
|
3520
|
+
animFrameId = requestAnimationFrame(draw);
|
|
3521
|
+
}
|
|
3522
|
+
function handleMouseDown(e) {
|
|
3523
|
+
if (!props.drawMode) return;
|
|
3524
|
+
if (props.drawTool === "text") {
|
|
3525
|
+
props.onTextPlace(e.clientX, e.clientY);
|
|
3526
|
+
} else {
|
|
3527
|
+
props.onDrawStart(e.clientX, e.clientY);
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
function handleMouseMove(e) {
|
|
3531
|
+
if (!props.drawMode) return;
|
|
3532
|
+
props.onDrawMove(e.clientX, e.clientY);
|
|
3533
|
+
}
|
|
3534
|
+
function handleMouseUp(_e) {
|
|
3535
|
+
if (!props.drawMode) return;
|
|
3536
|
+
props.onDrawEnd();
|
|
3537
|
+
}
|
|
3538
|
+
function handleTouchStart(e) {
|
|
3539
|
+
if (!props.drawMode) return;
|
|
3540
|
+
e.preventDefault();
|
|
3541
|
+
const touch = e.touches[0];
|
|
3542
|
+
if (props.drawTool === "text") {
|
|
3543
|
+
props.onTextPlace(touch.clientX, touch.clientY);
|
|
3544
|
+
} else {
|
|
3545
|
+
props.onDrawStart(touch.clientX, touch.clientY);
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
function handleTouchMove(e) {
|
|
3549
|
+
if (!props.drawMode) return;
|
|
3550
|
+
e.preventDefault();
|
|
3551
|
+
const touch = e.touches[0];
|
|
3552
|
+
props.onDrawMove(touch.clientX, touch.clientY);
|
|
3553
|
+
}
|
|
3554
|
+
function handleTouchEnd(e) {
|
|
3555
|
+
if (!props.drawMode) return;
|
|
3556
|
+
e.preventDefault();
|
|
3557
|
+
props.onDrawEnd();
|
|
3558
|
+
}
|
|
3559
|
+
onMount(() => {
|
|
3560
|
+
resizeCanvas();
|
|
3561
|
+
window.addEventListener("resize", resizeCanvas);
|
|
3562
|
+
animFrameId = requestAnimationFrame(draw);
|
|
3563
|
+
});
|
|
3564
|
+
onCleanup(() => {
|
|
3565
|
+
window.removeEventListener("resize", resizeCanvas);
|
|
3566
|
+
if (animFrameId !== null) {
|
|
3567
|
+
cancelAnimationFrame(animFrameId);
|
|
3568
|
+
}
|
|
3569
|
+
});
|
|
3570
|
+
return (() => {
|
|
3571
|
+
var _el$ = _tmpl$21();
|
|
3572
|
+
_el$.$$touchend = handleTouchEnd;
|
|
3573
|
+
_el$.$$touchmove = handleTouchMove;
|
|
3574
|
+
_el$.$$touchstart = handleTouchStart;
|
|
3575
|
+
_el$.$$mouseup = handleMouseUp;
|
|
3576
|
+
_el$.$$mousemove = handleMouseMove;
|
|
3577
|
+
_el$.$$mousedown = handleMouseDown;
|
|
3578
|
+
var _ref$ = canvasRef;
|
|
3579
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : canvasRef = _el$;
|
|
3580
|
+
createRenderEffect((_p$) => {
|
|
3581
|
+
var _v$ = props.drawMode ? "auto" : "none", _v$2 = props.drawMode ? props.drawTool === "text" ? "text" : "crosshair" : "default";
|
|
3582
|
+
_v$ !== _p$.e && setStyleProperty(_el$, "pointer-events", _p$.e = _v$);
|
|
3583
|
+
_v$2 !== _p$.t && setStyleProperty(_el$, "cursor", _p$.t = _v$2);
|
|
3584
|
+
return _p$;
|
|
3585
|
+
}, {
|
|
3586
|
+
e: void 0,
|
|
3587
|
+
t: void 0
|
|
3588
|
+
});
|
|
3589
|
+
return _el$;
|
|
3590
|
+
})();
|
|
3591
|
+
};
|
|
3592
|
+
delegateEvents(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend"]);
|
|
3593
|
+
|
|
3594
|
+
// src/ui/components/PinPopup.tsx
|
|
3595
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<div class=pp-popup><div class=pp-popup__input-row><textarea class=pp-popup__textarea placeholder="Add your feedback..."></textarea></div><div class=pp-popup__actions><button class="pp-btn pp-btn--ghost"title="Send 'Fix this' to agent"><span style=display:inline-flex></span>Fix</button><div style=flex:1></div><button class=pp-btn>Cancel</button><button class="pp-btn pp-btn--primary">`);
|
|
3596
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div class=pp-popup__header><span class=pp-popup__name></span><span>`);
|
|
3597
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div><div class=pp-popup__details-inner><div class=pp-popup__element-info>`);
|
|
3598
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=pp-popup__source><span style=display:inline-flex;vertical-align:middle></span> `);
|
|
3599
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<div class=pp-popup__component>`);
|
|
3600
|
+
var _tmpl$62 = /* @__PURE__ */ template(`<div class=pp-popup__element-info>`);
|
|
3601
|
+
var _tmpl$72 = /* @__PURE__ */ template(`<button>`);
|
|
3602
|
+
var _tmpl$82 = /* @__PURE__ */ template(`<button class=pp-btn title="Add to queue"><span style=display:inline-flex></span>Queue`);
|
|
3603
|
+
function getSpeechRecognition() {
|
|
3604
|
+
const w = window;
|
|
3605
|
+
return w.SpeechRecognition || w.webkitSpeechRecognition || null;
|
|
3606
|
+
}
|
|
3607
|
+
var PinPopup = (props) => {
|
|
3608
|
+
const [comment, setComment] = createSignal(props.initialComment || "");
|
|
3609
|
+
const [showDetails, setShowDetails] = createSignal(false);
|
|
3610
|
+
const [isRecording, setIsRecording] = createSignal(false);
|
|
3611
|
+
let textareaRef;
|
|
3612
|
+
let recognitionRef = null;
|
|
3613
|
+
const compact = () => props.compactPopup ?? true;
|
|
3614
|
+
const hasSpeechAPI = !!getSpeechRecognition();
|
|
3615
|
+
const displayName = () => {
|
|
3616
|
+
if (props.context.framework?.componentPath) {
|
|
3617
|
+
return props.context.framework.componentPath;
|
|
3618
|
+
}
|
|
3619
|
+
return `<${props.context.element.tagName.toLowerCase()}>`;
|
|
3620
|
+
};
|
|
3621
|
+
const popupPosition = () => {
|
|
3622
|
+
const rect = props.context.element.boundingRect;
|
|
3623
|
+
const estimatedHeight = compact() && showDetails() ? 260 : 220;
|
|
3624
|
+
const popupX = Math.min(rect.x, window.innerWidth - 380);
|
|
3625
|
+
const popupY = rect.y + rect.height + 8;
|
|
3626
|
+
const adjustedY = popupY + estimatedHeight > window.innerHeight ? rect.y - estimatedHeight - 8 : popupY;
|
|
3627
|
+
return {
|
|
3628
|
+
x: Math.max(8, popupX),
|
|
3629
|
+
y: Math.max(8, adjustedY)
|
|
3630
|
+
};
|
|
3631
|
+
};
|
|
3632
|
+
async function openFileHandler() {
|
|
3633
|
+
try {
|
|
3634
|
+
const file = props.context.framework?.sourceFile;
|
|
3635
|
+
if (!file) return;
|
|
3636
|
+
const {
|
|
3637
|
+
openFile
|
|
3638
|
+
} = await import("./open-file-RQVHOCXI.js");
|
|
3639
|
+
openFile(file);
|
|
3640
|
+
} catch {
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
function toggleRecording() {
|
|
3644
|
+
if (isRecording()) {
|
|
3645
|
+
stopRecording();
|
|
3646
|
+
} else {
|
|
3647
|
+
startRecording();
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
function startRecording() {
|
|
3651
|
+
const SpeechRecognitionClass = getSpeechRecognition();
|
|
3652
|
+
if (!SpeechRecognitionClass) return;
|
|
3653
|
+
const recognition = new SpeechRecognitionClass();
|
|
3654
|
+
recognition.continuous = true;
|
|
3655
|
+
recognition.interimResults = true;
|
|
3656
|
+
recognition.lang = "en-US";
|
|
3657
|
+
let finalTranscript = "";
|
|
3658
|
+
recognition.onresult = (event) => {
|
|
3659
|
+
let interim = "";
|
|
3660
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
3661
|
+
const transcript = event.results[i][0].transcript;
|
|
3662
|
+
if (event.results[i].isFinal) {
|
|
3663
|
+
finalTranscript += transcript;
|
|
3664
|
+
} else {
|
|
3665
|
+
interim = transcript;
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
const current = comment();
|
|
3669
|
+
const separator = current && !current.endsWith(" ") ? " " : "";
|
|
3670
|
+
setComment(current + separator + finalTranscript + interim);
|
|
3671
|
+
finalTranscript = "";
|
|
3672
|
+
if (textareaRef) {
|
|
3673
|
+
textareaRef.style.height = "auto";
|
|
3674
|
+
textareaRef.style.height = Math.min(textareaRef.scrollHeight, 120) + "px";
|
|
3675
|
+
}
|
|
3676
|
+
};
|
|
3677
|
+
recognition.onerror = () => {
|
|
3678
|
+
setIsRecording(false);
|
|
3679
|
+
};
|
|
3680
|
+
recognition.onend = () => {
|
|
3681
|
+
setIsRecording(false);
|
|
3682
|
+
};
|
|
3683
|
+
recognition.start();
|
|
3684
|
+
recognitionRef = recognition;
|
|
3685
|
+
setIsRecording(true);
|
|
3686
|
+
}
|
|
3687
|
+
function stopRecording() {
|
|
3688
|
+
recognitionRef?.stop();
|
|
3689
|
+
recognitionRef = null;
|
|
3690
|
+
setIsRecording(false);
|
|
3691
|
+
}
|
|
3692
|
+
onMount(() => {
|
|
3693
|
+
textareaRef?.focus();
|
|
3694
|
+
if (props.initialComment && textareaRef) {
|
|
3695
|
+
textareaRef.selectionStart = textareaRef.value.length;
|
|
3696
|
+
}
|
|
3697
|
+
const onEsc = (e) => {
|
|
3698
|
+
if (e.key === "Escape") {
|
|
3699
|
+
e.stopPropagation();
|
|
3700
|
+
stopRecording();
|
|
3701
|
+
props.onCancel();
|
|
3702
|
+
}
|
|
3703
|
+
};
|
|
3704
|
+
document.addEventListener("keydown", onEsc, true);
|
|
3705
|
+
onCleanup(() => {
|
|
3706
|
+
document.removeEventListener("keydown", onEsc, true);
|
|
3707
|
+
stopRecording();
|
|
3708
|
+
});
|
|
3709
|
+
});
|
|
3710
|
+
function handleSubmit() {
|
|
3711
|
+
const text = comment().trim();
|
|
3712
|
+
if (!text) return;
|
|
3713
|
+
stopRecording();
|
|
3714
|
+
props.onAdd(text);
|
|
3715
|
+
}
|
|
3716
|
+
function handleQueue() {
|
|
3717
|
+
const text = comment().trim();
|
|
3718
|
+
if (!text) return;
|
|
3719
|
+
stopRecording();
|
|
3720
|
+
props.onQueue?.(text);
|
|
3721
|
+
}
|
|
3722
|
+
function handleFixThis() {
|
|
3723
|
+
const text = comment().trim() || `Fix this ${displayName()}`;
|
|
3724
|
+
stopRecording();
|
|
3725
|
+
props.onFixThis?.(text);
|
|
3726
|
+
}
|
|
3727
|
+
function handleKeyDown(e) {
|
|
3728
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
3729
|
+
e.preventDefault();
|
|
3730
|
+
handleSubmit();
|
|
3731
|
+
}
|
|
3732
|
+
if (e.key === "Escape") {
|
|
3733
|
+
stopRecording();
|
|
3734
|
+
props.onCancel();
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
function handleAutoGrow(e) {
|
|
3738
|
+
const el = e.currentTarget;
|
|
3739
|
+
setComment(el.value);
|
|
3740
|
+
el.style.height = "auto";
|
|
3741
|
+
el.style.height = Math.min(el.scrollHeight, 120) + "px";
|
|
3742
|
+
}
|
|
3743
|
+
return (() => {
|
|
3744
|
+
var _el$ = _tmpl$22(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling, _el$5 = _el$4.firstChild, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling, _el$8 = _el$7.nextSibling, _el$9 = _el$8.nextSibling;
|
|
3745
|
+
insert(_el$, (() => {
|
|
3746
|
+
var _c$ = memo(() => !!compact());
|
|
3747
|
+
return () => _c$() ? (
|
|
3748
|
+
/* Compact mode — friendly name + collapsible details */
|
|
3749
|
+
[(() => {
|
|
3750
|
+
var _el$0 = _tmpl$23(), _el$1 = _el$0.firstChild, _el$10 = _el$1.nextSibling;
|
|
3751
|
+
addEventListener(_el$0, "click", () => setShowDetails(!showDetails()));
|
|
3752
|
+
insert(_el$1, displayName);
|
|
3753
|
+
createRenderEffect((_p$) => {
|
|
3754
|
+
var _v$5 = `pp-popup__chevron ${showDetails() ? "pp-popup__chevron--open" : ""}`, _v$6 = icons.chevronDown, _v$7 = showDetails();
|
|
3755
|
+
_v$5 !== _p$.e && className(_el$10, _p$.e = _v$5);
|
|
3756
|
+
_v$6 !== _p$.t && (_el$10.innerHTML = _p$.t = _v$6);
|
|
3757
|
+
_v$7 !== _p$.a && setAttribute(_el$10, "aria-expanded", _p$.a = _v$7);
|
|
3758
|
+
return _p$;
|
|
3759
|
+
}, {
|
|
3760
|
+
e: void 0,
|
|
3761
|
+
t: void 0,
|
|
3762
|
+
a: void 0
|
|
3763
|
+
});
|
|
3764
|
+
return _el$0;
|
|
3765
|
+
})(), (() => {
|
|
3766
|
+
var _el$11 = _tmpl$32(), _el$12 = _el$11.firstChild, _el$13 = _el$12.firstChild;
|
|
3767
|
+
insert(_el$13, () => props.context.cssSelector);
|
|
3768
|
+
insert(_el$12, createComponent(Show, {
|
|
3769
|
+
get when() {
|
|
3770
|
+
return props.context.framework?.sourceFile;
|
|
3771
|
+
},
|
|
3772
|
+
children: (file) => (() => {
|
|
3773
|
+
var _el$14 = _tmpl$42(), _el$15 = _el$14.firstChild, _el$16 = _el$15.nextSibling;
|
|
3774
|
+
addEventListener(_el$14, "click", openFileHandler);
|
|
3775
|
+
insert(_el$14, () => file().split("/").pop(), null);
|
|
3776
|
+
createRenderEffect((_p$) => {
|
|
3777
|
+
var _v$8 = file(), _v$9 = icons.fileCode;
|
|
3778
|
+
_v$8 !== _p$.e && setAttribute(_el$14, "title", _p$.e = _v$8);
|
|
3779
|
+
_v$9 !== _p$.t && (_el$15.innerHTML = _p$.t = _v$9);
|
|
3780
|
+
return _p$;
|
|
3781
|
+
}, {
|
|
3782
|
+
e: void 0,
|
|
3783
|
+
t: void 0
|
|
3784
|
+
});
|
|
3785
|
+
return _el$14;
|
|
3786
|
+
})()
|
|
3787
|
+
}), null);
|
|
3788
|
+
createRenderEffect(() => className(_el$11, `pp-popup__details ${showDetails() ? "pp-popup__details--open" : ""}`));
|
|
3789
|
+
return _el$11;
|
|
3790
|
+
})()]
|
|
3791
|
+
) : (
|
|
3792
|
+
/* Expanded mode — all info visible */
|
|
3793
|
+
[(() => {
|
|
3794
|
+
var _el$17 = _tmpl$52();
|
|
3795
|
+
insert(_el$17, displayName);
|
|
3796
|
+
return _el$17;
|
|
3797
|
+
})(), (() => {
|
|
3798
|
+
var _el$18 = _tmpl$62();
|
|
3799
|
+
insert(_el$18, () => props.context.cssSelector);
|
|
3800
|
+
return _el$18;
|
|
3801
|
+
})(), createComponent(Show, {
|
|
3802
|
+
get when() {
|
|
3803
|
+
return props.context.framework?.sourceFile;
|
|
3804
|
+
},
|
|
3805
|
+
children: (file) => (() => {
|
|
3806
|
+
var _el$19 = _tmpl$42(), _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling;
|
|
3807
|
+
addEventListener(_el$19, "click", openFileHandler);
|
|
3808
|
+
insert(_el$19, () => file().split("/").pop(), null);
|
|
3809
|
+
createRenderEffect((_p$) => {
|
|
3810
|
+
var _v$0 = file(), _v$1 = icons.fileCode;
|
|
3811
|
+
_v$0 !== _p$.e && setAttribute(_el$19, "title", _p$.e = _v$0);
|
|
3812
|
+
_v$1 !== _p$.t && (_el$20.innerHTML = _p$.t = _v$1);
|
|
3813
|
+
return _p$;
|
|
3814
|
+
}, {
|
|
3815
|
+
e: void 0,
|
|
3816
|
+
t: void 0
|
|
3817
|
+
});
|
|
3818
|
+
return _el$19;
|
|
3819
|
+
})()
|
|
3820
|
+
})]
|
|
3821
|
+
);
|
|
3822
|
+
})(), _el$2);
|
|
3823
|
+
addEventListener(_el$3, "keydown", handleKeyDown);
|
|
3824
|
+
addEventListener(_el$3, "input", handleAutoGrow);
|
|
3825
|
+
var _ref$ = textareaRef;
|
|
3826
|
+
typeof _ref$ === "function" ? use(_ref$, _el$3) : textareaRef = _el$3;
|
|
3827
|
+
insert(_el$2, hasSpeechAPI && (() => {
|
|
3828
|
+
var _el$22 = _tmpl$72();
|
|
3829
|
+
addEventListener(_el$22, "click", toggleRecording);
|
|
3830
|
+
createRenderEffect((_p$) => {
|
|
3831
|
+
var _v$10 = `pp-btn--icon pp-popup__mic ${isRecording() ? "pp-popup__mic--recording" : ""}`, _v$11 = isRecording() ? "Stop recording" : "Voice input", _v$12 = isRecording() ? "Stop recording" : "Voice input", _v$13 = isRecording() ? icons.microphoneOff : icons.microphone;
|
|
3832
|
+
_v$10 !== _p$.e && className(_el$22, _p$.e = _v$10);
|
|
3833
|
+
_v$11 !== _p$.t && setAttribute(_el$22, "title", _p$.t = _v$11);
|
|
3834
|
+
_v$12 !== _p$.a && setAttribute(_el$22, "aria-label", _p$.a = _v$12);
|
|
3835
|
+
_v$13 !== _p$.o && (_el$22.innerHTML = _p$.o = _v$13);
|
|
3836
|
+
return _p$;
|
|
3837
|
+
}, {
|
|
3838
|
+
e: void 0,
|
|
3839
|
+
t: void 0,
|
|
3840
|
+
a: void 0,
|
|
3841
|
+
o: void 0
|
|
3842
|
+
});
|
|
3843
|
+
return _el$22;
|
|
3844
|
+
})(), null);
|
|
3845
|
+
addEventListener(_el$5, "click", handleFixThis);
|
|
3846
|
+
addEventListener(_el$8, "click", () => props.onCancel());
|
|
3847
|
+
insert(_el$4, (() => {
|
|
3848
|
+
var _c$2 = memo(() => !!(props.queueMode && props.onQueue));
|
|
3849
|
+
return () => _c$2() && (() => {
|
|
3850
|
+
var _el$23 = _tmpl$82(), _el$24 = _el$23.firstChild;
|
|
3851
|
+
addEventListener(_el$23, "click", handleQueue);
|
|
3852
|
+
createRenderEffect((_p$) => {
|
|
3853
|
+
var _v$14 = !comment().trim(), _v$15 = icons.plus;
|
|
3854
|
+
_v$14 !== _p$.e && (_el$23.disabled = _p$.e = _v$14);
|
|
3855
|
+
_v$15 !== _p$.t && (_el$24.innerHTML = _p$.t = _v$15);
|
|
3856
|
+
return _p$;
|
|
3857
|
+
}, {
|
|
3858
|
+
e: void 0,
|
|
3859
|
+
t: void 0
|
|
3860
|
+
});
|
|
3861
|
+
return _el$23;
|
|
3862
|
+
})();
|
|
3863
|
+
})(), _el$9);
|
|
3864
|
+
addEventListener(_el$9, "click", () => handleSubmit());
|
|
3865
|
+
insert(_el$9, () => props.isEditing ? "Save" : "Add Pin");
|
|
3866
|
+
createRenderEffect((_p$) => {
|
|
3867
|
+
var _v$ = `${popupPosition().x}px`, _v$2 = `${popupPosition().y}px`, _v$3 = icons.bolt, _v$4 = !comment().trim();
|
|
3868
|
+
_v$ !== _p$.e && setStyleProperty(_el$, "left", _p$.e = _v$);
|
|
3869
|
+
_v$2 !== _p$.t && setStyleProperty(_el$, "top", _p$.t = _v$2);
|
|
3870
|
+
_v$3 !== _p$.a && (_el$6.innerHTML = _p$.a = _v$3);
|
|
3871
|
+
_v$4 !== _p$.o && (_el$9.disabled = _p$.o = _v$4);
|
|
3872
|
+
return _p$;
|
|
3873
|
+
}, {
|
|
3874
|
+
e: void 0,
|
|
3875
|
+
t: void 0,
|
|
3876
|
+
a: void 0,
|
|
3877
|
+
o: void 0
|
|
3878
|
+
});
|
|
3879
|
+
createRenderEffect(() => _el$3.value = comment());
|
|
3880
|
+
return _el$;
|
|
3881
|
+
})();
|
|
3882
|
+
};
|
|
3883
|
+
|
|
3884
|
+
// src/ui/components/ContextMenu.tsx
|
|
3885
|
+
var _tmpl$24 = /* @__PURE__ */ template(`<div class=pp-context-menu><div class=pp-context-menu__item><span></span>Add Annotation</div><div class=pp-context-menu__item><span></span>Quick Prompt</div><div class=pp-context-menu__separator></div><div class=pp-context-menu__item><span></span>Copy Element Context</div><div class=pp-context-menu__item><span></span>Copy HTML Snippet</div><div class=pp-context-menu__item><span></span>Copy Computed Styles`);
|
|
3886
|
+
var ContextMenu = (props) => {
|
|
3887
|
+
let menuRef;
|
|
3888
|
+
onMount(() => {
|
|
3889
|
+
const handleClick = (e) => {
|
|
3890
|
+
if (menuRef && !e.composedPath().includes(menuRef)) {
|
|
3891
|
+
props.onClose();
|
|
3892
|
+
}
|
|
3893
|
+
};
|
|
3894
|
+
const handleKeyDown = (e) => {
|
|
3895
|
+
if (e.key === "Escape") props.onClose();
|
|
3896
|
+
};
|
|
3897
|
+
setTimeout(() => {
|
|
3898
|
+
document.addEventListener("click", handleClick, true);
|
|
3899
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
3900
|
+
}, 0);
|
|
3901
|
+
onCleanup(() => {
|
|
3902
|
+
document.removeEventListener("click", handleClick, true);
|
|
3903
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
3904
|
+
});
|
|
3905
|
+
});
|
|
3906
|
+
const x = Math.min(props.position.x, window.innerWidth - 200);
|
|
3907
|
+
const y = Math.min(props.position.y, window.innerHeight - 250);
|
|
3908
|
+
return (() => {
|
|
3909
|
+
var _el$ = _tmpl$24(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling, _el$5 = _el$4.firstChild, _el$6 = _el$4.nextSibling, _el$7 = _el$6.nextSibling, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$0 = _el$9.firstChild, _el$1 = _el$9.nextSibling, _el$10 = _el$1.firstChild;
|
|
3910
|
+
var _ref$ = menuRef;
|
|
3911
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : menuRef = _el$;
|
|
3912
|
+
setStyleProperty(_el$, "left", `${x}px`);
|
|
3913
|
+
setStyleProperty(_el$, "top", `${y}px`);
|
|
3914
|
+
addEventListener(_el$2, "click", () => props.onAnnotate());
|
|
3915
|
+
addEventListener(_el$4, "click", () => props.onPrompt());
|
|
3916
|
+
addEventListener(_el$7, "click", () => props.onCopyContext());
|
|
3917
|
+
addEventListener(_el$9, "click", async () => {
|
|
3918
|
+
const html = props.element.outerHTML.replace(/\s+/g, " ").trim().slice(0, 500);
|
|
3919
|
+
await navigator.clipboard.writeText(html);
|
|
3920
|
+
props.onClose();
|
|
3921
|
+
});
|
|
3922
|
+
addEventListener(_el$1, "click", async () => {
|
|
3923
|
+
const styles = window.getComputedStyle(props.element);
|
|
3924
|
+
const relevant = ["color", "background-color", "font-size", "font-family", "padding", "margin", "border", "display", "position", "width", "height"];
|
|
3925
|
+
const result = relevant.map((key) => `${key}: ${styles.getPropertyValue(key)}`).join("\n");
|
|
3926
|
+
await navigator.clipboard.writeText(result);
|
|
3927
|
+
props.onClose();
|
|
3928
|
+
});
|
|
3929
|
+
createRenderEffect((_p$) => {
|
|
3930
|
+
var _v$ = icons.pin, _v$2 = icons.messageSquare, _v$3 = icons.copy, _v$4 = icons.fileCode, _v$5 = icons.eye;
|
|
3931
|
+
_v$ !== _p$.e && (_el$3.innerHTML = _p$.e = _v$);
|
|
3932
|
+
_v$2 !== _p$.t && (_el$5.innerHTML = _p$.t = _v$2);
|
|
3933
|
+
_v$3 !== _p$.a && (_el$8.innerHTML = _p$.a = _v$3);
|
|
3934
|
+
_v$4 !== _p$.o && (_el$0.innerHTML = _p$.o = _v$4);
|
|
3935
|
+
_v$5 !== _p$.i && (_el$10.innerHTML = _p$.i = _v$5);
|
|
3936
|
+
return _p$;
|
|
3937
|
+
}, {
|
|
3938
|
+
e: void 0,
|
|
3939
|
+
t: void 0,
|
|
3940
|
+
a: void 0,
|
|
3941
|
+
o: void 0,
|
|
3942
|
+
i: void 0
|
|
3943
|
+
});
|
|
3944
|
+
return _el$;
|
|
3945
|
+
})();
|
|
3946
|
+
};
|
|
3947
|
+
|
|
3948
|
+
// src/ui/components/SelectionLabel.tsx
|
|
3949
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div class=pp-selection-label>`);
|
|
3950
|
+
var SelectionLabel = (props) => {
|
|
3951
|
+
return createComponent(Show, {
|
|
3952
|
+
get when() {
|
|
3953
|
+
return props.info;
|
|
3954
|
+
},
|
|
3955
|
+
children: (info) => {
|
|
3956
|
+
const {
|
|
3957
|
+
text,
|
|
3958
|
+
rect
|
|
3959
|
+
} = info();
|
|
3960
|
+
const y = rect.top > 30 ? rect.top - 24 : rect.bottom + 4;
|
|
3961
|
+
const x = Math.max(4, Math.min(rect.left, window.innerWidth - 300));
|
|
3962
|
+
return (() => {
|
|
3963
|
+
var _el$ = _tmpl$25();
|
|
3964
|
+
setStyleProperty(_el$, "left", `${x}px`);
|
|
3965
|
+
setStyleProperty(_el$, "top", `${y}px`);
|
|
3966
|
+
insert(_el$, text);
|
|
3967
|
+
return _el$;
|
|
3968
|
+
})();
|
|
3969
|
+
}
|
|
3970
|
+
});
|
|
3971
|
+
};
|
|
3972
|
+
|
|
3973
|
+
// src/ui/components/PromptMode.tsx
|
|
3974
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<div class=pp-prompt><input class=pp-prompt__input type=text placeholder="Tell the agent what to do..."><button class="pp-btn pp-btn--primary pp-btn--sm"><span>`);
|
|
3975
|
+
var PromptMode = (props) => {
|
|
3976
|
+
const [instruction, setInstruction] = createSignal("");
|
|
3977
|
+
let inputRef;
|
|
3978
|
+
onMount(() => inputRef?.focus());
|
|
3979
|
+
function handleSubmit() {
|
|
3980
|
+
const text = instruction().trim();
|
|
3981
|
+
if (!text) return;
|
|
3982
|
+
props.onSend(text);
|
|
3983
|
+
}
|
|
3984
|
+
const rect = props.element.getBoundingClientRect();
|
|
3985
|
+
const x = Math.max(8, Math.min(rect.left, window.innerWidth - 300));
|
|
3986
|
+
const y = rect.bottom + 8 > window.innerHeight - 40 ? rect.top - 40 : rect.bottom + 8;
|
|
3987
|
+
return (() => {
|
|
3988
|
+
var _el$ = _tmpl$26(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild;
|
|
3989
|
+
setStyleProperty(_el$, "left", `${x}px`);
|
|
3990
|
+
setStyleProperty(_el$, "top", `${y}px`);
|
|
3991
|
+
_el$2.$$keydown = (e) => {
|
|
3992
|
+
if (e.key === "Enter") handleSubmit();
|
|
3993
|
+
if (e.key === "Escape") props.onCancel();
|
|
3994
|
+
};
|
|
3995
|
+
_el$2.$$input = (e) => setInstruction(e.currentTarget.value);
|
|
3996
|
+
var _ref$ = inputRef;
|
|
3997
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : inputRef = _el$2;
|
|
3998
|
+
_el$3.$$click = handleSubmit;
|
|
3999
|
+
createRenderEffect(() => _el$4.innerHTML = icons.send);
|
|
4000
|
+
createRenderEffect(() => _el$2.value = instruction());
|
|
4001
|
+
return _el$;
|
|
4002
|
+
})();
|
|
4003
|
+
};
|
|
4004
|
+
delegateEvents(["input", "keydown", "click"]);
|
|
4005
|
+
|
|
4006
|
+
// src/ui/components/TextInputPopup.tsx
|
|
4007
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<div class=pp-text-input-popup><div class=pp-text-input-popup__indicator></div><input class=pp-text-input-popup__input type=text placeholder="Add text note...">`);
|
|
4008
|
+
var TextInputPopup = (props) => {
|
|
4009
|
+
const [text, setText] = createSignal("");
|
|
4010
|
+
let inputRef;
|
|
4011
|
+
onMount(() => inputRef?.focus());
|
|
4012
|
+
function handleSubmit() {
|
|
4013
|
+
const t = text().trim();
|
|
4014
|
+
if (t) props.onSubmit(t);
|
|
4015
|
+
else props.onCancel();
|
|
4016
|
+
}
|
|
4017
|
+
const x = Math.max(8, Math.min(props.x, window.innerWidth - 260));
|
|
4018
|
+
const y = Math.max(8, Math.min(props.y + 8, window.innerHeight - 50));
|
|
4019
|
+
return (() => {
|
|
4020
|
+
var _el$ = _tmpl$27(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
|
|
4021
|
+
setStyleProperty(_el$, "left", `${x}px`);
|
|
4022
|
+
setStyleProperty(_el$, "top", `${y}px`);
|
|
4023
|
+
_el$3.addEventListener("blur", handleSubmit);
|
|
4024
|
+
_el$3.$$keydown = (e) => {
|
|
4025
|
+
if (e.key === "Enter") handleSubmit();
|
|
4026
|
+
if (e.key === "Escape") props.onCancel();
|
|
4027
|
+
};
|
|
4028
|
+
_el$3.$$input = (e) => setText(e.currentTarget.value);
|
|
4029
|
+
var _ref$ = inputRef;
|
|
4030
|
+
typeof _ref$ === "function" ? use(_ref$, _el$3) : inputRef = _el$3;
|
|
4031
|
+
createRenderEffect((_$p) => setStyleProperty(_el$2, "background", props.color));
|
|
4032
|
+
createRenderEffect(() => _el$3.value = text());
|
|
4033
|
+
return _el$;
|
|
4034
|
+
})();
|
|
4035
|
+
};
|
|
4036
|
+
delegateEvents(["input", "keydown"]);
|
|
4037
|
+
|
|
4038
|
+
// src/ui/components/PinpointApp.tsx
|
|
4039
|
+
var PinpointApp = (props) => {
|
|
4040
|
+
const [active, setActive] = createSignal(false);
|
|
4041
|
+
const [expanded, setExpanded] = createSignal(false);
|
|
4042
|
+
const [pins, setPins] = createSignal([]);
|
|
4043
|
+
const [hoveredElement, setHoveredElement] = createSignal(null);
|
|
4044
|
+
const [hoveredRect, setHoveredRect] = createSignal(null);
|
|
4045
|
+
const [selectedElement, setSelectedElement] = createSignal(null);
|
|
4046
|
+
const [selectedContext, setSelectedContext] = createSignal(null);
|
|
4047
|
+
const [showPopup, setShowPopup] = createSignal(false);
|
|
4048
|
+
const [editingPin, setEditingPin] = createSignal(null);
|
|
4049
|
+
const [showContextMenu, setShowContextMenu] = createSignal(false);
|
|
4050
|
+
const [contextMenuPos, setContextMenuPos] = createSignal({
|
|
4051
|
+
x: 0,
|
|
4052
|
+
y: 0
|
|
4053
|
+
});
|
|
4054
|
+
const [showSettings, setShowSettings] = createSignal(false);
|
|
4055
|
+
const [showPrompt, setShowPrompt] = createSignal(false);
|
|
4056
|
+
const [selectionLabelInfo, setSelectionLabelInfo] = createSignal(null);
|
|
4057
|
+
const [dragRect, setDragRect] = createSignal(null);
|
|
4058
|
+
const [mode, setMode] = createSignal("select");
|
|
4059
|
+
const [drawMode, setDrawMode] = createSignal(false);
|
|
4060
|
+
const [drawStrokes, setDrawStrokes] = createSignal([]);
|
|
4061
|
+
const [currentStroke, setCurrentStroke] = createSignal(null);
|
|
4062
|
+
const [drawColor, setDrawColor] = createSignal("#EF4444");
|
|
4063
|
+
const [drawLineWidth, setDrawLineWidth] = createSignal(4);
|
|
4064
|
+
const [drawTool, setDrawTool] = createSignal("freehand");
|
|
4065
|
+
const [textNotes, setTextNotes] = createSignal([]);
|
|
4066
|
+
const [showTextInput, setShowTextInput] = createSignal(false);
|
|
4067
|
+
const [textInputPos, setTextInputPos] = createSignal({
|
|
4068
|
+
x: 0,
|
|
4069
|
+
y: 0
|
|
4070
|
+
});
|
|
4071
|
+
let isDrawing = false;
|
|
4072
|
+
const [queue, setQueue] = createSignal([]);
|
|
4073
|
+
const [selectedPinIds, setSelectedPinIds] = createSignal(/* @__PURE__ */ new Set());
|
|
4074
|
+
const [outputFormat, setOutputFormat] = createSignal(props.config.outputFormat || "detailed");
|
|
4075
|
+
const [clearOnSend, setClearOnSend] = createSignal(props.config.clearOnSend ?? false);
|
|
4076
|
+
const [blockInteractions, setBlockInteractions] = createSignal(props.config.blockInteractions ?? false);
|
|
4077
|
+
const [autoSubmit, setAutoSubmit] = createSignal(props.config.autoSubmit ?? true);
|
|
4078
|
+
const [compactPopup, setCompactPopup] = createSignal(props.config.compactPopup ?? true);
|
|
4079
|
+
const storage = props.config.storage || (props.config.endpoint ? new RestClient(props.config.endpoint) : new MemoryStore());
|
|
4080
|
+
const picker = new ElementPicker({
|
|
4081
|
+
ignoreSelector: "#pinpoint-root, [data-pinpoint-marker]",
|
|
4082
|
+
blockInteractions: blockInteractions(),
|
|
4083
|
+
onHover: (element, rect) => {
|
|
4084
|
+
setHoveredElement(element);
|
|
4085
|
+
setHoveredRect(rect);
|
|
4086
|
+
if (element && rect) {
|
|
4087
|
+
const framework = detectFramework();
|
|
4088
|
+
const componentInfo = framework.getComponentInfo(element);
|
|
4089
|
+
const tagName = element.tagName.toLowerCase();
|
|
4090
|
+
const componentName = componentInfo?.name;
|
|
4091
|
+
const sourceFile = framework.getSourceLocation(element)?.file;
|
|
4092
|
+
const parts = [tagName];
|
|
4093
|
+
if (componentName) parts.push(componentName);
|
|
4094
|
+
if (sourceFile) parts.push(sourceFile);
|
|
4095
|
+
setSelectionLabelInfo({
|
|
4096
|
+
text: parts.join(" \xB7 "),
|
|
4097
|
+
rect
|
|
4098
|
+
});
|
|
4099
|
+
} else {
|
|
4100
|
+
setSelectionLabelInfo(null);
|
|
4101
|
+
}
|
|
4102
|
+
},
|
|
4103
|
+
onStableHover: (_element) => {
|
|
4104
|
+
},
|
|
4105
|
+
onSelect: (element) => {
|
|
4106
|
+
const framework = detectFramework();
|
|
4107
|
+
const frameworkInfo = (() => {
|
|
4108
|
+
const info = framework.getComponentInfo(element);
|
|
4109
|
+
const source = framework.getSourceLocation(element);
|
|
4110
|
+
if (!info && !source) return void 0;
|
|
4111
|
+
return {
|
|
4112
|
+
framework: framework.name,
|
|
4113
|
+
componentPath: info?.name ? `<${info.name}>` : "",
|
|
4114
|
+
sourceFile: source ? `${source.file}${source.line ? `:${source.line}` : ""}` : void 0,
|
|
4115
|
+
frameworkVersion: void 0
|
|
4116
|
+
};
|
|
4117
|
+
})();
|
|
4118
|
+
const context = buildElementContext(element, frameworkInfo);
|
|
4119
|
+
setSelectedElement(element);
|
|
4120
|
+
setSelectedContext(context);
|
|
4121
|
+
setShowPopup(true);
|
|
4122
|
+
picker.pause();
|
|
4123
|
+
}
|
|
4124
|
+
});
|
|
4125
|
+
const dragSelect = new DragSelect({
|
|
4126
|
+
ignoreSelector: "#pinpoint-root, [data-pinpoint-marker]",
|
|
4127
|
+
onDragStart: (rect) => setDragRect(rect),
|
|
4128
|
+
onDragMove: (rect) => setDragRect(rect),
|
|
4129
|
+
onDragEnd: (elements) => {
|
|
4130
|
+
setDragRect(null);
|
|
4131
|
+
for (const el of elements) {
|
|
4132
|
+
addPin(el, "Multi-selected element");
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
});
|
|
4136
|
+
const textSelect = new TextSelect({
|
|
4137
|
+
onSelect: (_selection) => {
|
|
4138
|
+
}
|
|
4139
|
+
});
|
|
4140
|
+
const handleKeyDown = (e) => {
|
|
4141
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
4142
|
+
if (mod && e.shiftKey && e.key === ".") {
|
|
4143
|
+
e.preventDefault();
|
|
4144
|
+
toggleActive();
|
|
4145
|
+
return;
|
|
4146
|
+
}
|
|
4147
|
+
if (mod && e.shiftKey && (e.key === "D" || e.key === "d")) {
|
|
4148
|
+
e.preventDefault();
|
|
4149
|
+
if (active()) {
|
|
4150
|
+
if (mode() === "draw") {
|
|
4151
|
+
handleModeChange("select");
|
|
4152
|
+
} else {
|
|
4153
|
+
handleModeChange("draw");
|
|
4154
|
+
}
|
|
4155
|
+
}
|
|
4156
|
+
return;
|
|
4157
|
+
}
|
|
4158
|
+
if (!active()) return;
|
|
4159
|
+
if (mod && e.shiftKey && e.key === "C") {
|
|
4160
|
+
e.preventDefault();
|
|
4161
|
+
copyPins();
|
|
4162
|
+
return;
|
|
4163
|
+
}
|
|
4164
|
+
if (mod && e.shiftKey && e.key === "Enter") {
|
|
4165
|
+
e.preventDefault();
|
|
4166
|
+
if (queue().length > 0) {
|
|
4167
|
+
sendQueue();
|
|
4168
|
+
} else if (selectedPinIds().size > 0) {
|
|
4169
|
+
sendSelected();
|
|
4170
|
+
} else {
|
|
4171
|
+
sendPins();
|
|
4172
|
+
}
|
|
4173
|
+
return;
|
|
4174
|
+
}
|
|
4175
|
+
if (mod && e.key === "z" && drawMode()) {
|
|
4176
|
+
e.preventDefault();
|
|
4177
|
+
undoDrawStroke();
|
|
4178
|
+
return;
|
|
4179
|
+
}
|
|
4180
|
+
if (e.key === "Escape") {
|
|
4181
|
+
if (showTextInput()) {
|
|
4182
|
+
setShowTextInput(false);
|
|
4183
|
+
} else if (showPopup()) {
|
|
4184
|
+
closePopup();
|
|
4185
|
+
} else if (showContextMenu()) {
|
|
4186
|
+
setShowContextMenu(false);
|
|
4187
|
+
} else if (showPrompt()) {
|
|
4188
|
+
setShowPrompt(false);
|
|
4189
|
+
} else if (drawMode()) {
|
|
4190
|
+
handleModeChange("select");
|
|
4191
|
+
} else if (expanded()) {
|
|
4192
|
+
setExpanded(false);
|
|
4193
|
+
} else {
|
|
4194
|
+
deactivateSelection();
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
};
|
|
4198
|
+
const handleContextMenu = (e) => {
|
|
4199
|
+
if (!active() || drawMode()) return;
|
|
4200
|
+
const element = document.elementFromPoint(e.clientX, e.clientY);
|
|
4201
|
+
if (!element || element.closest("#pinpoint-root")) return;
|
|
4202
|
+
e.preventDefault();
|
|
4203
|
+
setSelectedElement(element);
|
|
4204
|
+
setContextMenuPos({
|
|
4205
|
+
x: e.clientX,
|
|
4206
|
+
y: e.clientY
|
|
4207
|
+
});
|
|
4208
|
+
setShowContextMenu(true);
|
|
4209
|
+
};
|
|
4210
|
+
createEffect(() => {
|
|
4211
|
+
picker.setBlockInteractions(blockInteractions());
|
|
4212
|
+
});
|
|
4213
|
+
createEffect(() => {
|
|
4214
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
4215
|
+
document.addEventListener("contextmenu", handleContextMenu, true);
|
|
4216
|
+
onCleanup(() => {
|
|
4217
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
4218
|
+
document.removeEventListener("contextmenu", handleContextMenu, true);
|
|
4219
|
+
picker.dispose();
|
|
4220
|
+
dragSelect.dispose();
|
|
4221
|
+
textSelect.dispose();
|
|
4222
|
+
markerManager.dispose();
|
|
4223
|
+
});
|
|
4224
|
+
});
|
|
4225
|
+
const markerManager = new PinMarkerManager(props.config.markerColor);
|
|
4226
|
+
markerManager.setOnClick((pin) => openEditPopup(pin));
|
|
4227
|
+
markerManager.setOnToggleSelect((pin) => togglePinSelect(pin));
|
|
4228
|
+
createEffect(() => {
|
|
4229
|
+
const pageUrl = window.location.pathname;
|
|
4230
|
+
storage.load(pageUrl).then((loaded) => setPins(loaded));
|
|
4231
|
+
});
|
|
4232
|
+
createEffect(() => {
|
|
4233
|
+
const currentPins = pins();
|
|
4234
|
+
markerManager.update(currentPins);
|
|
4235
|
+
});
|
|
4236
|
+
createEffect(() => {
|
|
4237
|
+
markerManager.setSelectedPins(selectedPinIds());
|
|
4238
|
+
});
|
|
4239
|
+
function handleModeChange(newMode) {
|
|
4240
|
+
setMode(newMode);
|
|
4241
|
+
if (newMode === "draw") {
|
|
4242
|
+
setDrawMode(true);
|
|
4243
|
+
picker.pause();
|
|
4244
|
+
dragSelect.deactivate();
|
|
4245
|
+
textSelect.deactivate();
|
|
4246
|
+
markerManager.setShowCheckboxes(false);
|
|
4247
|
+
} else if (newMode === "select") {
|
|
4248
|
+
setDrawMode(false);
|
|
4249
|
+
picker.resume();
|
|
4250
|
+
if (active()) {
|
|
4251
|
+
dragSelect.activate();
|
|
4252
|
+
textSelect.activate();
|
|
4253
|
+
}
|
|
4254
|
+
markerManager.setShowCheckboxes(false);
|
|
4255
|
+
} else if (newMode === "queue") {
|
|
4256
|
+
setDrawMode(false);
|
|
4257
|
+
picker.pause();
|
|
4258
|
+
markerManager.setShowCheckboxes(true);
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
function handleDrawStart(x, y) {
|
|
4262
|
+
isDrawing = true;
|
|
4263
|
+
const toolType = drawTool();
|
|
4264
|
+
if (toolType === "text") return;
|
|
4265
|
+
setCurrentStroke({
|
|
4266
|
+
points: [{
|
|
4267
|
+
x,
|
|
4268
|
+
y
|
|
4269
|
+
}],
|
|
4270
|
+
color: drawColor(),
|
|
4271
|
+
lineWidth: drawLineWidth(),
|
|
4272
|
+
type: toolType
|
|
4273
|
+
});
|
|
4274
|
+
}
|
|
4275
|
+
function handleDrawMove(x, y) {
|
|
4276
|
+
if (!isDrawing) return;
|
|
4277
|
+
const stroke = currentStroke();
|
|
4278
|
+
if (!stroke) return;
|
|
4279
|
+
if (stroke.type === "freehand") {
|
|
4280
|
+
setCurrentStroke({
|
|
4281
|
+
...stroke,
|
|
4282
|
+
points: [...stroke.points, {
|
|
4283
|
+
x,
|
|
4284
|
+
y
|
|
4285
|
+
}]
|
|
4286
|
+
});
|
|
4287
|
+
} else {
|
|
4288
|
+
setCurrentStroke({
|
|
4289
|
+
...stroke,
|
|
4290
|
+
points: [stroke.points[0], {
|
|
4291
|
+
x,
|
|
4292
|
+
y
|
|
4293
|
+
}]
|
|
4294
|
+
});
|
|
4295
|
+
}
|
|
4296
|
+
}
|
|
4297
|
+
function handleDrawEnd() {
|
|
4298
|
+
if (!isDrawing) return;
|
|
4299
|
+
isDrawing = false;
|
|
4300
|
+
const stroke = currentStroke();
|
|
4301
|
+
if (stroke && stroke.points.length > 1) {
|
|
4302
|
+
setDrawStrokes((prev) => [...prev, stroke]);
|
|
4303
|
+
}
|
|
4304
|
+
setCurrentStroke(null);
|
|
4305
|
+
}
|
|
4306
|
+
function handleTextPlace(x, y) {
|
|
4307
|
+
setTextInputPos({
|
|
4308
|
+
x,
|
|
4309
|
+
y
|
|
4310
|
+
});
|
|
4311
|
+
setShowTextInput(true);
|
|
4312
|
+
}
|
|
4313
|
+
function handleTextSubmit(text) {
|
|
4314
|
+
setTextNotes((prev) => [...prev, {
|
|
4315
|
+
x: textInputPos().x,
|
|
4316
|
+
y: textInputPos().y,
|
|
4317
|
+
text,
|
|
4318
|
+
color: drawColor()
|
|
4319
|
+
}]);
|
|
4320
|
+
setShowTextInput(false);
|
|
4321
|
+
}
|
|
4322
|
+
function undoDrawStroke() {
|
|
4323
|
+
if (textNotes().length > 0) {
|
|
4324
|
+
setTextNotes((prev) => prev.slice(0, -1));
|
|
4325
|
+
} else if (drawStrokes().length > 0) {
|
|
4326
|
+
setDrawStrokes((prev) => prev.slice(0, -1));
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
function clearDrawing() {
|
|
4330
|
+
setDrawStrokes([]);
|
|
4331
|
+
setTextNotes([]);
|
|
4332
|
+
setCurrentStroke(null);
|
|
4333
|
+
}
|
|
4334
|
+
function addToQueue(pin) {
|
|
4335
|
+
const item = {
|
|
4336
|
+
id: crypto.randomUUID(),
|
|
4337
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
4338
|
+
};
|
|
4339
|
+
if (pin) {
|
|
4340
|
+
item.pin = pin;
|
|
4341
|
+
}
|
|
4342
|
+
const strokes = drawStrokes();
|
|
4343
|
+
const notes = textNotes();
|
|
4344
|
+
if (strokes.length > 0 || notes.length > 0) {
|
|
4345
|
+
item.drawings = [...strokes];
|
|
4346
|
+
item.textNotes = [...notes];
|
|
4347
|
+
clearDrawing();
|
|
4348
|
+
}
|
|
4349
|
+
setQueue((prev) => [...prev, item]);
|
|
4350
|
+
}
|
|
4351
|
+
async function sendQueue() {
|
|
4352
|
+
const items = queue();
|
|
4353
|
+
if (items.length === 0) return;
|
|
4354
|
+
const {
|
|
4355
|
+
formatQueueForAgent
|
|
4356
|
+
} = await import("./agent-context-76ZW6ODH.js");
|
|
4357
|
+
const {
|
|
4358
|
+
message,
|
|
4359
|
+
context
|
|
4360
|
+
} = formatQueueForAgent(items, outputFormat());
|
|
4361
|
+
try {
|
|
4362
|
+
const {
|
|
4363
|
+
sendToAgentChat
|
|
4364
|
+
} = await import("@agent-native/core/client");
|
|
4365
|
+
sendToAgentChat({
|
|
4366
|
+
message,
|
|
4367
|
+
context,
|
|
4368
|
+
submit: autoSubmit()
|
|
4369
|
+
});
|
|
4370
|
+
} catch {
|
|
4371
|
+
await navigator.clipboard.writeText(`${message}
|
|
4372
|
+
|
|
4373
|
+
${context}`);
|
|
4374
|
+
}
|
|
4375
|
+
setQueue([]);
|
|
4376
|
+
if (clearOnSend()) {
|
|
4377
|
+
const pageUrl = window.location.pathname;
|
|
4378
|
+
await storage.clear(pageUrl);
|
|
4379
|
+
setPins([]);
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
function clearQueue() {
|
|
4383
|
+
setQueue([]);
|
|
4384
|
+
}
|
|
4385
|
+
function togglePinSelect(pin) {
|
|
4386
|
+
setSelectedPinIds((prev) => {
|
|
4387
|
+
const next = new Set(prev);
|
|
4388
|
+
if (next.has(pin.id)) {
|
|
4389
|
+
next.delete(pin.id);
|
|
4390
|
+
} else {
|
|
4391
|
+
next.add(pin.id);
|
|
4392
|
+
}
|
|
4393
|
+
return next;
|
|
4394
|
+
});
|
|
4395
|
+
}
|
|
4396
|
+
async function sendSelected() {
|
|
4397
|
+
const ids = selectedPinIds();
|
|
4398
|
+
if (ids.size === 0) return;
|
|
4399
|
+
const selected = pins().filter((p) => ids.has(p.id));
|
|
4400
|
+
const {
|
|
4401
|
+
formatPinsForAgent
|
|
4402
|
+
} = await import("./agent-context-76ZW6ODH.js");
|
|
4403
|
+
const {
|
|
4404
|
+
message,
|
|
4405
|
+
context
|
|
4406
|
+
} = formatPinsForAgent(selected, outputFormat());
|
|
4407
|
+
try {
|
|
4408
|
+
const {
|
|
4409
|
+
sendToAgentChat
|
|
4410
|
+
} = await import("@agent-native/core/client");
|
|
4411
|
+
sendToAgentChat({
|
|
4412
|
+
message,
|
|
4413
|
+
context,
|
|
4414
|
+
submit: autoSubmit()
|
|
4415
|
+
});
|
|
4416
|
+
} catch {
|
|
4417
|
+
await navigator.clipboard.writeText(`${message}
|
|
4418
|
+
|
|
4419
|
+
${context}`);
|
|
4420
|
+
}
|
|
4421
|
+
setSelectedPinIds(/* @__PURE__ */ new Set());
|
|
4422
|
+
}
|
|
4423
|
+
function toggleActive() {
|
|
4424
|
+
if (active()) {
|
|
4425
|
+
deactivateSelection();
|
|
4426
|
+
} else {
|
|
4427
|
+
activateSelection();
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
function activateSelection() {
|
|
4431
|
+
setActive(true);
|
|
4432
|
+
setExpanded(true);
|
|
4433
|
+
if (mode() !== "draw") {
|
|
4434
|
+
picker.activate();
|
|
4435
|
+
dragSelect.activate();
|
|
4436
|
+
textSelect.activate();
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
function deactivateSelection() {
|
|
4440
|
+
setActive(false);
|
|
4441
|
+
setDrawMode(false);
|
|
4442
|
+
setMode("select");
|
|
4443
|
+
picker.deactivate();
|
|
4444
|
+
dragSelect.deactivate();
|
|
4445
|
+
textSelect.deactivate();
|
|
4446
|
+
setHoveredElement(null);
|
|
4447
|
+
setHoveredRect(null);
|
|
4448
|
+
setSelectionLabelInfo(null);
|
|
4449
|
+
}
|
|
4450
|
+
function closePopup() {
|
|
4451
|
+
setShowPopup(false);
|
|
4452
|
+
setEditingPin(null);
|
|
4453
|
+
if (mode() !== "draw") {
|
|
4454
|
+
picker.resume();
|
|
4455
|
+
}
|
|
4456
|
+
}
|
|
4457
|
+
function addPin(element, comment) {
|
|
4458
|
+
const framework = detectFramework();
|
|
4459
|
+
const frameworkInfo = (() => {
|
|
4460
|
+
const info = framework.getComponentInfo(element);
|
|
4461
|
+
const source = framework.getSourceLocation(element);
|
|
4462
|
+
if (!info && !source) return void 0;
|
|
4463
|
+
return {
|
|
4464
|
+
framework: framework.name,
|
|
4465
|
+
componentPath: info?.name ? `<${info.name}>` : "",
|
|
4466
|
+
sourceFile: source ? `${source.file}${source.line ? `:${source.line}` : ""}` : void 0,
|
|
4467
|
+
frameworkVersion: void 0
|
|
4468
|
+
};
|
|
4469
|
+
})();
|
|
4470
|
+
const elementInfo = extractElementInfo(element);
|
|
4471
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4472
|
+
const pin = {
|
|
4473
|
+
id: crypto.randomUUID(),
|
|
4474
|
+
pageUrl: window.location.pathname,
|
|
4475
|
+
createdAt: now,
|
|
4476
|
+
updatedAt: now,
|
|
4477
|
+
author: props.config.author,
|
|
4478
|
+
comment,
|
|
4479
|
+
element: elementInfo,
|
|
4480
|
+
framework: frameworkInfo,
|
|
4481
|
+
status: {
|
|
4482
|
+
state: "open",
|
|
4483
|
+
changedAt: now,
|
|
4484
|
+
changedBy: "user"
|
|
4485
|
+
}
|
|
4486
|
+
};
|
|
4487
|
+
setPins((prev) => [...prev, pin]);
|
|
4488
|
+
storage.save(pin);
|
|
4489
|
+
closePopup();
|
|
4490
|
+
return pin;
|
|
4491
|
+
}
|
|
4492
|
+
function handleQueueFromPopup(comment) {
|
|
4493
|
+
const el = selectedElement();
|
|
4494
|
+
if (!el) return;
|
|
4495
|
+
const pin = addPin(el, comment);
|
|
4496
|
+
addToQueue(pin);
|
|
4497
|
+
}
|
|
4498
|
+
async function handleFixThis(comment) {
|
|
4499
|
+
const el = selectedElement();
|
|
4500
|
+
if (!el) return;
|
|
4501
|
+
const pin = addPin(el, comment);
|
|
4502
|
+
const {
|
|
4503
|
+
formatRichPinContext
|
|
4504
|
+
} = await import("./agent-context-76ZW6ODH.js");
|
|
4505
|
+
const richMessage = `Please fix: ${formatRichPinContext(pin)}`;
|
|
4506
|
+
try {
|
|
4507
|
+
const {
|
|
4508
|
+
sendToAgentChat
|
|
4509
|
+
} = await import("@agent-native/core/client");
|
|
4510
|
+
sendToAgentChat({
|
|
4511
|
+
message: richMessage,
|
|
4512
|
+
context: "",
|
|
4513
|
+
submit: autoSubmit()
|
|
4514
|
+
});
|
|
4515
|
+
} catch {
|
|
4516
|
+
await navigator.clipboard.writeText(richMessage);
|
|
4517
|
+
}
|
|
4518
|
+
}
|
|
4519
|
+
function openEditPopup(pin) {
|
|
4520
|
+
setShowPopup(false);
|
|
4521
|
+
queueMicrotask(() => {
|
|
4522
|
+
const el = document.querySelector(pin.element.selector);
|
|
4523
|
+
setEditingPin(pin);
|
|
4524
|
+
setSelectedContext(buildElementContext(el || document.body, pin.framework));
|
|
4525
|
+
setShowPopup(true);
|
|
4526
|
+
picker.pause();
|
|
4527
|
+
});
|
|
4528
|
+
}
|
|
4529
|
+
function updatePin(comment) {
|
|
4530
|
+
const pin = editingPin();
|
|
4531
|
+
if (!pin) return;
|
|
4532
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4533
|
+
const updated = {
|
|
4534
|
+
...pin,
|
|
4535
|
+
comment,
|
|
4536
|
+
updatedAt: now
|
|
4537
|
+
};
|
|
4538
|
+
setPins((prev) => prev.map((p) => p.id === pin.id ? updated : p));
|
|
4539
|
+
storage.update(pin.id, {
|
|
4540
|
+
comment,
|
|
4541
|
+
updatedAt: now
|
|
4542
|
+
});
|
|
4543
|
+
closePopup();
|
|
4544
|
+
}
|
|
4545
|
+
async function copyPins() {
|
|
4546
|
+
const {
|
|
4547
|
+
formatPins
|
|
4548
|
+
} = await import("./formatter-25JPHXYA.js");
|
|
4549
|
+
const text = formatPins(pins(), outputFormat());
|
|
4550
|
+
await navigator.clipboard.writeText(text);
|
|
4551
|
+
}
|
|
4552
|
+
async function sendPins() {
|
|
4553
|
+
const {
|
|
4554
|
+
formatPinsForAgent
|
|
4555
|
+
} = await import("./agent-context-76ZW6ODH.js");
|
|
4556
|
+
const {
|
|
4557
|
+
message,
|
|
4558
|
+
context
|
|
4559
|
+
} = formatPinsForAgent(pins(), outputFormat());
|
|
4560
|
+
try {
|
|
4561
|
+
const {
|
|
4562
|
+
sendToAgentChat
|
|
4563
|
+
} = await import("@agent-native/core/client");
|
|
4564
|
+
sendToAgentChat({
|
|
4565
|
+
message,
|
|
4566
|
+
context,
|
|
4567
|
+
submit: autoSubmit()
|
|
4568
|
+
});
|
|
4569
|
+
} catch {
|
|
4570
|
+
await navigator.clipboard.writeText(`${message}
|
|
4571
|
+
|
|
4572
|
+
${context}`);
|
|
4573
|
+
}
|
|
4574
|
+
if (clearOnSend()) {
|
|
4575
|
+
const pageUrl = window.location.pathname;
|
|
4576
|
+
await storage.clear(pageUrl);
|
|
4577
|
+
setPins([]);
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
function removePin(id) {
|
|
4581
|
+
setPins((prev) => prev.filter((p) => p.id !== id));
|
|
4582
|
+
storage.delete(id);
|
|
4583
|
+
setSelectedPinIds((prev) => {
|
|
4584
|
+
const next = new Set(prev);
|
|
4585
|
+
next.delete(id);
|
|
4586
|
+
return next;
|
|
4587
|
+
});
|
|
4588
|
+
}
|
|
4589
|
+
function clearPins() {
|
|
4590
|
+
const pageUrl = window.location.pathname;
|
|
4591
|
+
storage.clear(pageUrl);
|
|
4592
|
+
setPins([]);
|
|
4593
|
+
setSelectedPinIds(/* @__PURE__ */ new Set());
|
|
4594
|
+
}
|
|
4595
|
+
return [createComponent(OverlayCanvas, {
|
|
4596
|
+
get hoveredRect() {
|
|
4597
|
+
return hoveredRect();
|
|
4598
|
+
},
|
|
4599
|
+
get dragRect() {
|
|
4600
|
+
return dragRect();
|
|
4601
|
+
},
|
|
4602
|
+
get pins() {
|
|
4603
|
+
return pins();
|
|
4604
|
+
},
|
|
4605
|
+
get active() {
|
|
4606
|
+
return active();
|
|
4607
|
+
},
|
|
4608
|
+
get drawMode() {
|
|
4609
|
+
return drawMode();
|
|
4610
|
+
},
|
|
4611
|
+
get drawStrokes() {
|
|
4612
|
+
return drawStrokes();
|
|
4613
|
+
},
|
|
4614
|
+
get currentStroke() {
|
|
4615
|
+
return currentStroke();
|
|
4616
|
+
},
|
|
4617
|
+
get drawColor() {
|
|
4618
|
+
return drawColor();
|
|
4619
|
+
},
|
|
4620
|
+
get drawLineWidth() {
|
|
4621
|
+
return drawLineWidth();
|
|
4622
|
+
},
|
|
4623
|
+
get drawTool() {
|
|
4624
|
+
return drawTool();
|
|
4625
|
+
},
|
|
4626
|
+
get textNotes() {
|
|
4627
|
+
return textNotes();
|
|
4628
|
+
},
|
|
4629
|
+
onDrawStart: handleDrawStart,
|
|
4630
|
+
onDrawMove: handleDrawMove,
|
|
4631
|
+
onDrawEnd: handleDrawEnd,
|
|
4632
|
+
onTextPlace: handleTextPlace
|
|
4633
|
+
}), createComponent(SelectionLabel, {
|
|
4634
|
+
get info() {
|
|
4635
|
+
return selectionLabelInfo();
|
|
4636
|
+
}
|
|
4637
|
+
}), createComponent(Toolbar, {
|
|
4638
|
+
get expanded() {
|
|
4639
|
+
return expanded();
|
|
4640
|
+
},
|
|
4641
|
+
get active() {
|
|
4642
|
+
return active();
|
|
4643
|
+
},
|
|
4644
|
+
get pins() {
|
|
4645
|
+
return pins();
|
|
4646
|
+
},
|
|
4647
|
+
get position() {
|
|
4648
|
+
return props.config.position;
|
|
4649
|
+
},
|
|
4650
|
+
get author() {
|
|
4651
|
+
return props.config.author;
|
|
4652
|
+
},
|
|
4653
|
+
get showSettings() {
|
|
4654
|
+
return showSettings();
|
|
4655
|
+
},
|
|
4656
|
+
get outputFormat() {
|
|
4657
|
+
return outputFormat();
|
|
4658
|
+
},
|
|
4659
|
+
get clearOnSend() {
|
|
4660
|
+
return clearOnSend();
|
|
4661
|
+
},
|
|
4662
|
+
get blockInteractions() {
|
|
4663
|
+
return blockInteractions();
|
|
4664
|
+
},
|
|
4665
|
+
get autoSubmit() {
|
|
4666
|
+
return autoSubmit();
|
|
4667
|
+
},
|
|
4668
|
+
get webhookUrl() {
|
|
4669
|
+
return props.config.webhookUrl;
|
|
4670
|
+
},
|
|
4671
|
+
get compactPopup() {
|
|
4672
|
+
return compactPopup();
|
|
4673
|
+
},
|
|
4674
|
+
get mode() {
|
|
4675
|
+
return mode();
|
|
4676
|
+
},
|
|
4677
|
+
get drawTool() {
|
|
4678
|
+
return drawTool();
|
|
4679
|
+
},
|
|
4680
|
+
get drawColor() {
|
|
4681
|
+
return drawColor();
|
|
4682
|
+
},
|
|
4683
|
+
get drawLineWidth() {
|
|
4684
|
+
return drawLineWidth();
|
|
4685
|
+
},
|
|
4686
|
+
get drawStrokeCount() {
|
|
4687
|
+
return drawStrokes().length + textNotes().length;
|
|
4688
|
+
},
|
|
4689
|
+
get queue() {
|
|
4690
|
+
return queue();
|
|
4691
|
+
},
|
|
4692
|
+
get selectedPinIds() {
|
|
4693
|
+
return selectedPinIds();
|
|
4694
|
+
},
|
|
4695
|
+
onToggleExpand: () => {
|
|
4696
|
+
const willExpand = !expanded();
|
|
4697
|
+
setExpanded(willExpand);
|
|
4698
|
+
if (willExpand) {
|
|
4699
|
+
activateSelection();
|
|
4700
|
+
} else {
|
|
4701
|
+
deactivateSelection();
|
|
4702
|
+
setShowSettings(false);
|
|
4703
|
+
if (showPopup()) {
|
|
4704
|
+
closePopup();
|
|
4705
|
+
}
|
|
4706
|
+
}
|
|
4707
|
+
},
|
|
4708
|
+
onModeChange: handleModeChange,
|
|
4709
|
+
onSend: sendPins,
|
|
4710
|
+
onCopy: copyPins,
|
|
4711
|
+
onClear: clearPins,
|
|
4712
|
+
onRemovePin: removePin,
|
|
4713
|
+
onEditPin: openEditPopup,
|
|
4714
|
+
onToggleSettings: () => setShowSettings(!showSettings()),
|
|
4715
|
+
onOutputFormatChange: setOutputFormat,
|
|
4716
|
+
onClearOnSendChange: setClearOnSend,
|
|
4717
|
+
onBlockInteractionsChange: setBlockInteractions,
|
|
4718
|
+
onAutoSubmitChange: setAutoSubmit,
|
|
4719
|
+
onCompactPopupChange: setCompactPopup,
|
|
4720
|
+
onDrawToolChange: setDrawTool,
|
|
4721
|
+
onDrawColorChange: setDrawColor,
|
|
4722
|
+
onDrawLineWidthChange: setDrawLineWidth,
|
|
4723
|
+
onDrawUndo: undoDrawStroke,
|
|
4724
|
+
onDrawClear: clearDrawing,
|
|
4725
|
+
onQueueAdd: () => addToQueue(),
|
|
4726
|
+
onQueueSend: sendQueue,
|
|
4727
|
+
onQueueClear: clearQueue,
|
|
4728
|
+
onSendSelected: sendSelected,
|
|
4729
|
+
onTogglePinSelect: togglePinSelect
|
|
4730
|
+
}), memo(() => memo(() => !!(showPopup() && selectedContext()))() && createComponent(PinPopup, {
|
|
4731
|
+
get context() {
|
|
4732
|
+
return selectedContext();
|
|
4733
|
+
},
|
|
4734
|
+
get initialComment() {
|
|
4735
|
+
return editingPin()?.comment;
|
|
4736
|
+
},
|
|
4737
|
+
get isEditing() {
|
|
4738
|
+
return !!editingPin();
|
|
4739
|
+
},
|
|
4740
|
+
get compactPopup() {
|
|
4741
|
+
return compactPopup();
|
|
4742
|
+
},
|
|
4743
|
+
get queueMode() {
|
|
4744
|
+
return mode() === "queue";
|
|
4745
|
+
},
|
|
4746
|
+
onAdd: (comment) => {
|
|
4747
|
+
if (editingPin()) {
|
|
4748
|
+
updatePin(comment);
|
|
4749
|
+
} else {
|
|
4750
|
+
addPin(selectedElement(), comment);
|
|
4751
|
+
}
|
|
4752
|
+
},
|
|
4753
|
+
onQueue: handleQueueFromPopup,
|
|
4754
|
+
onFixThis: handleFixThis,
|
|
4755
|
+
onCancel: () => closePopup()
|
|
4756
|
+
})), memo(() => memo(() => !!showTextInput())() && createComponent(TextInputPopup, {
|
|
4757
|
+
get x() {
|
|
4758
|
+
return textInputPos().x;
|
|
4759
|
+
},
|
|
4760
|
+
get y() {
|
|
4761
|
+
return textInputPos().y;
|
|
4762
|
+
},
|
|
4763
|
+
get color() {
|
|
4764
|
+
return drawColor();
|
|
4765
|
+
},
|
|
4766
|
+
onSubmit: handleTextSubmit,
|
|
4767
|
+
onCancel: () => setShowTextInput(false)
|
|
4768
|
+
})), memo(() => memo(() => !!(showContextMenu() && selectedElement()))() && createComponent(ContextMenu, {
|
|
4769
|
+
get position() {
|
|
4770
|
+
return contextMenuPos();
|
|
4771
|
+
},
|
|
4772
|
+
get element() {
|
|
4773
|
+
return selectedElement();
|
|
4774
|
+
},
|
|
4775
|
+
onClose: () => setShowContextMenu(false),
|
|
4776
|
+
onAnnotate: () => {
|
|
4777
|
+
setShowContextMenu(false);
|
|
4778
|
+
const el = selectedElement();
|
|
4779
|
+
const framework = detectFramework();
|
|
4780
|
+
const frameworkInfo = (() => {
|
|
4781
|
+
const info = framework.getComponentInfo(el);
|
|
4782
|
+
const source = framework.getSourceLocation(el);
|
|
4783
|
+
if (!info && !source) return void 0;
|
|
4784
|
+
return {
|
|
4785
|
+
framework: framework.name,
|
|
4786
|
+
componentPath: info?.name ? `<${info.name}>` : "",
|
|
4787
|
+
sourceFile: source?.file,
|
|
4788
|
+
frameworkVersion: void 0
|
|
4789
|
+
};
|
|
4790
|
+
})();
|
|
4791
|
+
setSelectedContext(buildElementContext(el, frameworkInfo));
|
|
4792
|
+
setShowPopup(true);
|
|
4793
|
+
picker.pause();
|
|
4794
|
+
},
|
|
4795
|
+
onCopyContext: async () => {
|
|
4796
|
+
const el = selectedElement();
|
|
4797
|
+
const context = buildElementContext(el);
|
|
4798
|
+
await navigator.clipboard.writeText(JSON.stringify(context, null, 2));
|
|
4799
|
+
setShowContextMenu(false);
|
|
4800
|
+
},
|
|
4801
|
+
onPrompt: () => {
|
|
4802
|
+
setShowContextMenu(false);
|
|
4803
|
+
setShowPrompt(true);
|
|
4804
|
+
}
|
|
4805
|
+
})), memo(() => memo(() => !!(showPrompt() && selectedElement()))() && createComponent(PromptMode, {
|
|
4806
|
+
get element() {
|
|
4807
|
+
return selectedElement();
|
|
4808
|
+
},
|
|
4809
|
+
onSend: async (instruction) => {
|
|
4810
|
+
try {
|
|
4811
|
+
const {
|
|
4812
|
+
sendToAgentChat
|
|
4813
|
+
} = await import("@agent-native/core/client");
|
|
4814
|
+
const context = buildElementContext(selectedElement());
|
|
4815
|
+
sendToAgentChat({
|
|
4816
|
+
message: instruction,
|
|
4817
|
+
context: JSON.stringify(context, null, 2),
|
|
4818
|
+
submit: autoSubmit()
|
|
4819
|
+
});
|
|
4820
|
+
} catch {
|
|
4821
|
+
}
|
|
4822
|
+
setShowPrompt(false);
|
|
4823
|
+
},
|
|
4824
|
+
onCancel: () => setShowPrompt(false)
|
|
4825
|
+
}))];
|
|
4826
|
+
};
|
|
4827
|
+
|
|
4828
|
+
// src/ui/mount.ts
|
|
4829
|
+
var CONTAINER_ID = "pinpoint-root";
|
|
4830
|
+
function mountPinpoint(config = {}, target = document.body) {
|
|
4831
|
+
const w = window;
|
|
4832
|
+
w.__pinpoint_instances = (w.__pinpoint_instances || 0) + 1;
|
|
4833
|
+
if (w.__pinpoint_instances > 1) {
|
|
4834
|
+
const existing = document.getElementById(CONTAINER_ID);
|
|
4835
|
+
if (existing) {
|
|
4836
|
+
existing.remove();
|
|
4837
|
+
}
|
|
4838
|
+
w.__pinpoint_instances = 1;
|
|
4839
|
+
}
|
|
4840
|
+
const container = document.createElement("div");
|
|
4841
|
+
container.id = CONTAINER_ID;
|
|
4842
|
+
container.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;z-index:2147483647;pointer-events:none;";
|
|
4843
|
+
target.appendChild(container);
|
|
4844
|
+
const shadowRoot = container.attachShadow({ mode: "open" });
|
|
4845
|
+
const sheet = new CSSStyleSheet();
|
|
4846
|
+
sheet.replaceSync(overlayStyles);
|
|
4847
|
+
shadowRoot.adoptedStyleSheets = [sheet];
|
|
4848
|
+
const theme = resolveColorScheme(config.colorScheme || "auto");
|
|
4849
|
+
if (theme === "light") {
|
|
4850
|
+
container.setAttribute("data-theme", "light");
|
|
4851
|
+
}
|
|
4852
|
+
const solidDispose = render(() => PinpointApp({ config }), shadowRoot);
|
|
4853
|
+
const dispose2 = () => {
|
|
4854
|
+
solidDispose();
|
|
4855
|
+
container.remove();
|
|
4856
|
+
w.__pinpoint_instances = Math.max(0, (w.__pinpoint_instances || 1) - 1);
|
|
4857
|
+
};
|
|
4858
|
+
if (import.meta.hot) {
|
|
4859
|
+
import.meta.hot.dispose(dispose2);
|
|
4860
|
+
}
|
|
4861
|
+
return { dispose: dispose2, shadowRoot, container };
|
|
4862
|
+
}
|
|
4863
|
+
function unmountPinpoint() {
|
|
4864
|
+
const container = document.getElementById(CONTAINER_ID);
|
|
4865
|
+
if (container) {
|
|
4866
|
+
container.remove();
|
|
4867
|
+
window.__pinpoint_instances = 0;
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
function resolveColorScheme(scheme) {
|
|
4871
|
+
if (scheme === "auto") {
|
|
4872
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
4873
|
+
}
|
|
4874
|
+
return scheme;
|
|
4875
|
+
}
|
|
4876
|
+
|
|
4877
|
+
export {
|
|
4878
|
+
MemoryStore,
|
|
4879
|
+
ElementInfoSchema,
|
|
4880
|
+
FrameworkInfoSchema,
|
|
4881
|
+
PinSchema,
|
|
4882
|
+
RestClient,
|
|
4883
|
+
ElementPicker,
|
|
4884
|
+
buildSelector,
|
|
4885
|
+
extractElementInfo,
|
|
4886
|
+
buildElementContext,
|
|
4887
|
+
DragSelect,
|
|
4888
|
+
TextSelect,
|
|
4889
|
+
registerAdapter,
|
|
4890
|
+
detectFramework,
|
|
4891
|
+
getComponentInfo,
|
|
4892
|
+
getSourceLocation,
|
|
4893
|
+
PinMarkerManager,
|
|
4894
|
+
mountPinpoint,
|
|
4895
|
+
unmountPinpoint
|
|
4896
|
+
};
|
|
4897
|
+
//# sourceMappingURL=chunk-5OW42OKO.js.map
|