react-grab 0.1.48-dev.e563133 → 0.1.48-dev.e8bbe19

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.
Files changed (34) hide show
  1. package/README.md +17 -58
  2. package/dist/{copy-content-3sDfOP1b.d.ts → copy-content-CNRKFr6F.d.ts} +12 -1
  3. package/dist/{copy-content-TZDC2S2A.d.cts → copy-content-CtYUWe5l.d.cts} +12 -1
  4. package/dist/core/index.cjs +1 -1
  5. package/dist/core/index.d.cts +2 -2
  6. package/dist/core/index.d.ts +2 -2
  7. package/dist/core/index.js +1 -1
  8. package/dist/core-DGlXEp--.cjs +14 -0
  9. package/dist/core-J_glajVw.js +14 -0
  10. package/dist/{execute-context-menu-action-qMuJC5wG.cjs → execute-context-menu-action-B97xLx3C.cjs} +1 -1
  11. package/dist/execute-context-menu-action-CNuVV340.js +9 -0
  12. package/dist/freeze-updates-Blxs8ns1.js +52 -0
  13. package/dist/freeze-updates-nmbjoxO5.cjs +52 -0
  14. package/dist/{index-DDf5jObx.d.cts → index-BgTe-uWs.d.cts} +1 -1
  15. package/dist/{index-DWvC_uKW.d.ts → index-CdWMNcJF.d.ts} +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.global.js +20 -20
  20. package/dist/index.js +1 -1
  21. package/dist/{open-file-djB6VdRN.cjs → open-file-Bi6PuduG.cjs} +1 -1
  22. package/dist/{open-file-CWAKzV7d.js → open-file-Bw4xAehe.js} +1 -1
  23. package/dist/primitives.cjs +2 -2
  24. package/dist/primitives.d.cts +40 -2
  25. package/dist/primitives.d.ts +40 -2
  26. package/dist/primitives.js +2 -2
  27. package/dist/{renderer-BqkijmsE.cjs → renderer-DburAGNL.cjs} +1 -1
  28. package/dist/{renderer-B0TpSoAf.js → renderer-iDUKx2RL.js} +1 -1
  29. package/package.json +2 -2
  30. package/dist/core-CzNdf_9v.js +0 -14
  31. package/dist/core-Duvvh_P0.cjs +0 -14
  32. package/dist/execute-context-menu-action-BAFetckA.js +0 -9
  33. package/dist/freeze-updates-BmjaUWo5.js +0 -52
  34. package/dist/freeze-updates-ajWXmT_s.cjs +0 -52
