react-grab 0.1.25 → 0.1.27

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 +1 @@
1
- 'use strict';var chunk3NX6LHF6_cjs=require('../chunk-3NX6LHF6.cjs'),chunk2J7DC6YX_cjs=require('../chunk-2J7DC6YX.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.c}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.a}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.f}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunk2J7DC6YX_cjs.wa}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunk2J7DC6YX_cjs.ra}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunk2J7DC6YX_cjs.la}});
1
+ 'use strict';var chunk4HEJMPYD_cjs=require('../chunk-4HEJMPYD.cjs'),chunkPOAWRTGI_cjs=require('../chunk-POAWRTGI.cjs');Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.c}});Object.defineProperty(exports,"copyContent",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.a}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.f}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkPOAWRTGI_cjs.Ba}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkPOAWRTGI_cjs.wa}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkPOAWRTGI_cjs.qa}});
@@ -1,3 +1,3 @@
1
- export { x as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BurXddDF.cjs';
1
+ export { x as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-CN8HkCli.cjs';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
@@ -1,3 +1,3 @@
1
- export { x as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-BurXddDF.js';
1
+ export { x as ActionContext, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, D as DEFAULT_THEME, O as Options, e as OverlayBounds, P as Plugin, z as PluginConfig, B as PluginHooks, R as ReactGrabAPI, F as ReactGrabRendererProps, r as SettableOptions, S as SourceInfo, H as copyContent, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from '../index-CN8HkCli.js';
2
2
  export { isInstrumentationActive } from 'bippy';
3
3
  import 'bippy/source';
@@ -1 +1 @@
1
- export{c as DEFAULT_THEME,a as copyContent,b as generateSnippet,f as init}from'../chunk-T6Z6IZX5.js';export{wa as formatElementInfo,ra as getStack,la as isInstrumentationActive}from'../chunk-MG2QQPFZ.js';
1
+ export{c as DEFAULT_THEME,a as copyContent,b as generateSnippet,f as init}from'../chunk-STWQGYJG.js';export{Ba as formatElementInfo,wa as getStack,qa as isInstrumentationActive}from'../chunk-5O2BUFAV.js';
@@ -149,7 +149,7 @@ interface AgentSession {
149
149
  componentName?: string;
150
150
  error?: string;
151
151
  }
152
- interface AgentProvider<T = any> {
152
+ interface AgentProvider<T = unknown> {
153
153
  send: (context: AgentContext<T>, signal: AbortSignal) => AsyncIterable<string>;
154
154
  resume?: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncIterable<string>;
155
155
  abort?: (sessionId: string) => Promise<void>;
@@ -171,7 +171,7 @@ interface AgentSessionStorage {
171
171
  interface AgentCompleteResult {
172
172
  error?: string;
173
173
  }
174
- interface AgentOptions<T = any> {
174
+ interface AgentOptions<T = unknown> {
175
175
  provider?: AgentProvider<T>;
176
176
  storage?: AgentSessionStorage | null;
177
177
  getOptions?: () => T;
@@ -149,7 +149,7 @@ interface AgentSession {
149
149
  componentName?: string;
150
150
  error?: string;
151
151
  }
152
- interface AgentProvider<T = any> {
152
+ interface AgentProvider<T = unknown> {
153
153
  send: (context: AgentContext<T>, signal: AbortSignal) => AsyncIterable<string>;
154
154
  resume?: (sessionId: string, signal: AbortSignal, storage: AgentSessionStorage) => AsyncIterable<string>;
155
155
  abort?: (sessionId: string) => Promise<void>;
@@ -171,7 +171,7 @@ interface AgentSessionStorage {
171
171
  interface AgentCompleteResult {
172
172
  error?: string;
173
173
  }
174
- interface AgentOptions<T = any> {
174
+ interface AgentOptions<T = unknown> {
175
175
  provider?: AgentProvider<T>;
176
176
  storage?: AgentSessionStorage | null;
177
177
  getOptions?: () => T;
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunk3NX6LHF6_cjs=require('./chunk-3NX6LHF6.cjs'),chunk2J7DC6YX_cjs=require('./chunk-2J7DC6YX.cjs');/**
1
+ 'use strict';var chunk4HEJMPYD_cjs=require('./chunk-4HEJMPYD.cjs'),chunkPOAWRTGI_cjs=require('./chunk-POAWRTGI.cjs');/**
2
2
  * @license MIT
3
3
  *
4
4
  * Copyright (c) 2025 Aiden Bai
@@ -6,4 +6,4 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- var e=null,d=()=>typeof window>"u"?e:window.__REACT_GRAB__??e??null,c=t=>{e=t,typeof window<"u"&&(t?window.__REACT_GRAB__=t:delete window.__REACT_GRAB__);};typeof window<"u"&&(window.__REACT_GRAB__?e=window.__REACT_GRAB__:(e=chunk3NX6LHF6_cjs.f(),window.__REACT_GRAB__=e),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:e})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.c}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.d}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.f}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunk3NX6LHF6_cjs.e}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunk2J7DC6YX_cjs.wa}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunk2J7DC6YX_cjs.ra}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunk2J7DC6YX_cjs.la}});exports.getGlobalApi=d;exports.setGlobalApi=c;
9
+ var n=null,l=()=>typeof window>"u"?n:window.__REACT_GRAB__??n??null,R=e=>{n=e,typeof window<"u"&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__);},o=[],p=e=>{for(;o.length>0;){let t=o.shift();t&&e.registerPlugin(t);}},P=e=>{let t=l();if(t){t.registerPlugin(e);return}o.push(e);},w=e=>{let t=l();if(t){t.unregisterPlugin(e);return}let r=o.findIndex(a=>a.name===e);r!==-1&&o.splice(r,1);};typeof window<"u"&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?n=window.__REACT_GRAB__:(n=chunk4HEJMPYD_cjs.f(),window.__REACT_GRAB__=n),p(n),window.dispatchEvent(new CustomEvent("react-grab:init",{detail:n})));Object.defineProperty(exports,"DEFAULT_THEME",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.c}});Object.defineProperty(exports,"commentPlugin",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.d}});Object.defineProperty(exports,"generateSnippet",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.b}});Object.defineProperty(exports,"init",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.f}});Object.defineProperty(exports,"openPlugin",{enumerable:true,get:function(){return chunk4HEJMPYD_cjs.e}});Object.defineProperty(exports,"formatElementInfo",{enumerable:true,get:function(){return chunkPOAWRTGI_cjs.Ba}});Object.defineProperty(exports,"getStack",{enumerable:true,get:function(){return chunkPOAWRTGI_cjs.wa}});Object.defineProperty(exports,"isInstrumentationActive",{enumerable:true,get:function(){return chunkPOAWRTGI_cjs.qa}});exports.getGlobalApi=l;exports.registerPlugin=P;exports.setGlobalApi=R;exports.unregisterPlugin=w;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Plugin, R as ReactGrabAPI } from './index-BurXddDF.cjs';
2
- export { x as ActionContext, y as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BurXddDF.cjs';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-CN8HkCli.cjs';
2
+ export { x as ActionContext, y as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-CN8HkCli.cjs';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5
 
@@ -10,9 +10,12 @@ declare const openPlugin: Plugin;
10
10
  declare global {
11
11
  interface Window {
12
12
  __REACT_GRAB__?: ReactGrabAPI;
13
+ __REACT_GRAB_DISABLED__?: boolean;
13
14
  }
14
15
  }
15
16
  declare const getGlobalApi: () => ReactGrabAPI | null;
16
17
  declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
18
+ declare const registerPlugin: (plugin: Plugin) => void;
19
+ declare const unregisterPlugin: (name: string) => void;
17
20
 
18
- export { Plugin, ReactGrabAPI, commentPlugin, getGlobalApi, openPlugin, setGlobalApi };
21
+ export { Plugin, ReactGrabAPI, commentPlugin, getGlobalApi, openPlugin, registerPlugin, setGlobalApi, unregisterPlugin };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as Plugin, R as ReactGrabAPI } from './index-BurXddDF.js';
2
- export { x as ActionContext, y as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-BurXddDF.js';
1
+ import { P as Plugin, R as ReactGrabAPI } from './index-CN8HkCli.js';
2
+ export { x as ActionContext, y as ActionContextHooks, s as ActivationMode, q as AgentCompleteResult, A as AgentContext, p as AgentOptions, n as AgentProvider, m as AgentSession, o as AgentSessionStorage, t as ContextMenuAction, u as ContextMenuActionContext, C as CrosshairContext, D as DEFAULT_THEME, j as DeepPartial, f as DragRect, l as ElementLabelContext, E as ElementLabelVariant, G as GrabbedBox, O as Options, e as OverlayBounds, w as PluginAction, z as PluginConfig, B as PluginHooks, k as PromptModeContext, c as ReactGrabState, h as Rect, r as SettableOptions, S as SourceInfo, T as Theme, v as ToolbarMenuAction, d as ToolbarState, a as formatElementInfo, b as generateSnippet, g as getStack, i as init } from './index-CN8HkCli.js';
3
3
  export { isInstrumentationActive } from 'bippy';
4
4
  import 'bippy/source';
5
5
 
@@ -10,9 +10,12 @@ declare const openPlugin: Plugin;
10
10
  declare global {
11
11
  interface Window {
12
12
  __REACT_GRAB__?: ReactGrabAPI;
13
+ __REACT_GRAB_DISABLED__?: boolean;
13
14
  }
14
15
  }
15
16
  declare const getGlobalApi: () => ReactGrabAPI | null;
16
17
  declare const setGlobalApi: (api: ReactGrabAPI | null) => void;
18
+ declare const registerPlugin: (plugin: Plugin) => void;
19
+ declare const unregisterPlugin: (name: string) => void;
17
20
 
18
- export { Plugin, ReactGrabAPI, commentPlugin, getGlobalApi, openPlugin, setGlobalApi };
21
+ export { Plugin, ReactGrabAPI, commentPlugin, getGlobalApi, openPlugin, registerPlugin, setGlobalApi, unregisterPlugin };