glitchgrab 1.17.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.js +14 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,6 +146,18 @@ function FeedbackWidget() {
|
|
|
146
146
|
|
|
147
147
|
Note: `openReportDialog()` requires a `<ReportButton>` to be mounted somewhere in the component tree. It triggers the same modal with screenshot capture.
|
|
148
148
|
|
|
149
|
+
## Keyboard Shortcuts
|
|
150
|
+
|
|
151
|
+
Once `GlitchgrabProvider` is mounted, these shortcuts work globally:
|
|
152
|
+
|
|
153
|
+
| Shortcut | Action |
|
|
154
|
+
|----------|--------|
|
|
155
|
+
| `Cmd+Shift+G` / `Ctrl+Shift+G` | Open the report dialog |
|
|
156
|
+
| `Cmd+V` / `Ctrl+V` (dialog open) | Paste a screenshot from clipboard |
|
|
157
|
+
| `Escape` | Close the dialog |
|
|
158
|
+
|
|
159
|
+
No configuration needed — shortcuts are active as long as the provider is in the tree.
|
|
160
|
+
|
|
149
161
|
## Fetching Reports by User
|
|
150
162
|
|
|
151
163
|
### React hook (recommended)
|
package/dist/index.js
CHANGED
|
@@ -446,11 +446,15 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
446
446
|
function useIsDark() {
|
|
447
447
|
if (typeof window === "undefined") return true;
|
|
448
448
|
try {
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
449
|
+
for (const el of [document.body, document.documentElement]) {
|
|
450
|
+
const bg = getComputedStyle(el).backgroundColor;
|
|
451
|
+
const match = bg.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
|
|
452
|
+
if (match) {
|
|
453
|
+
const alpha = match[4] !== void 0 ? parseFloat(match[4]) : 1;
|
|
454
|
+
if (alpha < 0.05) continue;
|
|
455
|
+
const [r, g, b] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
456
|
+
return (r * 299 + g * 587 + b * 114) / 1e3 < 128;
|
|
457
|
+
}
|
|
454
458
|
}
|
|
455
459
|
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
456
460
|
} catch (e) {
|
|
@@ -1387,7 +1391,8 @@ function GlitchgrabProviderInner({
|
|
|
1387
1391
|
colno: String((_f = event.colno) != null ? _f : ""),
|
|
1388
1392
|
...(session == null ? void 0 : session.userId) ? { sessionUserId: session.userId } : {},
|
|
1389
1393
|
...(session == null ? void 0 : session.name) ? { sessionUserName: String(session.name) } : {},
|
|
1390
|
-
...(session == null ? void 0 : session.email) ? { sessionUserEmail: String(session.email) } : {}
|
|
1394
|
+
...(session == null ? void 0 : session.email) ? { sessionUserEmail: String(session.email) } : {},
|
|
1395
|
+
...(session == null ? void 0 : session.phone) ? { sessionUserPhone: String(session.phone) } : {}
|
|
1391
1396
|
}
|
|
1392
1397
|
};
|
|
1393
1398
|
sendReport(payload, baseUrl).then((result) => {
|
|
@@ -1426,7 +1431,8 @@ function GlitchgrabProviderInner({
|
|
|
1426
1431
|
type: "unhandledrejection",
|
|
1427
1432
|
...(session == null ? void 0 : session.userId) ? { sessionUserId: session.userId } : {},
|
|
1428
1433
|
...(session == null ? void 0 : session.name) ? { sessionUserName: String(session.name) } : {},
|
|
1429
|
-
...(session == null ? void 0 : session.email) ? { sessionUserEmail: String(session.email) } : {}
|
|
1434
|
+
...(session == null ? void 0 : session.email) ? { sessionUserEmail: String(session.email) } : {},
|
|
1435
|
+
...(session == null ? void 0 : session.phone) ? { sessionUserPhone: String(session.phone) } : {}
|
|
1430
1436
|
}
|
|
1431
1437
|
};
|
|
1432
1438
|
sendReport(payload, baseUrl).then((result) => {
|
|
@@ -1444,7 +1450,7 @@ function GlitchgrabProviderInner({
|
|
|
1444
1450
|
};
|
|
1445
1451
|
} catch (e) {
|
|
1446
1452
|
}
|
|
1447
|
-
}, [token, baseUrl, onError, onReportSent]);
|
|
1453
|
+
}, [token, baseUrl, onError, onReportSent, session]);
|
|
1448
1454
|
const report = (0, import_react2.useCallback)(
|
|
1449
1455
|
async (type, description, metadata) => {
|
|
1450
1456
|
var _a;
|