react-grab 0.1.16 → 0.1.17
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 +64 -34
- package/dist/chunk-ILQ5JMGX.cjs +112 -0
- package/dist/chunk-WBYGVXEQ.js +112 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/{index-DYEETXtH.d.cts → index-BCkTVQa8.d.cts} +29 -7
- package/dist/{index-DYEETXtH.d.ts → index-BCkTVQa8.d.ts} +29 -7
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.global.js +41 -41
- package/dist/index.js +2 -2
- package/dist/react.cjs +10041 -8729
- package/dist/react.d.cts +17 -4
- package/dist/react.d.ts +17 -4
- package/dist/react.js +10041 -8729
- package/dist/styles.css +1 -1
- package/package.json +2 -1
- package/dist/chunk-QF65DY25.cjs +0 -112
- package/dist/chunk-RILHLGIL.js +0 -112
package/dist/react.d.cts
CHANGED
|
@@ -209,6 +209,7 @@ interface ContextMenuActionContext extends ActionContext {
|
|
|
209
209
|
interface ContextMenuAction {
|
|
210
210
|
id: string;
|
|
211
211
|
label: string;
|
|
212
|
+
target?: "context-menu";
|
|
212
213
|
shortcut?: string;
|
|
213
214
|
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
214
215
|
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
@@ -223,8 +224,9 @@ interface ScreenshotBounds {
|
|
|
223
224
|
interface PluginHooks {
|
|
224
225
|
onActivate?: () => void;
|
|
225
226
|
onDeactivate?: () => void;
|
|
227
|
+
cancelPendingToolbarActions?: () => void;
|
|
226
228
|
onElementHover?: (element: Element) => void;
|
|
227
|
-
onElementSelect?: (element: Element) => void
|
|
229
|
+
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
228
230
|
onDragStart?: (startX: number, startY: number) => void;
|
|
229
231
|
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
230
232
|
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
@@ -251,10 +253,20 @@ interface PluginHooks {
|
|
|
251
253
|
transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
|
|
252
254
|
transformSnippet?: (snippet: string, element: Element) => string | Promise<string>;
|
|
253
255
|
}
|
|
256
|
+
interface ToolbarMenuAction {
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
shortcut?: string;
|
|
260
|
+
target: "toolbar";
|
|
261
|
+
enabled?: boolean | (() => boolean);
|
|
262
|
+
isActive?: () => boolean;
|
|
263
|
+
onAction: () => void | Promise<void>;
|
|
264
|
+
}
|
|
265
|
+
type PluginAction = ContextMenuAction | ToolbarMenuAction;
|
|
254
266
|
interface PluginConfig {
|
|
255
267
|
theme?: DeepPartial<Theme>;
|
|
256
268
|
options?: SettableOptions;
|
|
257
|
-
actions?:
|
|
269
|
+
actions?: PluginAction[];
|
|
258
270
|
hooks?: PluginHooks;
|
|
259
271
|
cleanup?: () => void;
|
|
260
272
|
}
|
|
@@ -262,9 +274,9 @@ interface Plugin {
|
|
|
262
274
|
name: string;
|
|
263
275
|
theme?: DeepPartial<Theme>;
|
|
264
276
|
options?: SettableOptions;
|
|
265
|
-
actions?:
|
|
277
|
+
actions?: PluginAction[];
|
|
266
278
|
hooks?: PluginHooks;
|
|
267
|
-
setup?: (api: ReactGrabAPI) => PluginConfig | void;
|
|
279
|
+
setup?: (api: ReactGrabAPI, hooks: ActionContextHooks) => PluginConfig | void;
|
|
268
280
|
}
|
|
269
281
|
interface Options {
|
|
270
282
|
enabled?: boolean;
|
|
@@ -299,6 +311,7 @@ interface ReactGrabAPI {
|
|
|
299
311
|
activate: () => void;
|
|
300
312
|
deactivate: () => void;
|
|
301
313
|
toggle: () => void;
|
|
314
|
+
comment: () => void;
|
|
302
315
|
isActive: () => boolean;
|
|
303
316
|
isEnabled: () => boolean;
|
|
304
317
|
setEnabled: (enabled: boolean) => void;
|
package/dist/react.d.ts
CHANGED
|
@@ -209,6 +209,7 @@ interface ContextMenuActionContext extends ActionContext {
|
|
|
209
209
|
interface ContextMenuAction {
|
|
210
210
|
id: string;
|
|
211
211
|
label: string;
|
|
212
|
+
target?: "context-menu";
|
|
212
213
|
shortcut?: string;
|
|
213
214
|
enabled?: boolean | ((context: ActionContext) => boolean);
|
|
214
215
|
onAction: (context: ContextMenuActionContext) => void | Promise<void>;
|
|
@@ -223,8 +224,9 @@ interface ScreenshotBounds {
|
|
|
223
224
|
interface PluginHooks {
|
|
224
225
|
onActivate?: () => void;
|
|
225
226
|
onDeactivate?: () => void;
|
|
227
|
+
cancelPendingToolbarActions?: () => void;
|
|
226
228
|
onElementHover?: (element: Element) => void;
|
|
227
|
-
onElementSelect?: (element: Element) => void
|
|
229
|
+
onElementSelect?: (element: Element) => boolean | void | Promise<boolean>;
|
|
228
230
|
onDragStart?: (startX: number, startY: number) => void;
|
|
229
231
|
onDragEnd?: (elements: Element[], bounds: DragRect) => void;
|
|
230
232
|
onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
|
|
@@ -251,10 +253,20 @@ interface PluginHooks {
|
|
|
251
253
|
transformOpenFileUrl?: (url: string, filePath: string, lineNumber?: number) => string;
|
|
252
254
|
transformSnippet?: (snippet: string, element: Element) => string | Promise<string>;
|
|
253
255
|
}
|
|
256
|
+
interface ToolbarMenuAction {
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
shortcut?: string;
|
|
260
|
+
target: "toolbar";
|
|
261
|
+
enabled?: boolean | (() => boolean);
|
|
262
|
+
isActive?: () => boolean;
|
|
263
|
+
onAction: () => void | Promise<void>;
|
|
264
|
+
}
|
|
265
|
+
type PluginAction = ContextMenuAction | ToolbarMenuAction;
|
|
254
266
|
interface PluginConfig {
|
|
255
267
|
theme?: DeepPartial<Theme>;
|
|
256
268
|
options?: SettableOptions;
|
|
257
|
-
actions?:
|
|
269
|
+
actions?: PluginAction[];
|
|
258
270
|
hooks?: PluginHooks;
|
|
259
271
|
cleanup?: () => void;
|
|
260
272
|
}
|
|
@@ -262,9 +274,9 @@ interface Plugin {
|
|
|
262
274
|
name: string;
|
|
263
275
|
theme?: DeepPartial<Theme>;
|
|
264
276
|
options?: SettableOptions;
|
|
265
|
-
actions?:
|
|
277
|
+
actions?: PluginAction[];
|
|
266
278
|
hooks?: PluginHooks;
|
|
267
|
-
setup?: (api: ReactGrabAPI) => PluginConfig | void;
|
|
279
|
+
setup?: (api: ReactGrabAPI, hooks: ActionContextHooks) => PluginConfig | void;
|
|
268
280
|
}
|
|
269
281
|
interface Options {
|
|
270
282
|
enabled?: boolean;
|
|
@@ -299,6 +311,7 @@ interface ReactGrabAPI {
|
|
|
299
311
|
activate: () => void;
|
|
300
312
|
deactivate: () => void;
|
|
301
313
|
toggle: () => void;
|
|
314
|
+
comment: () => void;
|
|
302
315
|
isActive: () => boolean;
|
|
303
316
|
isEnabled: () => boolean;
|
|
304
317
|
setEnabled: (enabled: boolean) => void;
|