package/dist/index.js CHANGED
@@ -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
- import{a as e,i as t,n,r,t as i}from"./core-CzNdf_9v.js";import{I as a,L as o,N as s,U as c,j as l}from"./freeze-updates-BmjaUWo5.js";import{r as u,s as d}from"./open-file-CWAKzV7d.js";let f=null;const p=new Map,m=()=>typeof window>`u`?f:window.__REACT_GRAB__??f??null,h=e=>{if(f=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__),e)for(let[t,n]of p){p.delete(t);try{e.registerPlugin(n)}catch(e){e instanceof a||new a(t,e)}}},g=e=>{let t=m();if(t){t.registerPlugin(e);return}p.set(e.name,e)},_=e=>{let t=m();if(t){t.unregisterPlugin(e);return}p.delete(e)};typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(h((window.__REACT_GRAB__??(()=>{if(typeof window>`u`||window.parent===window)return null;try{return window.parent.__REACT_GRAB__??null}catch{return null}})())||i()),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:m()})));export{e as DEFAULT_THEME,l as FreezeError,s as OpenFileError,a as PluginSetupError,o as ReactGrabError,t as commentPlugin,u as formatElementInfo,n as generateSnippet,m as getGlobalApi,d as getStack,i as init,c as isInstrumentationActive,r as openPlugin,g as registerPlugin,h as setGlobalApi,_ as unregisterPlugin};
9
+ import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./core-J_glajVw.js";import{I as l,L as u,N as d,U as f,j as p}from"./freeze-updates-Blxs8ns1.js";import{r as m,s as h}from"./open-file-Bw4xAehe.js";typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(e((window.__REACT_GRAB__??(()=>{if(typeof window>`u`||window.parent===window)return null;try{return window.parent.__REACT_GRAB__??null}catch{return null}})())||c()),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:o()})));export{r as DEFAULT_THEME,p as FreezeError,d as OpenFileError,l as PluginSetupError,u as ReactGrabError,t as commentPlugin,m as formatElementInfo,i as generateSnippet,o as getGlobalApi,h as getStack,c as init,f as isInstrumentationActive,s as openPlugin,n as registerPlugin,e as setGlobalApi,a as unregisterPlugin};
@@ -6,7 +6,7 @@
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
- const e=require(`./freeze-updates-ajWXmT_s.cjs`),t=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,n=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],r=[`rsc://`,`about://React/`],i=[`<anonymous>`,`eval`,``],a=/\.(jsx|tsx|ts|js)$/,o=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,s=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,c=/\(at [^)]+\)$/,l=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],u=/(^|@)\S+:\d+/,d=/^\s*at .*(\S+:\d+|\(native\))/m,f=/^(eval@)?(\[native code\])?$/,p=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
9
+ const e=require(`./freeze-updates-nmbjoxO5.cjs`),t=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,n=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],r=[`rsc://`,`about://React/`],i=[`<anonymous>`,`eval`,``],a=/\.(jsx|tsx|ts|js)$/,o=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,s=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,c=/\(at [^)]+\)$/,l=[`react_stack_bottom_frame`,`react-stack-bottom-frame`],u=/(^|@)\S+:\d+/,d=/^\s*at .*(\S+:\d+|\(native\))/m,f=/^(eval@)?(\[native code\])?$/,p=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
10
10
  `),r=[];for(let e of n)if(/^\s*at\s+/.test(e)){let t=ee(e,void 0)[0];t&&r.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*\(at .*\)$/,``);r.push({functionName:t,source:e})}else if(e.match(u)){let t=te(e,void 0)[0];t&&r.push(t)}return h(r,t)}return e.match(d)?ee(e,t):te(e,t)},m=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},h=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,ee=(e,t)=>h(e.split(`
11
11
  `).filter(e=>!!e.match(d)),t).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=m(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),te=(e,t)=>h(e.split(`
12
12
  `).filter(e=>!e.match(f)),t).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=m(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),ne=new WeakMap,re=e=>l.some(t=>e.includes(t)),ie=e=>{let t=e.getFunctionName?.()??``;if(t)return t;let n=e.getTypeName?.()??``,r=e.getMethodName?.()??``;return n&&r?`${n}.${r}`:r},ae=e=>{let t=[];for(let n=1;n<e.length;n++){let r=e[n],i=ie(r);if(re(i))return{frames:t,isTrusted:!0};if(r.isNative?.()){t.push({functionName:i||void 0});continue}let a=r.getScriptNameOrSourceURL?.()??``;!a&&r.isEval?.()&&(a=r.getEvalOrigin?.()??``),t.push({functionName:i&&i!==`<anonymous>`?i:void 0,fileName:a&&a!==`<anonymous>`?a:void 0,lineNumber:r.getLineNumber?.()??void 0,columnNumber:r.getColumnNumber?.()??void 0,enclosingLineNumber:r.getEnclosingLineNumber?.()??void 0,enclosingColumnNumber:r.getEnclosingColumnNumber?.()??void 0,source:` at ${r.toString()}`})}return{frames:t,isTrusted:!1}},oe=e=>{let t=-1;for(let n of l)if(t=e.indexOf(n),t!==-1)break;return{frames:p(t===-1?e:e.slice(0,e.lastIndexOf(`
