@impakers/debug 1.4.7 → 1.4.9
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/dist/react.js +14 -69
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +14 -69
- package/dist/react.mjs.map +1 -1
- package/package.json +2 -2
package/dist/react.mjs
CHANGED
|
@@ -1535,68 +1535,14 @@ function findNearestComponentSource(element, maxAncestors = 10) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
1537
|
// src/utils/capture-element.ts
|
|
1538
|
-
var UNSUPPORTED_RE = /oklab|oklch|color-mix/i;
|
|
1539
|
-
function sanitizeUnsupportedColors(clonedDoc) {
|
|
1540
|
-
try {
|
|
1541
|
-
for (let i = 0; i < clonedDoc.styleSheets.length; i++) {
|
|
1542
|
-
try {
|
|
1543
|
-
const sheet = clonedDoc.styleSheets[i];
|
|
1544
|
-
const rules = sheet.cssRules || sheet.rules;
|
|
1545
|
-
if (!rules) continue;
|
|
1546
|
-
sanitizeCSSRules(sheet, rules);
|
|
1547
|
-
} catch {
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
} catch {
|
|
1551
|
-
}
|
|
1552
|
-
clonedDoc.querySelectorAll("style").forEach((styleEl) => {
|
|
1553
|
-
const text = styleEl.textContent || "";
|
|
1554
|
-
if (UNSUPPORTED_RE.test(text)) {
|
|
1555
|
-
styleEl.textContent = text.replace(
|
|
1556
|
-
/[^{};\n]+:\s*[^;{}]*(?:oklab|oklch|color-mix|lch|lab)\([^)]*(?:\([^)]*\))*[^)]*\)[^;{}]*/gi,
|
|
1557
|
-
""
|
|
1558
|
-
);
|
|
1559
|
-
}
|
|
1560
|
-
});
|
|
1561
|
-
clonedDoc.querySelectorAll("*").forEach((el) => {
|
|
1562
|
-
const s = el.style;
|
|
1563
|
-
if (!s?.cssText) return;
|
|
1564
|
-
if (UNSUPPORTED_RE.test(s.cssText)) {
|
|
1565
|
-
s.cssText = s.cssText.replace(
|
|
1566
|
-
/[^;]*(?:oklab|oklch|color-mix|lch|lab)\([^)]*(?:\([^)]*\))*[^)]*\)[^;]*/gi,
|
|
1567
|
-
""
|
|
1568
|
-
);
|
|
1569
|
-
}
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1572
|
-
function sanitizeCSSRules(sheet, rules) {
|
|
1573
|
-
for (let j = rules.length - 1; j >= 0; j--) {
|
|
1574
|
-
const rule = rules[j];
|
|
1575
|
-
if ("cssRules" in rule && rule.cssRules) {
|
|
1576
|
-
sanitizeCSSRules(sheet, rule.cssRules);
|
|
1577
|
-
continue;
|
|
1578
|
-
}
|
|
1579
|
-
if (rule instanceof CSSStyleRule) {
|
|
1580
|
-
const style = rule.style;
|
|
1581
|
-
for (let k = style.length - 1; k >= 0; k--) {
|
|
1582
|
-
const prop = style[k];
|
|
1583
|
-
const val = style.getPropertyValue(prop);
|
|
1584
|
-
if (UNSUPPORTED_RE.test(val)) {
|
|
1585
|
-
style.setProperty(prop, "transparent");
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
1538
|
async function captureElement(el, options = {}) {
|
|
1592
1539
|
const { quality = 0.7, maxScale = 2 } = options;
|
|
1593
|
-
const html2canvas = (await import("html2canvas")).default;
|
|
1540
|
+
const html2canvas = (await import("html2canvas-pro")).default;
|
|
1594
1541
|
const canvas = await html2canvas(el, {
|
|
1595
1542
|
useCORS: true,
|
|
1596
1543
|
allowTaint: true,
|
|
1597
1544
|
scale: Math.min(window.devicePixelRatio, maxScale),
|
|
1598
|
-
logging: false
|
|
1599
|
-
onclone: (clonedDoc) => sanitizeUnsupportedColors(clonedDoc)
|
|
1545
|
+
logging: false
|
|
1600
1546
|
});
|
|
1601
1547
|
return canvas.toDataURL("image/jpeg", quality);
|
|
1602
1548
|
}
|
|
@@ -1607,15 +1553,14 @@ async function captureFullPage(options = {}) {
|
|
|
1607
1553
|
const hiddenEls = document.querySelectorAll(allSelectors.join(", "));
|
|
1608
1554
|
try {
|
|
1609
1555
|
hiddenEls.forEach((el) => el.style.visibility = "hidden");
|
|
1610
|
-
const html2canvas = (await import("html2canvas")).default;
|
|
1556
|
+
const html2canvas = (await import("html2canvas-pro")).default;
|
|
1611
1557
|
const canvas = await html2canvas(document.body, {
|
|
1612
1558
|
useCORS: true,
|
|
1613
1559
|
allowTaint: true,
|
|
1614
1560
|
scale: 1,
|
|
1615
1561
|
logging: false,
|
|
1616
1562
|
width: window.innerWidth,
|
|
1617
|
-
height: window.innerHeight
|
|
1618
|
-
onclone: (clonedDoc) => sanitizeUnsupportedColors(clonedDoc)
|
|
1563
|
+
height: window.innerHeight
|
|
1619
1564
|
});
|
|
1620
1565
|
return canvas.toDataURL("image/jpeg", quality);
|
|
1621
1566
|
} catch {
|
|
@@ -3902,10 +3847,10 @@ function DebugWidget({ endpoint, getUser, onHide }) {
|
|
|
3902
3847
|
if (routeMatch?.context) {
|
|
3903
3848
|
metadata.routeDebug = routeMatch.context;
|
|
3904
3849
|
}
|
|
3905
|
-
const
|
|
3850
|
+
const debugParts = [];
|
|
3906
3851
|
if (debugTargets.length > 0) {
|
|
3907
|
-
|
|
3908
|
-
"
|
|
3852
|
+
debugParts.push(
|
|
3853
|
+
"**\uB514\uBC84\uAE45 \uD0C0\uAC9F \uD30C\uC77C**:",
|
|
3909
3854
|
...debugTargets.map((target) => {
|
|
3910
3855
|
const suffix = target.line ? `:${target.line}${typeof target.column === "number" ? `:${target.column}` : ""}` : "";
|
|
3911
3856
|
return `- [${target.kind}] \`${target.file}${suffix}\` (${target.reason})`;
|
|
@@ -3940,29 +3885,29 @@ function DebugWidget({ endpoint, getUser, onHide }) {
|
|
|
3940
3885
|
elementInfo.push(`**\uC811\uADFC\uC131**: ${pendingAnnotation.accessibility}`);
|
|
3941
3886
|
}
|
|
3942
3887
|
if (elementInfo.length > 0) {
|
|
3943
|
-
|
|
3944
|
-
|
|
3888
|
+
debugParts.push(`
|
|
3945
3889
|
---
|
|
3946
3890
|
${elementInfo.join("\n")}`);
|
|
3947
3891
|
}
|
|
3948
3892
|
if (metadata.consoleErrors?.length) {
|
|
3949
|
-
|
|
3893
|
+
debugParts.push(`
|
|
3950
3894
|
**\uCD5C\uADFC \uCF58\uC194 \uC5D0\uB7EC**:`);
|
|
3951
|
-
metadata.consoleErrors.slice(-10).forEach((e) =>
|
|
3895
|
+
metadata.consoleErrors.slice(-10).forEach((e) => debugParts.push(`- \`${e.slice(0, 200)}\``));
|
|
3952
3896
|
}
|
|
3953
3897
|
if (metadata.consoleLogs?.length) {
|
|
3954
3898
|
const recentLogs = metadata.consoleLogs.filter((l) => l.level === "error" || l.level === "warn").slice(-10);
|
|
3955
3899
|
if (recentLogs.length > 0) {
|
|
3956
|
-
|
|
3900
|
+
debugParts.push(`
|
|
3957
3901
|
**\uCD5C\uADFC \uCF58\uC194 \uB85C\uADF8**:`);
|
|
3958
|
-
recentLogs.forEach((l) =>
|
|
3902
|
+
recentLogs.forEach((l) => debugParts.push(`- [${l.level}] \`${l.message.slice(0, 200)}\``));
|
|
3959
3903
|
}
|
|
3960
3904
|
}
|
|
3961
3905
|
const result = await submitFeedback(endpoint, {
|
|
3962
3906
|
title: comment.slice(0, 100),
|
|
3963
|
-
description:
|
|
3907
|
+
description: comment,
|
|
3964
3908
|
priority: "medium",
|
|
3965
3909
|
metadata,
|
|
3910
|
+
debugInfo: debugParts.length > 0 ? debugParts.join("\n") : void 0,
|
|
3966
3911
|
screenshot,
|
|
3967
3912
|
feedbackUrl: window.location.pathname,
|
|
3968
3913
|
feedbackMarker: {
|