@zargaryanvh/react-component-inspector 1.0.2 → 1.0.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/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- export { InspectionProvider, useInspection, ComponentMetadata } from './InspectionContext';
2
- export { InspectionTooltip } from './InspectionTooltip';
3
- export { InspectionHighlight } from './InspectionHighlight';
4
- export { InspectionWrapper, withInspection } from './InspectionWrapper';
5
- export { useInspectionMetadata } from './useInspectionMetadata';
6
- export { setupInterceptors, setInspectionActive, shouldBlockRequest } from './inspectionInterceptors';
7
- export { generateComponentId, formatPropsSignature, formatMetadataForClipboard, getComponentName, getNextInstanceIndex } from './inspection';
8
- export { setupAutoInspection, parseInspectionMetadata } from './autoInspection';
1
+ export { InspectionProvider, useInspection, ComponentMetadata } from './InspectionContext';
2
+ export { InspectionTooltip } from './InspectionTooltip';
3
+ export { InspectionHighlight } from './InspectionHighlight';
4
+ export { InspectionOverlays } from './InspectionOverlays';
5
+ export { InspectionWrapper, withInspection } from './InspectionWrapper';
6
+ export { useInspectionMetadata } from './useInspectionMetadata';
7
+ export { setupInterceptors, setInspectionActive, shouldBlockRequest } from './inspectionInterceptors';
8
+ export { generateComponentId, formatPropsSignature, formatMetadataForClipboard, formatMarginForClipboard, formatPaddingForClipboard, formatGapForClipboard, getParentWithGap, getAncestorsWithMargin, getTooltipHowToFindInfo, getComponentName, getNextInstanceIndex } from './inspection';
9
+ export type { CopyType } from './inspection';
10
+ export { setupAutoInspection, parseInspectionMetadata } from './autoInspection';
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
- // Main exports
2
- export { InspectionProvider, useInspection } from './InspectionContext';
3
- export { InspectionTooltip } from './InspectionTooltip';
4
- export { InspectionHighlight } from './InspectionHighlight';
5
- export { InspectionWrapper, withInspection } from './InspectionWrapper';
6
- export { useInspectionMetadata } from './useInspectionMetadata';
7
- export { setupInterceptors, setInspectionActive, shouldBlockRequest } from './inspectionInterceptors';
8
- export { generateComponentId, formatPropsSignature, formatMetadataForClipboard, getComponentName, getNextInstanceIndex } from './inspection';
9
- export { setupAutoInspection, parseInspectionMetadata } from './autoInspection';
1
+ // Main exports
2
+ export { InspectionProvider, useInspection } from './InspectionContext';
3
+ export { InspectionTooltip } from './InspectionTooltip';
4
+ export { InspectionHighlight } from './InspectionHighlight';
5
+ export { InspectionOverlays } from './InspectionOverlays';
6
+ export { InspectionWrapper, withInspection } from './InspectionWrapper';
7
+ export { useInspectionMetadata } from './useInspectionMetadata';
8
+ export { setupInterceptors, setInspectionActive, shouldBlockRequest } from './inspectionInterceptors';
9
+ export { generateComponentId, formatPropsSignature, formatMetadataForClipboard, formatMarginForClipboard, formatPaddingForClipboard, formatGapForClipboard, getParentWithGap, getAncestorsWithMargin, getTooltipHowToFindInfo, getComponentName, getNextInstanceIndex } from './inspection';
10
+ export { setupAutoInspection, parseInspectionMetadata } from './autoInspection';
@@ -1,29 +1,78 @@
1
- import { ComponentMetadata } from "./InspectionContext";
2
- /**
3
- * Generate a unique component ID
4
- */
5
- export declare const generateComponentId: (componentName: string, instanceIndex: number) => string;
6
- /**
7
- * Format props signature for display
8
- */
9
- export declare const formatPropsSignature: (props: Record<string, any>) => string;
10
- /**
11
- * Get component name from component type
12
- */
13
- export declare const getComponentName: (component: React.ComponentType<any> | string) => string;
14
- /**
15
- * Build usage path from component hierarchy
16
- */
17
- export declare const buildUsagePath: (hierarchy: string[]) => string;
18
- /**
19
- * Format metadata for clipboard with full element details
20
- */
21
- export declare const formatMetadataForClipboard: (metadata: ComponentMetadata, element: HTMLElement) => string;
22
- /**
23
- * Get next instance index for a component
24
- */
25
- export declare const getNextInstanceIndex: (componentName: string) => number;
26
- /**
27
- * Reset instance counts (useful for testing or remounting)
28
- */
29
- export declare const resetInstanceCounts: () => void;
1
+ import { ComponentMetadata } from "./InspectionContext";
2
+ /**
3
+ * Generate a unique component ID
4
+ */
5
+ export declare const generateComponentId: (componentName: string, instanceIndex: number) => string;
6
+ /**
7
+ * Format props signature for display
8
+ */
9
+ export declare const formatPropsSignature: (props: Record<string, any>) => string;
10
+ /**
11
+ * Get component name from component type
12
+ */
13
+ export declare const getComponentName: (component: React.ComponentType<any> | string) => string;
14
+ /**
15
+ * Build usage path from component hierarchy
16
+ */
17
+ export declare const buildUsagePath: (hierarchy: string[]) => string;
18
+ export type CopyType = "component" | "margin" | "padding" | "gap";
19
+ /**
20
+ * Get parent element that has flex/grid layout with non-zero gap
21
+ */
22
+ export declare const getParentWithGap: (element: HTMLElement) => HTMLElement | null;
23
+ /**
24
+ * Get ancestors with non-zero margin (closest first, up to maxCount)
25
+ */
26
+ export declare const getAncestorsWithMargin: (element: HTMLElement, maxCount?: number) => Array<{
27
+ element: HTMLElement;
28
+ mt: number;
29
+ mr: number;
30
+ mb: number;
31
+ ml: number;
32
+ }>;
33
+ /**
34
+ * Build DOM path from body to element (helps Cursor identify exact element)
35
+ */
36
+ export declare const buildDomPath: (element: HTMLElement) => string;
37
+ /**
38
+ * Build parent element description
39
+ */
40
+ export declare const buildParentInfo: (element: HTMLElement) => string | null;
41
+ /**
42
+ * Build role/disambiguation (outer vs inner, position in tree)
43
+ */
44
+ export declare const buildRoleInTree: (element: HTMLElement, type: "margin" | "padding" | "component") => string;
45
+ /**
46
+ * Format metadata for clipboard with full element details
47
+ */
48
+ export declare const formatMetadataForClipboard: (metadata: ComponentMetadata, element: HTMLElement, type?: CopyType) => string;
49
+ /**
50
+ * Format margin info for clipboard (alias for formatMetadataForClipboard with type="margin")
51
+ */
52
+ export declare const formatMarginForClipboard: (metadata: ComponentMetadata, element: HTMLElement) => string;
53
+ /**
54
+ * Format padding info for clipboard (alias for formatMetadataForClipboard with type="padding")
55
+ */
56
+ export declare const formatPaddingForClipboard: (metadata: ComponentMetadata, element: HTMLElement) => string;
57
+ /**
58
+ * Format gap info for clipboard (alias for formatMetadataForClipboard with type="gap")
59
+ */
60
+ export declare const formatGapForClipboard: (metadata: ComponentMetadata, element: HTMLElement) => string;
61
+ /**
62
+ * Get "how to find" display info for tooltip (same logic for desktop and mobile)
63
+ */
64
+ export declare const getTooltipHowToFindInfo: (metadata: ComponentMetadata, element: HTMLElement, type: CopyType) => {
65
+ domPath: string;
66
+ parent: string | null;
67
+ roleInTree: string;
68
+ target: string;
69
+ howToFindSteps: string[];
70
+ };
71
+ /**
72
+ * Get next instance index for a component
73
+ */
74
+ export declare const getNextInstanceIndex: (componentName: string) => number;
75
+ /**
76
+ * Reset instance counts (useful for testing or remounting)
77
+ */
78
+ export declare const resetInstanceCounts: () => void;