@@ -6,7 +6,7 @@
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
- import{B as e,D as t,Gt as n,H as r,Jt as i,K as a,Kt as o,M as s,N as c,U as l,V as u,X as d,Y as f,en as p,gn as m,hn as h,in as ee,jt as te,mn as ne,nn as re,nt as g,ot as ie,q as _,qt as ae,tn as oe,tt as se,z as ce}from"./freeze-updates-BmjaUWo5.js";
9
+ import{B as e,D as t,Gt as n,H as r,Jt as i,K as a,Kt as o,M as s,N as c,U as l,V as u,X as d,Y as f,en as p,gn as m,hn as h,in as ee,jt as te,mn as ne,nn as re,nt as g,ot as ie,q as _,qt as ae,tn as oe,tt as se,z as ce}from"./freeze-updates-Blxs8ns1.js";
10
10
  /**
11
11
  * @license bippy
12
12
  *
@@ -6,5 +6,5 @@
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
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./freeze-updates-ajWXmT_s.cjs`),t=require(`./open-file-djB6VdRN.cjs`),n=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let r=null;const i=new Map,a=()=>r||(r=document.createElement(`iframe`),r.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(r),r),o=t=>{let n=i.get(t);if(n)return n;let r=a(),o=r.contentDocument,s=o.createElement(t);o.body.appendChild(s);let c=r.contentWindow.getComputedStyle(s),l=new Map;for(let t of e.Xt){let e=c.getPropertyValue(t);e&&l.set(t,e)}return s.remove(),i.set(t,l),l},s=(e,t)=>{let r=n.get(e);if(!r)return!1;let i=t.getPropertyValue(`border-${r}-width`);return i===`0px`||i===`0`},c=t=>{let n=o(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let t of e.Xt){let e=r.getPropertyValue(t);e&&e!==n.get(t)&&(s(t,r)||i.push(`${t}: ${e};`))}let a=t.getAttribute(`class`)?.trim(),c=i.join(`
10
- `);return a?c?`className: ${a}\n\n${c}`:`className: ${a}`:c},l=()=>{r?.remove(),r=null,i.clear()},u=async n=>{let[r,i,a]=await Promise.all([t.r(n),t.l(n),t.s(n).then(e=>e??[])]),o=await t.c(n),s=t.u(n),l=t.i(n),u=e.q(n),d=t.p(t.f(n)),f=c(n);return{element:n,snippet:r,htmlPreview:s,stackString:o,stack:a,componentName:l,filePath:i?.filePath??null,lineNumber:i?.lineNumber??null,columnNumber:i?.columnNumber??null,fiber:u,selector:d,styles:f}},d=(t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n))return[];e.h();try{return e.g(t,n)}finally{e.m()}},f=new Set;let p=!1,m=!1,h=!1,g=!1;const _=()=>{e.s([])},v=()=>{if(h)return[];h=!0;let e=Array.from(f).reverse(),t=[],n=[];f.clear();try{for(let r of e)try{r()}catch(e){t.unshift(r),n.push(e)}}finally{for(let e of t)f.add(e);h=!1}return n},y=t=>{if(!(p||m)){m=!0;try{f.add(e.n()),f.add(e.i),e.r(),f.add(_),e.s(t??[document.body]),p=!0}catch(t){let n=v();throw p=f.size>0,new e.j(n.length===0?t:AggregateError([t,...n],`Rolling back page freeze failed`))}finally{m=!1,g&&(g=!1,b())}}},b=()=>{if(m){g=!0;return}if(h)return;let t=v();p=f.size>0;for(let n of t)new e.R(`Unfreezing page failed`,n)},x=()=>p,S=async(e,n)=>{await t.t(e,n)};exports.FreezeError=e.j,exports.OpenFileError=e.N,exports.copyContent=t.n,exports.disposeBaselineStyles=l,exports.freeze=y,exports.getElementContext=u,exports.getElementsAtPosition=d,exports.isFreezeActive=x,exports.openFile=S,exports.unfreeze=b;
9
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./freeze-updates-nmbjoxO5.cjs`),t=require(`./open-file-Bi6PuduG.cjs`),n=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let r=null;const i=new Map,a=()=>r||(r=document.createElement(`iframe`),r.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(r),r),o=t=>{let n=i.get(t);if(n)return n;let r=a(),o=r.contentDocument,s=o.createElement(t);o.body.appendChild(s);let c=r.contentWindow.getComputedStyle(s),l=new Map;for(let t of e.Xt){let e=c.getPropertyValue(t);e&&l.set(t,e)}return s.remove(),i.set(t,l),l},s=(e,t)=>{let r=n.get(e);if(!r)return!1;let i=t.getPropertyValue(`border-${r}-width`);return i===`0px`||i===`0`},c=t=>{let n=o(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let t of e.Xt){let e=r.getPropertyValue(t);e&&e!==n.get(t)&&(s(t,r)||i.push(`${t}: ${e};`))}let a=t.getAttribute(`class`)?.trim(),c=i.join(`
10
+ `);return a?c?`className: ${a}\n\n${c}`:`className: ${a}`:c},l=()=>{r?.remove(),r=null,i.clear()},u=(t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n))return[];e.h();try{return e.g(t,n)}finally{e.m()}},d=(t,n)=>{let r=t;for(;r;){if(r===n)return!0;r=e.pn(r)}return!1},f=(t,n)=>n?.container&&!d(t,n.container)?!1:(n?.filter??e.v)(t),p=t=>e.v(t),m=t=>({...e.Z(t)}),h=e=>t.p(t.f(e)),g=async n=>{let[r,i,a]=await Promise.all([t.r(n),t.l(n),t.s(n).then(e=>e??[])]),o=await t.c(n),s=t.u(n),l=t.i(n),u=e.q(n),d=h(n),f=c(n);return{element:n,snippet:r,htmlPreview:s,stackString:o,stack:a,componentName:l,filePath:i?.filePath??null,lineNumber:i?.lineNumber??null,columnNumber:i?.columnNumber??null,fiber:u,selector:d,styles:f}},_=(e,t,n)=>{let r=u(e,t);for(let e of r)if(f(e,n))return e;return null},v=(e,t,n)=>{let r=u(e,t),i=[];for(let e of r)f(e,n)&&i.push(e);return i},y=(e,t)=>u(e,t),b=new Set;let x=!1,S=!1,C=!1,w=!1;const T=()=>{e.s([])},E=()=>{if(C)return[];C=!0;let e=Array.from(b).reverse(),t=[],n=[];b.clear();try{for(let r of e)try{r()}catch(e){t.unshift(r),n.push(e)}}finally{for(let e of t)b.add(e);C=!1}return n},D=t=>{if(!(x||S)){S=!0;try{b.add(e.n()),b.add(e.i),e.r(),b.add(T),e.s(t??[document.body]),x=!0}catch(t){let n=E();throw x=b.size>0,new e.j(n.length===0?t:AggregateError([t,...n],`Rolling back page freeze failed`))}finally{S=!1,w&&(w=!1,O())}}},O=()=>{if(S){w=!0;return}if(C)return;let t=E();x=b.size>0;for(let n of t)e.u(new e.R(`Unfreezing page failed`,n))},k=()=>x,A=async(e,n)=>{await t.t(e,n)};exports.FreezeError=e.j,exports.OpenFileError=e.N,exports.copyContent=t.n,exports.disposeBaselineStyles=l,exports.freeze=D,exports.getElementAtPoint=_,exports.getElementBounds=m,exports.getElementContext=g,exports.getElementSelector=h,exports.getElementsAtPoint=v,exports.getElementsAtPosition=y,exports.isElementGrabbable=p,exports.isFreezeActive=k,exports.openFile=A,exports.unfreeze=O;
@@ -6,7 +6,7 @@
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
- import { i as Fiber, r as StackFrame, t as copyContent } from "./copy-content-TZDC2S2A.cjs";
9
+ import { i as Fiber, m as ElementBounds, p as ElementAtPointOptions, r as StackFrame, t as copyContent } from "./copy-content-CtYUWe5l.cjs";
10
10
  import { n as OpenFileError, t as FreezeError } from "./errors-CTlIFDQs.cjs";
11
11
 
12
12
  //#region src/utils/extract-element-css.d.ts
@@ -27,6 +27,22 @@ interface ReactGrabElementContext {
27
27
  selector: string | null;
28
28
  styles: string;
29
29
  }
30
+ /**
31
+ * Returns whether an element is a useful selection target. Invisible elements,
32
+ * document roots, React Grab UI, ignored subtrees, and transparent page-covering
33
+ * overlays are excluded.
34
+ */
35
+ declare const isElementGrabbable: (element: Element) => boolean;
36
+ /**
37
+ * Returns viewport bounds in the top-level window, including elements inside
38
+ * transformed same-origin iframes.
39
+ */
40
+ declare const getElementBounds: (element: Element) => ElementBounds;
41
+ /**
42
+ * Returns a stable selector, crossing open shadow roots and same-origin iframes
43
+ * with `>>>` and `>>iframe>>` boundary markers.
44
+ */
45
+ declare const getElementSelector: (element: Element) => string;
30
46
  /**
31
47
  * Gathers comprehensive context for a DOM element — the same context
32
48
  * React Grab copies to the clipboard, plus structured source location
@@ -40,6 +56,25 @@ interface ReactGrabElementContext {
40
56
  * ctx.lineNumber; // 12
41
57
  */
