react-grab 0.0.49 → 0.0.50
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 +37 -0
- package/dist/chunk-73DWLENH.js +6232 -0
- package/dist/chunk-V3NBFNRU.cjs +6240 -0
- package/dist/core.cjs +34 -0
- package/dist/core.d.cts +157 -0
- package/dist/core.d.ts +157 -0
- package/dist/core.js +1 -0
- package/dist/index.cjs +31 -6004
- package/dist/index.d.cts +3 -65
- package/dist/index.d.ts +3 -65
- package/dist/index.global.js +30 -30
- package/dist/index.js +6 -6005
- package/package.json +11 -1
package/dist/core.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkV3NBFNRU_cjs = require('./chunk-V3NBFNRU.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkV3NBFNRU_cjs.DEFAULT_THEME; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "formatStack", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkV3NBFNRU_cjs.formatStack; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "getHTMLPreview", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkV3NBFNRU_cjs.getHTMLPreview; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "getNearestComponentName", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkV3NBFNRU_cjs.getNearestComponentName; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "getStack", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkV3NBFNRU_cjs.getStack; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "init", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkV3NBFNRU_cjs.init; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkV3NBFNRU_cjs.Ee; }
|
|
34
|
+
});
|
package/dist/core.d.cts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { FiberSource } from 'bippy/source';
|
|
2
|
+
export { isInstrumentationActive } from 'bippy';
|
|
3
|
+
|
|
4
|
+
interface Theme {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
hue?: number;
|
|
7
|
+
selectionBox?: {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
color?: string;
|
|
10
|
+
borderRadius?: string;
|
|
11
|
+
};
|
|
12
|
+
dragBox?: {
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
color?: string;
|
|
15
|
+
};
|
|
16
|
+
grabbedBoxes?: {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
color?: string;
|
|
19
|
+
};
|
|
20
|
+
elementLabel?: {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
textColor?: string;
|
|
24
|
+
borderColor?: string;
|
|
25
|
+
padding?: string;
|
|
26
|
+
cursorOffset?: number;
|
|
27
|
+
};
|
|
28
|
+
successLabels?: {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
crosshair?: {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
color?: string;
|
|
34
|
+
};
|
|
35
|
+
inputOverlay?: {
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface ReactGrabState {
|
|
40
|
+
isActive: boolean;
|
|
41
|
+
isDragging: boolean;
|
|
42
|
+
isCopying: boolean;
|
|
43
|
+
targetElement: Element | null;
|
|
44
|
+
dragBounds: DragRect | null;
|
|
45
|
+
}
|
|
46
|
+
type RenderType = 'selectionBox' | 'dragBox' | 'grabbedBox' | 'elementLabel' | 'successLabel' | 'crosshair' | 'inputOverlay';
|
|
47
|
+
interface RenderData {
|
|
48
|
+
ref: HTMLElement | undefined;
|
|
49
|
+
props: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface Options {
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
keyHoldDuration?: number;
|
|
54
|
+
allowActivationInsideInput?: boolean;
|
|
55
|
+
theme?: Theme;
|
|
56
|
+
onActivate?: () => void;
|
|
57
|
+
onDeactivate?: () => void;
|
|
58
|
+
onElementHover?: (element: Element) => void;
|
|
59
|
+
onElementSelect?: (element: Element) => void;
|
|
60
|
+
onDragStart?: (startX: number, startY: number) => void;
|
|
61
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
62
|
+
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
63
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void;
|
|
64
|
+
onCopySuccess?: (elements: Element[], content: string) => void;
|
|
65
|
+
onCopyError?: (error: Error) => void;
|
|
66
|
+
onStateChange?: (state: ReactGrabState) => void;
|
|
67
|
+
onRender?: (type: RenderType, data: RenderData) => void;
|
|
68
|
+
}
|
|
69
|
+
interface ReactGrabAPI {
|
|
70
|
+
activate: () => void;
|
|
71
|
+
deactivate: () => void;
|
|
72
|
+
toggle: () => void;
|
|
73
|
+
isActive: () => boolean;
|
|
74
|
+
dispose: () => void;
|
|
75
|
+
copyElement: (elements: Element | Element[]) => Promise<boolean>;
|
|
76
|
+
getState: () => ReactGrabState;
|
|
77
|
+
}
|
|
78
|
+
interface OverlayBounds {
|
|
79
|
+
borderRadius: string;
|
|
80
|
+
height: number;
|
|
81
|
+
transform: string;
|
|
82
|
+
width: number;
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}
|
|
86
|
+
interface ReactGrabRendererProps {
|
|
87
|
+
selectionVisible?: boolean;
|
|
88
|
+
selectionBounds?: OverlayBounds;
|
|
89
|
+
dragVisible?: boolean;
|
|
90
|
+
dragBounds?: OverlayBounds;
|
|
91
|
+
grabbedBoxes?: Array<{
|
|
92
|
+
id: string;
|
|
93
|
+
bounds: OverlayBounds;
|
|
94
|
+
createdAt: number;
|
|
95
|
+
}>;
|
|
96
|
+
successLabels?: Array<{
|
|
97
|
+
id: string;
|
|
98
|
+
text: string;
|
|
99
|
+
}>;
|
|
100
|
+
labelVariant?: "hover" | "processing" | "success";
|
|
101
|
+
labelContent?: unknown;
|
|
102
|
+
labelX?: number;
|
|
103
|
+
labelY?: number;
|
|
104
|
+
labelVisible?: boolean;
|
|
105
|
+
labelZIndex?: number;
|
|
106
|
+
labelShowHint?: boolean;
|
|
107
|
+
progressVisible?: boolean;
|
|
108
|
+
progress?: number;
|
|
109
|
+
mouseX?: number;
|
|
110
|
+
mouseY?: number;
|
|
111
|
+
crosshairVisible?: boolean;
|
|
112
|
+
inputVisible?: boolean;
|
|
113
|
+
inputX?: number;
|
|
114
|
+
inputY?: number;
|
|
115
|
+
inputValue?: string;
|
|
116
|
+
onInputChange?: (value: string) => void;
|
|
117
|
+
onInputSubmit?: () => void;
|
|
118
|
+
onInputCancel?: () => void;
|
|
119
|
+
theme?: Required<Theme>;
|
|
120
|
+
}
|
|
121
|
+
interface GrabbedBox {
|
|
122
|
+
id: string;
|
|
123
|
+
bounds: OverlayBounds;
|
|
124
|
+
createdAt: number;
|
|
125
|
+
element: Element;
|
|
126
|
+
}
|
|
127
|
+
interface Rect {
|
|
128
|
+
left: number;
|
|
129
|
+
top: number;
|
|
130
|
+
right: number;
|
|
131
|
+
bottom: number;
|
|
132
|
+
}
|
|
133
|
+
interface DragRect {
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
}
|
|
139
|
+
interface Position {
|
|
140
|
+
left: number;
|
|
141
|
+
top: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare const getNearestComponentName: (element: Element) => string | null;
|
|
145
|
+
interface StackFrame {
|
|
146
|
+
name: string;
|
|
147
|
+
source: FiberSource | null;
|
|
148
|
+
}
|
|
149
|
+
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
150
|
+
declare const formatStack: (stack: Array<StackFrame>) => string;
|
|
151
|
+
declare const getHTMLPreview: (element: Element) => string;
|
|
152
|
+
|
|
153
|
+
declare const DEFAULT_THEME: Required<Theme>;
|
|
154
|
+
|
|
155
|
+
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
156
|
+
|
|
157
|
+
export { type DragRect as D, DEFAULT_THEME, type GrabbedBox as G, type Options, type OverlayBounds, type Position as P, type ReactGrabState as R, type ReactGrabAPI, type ReactGrabRendererProps, type Theme as T, type RenderType as a, type RenderData as b, type Rect as c, formatStack, getHTMLPreview, getNearestComponentName, getStack, init };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { FiberSource } from 'bippy/source';
|
|
2
|
+
export { isInstrumentationActive } from 'bippy';
|
|
3
|
+
|
|
4
|
+
interface Theme {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
hue?: number;
|
|
7
|
+
selectionBox?: {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
color?: string;
|
|
10
|
+
borderRadius?: string;
|
|
11
|
+
};
|
|
12
|
+
dragBox?: {
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
color?: string;
|
|
15
|
+
};
|
|
16
|
+
grabbedBoxes?: {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
color?: string;
|
|
19
|
+
};
|
|
20
|
+
elementLabel?: {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
textColor?: string;
|
|
24
|
+
borderColor?: string;
|
|
25
|
+
padding?: string;
|
|
26
|
+
cursorOffset?: number;
|
|
27
|
+
};
|
|
28
|
+
successLabels?: {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
crosshair?: {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
color?: string;
|
|
34
|
+
};
|
|
35
|
+
inputOverlay?: {
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface ReactGrabState {
|
|
40
|
+
isActive: boolean;
|
|
41
|
+
isDragging: boolean;
|
|
42
|
+
isCopying: boolean;
|
|
43
|
+
targetElement: Element | null;
|
|
44
|
+
dragBounds: DragRect | null;
|
|
45
|
+
}
|
|
46
|
+
type RenderType = 'selectionBox' | 'dragBox' | 'grabbedBox' | 'elementLabel' | 'successLabel' | 'crosshair' | 'inputOverlay';
|
|
47
|
+
interface RenderData {
|
|
48
|
+
ref: HTMLElement | undefined;
|
|
49
|
+
props: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface Options {
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
keyHoldDuration?: number;
|
|
54
|
+
allowActivationInsideInput?: boolean;
|
|
55
|
+
theme?: Theme;
|
|
56
|
+
onActivate?: () => void;
|
|
57
|
+
onDeactivate?: () => void;
|
|
58
|
+
onElementHover?: (element: Element) => void;
|
|
59
|
+
onElementSelect?: (element: Element) => void;
|
|
60
|
+
onDragStart?: (startX: number, startY: number) => void;
|
|
61
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
62
|
+
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
63
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void;
|
|
64
|
+
onCopySuccess?: (elements: Element[], content: string) => void;
|
|
65
|
+
onCopyError?: (error: Error) => void;
|
|
66
|
+
onStateChange?: (state: ReactGrabState) => void;
|
|
67
|
+
onRender?: (type: RenderType, data: RenderData) => void;
|
|
68
|
+
}
|
|
69
|
+
interface ReactGrabAPI {
|
|
70
|
+
activate: () => void;
|
|
71
|
+
deactivate: () => void;
|
|
72
|
+
toggle: () => void;
|
|
73
|
+
isActive: () => boolean;
|
|
74
|
+
dispose: () => void;
|
|
75
|
+
copyElement: (elements: Element | Element[]) => Promise<boolean>;
|
|
76
|
+
getState: () => ReactGrabState;
|
|
77
|
+
}
|
|
78
|
+
interface OverlayBounds {
|
|
79
|
+
borderRadius: string;
|
|
80
|
+
height: number;
|
|
81
|
+
transform: string;
|
|
82
|
+
width: number;
|
|
83
|
+
x: number;
|
|
84
|
+
y: number;
|
|
85
|
+
}
|
|
86
|
+
interface ReactGrabRendererProps {
|
|
87
|
+
selectionVisible?: boolean;
|
|
88
|
+
selectionBounds?: OverlayBounds;
|
|
89
|
+
dragVisible?: boolean;
|
|
90
|
+
dragBounds?: OverlayBounds;
|
|
91
|
+
grabbedBoxes?: Array<{
|
|
92
|
+
id: string;
|
|
93
|
+
bounds: OverlayBounds;
|
|
94
|
+
createdAt: number;
|
|
95
|
+
}>;
|
|
96
|
+
successLabels?: Array<{
|
|
97
|
+
id: string;
|
|
98
|
+
text: string;
|
|
99
|
+
}>;
|
|
100
|
+
labelVariant?: "hover" | "processing" | "success";
|
|
101
|
+
labelContent?: unknown;
|
|
102
|
+
labelX?: number;
|
|
103
|
+
labelY?: number;
|
|
104
|
+
labelVisible?: boolean;
|
|
105
|
+
labelZIndex?: number;
|
|
106
|
+
labelShowHint?: boolean;
|
|
107
|
+
progressVisible?: boolean;
|
|
108
|
+
progress?: number;
|
|
109
|
+
mouseX?: number;
|
|
110
|
+
mouseY?: number;
|
|
111
|
+
crosshairVisible?: boolean;
|
|
112
|
+
inputVisible?: boolean;
|
|
113
|
+
inputX?: number;
|
|
114
|
+
inputY?: number;
|
|
115
|
+
inputValue?: string;
|
|
116
|
+
onInputChange?: (value: string) => void;
|
|
117
|
+
onInputSubmit?: () => void;
|
|
118
|
+
onInputCancel?: () => void;
|
|
119
|
+
theme?: Required<Theme>;
|
|
120
|
+
}
|
|
121
|
+
interface GrabbedBox {
|
|
122
|
+
id: string;
|
|
123
|
+
bounds: OverlayBounds;
|
|
124
|
+
createdAt: number;
|
|
125
|
+
element: Element;
|
|
126
|
+
}
|
|
127
|
+
interface Rect {
|
|
128
|
+
left: number;
|
|
129
|
+
top: number;
|
|
130
|
+
right: number;
|
|
131
|
+
bottom: number;
|
|
132
|
+
}
|
|
133
|
+
interface DragRect {
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
}
|
|
139
|
+
interface Position {
|
|
140
|
+
left: number;
|
|
141
|
+
top: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare const getNearestComponentName: (element: Element) => string | null;
|
|
145
|
+
interface StackFrame {
|
|
146
|
+
name: string;
|
|
147
|
+
source: FiberSource | null;
|
|
148
|
+
}
|
|
149
|
+
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
150
|
+
declare const formatStack: (stack: Array<StackFrame>) => string;
|
|
151
|
+
declare const getHTMLPreview: (element: Element) => string;
|
|
152
|
+
|
|
153
|
+
declare const DEFAULT_THEME: Required<Theme>;
|
|
154
|
+
|
|
155
|
+
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
156
|
+
|
|
157
|
+
export { type DragRect as D, DEFAULT_THEME, type GrabbedBox as G, type Options, type OverlayBounds, type Position as P, type ReactGrabState as R, type ReactGrabAPI, type ReactGrabRendererProps, type Theme as T, type RenderType as a, type RenderData as b, type Rect as c, formatStack, getHTMLPreview, getNearestComponentName, getStack, init };
|
package/dist/core.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DEFAULT_THEME, formatStack, getHTMLPreview, getNearestComponentName, getStack, init, Ee as isInstrumentationActive } from './chunk-73DWLENH.js';
|