react-grab 0.1.48-dev.e2bb01e → 0.1.48-dev.e563133
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 +58 -17
- package/dist/{copy-content-CNRKFr6F.d.ts → copy-content-3sDfOP1b.d.ts} +1 -12
- package/dist/{copy-content-CtYUWe5l.d.cts → copy-content-TZDC2S2A.d.cts} +1 -12
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/core-CzNdf_9v.js +14 -0
- package/dist/core-Duvvh_P0.cjs +14 -0
- package/dist/execute-context-menu-action-BAFetckA.js +9 -0
- package/dist/{execute-context-menu-action-Dktxtbqq.cjs → execute-context-menu-action-qMuJC5wG.cjs} +1 -1
- package/dist/freeze-updates-BmjaUWo5.js +52 -0
- package/dist/freeze-updates-ajWXmT_s.cjs +52 -0
- package/dist/{index-BgTe-uWs.d.cts → index-DDf5jObx.d.cts} +1 -1
- package/dist/{index-CdWMNcJF.d.ts → index-DWvC_uKW.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.global.js +20 -20
- package/dist/index.js +1 -1
- package/dist/{open-file-Cs5OcyVU.js → open-file-CWAKzV7d.js} +1 -1
- package/dist/{open-file-D6m-0Nc1.cjs → open-file-djB6VdRN.cjs} +1 -1
- package/dist/primitives.cjs +2 -2
- package/dist/primitives.d.cts +2 -40
- package/dist/primitives.d.ts +2 -40
- package/dist/primitives.js +2 -2
- package/dist/{renderer-CASmhdv6.js → renderer-B0TpSoAf.js} +1 -1
- package/dist/{renderer-mgPyc6m-.cjs → renderer-BqkijmsE.cjs} +1 -1
- package/package.json +2 -2
- package/dist/core-D3Hts6Z4.js +0 -14
- package/dist/core-DghMRNwf.cjs +0 -14
- package/dist/execute-context-menu-action-DuH-9-Q8.js +0 -9
- package/dist/freeze-updates-DvgmOybu.cjs +0 -52
- package/dist/freeze-updates-Qf-TlIHs.js +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-
|
|
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};
|
|
@@ -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-
|
|
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";
|
|
10
10
|
/**
|
|
11
11
|
* @license bippy
|
|
12
12
|
*
|
|
@@ -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-
|
|
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(`
|
|
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(`
|
package/dist/primitives.cjs
CHANGED
|
@@ -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-
|
|
10
|
-
`);return a?c?`className: ${a}\n\n${c}`:`className: ${a}`:c},l=()=>{r?.remove(),r=null,i.clear()},u=
|
|
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;
|
package/dist/primitives.d.cts
CHANGED
|
@@ -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,
|
|
9
|
+
import { i as Fiber, r as StackFrame, t as copyContent } from "./copy-content-TZDC2S2A.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,22 +27,6 @@ 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;
|
|
46
30
|
/**
|
|
47
31
|
* Gathers comprehensive context for a DOM element — the same context
|
|
48
32
|
* React Grab copies to the clipboard, plus structured source location
|
|
@@ -56,25 +40,6 @@ declare const getElementSelector: (element: Element) => string;
|
|
|
56
40
|
* ctx.lineNumber; // 12
|
|
57
41
|
*/
|
|
58
42
|
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[];
|
|
78
43
|
/**
|
|
79
44
|
* Returns all elements at the given viewport coordinates, temporarily
|
|
80
45
|
* suspending the pointer-events freeze so `elementsFromPoint` can
|
|
@@ -84,9 +49,6 @@ declare const getElementsAtPoint: (clientX: number, clientY: number, options?: E
|
|
|
84
49
|
* freeze();
|
|
85
50
|
* const elements = getElementsAtPosition(e.clientX, e.clientY);
|
|
86
51
|
* // 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.
|
|
90
52
|
*/
|
|
91
53
|
declare const getElementsAtPosition: (clientX: number, clientY: number) => Element[];
|
|
92
54
|
/**
|
|
@@ -128,4 +90,4 @@ declare const isFreezeActive: () => boolean;
|
|
|
128
90
|
*/
|
|
129
91
|
declare const openFile: (filePath: string, lineNumber?: number) => Promise<void>;
|
|
130
92
|
//#endregion
|
|
131
|
-
export {
|
|
93
|
+
export { FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, copyContent, disposeBaselineStyles, freeze, getElementContext, getElementsAtPosition, isFreezeActive, openFile, unfreeze };
|
package/dist/primitives.d.ts
CHANGED
|
@@ -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,
|
|
9
|
+
import { i as Fiber, r as StackFrame, t as copyContent } from "./copy-content-3sDfOP1b.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,22 +27,6 @@ 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;
|
|
46
30
|
/**
|
|
47
31
|
* Gathers comprehensive context for a DOM element — the same context
|
|
48
32
|
* React Grab copies to the clipboard, plus structured source location
|
|
@@ -56,25 +40,6 @@ declare const getElementSelector: (element: Element) => string;
|
|
|
56
40
|
* ctx.lineNumber; // 12
|
|
57
41
|
*/
|
|
58
42
|
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[];
|
|
78
43
|
/**
|
|
79
44
|
* Returns all elements at the given viewport coordinates, temporarily
|
|
80
45
|
* suspending the pointer-events freeze so `elementsFromPoint` can
|
|
@@ -84,9 +49,6 @@ declare const getElementsAtPoint: (clientX: number, clientY: number, options?: E
|
|
|
84
49
|
* freeze();
|
|
85
50
|
* const elements = getElementsAtPosition(e.clientX, e.clientY);
|
|
86
51
|
* // 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.
|
|
90
52
|
*/
|
|
91
53
|
declare const getElementsAtPosition: (clientX: number, clientY: number) => Element[];
|
|
92
54
|
/**
|
|
@@ -128,4 +90,4 @@ declare const isFreezeActive: () => boolean;
|
|
|
128
90
|
*/
|
|
129
91
|
declare const openFile: (filePath: string, lineNumber?: number) => Promise<void>;
|
|
130
92
|
//#endregion
|
|
131
|
-
export {
|
|
93
|
+
export { FreezeError, OpenFileError, ReactGrabElementContext, type StackFrame, copyContent, disposeBaselineStyles, freeze, getElementContext, getElementsAtPosition, isFreezeActive, openFile, unfreeze };
|
package/dist/primitives.js
CHANGED
|
@@ -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,
|
|
10
|
-
`);return a?o?`className: ${a}\n\n${o}`:`className: ${a}`:o},
|
|
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};
|