42
58
  declare const getElementContext: (element: Element) => Promise<ReactGrabElementContext>;
59
+ /**
60
+ * Returns the topmost selectable element at viewport coordinates. Hit testing
61
+ * traverses open shadow roots and same-origin iframes and continues past
62
+ * non-grabbable overlays. Pass a filter to replace the default grabbability
63
+ * predicate or a container to confine selection to its composed subtree.
64
+ *
65
+ * @example
66
+ * const element = getElementAtPoint(event.clientX, event.clientY, {
67
+ * container: canvas,
68
+ * filter: (candidate) => isElementGrabbable(candidate) && !toolbar.contains(candidate),
69
+ * });
70
+ */
71
+ declare const getElementAtPoint: (clientX: number, clientY: number, options?: ElementAtPointOptions) => Element | null;
72
+ /**
73
+ * Returns every selectable element at viewport coordinates in paint order,
74
+ * from topmost to bottommost. Uses the same shadow-root, iframe, filter, and
75
+ * container behavior as `getElementAtPoint`.
76
+ */
77
+ declare const getElementsAtPoint: (clientX: number, clientY: number, options?: ElementAtPointOptions) => Element[];
43
78
  /**
44
79
  * Returns all elements at the given viewport coordinates, temporarily
45
80
  * suspending the pointer-events freeze so `elementsFromPoint` can
@@ -49,6 +84,9 @@ declare const getElementContext: (element: Element) => Promise<ReactGrabElementC
49
84
  * freeze();
50
85
  * const elements = getElementsAtPosition(e.clientX, e.clientY);
51
86
  * // elements[0] is the topmost element under the cursor
87
+ *
88
+ * @deprecated Use `getElementsAtPoint` for selectable elements. Pass
89
+ * `{ filter: () => true }` to preserve this function's raw-stack behavior.
52
90
  */
