uilint-react 0.1.33 → 0.1.35
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/{ElementBadges-TBAUB3KM.js → ElementBadges-M7WT4MWJ.js} +44 -4
- package/dist/{InspectionPanel-JNLWBL4D.js → InspectionPanel-Z2F7PDVS.js} +2 -2
- package/dist/{LocatorOverlay-6SAH7LN2.js → LocatorOverlay-YTDVYPJQ.js} +2 -2
- package/dist/{UILintToolbar-WNV5RS2L.js → UILintToolbar-WF5WHENS.js} +2 -2
- package/dist/{chunk-Z6PWYQGW.js → chunk-3YZH4UAT.js} +1 -1
- package/dist/{chunk-JBBUE3Y5.js → chunk-GKYWTCFU.js} +1 -1
- package/dist/{chunk-MO4NS6EG.js → chunk-I4JDR36K.js} +4 -4
- package/dist/{chunk-HTNIKCEM.js → chunk-IGVNY64A.js} +1 -1
- package/dist/index.js +4 -4
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
4
|
useUILintContext
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-I4JDR36K.js";
|
|
6
6
|
|
|
7
7
|
// src/components/ui-lint/ElementBadges.tsx
|
|
8
8
|
import React, { useState, useEffect, useCallback, useMemo } from "react";
|
|
@@ -167,6 +167,17 @@ function formatElementLabel(element) {
|
|
|
167
167
|
return componentName ? `${tag} > ${componentName}` : tag;
|
|
168
168
|
}
|
|
169
169
|
var NEARBY_THRESHOLD = 30;
|
|
170
|
+
function shouldShowBadge(issue, isAltKeyPressed) {
|
|
171
|
+
if (issue.status === "error") return true;
|
|
172
|
+
if (issue.status === "complete" && issue.issues.length > 0) return true;
|
|
173
|
+
if (issue.status === "complete" && issue.issues.length === 0) {
|
|
174
|
+
return isAltKeyPressed;
|
|
175
|
+
}
|
|
176
|
+
if (issue.status === "scanning" || issue.status === "pending") {
|
|
177
|
+
return isAltKeyPressed;
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
170
181
|
function BadgeAnimationStyles() {
|
|
171
182
|
return /* @__PURE__ */ jsx("style", { children: `
|
|
172
183
|
@keyframes uilint-badge-spin {
|
|
@@ -180,9 +191,33 @@ function ElementBadges() {
|
|
|
180
191
|
const [mounted, setMounted] = useState(false);
|
|
181
192
|
const [cursorPos, setCursorPos] = useState({ x: 0, y: 0 });
|
|
182
193
|
const [badgePositions, setBadgePositions] = useState([]);
|
|
194
|
+
const [isAltKeyPressed, setIsAltKeyPressed] = useState(false);
|
|
183
195
|
useEffect(() => {
|
|
184
196
|
setMounted(true);
|
|
185
197
|
}, []);
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
const handleKeyDown = (e) => {
|
|
200
|
+
if (e.altKey) {
|
|
201
|
+
setIsAltKeyPressed(true);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const handleKeyUp = (e) => {
|
|
205
|
+
if (!e.altKey) {
|
|
206
|
+
setIsAltKeyPressed(false);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const handleBlur = () => {
|
|
210
|
+
setIsAltKeyPressed(false);
|
|
211
|
+
};
|
|
212
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
213
|
+
window.addEventListener("keyup", handleKeyUp);
|
|
214
|
+
window.addEventListener("blur", handleBlur);
|
|
215
|
+
return () => {
|
|
216
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
217
|
+
window.removeEventListener("keyup", handleKeyUp);
|
|
218
|
+
window.removeEventListener("blur", handleBlur);
|
|
219
|
+
};
|
|
220
|
+
}, []);
|
|
186
221
|
useEffect(() => {
|
|
187
222
|
const handleMouseMove = (e) => {
|
|
188
223
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
@@ -236,17 +271,22 @@ function ElementBadges() {
|
|
|
236
271
|
() => BadgeLayoutBuilder.create(badgePositions).minDistance(24).repulsion(50).anchorStrength(0.3).iterations(50).compute(),
|
|
237
272
|
[badgePositions]
|
|
238
273
|
);
|
|
274
|
+
const visibleBadges = useMemo(() => {
|
|
275
|
+
return nudgedPositions.filter(
|
|
276
|
+
(pos) => shouldShowBadge(pos.issue, isAltKeyPressed)
|
|
277
|
+
);
|
|
278
|
+
}, [nudgedPositions, isAltKeyPressed]);
|
|
239
279
|
if (!mounted) return null;
|
|
240
280
|
if (autoScanState.status === "idle") return null;
|
|
241
281
|
const content = /* @__PURE__ */ jsxs("div", { "data-ui-lint": true, children: [
|
|
242
282
|
/* @__PURE__ */ jsx(BadgeAnimationStyles, {}),
|
|
243
|
-
|
|
283
|
+
visibleBadges.map((nudgedPos) => {
|
|
244
284
|
const distance = Math.hypot(
|
|
245
285
|
nudgedPos.nudgedX - cursorPos.x,
|
|
246
286
|
nudgedPos.nudgedY - cursorPos.y
|
|
247
287
|
);
|
|
248
288
|
const nearbyBadges = findNearbyBadges(
|
|
249
|
-
|
|
289
|
+
visibleBadges,
|
|
250
290
|
nudgedPos.nudgedX,
|
|
251
291
|
nudgedPos.nudgedY,
|
|
252
292
|
NEARBY_THRESHOLD
|
|
@@ -379,7 +419,7 @@ function NudgedBadge({
|
|
|
379
419
|
left: nudgedX - 9,
|
|
380
420
|
zIndex: isExpanded ? 99999 : 99995,
|
|
381
421
|
cursor: "pointer",
|
|
382
|
-
transition: "transform 0.1s ease-out
|
|
422
|
+
transition: "transform 0.1s ease-out",
|
|
383
423
|
transform: `scale(${scale})`,
|
|
384
424
|
transformOrigin: "center center"
|
|
385
425
|
},
|
|
@@ -1033,10 +1033,10 @@ function UILintUI() {
|
|
|
1033
1033
|
const [components, setComponents] = useState(null);
|
|
1034
1034
|
useEffect(() => {
|
|
1035
1035
|
Promise.all([
|
|
1036
|
-
import("./UILintToolbar-
|
|
1037
|
-
import("./InspectionPanel-
|
|
1038
|
-
import("./LocatorOverlay-
|
|
1039
|
-
import("./ElementBadges-
|
|
1036
|
+
import("./UILintToolbar-WF5WHENS.js"),
|
|
1037
|
+
import("./InspectionPanel-Z2F7PDVS.js"),
|
|
1038
|
+
import("./LocatorOverlay-YTDVYPJQ.js"),
|
|
1039
|
+
import("./ElementBadges-M7WT4MWJ.js")
|
|
1040
1040
|
]).then(([toolbar, panel, locator, badges]) => {
|
|
1041
1041
|
setComponents({
|
|
1042
1042
|
Toolbar: toolbar.UILintToolbar,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
UILintToolbar
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IGVNY64A.js";
|
|
5
5
|
import {
|
|
6
6
|
InspectionPanel,
|
|
7
7
|
clearSourceCache,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
fetchSourceWithContext,
|
|
10
10
|
getCachedSource,
|
|
11
11
|
prefetchSources
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GKYWTCFU.js";
|
|
13
13
|
import {
|
|
14
14
|
LocatorOverlay
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3YZH4UAT.js";
|
|
16
16
|
import {
|
|
17
17
|
DATA_UILINT_ID,
|
|
18
18
|
DEFAULT_SETTINGS,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
scanDOMForSources,
|
|
32
32
|
updateElementRects,
|
|
33
33
|
useUILintContext
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-I4JDR36K.js";
|
|
35
35
|
|
|
36
36
|
// src/consistency/snapshot.ts
|
|
37
37
|
var DATA_ELEMENTS_ATTR = "data-elements";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uilint-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"description": "React component for AI-powered UI consistency checking",
|
|
5
5
|
"author": "Peter Suggate",
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"node": ">=20.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"uilint-core": "^0.1.
|
|
37
|
+
"uilint-core": "^0.1.35",
|
|
38
38
|
"zustand": "^5.0.5"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|