react-grab 0.0.50 → 0.0.52
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 +2 -6
- package/dist/{chunk-73DWLENH.js → chunk-CBPK6MDL.js} +93 -22
- package/dist/{chunk-V3NBFNRU.cjs → chunk-ZCGA27A6.cjs} +93 -22
- package/dist/core-CHAbsaHv.d.cts +272 -0
- package/dist/core-CHAbsaHv.d.ts +272 -0
- package/dist/core.cjs +8 -8
- package/dist/core.d.cts +2 -156
- package/dist/core.d.ts +2 -156
- package/dist/core.js +1 -1
- package/dist/index.cjs +14 -9
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.global.js +29 -29
- package/dist/index.js +9 -3
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { FiberSource } from 'bippy/source';
|
|
2
|
+
import 'bippy';
|
|
3
|
+
|
|
4
|
+
type DeepPartial<T> = {
|
|
5
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
6
|
+
};
|
|
7
|
+
interface Theme {
|
|
8
|
+
/**
|
|
9
|
+
* Globally toggle the entire overlay
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Base hue (0-360) used to generate colors throughout the interface using HSL color space
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
hue?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The highlight box that appears when hovering over an element before selecting it
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
selectionBox?: {
|
|
23
|
+
/**
|
|
24
|
+
* Whether to show the selection highlight
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The border/outline color of the selection box.
|
|
30
|
+
* When undefined, falls back to grab-purple (rgb(210, 57, 192)) with opacity modifiers (50% border, 8% fill).
|
|
31
|
+
* When set, this color is used as the base for both the border and fill with the same opacity modifiers.
|
|
32
|
+
* @default undefined
|
|
33
|
+
*/
|
|
34
|
+
color?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Rounded corners of the selection box (e.g., "4px")
|
|
37
|
+
* @default 0px
|
|
38
|
+
*/
|
|
39
|
+
borderRadius?: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The rectangular selection area that appears when clicking and dragging to select multiple elements
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
dragBox?: {
|
|
46
|
+
/**
|
|
47
|
+
* Whether to show the drag selection box
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The fill color and border of the drag rectangle.
|
|
53
|
+
* When undefined, falls back to grab-purple (rgb(210, 57, 192)) with opacity modifiers (40% border, 5% fill).
|
|
54
|
+
* When set, this color is used as the base for both the border and fill with the same opacity modifiers.
|
|
55
|
+
* @default undefined
|
|
56
|
+
*/
|
|
57
|
+
color?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Brief flash/highlight boxes that appear on elements immediately after they're successfully grabbed/copied
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
grabbedBoxes?: {
|
|
64
|
+
/**
|
|
65
|
+
* Whether to show these success flash effects
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The color of the flash boxes.
|
|
71
|
+
* When undefined, falls back to grab-purple (rgb(210, 57, 192)) with opacity modifiers (100% border, 8% fill).
|
|
72
|
+
* When set, this color is used as the base for both the border and fill with the same opacity modifiers.
|
|
73
|
+
* @default undefined
|
|
74
|
+
*/
|
|
75
|
+
color?: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The floating label that follows the cursor showing information about the currently hovered element
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
elementLabel?: {
|
|
82
|
+
/**
|
|
83
|
+
* Whether to show the label
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
enabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Background color of the label box
|
|
89
|
+
* @default #fde7f7 (grab-pink-light)
|
|
90
|
+
*/
|
|
91
|
+
backgroundColor?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Color of the text inside the label
|
|
94
|
+
* @default #b21c8e (grab-pink)
|
|
95
|
+
*/
|
|
96
|
+
textColor?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Border color around the label
|
|
99
|
+
* @default #f7c5ec (grab-pink-border)
|
|
100
|
+
*/
|
|
101
|
+
borderColor?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Internal spacing of the label (e.g., "4px 8px")
|
|
104
|
+
* @default "2px 6px"
|
|
105
|
+
*/
|
|
106
|
+
padding?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Distance in pixels the label appears from the cursor
|
|
109
|
+
* @default 14
|
|
110
|
+
*/
|
|
111
|
+
cursorOffset?: number;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Text labels that appear after successful operations (like "Copied!" messages)
|
|
115
|
+
* @default true
|
|
116
|
+
*/
|
|
117
|
+
successLabels?: {
|
|
118
|
+
/**
|
|
119
|
+
* Whether to show success feedback labels
|
|
120
|
+
* @default true
|
|
121
|
+
*/
|
|
122
|
+
enabled?: boolean;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* The crosshair cursor overlay that helps with precise element targeting
|
|
126
|
+
* @default true
|
|
127
|
+
*/
|
|
128
|
+
crosshair?: {
|
|
129
|
+
/**
|
|
130
|
+
* Whether to show the crosshair
|
|
131
|
+
* @default true
|
|
132
|
+
*/
|
|
133
|
+
enabled?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Color of the crosshair lines
|
|
136
|
+
* @default rgba(210, 57, 192) (grab-purple)
|
|
137
|
+
*/
|
|
138
|
+
color?: string;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* An input field overlay that can appear for text entry during selection
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
inputOverlay?: {
|
|
145
|
+
/**
|
|
146
|
+
* Whether to show the input overlay when needed
|
|
147
|
+
* @default true
|
|
148
|
+
*/
|
|
149
|
+
enabled?: boolean;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
interface ReactGrabState {
|
|
153
|
+
isActive: boolean;
|
|
154
|
+
isDragging: boolean;
|
|
155
|
+
isCopying: boolean;
|
|
156
|
+
targetElement: Element | null;
|
|
157
|
+
dragBounds: DragRect | null;
|
|
158
|
+
}
|
|
159
|
+
type RenderType = "selectionBox" | "dragBox" | "grabbedBox" | "elementLabel" | "successLabel" | "crosshair" | "inputOverlay";
|
|
160
|
+
interface RenderData {
|
|
161
|
+
ref: HTMLElement | undefined;
|
|
162
|
+
props: Record<string, unknown>;
|
|
163
|
+
}
|
|
164
|
+
interface Options {
|
|
165
|
+
enabled?: boolean;
|
|
166
|
+
keyHoldDuration?: number;
|
|
167
|
+
allowActivationInsideInput?: boolean;
|
|
168
|
+
theme?: Theme;
|
|
169
|
+
onActivate?: () => void;
|
|
170
|
+
onDeactivate?: () => void;
|
|
171
|
+
onElementHover?: (element: Element) => void;
|
|
172
|
+
onElementSelect?: (element: Element) => void;
|
|
173
|
+
onDragStart?: (startX: number, startY: number) => void;
|
|
174
|
+
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
175
|
+
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
176
|
+
onAfterCopy?: (elements: Element[], success: boolean) => void;
|
|
177
|
+
onCopySuccess?: (elements: Element[], content: string) => void;
|
|
178
|
+
onCopyError?: (error: Error) => void;
|
|
179
|
+
onStateChange?: (state: ReactGrabState) => void;
|
|
180
|
+
onRender?: (type: RenderType, data: RenderData) => void;
|
|
181
|
+
}
|
|
182
|
+
interface ReactGrabAPI {
|
|
183
|
+
activate: () => void;
|
|
184
|
+
deactivate: () => void;
|
|
185
|
+
toggle: () => void;
|
|
186
|
+
isActive: () => boolean;
|
|
187
|
+
dispose: () => void;
|
|
188
|
+
copyElement: (elements: Element | Element[]) => Promise<boolean>;
|
|
189
|
+
getState: () => ReactGrabState;
|
|
190
|
+
updateTheme: (theme: DeepPartial<Theme>) => void;
|
|
191
|
+
getTheme: () => Required<Theme>;
|
|
192
|
+
}
|
|
193
|
+
interface OverlayBounds {
|
|
194
|
+
borderRadius: string;
|
|
195
|
+
height: number;
|
|
196
|
+
transform: string;
|
|
197
|
+
width: number;
|
|
198
|
+
x: number;
|
|
199
|
+
y: number;
|
|
200
|
+
}
|
|
201
|
+
interface ReactGrabRendererProps {
|
|
202
|
+
selectionVisible?: boolean;
|
|
203
|
+
selectionBounds?: OverlayBounds;
|
|
204
|
+
dragVisible?: boolean;
|
|
205
|
+
dragBounds?: OverlayBounds;
|
|
206
|
+
grabbedBoxes?: Array<{
|
|
207
|
+
id: string;
|
|
208
|
+
bounds: OverlayBounds;
|
|
209
|
+
createdAt: number;
|
|
210
|
+
}>;
|
|
211
|
+
successLabels?: Array<{
|
|
212
|
+
id: string;
|
|
213
|
+
text: string;
|
|
214
|
+
}>;
|
|
215
|
+
labelVariant?: "hover" | "processing" | "success";
|
|
216
|
+
labelContent?: unknown;
|
|
217
|
+
labelX?: number;
|
|
218
|
+
labelY?: number;
|
|
219
|
+
labelVisible?: boolean;
|
|
220
|
+
labelZIndex?: number;
|
|
221
|
+
labelShowHint?: boolean;
|
|
222
|
+
progressVisible?: boolean;
|
|
223
|
+
progress?: number;
|
|
224
|
+
mouseX?: number;
|
|
225
|
+
mouseY?: number;
|
|
226
|
+
crosshairVisible?: boolean;
|
|
227
|
+
inputVisible?: boolean;
|
|
228
|
+
inputX?: number;
|
|
229
|
+
inputY?: number;
|
|
230
|
+
inputValue?: string;
|
|
231
|
+
onInputChange?: (value: string) => void;
|
|
232
|
+
onInputSubmit?: () => void;
|
|
233
|
+
onInputCancel?: () => void;
|
|
234
|
+
theme?: Required<Theme>;
|
|
235
|
+
}
|
|
236
|
+
interface GrabbedBox {
|
|
237
|
+
id: string;
|
|
238
|
+
bounds: OverlayBounds;
|
|
239
|
+
createdAt: number;
|
|
240
|
+
element: Element;
|
|
241
|
+
}
|
|
242
|
+
interface Rect {
|
|
243
|
+
left: number;
|
|
244
|
+
top: number;
|
|
245
|
+
right: number;
|
|
246
|
+
bottom: number;
|
|
247
|
+
}
|
|
248
|
+
interface DragRect {
|
|
249
|
+
x: number;
|
|
250
|
+
y: number;
|
|
251
|
+
width: number;
|
|
252
|
+
height: number;
|
|
253
|
+
}
|
|
254
|
+
interface Position {
|
|
255
|
+
left: number;
|
|
256
|
+
top: number;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
declare const getNearestComponentName: (element: Element) => string | null;
|
|
260
|
+
interface StackFrame {
|
|
261
|
+
name: string;
|
|
262
|
+
source: FiberSource | null;
|
|
263
|
+
}
|
|
264
|
+
declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
|
|
265
|
+
declare const formatStack: (stack: Array<StackFrame>) => string;
|
|
266
|
+
declare const getHTMLPreview: (element: Element) => string;
|
|
267
|
+
|
|
268
|
+
declare const DEFAULT_THEME: Required<Theme>;
|
|
269
|
+
|
|
270
|
+
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
271
|
+
|
|
272
|
+
export { DEFAULT_THEME as D, type GrabbedBox as G, type Options as O, type Position as P, type ReactGrabAPI as R, type Theme as T, getHTMLPreview as a, getNearestComponentName as b, type ReactGrabState as c, type RenderType as d, type RenderData as e, formatStack as f, getStack as g, type OverlayBounds as h, init as i, type DragRect as j, type Rect as k, type DeepPartial as l, type ReactGrabRendererProps as m };
|
package/dist/core.cjs
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZCGA27A6_cjs = require('./chunk-ZCGA27A6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkZCGA27A6_cjs.DEFAULT_THEME; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "formatStack", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkZCGA27A6_cjs.formatStack; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getHTMLPreview", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkZCGA27A6_cjs.getHTMLPreview; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkZCGA27A6_cjs.getNearestComponentName; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getStack", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkZCGA27A6_cjs.getStack; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "init", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkZCGA27A6_cjs.init; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkZCGA27A6_cjs.Ee; }
|
|
34
34
|
});
|
package/dist/core.d.cts
CHANGED
|
@@ -1,157 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { D as DEFAULT_THEME, O as Options, h as OverlayBounds, R as ReactGrabAPI, m as ReactGrabRendererProps, f as formatStack, a as getHTMLPreview, b as getNearestComponentName, g as getStack, i as init } from './core-CHAbsaHv.cjs';
|
|
2
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 };
|
|
3
|
+
import 'bippy/source';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,157 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { D as DEFAULT_THEME, O as Options, h as OverlayBounds, R as ReactGrabAPI, m as ReactGrabRendererProps, f as formatStack, a as getHTMLPreview, b as getNearestComponentName, g as getStack, i as init } from './core-CHAbsaHv.js';
|
|
2
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 };
|
|
3
|
+
import 'bippy/source';
|
package/dist/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DEFAULT_THEME, formatStack, getHTMLPreview, getNearestComponentName, getStack, init, Ee as isInstrumentationActive } from './chunk-
|
|
1
|
+
export { DEFAULT_THEME, formatStack, getHTMLPreview, getNearestComponentName, getStack, init, Ee as isInstrumentationActive } from './chunk-CBPK6MDL.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZCGA27A6_cjs = require('./chunk-ZCGA27A6.cjs');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @license MIT
|
|
@@ -12,35 +12,40 @@ var chunkV3NBFNRU_cjs = require('./chunk-V3NBFNRU.cjs');
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
// src/index.ts
|
|
15
|
+
var globalApi = null;
|
|
16
|
+
var getGlobalApi = () => {
|
|
17
|
+
return globalApi;
|
|
18
|
+
};
|
|
15
19
|
if (typeof window !== "undefined") {
|
|
16
|
-
|
|
20
|
+
globalApi = chunkZCGA27A6_cjs.init();
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
Object.defineProperty(exports, "DEFAULT_THEME", {
|
|
20
24
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkZCGA27A6_cjs.DEFAULT_THEME; }
|
|
22
26
|
});
|
|
23
27
|
Object.defineProperty(exports, "formatStack", {
|
|
24
28
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkZCGA27A6_cjs.formatStack; }
|
|
26
30
|
});
|
|
27
31
|
Object.defineProperty(exports, "getHTMLPreview", {
|
|
28
32
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkZCGA27A6_cjs.getHTMLPreview; }
|
|
30
34
|
});
|
|
31
35
|
Object.defineProperty(exports, "getNearestComponentName", {
|
|
32
36
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkZCGA27A6_cjs.getNearestComponentName; }
|
|
34
38
|
});
|
|
35
39
|
Object.defineProperty(exports, "getStack", {
|
|
36
40
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkZCGA27A6_cjs.getStack; }
|
|
38
42
|
});
|
|
39
43
|
Object.defineProperty(exports, "init", {
|
|
40
44
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkZCGA27A6_cjs.init; }
|
|
42
46
|
});
|
|
43
47
|
Object.defineProperty(exports, "isInstrumentationActive", {
|
|
44
48
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkZCGA27A6_cjs.Ee; }
|
|
46
50
|
});
|
|
51
|
+
exports.getGlobalApi = getGlobalApi;
|