53
91
  declare const getElementsAtPosition: (clientX: number, clientY: number) => Element[];
54
92
  /**
@@ -90,4 +128,4 @@ declare const isFreezeActive: () => boolean;
90
128
  */
91
129
  declare const openFile: (filePath: string, lineNumber?: number) => Promise<void>;
92
130
  //#endregion
93
- export { FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, copyContent, disposeBaselineStyles, freeze, getElementContext, getElementsAtPosition, isFreezeActive, openFile, unfreeze };
131
+ export { type ElementAtPointOptions, type ElementBounds, FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, copyContent, disposeBaselineStyles, freeze, getElementAtPoint, getElementBounds, getElementContext, getElementSelector, getElementsAtPoint, getElementsAtPosition, isElementGrabbable, isFreezeActive, openFile, unfreeze };
@@ -6,7 +6,7 @@
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
- import { i as Fiber, r as StackFrame, t as copyContent } from "./copy-content-3sDfOP1b.js";
9
+ import { i as Fiber, m as ElementBounds, p as ElementAtPointOptions, r as StackFrame, t as copyContent } from "./copy-content-CNRKFr6F.js";
10
10
  import { n as OpenFileError, t as FreezeError } from "./errors-BEgowzRA.js";
11
11
 
12
12
  //#region src/utils/extract-element-css.d.ts
