@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/README.md +72 -25
- package/dist/InspectionContext.d.ts +37 -35
- package/dist/InspectionContext.js +211 -253
- package/dist/InspectionHighlight.d.ts +2 -6
- package/dist/InspectionHighlight.js +258 -65
- package/dist/InspectionOverlays.d.ts +7 -0
- package/dist/InspectionOverlays.js +32 -0
- package/dist/InspectionTooltip.d.ts +6 -6
- package/dist/InspectionTooltip.js +406 -232
- package/dist/InspectionWrapper.d.ts +28 -28
- package/dist/InspectionWrapper.js +102 -102
- package/dist/autoInspection.d.ts +18 -14
- package/dist/autoInspection.js +329 -320
- package/dist/index.d.ts +10 -8
- package/dist/index.js +10 -9
- package/dist/inspection.d.ts +78 -29
- package/dist/inspection.js +493 -140
- package/dist/inspectionInterceptors.d.ts +27 -27
- package/dist/inspectionInterceptors.js +68 -64
- package/dist/useInspectionMetadata.d.ts +34 -34
- package/dist/useInspectionMetadata.js +67 -67
- package/package.json +1 -1
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 {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
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 {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
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';
|
package/dist/inspection.d.ts
CHANGED
|
@@ -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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|