uilint-react 0.2.1 → 0.2.4
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/DevTool.d.ts +11 -0
- package/dist/DevTool.d.ts.map +1 -0
- package/dist/ElementBadges-BNRIjtRW.js +672 -0
- package/dist/ElementBadges-BNRIjtRW.js.map +1 -0
- package/dist/VisionIssueBadge-C6vfwtec.js +154 -0
- package/dist/VisionIssueBadge-C6vfwtec.js.map +1 -0
- package/dist/components/Highlighter.d.ts +6 -0
- package/dist/components/Highlighter.d.ts.map +1 -0
- package/dist/components/ui-lint/ElementBadges.d.ts +6 -0
- package/dist/components/ui-lint/ElementBadges.d.ts.map +1 -0
- package/dist/components/ui-lint/InspectionPanel.d.ts +6 -0
- package/dist/components/ui-lint/InspectionPanel.d.ts.map +1 -0
- package/dist/components/ui-lint/LocatorOverlay.d.ts +14 -0
- package/dist/components/ui-lint/LocatorOverlay.d.ts.map +1 -0
- package/dist/components/ui-lint/RegionSelector.d.ts +18 -0
- package/dist/components/ui-lint/RegionSelector.d.ts.map +1 -0
- package/dist/components/ui-lint/ScanResultsPopover.d.ts +6 -0
- package/dist/components/ui-lint/ScanResultsPopover.d.ts.map +1 -0
- package/dist/components/ui-lint/ScreenshotViewer.d.ts +11 -0
- package/dist/components/ui-lint/ScreenshotViewer.d.ts.map +1 -0
- package/dist/components/ui-lint/UILintProvider.d.ts +11 -0
- package/dist/components/ui-lint/UILintProvider.d.ts.map +1 -0
- package/dist/components/ui-lint/VisionIssueBadge.d.ts +6 -0
- package/dist/components/ui-lint/VisionIssueBadge.d.ts.map +1 -0
- package/dist/components/ui-lint/VisionIssuesPanel.d.ts +12 -0
- package/dist/components/ui-lint/VisionIssuesPanel.d.ts.map +1 -0
- package/dist/components/ui-lint/badge-layout.d.ts +91 -0
- package/dist/components/ui-lint/badge-layout.d.ts.map +1 -0
- package/dist/components/ui-lint/code-formatting.d.ts +14 -0
- package/dist/components/ui-lint/code-formatting.d.ts.map +1 -0
- package/dist/components/ui-lint/dom-utils.d.ts +43 -0
- package/dist/components/ui-lint/dom-utils.d.ts.map +1 -0
- package/dist/components/ui-lint/index.d.ts +22 -0
- package/dist/components/ui-lint/index.d.ts.map +1 -0
- package/dist/components/ui-lint/inspection-panel-positioning.d.ts +41 -0
- package/dist/components/ui-lint/inspection-panel-positioning.d.ts.map +1 -0
- package/dist/components/ui-lint/portal-host.d.ts +3 -0
- package/dist/components/ui-lint/portal-host.d.ts.map +1 -0
- package/dist/components/ui-lint/scan-results/FileTree.d.ts +25 -0
- package/dist/components/ui-lint/scan-results/FileTree.d.ts.map +1 -0
- package/dist/components/ui-lint/scan-results/IssueRow.d.ts +16 -0
- package/dist/components/ui-lint/scan-results/IssueRow.d.ts.map +1 -0
- package/dist/components/ui-lint/scan-results/SearchFilter.d.ts +8 -0
- package/dist/components/ui-lint/scan-results/SearchFilter.d.ts.map +1 -0
- package/dist/components/ui-lint/source-fetcher.d.ts +40 -0
- package/dist/components/ui-lint/source-fetcher.d.ts.map +1 -0
- package/dist/components/ui-lint/store.d.ts +194 -0
- package/dist/components/ui-lint/store.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/TabbedToolbar.d.ts +2 -0
- package/dist/components/ui-lint/toolbar/TabbedToolbar.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/icons.d.ts +29 -0
- package/dist/components/ui-lint/toolbar/icons.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/index.d.ts +3 -0
- package/dist/components/ui-lint/toolbar/index.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/tabs/ConfigureTab.d.ts +2 -0
- package/dist/components/ui-lint/toolbar/tabs/ConfigureTab.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/tabs/ESLintTab.d.ts +2 -0
- package/dist/components/ui-lint/toolbar/tabs/ESLintTab.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/tabs/VisionTab.d.ts +2 -0
- package/dist/components/ui-lint/toolbar/tabs/VisionTab.d.ts.map +1 -0
- package/dist/components/ui-lint/toolbar/tokens.d.ts +45 -0
- package/dist/components/ui-lint/toolbar/tokens.d.ts.map +1 -0
- package/dist/components/ui-lint/types.d.ts +170 -0
- package/dist/components/ui-lint/types.d.ts.map +1 -0
- package/dist/components/ui-lint/useDOMObserver.d.ts +11 -0
- package/dist/components/ui-lint/useDOMObserver.d.ts.map +1 -0
- package/dist/components/ui-lint/visibility-utils.d.ts +41 -0
- package/dist/components/ui-lint/visibility-utils.d.ts.map +1 -0
- package/dist/consistency/highlights.d.ts +14 -0
- package/dist/consistency/highlights.d.ts.map +1 -0
- package/dist/consistency/index.d.ts +7 -0
- package/dist/consistency/index.d.ts.map +1 -0
- package/dist/consistency/snapshot.d.ts +14 -0
- package/dist/consistency/snapshot.d.ts.map +1 -0
- package/dist/consistency/types.d.ts +5 -0
- package/dist/consistency/types.d.ts.map +1 -0
- package/dist/devtools.d.ts +8 -0
- package/dist/devtools.d.ts.map +1 -0
- package/dist/devtools.js +259 -0
- package/dist/devtools.js.map +1 -0
- package/dist/environment-DVxa60C6.js +26 -0
- package/dist/environment-DVxa60C6.js.map +1 -0
- package/dist/index-BGzkrD0y.js +12304 -0
- package/dist/index-BGzkrD0y.js.map +1 -0
- package/dist/index-L3Zm-CoX.js +513 -0
- package/dist/index-L3Zm-CoX.js.map +1 -0
- package/dist/index.d.ts +13 -339
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -482
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +11 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/node.d.ts +7 -38
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +32 -79
- package/dist/node.js.map +1 -0
- package/dist/scanner/dom-scanner.d.ts +7 -0
- package/dist/scanner/dom-scanner.d.ts.map +1 -0
- package/dist/scanner/environment.d.ts +16 -0
- package/dist/scanner/environment.d.ts.map +1 -0
- package/dist/scanner/jsdom-adapter.d.ts +30 -0
- package/dist/scanner/jsdom-adapter.d.ts.map +1 -0
- package/dist/scanner/vision-capture.d.ts +131 -0
- package/dist/scanner/vision-capture.d.ts.map +1 -0
- package/dist/styles/inject-styles.d.ts +2 -0
- package/dist/styles/inject-styles.d.ts.map +1 -0
- package/dist/vision-capture-EIrYA_XF.js +216 -0
- package/dist/vision-capture-EIrYA_XF.js.map +1 -0
- package/dist/web-component.d.ts +2 -0
- package/dist/web-component.d.ts.map +1 -0
- package/package.json +36 -7
- package/dist/ElementBadges-2CTPMJ6L.js +0 -825
- package/dist/InspectionPanel-NXSE7CMH.js +0 -10
- package/dist/LocatorOverlay-3TKK74BD.js +0 -11
- package/dist/UILintToolbar-CLVXQHCZ.js +0 -10
- package/dist/chunk-552GIJIQ.js +0 -1109
- package/dist/chunk-K46BWHFU.js +0 -271
- package/dist/chunk-KKNPFLL2.js +0 -1853
- package/dist/chunk-S4IWHBOQ.js +0 -178
- package/dist/chunk-Z4AAGFIN.js +0 -933
package/dist/chunk-S4IWHBOQ.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/ui-lint/Badge.tsx
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
var BADGE_COLORS = {
|
|
6
|
-
success: "#68d391",
|
|
7
|
-
// Soft green
|
|
8
|
-
warning: "#f6ad55",
|
|
9
|
-
// Warm orange
|
|
10
|
-
error: "#ef4444"
|
|
11
|
-
// Red (for future use)
|
|
12
|
-
};
|
|
13
|
-
var FONT_MONO = `"SF Mono", Monaco, "Cascadia Code", monospace`;
|
|
14
|
-
function getBadgeTextColor(issueCount) {
|
|
15
|
-
if (issueCount === 0) return BADGE_COLORS.success;
|
|
16
|
-
return BADGE_COLORS.warning;
|
|
17
|
-
}
|
|
18
|
-
function getBadgeBackgroundColor(issueCount) {
|
|
19
|
-
const color = getBadgeTextColor(issueCount);
|
|
20
|
-
return `${color}20`;
|
|
21
|
-
}
|
|
22
|
-
var BADGE_STYLES = {
|
|
23
|
-
default: {
|
|
24
|
-
minWidth: "20px",
|
|
25
|
-
height: "20px",
|
|
26
|
-
padding: "0 6px",
|
|
27
|
-
borderRadius: "10px",
|
|
28
|
-
fontSize: "11px",
|
|
29
|
-
fontWeight: 600,
|
|
30
|
-
letterSpacing: "-0.02em"
|
|
31
|
-
},
|
|
32
|
-
small: {
|
|
33
|
-
minWidth: "18px",
|
|
34
|
-
height: "18px",
|
|
35
|
-
padding: "0 5px",
|
|
36
|
-
borderRadius: "9px",
|
|
37
|
-
fontSize: "10px",
|
|
38
|
-
fontWeight: 700,
|
|
39
|
-
letterSpacing: "0"
|
|
40
|
-
},
|
|
41
|
-
// For file row badges (slightly larger than small)
|
|
42
|
-
medium: {
|
|
43
|
-
minWidth: "22px",
|
|
44
|
-
height: "18px",
|
|
45
|
-
padding: "0 6px",
|
|
46
|
-
borderRadius: "9px",
|
|
47
|
-
fontSize: "10px",
|
|
48
|
-
fontWeight: 700,
|
|
49
|
-
letterSpacing: "0"
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
function Badge({
|
|
53
|
-
count,
|
|
54
|
-
size = "default",
|
|
55
|
-
backgroundColor,
|
|
56
|
-
color
|
|
57
|
-
}) {
|
|
58
|
-
const sizeStyles = BADGE_STYLES[size];
|
|
59
|
-
const bgColor = backgroundColor ?? getBadgeBackgroundColor(count);
|
|
60
|
-
const textColor = color ?? getBadgeTextColor(count);
|
|
61
|
-
return /* @__PURE__ */ jsx(
|
|
62
|
-
"span",
|
|
63
|
-
{
|
|
64
|
-
style: {
|
|
65
|
-
display: "inline-flex",
|
|
66
|
-
alignItems: "center",
|
|
67
|
-
justifyContent: "center",
|
|
68
|
-
...sizeStyles,
|
|
69
|
-
backgroundColor: bgColor,
|
|
70
|
-
color: textColor,
|
|
71
|
-
fontFamily: FONT_MONO
|
|
72
|
-
},
|
|
73
|
-
children: count
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// src/components/ui-lint/source-fetcher.ts
|
|
79
|
-
var sourceCache = /* @__PURE__ */ new Map();
|
|
80
|
-
var CACHE_TTL = 5 * 60 * 1e3;
|
|
81
|
-
var API_ENDPOINT = "/api/.uilint/source";
|
|
82
|
-
async function fetchSource(filePath) {
|
|
83
|
-
const cached = sourceCache.get(filePath);
|
|
84
|
-
if (cached && Date.now() - cached.fetchedAt < CACHE_TTL) {
|
|
85
|
-
return {
|
|
86
|
-
content: cached.content,
|
|
87
|
-
relativePath: cached.relativePath
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const response = await fetch(
|
|
92
|
-
`${API_ENDPOINT}?path=${encodeURIComponent(filePath)}`
|
|
93
|
-
);
|
|
94
|
-
if (!response.ok) {
|
|
95
|
-
console.warn(`[UILint] Failed to fetch source: ${response.statusText}`);
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
const data = await response.json();
|
|
99
|
-
sourceCache.set(filePath, {
|
|
100
|
-
...data,
|
|
101
|
-
fetchedAt: Date.now()
|
|
102
|
-
});
|
|
103
|
-
return data;
|
|
104
|
-
} catch (error) {
|
|
105
|
-
console.error("[UILint] Error fetching source:", error);
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function fetchSourceWithContext(source, contextLines = 5) {
|
|
110
|
-
const result = await fetchSource(source.fileName);
|
|
111
|
-
if (!result) return null;
|
|
112
|
-
const allLines = result.content.split("\n");
|
|
113
|
-
const targetLine = source.lineNumber - 1;
|
|
114
|
-
const startLine = Math.max(0, targetLine - contextLines);
|
|
115
|
-
const endLine = Math.min(allLines.length, targetLine + contextLines + 1);
|
|
116
|
-
return {
|
|
117
|
-
lines: allLines.slice(startLine, endLine),
|
|
118
|
-
startLine: startLine + 1,
|
|
119
|
-
// Back to 1-indexed
|
|
120
|
-
highlightLine: source.lineNumber,
|
|
121
|
-
relativePath: result.relativePath
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
async function fetchSourceWithWindow(source, window) {
|
|
125
|
-
const result = await fetchSource(source.fileName);
|
|
126
|
-
if (!result) return null;
|
|
127
|
-
const allLines = result.content.split("\n");
|
|
128
|
-
const targetLine = source.lineNumber - 1;
|
|
129
|
-
const startLine = Math.max(0, targetLine - Math.max(0, window.linesAbove));
|
|
130
|
-
const endLine = Math.min(
|
|
131
|
-
allLines.length,
|
|
132
|
-
targetLine + Math.max(0, window.linesBelow) + 1
|
|
133
|
-
);
|
|
134
|
-
return {
|
|
135
|
-
lines: allLines.slice(startLine, endLine),
|
|
136
|
-
startLine: startLine + 1,
|
|
137
|
-
// Back to 1-indexed
|
|
138
|
-
highlightLine: source.lineNumber,
|
|
139
|
-
relativePath: result.relativePath
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function clearSourceCache() {
|
|
143
|
-
sourceCache.clear();
|
|
144
|
-
}
|
|
145
|
-
function getCachedSource(filePath) {
|
|
146
|
-
const cached = sourceCache.get(filePath);
|
|
147
|
-
if (!cached) return null;
|
|
148
|
-
if (Date.now() - cached.fetchedAt >= CACHE_TTL) {
|
|
149
|
-
sourceCache.delete(filePath);
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
content: cached.content,
|
|
154
|
-
relativePath: cached.relativePath
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
async function prefetchSources(filePaths) {
|
|
158
|
-
const uniquePaths = [...new Set(filePaths)].filter((path) => {
|
|
159
|
-
const cached = sourceCache.get(path);
|
|
160
|
-
return !cached || Date.now() - cached.fetchedAt >= CACHE_TTL;
|
|
161
|
-
});
|
|
162
|
-
const BATCH_SIZE = 5;
|
|
163
|
-
for (let i = 0; i < uniquePaths.length; i += BATCH_SIZE) {
|
|
164
|
-
const batch = uniquePaths.slice(i, i + BATCH_SIZE);
|
|
165
|
-
await Promise.all(batch.map(fetchSource));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export {
|
|
170
|
-
BADGE_COLORS,
|
|
171
|
-
Badge,
|
|
172
|
-
fetchSource,
|
|
173
|
-
fetchSourceWithContext,
|
|
174
|
-
fetchSourceWithWindow,
|
|
175
|
-
clearSourceCache,
|
|
176
|
-
getCachedSource,
|
|
177
|
-
prefetchSources
|
|
178
|
-
};
|