@@ -27,6 +27,22 @@ interface ReactGrabElementContext {
27
27
  selector: string | null;
28
28
  styles: string;
29
29
  }
30
+ /**
31
+ * Returns whether an element is a useful selection target. Invisible elements,
32
+ * document roots, React Grab UI, ignored subtrees, and transparent page-covering
33
+ * overlays are excluded.
34
+ */
35
+ declare const isElementGrabbable: (element: Element) => boolean;
36
+ /**
37
+ * Returns viewport bounds in the top-level window, including elements inside
38
+ * transformed same-origin iframes.
39
+ */
40
+ declare const getElementBounds: (element: Element) => ElementBounds;
41
+ /**
42
+ * Returns a stable selector, crossing open shadow roots and same-origin iframes
43
+ * with `>>>` and `>>iframe>>` boundary markers.
44
+ */
45
+ declare const getElementSelector: (element: Element) => string;
30
46
  /**
31
47
  * Gathers comprehensive context for a DOM element — the same context
32
48
  * React Grab copies to the clipboard, plus structured source location
@@ -40,6 +56,25 @@ interface ReactGrabElementContext {
40
56
  * ctx.lineNumber; // 12
41
57
  */
42
58
  declare const getElementContext: (element: Element) => Promise<ReactGrabElementContext>;
59
+ /**
60
+ * Returns the topmost selectable element at viewport coordinates. Hit testing
61
+ * traverses open shadow roots and same-origin iframes and continues past
62
+ * non-grabbable overlays. Pass a filter to replace the default grabbability
63
+ * predicate or a container to confine selection to its composed subtree.
64
+ *
65
+ * @example
66
+ * const element = getElementAtPoint(event.clientX, event.clientY, {
67
+ * container: canvas,
68
+ * filter: (candidate) => isElementGrabbable(candidate) && !toolbar.contains(candidate),
69
+ * });
70
+ */
71
+ declare const getElementAtPoint: (clientX: number, clientY: number, options?: ElementAtPointOptions) => Element | null;
72
+ /**
73
+ * Returns every selectable element at viewport coordinates in paint order,
74
+ * from topmost to bottommost. Uses the same shadow-root, iframe, filter, and
75
+ * container behavior as `getElementAtPoint`.
76
+ */
77
+ declare const getElementsAtPoint: (clientX: number, clientY: number, options?: ElementAtPointOptions) => Element[];
43
78
  /**
44
79
  * Returns all elements at the given viewport coordinates, temporarily
45
80
  * suspending the pointer-events freeze so `elementsFromPoint` can
@@ -49,6 +84,9 @@ declare const getElementContext: (element: Element) => Promise<ReactGrabElementC
49
84
  * freeze();
50
85
  * const elements = getElementsAtPosition(e.clientX, e.clientY);
51
86
  * // elements[0] is the topmost element under the cursor
87
+ *
88
+ * @deprecated Use `getElementsAtPoint` for selectable elements. Pass
89
+ * `{ filter: () => true }` to preserve this function's raw-stack behavior.
52
90
  */
