react-grab 0.1.49-dev.c704a67 → 0.1.49

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/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,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./core-ICddiuc-.js";import{B as l,G as u,H as d,K as f,it as p}from"./freeze-updates-BG_wQYjL.js";import{r as m,s as h}from"./open-file-ST9byhOS.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,l as FreezeError,d as OpenFileError,u as PluginSetupError,f as ReactGrabError,t as commentPlugin,m as formatElementInfo,i as generateSnippet,o as getGlobalApi,h as getStack,c as init,p as isInstrumentationActive,s as openPlugin,n as registerPlugin,e as setGlobalApi,a 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-BWHKYMNj.js";import{B as l,G as u,H as d,K as f,it as p}from"./freeze-updates-BVpP20ot.js";import{r as m,s as h}from"./open-file-B-67eaOe.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,l as FreezeError,d as OpenFileError,u as PluginSetupError,f as ReactGrabError,t as commentPlugin,m as formatElementInfo,i as generateSnippet,o as getGlobalApi,h as getStack,c as init,p 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
- import{$ as e,H as t,I as n,J as r,N as i,V as a,Wt as o,X as s,Y as c,_n as l,an as u,et as d,ft as f,hn as p,ht as m,in as h,it as g,lt as ee,mn as te,mt as ne,on as re,pn as ie,rt as _,sn as ae,st as v,tt as y,ut as oe,yt as se}from"./freeze-updates-BG_wQYjL.js";
9
+ import{$ as e,H as t,I as n,J as r,N as i,V as a,Wt as o,X as s,Y as c,_n as l,an as u,et as d,ft as f,hn as p,ht as m,in as h,it as g,lt as ee,mn as te,mt as ne,on as re,pn as ie,rt as _,sn as ae,st as v,tt as y,ut as oe,yt as se}from"./freeze-updates-BVpP20ot.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-sokrLTw8.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-B8sLUUT5.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,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-sokrLTw8.cjs`),t=require(`./open-file-BumkIdCE.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.ln){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=>{if(e.$(t)?.supportsDomEditing===!1)return``;let n=o(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let t of e.ln){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(`
9
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./freeze-updates-B8sLUUT5.cjs`),t=require(`./open-file-yS_XhtcV.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.ln){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=>{if(e.$(t)?.supportsDomEditing===!1)return``;let n=o(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let t of e.ln){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
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.v();try{return e.y(t,n)}finally{e._()}},d=(t,n)=>{let r=e.$(t)?.hostElement??t;for(;r;){if(r===n)return!0;r=e.M(r)}return!1},f=(t,n)=>n?.container&&!d(t,n.container)?!1:(n?.filter??e.x)(t),p=t=>e.x(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.et(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}},_=(t,n,r)=>{let i=u(t,n);for(let a of i){let i=e.g(a,t,n);if(f(i,r))return i;if(i!==a&&f(a,r))return a}return null},v=(t,n,r)=>{let i=u(t,n),a=[];for(let o of i){let i=e.g(o,t,n);if(f(i,r)){a.push(i);continue}i!==o&&f(o,r)&&a.push(o)}return a},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.B(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.d(new e.q(`Unfreezing page failed`,n))},k=()=>x,A=async(e,n)=>{await t.t(e,n)};exports.FreezeError=e.B,exports.OpenFileError=e.H,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.registerThreeScene=e.h,exports.unfreeze=O;
@@ -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{$ as e,B as t,H as n,M as r,Z as i,_ as a,d as o,et as s,g as c,h as l,i as u,ln as d,n as f,q as p,r as m,s as h,v as g,x as _,y as v}from"./freeze-updates-BG_wQYjL.js";import{c as y,f as b,i as x,l as S,n as C,p as w,r as T,s as ee,t as E,u as D}from"./open-file-ST9byhOS.js";const O=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let k=null;const A=new Map,j=()=>k||(k=document.createElement(`iframe`),k.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(k),k),M=e=>{let t=A.get(e);if(t)return t;let n=j(),r=n.contentDocument,i=r.createElement(e);r.body.appendChild(i);let a=n.contentWindow.getComputedStyle(i),o=new Map;for(let e of d){let t=a.getPropertyValue(e);t&&o.set(e,t)}return i.remove(),A.set(e,o),o},N=(e,t)=>{let n=O.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},P=t=>{if(e(t)?.supportsDomEditing===!1)return``;let n=M(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let e of d){let t=r.getPropertyValue(e);t&&t!==n.get(e)&&(N(e,r)||i.push(`${e}: ${t};`))}let a=t.getAttribute(`class`)?.trim(),o=i.join(`
9
+ import{$ as e,B as t,H as n,M as r,Z as i,_ as a,d as o,et as s,g as c,h as l,i as u,ln as d,n as f,q as p,r as m,s as h,v as g,x as _,y as v}from"./freeze-updates-BVpP20ot.js";import{c as y,f as b,i as x,l as S,n as C,p as w,r as T,s as ee,t as E,u as D}from"./open-file-B-67eaOe.js";const O=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let k=null;const A=new Map,j=()=>k||(k=document.createElement(`iframe`),k.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(k),k),M=e=>{let t=A.get(e);if(t)return t;let n=j(),r=n.contentDocument,i=r.createElement(e);r.body.appendChild(i);let a=n.contentWindow.getComputedStyle(i),o=new Map;for(let e of d){let t=a.getPropertyValue(e);t&&o.set(e,t)}return i.remove(),A.set(e,o),o},N=(e,t)=>{let n=O.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},P=t=>{if(e(t)?.supportsDomEditing===!1)return``;let n=M(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let e of d){let t=r.getPropertyValue(e);t&&t!==n.get(e)&&(N(e,r)||i.push(`${e}: ${t};`))}let a=t.getAttribute(`class`)?.trim(),o=i.join(`
10
10
  `);return a?o?`className: ${a}\n\n${o}`:`className: ${a}`:o},F=()=>{k?.remove(),k=null,A.clear()},I=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return[];g();try{return v(e,t)}finally{a()}},L=(t,n)=>{let i=e(t)?.hostElement??t;for(;i;){if(i===n)return!0;i=r(i)}return!1},R=(e,t)=>t?.container&&!L(e,t.container)?!1:(t?.filter??_)(e),z=e=>_(e),B=e=>({...i(e)}),V=e=>w(b(e)),H=async e=>{let[t,n,r]=await Promise.all([T(e),S(e),ee(e).then(e=>e??[])]),i=await y(e),a=D(e),o=x(e),c=s(e),l=V(e),u=P(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:c,selector:l,styles:u}},U=(e,t,n)=>{let r=I(e,t);for(let i of r){let r=c(i,e,t);if(R(r,n))return r;if(r!==i&&R(i,n))return i}return null},W=(e,t,n)=>{let r=I(e,t),i=[];for(let a of r){let r=c(a,e,t);if(R(r,n)){i.push(r);continue}r!==a&&R(a,n)&&i.push(a)}return i},G=(e,t)=>I(e,t),K=new Set;let q=!1,J=!1,Y=!1,X=!1;const Z=()=>{h([])},Q=()=>{if(Y)return[];Y=!0;let e=Array.from(K).reverse(),t=[],n=[];K.clear();try{for(let r of e)try{r()}catch(e){t.unshift(r),n.push(e)}}finally{for(let e of t)K.add(e);Y=!1}return n},te=e=>{if(!(q||J)){J=!0;try{K.add(f()),K.add(u),m(),K.add(Z),h(e??[document.body]),q=!0}catch(e){let n=Q();throw q=K.size>0,new t(n.length===0?e:AggregateError([e,...n],`Rolling back page freeze failed`))}finally{J=!1,X&&(X=!1,$())}}},$=()=>{if(J){X=!0;return}if(Y)return;let e=Q();q=K.size>0;for(let t of e)o(new p(`Unfreezing page failed`,t))},ne=()=>q,re=async(e,t)=>{await E(e,t)};export{t as FreezeError,n as OpenFileError,C as copyContent,F as disposeBaselineStyles,te as freeze,U as getElementAtPoint,B as getElementBounds,H as getElementContext,V as getElementSelector,W as getElementsAtPoint,G as getElementsAtPosition,z as isElementGrabbable,ne as isFreezeActive,re as openFile,l as registerThreeScene,$ as unfreeze};