@impakers/debug 1.4.8 → 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 -71
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +14 -71
- package/dist/react.mjs.map +1 -1
- package/package.json +2 -2
package/dist/react.js
CHANGED
|
@@ -1569,70 +1569,14 @@ function findNearestComponentSource(element, maxAncestors = 10) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
// src/utils/capture-element.ts
|
|
1572
|
-
var UNSUPPORTED_RE = /\b(?:oklab|oklch|color-mix|(?<![\w-])lab|(?<![\w-])lch)\s*\(/i;
|
|
1573
|
-
var COLOR_PROPS = [
|
|
1574
|
-
"color",
|
|
1575
|
-
"background-color",
|
|
1576
|
-
"background-image",
|
|
1577
|
-
"background",
|
|
1578
|
-
"border-color",
|
|
1579
|
-
"border-top-color",
|
|
1580
|
-
"border-right-color",
|
|
1581
|
-
"border-bottom-color",
|
|
1582
|
-
"border-left-color",
|
|
1583
|
-
"outline-color",
|
|
1584
|
-
"text-decoration-color",
|
|
1585
|
-
"box-shadow",
|
|
1586
|
-
"text-shadow",
|
|
1587
|
-
"caret-color",
|
|
1588
|
-
"column-rule-color",
|
|
1589
|
-
"fill",
|
|
1590
|
-
"stroke",
|
|
1591
|
-
"stop-color",
|
|
1592
|
-
"flood-color",
|
|
1593
|
-
"lighting-color"
|
|
1594
|
-
];
|
|
1595
|
-
function sanitizeUnsupportedColors(clonedDoc) {
|
|
1596
|
-
const allEls = clonedDoc.querySelectorAll("*");
|
|
1597
|
-
for (let i = 0; i < allEls.length; i++) {
|
|
1598
|
-
const el = allEls[i];
|
|
1599
|
-
if (!el.style) continue;
|
|
1600
|
-
let cs = null;
|
|
1601
|
-
for (const prop of COLOR_PROPS) {
|
|
1602
|
-
const inlineVal = el.style.getPropertyValue(prop);
|
|
1603
|
-
if (inlineVal && UNSUPPORTED_RE.test(inlineVal)) {
|
|
1604
|
-
el.style.setProperty(prop, getFallback(prop));
|
|
1605
|
-
continue;
|
|
1606
|
-
}
|
|
1607
|
-
if (!cs) {
|
|
1608
|
-
try {
|
|
1609
|
-
cs = clonedDoc.defaultView.getComputedStyle(el);
|
|
1610
|
-
} catch {
|
|
1611
|
-
break;
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
const val = cs.getPropertyValue(prop);
|
|
1615
|
-
if (val && UNSUPPORTED_RE.test(val)) {
|
|
1616
|
-
el.style.setProperty(prop, getFallback(prop));
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
function getFallback(prop) {
|
|
1622
|
-
if (prop === "background-image" || prop === "background") return "none";
|
|
1623
|
-
if (prop === "box-shadow" || prop === "text-shadow") return "none";
|
|
1624
|
-
if (prop === "color") return "inherit";
|
|
1625
|
-
return "transparent";
|
|
1626
|
-
}
|
|
1627
1572
|
async function captureElement(el, options = {}) {
|
|
1628
1573
|
const { quality = 0.7, maxScale = 2 } = options;
|
|
1629
|
-
const html2canvas = (await import("html2canvas")).default;
|
|
1574
|
+
const html2canvas = (await import("html2canvas-pro")).default;
|
|
1630
1575
|
const canvas = await html2canvas(el, {
|
|
1631
1576
|
useCORS: true,
|
|
1632
1577
|
allowTaint: true,
|
|
1633
1578
|
scale: Math.min(window.devicePixelRatio, maxScale),
|
|
1634
|
-
logging: false
|
|
1635
|
-
onclone: (clonedDoc) => sanitizeUnsupportedColors(clonedDoc)
|
|
1579
|
+
logging: false
|
|
1636
1580
|
});
|
|
1637
1581
|
return canvas.toDataURL("image/jpeg", quality);
|
|
1638
1582
|
}
|
|
@@ -1643,15 +1587,14 @@ async function captureFullPage(options = {}) {
|
|
|
1643
1587
|
const hiddenEls = document.querySelectorAll(allSelectors.join(", "));
|
|
1644
1588
|
try {
|
|
1645
1589
|
hiddenEls.forEach((el) => el.style.visibility = "hidden");
|
|
1646
|
-
const html2canvas = (await import("html2canvas")).default;
|
|
1590
|
+
const html2canvas = (await import("html2canvas-pro")).default;
|
|
1647
1591
|
const canvas = await html2canvas(document.body, {
|
|
1648
1592
|
useCORS: true,
|
|
1649
1593
|
allowTaint: true,
|
|
1650
1594
|
scale: 1,
|
|
1651
1595
|
logging: false,
|
|
1652
1596
|
width: window.innerWidth,
|
|
1653
|
-
height: window.innerHeight
|
|
1654
|
-
onclone: (clonedDoc) => sanitizeUnsupportedColors(clonedDoc)
|
|
1597
|
+
height: window.innerHeight
|
|
1655
1598
|
});
|
|
1656
1599
|
return canvas.toDataURL("image/jpeg", quality);
|
|
1657
1600
|
} catch {
|
|
@@ -3938,10 +3881,10 @@ function DebugWidget({ endpoint, getUser, onHide }) {
|
|
|
3938
3881
|
if (routeMatch?.context) {
|
|
3939
3882
|
metadata.routeDebug = routeMatch.context;
|
|
3940
3883
|
}
|
|
3941
|
-
const
|
|
3884
|
+
const debugParts = [];
|
|
3942
3885
|
if (debugTargets.length > 0) {
|
|
3943
|
-
|
|
3944
|
-
"
|
|
3886
|
+
debugParts.push(
|
|
3887
|
+
"**\uB514\uBC84\uAE45 \uD0C0\uAC9F \uD30C\uC77C**:",
|
|
3945
3888
|
...debugTargets.map((target) => {
|
|
3946
3889
|
const suffix = target.line ? `:${target.line}${typeof target.column === "number" ? `:${target.column}` : ""}` : "";
|
|
3947
3890
|
return `- [${target.kind}] \`${target.file}${suffix}\` (${target.reason})`;
|
|
@@ -3976,29 +3919,29 @@ function DebugWidget({ endpoint, getUser, onHide }) {
|
|
|
3976
3919
|
elementInfo.push(`**\uC811\uADFC\uC131**: ${pendingAnnotation.accessibility}`);
|
|
3977
3920
|
}
|
|
3978
3921
|
if (elementInfo.length > 0) {
|
|
3979
|
-
|
|
3980
|
-
|
|
3922
|
+
debugParts.push(`
|
|
3981
3923
|
---
|
|
3982
3924
|
${elementInfo.join("\n")}`);
|
|
3983
3925
|
}
|
|
3984
3926
|
if (metadata.consoleErrors?.length) {
|
|
3985
|
-
|
|
3927
|
+
debugParts.push(`
|
|
3986
3928
|
**\uCD5C\uADFC \uCF58\uC194 \uC5D0\uB7EC**:`);
|
|
3987
|
-
metadata.consoleErrors.slice(-10).forEach((e) =>
|
|
3929
|
+
metadata.consoleErrors.slice(-10).forEach((e) => debugParts.push(`- \`${e.slice(0, 200)}\``));
|
|
3988
3930
|
}
|
|
3989
3931
|
if (metadata.consoleLogs?.length) {
|
|
3990
3932
|
const recentLogs = metadata.consoleLogs.filter((l) => l.level === "error" || l.level === "warn").slice(-10);
|
|
3991
3933
|
if (recentLogs.length > 0) {
|
|
3992
|
-
|
|
3934
|
+
debugParts.push(`
|
|
3993
3935
|
**\uCD5C\uADFC \uCF58\uC194 \uB85C\uADF8**:`);
|
|
3994
|
-
recentLogs.forEach((l) =>
|
|
3936
|
+
recentLogs.forEach((l) => debugParts.push(`- [${l.level}] \`${l.message.slice(0, 200)}\``));
|
|
3995
3937
|
}
|
|
3996
3938
|
}
|
|
3997
3939
|
const result = await submitFeedback(endpoint, {
|
|
3998
3940
|
title: comment.slice(0, 100),
|
|
3999
|
-
description:
|
|
3941
|
+
description: comment,
|
|
4000
3942
|
priority: "medium",
|
|
4001
3943
|
metadata,
|
|
3944
|
+
debugInfo: debugParts.length > 0 ? debugParts.join("\n") : void 0,
|
|
4002
3945
|
screenshot,
|
|
4003
3946
|
feedbackUrl: window.location.pathname,
|
|
4004
3947
|
feedbackMarker: {
|