gap-inspector 0.1.0 → 0.2.1

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.
@@ -1,17 +1,19 @@
1
- export type GapAxis = "horizontal" | "vertical";
2
- export type GapPoint = {
1
+ import * as react from 'react';
2
+
3
+ type GapAxis = "horizontal" | "vertical";
4
+ type GapPoint = {
3
5
  x: number;
4
6
  y: number;
5
7
  };
6
- export type GapContributionKind = "margin" | "padding" | "border" | "scrollbar" | "gap" | "layout" | "unknown";
7
- export type GapElementInfo = {
8
+ type GapContributionKind = "margin" | "padding" | "border" | "scrollbar" | "gap" | "layout" | "unknown";
9
+ type GapElementInfo = {
8
10
  selector: string;
9
11
  tagName: string;
10
12
  className: string;
11
13
  rect: GapRect;
12
14
  element?: Element;
13
15
  };
14
- export type GapContribution = {
16
+ type GapContribution = {
15
17
  kind: GapContributionKind;
16
18
  property: string;
17
19
  valuePx: number;
@@ -20,7 +22,7 @@ export type GapContribution = {
20
22
  element: GapElementInfo;
21
23
  note?: string;
22
24
  };
23
- export type GapRect = {
25
+ type GapRect = {
24
26
  top: number;
25
27
  right: number;
26
28
  bottom: number;
@@ -28,7 +30,7 @@ export type GapRect = {
28
30
  width: number;
29
31
  height: number;
30
32
  };
31
- export type GapMeasurement = {
33
+ type GapMeasurement = {
32
34
  axis: GapAxis;
33
35
  totalPx: number;
34
36
  attributedPx: number;
@@ -42,8 +44,8 @@ export type GapMeasurement = {
42
44
  equation: string;
43
45
  markdown: string;
44
46
  };
45
- export type PointRegion = "content" | "padding" | "border" | "margin" | "gap" | "unknown";
46
- export type PointInspection = {
47
+ type PointRegion = "content" | "padding" | "border" | "margin" | "gap" | "unknown";
48
+ type PointInspection = {
47
49
  kind: "point";
48
50
  axis: GapAxis;
49
51
  point: GapPoint;
@@ -59,8 +61,8 @@ export type PointInspection = {
59
61
  markdown: string;
60
62
  };
61
63
  type Direction = "after" | "before";
62
- export declare function inferAxis(start: GapPoint, end: GapPoint): GapAxis;
63
- export declare function measureGap(options: {
64
+ declare function inferAxis(start: GapPoint, end: GapPoint): GapAxis;
65
+ declare function measureGap(options: {
64
66
  axis?: GapAxis;
65
67
  start: GapPoint;
66
68
  end: GapPoint;
@@ -69,11 +71,11 @@ export declare function measureGap(options: {
69
71
  /** Set to false to skip the full-DOM boundary scan fallback (used for cheap drag previews). */
70
72
  boundaryScan?: boolean;
71
73
  }): GapMeasurement | null;
72
- export declare function inspectPoint(options: {
73
- axis?: GapAxis;
74
- point: GapPoint;
75
- document?: Document;
76
- ignoreElements?: Array<Element | null | undefined>;
77
- }): PointInspection | null;
78
- export declare function resolveSelector(selector: string, doc?: Document): Element | null;
79
- export {};
74
+
75
+ type GapInspectorProps = {
76
+ initiallyOpen?: boolean;
77
+ onMeasure?: (measurement: GapMeasurement) => void;
78
+ };
79
+ declare function GapInspector({ initiallyOpen, onMeasure }: GapInspectorProps): react.JSX.Element;
80
+
81
+ export { type GapAxis, type GapContribution, GapInspector, type GapInspectorProps, type GapMeasurement, type GapPoint, type PointInspection, inferAxis, measureGap };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,81 @@
1
- import { inferAxis, measureGap, type GapMeasurement } from "./measurement";
2
- export type GapInspectorProps = {
1
+ import * as react from 'react';
2
+
3
+ type GapAxis = "horizontal" | "vertical";
4
+ type GapPoint = {
5
+ x: number;
6
+ y: number;
7
+ };
8
+ type GapContributionKind = "margin" | "padding" | "border" | "scrollbar" | "gap" | "layout" | "unknown";
9
+ type GapElementInfo = {
10
+ selector: string;
11
+ tagName: string;
12
+ className: string;
13
+ rect: GapRect;
14
+ element?: Element;
15
+ };
16
+ type GapContribution = {
17
+ kind: GapContributionKind;
18
+ property: string;
19
+ valuePx: number;
20
+ cssValue?: string;
21
+ selector: string;
22
+ element: GapElementInfo;
23
+ note?: string;
24
+ };
25
+ type GapRect = {
26
+ top: number;
27
+ right: number;
28
+ bottom: number;
29
+ left: number;
30
+ width: number;
31
+ height: number;
32
+ };
33
+ type GapMeasurement = {
34
+ axis: GapAxis;
35
+ totalPx: number;
36
+ attributedPx: number;
37
+ unattributedPx: number;
38
+ from: GapElementInfo;
39
+ to: GapElementInfo;
40
+ commonAncestor?: GapElementInfo;
41
+ internalSide?: Direction;
42
+ contributions: GapContribution[];
43
+ warnings: string[];
44
+ equation: string;
45
+ markdown: string;
46
+ };
47
+ type PointRegion = "content" | "padding" | "border" | "margin" | "gap" | "unknown";
48
+ type PointInspection = {
49
+ kind: "point";
50
+ axis: GapAxis;
51
+ point: GapPoint;
52
+ region: PointRegion;
53
+ totalPx?: number;
54
+ property?: string;
55
+ cssValue?: string;
56
+ element?: GapElementInfo;
57
+ from?: GapElementInfo;
58
+ to?: GapElementInfo;
59
+ rect?: GapRect;
60
+ note?: string;
61
+ markdown: string;
62
+ };
63
+ type Direction = "after" | "before";
64
+ declare function inferAxis(start: GapPoint, end: GapPoint): GapAxis;
65
+ declare function measureGap(options: {
66
+ axis?: GapAxis;
67
+ start: GapPoint;
68
+ end: GapPoint;
69
+ document?: Document;
70
+ ignoreElements?: Array<Element | null | undefined>;
71
+ /** Set to false to skip the full-DOM boundary scan fallback (used for cheap drag previews). */
72
+ boundaryScan?: boolean;
73
+ }): GapMeasurement | null;
74
+
75
+ type GapInspectorProps = {
3
76
  initiallyOpen?: boolean;
4
77
  onMeasure?: (measurement: GapMeasurement) => void;
5
78
  };
6
- export declare function GapInspector({ initiallyOpen, onMeasure }: GapInspectorProps): import("react").JSX.Element;
7
- export { inferAxis, measureGap };
8
- export type { GapAxis, GapContribution, GapMeasurement, GapPoint, PointInspection } from "./measurement";
79
+ declare function GapInspector({ initiallyOpen, onMeasure }: GapInspectorProps): react.JSX.Element;
80
+
81
+ export { type GapAxis, type GapContribution, GapInspector, type GapInspectorProps, type GapMeasurement, type GapPoint, type PointInspection, inferAxis, measureGap };