53
91
  declare const getElementsAtPosition: (clientX: number, clientY: number) => Element[];
54
92
  /**
@@ -90,4 +128,4 @@ declare const isFreezeActive: () => boolean;
90
128
  */
91
129
  declare const openFile: (filePath: string, lineNumber?: number) => Promise<void>;
92
130
  //#endregion
93
- export { FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, copyContent, disposeBaselineStyles, freeze, getElementContext, getElementsAtPosition, isFreezeActive, openFile, unfreeze };
131
+ export { type ElementAtPointOptions, type ElementBounds, FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, copyContent, disposeBaselineStyles, freeze, getElementAtPoint, getElementBounds, getElementContext, getElementSelector, getElementsAtPoint, getElementsAtPosition, isElementGrabbable, isFreezeActive, openFile, unfreeze };
@@ -6,5 +6,5 @@
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
- import{N as e,R as t,Xt as n,g as r,h as i,i as a,j as o,m as s,n as c,q as l,r as u,s as d}from"./freeze-updates-BmjaUWo5.js";import{c as f,f as p,i as m,l as h,n as g,p as _,r as v,s as y,t as b,u as x}from"./open-file-CWAKzV7d.js";const S=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let C=null;const w=new Map,T=()=>C||(C=document.createElement(`iframe`),C.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(C),C),E=e=>{let t=w.get(e);if(t)return t;let r=T(),i=r.contentDocument,a=i.createElement(e);i.body.appendChild(a);let o=r.contentWindow.getComputedStyle(a),s=new Map;for(let e of n){let t=o.getPropertyValue(e);t&&s.set(e,t)}return a.remove(),w.set(e,s),s},D=(e,t)=>{let n=S.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},O=e=>{let t=E(e.tagName.toLowerCase()),r=getComputedStyle(e),i=[];for(let e of n){let n=r.getPropertyValue(e);n&&n!==t.get(e)&&(D(e,r)||i.push(`${e}: ${n};`))}let a=e.getAttribute(`class`)?.trim(),o=i.join(`
10
- `);return a?o?`className: ${a}\n\n${o}`:`className: ${a}`:o},k=()=>{C?.remove(),C=null,w.clear()},A=async e=>{let[t,n,r]=await Promise.all([v(e),h(e),y(e).then(e=>e??[])]),i=await f(e),a=x(e),o=m(e),s=l(e),c=_(p(e)),u=O(e);return{element:e,snippet:t,htmlPreview:a,stackString:i,stack:r,componentName:o,filePath:n?.filePath??null,lineNumber:n?.lineNumber??null,columnNumber:n?.columnNumber??null,fiber:s,selector:c,styles:u}},j=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return[];i();try{return r(e,t)}finally{s()}},M=new Set;let N=!1,P=!1,F=!1,I=!1;const L=()=>{d([])},R=()=>{if(F)return[];F=!0;let e=Array.from(M).reverse(),t=[],n=[];M.clear();try{for(let r of e)try{r()}catch(e){t.unshift(r),n.push(e)}}finally{for(let e of t)M.add(e);F=!1}return n},z=e=>{if(!(N||P)){P=!0;try{M.add(c()),M.add(a),u(),M.add(L),d(e??[document.body]),N=!0}catch(e){let t=R();throw N=M.size>0,new o(t.length===0?e:AggregateError([e,...t],`Rolling back page freeze failed`))}finally{P=!1,I&&(I=!1,B())}}},B=()=>{if(P){I=!0;return}if(F)return;let e=R();N=M.size>0;for(let n of e)new t(`Unfreezing page failed`,n)},V=()=>N,H=async(e,t)=>{await b(e,t)};export{o as FreezeError,e as OpenFileError,g as copyContent,k as disposeBaselineStyles,z as freeze,A as getElementContext,j as getElementsAtPosition,V as isFreezeActive,H as openFile,B as unfreeze};
9
+ import{N as e,R as t,Xt as n,Z as r,g as i,h as a,i as o,j as s,m as c,n as l,pn as u,q as d,r as f,s as p,u as m,v as h}from"./freeze-updates-Blxs8ns1.js";import{c as g,f as _,i as v,l as y,n as b,p as x,r as S,s as C,t as w,u as T}from"./open-file-Bw4xAehe.js";const E=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let D=null;const O=new Map,k=()=>D||(D=document.createElement(`iframe`),D.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(D),D),A=e=>{let t=O.get(e);if(t)return t;let r=k(),i=r.contentDocument,a=i.createElement(e);i.body.appendChild(a);let o=r.contentWindow.getComputedStyle(a),s=new Map;for(let e of n){let t=o.getPropertyValue(e);t&&s.set(e,t)}return a.remove(),O.set(e,s),s},j=(e,t)=>{let n=E.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},M=e=>{let t=A(e.tagName.toLowerCase()),r=getComputedStyle(e),i=[];for(let e of n){let n=r.getPropertyValue(e);n&&n!==t.get(e)&&(j(e,r)||i.push(`${e}: ${n};`))}let a=e.getAttribute(`class`)?.trim(),o=i.join(`
10
+ `);return a?o?`className: ${a}\n\n${o}`:`className: ${a}`:o},N=()=>{D?.remove(),D=null,O.clear()},P=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return[];a();try{return i(e,t)}finally{c()}},F=(e,t)=>{let n=e;for(;n;){if(n===t)return!0;n=u(n)}return!1},I=(e,t)=>t?.container&&!F(e,t.container)?!1:(t?.filter??h)(e),L=e=>h(e),R=e=>({...r(e)}),z=e=>x(_(e)),B=async e=>{let[t,n,r]=await Promise.all([S(e),y(e),C(e).then(e=>e??[])]),i=await g(e),a=T(e),o=v(e),s=d(e),c=z(e),l=M(e);return{element:e,snippet:t,htmlPreview:a,stackString:i,stack:r,componentName:o,filePath:n?.filePath??null,lineNumber:n?.lineNumber??null,columnNumber:n?.columnNumber??null,fiber:s,selector:c,styles:l}},V=(e,t,n)=>{let r=P(e,t);for(let e of r)if(I(e,n))return e;return null},H=(e,t,n)=>{let r=P(e,t),i=[];for(let e of r)I(e,n)&&i.push(e);return i},U=(e,t)=>P(e,t),W=new Set;let G=!1,K=!1,q=!1,J=!1;const Y=()=>{p([])},X=()=>{if(q)return[];q=!0;let e=Array.from(W).reverse(),t=[],n=[];W.clear();try{for(let r of e)try{r()}catch(e){t.unshift(r),n.push(e)}}finally{for(let e of t)W.add(e);q=!1}return n},Z=e=>{if(!(G||K)){K=!0;try{W.add(l()),W.add(o),f(),W.add(Y),p(e??[document.body]),G=!0}catch(e){let t=X();throw G=W.size>0,new s(t.length===0?e:AggregateError([e,...t],`Rolling back page freeze failed`))}finally{K=!1,J&&(J=!1,Q())}}},Q=()=>{if(K){J=!0;return}if(q)return;let e=X();G=W.size>0;for(let n of e)m(new t(`Unfreezing page failed`,n))},$=()=>G,ee=async(e,t)=>{await w(e,t)};export{s as FreezeError,e as OpenFileError,b as copyContent,N as disposeBaselineStyles,Z as freeze,V as getElementAtPoint,R as getElementBounds,B as getElementContext,z as getElementSelector,H as getElementsAtPoint,U as getElementsAtPosition,L as isElementGrabbable,$ as isFreezeActive,ee as openFile,Q as unfreeze};