@rose42/t3-feedback 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +516 -0
- package/dist/bridge/attachments.d.ts +27 -0
- package/dist/bridge/attachments.js +109 -0
- package/dist/bridge/format.d.ts +70 -0
- package/dist/bridge/format.js +358 -0
- package/dist/bridge/http.d.ts +31 -0
- package/dist/bridge/http.js +169 -0
- package/dist/bridge/index.d.ts +13 -0
- package/dist/bridge/index.js +12 -0
- package/dist/bridge/parse.d.ts +16 -0
- package/dist/bridge/parse.js +82 -0
- package/dist/bridge/paths.d.ts +10 -0
- package/dist/bridge/paths.js +10 -0
- package/dist/bridge/probeThreads.d.ts +13 -0
- package/dist/bridge/probeThreads.js +66 -0
- package/dist/bridge/readSource.d.ts +8 -0
- package/dist/bridge/readSource.js +64 -0
- package/dist/bridge/sendFeedback.d.ts +99 -0
- package/dist/bridge/sendFeedback.js +417 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +40 -0
- package/dist/cli/constants.d.ts +4 -0
- package/dist/cli/constants.js +4 -0
- package/dist/cli/detect.d.ts +17 -0
- package/dist/cli/detect.js +118 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/init.d.ts +18 -0
- package/dist/cli/init.js +165 -0
- package/dist/cli/pm.d.ts +12 -0
- package/dist/cli/pm.js +49 -0
- package/dist/cli/prompt.d.ts +2 -0
- package/dist/cli/prompt.js +19 -0
- package/dist/cli/wire/next.d.ts +8 -0
- package/dist/cli/wire/next.js +71 -0
- package/dist/cli/wire/node.d.ts +3 -0
- package/dist/cli/wire/node.js +76 -0
- package/dist/cli/wire/vite.d.ts +25 -0
- package/dist/cli/wire/vite.js +71 -0
- package/dist/client/activeThreads.d.ts +23 -0
- package/dist/client/activeThreads.js +89 -0
- package/dist/client/cropScreenshot.d.ts +39 -0
- package/dist/client/cropScreenshot.js +212 -0
- package/dist/client/customPlugins.d.ts +7 -0
- package/dist/client/customPlugins.js +38 -0
- package/dist/client/draft.d.ts +33 -0
- package/dist/client/draft.js +222 -0
- package/dist/client/index.d.ts +24 -0
- package/dist/client/index.js +20 -0
- package/dist/client/mount.d.ts +210 -0
- package/dist/client/mount.js +2408 -0
- package/dist/client/openInT3.d.ts +28 -0
- package/dist/client/openInT3.js +81 -0
- package/dist/client/readClipboardImage.d.ts +2 -0
- package/dist/client/readClipboardImage.js +2 -0
- package/dist/client/reportType.d.ts +43 -0
- package/dist/client/reportType.js +110 -0
- package/dist/client/selectBurstFrames.d.ts +21 -0
- package/dist/client/selectBurstFrames.js +101 -0
- package/dist/client/sessionThread.d.ts +26 -0
- package/dist/client/sessionThread.js +93 -0
- package/dist/client/threadPicker.d.ts +20 -0
- package/dist/client/threadPicker.js +51 -0
- package/dist/client/transport.d.ts +11 -0
- package/dist/client/transport.js +35 -0
- package/dist/client/ui/commentPanelPlugin.d.ts +46 -0
- package/dist/client/ui/commentPanelPlugin.js +126 -0
- package/dist/client/ui/defaultPlugins.d.ts +19 -0
- package/dist/client/ui/defaultPlugins.js +48 -0
- package/dist/client/ui/elementTargetChip.d.ts +64 -0
- package/dist/client/ui/elementTargetChip.js +185 -0
- package/dist/client/ui/elementTargetPanelPlugin.d.ts +43 -0
- package/dist/client/ui/elementTargetPanelPlugin.js +167 -0
- package/dist/client/ui/elementTargetPanelSession.d.ts +49 -0
- package/dist/client/ui/elementTargetPanelSession.js +279 -0
- package/dist/client/ui/elementTargetUi.d.ts +36 -0
- package/dist/client/ui/elementTargetUi.js +105 -0
- package/dist/client/ui/host.d.ts +112 -0
- package/dist/client/ui/host.js +132 -0
- package/dist/client/ui/html.d.ts +22 -0
- package/dist/client/ui/html.js +26 -0
- package/dist/client/ui/labeledPluginPreview.d.ts +8 -0
- package/dist/client/ui/labeledPluginPreview.js +71 -0
- package/dist/client/ui/resolveContributions.d.ts +13 -0
- package/dist/client/ui/resolveContributions.js +20 -0
- package/dist/client/ui/screenshotPanelPlugin.d.ts +39 -0
- package/dist/client/ui/screenshotPanelPlugin.js +212 -0
- package/dist/client/ui/screenshotPanelSession.d.ts +84 -0
- package/dist/client/ui/screenshotPanelSession.js +445 -0
- package/dist/client/ui/screenshotUi.d.ts +31 -0
- package/dist/client/ui/screenshotUi.js +130 -0
- package/dist/client/ui/shortcuts.d.ts +32 -0
- package/dist/client/ui/shortcuts.js +40 -0
- package/dist/client/ui/slots.d.ts +73 -0
- package/dist/client/ui/slots.js +112 -0
- package/dist/controls.d.ts +8 -0
- package/dist/controls.js +16 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/plugin.d.ts +9 -0
- package/dist/plugin.js +186 -0
- package/dist/types.d.ts +464 -0
- package/dist/types.js +283 -0
- package/docs/devcontainer.md +160 -0
- package/package.json +107 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seamless Open-in-T3 handoff from `GET/POST /__t3-feedback/open`.
|
|
3
|
+
* Open `pairUrl` first (auto-pairs), then navigate to `threadUrl`.
|
|
4
|
+
*/
|
|
5
|
+
export type T3FeedbackOpenHandoff = {
|
|
6
|
+
pairUrl: string;
|
|
7
|
+
threadUrl: string;
|
|
8
|
+
environmentId: string;
|
|
9
|
+
};
|
|
10
|
+
/** Result returned by the Vite middleware after a successful T3 turn. */
|
|
11
|
+
export type FeedbackSendResult = {
|
|
12
|
+
threadId: string;
|
|
13
|
+
threadTitle: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
/** T3 environment id for deep links (`/$environmentId/$threadId`). */
|
|
16
|
+
environmentId?: string;
|
|
17
|
+
/** Human label from `/.well-known/t3/environment` (helps spot wrong-server wiring). */
|
|
18
|
+
environmentLabel?: string;
|
|
19
|
+
sequence: number;
|
|
20
|
+
openUrl: string;
|
|
21
|
+
};
|
|
22
|
+
/** Live / inferred agent activity for a feedback thread. */
|
|
23
|
+
export type ThreadProbeState = "working" | "settled" | "unknown";
|
|
24
|
+
export type ThreadProbeResult = {
|
|
25
|
+
threadId: string;
|
|
26
|
+
state: ThreadProbeState;
|
|
27
|
+
};
|
|
28
|
+
/** GET /__t3-feedback/threads?ids=… response body. */
|
|
29
|
+
export type ThreadsProbeResponse = {
|
|
30
|
+
threads: ThreadProbeResult[];
|
|
31
|
+
};
|
|
32
|
+
/** One project thread from GET /__t3-feedback/threads (no `ids`). */
|
|
33
|
+
export type ThreadListItem = {
|
|
34
|
+
threadId: string;
|
|
35
|
+
title: string;
|
|
36
|
+
state: ThreadProbeState;
|
|
37
|
+
/** ISO timestamp from the shell snapshot when present. */
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
};
|
|
40
|
+
/** GET /__t3-feedback/threads (no `ids`) response body. */
|
|
41
|
+
export type ThreadsListResponse = {
|
|
42
|
+
threads: ThreadListItem[];
|
|
43
|
+
};
|
|
44
|
+
/** Per-thread result from POST /__t3-feedback/settle. */
|
|
45
|
+
export type ThreadSettleResult = {
|
|
46
|
+
threadId: string;
|
|
47
|
+
/** True when settle dispatched, or the thread was already gone from the shell. */
|
|
48
|
+
ok: boolean;
|
|
49
|
+
/** Thread missing from the shell snapshot (treated as already settled). */
|
|
50
|
+
skipped?: boolean;
|
|
51
|
+
error?: string;
|
|
52
|
+
};
|
|
53
|
+
/** POST /__t3-feedback/settle response body. */
|
|
54
|
+
export type ThreadsSettleResponse = {
|
|
55
|
+
threads: ThreadSettleResult[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* How the client reuses T3 threads across sends.
|
|
59
|
+
* - `"ask"`: New vs Continue control; soft-defaults to Continue when same route /
|
|
60
|
+
* report type within a short TTL (default)
|
|
61
|
+
* - `"session-route"`: always reuse while `sessionStorage` + pathname match
|
|
62
|
+
* - `"never"`: new thread every send
|
|
63
|
+
*/
|
|
64
|
+
export type T3FeedbackThreadReuse = "ask" | "session-route" | "never";
|
|
65
|
+
/** When the floating ✎ button is shown. Keyboard shortcut always works. */
|
|
66
|
+
export type T3FeedbackFabVisibility = "mobile" | "always" | "never";
|
|
67
|
+
/** Fixed offsets from the viewport edges (px numbers or CSS lengths). */
|
|
68
|
+
export type T3FeedbackFabPosition = {
|
|
69
|
+
top?: number | string;
|
|
70
|
+
right?: number | string;
|
|
71
|
+
bottom?: number | string;
|
|
72
|
+
left?: number | string;
|
|
73
|
+
};
|
|
74
|
+
/** Floating action button appearance for the injected / mounted client. */
|
|
75
|
+
export type T3FeedbackFabOptions = {
|
|
76
|
+
/**
|
|
77
|
+
* Default: `"mobile"` — show only at or below `mobileMaxWidth`.
|
|
78
|
+
* `"always"` — all viewports; `"never"` — omit the button (shortcut still works).
|
|
79
|
+
*/
|
|
80
|
+
visibility?: T3FeedbackFabVisibility;
|
|
81
|
+
/**
|
|
82
|
+
* Max viewport width (px) treated as mobile when `visibility` is `"mobile"`.
|
|
83
|
+
* Default: `719`.
|
|
84
|
+
*/
|
|
85
|
+
mobileMaxWidth?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Edge offsets. Default: `{ right: 16, bottom: 16 }`.
|
|
88
|
+
* Only provided edges are applied (e.g. `{ top: 12, left: 12 }` pins top-left).
|
|
89
|
+
*/
|
|
90
|
+
position?: T3FeedbackFabPosition;
|
|
91
|
+
/** FAB diameter (px number or CSS length). Default: `44`. */
|
|
92
|
+
size?: number | string;
|
|
93
|
+
};
|
|
94
|
+
/** Resolved FAB options embedded in the client config. */
|
|
95
|
+
export type T3FeedbackFabConfig = {
|
|
96
|
+
visibility: T3FeedbackFabVisibility;
|
|
97
|
+
mobileMaxWidth: number;
|
|
98
|
+
position: T3FeedbackFabPosition;
|
|
99
|
+
size: number | string;
|
|
100
|
+
};
|
|
101
|
+
export declare const DEFAULT_FAB_CONFIG: T3FeedbackFabConfig;
|
|
102
|
+
export declare function resolveFabConfig(fab?: T3FeedbackFabOptions): T3FeedbackFabConfig;
|
|
103
|
+
/** Built-in emoji glyphs for Bug / Feedback / Suggestion when using `"emoji"` or a partial map. */
|
|
104
|
+
export declare const DEFAULT_REPORT_TYPE_EMOJIS: {
|
|
105
|
+
readonly bug: "🐛";
|
|
106
|
+
readonly feedback: "💬";
|
|
107
|
+
readonly suggestion: "💡";
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Custom emoji (or other short glyph) per report type.
|
|
111
|
+
* Prefer UI labels (`Bug` / `Feedback` / `Suggestion`); lowercase keys also work.
|
|
112
|
+
* Omitted keys fall back to {@link DEFAULT_REPORT_TYPE_EMOJIS}.
|
|
113
|
+
*/
|
|
114
|
+
export type T3FeedbackReportTypeGlyphMap = {
|
|
115
|
+
Bug?: string;
|
|
116
|
+
Feedback?: string;
|
|
117
|
+
Suggestion?: string;
|
|
118
|
+
bug?: string;
|
|
119
|
+
feedback?: string;
|
|
120
|
+
suggestion?: string;
|
|
121
|
+
};
|
|
122
|
+
/** Normalized custom glyphs after {@link resolveReportTypeGlyph}. */
|
|
123
|
+
export type T3FeedbackReportTypeGlyphCustom = {
|
|
124
|
+
bug: string;
|
|
125
|
+
feedback: string;
|
|
126
|
+
suggestion: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* How report-type affordances (Bug / Feedback / Suggestion) are drawn in the overlay
|
|
130
|
+
* and prefixed on new T3 thread titles.
|
|
131
|
+
* - `"icon"` — SVG icons in the UI; textual titles (`Bug: …`)
|
|
132
|
+
* - `"emoji"` — built-in emojis in the UI and in new thread titles (`🐛: …`)
|
|
133
|
+
* - map — custom glyphs, e.g. `{ Bug: "🐛", Feedback: "💬", Suggestion: "💡" }`
|
|
134
|
+
*/
|
|
135
|
+
export type T3FeedbackReportTypeGlyph = "icon" | "emoji" | T3FeedbackReportTypeGlyphMap;
|
|
136
|
+
/** Value embedded in the client config / used when rendering glyphs. */
|
|
137
|
+
export type T3FeedbackReportTypeGlyphResolved = "icon" | "emoji" | T3FeedbackReportTypeGlyphCustom;
|
|
138
|
+
export declare const DEFAULT_REPORT_TYPE_GLYPH: T3FeedbackReportTypeGlyphResolved;
|
|
139
|
+
export declare function resolveReportTypeGlyph(value?: T3FeedbackReportTypeGlyph): T3FeedbackReportTypeGlyphResolved;
|
|
140
|
+
/**
|
|
141
|
+
* Keyboard chord that opens the feedback panel.
|
|
142
|
+
* When the whole `shortcut` option is omitted, defaults to Ctrl/⌘+Shift+F.
|
|
143
|
+
* When `shortcut` is set, omitted `mod` / `shift` / `alt` default to `false`.
|
|
144
|
+
*/
|
|
145
|
+
export type T3FeedbackShortcutOptions = {
|
|
146
|
+
/** Matched case-insensitively against `event.key`. Default: `"f"`. */
|
|
147
|
+
key?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Require Ctrl (Windows/Linux) or ⌘ (macOS) — `ctrlKey || metaKey`.
|
|
150
|
+
* Default when `shortcut` is set: `false`. Plugin-wide default chord uses `true`.
|
|
151
|
+
*/
|
|
152
|
+
mod?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Require Shift.
|
|
155
|
+
* Default when `shortcut` is set: `false`. Plugin-wide default chord uses `true`.
|
|
156
|
+
*/
|
|
157
|
+
shift?: boolean;
|
|
158
|
+
/** Require Alt/Option. Default: `false`. */
|
|
159
|
+
alt?: boolean;
|
|
160
|
+
};
|
|
161
|
+
/** Resolved shortcut embedded in the client config. */
|
|
162
|
+
export type T3FeedbackShortcutConfig = {
|
|
163
|
+
key: string;
|
|
164
|
+
mod: boolean;
|
|
165
|
+
shift: boolean;
|
|
166
|
+
alt: boolean;
|
|
167
|
+
};
|
|
168
|
+
export declare const DEFAULT_SHORTCUT: T3FeedbackShortcutConfig;
|
|
169
|
+
/** Default chord for element picking: Ctrl/⌘+Shift+E. */
|
|
170
|
+
export declare const DEFAULT_PICK_SHORTCUT: T3FeedbackShortcutConfig;
|
|
171
|
+
/** Default chord for Capture screenshot: Ctrl/⌘+Shift+S. */
|
|
172
|
+
export declare const DEFAULT_SCREENSHOT_SHORTCUT: T3FeedbackShortcutConfig;
|
|
173
|
+
/** Default chord for Record (frame burst): Ctrl/⌘+Shift+R. */
|
|
174
|
+
export declare const DEFAULT_RECORD_SHORTCUT: T3FeedbackShortcutConfig;
|
|
175
|
+
/** What to do after a successful element pick. */
|
|
176
|
+
export type T3FeedbackAfterPick = "none" | "capture" | "crop";
|
|
177
|
+
/**
|
|
178
|
+
* How Capture / Change-region attaches screenshots.
|
|
179
|
+
* - `"ui"` — attach full image, enable crop on thumbs (default); Capture focuses
|
|
180
|
+
* the new thumb's crop control so Enter opens the overlay (never auto-opens)
|
|
181
|
+
* - `"auto"` — silently crop to the picked element when present, else full image
|
|
182
|
+
* - `"none"` — always attach the full image (no crop UI)
|
|
183
|
+
*/
|
|
184
|
+
export type T3FeedbackScreenshotCrop = "ui" | "auto" | "none";
|
|
185
|
+
/** Element-pick behavior for the injected / mounted client. */
|
|
186
|
+
export type T3FeedbackPickOptions = {
|
|
187
|
+
/**
|
|
188
|
+
* Chord that starts element picking immediately.
|
|
189
|
+
* Default when omitted: Ctrl/⌘+Shift+E. Set `false` to disable.
|
|
190
|
+
* When set as an object, omitted modifiers default to `false` (same as `shortcut`).
|
|
191
|
+
*/
|
|
192
|
+
shortcut?: T3FeedbackShortcutOptions | false;
|
|
193
|
+
/**
|
|
194
|
+
* After a successful pick:
|
|
195
|
+
* - `"none"` — store the target only
|
|
196
|
+
* - `"capture"` — take a full-tab screenshot (no crop UI)
|
|
197
|
+
* - `"crop"` — take a screenshot and silently crop to the element (default)
|
|
198
|
+
*/
|
|
199
|
+
afterPick?: T3FeedbackAfterPick;
|
|
200
|
+
/** CSS-pixel padding around the element when `afterPick` is `"crop"`. Default: `12`. */
|
|
201
|
+
cropPaddingPx?: number;
|
|
202
|
+
/**
|
|
203
|
+
* Include truncated innerHTML on the picked target.
|
|
204
|
+
* Default: `false` (selector / role / text / bbox are usually enough).
|
|
205
|
+
* Sets the panel checkbox default; users can override per session in the UI.
|
|
206
|
+
*/
|
|
207
|
+
includeInnerHTML?: boolean;
|
|
208
|
+
/** Max characters for innerHTML when enabled (default: 500). */
|
|
209
|
+
maxInnerHTMLLength?: number;
|
|
210
|
+
/**
|
|
211
|
+
* Attach curated computed styles on the picked target.
|
|
212
|
+
* Default: `"none"`. `"layout"` = box/flex/grid; `"computed"` = layout + paint/type.
|
|
213
|
+
* Sets the panel select default; users can override per session in the UI.
|
|
214
|
+
*/
|
|
215
|
+
styles?: "none" | "layout" | "computed";
|
|
216
|
+
/**
|
|
217
|
+
* Framework adapter for component source enrichment.
|
|
218
|
+
* - `"auto"` (default): detect + try qwik/locator/next/react/vue/svelte
|
|
219
|
+
* - `"react"` | `"next"` | `"vue"` | `"svelte"` | `"qwik"` | `"locator"`: pin one adapter
|
|
220
|
+
* - `"none"`: DOM metadata only
|
|
221
|
+
*
|
|
222
|
+
* Custom function inject is not available here (config is JSON-serialized into
|
|
223
|
+
* the client). Use {@link mountT3Feedback} `pick.resolveSource` for that.
|
|
224
|
+
*/
|
|
225
|
+
sourceFramework?: "react" | "next" | "vue" | "svelte" | "qwik" | "locator" | "auto" | "none";
|
|
226
|
+
/**
|
|
227
|
+
* When a picked element resolves to a component file, make the path in the
|
|
228
|
+
* ELEMENT chip clickable to open it in the IDE.
|
|
229
|
+
*
|
|
230
|
+
* - omit / `true` — GET Vite's `/__open-in-editor?file=path:line:column`
|
|
231
|
+
* (set `LAUNCH_EDITOR=cursor` or `code` if auto-detect fails)
|
|
232
|
+
* - `false` — plain text path, no open action
|
|
233
|
+
* - `{ endpoint }` — same as Vite, but a custom path (still `?file=`)
|
|
234
|
+
* - `{ urlTemplate }` — navigate to a URL with `{file}`, `{line}`, `{column}`
|
|
235
|
+
* (e.g. `vscode://file/{file}:{line}:{column}`); wins over `endpoint`
|
|
236
|
+
*/
|
|
237
|
+
openInEditor?: boolean | T3FeedbackOpenInEditorOptions;
|
|
238
|
+
};
|
|
239
|
+
/** Custom open-in-editor behavior when not using the Vite default endpoint alone. */
|
|
240
|
+
export type T3FeedbackOpenInEditorOptions = {
|
|
241
|
+
/**
|
|
242
|
+
* GET endpoint that accepts `?file=path:line:column` (Vite-compatible).
|
|
243
|
+
* Default: `/__open-in-editor`. Ignored when `urlTemplate` is set.
|
|
244
|
+
*/
|
|
245
|
+
endpoint?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Browser navigation URL template. Placeholders: `{file}`, `{line}`, `{column}`.
|
|
248
|
+
* `{file}` is inserted raw (use absolute paths if your scheme requires them).
|
|
249
|
+
*/
|
|
250
|
+
urlTemplate?: string;
|
|
251
|
+
};
|
|
252
|
+
/** Screenshot / crop behavior for Capture and Change region. */
|
|
253
|
+
export type T3FeedbackScreenshotOptions = {
|
|
254
|
+
/**
|
|
255
|
+
* Chord that starts Capture screenshot (opens the panel if needed).
|
|
256
|
+
* Default when omitted: Ctrl/⌘+Shift+S. Set `false` to disable.
|
|
257
|
+
* When set as an object, omitted modifiers default to `false` (same as `shortcut`).
|
|
258
|
+
*/
|
|
259
|
+
shortcut?: T3FeedbackShortcutOptions | false;
|
|
260
|
+
/**
|
|
261
|
+
* Default: `"ui"`. See {@link T3FeedbackScreenshotCrop}.
|
|
262
|
+
*/
|
|
263
|
+
crop?: T3FeedbackScreenshotCrop;
|
|
264
|
+
/** CSS-pixel padding when `crop` is `"auto"`. Default: pick padding or `12`. */
|
|
265
|
+
cropPaddingPx?: number;
|
|
266
|
+
/**
|
|
267
|
+
* Max images per report (capture, paste, and burst share this budget).
|
|
268
|
+
* Default: 5, clamped to 1–10.
|
|
269
|
+
*/
|
|
270
|
+
maxImages?: number;
|
|
271
|
+
};
|
|
272
|
+
/** Frame-burst record behavior. */
|
|
273
|
+
export type T3FeedbackRecordOptions = {
|
|
274
|
+
/**
|
|
275
|
+
* Chord that starts recording immediately (opens the panel afterward).
|
|
276
|
+
* Default when omitted: Ctrl/⌘+Shift+R. Set `false` to disable.
|
|
277
|
+
* When set as an object, omitted modifiers default to `false` (same as `shortcut`).
|
|
278
|
+
*/
|
|
279
|
+
shortcut?: T3FeedbackShortcutOptions | false;
|
|
280
|
+
};
|
|
281
|
+
/** Resolved open-in-editor config (`null` = disabled). */
|
|
282
|
+
export type T3FeedbackOpenInEditorConfig = {
|
|
283
|
+
/** Vite-style GET endpoint; used when `urlTemplate` is absent. */
|
|
284
|
+
endpoint: string;
|
|
285
|
+
/** Optional navigation template; wins over `endpoint` when set. */
|
|
286
|
+
urlTemplate?: string;
|
|
287
|
+
};
|
|
288
|
+
/** Resolved pick options embedded in the client config. */
|
|
289
|
+
export type T3FeedbackPickConfig = {
|
|
290
|
+
/** `null` when pick shortcut is disabled. */
|
|
291
|
+
shortcut: T3FeedbackShortcutConfig | null;
|
|
292
|
+
afterPick: T3FeedbackAfterPick;
|
|
293
|
+
cropPaddingPx: number;
|
|
294
|
+
includeInnerHTML: boolean;
|
|
295
|
+
maxInnerHTMLLength: number;
|
|
296
|
+
styles: "none" | "layout" | "computed";
|
|
297
|
+
sourceFramework: "react" | "next" | "vue" | "svelte" | "qwik" | "locator" | "auto" | "none";
|
|
298
|
+
/** `null` when open-in-editor is disabled. */
|
|
299
|
+
openInEditor: T3FeedbackOpenInEditorConfig | null;
|
|
300
|
+
};
|
|
301
|
+
/** Default Vite DEV endpoint for opening a file in the editor. */
|
|
302
|
+
export declare const DEFAULT_OPEN_IN_EDITOR_ENDPOINT = "/__open-in-editor";
|
|
303
|
+
/** Resolved screenshot options embedded in the client config. */
|
|
304
|
+
export type T3FeedbackScreenshotConfig = {
|
|
305
|
+
/** `null` when capture shortcut is disabled. */
|
|
306
|
+
shortcut: T3FeedbackShortcutConfig | null;
|
|
307
|
+
crop: T3FeedbackScreenshotCrop;
|
|
308
|
+
cropPaddingPx: number;
|
|
309
|
+
maxImages: number;
|
|
310
|
+
};
|
|
311
|
+
/** Resolved record options embedded in the client config. */
|
|
312
|
+
export type T3FeedbackRecordConfig = {
|
|
313
|
+
/** `null` when record shortcut is disabled. */
|
|
314
|
+
shortcut: T3FeedbackShortcutConfig | null;
|
|
315
|
+
};
|
|
316
|
+
export declare function resolveOpenInEditorConfig(value?: boolean | T3FeedbackOpenInEditorOptions): T3FeedbackOpenInEditorConfig | null;
|
|
317
|
+
export declare function resolvePickConfig(pick?: T3FeedbackPickOptions): T3FeedbackPickConfig;
|
|
318
|
+
export declare function resolveScreenshotConfig(screenshot?: T3FeedbackScreenshotOptions, pickCropPaddingPx?: number): T3FeedbackScreenshotConfig;
|
|
319
|
+
export declare function resolveRecordConfig(record?: T3FeedbackRecordOptions): T3FeedbackRecordConfig;
|
|
320
|
+
/**
|
|
321
|
+
* Resolve plugin/mount shortcut options.
|
|
322
|
+
* - No `shortcut` / `shortcutKey`: Ctrl/⌘+Shift+F
|
|
323
|
+
* - `shortcut` object: omitted modifiers are `false`
|
|
324
|
+
* - Legacy `shortcutKey` only: same key with Ctrl/⌘+Shift
|
|
325
|
+
*/
|
|
326
|
+
export declare function resolveShortcut(shortcut?: T3FeedbackShortcutOptions, shortcutKey?: string): T3FeedbackShortcutConfig;
|
|
327
|
+
/** Human-readable chord label (e.g. `Ctrl/⌘+Shift+F` or `F (Ctrl/⌘+Shift+F in fields)`). */
|
|
328
|
+
export declare function formatShortcutLabel(shortcut: T3FeedbackShortcutConfig): string;
|
|
329
|
+
/** Whether `event` matches the resolved chord (modifiers must match exactly). */
|
|
330
|
+
export declare function matchesShortcut(event: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey" | "shiftKey" | "altKey">, shortcut: T3FeedbackShortcutConfig): boolean;
|
|
331
|
+
/** True when the chord requires at least one modifier (global; works while typing). */
|
|
332
|
+
export declare function shortcutRequiresModifier(shortcut: T3FeedbackShortcutConfig): boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Fixed escape hatch for bare-key shortcuts: same key with Ctrl/⌘+Shift
|
|
335
|
+
* (works in editable fields where the bare key is ignored).
|
|
336
|
+
*/
|
|
337
|
+
export declare function matchesBareKeyOverride(event: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey" | "shiftKey" | "altKey">, shortcut: T3FeedbackShortcutConfig): boolean;
|
|
338
|
+
/**
|
|
339
|
+
* True when `target` is an editable / typing surface where a bare key
|
|
340
|
+
* should insert text instead of opening feedback.
|
|
341
|
+
*/
|
|
342
|
+
export declare function isEditableKeyboardTarget(target: EventTarget | null): boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Whether this keydown should open feedback.
|
|
345
|
+
* - Configured modified chords: exact match anywhere (including inputs).
|
|
346
|
+
* - Bare-key shortcuts: bare key outside editable fields, plus Ctrl/⌘+Shift+key
|
|
347
|
+
* anywhere as a global override while typing.
|
|
348
|
+
*/
|
|
349
|
+
export declare function shouldOpenFromShortcut(event: Pick<KeyboardEvent, "key" | "ctrlKey" | "metaKey" | "shiftKey" | "altKey" | "target">, shortcut: T3FeedbackShortcutConfig): boolean;
|
|
350
|
+
/** Built-in capture plugins selectable via `activePlugins`. Comment is always on. */
|
|
351
|
+
export declare const T3_BUILTIN_PLUGIN_IDS: readonly ["pageContext", "consoleLogs", "screenshot", "elementTarget"];
|
|
352
|
+
export type T3BuiltinPluginId = (typeof T3_BUILTIN_PLUGIN_IDS)[number];
|
|
353
|
+
/** Per-built-in options (serializable; embedded in the client config). */
|
|
354
|
+
export type T3FeedbackBuiltinPluginOptions = {
|
|
355
|
+
consoleLogs?: {
|
|
356
|
+
/** Ring-buffer size for console capture. Default: `200`. */
|
|
357
|
+
maxEntries?: number;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Resolve which built-ins are active.
|
|
362
|
+
* - `active` omitted → all four (today’s defaults)
|
|
363
|
+
* - explicit list → only those ids (unknown strings ignored)
|
|
364
|
+
* - `includeConsoleLogs: false` strips `consoleLogs` (deprecated alias)
|
|
365
|
+
*/
|
|
366
|
+
export declare function resolveActivePlugins(active?: readonly T3BuiltinPluginId[], includeConsoleLogs?: boolean): Set<T3BuiltinPluginId>;
|
|
367
|
+
/** Stable ordered list of active built-in ids (for JSON client config). */
|
|
368
|
+
export declare function resolveActivePluginList(active?: readonly T3BuiltinPluginId[], includeConsoleLogs?: boolean): T3BuiltinPluginId[];
|
|
369
|
+
/** Options for `t3FeedbackPlugin` (Node / Vite config). */
|
|
370
|
+
export type T3FeedbackPluginOptions = {
|
|
371
|
+
/** T3 HTTP origin. Default: http://localhost:3773 (override via T3_FEEDBACK_ORIGIN). */
|
|
372
|
+
origin?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Browser-facing origin for Open-in-T3 links. Default: same as `origin`.
|
|
375
|
+
* Set this (or `T3_FEEDBACK_OPEN_ORIGIN`) when the host browser must use a
|
|
376
|
+
* different URL than Node (e.g. `http://localhost:3774` while the bridge uses
|
|
377
|
+
* an in-container hostname). Do **not** point this at another container's T3.
|
|
378
|
+
*/
|
|
379
|
+
openOrigin?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Optional prefix for newly created thread titles
|
|
382
|
+
* (e.g. `"Checkout"` → `"Checkout: /pay · broken CTA"`).
|
|
383
|
+
* Titles are derived per send; this is not a sticky reuse key.
|
|
384
|
+
*/
|
|
385
|
+
threadTitle?: string;
|
|
386
|
+
/**
|
|
387
|
+
* How the injected client reuses threads across sends.
|
|
388
|
+
* Default: `"ask"` — New vs Continue in the panel (soft-default Continue when
|
|
389
|
+
* same pathname + report type within TTL).
|
|
390
|
+
* `"session-route"` — always reuse while on the same pathname.
|
|
391
|
+
* `"never"` — new thread every send.
|
|
392
|
+
*/
|
|
393
|
+
threadReuse?: T3FeedbackThreadReuse;
|
|
394
|
+
/** Prefer matching this workspace root when picking a T3 project. */
|
|
395
|
+
workspaceRootHints?: string[];
|
|
396
|
+
/**
|
|
397
|
+
* Full keyboard chord (key + modifiers). Default when omitted: Ctrl/⌘+Shift+F.
|
|
398
|
+
* When set, omitted modifiers are false — e.g. `{ key: "f" }` is bare F.
|
|
399
|
+
* Bare keys skip editable fields; Ctrl/⌘+Shift+key still opens while typing.
|
|
400
|
+
* Prefer this over `shortcutKey` when changing modifiers.
|
|
401
|
+
*/
|
|
402
|
+
shortcut?: T3FeedbackShortcutOptions;
|
|
403
|
+
/**
|
|
404
|
+
* @deprecated Use `shortcut: { key }` instead. Letter only; modifiers stay Ctrl/⌘+Shift.
|
|
405
|
+
*/
|
|
406
|
+
shortcutKey?: string;
|
|
407
|
+
/**
|
|
408
|
+
* When true (default), inject the feedback UI into the page via transformIndexHtml.
|
|
409
|
+
* Set false to mount manually via `@rose42/t3-feedback/client`.
|
|
410
|
+
*/
|
|
411
|
+
injectClient?: boolean;
|
|
412
|
+
/** Floating ✎ button visibility, position, and size (default: mobile-only). */
|
|
413
|
+
fab?: T3FeedbackFabOptions;
|
|
414
|
+
/**
|
|
415
|
+
* Report-type glyphs in the overlay and on new thread titles: SVG `"icon"`
|
|
416
|
+
* (default), `"emoji"`, or a custom map (`{ Bug: "🐛", Feedback: "💬", Suggestion: "💡" }`).
|
|
417
|
+
* `"emoji"` / map replace `Bug` / `Feedback` / `Suggestion` in new chat names.
|
|
418
|
+
*/
|
|
419
|
+
reportTypeGlyph?: T3FeedbackReportTypeGlyph;
|
|
420
|
+
/** Element pick shortcut + after-pick capture/crop behavior. */
|
|
421
|
+
pick?: T3FeedbackPickOptions;
|
|
422
|
+
/** Capture / Change-region crop behavior. */
|
|
423
|
+
screenshot?: T3FeedbackScreenshotOptions;
|
|
424
|
+
/** Frame-burst record shortcut. */
|
|
425
|
+
record?: T3FeedbackRecordOptions;
|
|
426
|
+
/**
|
|
427
|
+
* App version string included on bug/feedback reports (`envelope.version`).
|
|
428
|
+
* In DEV the client also attaches an HMR generation counter (`#n`).
|
|
429
|
+
*/
|
|
430
|
+
version?: string;
|
|
431
|
+
/**
|
|
432
|
+
* Which built-in capture plugins to enable.
|
|
433
|
+
* Omit = all four (`pageContext`, `consoleLogs`, `screenshot`, `elementTarget`).
|
|
434
|
+
* Explicit list = only those (comment is always collected for the panel).
|
|
435
|
+
*/
|
|
436
|
+
activePlugins?: T3BuiltinPluginId[];
|
|
437
|
+
/** Options for built-ins selected by `activePlugins`. */
|
|
438
|
+
pluginOptions?: T3FeedbackBuiltinPluginOptions;
|
|
439
|
+
/**
|
|
440
|
+
* Vite-resolved module ids/paths whose default export (or module namespace) is a
|
|
441
|
+
* `FeedbackCapturePlugin`, an array of them, or a factory returning the same.
|
|
442
|
+
* Loaded as imports in the injected virtual client (not JSON-serialized).
|
|
443
|
+
* Example: `["./src/dev/authFeedbackPlugin.ts"]`.
|
|
444
|
+
*/
|
|
445
|
+
customPlugins?: string[];
|
|
446
|
+
};
|
|
447
|
+
/** Serialized options embedded for the injected / auto-mounted client. */
|
|
448
|
+
export type T3FeedbackClientConfig = {
|
|
449
|
+
shortcut: T3FeedbackShortcutConfig;
|
|
450
|
+
endpoint: string;
|
|
451
|
+
fab: T3FeedbackFabConfig;
|
|
452
|
+
threadReuse: T3FeedbackThreadReuse;
|
|
453
|
+
pick: T3FeedbackPickConfig;
|
|
454
|
+
screenshot: T3FeedbackScreenshotConfig;
|
|
455
|
+
record: T3FeedbackRecordConfig;
|
|
456
|
+
/** Report-type UI glyphs: `"icon"` (default), `"emoji"`, or a resolved custom map. */
|
|
457
|
+
reportTypeGlyph: T3FeedbackReportTypeGlyphResolved;
|
|
458
|
+
/** App version for `envelope.version` (optional). */
|
|
459
|
+
version?: string;
|
|
460
|
+
/** Active built-in plugin ids (ordered). Omit / empty handled by {@link resolveActivePlugins}. */
|
|
461
|
+
activePlugins: T3BuiltinPluginId[];
|
|
462
|
+
/** Serializable built-in options (e.g. console ring size). */
|
|
463
|
+
pluginOptions?: T3FeedbackBuiltinPluginOptions;
|
|
464
|
+
};
|