uilint-react 0.1.35 → 0.1.38

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/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { AnalysisResult, ConsistencyResult, DOMSnapshot, ElementRole, ElementSna
7
7
  * Types for UILint Source Visualization
8
8
  */
9
9
  /**
10
- * Source location from React Fiber _debugSource
10
+ * Source location from data-loc attribute
11
11
  */
12
12
  interface SourceLocation {
13
13
  fileName: string;
@@ -15,22 +15,17 @@ interface SourceLocation {
15
15
  columnNumber?: number;
16
16
  }
17
17
  /**
18
- * Component information extracted from React Fiber
19
- */
20
- interface ComponentInfo {
21
- name: string;
22
- source: SourceLocation | null;
23
- }
24
- /**
25
- * A scanned DOM element with its React source information
18
+ * A scanned DOM element with its source information
19
+ * Source is always present from data-loc attribute
26
20
  */
27
21
  interface ScannedElement {
22
+ /** Unique ID from data-loc value (format: "loc:path:line:column") */
28
23
  id: string;
29
24
  element: Element;
30
25
  tagName: string;
31
26
  className: string;
32
- source: SourceLocation | null;
33
- componentStack: ComponentInfo[];
27
+ /** Source location (always present from data-loc) */
28
+ source: SourceLocation;
34
29
  rect: DOMRect;
35
30
  }
36
31
  /**
@@ -87,19 +82,15 @@ interface ElementIssue {
87
82
  */
88
83
  interface LocatorTarget {
89
84
  element: Element;
90
- source: SourceLocation | null;
91
- componentStack: ComponentInfo[];
85
+ source: SourceLocation;
92
86
  rect: DOMRect;
93
- /** Index in the component stack (0 = current element, higher = parent) */
94
- stackIndex: number;
95
87
  }
96
88
  /**
97
89
  * Element being inspected in the sidebar
98
90
  */
99
91
  interface InspectedElement {
100
92
  element: Element;
101
- source: SourceLocation | null;
102
- componentStack: ComponentInfo[];
93
+ source: SourceLocation;
103
94
  rect: DOMRect;
104
95
  /** Optional ID from auto-scan to link to cached results */
105
96
  scannedElementId?: string;
@@ -114,10 +105,6 @@ interface UILintContextValue {
114
105
  altKeyHeld: boolean;
115
106
  /** Current element under cursor when Alt is held */
116
107
  locatorTarget: LocatorTarget | null;
117
- /** Navigate to parent component in locator mode */
118
- locatorGoUp: () => void;
119
- /** Navigate to child component in locator mode */
120
- locatorGoDown: () => void;
121
108
  /** Element currently being inspected in sidebar */
122
109
  inspectedElement: InspectedElement | null;
123
110
  /** Set the element to inspect (opens sidebar) */
@@ -181,11 +168,17 @@ declare function useUILintContext(): UILintContextValue;
181
168
  declare function UILintProvider({ children, enabled, }: UILintProviderProps): react_jsx_runtime.JSX.Element;
182
169
 
183
170
  /**
184
- * UILint Toolbar - Simple floating button with settings popover
171
+ * UILint Toolbar - Segmented pill with Scan button and settings
172
+ *
173
+ * Design:
174
+ * ┌─────────────────────────────────────┐
175
+ * │ [🔍 Scan] │ [...] │
176
+ * └─────────────────────────────────────┘
177
+ * ⌥+Click to inspect
185
178
  */
186
179
 
187
180
  /**
188
- * Main Toolbar Component - Simple floating button with settings popover
181
+ * Main Toolbar Component - Segmented pill with Scan + Settings
189
182
  */
190
183
  declare function UILintToolbar(): React$1.ReactPortal | null;
191
184
 
@@ -202,6 +195,8 @@ declare function InspectionPanel(): React$1.ReactPortal | null;
202
195
  /**
203
196
  * Locator Overlay - Shows element info when Alt/Option key is held
204
197
  * Inspired by LocatorJS for a quick "hover to find source" experience
198
+ *
199
+ * Uses data-loc attributes only (no React Fiber).
205
200
  */
206
201
 
207
202
  /**
@@ -210,45 +205,18 @@ declare function InspectionPanel(): React$1.ReactPortal | null;
210
205
  declare function LocatorOverlay(): React$1.ReactPortal | null;
211
206
 
212
207
  /**
213
- * React Fiber inspection utilities for source file visualization
208
+ * DOM utilities for UILint source file visualization
214
209
  *
215
- * In development mode, React attaches debug information to Fiber nodes:
216
- * - _debugSource: { fileName, lineNumber, columnNumber }
217
- * - _debugOwner: The component that rendered this element
218
- * - return: Parent fiber in the tree
210
+ * Uses data-loc attributes injected by the jsx-loc-plugin build transform.
211
+ * This works uniformly for both server and client components in Next.js 15+.
219
212
  */
220
213
 
221
- /** React Fiber type (simplified) */
222
- interface Fiber {
223
- tag: number;
224
- type: string | Function | null;
225
- stateNode: Element | null;
226
- return: Fiber | null;
227
- _debugSource?: {
228
- fileName: string;
229
- lineNumber: number;
230
- columnNumber?: number;
231
- } | null;
232
- _debugOwner?: Fiber | null;
233
- }
234
- /**
235
- * Get React Fiber from a DOM element
236
- * React attaches fiber via __reactFiber$xxx key
237
- */
238
- declare function getFiberFromElement(element: Element): Fiber | null;
239
- /**
240
- * Extract source location from a fiber's _debugSource
241
- */
242
- declare function getDebugSource(fiber: Fiber): SourceLocation | null;
243
- /**
244
- * Get the debug owner fiber (component that rendered this element)
245
- */
246
- declare function getDebugOwner(fiber: Fiber): Fiber | null;
247
214
  /**
248
- * Build a component stack by walking up the fiber tree
249
- * Returns an array from innermost to outermost component
215
+ * Parse source location from data-loc attribute
216
+ * Format: "path/to/file.tsx:line:column" (injected by jsx-loc-plugin)
217
+ * Also supports legacy format: "path/to/file.tsx:line"
250
218
  */
251
- declare function getComponentStack(fiber: Fiber): ComponentInfo[];
219
+ declare function getSourceFromDataLoc(element: Element): SourceLocation | null;
252
220
  /**
253
221
  * Check if a file path is from node_modules
254
222
  */
@@ -258,7 +226,7 @@ declare function isNodeModulesPath(path: string): boolean;
258
226
  */
259
227
  declare function getDisplayName(path: string): string;
260
228
  /**
261
- * Scan the DOM tree and extract React source information
229
+ * Scan the DOM tree and extract elements with data-loc attributes
262
230
  */
263
231
  declare function scanDOMForSources(root?: Element, hideNodeModules?: boolean): ScannedElement[];
264
232
  /**
@@ -366,4 +334,4 @@ declare function isJSDOM(): boolean;
366
334
  */
367
335
  declare function isNode(): boolean;
368
336
 
369
- export { type CachedSource, type ComponentInfo, ConsistencyHighlighter, DATA_UILINT_ID, DEFAULT_SETTINGS, FILE_COLORS, type InspectedElement, InspectionPanel, LocatorOverlay, type LocatorTarget, type ScannedElement, type SourceApiResponse, type SourceFile, type SourceLocation, type UILintContextValue, UILintProvider, type UILintProviderProps, type UILintSettings, UILintToolbar, buildEditorUrl, cleanupDataAttributes, cleanupDataElements, clearSourceCache, createSnapshot, fetchSource, fetchSourceWithContext, getCachedSource, getComponentStack, getDebugOwner, getDebugSource, getDisplayName, getElementById, getElementBySnapshotId, getFiberFromElement, groupBySourceFile, isBrowser, isJSDOM, isNode, isNodeModulesPath, prefetchSources, scanDOM, scanDOMForSources, updateElementRects, useUILintContext };
337
+ export { type CachedSource, ConsistencyHighlighter, DATA_UILINT_ID, DEFAULT_SETTINGS, FILE_COLORS, type InspectedElement, InspectionPanel, LocatorOverlay, type LocatorTarget, type ScannedElement, type SourceApiResponse, type SourceFile, type SourceLocation, type UILintContextValue, UILintProvider, type UILintProviderProps, type UILintSettings, UILintToolbar, buildEditorUrl, cleanupDataAttributes, cleanupDataElements, clearSourceCache, createSnapshot, fetchSource, fetchSourceWithContext, getCachedSource, getDisplayName, getElementById, getElementBySnapshotId, getSourceFromDataLoc, groupBySourceFile, isBrowser, isJSDOM, isNode, isNodeModulesPath, prefetchSources, scanDOM, scanDOMForSources, updateElementRects, useUILintContext };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  UILintToolbar
4
- } from "./chunk-IGVNY64A.js";
4
+ } from "./chunk-WEBVLQL5.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-GKYWTCFU.js";
12
+ } from "./chunk-GZOQ6QWC.js";
13
13
  import {
14
14
  LocatorOverlay
15
- } from "./chunk-3YZH4UAT.js";
15
+ } from "./chunk-V4273T5B.js";
16
16
  import {
17
17
  DATA_UILINT_ID,
18
18
  DEFAULT_SETTINGS,
@@ -20,18 +20,15 @@ import {
20
20
  UILintProvider,
21
21
  buildEditorUrl,
22
22
  cleanupDataAttributes,
23
- getComponentStack,
24
- getDebugOwner,
25
- getDebugSource,
26
23
  getDisplayName,
27
24
  getElementById,
28
- getFiberFromElement,
25
+ getSourceFromDataLoc,
29
26
  groupBySourceFile,
30
27
  isNodeModulesPath,
31
28
  scanDOMForSources,
32
29
  updateElementRects,
33
30
  useUILintContext
34
- } from "./chunk-I4JDR36K.js";
31
+ } from "./chunk-PU6XPNPN.js";
35
32
 
36
33
  // src/consistency/snapshot.ts
37
34
  var DATA_ELEMENTS_ATTR = "data-elements";
@@ -465,13 +462,10 @@ export {
465
462
  fetchSourceWithContext,
466
463
  generateStyleGuideFromStyles as generateStyleGuide,
467
464
  getCachedSource,
468
- getComponentStack,
469
- getDebugOwner,
470
- getDebugSource,
471
465
  getDisplayName,
472
466
  getElementById,
473
467
  getElementBySnapshotId,
474
- getFiberFromElement,
468
+ getSourceFromDataLoc,
475
469
  groupBySourceFile,
476
470
  isBrowser,
477
471
  isJSDOM,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uilint-react",
3
- "version": "0.1.35",
3
+ "version": "0.1.38",
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.35",
37
+ "uilint-core": "^0.1.38",
38
38
  "zustand": "^5.0.5"
39
39
  },
40
40
  "peerDependencies": {